/* Sparkpole. Tokens and rules come from landing/DESIGN.md. */
:root {
  --ground: oklch(0.968 0.006 165);
  --ink: oklch(0.235 0.025 165);
  --ink-2: oklch(0.430 0.025 165);
  --shell: oklch(0.455 0.095 163);
  --shell-deep: oklch(0.385 0.082 163);
  --on-shell: oklch(0.975 0.008 165);
  --on-shell-2: oklch(0.885 0.035 165);
  --accent: oklch(0.845 0.160 85);
  --accent-press: oklch(0.800 0.160 82);
  --on-accent: oklch(0.235 0.025 165);
  --sky: #5a95d6; /* sampled from the top of the roadside photo */
  --steel-light: oklch(0.830 0.010 165);
  --steel-dark: oklch(0.330 0.012 165);
  --led: oklch(0.190 0.012 165);
  --led-dot: oklch(0.255 0.012 165);
  --focus: var(--ink);

  /* The example ad on the vinyl face (content colours, not page roles) */
  --ad-peach: oklch(0.775 0.125 62);
  --ad-peach-ink: oklch(0.300 0.060 45);
  /* The same ads as LED creative: lit colour, glowing type */
  --led-peach: oklch(0.560 0.165 45);
  --led-tire: oklch(0.560 0.200 28);
  --led-dent: oklch(0.520 0.160 256);
  --led-farm: oklch(0.505 0.150 142);
  --led-ink: oklch(0.990 0.020 95);

  --font: "Overpass", "Helvetica Neue", Arial, sans-serif;
  --t-small: 15px;
  --t-body: 18px;
  --t-step: 22px;
  --t-h2: clamp(28px, 3.4vw, 40px);
  --t-h1: clamp(38px, 5.6vw, 72px);

  --r: 6px;
  --gutter: clamp(20px, 4vw, 32px);
  --pole-w: clamp(10px, 1.4vw, 18px);
  /* The blank face in roadside-*.webp (2688×1520), as fractions of the photo */
  --plate-ar: 1.76842;
  --face-x: 0.54911; --face-y: 0.21513; --face-w: 0.33594; --face-h: 0.17895;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 var(--t-body)/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: var(--r); }
a { color: inherit; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }

.wrap {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  background: var(--accent); color: var(--on-accent);
  padding: 10px 14px; border-radius: var(--r); font-weight: 700; text-decoration: none;
}
.skip:focus-visible { top: 12px; }

/* Green guide-sign bands */
.band--shell { background: var(--shell); color: var(--on-shell); --focus: var(--accent); }

/* Nav */
.nav {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 64px; padding-top: env(safe-area-inset-top, 0px);
}
.wordmark {
  font-weight: 800; font-size: 24px; letter-spacing: -0.01em; text-decoration: none;
  display: inline-flex; align-items: center; min-height: 44px;
}
.nav-link {
  font-weight: 700; font-size: var(--t-small); text-decoration: underline;
  text-underline-offset: 4px; text-decoration-thickness: 2px;
  text-decoration-color: color-mix(in oklch, currentColor 45%, transparent);
  display: inline-flex; align-items: center; min-height: 44px; padding-inline: 4px;
  transition: text-decoration-color 150ms ease;
}
.nav-link:hover { text-decoration-color: currentColor; }

/* Hero */
/* Hero: the owner's board on its road. Copy sits on the sky in ink. */
.hero { position: relative; background: var(--sky); color: var(--ink); }
.hero-top { position: relative; z-index: 1; }
.hero-copy { padding-block: clamp(20px, 3vw, 40px) 24px; max-width: 640px; }
h1 {
  font-size: var(--t-h1); font-weight: 800; line-height: 1.0; letter-spacing: -0.025em;
  margin-bottom: clamp(20px, 2.4vw, 28px);
}
h1 span { display: block; }
.lede { font-size: clamp(var(--t-body), 1.6vw, 21px); max-width: 40ch; margin-bottom: 28px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 12px 22px;
  background: var(--accent); color: var(--on-accent);
  font: 700 var(--t-body)/1.2 var(--font); text-decoration: none; white-space: nowrap;
  border-radius: var(--r);
  transition: background-color 150ms ease, transform 120ms ease;
  touch-action: manipulation;
}
.btn:hover { background: var(--accent-press); }
.btn:active { transform: scale(.97); }

/* The photo, cropped like object-fit: cover around the board, so the board's
   position on the face stays exact at every size. */
