/* Home page only. Shared tokens, header, footer, .device/.watch frames and the gallery live in site.css. */

@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-latin.woff2") format("woff2");
  font-weight: 600 900;
  font-style: normal;
  font-display: swap;
}

.home {
  --night: #0b1530;
  --ground: #161c33;
  --cream: #fff4e2;
  --ember: #ffd8a8;
  --orange: #ff9500;
  --ok: #34c759;
  --stop: #ff3b30;
}

.display,
.dusk h1 {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-variation-settings: "SOFT" 100, "WONK" 1;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.05;
}
.center { text-align: center; }

/* ---------- Header: transparent over the hero, solid once scrolled ---------- */
.home .site-header {
  position: fixed; left: 0; right: 0;
  background: transparent; border-bottom-color: transparent;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  transition: background-color .3s, border-color .3s;
}
.home .site-header:not(.scrolled) .brand,
.home .site-header:not(.scrolled) .site-nav a:not(.nav-cta) { color: var(--cream); }
.home .site-header:not(.scrolled) .site-nav a:not(.nav-cta):hover { background: rgba(255, 244, 226, .12); }
.home .site-header.scrolled {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  border-bottom-color: var(--line);
}

/* ---------- Hero: the campsite ---------- */
.dusk {
  position: relative; display: flex; align-items: flex-start;
  min-height: max(720px, 100svh); padding: 0;
  background: var(--night); color: var(--cream); overflow: hidden;
}
.dusk-scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.dusk-copy { position: relative; z-index: 1; padding-top: 104px; padding-bottom: 32px; }
.dusk-copy > * { max-width: 34rem; }
.kicker {
  margin: 0 0 14px; font-size: .8rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--ember);
}
.dusk h1 {
  font-size: clamp(2.5rem, 6.2vw, 4.7rem); color: var(--cream); margin: 0 0 .3em;
  text-shadow: 0 2px 30px rgba(11, 21, 48, .55);
}
.dusk-lede { font-size: clamp(1.05rem, 1.7vw, 1.25rem); color: #f1ddd0; max-width: 29rem; text-shadow: 0 1px 16px rgba(11, 21, 48, .6); }
.btn-text.light { color: var(--ember); }
.btn-text.light:hover { color: #fff; }
@media (min-width: 900px) { .dusk-copy { padding-top: 132px; } }
/* Narrow screens: the text comes first and the campsite gets its own area below it. */
@media (max-width: 899px) {
  .dusk { min-height: 0; }
  .dusk-copy { padding-bottom: min(92vw, 560px); }
  .readout .value { font-size: 30px; }
  .readout .label { font-size: 15px; letter-spacing: .06em; }
}

/* The spirit level under the call to action, in the logo's orange */
.vial-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 26px; }
.vial {
  width: 150px; height: 28px; border-radius: 6px; display: grid; place-items: center;
  background: linear-gradient(#ffb547, #f08a00);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), 0 8px 20px rgba(0, 0, 0, .3);
  transform: rotate(var(--tilt, 0deg)); transition: transform .2s linear;
}
.vial-tube {
  position: relative; width: 96px; height: 14px; border-radius: 7px; overflow: hidden;
  background: #b6e46a; box-shadow: inset 0 2px 3px rgba(0, 0, 0, .3);
}
.vial-tube::before, .vial-tube::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(30, 40, 20, .55);
}
.vial-tube::before { left: calc(50% - 13px); }
.vial-tube::after { left: calc(50% + 11px); }
.vial-bubble {
  position: absolute; top: 3px; left: calc(50% - 9px + var(--bubble, 0px)); width: 18px; height: 8px;
  border-radius: 5px; background: rgba(255, 255, 255, .9);
}
.vial-status { margin: 0; font-weight: 600; font-size: .95rem; color: var(--ember); font-variant-numeric: tabular-nums; }
.is-level .vial-status { color: #8de59a; }
.replay {
  font: inherit; font-size: .9rem; font-weight: 600; color: var(--cream); cursor: pointer;
  background: rgba(255, 244, 226, .08); border: 1px solid rgba(255, 244, 226, .35); border-radius: 999px; padding: 6px 14px;
}
.replay:hover { background: rgba(255, 244, 226, .16); }
.replay::before { content: "↻ "; }

/* Scene animation */
.star { fill: #fff; animation: twinkle var(--d, 4s) ease-in-out var(--delay, 0s) infinite; }
@keyframes twinkle { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
.cloud { animation: drift 70s ease-in-out infinite alternate; }
.cloud.c2 { animation-duration: 95s; animation-direction: alternate-reverse; }
@keyframes drift { from { transform: translateX(-50px); } to { transform: translateX(70px); } }
.sun { transform-box: view-box; transform-origin: 880px 664px; animation: sunpulse 7s ease-in-out infinite alternate; }
@keyframes sunpulse { from { transform: scale(1); opacity: .9; } to { transform: scale(1.06); opacity: 1; } }
.shimmer { animation: shimmer 3.2s ease-in-out infinite; }
.shimmer.s2 { animation-delay: -1.1s; }
.shimmer.s3 { animation-delay: -2.2s; }
@keyframes shimmer { 0%, 100% { opacity: .2; transform: translateX(-8px); } 50% { opacity: 1; transform: translateX(8px); } }
.flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flicker .9s ease-in-out infinite alternate; }
.flame.f2 { animation-duration: .7s; animation-delay: -.3s; }
.flame.f3 { animation-duration: .5s; animation-delay: -.2s; }
@keyframes flicker {
  0% { transform: scale(1, 1) skewX(0); }
  50% { transform: scale(.93, 1.09) skewX(-5deg); }
  100% { transform: scale(1.05, .93) skewX(4deg); }
}
.fire-glow { animation: glow 2.4s ease-in-out infinite alternate; }
@keyframes glow { from { opacity: .7; } to { opacity: 1; } }
.spark { animation: rise 2.6s ease-out infinite; }
.spark.k2 { animation-delay: -.9s; --sx: -12px; }
.spark.k3 { animation-delay: -1.8s; --sx: 6px; }
@keyframes rise {
  0% { transform: translate(0, 0); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translate(var(--sx, 10px), -110px); opacity: 0; }
}
.firefly { fill: #f4ff9c; animation: fly var(--d, 7s) ease-in-out var(--delay, 0s) infinite alternate, blink var(--b, 3s) ease-in-out var(--delay, 0s) infinite; }
@keyframes fly { from { transform: translate(0, 0); } to { transform: translate(var(--dx, 40px), var(--dy, -20px)); } }
@keyframes blink { 0%, 100% { opacity: 0; } 45%, 55% { opacity: 1; } }

.win { fill: #8eadd6; transition: fill .9s; }
.dusk-scene .porch { opacity: 0; transition: opacity 1.2s; }
.dusk-scene.lit .win { fill: #ffd98a; }
.dusk-scene.lit .porch { opacity: 1; }

.readout { opacity: 0; transition: opacity .6s; }
.readout.shown { opacity: 1; }
.readout .tile { fill: var(--stop); transition: fill .4s; }
.readout .arrow, .readout .dash { fill: none; stroke: #fff; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; transition: opacity .3s; }
.readout .dash { opacity: 0; }
.readout.ok .tile { fill: var(--ok); }
.readout.ok .arrow { opacity: 0; }
.readout.ok .dash { opacity: 1; }
.readout .value { fill: var(--cream); font: 700 26px system-ui, -apple-system, "Segoe UI", sans-serif; text-anchor: middle; font-variant-numeric: tabular-nums; }
.readout .label { fill: rgba(255, 244, 226, .78); font: 700 12px system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: .12em; text-anchor: middle; }
.readout .leader { stroke: rgba(255, 244, 226, .5); stroke-width: 1.5; stroke-dasharray: 3 5; }

.dusk.paused *, .night.paused * { animation-play-state: paused !important; }

/* ---------- Demo ---------- */
.demo { background: linear-gradient(var(--ground), #10152a); color: #e9e3f5; }
.demo h2 { color: var(--cream); font-size: clamp(1.9rem, 4.4vw, 3rem); }
.demo-grid { display: grid; gap: 40px; align-items: center; }
@media (min-width: 860px) { .demo-grid { grid-template-columns: 300px 1fr; gap: 72px; } }
.demo-phone { width: min(70vw, 300px); margin: 0 auto; }
.demo-phone video { display: block; width: 100%; height: auto; border-radius: 10.5% / 4.9%; background: #fff; }
.chapters { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 6px; counter-reset: chapter; }
.chapters button {
  position: relative; display: grid; gap: 2px; width: 100%; text-align: left; cursor: pointer;
  font: inherit; color: inherit; background: transparent; border: 0; border-radius: 14px; padding: 14px 16px 16px 60px;
}
.chapters button:hover { background: rgba(255, 255, 255, .05); }
.chapters button::before {
  counter-increment: chapter; content: counter(chapter);
  position: absolute; left: 16px; top: 14px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: .85rem;
  border: 2px solid rgba(255, 255, 255, .28);
}
.chapters button strong { color: var(--cream); font-size: 1.05rem; }
.chapters button span { color: #b3adc8; font-size: .95rem; }
.chapters button[aria-current] { background: rgba(255, 255, 255, .07); }
.chapters button[aria-current]::before { background: var(--orange); border-color: var(--orange); color: #241400; }
.chapters button[aria-current]::after {
  content: ""; position: absolute; left: 60px; right: 16px; bottom: 7px; height: 2px; border-radius: 1px;
  background: linear-gradient(90deg, var(--orange) var(--p, 0%), rgba(255, 255, 255, .1) 0);
}
.fineprint { color: #8d87a5; font-size: .85rem; margin: 18px 0 0; }

/* ---------- Old way / new way ---------- */
.versus h2 { font-size: clamp(1.8rem, 4.2vw, 2.8rem); max-width: 24ch; margin-inline: auto; }
.versus-grid { display: grid; gap: 22px; margin-top: 40px; }
@media (min-width: 820px) { .versus-grid { grid-template-columns: 1fr 1fr; gap: 28px; } }
.old-way, .new-way { border-radius: 24px; padding: 28px; }
.old-way h3, .new-way h3 { font-size: .85rem; letter-spacing: .14em; text-transform: uppercase; }
.old-way { background: #f3ece0; color: #4a4033; transform: rotate(-.6deg); }
.new-way { background: var(--card); border: 2px solid var(--ok); box-shadow: var(--shadow); }
.new-way h3 { color: #1f8f3a; }
.shouts { list-style: none; padding: 0; margin: 4px 0 20px; display: flex; flex-direction: column; gap: 10px; }
.shouts li {
  align-self: flex-start; max-width: 90%; background: #fff; color: #2b2520; font-weight: 650;
  padding: 10px 16px; border-radius: 18px 18px 18px 4px; box-shadow: 0 2px 0 rgba(0, 0, 0, .08);
  transform: rotate(-1deg);
}
.shouts li:nth-child(even) { align-self: flex-end; border-radius: 18px 18px 4px 18px; transform: rotate(1.2deg); }
.shouts li:nth-child(3) { color: #c4281c; font-size: 1.25rem; font-weight: 800; letter-spacing: .02em; }
.old-way p { margin: 0; }
.mini-tiles { display: flex; gap: 22px; margin: 8px 0 20px; }
.mini-tile { display: grid; justify-items: center; gap: 4px; }
.mini-tile b { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.mini-tile small { color: var(--text-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; }
.mini-tile .t {
  width: 56px; height: 56px; border-radius: 13px; display: grid; place-items: center;
  color: #fff; font-size: 30px; font-weight: 800; transition: background-color .5s;
}
.t.red { background: var(--stop); }
.t.green { background: var(--ok); }
.new-way p { margin: 0; color: var(--text-2); }
.fridge-note {
  position: relative; max-width: 620px; margin: 40px auto 0; padding: 18px 22px;
  background: #fff1b8; color: #4b3c00; border-radius: 4px; transform: rotate(.5deg);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .1);
}
.fridge-note::before {
  content: ""; position: absolute; top: -12px; left: calc(50% - 50px); width: 100px; height: 24px;
  background: rgba(255, 255, 255, .55); transform: rotate(-2deg); box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
@media (prefers-color-scheme: dark) {
  .old-way { background: #2b2620; color: #e8dcc8; }
  .shouts li { background: #3a342c; color: #f5ead8; }
  .shouts li:nth-child(3) { color: #ff7a6e; }
  .new-way h3 { color: #4cd964; }
  .fridge-note { background: #3b3416; color: #f6e7a8; }
  .fridge-note::before { background: rgba(255, 255, 255, .14); }
}

/* ---------- Trail ---------- */
.trail { background: var(--bg-2); }
.trail h2 { font-size: clamp(1.9rem, 4.4vw, 3rem); }
.trail-intro { color: var(--text-2); max-width: 36rem; }
.trail-steps { list-style: none; padding: 0; margin: 44px 0 0; display: grid; gap: 48px; position: relative; }
.trail-steps::before {
  content: ""; position: absolute; left: 21px; top: 8px; bottom: 8px;
  border-left: 3px dashed color-mix(in srgb, var(--text) 22%, transparent);
}
.trail-steps li { position: relative; padding-left: 68px; }
.trail-steps .marker {
  position: absolute; left: 0; top: -6px; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; color: #241400;
  background: var(--orange); border: 4px solid var(--bg-2); box-shadow: 0 0 0 2px var(--orange);
}
.trail-steps h3 { margin-bottom: .3em; }
.trail-steps p { color: var(--text-2); }
.trail-steps .device { width: min(56%, 210px); margin-top: 18px; }
.trail-steps .watch { width: min(52%, 190px); margin-top: 18px; }
@media (min-width: 900px) {
  .trail-steps { grid-template-columns: repeat(3, 1fr); gap: 40px; }
  .trail-steps::before {
    left: 4%; right: 4%; top: 2px; bottom: auto; height: 40px; border: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 40' preserveAspectRatio='none'%3E%3Cpath d='M0 20C160 0 340 40 500 20S840 0 1000 20' fill='none' stroke='%23a99c86' stroke-width='3' stroke-dasharray='10 10' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  }
  .trail-steps li { padding-left: 0; padding-top: 70px; }
  .trail-steps .marker { top: 0; }
  .trail-steps .device { width: 70%; }
  .trail-steps .watch { width: 64%; }
}

/* ---------- Data plate on trailer siding ---------- */
.plate-section {
  background: repeating-linear-gradient(180deg, #dde1e7 0 22px, #c7ccd4 22px 24px, #eef0f3 24px 26px);
}
@media (prefers-color-scheme: dark) {
  .plate-section { background: repeating-linear-gradient(180deg, #23262c 0 22px, #1a1c21 22px 24px, #2c3037 24px 26px); }
}
.plate {
  position: relative; max-width: 760px; margin: 0 auto; padding: 38px clamp(22px, 5vw, 48px) 30px;
  border-radius: 14px; border: 1px solid #949aa3; color: #22252c;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .07) 0 1px, transparent 1px 3px),
    linear-gradient(135deg, #f5f6f8 0%, #c8cbd1 42%, #eef0f3 55%, #b5b9c0 100%);
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 rgba(0, 0, 0, .15), 0 18px 44px rgba(0, 0, 0, .28);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.plate h2 {
  font-family: inherit; font-size: clamp(.95rem, 2.4vw, 1.2rem); font-weight: 800; letter-spacing: .18em;
  text-transform: uppercase; text-align: center; margin: 0 0 16px; padding-bottom: 14px;
  border-bottom: 2px solid #22252c; text-shadow: 0 1px 0 rgba(255, 255, 255, .7);
}
.plate dl { margin: 0; }
.plate dl > div { display: grid; grid-template-columns: 8.5em 1fr; gap: 14px; padding: 10px 0; border-bottom: 1px dashed rgba(34, 37, 44, .35); }
.plate dt { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; color: #4b505a; padding-top: 3px; }
.plate dd { margin: 0; font-weight: 700; text-shadow: 0 1px 0 rgba(255, 255, 255, .6); }
@media (max-width: 520px) { .plate dl > div { grid-template-columns: 1fr; gap: 2px; } }
.plate-foot { margin: 18px 0 0; text-align: center; font-size: .72rem; letter-spacing: .22em; text-transform: uppercase; color: #4b505a; }
.rivet {
  position: absolute; width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #a0a6ae 60%, #666c75);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .45);
}
.rivet:nth-of-type(1) { top: 12px; left: 12px; }
.rivet:nth-of-type(2) { top: 12px; right: 12px; }
.rivet:nth-of-type(3) { bottom: 12px; left: 12px; }
.rivet:nth-of-type(4) { bottom: 12px; right: 12px; }

/* ---------- Night: closing call to action ---------- */
.night {
  position: relative; overflow: hidden; text-align: center; padding: 110px 0 150px;
  background: linear-gradient(#0b1530, #05070f 85%); color: #e3dcf0;
}
.night-sky {
  position: absolute; inset: 0; opacity: .85;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 33% 42%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 58% 12%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 76% 36%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 88% 14%, #ffeccc 50%, transparent 51%),
    radial-gradient(1px 1px at 46% 66%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 6% 58%, #fff 50%, transparent 51%);
  background-size: 420px 320px, 300px 260px, 520px 380px, 360px 300px, 640px 420px, 280px 340px, 460px 280px;
  animation: twinkle 6s ease-in-out infinite;
}
.night-inner { position: relative; z-index: 1; }
.night-logo { margin: 0 auto 24px; border-radius: 22px; box-shadow: 0 0 70px rgba(255, 170, 90, .35); }
.night h2 { color: var(--cream); font-size: clamp(1.8rem, 4.4vw, 2.8rem); }
.night p { color: #c9c1dc; }
.night .cta-row { justify-content: center; margin-top: 26px; }
.night-ground { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 90px; }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .dusk *, .night *, .night-sky { animation: none !important; transition: none !important; }
}

/* The footer continues the night on the home page. */
.home .site-footer { background: #05070f; border-top-color: transparent; color: #8d87a5; }
.home .site-footer a { color: #c9c1dc; }
.home .site-footer a:hover { color: #fff; }
