/* ============================================================================
   The enquiry sheet.

   One dialog carries all four enquiry forms that used to sit inline on the
   homepage. Desktop gets a centred dialog; a phone gets a bottom sheet, which is
   the pattern people already expect from a form on a small screen.

   Loaded after polish-final.css so it can override the inline .panel styling
   without editing rules that the /request page also uses.
   ========================================================================= */

/* ---------------------------------------------------------------- the dialog */

.enquiry-sheet {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(680px, calc(100vw - 32px));
  max-height: min(88dvh, 900px);
  width: 100%;
  overflow: visible;
  color: var(--jz-ink);
}

.enquiry-sheet::backdrop {
  background: rgba(23, 18, 13, .72);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.enquiry-sheet[open] { animation: sheet-in .22s ease-out; }
.enquiry-sheet[open]::backdrop { animation: sheet-fade .22s ease-out; }

@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes sheet-fade { from { opacity: 0; } }

/* Respect a stated preference for less motion. */
@media (prefers-reduced-motion: reduce) {
  .enquiry-sheet[open],
  .enquiry-sheet[open]::backdrop { animation: none; }
}

.sheet-shell {
  display: flex;
  flex-direction: column;
  max-height: min(88dvh, 900px);
  background: var(--jz-paper, #fffdf7);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(23, 18, 13, .34);
}

/* ------------------------------------------------------------------- header */

.sheet-head {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  padding: 22px 22px 16px;
  background: var(--jz-cream, #f8f5ed);
  border-bottom: 1px solid var(--line);
}

.sheet-heading { grid-column: 1; min-width: 0; }

.sheet-head .eyebrow {
  margin: 0 0 6px;
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--jz-paprika);
}

.sheet-head h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3.4vw, 1.85rem);
  line-height: 1.12;
  letter-spacing: -.02em;
}

.sheet-lead {
  margin: 8px 0 0;
  font-size: .95rem;
  line-height: 1.55;
  color: var(--jz-muted);
  max-width: 52ch;
}

/* The close control is the first thing a keyboard reaches, and is at least
   44x44 so it is easy to hit on a phone. */
