/* ============================================================
   Chewie.co.uk — landing page
   Structure: shell (nav / stage / footer) over a full-bleed sky canvas.
   Theming: CSS variables swapped via <html data-theme="…">.
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  overflow: hidden;                 /* non-scrolling on desktop */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .6s var(--ease), color .6s var(--ease);
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ul { margin: 0; }
ul { list-style: none; padding: 0; }
button { font: inherit; color: inherit; }

/* ---------- Design tokens (theme-independent) ---------- */
:root {
  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif:   'Fraunces', Georgia, 'Times New Roman', serif;

  --nav-h: 74px;
  --foot-h: 46px;
  --radius: 16px;
  --radius-lg: 24px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --gutter: clamp(20px, 4vw, 52px);

  /* demo height — set by the fit scaler so both portrait demos align
     and the page never scrolls; default is a safe size before JS runs */
  --demoH: 440px;
}

/* ============================================================
   THEMES  — each sets surface, text, accent and sky gradient stops.
   Master bands (night / sunrise / day / sunset) all stay on a dark surface.
   ============================================================ */

/* ---- Night (default) ---- */
[data-theme="night"] {
  --bg: #05060a;
  --surface: rgba(255,255,255,.045);
  --surface-2: rgba(255,255,255,.07);
  --text: #e9edf7;
  --text-dim: #9aa3bd;
  --muted: #5d667f;
  --line: rgba(255,255,255,.09);
  --accent: #7aa2ff;
  --accent-2: #b69bff;
  --glow: rgba(122,162,255,.35);
  --sky-a: #0b1124;  --sky-b: #070a16;  --sky-c: #04050b;
  --celest: #e7ecff;     /* moon */
  --celest-2: #cdd6f5;   /* stars */
  color-scheme: dark;
}

/* ---- Sunrise (morning) ---- */
[data-theme="sunrise"] {
  --bg: #0a0710;
  --surface: rgba(255,255,255,.05);
  --surface-2: rgba(255,255,255,.08);
  --text: #fbeee6;
  --text-dim: #d8b6a6;
  --muted: #8a6a62;
  --line: rgba(255,200,170,.13);
  --accent: #ff9e6d;
  --accent-2: #ffd27a;
  --glow: rgba(255,158,109,.4);
  --sky-a: #150f24;  --sky-b: #2a1622;  --sky-c: #46221d;
  --celest: #ffd9a0;     /* rising sun */
  --celest-2: #ffb27a;
  color-scheme: dark;
}

/* ---- Day (early afternoon) ---- */
[data-theme="day"] {
  --bg: #080d15;
  --surface: rgba(255,255,255,.05);
  --surface-2: rgba(255,255,255,.08);
  --text: #e8f1fb;
  --text-dim: #9db4cf;
  --muted: #5a7088;
  --line: rgba(160,200,255,.12);
  --accent: #5fd0ff;
  --accent-2: #8ad9ff;
  --glow: rgba(95,208,255,.34);
  --sky-a: #336aa0;  --sky-b: #1e4163;  --sky-c: #152c45;   /* lighter noon blue */
  --celest: #f6fbff;     /* high sun */
  --celest-2: #cfe7ff;
  color-scheme: dark;
}

/* ---- Sunset (twilight) ---- */
[data-theme="sunset"] {
  --bg: #0c0810;
  --surface: rgba(255,255,255,.05);
  --surface-2: rgba(255,255,255,.08);
  --text: #fbe9ec;
  --text-dim: #d6a9b5;
  --muted: #87616c;
  --line: rgba(255,170,190,.13);
  --accent: #ff7e6b;
  --accent-2: #c77dff;
  --glow: rgba(255,126,107,.38);
  --sky-a: #1b1230;  --sky-b: #301726;  --sky-c: #45191e;
  --celest: #ffc08a;     /* setting sun */
  --celest-2: #ff9e7a;
  color-scheme: dark;
}

/* ============================================================
   Sky canvas
   ============================================================ */
#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

/* ============================================================
   Shell
   ============================================================ */
