/* Shared components for STAR Prints by CHA Prints: the page itself, the header,
 * the footer, buttons, links, the stage and the "Don't see it?" block. Every
 * page carries the same markup for these.
 *
 * 🔴 NO SHADOWS, of any kind, on any element or any text. Separation comes from
 *    color and from space. A soft shadow under a rounded card is the single
 *    clearest tell of a generated page, and the brief rules it out.
 *    checks/check-1a.sh scans for the three CSS properties that make one, so
 *    they are not even named here: a commented-out shadow is a shadow waiting
 *    to be uncommented.
 * 🔴 NO hex colors here. Every color is a token from tokens.css.
 * 🔴 No vh/svh/dvh/lvh: a viewport-height box on a phone jumps when the URL bar
 *    slides away.
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--dusk);
}

body {
  margin: 0;
  background: var(--white);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: var(--line-body);
  font-weight: 400;
}

/* ---- headings: League Spartan 700, sentence case ------------------------ */
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: var(--size-display);
  line-height: var(--line-display);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--size-h2);
  line-height: var(--line-h2);
  letter-spacing: -0.02em;
}

h3 {
  font-size: var(--size-h3);
  line-height: var(--line-h3);
}

p {
  margin: 0;
  max-width: var(--measure);
}

.lede {
  font-size: var(--size-lede);
  line-height: var(--line-lede);
}

.small {
  font-size: var(--size-small);
  line-height: var(--line-small);
  font-weight: 600;
}

/* Prices never wobble as their digits change: League Spartan has no tabular
   figures, which is why no price is ever set in it. */
.price,
.row-price {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- focus: always visible --------------------------------------------- */
:focus-visible {
  outline: var(--focus-width) solid var(--ink);
  outline-offset: 2px;
}

.on-dark :focus-visible {
  outline-color: var(--sky);
}

/* ---- links -------------------------------------------------------------- */
/* Underlined, never shown by color alone. */
a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* 🔴 :where() ON PURPOSE -- it contributes no specificity, so this rule weighs
   exactly as much as the bare `a` above it. Written as `.on-dark a` it scored
   higher than .btn and .nav-link and repainted them Sky: the stage button came
   out Sky text on a Sky fill, invisible (contrast 1.0, caught by
   check-1a-browser.sh). A surface rule must never outrank a component. */
:where(.on-dark) a {
  color: var(--sky);
}

/* A link whose page does not exist yet looks exactly like the live one and goes
   nowhere. The slice that builds the page swaps data-pending for href. */
a[data-pending] {
  cursor: default;
}

/* ---- buttons: one rule per surface, and no arrows ----------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 48px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-button);
  background: var(--navy);
  color: var(--white);
  font-family: var(--font-body);
  font-size: var(--size-body);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border: 0;
}

.btn-stage {
  background: var(--sky);
  color: var(--midnight);
}

.on-dark .btn-stage:focus-visible {
  outline-color: var(--sky);
}

/* ---- the stage ---------------------------------------------------------- */
.stage {
  background: var(--stage);
  border-radius: var(--radius-stage);
  color: var(--white);
}

/* Edge to edge: no radius, because there are no edges to round. */
.stage-edge {
  border-radius: 0;
}

.on-dark h1,
.on-dark h2,
.on-dark h3 {
  color: var(--white);
}

.on-dark .lede,
.on-dark .small {
  color: var(--haze);
}

/* ---- page width --------------------------------------------------------- */
.wrap {
  max-width: var(--content-max);
  margin: 0 auto;
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}

/* Sections stack: each opens a gap above itself, and only the last one closes a
   gap below, so two neighbours never add up to a double gap. */
.section {
  padding-top: var(--section-gap);
}

.section:last-of-type {
  padding-bottom: var(--section-gap);
}

/* The stage's edge already separates the hero from what follows, and the hero
   carries its own bottom padding, so a second full gap here just reads as a
   hole in the page. */
.hero + .section {
  padding-top: var(--space-10);
}

/* ---- the hero: the header melts into it, both starting at Midnight ------ */
.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding-top: var(--space-8);
  padding-bottom: var(--space-8);
}

.hero-inner .lede {
  max-width: 46ch;
  text-wrap: balance;
}

.hero-logo {
  display: block;
  height: 240px;
  width: auto;
  margin-bottom: var(--space-2);
}

@media (min-width: 768px) {
  .hero-logo {
    height: 320px;
  }

  .hero-inner {
    padding-top: var(--space-12);
    padding-bottom: var(--space-12);
  }
}

/* ---- header ------------------------------------------------------------- */
.site-header {
  background: var(--midnight);
  /* The shipping line is positioned against this on desktop. Without it,
     right: 0 resolved against the viewport and the line ran off the screen. */
  position: relative;
}