.sheet-close {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: -6px -6px 0 0;
  padding: 0;
  font-size: 1.7rem;
  line-height: 1;
  color: var(--jz-ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.sheet-close:hover { background: var(--jz-ink); color: var(--jz-paper, #fff); }
.sheet-close:focus-visible { outline: 3px solid var(--jz-paprika); outline-offset: 2px; }

/* The grip is decorative: it hints "drag me down" but the sheet does not
   actually implement a drag gesture, so it is hidden from assistive tech and
   never the only way out. */
.sheet-grip { display: none; }

/* -------------------------------------------------------------------- tabs */

.sheet-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 22px;
  overflow-x: auto;
  scrollbar-width: thin;
  background: var(--jz-cream, #f8f5ed);
  border-bottom: 1px solid var(--line);
}

.sheet-tab {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 16px;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--jz-ink);
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.sheet-tab[aria-selected="true"] {
  background: var(--jz-ink);
  border-color: var(--jz-ink);
  color: var(--jz-paper, #fff);
}

/* -------------------------------------------------------------------- body */

.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 22px 24px;
  /* A sticky submit bar would hide the last field on short screens, so the whole
     body scrolls and the button stays reachable at the end of it. */
  overscroll-behavior: contain;
}

.sheet-panel[hidden] { display: none; }

/* The forms come from enquiry-forms.php, so they carry the same .panel class as
   the standalone /request form. Only the frame is removed here. */
.enquiry-sheet .panel {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}
.enquiry-sheet .panel-h { margin-top: 0; }

/* Labels sit above their field, full width: the two-up grid that suits a wide
   page wastes space and invites mistaps on a narrow sheet. */
.enquiry-sheet .fgrid { grid-template-columns: 1fr; gap: 14px; }
.enquiry-sheet .fgrid > div { grid-column: 1 / -1; }

.enquiry-sheet input,
.enquiry-sheet select,
.enquiry-sheet textarea {
  min-height: 48px;
  font-size: 16px; /* 16px stops iOS Safari zooming on focus. */
  padding: 12px 14px;
}

.enquiry-sheet textarea { min-height: 96px; line-height: 1.5; }

.enquiry-sheet .btn {
  width: 100%;
  min-height: 52px;
  font-size: 1.05rem;
  margin-top: 20px;
}

.enquiry-sheet .sub-note { margin-top: 12px; }

/* ----------------------------------------------------------------- success */

.sheet-success { padding: 28px 24px 30px; }
.sheet-success[hidden] { display: none; }
.sheet-success h3 { margin: 12px 0 10px; font-size: 1.5rem; line-height: 1.15; }
.sheet-success p { margin: 0 0 18px; color: var(--jz-muted); line-height: 1.55; }
.sheet-success-actions { display: grid; gap: 10px; }
.sheet-success .btn { min-height: 52px; font-size: 1.05rem; }
.sheet-success .small-note { margin: 16px 0 0; }

/* ------------------------------------------------------------- phone sheet */

/* Below 640px the dialog becomes a bottom sheet: pinned to the bottom edge,
   square top corners softened, and tall enough that the form is comfortable
   without a pinch-zoom. */
@media (max-width: 640px) {
  .enquiry-sheet {
    max-width: 100%;
    width: 100%;
    margin: auto auto 0;
    max-height: 94dvh;
  }

  .sheet-shell {
    max-height: 94dvh;
    border-radius: 20px 20px 0 0;
  }

  .enquiry-sheet[open] { animation: sheet-rise .26s cubic-bezier(.22, .8, .3, 1); }
  @keyframes sheet-rise { from { transform: translateY(100%); } }

  .sheet-head { padding: 10px 16px 14px; }

  /* The grip sits above the close button and reads as the sheet's handle. */
  .sheet-grip {
    display: block;
    grid-column: 1 / -1;
    width: 44px;
    height: 4px;
    margin: 0 auto 10px;
    background: var(--line);
    border-radius: 999px;
  }

  .sheet-head h2 { font-size: 1.4rem; }
  .sheet-lead { font-size: .92rem; margin-top: 6px; }
  .sheet-tabs { padding: 10px 16px; }
  .sheet-body { padding: 16px 16px 26px; }

  /* Room for the iOS home indicator so the submit button is never underneath it. */
  .sheet-body { padding-bottom: calc(26px + env(safe-area-inset-bottom, 0px)); }
}

/* Landscape phone: a full-height sheet is unusable, so cap it and let it scroll. */
@media (max-height: 480px) {
  .enquiry-sheet, .sheet-shell { max-height: 96dvh; }
  .sheet-lead { display: none; }
}

/* ------------------------------------------------------------- CTA blocks */

.enquiry-cta {
  margin: 26px 0 6px;
  padding: 24px 0 0;
  border-top: 1px solid var(--line);
}

.enquiry-cta-hint {
  margin: 0 0 12px;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--jz-muted);
}

.enquiry-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.enquiry-cta .btn { min-height: 48px; }
.enquiry-cta .sub-note { margin: 12px 0 0; }

/* On the dark sections the rule needs to be light, or it disappears. */
:where(.signature, .dark) .enquiry-cta { border-top-color: rgba(255, 255, 255, .22); }
:where(.signature, .dark) .enquiry-cta .sub-note,
:where(.signature, .dark) .enquiry-cta-hint { color: rgba(255, 255, 255, .82); }

@media (max-width: 560px) {
  .enquiry-cta-actions { flex-direction: column; align-items: stretch; }
  .enquiry-cta .btn { width: 100%; }
}

/* --------------------------------------------- scroll lock while a sheet is up */

/* Applied by app.js to <html> only while the dialog is open. Without it the page
   behind a sheet still scrolls under a finger drag on the backdrop. */
html.enquiry-open { overflow: hidden; }