.scene {
  --k: 1.25; /* scene height ÷ width on phones (4:5) */
  --scene-h: max(420px, min(100vw * var(--k), 82svh));
  position: relative; overflow: hidden; container-type: size;
  height: var(--scene-h);
  /* tuck the empty sky above the board under the controls */
  margin-top: calc(56px - var(--face-y) * var(--scene-h));
}
.plate {
  --pw: max(100cqw, 100cqh * var(--plate-ar));
  --fx: calc(var(--face-x) + var(--face-w) / 2);
  position: absolute; bottom: 0;
  width: var(--pw); aspect-ratio: 2688 / 1520;
  left: clamp(100cqw - var(--pw), 50cqw - var(--fx) * var(--pw), 0px);
}
.plate-img {
  display: block; width: 100%; height: 100%;
  /* deslop-ignore: PA6 (mask alpha, not a visible colour) */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 14%);
}
.board {
  position: absolute; container-type: inline-size;
  left: calc(var(--face-x) * 100% - 1px); top: calc(var(--face-y) * 100% - 1px);
  width: calc(var(--face-w) * 100% + 2px); height: calc(var(--face-h) * 100% + 2px);
  background: var(--steel-dark);
}
/* The photo's own light and grain, laid back over the coded face */
.board::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: url("/img/face-light.webp") center / 100% 100% no-repeat;
  mix-blend-mode: multiply; opacity: .55;
  transition: opacity 600ms ease;
}
.board.is-digital::after { opacity: .12; }
.slats { position: relative; width: 100%; height: 100%; perspective: 2200px; }
.slat {
  position: absolute; top: 0; bottom: 0;
  left: calc(var(--i) * 100% / var(--n));
  width: calc(100% / var(--n) + 0.6px);
  transform-style: preserve-3d;
  transition: transform 720ms var(--ease-out) calc(var(--i) * 32ms);
}
.board.is-digital .slat { transform: rotateY(180deg); }
.side { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.side--back { transform: rotateY(180deg); background: var(--led); }
.face-row {
  position: absolute; top: 0; bottom: 0;
  left: calc(var(--i) * -100%);
  width: calc(var(--n) * 100%);
}
.face {
  position: absolute; inset: 0;
  display: grid; align-content: center; gap: 1.6cqw;
  padding-inline: 7cqw;
  background: var(--ad-bg); color: var(--ad-ink);
  transition: opacity 600ms ease;
}
.face-head { font-weight: 800; font-size: 11cqw; line-height: 0.95; letter-spacing: -0.02em; }
.face-sub { font-weight: 700; font-size: max(13px, 5cqw); line-height: 1.1; }

/* LED: the same ads, drawn as lit pixels */
.side--back {
  background-color: var(--led);
  background-image: radial-gradient(circle, var(--led-dot) 0 45%, transparent 50%);
  background-size: max(2px, 0.5cqw) max(2px, 0.5cqw);
}
.side--back .face {
  --ad-ink: var(--led-ink);
  /* deslop-ignore: PA6 (mask alpha, not a visible colour) */
  -webkit-mask-image: radial-gradient(circle, #000 0 62%, transparent 72%);
  mask-image: radial-gradient(circle, #000 0 62%, transparent 72%);
  -webkit-mask-size: max(2px, 0.5cqw) max(2px, 0.5cqw);
  mask-size: max(2px, 0.5cqw) max(2px, 0.5cqw);
  opacity: 0;
}
.side--back .face .face-head, .side--back .face .face-sub { text-shadow: 0 0 1.6cqw color-mix(in oklch, var(--led-ink) 55%, transparent); }
.side--back .ad--peach { --ad-bg: var(--led-peach); }
.side--back .ad--tire { --ad-bg: var(--led-tire); }
.side--back .ad--dent { --ad-bg: var(--led-dent); }
.side--back .ad--farm { --ad-bg: var(--led-farm); }
.side--back .face.on { opacity: 1; }
.ad--peach { --ad-bg: var(--ad-peach); --ad-ink: var(--ad-peach-ink); }

/* Dwell timer, lit along the bottom edge of the LED face */
.dwell {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  height: max(3px, 1.1cqw); visibility: hidden;
  background: color-mix(in oklch, var(--led) 70%, transparent);
}
.board.is-digital .dwell { visibility: visible; }
.dwell-fill { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }
.dwell.run .dwell-fill { animation: dwell 8s linear forwards; }
@keyframes dwell { to { transform: scaleX(1); } }

/* Flip controls: their own solid surface, so they read over sky, trees or grass */
.flip {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 0;
  padding: 4px; margin-bottom: 20px; max-width: 100%;
  background: var(--shell-deep); color: var(--on-shell); --focus: var(--accent);
  border-radius: calc(var(--r) + 4px);
}
.flip[hidden] { display: none; }
.switch { display: inline-flex; gap: 4px; }
.switch-btn {
  min-height: 44px; min-width: 96px; padding: 8px 16px;
  border: 0; border-radius: var(--r); cursor: pointer;
  background: transparent; color: var(--on-shell);
  font: 700 var(--t-small)/1 var(--font);
  transition: background-color 150ms ease, color 150ms ease, transform 120ms ease;
  touch-action: manipulation;
}
.switch-btn:hover { background: color-mix(in oklch, var(--on-shell) 12%, transparent); }
.switch-btn[aria-pressed="true"] { background: var(--on-shell); color: var(--ink); }
.switch-btn:active { transform: scale(.97); }
.flip-note { font-size: var(--t-small); color: var(--on-shell-2); padding: 8px 14px; }
.next-ad {
  min-height: 44px; padding: 8px 14px; border: 0; border-radius: var(--r);
  background: color-mix(in oklch, var(--on-shell) 14%, transparent); color: var(--on-shell); cursor: pointer;
  font: 700 var(--t-small)/1 var(--font);
}
.next-ad[hidden] { display: none; }

/* How it works: the pole continues as the spine */
.how { position: relative; padding-block: clamp(56px, 8vw, 112px) clamp(72px, 10vw, 128px); }
.how-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
.how h2, .fit h2 { font-size: var(--t-h2); font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 36px; position: relative; }
.steps::before {
  content: ""; position: absolute; top: -8px; bottom: 8px; left: 0;
  width: var(--pole-w); background: var(--steel-light);
}
.steps li { position: relative; padding-left: calc(var(--pole-w) + 28px); max-width: 560px; }
.steps li::before {
  content: ""; position: absolute; left: -5px; top: 0.45em;
  width: calc(var(--pole-w) + 10px); height: 7px; background: var(--steel-dark);
}
.steps h3 { font-size: var(--t-step); font-weight: 800; line-height: 1.2; margin-bottom: 6px; }
.steps p { color: var(--on-shell-2); }

/* Boards we look for */
.fit { padding-block: clamp(64px, 9vw, 120px); }
.fit-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.fit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.fit-list li { font-size: var(--t-step); font-weight: 700; line-height: 1.3; max-width: 30ch; }

/* Close */
.close { padding-block: clamp(64px, 9vw, 112px); }
.close-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.close h2 { font-size: clamp(36px, 5vw, 64px); font-weight: 800; line-height: 1.0; letter-spacing: -0.025em; }
.close-body p { font-size: clamp(var(--t-body), 1.6vw, 21px); color: var(--on-shell-2); max-width: 40ch; margin-bottom: 28px; }
.close-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.mail {
  font-weight: 700; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px;
  text-decoration-color: color-mix(in oklch, var(--on-shell) 45%, transparent);
  display: inline-flex; align-items: center; min-height: 44px;
}
.mail:hover { text-decoration-color: var(--on-shell); }

/* Footer */
.foot { padding-block: 28px calc(28px + env(safe-area-inset-bottom, 0px)); color: var(--ink-2); font-size: var(--t-small); }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.foot-mark { font-weight: 800; color: var(--ink); }

/* Desktop: heading left of the pole, steps hanging to its right */
@media (min-width: 900px) {
  .how-grid, .fit-grid, .close-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 0;
  }
  .how h2, .fit h2, .close h2 { padding-right: 48px; }
  .how h2 { position: sticky; top: 40px; align-self: start; }
  .steps { margin-left: calc(var(--pole-w) / -2); }

  /* The whole photo shows; copy and switch sit on its open sky */
  .hero-top { position: absolute; inset: 0 0 auto 0; }
  .hero-copy { max-width: min(46vw, 640px); }
  .scene { height: max(100vw / var(--plate-ar), 600px); margin-top: 0; }
  .plate-img { -webkit-mask-image: none; mask-image: none; }
  .fit-list { padding-left: calc(var(--pole-w) / 2 + 28px); }
  .close-body { padding-left: calc(var(--pole-w) / 2 + 28px); }
}
@media (min-width: 600px) and (max-width: 899.98px) {
  .scene { --k: 1; }
}
@media (max-width: 599.98px) {
  .flip { display: flex; }
  .switch { flex: 1 1 100%; }
  .switch-btn { flex: 1; }
  .flip-note { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .slat { transition: none; }
  .board.fade { animation: fade 150ms ease-out; }
  .side--back .face { transition: opacity 150ms ease; }
  .dwell { display: none; }
}
@keyframes fade { from { opacity: .35; } to { opacity: 1; } }