/* 🔴 overflow: clip is load-bearing. The "By CHA PRINTS" tap box deliberately
   runs DOWN past the logo into the empty bar; this is what stops it at the
   bar's bottom edge instead of letting it sit invisibly over the page. */
.site-header-bar {
  height: 64px;
  overflow: clip;
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}

.site-header-inner {
  position: relative;
  max-width: var(--content-max);
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Without overflow: visible the tap box is clipped to the logo's own box, and
   the whole point of it is that it is bigger than the logo. */
.site-logo {
  display: block;
  height: 40px;
  width: auto;
  flex: none;
  overflow: visible;
}

.focus-ring {
  stroke: transparent;
}

a:focus-visible .focus-ring {
  stroke: var(--sky);
  stroke-width: 3px;
  vector-effect: non-scaling-stroke;
}

a:focus-visible .hit {
  outline: none;
}

.site-logo a:focus-visible {
  outline: none;
}

@media (hover: hover) {
  .logo-cha:hover .underline {
    stroke: var(--sky);
  }
}

.site-nav {
  display: flex;
  align-self: flex-start;
  height: 48px;
  align-items: center;
}

/* Shop and Cart at every width. With two links a menu would only hide one. */
.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  color: var(--white);
  font-weight: 600;
  font-size: var(--size-body);
  text-decoration: none;
}

.nav-link:focus-visible {
  outline-color: var(--sky);
}

/* Phone: its own strip under the bar, so the bar's clip never touches it.
   🔴 pointer-events: none. This line is never interactive, and on desktop it is
   positioned over the header bar -- a full-width box here swallowed the "By CHA
   PRINTS" tap area and cut it from 29px to 4.5px (caught by check-1a-browser.sh).
   Decorative text must never take a tap meant for a link underneath it. */
.ship-note {
  pointer-events: none;
  color: var(--sky);
  font-weight: 600;
  font-size: var(--size-small);
  line-height: 20px;
  max-width: none;
  padding: 0 var(--space-2) var(--space-1);
}

@media (min-width: 768px) {
  .site-header-bar {
    height: 72px;
  }

  .site-logo {
    height: 48px;
  }

  /* Desktop: inside the 72px bar -- a 48px nav row with the line under it.
     It lines up with the nav above it by sitting in a box of the same width as
     the bar's content, centred the same way. */
  .ship-note {
    position: absolute;
    top: 48px;
    /* Flush with the nav's right edge: the bar's 16px padding, plus whatever the
       1120px content column is inset by once the header is wider than that.
       It shrink-wraps, so it never reaches across into the logo's half. */
    right: max(var(--space-2),
               calc(var(--space-2) + (100% - var(--space-4) - var(--content-max)) / 2));
    padding: 0;
    text-align: right;
  }
}

@media (max-width: 374px) {
  .site-header-bar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .ship-note {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* ---- rows: a plain list, one tap each ----------------------------------- */
.row-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--hairline);
}

.row-list li {
  border-bottom: 1px solid var(--hairline);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 48px;
  /* The tint reaches past the text on both sides; the negative margin keeps the
     text itself on the page's left edge. */
  padding: var(--space-2);
  margin-inline: calc(-1 * var(--space-2));
  border-radius: var(--radius-row);
  color: var(--navy);
  font-weight: 600;
  text-decoration: none;
}

/* Seven rows that are each a whole tap need to say so on a pointer device.
   Mist is the brief's own selected-option fill, so the hover reads as part of
   the same system -- and it is a fill, not a shadow. */
@media (hover: hover) {
  .row:hover {
    background: var(--mist);
  }
}

.row-price {
  color: var(--dusk);
  font-weight: 400;
  white-space: nowrap;
}

/* ---- "Don't see it?" ---------------------------------------------------- */
.no-see {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
}

.no-see-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.no-see-actions .link {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
}

/* ---- footer: the page ends like the card -------------------------------- */
/* Phones: one centered column. From 768px: centered, links and © at right. */
.site-footer {
  background: var(--stage);
  color: var(--white);
  padding-top: var(--space-5);
  padding-bottom: var(--space-4);
}

.site-footer .footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  text-align: center;
}

.site-footer img {
  display: block;
  height: 160px;
  width: auto;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: var(--space-4);
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
}

.fine-print {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding-top: var(--space-2);
  border-top: 1px solid color-mix(in srgb, var(--haze) 24%, transparent);
  color: var(--haze);
}

@media (min-width: 768px) {
  .site-footer .footer-inner,
  .fine-print {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .site-footer .footer-inner {
    row-gap: var(--space-3);
  }

  .site-footer img,
  .fine-print :first-child {
    grid-column: 2;
  }

  .footer-links,
  .fine-print :last-child {
    justify-self: end;
  }

  .fine-print {
    grid-column: 1 / -1;
  }
}
