/* ============================================================
   Shared Priority List Drawer (bayside-664.14.8)
   See ./drawer.js for the JS lifecycle. Colocated with the drawer
   module so the visual contract and the behaviour live side by side.

   Migrated from styles.css per bayside-fgs (shell-to-modules). The
   block below is a verbatim relocation — selectors, values, comments,
   and media-query order are preserved bit-for-bit so the cascade
   lands identical to the pre-migration baseline.

   The legacy `/* /shared/drawer */` end marker that used to live in
   styles.css is gone (the module file boundary makes it redundant).
   ============================================================ */

body.drawer-open {
  overflow: hidden;
}

[data-drawer-root] {
  position: relative;
  z-index: 1000;
}

[data-drawer-overlay] {
  position: fixed;
  inset: 0;
  background: oklch(0.16 0.043 211 / 0.72);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out;
  z-index: 1000;
}

[data-drawer-root][data-drawer-state="open"] [data-drawer-overlay] {
  opacity: 1;
  pointer-events: auto;
}

[data-drawer-panel] {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(85vw, 1080px);
  max-width: 100vw;
  background: var(--paper, #fdfbf7);
  color: var(--ink, #1d1f1c);
  box-shadow: -24px 0 64px rgba(0, 0, 0, 0.18);
  transform: translate3d(100%, 0, 0);
  transition: transform 300ms ease-out;
  z-index: 1001;
  overflow: hidden;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.42fr) auto minmax(0, 0.58fr);
  grid-template-rows: 100%;
}

[data-drawer-root][data-drawer-state="open"] [data-drawer-panel] {
  transform: translate3d(0, 0, 0);
}

/* ── Image panel (left side of the diptych) ───────────────────── */

[data-drawer-image-panel] {
  position: relative;
  overflow: hidden;
  background-color: var(--green);
  background-image: url("../../04-renderings/web/preleasing-spine/drawer/drawer-water-still-v01.jpg");
  background-size: cover;
  background-position: center;
  color: var(--paper);
  min-height: 100%;
}

[data-drawer-image-overlay] {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      to bottom,
      transparent 0%,
      transparent 35%,
      oklch(0.16 0.043 211 / 0.35) 70%,
      oklch(0.16 0.043 211 / 0.62) 100%
    );
  pointer-events: none;
}

[data-drawer-image-copy] {
  position: absolute;
  inset: auto 0 0 0;
  /* Slightly larger bottom padding than the side/top so the headline reads
     as bottom-anchored print-caption rather than stuck against the panel
     edge (per high-end-visual-design skill review for bayside-g8g8). */
  padding: clamp(28px, 4.2vw, 56px) clamp(28px, 4.2vw, 56px)
    clamp(40px, 5vw, 72px);
  display: grid;
  gap: 14px;
}

[data-drawer-image-copy] #drawer-heading {
  margin: 0;
  font-family: var(--display, "Montserrat", sans-serif);
  font-weight: var(--w-display);
  font-size: clamp(36px, 4.6vw, 60px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.05;
  color: var(--paper);
}

[data-drawer-image-copy] [data-drawer-support] {
  margin: 0;
  max-width: 38ch;
  font-size: 14px;
  line-height: 1.55;
  color: oklch(0.95 0.01 73 / 0.86);
}

/* ── Side rail (vertical typographic seam) ────────────────────── */

[data-drawer-side-rail] {
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 0 clamp(8px, 0.9vw, 14px);
  border-left: 1px solid oklch(0.82 0.02 207 / 0.5);
  border-right: 1px solid oklch(0.82 0.02 207 / 0.3);
  background: var(--paper);
  /* B5 (bayside-dfgz.15): WCAG 1.4.3 — turquoise on paper reads 2.54:1
     (fails 4.5:1 for 11px uppercase). --green on paper reads ~9.5:1. */
  color: var(--green);
  font-family: var(--condensed, "Barlow Condensed", "Barlow", sans-serif);
  font-weight: var(--w-label);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  user-select: none;
}

/* ── Form panel (right side of the diptych) ───────────────────── */

[data-drawer-form-panel] {
  position: relative;
  overflow-y: auto;
  padding: clamp(48px, 5vw, 72px) clamp(28px, 4vw, 56px);
  background: var(--paper);
}

/* The form module renders its own .priority-list-heading and .priority-list-support
   nodes for the no-JS Scene 10 fallback host. Inside the diptych drawer the heading
   + support copy live in the image panel — hide the form's redundant copies so we
   don't double-render the Track 09 strings. */

[data-drawer-form-panel] .priority-list-heading,
[data-drawer-form-panel] .priority-list-support {
  display: none;
}

[data-drawer-close] {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: 1px solid var(--ink-soft);
  color: var(--ink);
  width: 40px;
  height: 40px;
  border-radius: 0; /* B2 hard-edge mandate (audit 2026-05-14) — was 50% circle */
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  z-index: 2;
}

[data-drawer-close]:focus-visible {
  outline: 2px solid var(--turquoise, #2a8d8a);
  outline-offset: 3px;
}

.priority-list-form-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-width: 560px;
  width: 100%;
}

.priority-list-heading {
  margin: 0;
  font-family: var(--script);
  font-size: clamp(30px, 4vw, 48px);
  font-style: italic;
  font-weight: 400;
  line-height: 1.08;
}

.priority-list-support {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.priority-list-form {
  display: grid;
  gap: 14px;
}

.priority-list-row,
.priority-list-consent-row {
  display: grid;
  gap: 7px;
}

.priority-list-label {
  color: var(--green);
  font-size: 11px;
  font-weight: var(--w-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.priority-list-control {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line-strong);
  background: var(--shell);
  color: var(--ink);
  padding: 12px 14px;
  font: inherit;
}

.priority-list-control[aria-invalid="true"] {
  border-color: oklch(0.58 0.12 28);
  background: oklch(0.97 0.018 41);
}

.priority-list-consent-row {
  position: relative;
  padding: 10px 12px;
  border-radius: 0; /* B2 hard-edge mandate (audit 2026-05-14) — was 4px */
  transition: background-color 200ms ease-out, box-shadow 200ms ease-out;
}

.priority-list-consent-label {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 10px;
  align-items: start;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

.priority-list-consent-label input {
  min-height: 20px;
  margin: 2px 0 0;
  accent-color: var(--green);
}

/* Required-consent failure state — bayside-g8g8.
   When the user submits without checking the consent box, the row gets a
   warm-coral wash + a 3px error rule on the inside-left edge so the
   "this is the gate" affordance is obvious without being hostile. The
   checkbox itself flips to the same error tone. The error message below
   bumps to 14px + brand error red. Pairs with the JS focus-move that
   automatically lands the cursor on the consent input. */
.priority-list-consent-row[data-error="true"] {
  background: oklch(0.97 0.018 41);
  box-shadow: inset 3px 0 0 0 oklch(0.58 0.12 28);
}

.priority-list-consent-row[data-error="true"]
  .priority-list-consent-label
  input {
  accent-color: oklch(0.58 0.12 28);
  outline: 1px solid oklch(0.58 0.12 28);
  outline-offset: 1px;
}

.priority-list-consent-row[data-error="true"] .priority-list-field-error {
  font-size: 14px;
  margin-top: 6px;
}

.priority-list-field-error,
.priority-list-errors {
  margin: 0;
  color: oklch(0.47 0.12 28);
  font-size: 13px;
  font-weight: var(--w-label);
}

@media (prefers-reduced-motion: reduce) {
  .priority-list-consent-row {
    transition: none;
  }
}

.priority-list-submit {
  min-height: 56px;
  margin-top: 6px;
  border: 1px solid var(--green);
  background: var(--green);
  color: var(--paper);
  font: inherit;
  font-size: 13px;
  font-weight: var(--w-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.priority-list-submit:disabled {
  cursor: default;
  opacity: 0.72;
}

/* `display: grid` would override the `hidden` attribute that the drawer
   shell applies before the user submits (HTML `hidden` carries an implicit
   `display: none`, but a more specific display rule wins). The :not() guard
   keeps the drawer's pre-submit state correctly invisible. */
.priority-list-confirmation,
section[data-drawer-confirmation]:not([hidden]) {
  display: grid;
  gap: 14px;
}

.priority-list-confirmation h3,
section[data-drawer-confirmation] h3 {
  margin: 0;
  font-family: var(--script);
  font-size: clamp(30px, 4vw, 46px);
  font-style: italic;
  font-weight: 400;
  line-height: 1.08;
}

.priority-list-confirmation ul,
section[data-drawer-confirmation] ul {
  margin: 0;
  padding-left: 20px;
  color: var(--ink-soft);
  line-height: 1.55;
}

@media (max-width: 720px) {
  [data-drawer-panel] {
    width: 100vw;
    grid-template-columns: 100%;
    grid-template-rows: clamp(260px, 34dvh, 340px) auto 1fr;
    overflow-y: auto;
    transform: translate3d(0, 100%, 0);
  }
  [data-drawer-root][data-drawer-state="open"] [data-drawer-panel] {
    transform: translate3d(0, 0, 0);
  }
  [data-drawer-image-panel] {
    min-height: 0;
  }
  [data-drawer-image-copy] {
    padding: clamp(20px, 5vw, 28px);
    gap: 8px;
  }
  [data-drawer-image-copy] #drawer-heading {
    font-size: clamp(22px, 6vw, 28px);
  }
  [data-drawer-image-copy] [data-drawer-support] {
    max-width: 34ch;
    font-size: clamp(12px, 3.3vw, 13px);
    line-height: 1.42;
  }
  [data-drawer-side-rail] {
    align-self: auto;
    padding: 8px 0;
    border: 0;
    border-top: 1px solid oklch(0.82 0.02 207 / 0.4);
    border-bottom: 1px solid oklch(0.82 0.02 207 / 0.4);
    writing-mode: horizontal-tb;
    transform: none;
    letter-spacing: 0.28em;
    background: var(--shell);
  }
  [data-drawer-form-panel] {
    /* Top padding leaves clearance for the absolute-positioned close button
       (40px button + 16px inset + 8px breathing room). */
    padding: 64px clamp(20px, 5vw, 32px) clamp(20px, 5vw, 32px);
    overflow-y: visible;
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-drawer-overlay],
  [data-drawer-panel] {
    transition: none;
  }
}

[data-drawer-root][data-reduced-motion="true"] [data-drawer-overlay],
[data-drawer-root][data-reduced-motion="true"] [data-drawer-panel] {
  transition: none;
}