.app-shell {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
/* When logged in, WordPress's 32px admin bar pushes the page down via html{margin-top:32px}.
   Trim BOTH the root html (which is height:100%) and the fixed homepage shell by 32px so the
   page still fits the screen with no scroll. (Logged-in-only; modern :has() is fine here.) */
@media (min-width: 901px) {
  html:has(body.admin-bar) { height: calc(100% - 32px); }
  body.admin-bar.home .app-shell { height: calc(100dvh - 32px); }
}

/* ---------- Header ---------- */
.nav {
  position: relative;
  z-index: 3;                 /* lift nav (and the floating slider) above the stage */
  flex: 0 0 auto;             /* was a locked --nav-h; now grows for the transparency-slider row */
  min-height: var(--nav-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
  transition: border-color .6s var(--ease);
}
.brand { justify-self: start; }
.nav__links { justify-self: end; }
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand__logo { display: block; height: 40px; width: auto; }   /* matches the day/night control pill height (same ~17px top/bottom padding) */
.brand__mark { color: var(--accent); display: inline-flex; transition: color .6s var(--ease); }
.brand__word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -.02em;
  color: var(--text);
}
.nav__links { display: flex; align-items: center; gap: clamp(18px, 3vw, 34px); }
.nav__links a {
  position: relative;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--text-dim);
  padding: 6px 2px;
  transition: color .25s var(--ease);
}
.nav__links a::after {
  content: "";
  position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease);
}
.nav__links a:hover { color: var(--text); }
.nav__links a:hover::after { transform: scaleX(1); }

/* ---------- Stage (two blocks + center divider) ---------- */
.stage {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr);
  align-items: center;
  padding: clamp(14px, 2.4vh, 30px) var(--gutter);
  gap: clamp(20px, 3vw, 48px);
}
.divider-v {
  width: 1px;
  height: 62%;
  align-self: center;
  background: linear-gradient(to bottom, transparent, var(--line) 14%, var(--line) 86%, transparent);
  transition: background .6s var(--ease);
}

/* A block = demo + supporting copy. Scaled by --fit to stay in the viewport. */
.block {
  height: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 2vw, 36px);
  outline: none;
}
/* ReflectAR is the left block: demo on the outer (left) edge, copy on the inner side */
.block--reflectar { flex-direction: row; }
/* AlcoLog is the right block, mirrored: demo on the outer (right) edge, copy inner */
.block--alcolog { flex-direction: row-reverse; }

.demo { display: flex; align-items: center; justify-content: center; }

/* demo iframes — isolated, pixel-accurate copies of each app's live demo.
   Both demos are portrait and share --demoH so they read as a mirrored pair. */
.demo-frame { border: 0; display: block; background: transparent; }
.demo--phone {
  width: calc(var(--demoH) * 0.482);   /* phone aspect */
  max-width: 26vw;
  height: var(--demoH);
}
/* phone is non-interactive: let the parent block own the hover */
.demo-frame--phone { width: 100%; height: 100%; pointer-events: none; }
.demo--ar {
  width: calc(var(--demoH) * 0.6);     /* portrait AR stage */
  max-width: 33vw;
  height: var(--demoH);
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* solid, always-visible frame — --line is too faint over the cream demo, so the
     border read as "broken" until the hover/focus accent kicked in */
  border: 1px solid rgba(255,255,255,.45);
  box-shadow: 0 24px 70px -28px rgba(0,0,0,.55);
  transition: border-color .35s var(--ease), box-shadow .35s var(--ease);
}
.block--reflectar:hover .demo--ar,
.block--reflectar:focus-within .demo--ar { border-color: var(--accent); }
.demo-frame--ar { width: 100%; height: 100%; }

/* ---------- Copy / bullets ---------- */
.copy { display: flex; flex-direction: column; gap: 14px; max-width: 300px; }
.copy--mirror { align-items: flex-end; text-align: right; }   /* mirror of the AlcoLog copy */
.app-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(22px, 2.4vw, 30px);
  letter-spacing: -.02em;
  color: var(--text);
  line-height: 0;
}
/* app logos (icon + wordmark) replacing the text headings */
.app-logo { display: block; height: clamp(28px, 3.2vw, 38px); width: auto; }
.app-logo--reflectar { filter: drop-shadow(0 2px 6px rgba(0,0,0,.45)); }  /* lift the colourful logo off the dark sky */
.app-tag { font-size: 15px; color: var(--text-dim); line-height: 1.45; white-space: nowrap; }
.bullets { display: flex; flex-direction: column; gap: 11px; }
.bullets li {
  position: relative;
  padding-left: 22px;
  font-size: 14.5px;
  color: var(--text-dim);
  line-height: 1.4;
}
.bullets li::before {
  content: "";
  position: absolute; left: 0; top: .5em;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--glow);
  transition: background .6s var(--ease);
}
/* mirrored bullets: marker on the right, text right-aligned */
.copy--mirror .bullets li { padding-left: 0; padding-right: 22px; }
.copy--mirror .bullets li::before { left: auto; right: 0; }

