/* ---------- The cookie strip (plan 2026-11-11-2305 U11, KTD14; docs/site-relaunch/round-three/specs/shell.md §6).
   app/components/consent/ConsentBanner.tsx is shared with the product and is not edited: on site pages its first-visit
   bar is restyled by this sheet alone. Linked on every site page through the round-three seam (SITE_ROUND_THREE_CSS,
   KTD16). Every selector starts with body[data-site] (set by lib/site/compose.ts's bootstrap), so a product page renders
   the banner exactly as before. The banner's inner elements carry generated class names, so they are selected by
   structure only:
     the bar            section[data-site-chrome="consent"][aria-describedby]
                        > h2 (screen-reader title), [div (the "More" text, while open)], div:last-child (the row)
     the row            > p (the line and its More button), > div (the two choices, Reject non-essential then Accept all)
     the choices panel  section[data-site-chrome="consent"][tabindex]   (not restyled)
     the saved note     div[data-site-chrome="consent"]                 (placed only: 16px above the bottom, centered)
   Selectors here outrank the module's (`.bar`, `body[data-site] .bar` from 861 up, `.dark .bar`), so order does not matter.

   Home wears it too (build three, plan 2026-11-11-2305 U13; specs/home.md section 1). Its sheet (home-page.css) lifts the
   hero card, the scene controls, the scroll cue and the phone first-screen block by --consent-h while the strip shows,
   so nothing on Home's first screen sits under it (implementation-notes-r3-U13.md). ---------- */

/* ---- Wide (721px and up): one line, 44px tall (a 1px hairline and a 43px row), across the bottom edge, its contents on
   the page's --wrap and --gutter like .wrap. Square, paper at full opacity, no shadow. Colors are set here, not taken
   from the module, so the dark register's plinth tones never reach the site's paper strip. */
body[data-site] section[data-site-chrome="consent"][aria-describedby] {
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  max-height: calc(100dvh - 48px);
  padding: 0 max(var(--gutter), calc((100% - var(--wrap)) / 2)) env(safe-area-inset-bottom);
  border: 0;
  border-top: 1px solid rgba(21, 23, 28, .14);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: none;
}
body[data-site] section[data-site-chrome="consent"][aria-describedby] > div:last-child {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 16px;
  min-height: 43px;
}
body[data-site] section[data-site-chrome="consent"][aria-describedby] > div:last-child > p {
  flex: 1 1 auto;
  flex-basis: auto;
  min-width: 0;
  max-width: none; /* site.css caps a paragraph's measure; here the line takes the row up to the choices */
  margin: 0;
  font-size: .875rem;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--ink-2);
}
body[data-site] section[data-site-chrome="consent"][aria-describedby] button[aria-expanded] {
  color: var(--sapphire);
}
/* "More" open: the text above the row, as today; the strip grows upward from the bottom edge. */
body[data-site] section[data-site-chrome="consent"][aria-describedby] > div:not(:last-child) {
  padding-top: 10px;
  border-bottom-color: rgba(21, 23, 28, .14);
}
body[data-site] section[data-site-chrome="consent"][aria-describedby] > div:not(:last-child) p {
  color: var(--ink-2);
}
body[data-site] section[data-site-chrome="consent"][aria-describedby] > div:not(:last-child) :is(a, button) {
  color: var(--sapphire);
}
/* The two choices: equal width, size and weight (they stay equal choices), in their order. */
body[data-site] section[data-site-chrome="consent"][aria-describedby] > div:last-child > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: none;
  gap: 8px;
}
body[data-site] section[data-site-chrome="consent"][aria-describedby] > div:last-child > div > button {
  min-width: 0;
  min-height: 32px;
  padding: 4px 14px;
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-size: .8125rem;
  font-weight: 600;
  white-space: nowrap;
}
body[data-site] section[data-site-chrome="consent"][aria-describedby] > div:last-child > div > button:hover {
  background: var(--ink-2);
}

/* ---- Phones (720px and narrower): two tight rows, at most 92px: the line, then the two choices side by side at equal
   width, each at least 40px tall. Full width on the bottom edge, the page gutter inside. */
@media (max-width: 720px) {
  body[data-site] section[data-site-chrome="consent"][aria-describedby] {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    padding: 8px var(--gutter) calc(8px + env(safe-area-inset-bottom));
  }
  body[data-site] section[data-site-chrome="consent"][aria-describedby] > div:last-child {
    flex-wrap: wrap;
    gap: 6px;
    min-height: 0;
  }
  body[data-site] section[data-site-chrome="consent"][aria-describedby] > div:last-child > p {
    flex-basis: 100%;
    white-space: normal;
  }
  body[data-site] section[data-site-chrome="consent"][aria-describedby] > div:last-child > div {
    flex: 1 1 100%;
  }
  body[data-site] section[data-site-chrome="consent"][aria-describedby] > div:last-child > div > button {
    min-height: 40px;
  }
}

/* ---- Nothing hides under it. While the bar shows, --consent-h holds its height (44px wide, 92px phones, the spec's
   ceiling), the footer gets that much more bottom room (site.css's 32px plus the strip) so the page's last line scrolls
   clear, and a first-screen opening scene (the front-door hero, arrive.css) gives up that much height: --ah-hdr is the
   header allowance in arrive.css's section height (69px there, the bar's 68px and its rule), so it grows by the strip.
   arrive.css still never lets the section crop the picture's safe box, so on a screen too short for that box the
   scene may still run under the strip. */
body[data-site]:has(section[data-site-chrome="consent"][aria-describedby]) {
  --consent-h: 44px;
}
@media (max-width: 720px) {
  body[data-site]:has(section[data-site-chrome="consent"][aria-describedby]) {
    --consent-h: 92px;
  }
}
body[data-site]:has(section[data-site-chrome="consent"][aria-describedby]) #site-footer {
  padding-bottom: calc(32px + var(--consent-h));
}
body[data-site]:has(section[data-site-chrome="consent"][aria-describedby]) [data-hero="arrival"] {
  --ah-hdr: calc(69px + var(--consent-h));
}

/* ---- The saved note keeps its look; on site pages it sits 16px above the bottom edge, centered. */
body[data-site] div[data-site-chrome="consent"] {
  left: 50%;
  right: auto;
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
}
@media (max-width: 640px) {
  /* the module turns the note into a full-width sheet under 641px; on site pages it stays the small note */
  body[data-site] div[data-site-chrome="consent"] {
    padding: 12px 16px;
    border-radius: var(--r-card-round);
  }
}