.app-cta {
  align-self: flex-start;
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--text);
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  transition: border-color .25s var(--ease), background .25s var(--ease), transform .25s var(--ease);
}
.copy--mirror .app-cta { align-self: flex-end; }
.app-cta:hover { border-color: var(--accent); background: var(--surface-2); transform: translateY(-1px); }

/* App Store + Google Play badges, sitting side by side under the website pill */
.app-badges { align-self: flex-start; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.copy--mirror .app-badges { align-self: flex-end; justify-content: flex-end; }
.app-badge { display: inline-flex; line-height: 0; border-radius: 9px; transition: transform .25s var(--ease); }
.app-badge img { height: 42px; width: auto; display: block; }
.app-badge:hover { transform: translateY(-1px); }
.app-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* demo viewport + interaction-hint caption (caption sits under the demo) */
.demo-col { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
.demo-hint {
  margin: 0; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 7px;
  text-align: center; line-height: 1.3;
  font-family: var(--font-display); font-weight: 500; font-size: 13px;
}
.demo-hint__txt { color: var(--text); text-shadow: 0 1px 8px rgba(0,0,0,.6), 0 0 2px rgba(0,0,0,.45); }   /* clean light caption, soft shadow keeps it legible over the sky */
.demo-hint__ic { display: inline-flex; }
.demo-hint__ic svg { display: block; }
.demo-hint--reflectar .demo-hint__ic { color: #e0855a; }
.demo-hint--alcolog .demo-hint__ic { color: #54ccbf; }
.demo-hint__ic--mouse, .demo-hint__txt--mouse { display: none; }   /* touch is the default; swapped for mouse below */
.block--reflectar .demo-hint { max-width: calc(var(--demoH) * 0.6); }
.block--alcolog .demo-hint { max-width: calc(var(--demoH) * 0.482); }
@media (hover: hover) and (pointer: fine) {
  .demo-hint__ic--mouse { display: inline-flex; }
  .demo-hint__txt--mouse { display: inline; }
  .demo-hint__ic--touch, .demo-hint__txt--touch { display: none; }
}

/* ---------- Footer ---------- */
.foot {
  flex: 0 0 var(--foot-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border-top: 1px solid var(--line);
  transition: border-color .6s var(--ease);
}
.foot p { font-size: 12.5px; color: var(--text-dim); letter-spacing: .01em; }

/* ---- heart-flutter easter egg (the footer ♥) ---- */
.heart-flutter {
  color: #ff5a6e;                 /* the site's love-heart red */
  position: relative;             /* anchors the floating particles: required */
  display: inline-block;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: transform .2s cubic-bezier(.4, 0, .2, 1);
}
.heart-flutter:hover { transform: scale(1.18); }
.heart-flutter:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 3px; }
.heart-particle { position: absolute; pointer-events: none; opacity: 0; left: 50%; top: 50%; }

/* ---------- Time-of-day selector (centre of the nav) ---------- */
.tod-controls { justify-self: center; display: flex; align-items: center; gap: 12px; }
/* center stack: the controls row, with the panel-transparency slider beneath it */
.tod-center { justify-self: center; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.tod-dialrow { display: flex; align-items: center; gap: 12px; }   /* wraps the scrub dial — the transparency slider now sits to the LEFT of the band lozenge */

/* ---- panel-background transparency slider (background-only; borders/text untouched) ---- */
.bg-slider { display: flex; align-items: center; gap: 9px; width: 150px; height: 40px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }   /* desktop: matches the .tod-nav band-lozenge height (40px, box-sizing:border-box); sits to its left */
.bg-slider__ic { flex: 0 0 auto; color: var(--text-dim); display: block; }
.bg-slider__range { -webkit-appearance: none; appearance: none; flex: 1 1 auto; width: auto; min-width: 0; height: 5px; padding: 0; margin: 0; border-radius: 999px; --tick: linear-gradient(rgba(255,255,255,.42), rgba(255,255,255,.42)); background-color: var(--line); background-image: var(--tick), var(--tick), var(--tick); background-size: 2px 100%; background-repeat: no-repeat; background-position: calc(25% + 3.25px) center, center, calc(75% - 3.25px) center; outline: none; cursor: pointer; }   /* ticks at 25/50/75% (the +/-3.25px offsets account for the 13px thumb's travel inset) */
.bg-slider__range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--accent); border: 0; cursor: grab; transition: transform .15s var(--ease); }
.bg-slider__range:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.15); }
.bg-slider__range::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--accent); border: 0; cursor: grab; }
.bg-slider__range::-moz-range-track { height: 5px; border-radius: 999px; background-color: var(--line); background-image: var(--tick), var(--tick), var(--tick); background-size: 2px 100%; background-repeat: no-repeat; background-position: calc(25% + 3.25px) center, center, calc(75% - 3.25px) center; }
.bg-slider__range:focus-visible { box-shadow: 0 0 0 3px rgba(255,255,255,.14); }
.tod-nav {
  display: flex; align-items: center; gap: 2px;
  padding: 4px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); backdrop-filter: blur(8px);
}
/* time-of-day dial, to the right of the icons */
.tod-dial { width: 50px; height: 50px; flex: 0 0 auto; cursor: grab; touch-action: none; outline: none; }
.tod-dial__time { fill: var(--text); font-family: var(--font-display); font-weight: 600; font-size: 8.5px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tod-dial:active { cursor: grabbing; }
.tod-dial svg { width: 100%; height: 100%; display: block; overflow: visible; }
.tod-dial__track { fill: none; stroke: var(--line); stroke-width: 2.5; }
.tod-dial__tick { fill: var(--text-dim); opacity: .5; }
.tod-dial__handle { fill: var(--accent); stroke: var(--bg); stroke-width: 1.4; transition: fill .3s var(--ease); }
.tod-dial:focus-visible .tod-dial__track { stroke: var(--accent); }
/* fly-by timer + stacked "seen" counters, left of the icons */
.tod-meta { display: flex; flex-direction: row; align-items: center; gap: 9px; margin-right: 10px; }
.tod-timer { display: inline-flex; align-items: stretch; font: 600 18px/1 var(--font-display); color: var(--text); font-variant-numeric: tabular-nums; }
.tod-timer.flashing { animation: timerFlash 1.1s ease-in-out infinite; }
@keyframes timerFlash { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.tdig { display: inline-block; width: .58em; height: 1em; text-align: center; }   /* plain static digit slot — no animation/overlay, so digits can never overlap or ghost (mobile-safe on every browser) */
.tdig__c { display: block; width: 100%; }
.tcol { display: inline-block; padding: 0 1px; }
.tod-seen { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.tod-seen__item { display: inline-flex; align-items: center; gap: 4px; font: 500 11px var(--font-display); color: var(--text-dim); font-variant-numeric: tabular-nums; }
.tod-seen__item svg { opacity: .75; }

/* hover tooltip explaining the fly-by "seen" counters */
.seen-tip {
  position: absolute; top: calc(100% + 12px); left: 0;
  width: max-content; max-width: 244px;
  padding: 10px 13px;
  font: 400 12px/1.55 var(--font-body); color: var(--text); text-align: left; letter-spacing: 0; text-transform: none;
  background: rgba(12, 15, 24, 0.94);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .22s var(--ease), transform .22s var(--ease);
  pointer-events: none; z-index: 30;
}
.seen-tip::before { content: ""; position: absolute; bottom: 100%; left: 22px; border: 6px solid transparent; border-bottom-color: rgba(12, 15, 24, 0.94); }
.tod-seen:hover .seen-tip, .tod-seen:focus-within .seen-tip { opacity: 1; visibility: visible; transform: translateY(0); }

/* ---------- cookie-consent banner (sitewide) ---------- */
.cookie-banner {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 60; width: min(680px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 13px 16px;
  background: rgba(12, 15, 24, 0.95); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  font: 400 13px/1.5 var(--font-body); color: var(--text-dim);
  animation: cookieIn .4s var(--ease) both;
}
.cookie-banner[hidden] { display: none; }
@keyframes cookieIn { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
.cookie-banner__text { margin: 0; flex: 1 1 280px; }
.cookie-banner__text a { color: var(--text); text-decoration: underline; }
.cookie-banner__actions { display: flex; gap: 8px; flex: 0 0 auto; margin-left: auto; }
.cookie-btn { font: 600 13px var(--font-display); padding: 8px 18px; border-radius: 999px; cursor: pointer; border: 1px solid var(--line); transition: filter .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease); }
.cookie-btn--ghost { background: transparent; color: var(--text-dim); }
.cookie-btn--ghost:hover { color: var(--text); border-color: rgba(255, 255, 255, .28); }
.cookie-btn--accept { background: var(--accent); color: #06121c; border-color: transparent; }
.cookie-btn--accept:hover { filter: brightness(1.08); }
.foot-cookie-link { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: 12.5px; letter-spacing: .01em; color: var(--text-dim); text-decoration: none; }
.foot-cookie-link:hover { color: var(--text); text-decoration: underline; }
@media (max-width: 560px) { .cookie-banner { bottom: 10px; gap: 10px; } .cookie-banner__actions { margin-left: 0; width: 100%; justify-content: flex-end; } }
.tod-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 30px; border: 0; border-radius: 999px;
  color: var(--text-dim); background: transparent; cursor: pointer;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.tod-btn:hover { color: var(--text); }
.tod-btn[aria-pressed="true"] { color: var(--accent); background: var(--surface-2); }
.tod-sep { width: 1px; height: 16px; background: var(--line); margin: 0 3px; }

/* ---------- nav menu wrapper + hamburger ---------- */
.nav-menu { display: contents; }   /* desktop: its children flow into the nav grid */
.nav-burger { display: none; }     /* desktop: no hamburger */
.nav-close { display: none; }      /* desktop: no drawer close button */

/* ---------- debug fly-by switcher (only present when ?debug=true) ---------- */
.fly-debug {
  position: fixed; left: 14px; bottom: 14px; z-index: 7;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  width: 190px; max-height: 70vh; overflow-y: auto; padding: 8px 9px;
  background: rgba(8, 10, 16, 0.92); border: 1px solid var(--line);
  border-radius: 12px; backdrop-filter: blur(10px);
}
.fly-debug__title { width: 100%; font: 600 10px/1 var(--font-display); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.fly-debug__row { width: 100%; font: 500 9px/1 var(--font-display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); opacity: .6; margin-top: 4px; }
.fly-debug button { font: 500 11px var(--font-display); color: var(--text-dim); background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; cursor: pointer; }
.fly-debug button:hover { color: var(--text); border-color: var(--accent); }
.fly-debug button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

/* ============================================================
   Mobile — portrait phones / small tablets.
   The sky canvas stays fixed; the foreground scrolls. Controls + links
   collapse into a hamburger drawer; the two blocks stack vertically.
   ============================================================ */
/* ---------- Project carousel (home) ----------
   Orbital: the track holds N identical sequences and is translated by
   -(p * loopWidth); crossing p=1 lands on an identical frame, so the loop is
   seamless. p is driven by the clock (one revolution per 12h) in
   assets/js/projects-carousel.js. */
/* .stage.stage--projects (0,2,0) so the carousel stays full-bleed against the
   mobile .stage padding set later in this file — the feather must sit on the
   screen edge, not 18px inside it. */
.stage.stage--projects { display: block; padding: 0; overflow: hidden; align-content: center; }
.pcar { --pcar-card-w: 560px; --pcar-card-h: min(62vh, 430px); --pcar-gap: 30px; --pcar-endgap: 300px; --pcar-feather: 9%; width: 100%; }
.pcar__viewport {
  position: relative; width: 100%; overflow: hidden;
  touch-action: pan-y;                       /* horizontal drag is ours, vertical scroll stays the page's */
  cursor: default;                           /* desktop is driven by the time bar, not by dragging cards */
  /* feathered frames: cards fade in and out of the edges rather than being cut */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--pcar-feather), #000 calc(100% - var(--pcar-feather)), transparent 100%);
          mask-image: linear-gradient(to right, transparent 0, #000 var(--pcar-feather), #000 calc(100% - var(--pcar-feather)), transparent 100%);
}
.pcar.is-dragging .pcar__viewport { cursor: grabbing; }
/* stretch, not center: every card takes the height of the tallest in the lap
   (the two-line blog card), so the rhythm along the track is uniform */
.pcar__track { display: flex; gap: 0; will-change: transform; align-items: stretch; }
.pcar__seq { display: flex; gap: var(--pcar-gap); flex: 0 0 auto; align-items: stretch; }
.pcar__endgap { flex: 0 0 var(--pcar-endgap); }   /* the breather between the last card and the first */

.pcard {
  flex: 0 0 var(--pcar-card-w); width: var(--pcar-card-w); box-sizing: border-box;
  display: flex; align-items: center; gap: 22px;
  padding: 20px 24px; border: 1px solid var(--line); border-radius: 20px;
  background: rgba(10, 13, 21, var(--panel-alpha, .5));
  /* 🚨 deliberately NO backdrop-filter here. A backdrop-filtered descendant
     escapes the ancestor's mask, which killed the .pcar__viewport feather
     entirely (verified: turn the blur off and the edges fade correctly; turn it
     on with isolation/translateZ and the card backgrounds vanish instead).
     The blog and contact panels keep their blur — only the carousel gives it up,
     because the feathered edges matter more here. */
}
.pcard__shot { flex: 0 0 auto; }
.pphone {
  height: calc(var(--pcar-card-h) - 46px); aspect-ratio: 1260 / 2736;
  border-radius: 24px; overflow: hidden; background: #000;
  border: 2px solid rgba(232, 238, 252, .22); box-shadow: 0 12px 34px rgba(0,0,0,.45);
}
.pphone__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard__body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.pcard__name { margin: 0; font: 600 20px/1.15 var(--font-display); color: var(--text); }
.pcard__name--text { display: block; font: 600 19px/1.2 var(--font-display); color: var(--text); }
.pcard__tag, .pcard__excerpt { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--text-dim); }
.pcard__kicker { margin: 0; font: 600 10.5px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.pcard__bullets { list-style: none; margin: 4px 0 2px; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.pcard__bullets li { position: relative; padding-left: 15px; font-size: 13px; line-height: 1.4; color: var(--text); }
.pcard__bullets li::before { content: ""; position: absolute; left: 0; top: .52em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.pcard .app-cta { margin-top: 4px; }
.pcard .app-badges { margin-top: 6px; }
.pcard .app-badge img { height: 34px; }
.pcard .app-logo { max-width: 190px; height: auto; display: block; }

/* an article, not an app: landscape hero on top, no phone frame */
.pcard--post { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 13px; }
.pcard--post .pcard__body { align-items: flex-start; }
.pcard__hero { display: block; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 10; border: 1px solid var(--line); }
.pcard__hero img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- sun→moon time bar (under the carousel) ----------
   A second face for the nav dial, not a second source of truth: it reads and
   writes ChewieSky, which notifies every subscriber, so bar / dial / band
   buttons can never drift apart. The scale runs 06:00 → 06:00, which is what
   puts DAY on the left half (sun) and NIGHT on the right half (moon). The track
   gradient follows the same journey: sunrise, noon, sunset, midnight. */
.tbar { display: flex; flex-direction: column; align-items: center; gap: 9px; width: min(92vw, 660px); margin: 22px auto 0; }
.tbar__row { display: flex; align-items: center; gap: 14px; width: 100%; }
.tbar__time { margin: 0; text-align: center; font: 600 12.5px/1 var(--font-display); letter-spacing: .03em; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.tbar__ic { flex: 0 0 auto; color: var(--text-dim); display: block; }
.tbar__range {
  -webkit-appearance: none; appearance: none;
  flex: 1 1 auto; width: auto; min-width: 0; height: 6px; margin: 0; padding: 0;
  border-radius: 999px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, #f0a95c 0%, #74b8e6 25%, #ef8a4e 50%, #121a30 75%, #f0a95c 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.13);
}
.tbar__range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; border-radius: 50%;
  background: #fff; border: 2px solid rgba(10,13,21,.85); cursor: grab;
  box-shadow: 0 2px 7px rgba(0,0,0,.5);
}
.tbar__range:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.12); }
.tbar__range::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: #fff; border: 2px solid rgba(10,13,21,.85); cursor: grab;
}
.tbar__range::-moz-range-track { height: 6px; border-radius: 999px; background: transparent; }
.tbar__range:focus-visible { box-shadow: inset 0 0 0 1px rgba(255,255,255,.13), 0 0 0 3px rgba(255,255,255,.16); }

@media (max-width: 900px) {
  /* one card per viewport; the app card stacks so a phone still fits beside nothing */
  .pcar { --pcar-card-w: min(86vw, 370px); --pcar-card-h: auto; --pcar-gap: 18px; --pcar-endgap: 44vw; --pcar-feather: 6%; }
  .pcar__viewport { cursor: grab; }          /* swipe is the mobile control */
  .pcard { padding: 18px; gap: 16px; }
  .pcard--app { flex-direction: column; align-items: center; text-align: center; }
  .pcard--app .pcard__body { align-items: center; }
  .pcard--app .pcard__bullets li { padding-left: 0; }
  .pcard--app .pcard__bullets li::before { display: none; }
  .pphone { height: auto; width: 158px; }
  .pcard .app-logo { margin: 0 auto; }
}

@media (max-width: 900px) {
  html { overflow-x: clip; }
  html, body { height: auto; min-height: 100%; }
  body { overflow: visible; }                       /* document flows & the viewport scrolls naturally */
  .app-shell { height: auto; min-height: 100dvh; }

  /* header: logo + hamburger, sticky frosted bar */
  .nav {
    position: sticky; top: 0; z-index: 5;
    min-height: var(--nav-h);
    display: flex; align-items: center; justify-content: space-between;   /* flex (not grid) so brand + burger reliably vertical-centre on iOS — grid row-stretch doesn't honour min-height on iOS Safari */
    background: rgba(8, 10, 16, 0.55); backdrop-filter: blur(12px);
  }
  .brand__logo { height: 40px; max-width: 64vw; object-fit: contain; object-position: left center; }
  .nav-burger {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    justify-self: end; width: 42px; height: 42px; padding: 0;
    background: transparent; border: 0; cursor: pointer;
  }
  .nav-burger span { width: 22px; height: 2px; border-radius: 2px; background: var(--text); transition: transform .3s var(--ease), opacity .2s; }
  .nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-burger.open span:nth-child(2) { opacity: 0; }
  .nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* the controls drawer — sits ABOVE the header (z6 > z5) so it covers the bar
     when open: the close button gets full contrast and the top padding can be tight */
  .nav-menu {
    display: flex; flex-direction: column; align-items: center; gap: 20px;
    position: fixed; top: 0; left: 0; right: 0; z-index: 6;
    padding: 56px 20px 30px;
    background: rgba(8, 10, 16, 0.96); backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    transform: translateY(-102%); transition: transform .32s var(--ease);
    max-height: 100dvh; overflow-y: auto; overflow-x: hidden;   /* vertical scroll for short screens, but NEVER a horizontal scrollbar — setting overflow-y:auto alone makes overflow-x compute to `auto`, which gives the drawer an annoying sideways scroll on some widths */
  }
  .nav-menu.open { transform: translateY(0); }

  /* clearly-visible close button, top-right of the drawer */
  .nav-close {
    display: inline-flex; align-items: center; justify-content: center;
    position: absolute; top: 12px; right: 14px;
    width: 40px; height: 40px; padding: 0;
    color: var(--text); background: var(--surface-2);
    border: 1px solid var(--line); border-radius: 50%; cursor: pointer;
    transition: background .2s var(--ease), border-color .2s var(--ease);
  }
  .nav-close:hover { background: var(--surface); border-color: var(--accent); }
  .nav-menu .tod-center { gap: 18px; }
  /* drawer: meta row, band row, then slider+dial share the last row (grid keeps them paired to save height) */
  .nav-menu .tod-controls { display: grid; grid-template-columns: auto auto; grid-template-areas: "meta meta" "nav nav" "slider dial"; justify-content: center; justify-items: center; align-items: center; gap: 18px 14px; margin: 0; }
  .nav-menu .tod-meta { grid-area: meta; margin-right: 0; }
  .nav-menu .tod-nav { grid-area: nav; }
  .nav-menu .tod-btn { width: 46px; height: 42px; }            /* bigger touch targets */
  .nav-menu .tod-dial { width: 58px; height: 58px; }
  .nav-menu .tod-dialrow { grid-area: dial; }
  .nav-menu .bg-slider { grid-area: slider; width: min(54vw, 210px); height: auto; padding: 8px 16px; }   /* reset the desktop fixed height — mobile slider sizes to content */
  .nav-menu .bg-slider__range { height: 5px; }
  .nav-menu .bg-slider__range::-webkit-slider-thumb { width: 18px; height: 18px; }
  .nav-menu .bg-slider__range::-moz-range-thumb { width: 18px; height: 18px; }
  .nav-menu .nav__links { gap: 36px; font-size: 16px; }
  .nav-menu .nav__links a { padding: 8px 4px; }

  /* stacked content — explicitly layered above the fixed sky canvas so fly-bys
     always stay behind the text (the canvas is position:fixed; z-index:0) */
  .stage { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 46px; padding: 26px 18px 44px; min-height: 0; }
  .divider-v { display: none; }
  .block { flex-direction: column !important; height: auto; gap: 18px; width: 100%; }
  .copy, .copy--mirror { order: -1; align-items: center; text-align: center; max-width: 90vw; }   /* text above the demo */
  .app-tag { white-space: normal; }   /* allow the byline to wrap on very narrow phones rather than clip */
  .copy .bullets, .copy--mirror .bullets { text-align: left; align-self: center; }
  .copy--mirror .bullets li { padding-left: 22px; padding-right: 0; }
  .copy--mirror .bullets li::before { left: 0; right: auto; }
  .copy .app-cta, .copy--mirror .app-cta { align-self: center; }
  .copy .app-badges, .copy--mirror .app-badges { align-self: center; justify-content: center; }
  .block--reflectar .demo-hint { max-width: min(84vw, 380px); }
  .block--alcolog .demo-hint { max-width: min(70vw, 290px); }
  .demo-hint__ic--touch { display: inline-flex; }            /* mobile layout → always the touch cue */
  .demo-hint__txt--touch { display: inline; }
  .demo-hint__ic--mouse, .demo-hint__txt--mouse { display: none; }

  /* demos sized to the narrow screen — width-driven & capped, height from aspect-ratio */
  .demo--phone { width: min(70vw, 290px); max-width: none; height: auto; aspect-ratio: 0.482; }
  .demo--ar { width: min(84vw, 380px); max-width: none; height: auto; aspect-ratio: 0.6; }

  .foot { position: relative; z-index: 1; text-align: center; padding: 0 18px; }
}

/* ============================================================
   Contact page — a form card floating on the same living sky.
   ============================================================ */
body.contact-page { overflow-x: hidden; overflow-y: auto; }       /* let the form scroll if it's taller than the viewport */
.contact-page .app-shell { height: auto; min-height: 100dvh; }

.stage--contact {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 5vh, 64px) var(--gutter);
}

.contact-card {
  width: min(560px, 100%);
  background: rgba(10, 13, 21, var(--panel-alpha, .5));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 4vw, 40px);
  -webkit-backdrop-filter: blur(calc(12px * var(--panel-blur-mult, 1)));
  backdrop-filter: blur(calc(12px * var(--panel-blur-mult, 1)));
  box-shadow: 0 30px 80px -42px rgba(0,0,0,.6);
  transition: border-color .6s var(--ease);
}
.contact-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(26px, 3.4vw, 36px);
  letter-spacing: -.02em;
  color: var(--text);
}
.contact-sub { margin-top: 8px; color: var(--text-dim); font-size: 15px; line-height: 1.5; }

.contact-form { display: flex; flex-direction: column; gap: 15px; margin-top: 26px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-family: var(--font-display); font-size: 12.5px; font-weight: 500; letter-spacing: .02em; color: var(--text-dim); }
.field input,
.field textarea {
  font: inherit; font-size: 15px; color: var(--text);
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.field textarea { resize: vertical; min-height: 130px; }
.field input:focus,
.field textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); }

/* honeypot — kept out of sight and out of the tab order */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.contact-send { align-self: flex-start; margin-top: 2px; cursor: pointer; }
.contact-send[disabled] { opacity: .6; cursor: default; }

.contact-status { min-height: 1.3em; font-size: 14px; line-height: 1.4; }
.contact-status.ok  { color: #4fd08a; }
.contact-status.err { color: #ff6b75; }

/* reCAPTCHA widget is a fixed 304px — keep it tidy inside a narrow card */
.g-recaptcha { transform-origin: left top; }
@media (max-width: 360px) { .g-recaptcha { transform: scale(.86); } }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
