/* Firepit website. Colours are the apps' Ember tokens (docs/meshchat-ux-design.md §9.1), light and dark. */

:root {
  --surface: #FAF7F3;
  --surface-2: #FFFFFF;
  --surface-alt: #F4EEE7;
  --text: #1A1614;
  --text-2: #6B625C;
  --line: #E8E0D9;
  --line-strong: #D8CDC3;
  --primary: #C2410C;
  --on-primary: #FFFFFF;
  --primary-soft: #FBE3D6;
  --primary-ink: #A3370A;
  --infra: #4A5B8C;
  --infra-soft: rgba(74, 91, 140, 0.10);
  --bubble-out: #FBE3D6;
  --bubble-in: #FFFFFF;
  --live: #2BB673;
  --stale: #A39E98;
  --warn: #9A6B00;

  --glow-1: rgba(244, 106, 16, 0.17);
  --glow-2: rgba(255, 176, 90, 0.20);
  --mesh-line: rgba(194, 65, 12, 0.17);
  --mesh-node: rgba(194, 65, 12, 0.42);
  --grain-opacity: 0.05;
  --grain-filter: none;
  --closing-bg: #FAF7F3;
  --closing-glow: rgba(244, 106, 16, 0.20);
  --closing-glow-soft: rgba(244, 106, 16, 0.06);

  --shadow-sm: 0 1px 2px rgba(60, 30, 10, 0.05), 0 6px 18px -8px rgba(60, 30, 10, 0.14);
  --shadow-md: 0 2px 6px rgba(60, 30, 10, 0.05), 0 26px 50px -26px rgba(60, 30, 10, 0.32);
  --device-shadow: 0 60px 120px -40px rgba(80, 35, 5, 0.42), 0 26px 50px -26px rgba(80, 35, 5, 0.34);

  --font-display: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --gutter: clamp(20px, 5vw, 40px);
  --max: 1180px;
  --header: 68px;

  color-scheme: light dark;
}

/* Dark, when the system asks for it, unless someone picked Light (html[data-theme="light"], set by main.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #141210;
    --surface-2: #1E1B18;
    --surface-alt: #181513;
    --text: #F1ECE7;
    --text-2: #A39C95;
    --line: #2E2926;
    --line-strong: #3D3631;
    --primary: #F0875A;
    --on-primary: #3B1400;
    --primary-soft: #3A2418;
    --primary-ink: #F0875A;
    --infra: #93A6DF;
    --infra-soft: rgba(147, 166, 223, 0.12);
    --bubble-out: #3A2418;
    --bubble-in: #24211E;
    --live: #4ED69A;
    --stale: #6F6963;
    --warn: #F2C94C;

    --glow-1: rgba(240, 135, 90, 0.16);
    --glow-2: rgba(244, 106, 16, 0.10);
    --mesh-line: rgba(240, 135, 90, 0.15);
    --mesh-node: rgba(240, 135, 90, 0.5);
    --grain-opacity: 0.07;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px -8px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.25), 0 26px 50px -26px rgba(0, 0, 0, 0.7);
    --device-shadow: 0 60px 120px -40px rgba(0, 0, 0, 0.85), 0 26px 50px -26px rgba(0, 0, 0, 0.6), 0 0 90px -30px rgba(240, 135, 90, 0.25);
    --grain-filter: invert(1);
    --closing-bg: #100E0C;
    --closing-glow: rgba(244, 106, 16, 0.32);
    --closing-glow-soft: rgba(244, 106, 16, 0.08);
  }
}

/* Dark, picked by hand whatever the system says. The same values as the block above: keep the two in step. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface: #141210;
  --surface-2: #1E1B18;
  --surface-alt: #181513;
  --text: #F1ECE7;
  --text-2: #A39C95;
  --line: #2E2926;
  --line-strong: #3D3631;
  --primary: #F0875A;
  --on-primary: #3B1400;
  --primary-soft: #3A2418;
  --primary-ink: #F0875A;
  --infra: #93A6DF;
  --infra-soft: rgba(147, 166, 223, 0.12);
  --bubble-out: #3A2418;
  --bubble-in: #24211E;
  --live: #4ED69A;
  --stale: #6F6963;
  --warn: #F2C94C;

  --glow-1: rgba(240, 135, 90, 0.16);
  --glow-2: rgba(244, 106, 16, 0.10);
  --mesh-line: rgba(240, 135, 90, 0.15);
  --mesh-node: rgba(240, 135, 90, 0.5);
  --grain-opacity: 0.07;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px -8px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.25), 0 26px 50px -26px rgba(0, 0, 0, 0.7);
  --device-shadow: 0 60px 120px -40px rgba(0, 0, 0, 0.85), 0 26px 50px -26px rgba(0, 0, 0, 0.6), 0 0 90px -30px rgba(240, 135, 90, 0.25);
  --grain-filter: invert(1);
  --closing-bg: #100E0C;
  --closing-glow: rgba(244, 106, 16, 0.32);
  --closing-glow-soft: rgba(244, 106, 16, 0.08);
}

:root[data-theme="light"] { color-scheme: light; }

/* Base */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header) + 12px);
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p, figure, blockquote, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
::selection { background: var(--primary); color: var(--on-primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 6px; }

.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }

.skip {
  position: absolute; left: 16px; top: -80px; z-index: 100;
  padding: 10px 16px; border-radius: 10px;
  background: var(--primary); color: var(--on-primary);
  font-weight: 600; text-decoration: none;
}
.skip:focus { top: 16px; }

svg.icon, .fact-ico svg, .f-ico svg, .node-ico svg {
  width: 24px; height: 24px;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

/* Header */

.site-header {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s, border-color 0.3s, -webkit-backdrop-filter 0.3s, backdrop-filter 0.3s;
}
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom-color: var(--line);
}

.nav { display: flex; align-items: center; justify-content: space-between; height: var(--header); }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: -0.01em;
  text-decoration: none;
}
.brand img { width: 30px; height: 30px; }

.nav-links { display: flex; gap: clamp(16px, 3vw, 34px); font-size: 15px; }
.nav-links a {
  position: relative; padding: 6px 0;
  color: var(--text-2); text-decoration: none;
  transition: color 0.2s;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px;
  background: var(--primary);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.35s var(--ease);
}
.nav-links a:hover, .nav-links a[aria-current] { color: var(--text); }
.nav-links a:hover::after, .nav-links a[aria-current]::after { transform: scaleX(1); }

/* Theme: System (the default), Light or Dark. Needs the script, so it only appears when the script runs. */

.nav-end { display: flex; align-items: center; gap: clamp(16px, 3vw, 34px); }
.theme { position: relative; display: none; }
.js .theme { display: block; }
.nav-end { position: relative; }
.round-button {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--text-2); cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.round-button:hover, .theme.is-open .round-button, .menu-button[aria-expanded="true"] { color: var(--text); border-color: var(--line-strong); }
.round-button svg, .theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Sections menu: on phones the links fold behind this button (see the 600px rules). */
.menu-button { display: none; }
.mi { display: none; }
.menu-button[aria-expanded="false"] .mi-open, .menu-button[aria-expanded="true"] .mi-close { display: grid; }
.ti { display: none; }
:root:not([data-theme]) .ti-system, :root[data-theme="light"] .ti-light, :root[data-theme="dark"] .ti-dark { display: grid; }
.theme-menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 60;
  display: grid; gap: 2px; min-width: 168px; padding: 6px;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface-2); box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; translate: 0 -4px;
  transition: opacity 0.18s var(--ease), translate 0.18s var(--ease), visibility 0s linear 0.18s;
}
.theme.is-open .theme-menu {
  opacity: 1; visibility: visible; translate: none;
  transition: opacity 0.18s var(--ease), translate 0.18s var(--ease);
}
.theme-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: 0; border-radius: 10px; background: transparent;
  font: inherit; font-size: 14.5px; color: var(--text); text-align: left; cursor: pointer;
}
.theme-menu button:hover { background: var(--surface-alt); }
.theme-menu button[aria-pressed="true"] { color: var(--primary); font-weight: 600; }
.theme-menu button[aria-pressed="true"]::after {
  content: ""; margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}

/* Buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 50px; padding: 0 24px; border-radius: 999px;
  font-size: 15.5px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: transform 0.25s var(--ease), box-shadow 0.25s, background-color 0.25s, border-color 0.25s;
}
.btn-primary {
  background: var(--primary); color: var(--on-primary);
  box-shadow: 0 12px 26px -12px color-mix(in srgb, var(--primary) 75%, transparent);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 32px -14px color-mix(in srgb, var(--primary) 80%, transparent); }
.btn-ghost {
  border: 1px solid var(--line-strong); color: var(--text);
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}
.btn-ghost:hover { transform: translateY(-2px); border-color: var(--text-2); }
/* The strongest contrast the theme has: dark on light, light on dark. */
.btn-light { background: var(--text); color: var(--surface); }
.btn-light:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* Hero */

.hero {
  position: relative; overflow: clip;
  margin-top: calc(-1 * var(--header));
  padding: calc(var(--header) + clamp(36px, 6vw, 88px)) 0 clamp(72px, 9vw, 128px);
}

.hero-bg {
  position: absolute; inset: 0; pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 78%, transparent);
  mask-image: linear-gradient(#000 78%, transparent);
}
.hero-bg::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(42% 55% at 74% 50%, var(--glow-1), transparent 72%),
    radial-gradient(38% 45% at 12% 8%, var(--glow-2), transparent 72%);
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: url("assets/grain.svg");
  opacity: var(--grain-opacity);
  filter: var(--grain-filter);
}

.mesh {
  position: absolute; inset: 0; width: 100%; height: 100%;
  -webkit-mask-image: radial-gradient(70% 80% at 66% 45%, #000 22%, transparent 80%);
  mask-image: radial-gradient(70% 80% at 66% 45%, #000 22%, transparent 80%);
}
.mesh-links path { fill: none; stroke: var(--mesh-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.mesh-nodes circle { fill: var(--mesh-node); }
.mesh-pulses circle {
  fill: none; stroke: var(--primary); stroke-width: 1.2; opacity: 0;
  transform-box: fill-box; transform-origin: center;
  animation: ping 5.2s ease-out infinite;
}
.mesh-pulses .p2 { animation-delay: 1.3s; }
.mesh-pulses .p3 { animation-delay: 2.6s; }
.mesh-pulses .p4 { animation-delay: 3.9s; }
.mesh-packets circle { fill: var(--primary); opacity: 0.85; }
@keyframes ping {
  0% { transform: scale(1); opacity: 0.6; }
  70%, 100% { transform: scale(7); opacity: 0; }
}

.hero-grid {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  align-items: center; gap: clamp(32px, 5vw, 72px);
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  margin-bottom: 30px; padding: 7px 15px 7px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  font-size: 13.5px; color: var(--text-2);
}
.eyebrow-dot { flex: none; }
.eyebrow a {
  color: inherit; text-decoration: underline dotted color-mix(in srgb, var(--primary) 70%, transparent);
  text-underline-offset: 3px; transition: color 0.2s;
}
.eyebrow a:hover { color: var(--text); }
.eyebrow-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}

h1 {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(3rem, 1.5rem + 5.2vw, 5.9rem);
  line-height: 0.98; letter-spacing: -0.032em;
}
h1 em, h2 em { font-style: italic; font-weight: 400; color: var(--primary); }

.hero-lead {
  max-width: 33rem; margin-top: 28px;
  font-size: clamp(1.08rem, 1rem + 0.35vw, 1.28rem); line-height: 1.55;
  color: var(--text-2);
}

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 38px; }

.status {
  display: flex; align-items: center; gap: 10px; margin-top: 32px;
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.02em; color: var(--text-2);
}
.status-dot { flex: none; align-self: flex-start; width: 7px; height: 7px; margin-top: 0.5em; border-radius: 50%; background: var(--warn); animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.3; } }

/* Phones */

.hero-devices {
  position: relative; display: grid; place-items: center;
  min-height: clamp(460px, 50vw, 640px);
}

.device {
  --w: clamp(212px, 21vw, 292px);
  position: relative; grid-area: 1 / 1;
  width: var(--w); margin: 0; padding: 2.4%;
  border-radius: 15.35% / 7.25%;
  background: linear-gradient(155deg, #4b433d 0%, #19150f 20%, #0b0908 62%, #2b241f 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 0 0 3px rgba(0, 0, 0, 0.55), var(--device-shadow);
}
.screen { position: relative; overflow: hidden; border-radius: 13.6% / 6.27%; background: #000; }
.screen img { width: 100%; }
/* The Dynamic Island, where the screenshot leaves it out. */
.screen::after {
  content: ""; position: absolute; top: 0; left: 34.41%;
  width: 31.18%; aspect-ratio: 376 / 110; margin-top: 3.48%;
  border-radius: 999px; background: #000;
}

.device-front { z-index: 2; translate: -31% 6%; rotate: -5deg; animation: float 10s ease-in-out infinite; }
.device-back { z-index: 1; translate: 31% -5%; rotate: 5deg; scale: 0.92; animation: float 12s ease-in-out -5s infinite; }
@keyframes float { 50% { transform: translateY(-12px); } }

.sparks { position: absolute; inset: 10% 0 0; pointer-events: none; }
.sparks span {
  position: absolute; bottom: 4%; left: 50%;
  width: 3px; height: 3px; border-radius: 50%;
  background: #FFB05A; box-shadow: 0 0 6px 1px rgba(255, 140, 50, 0.8);
  opacity: 0; animation: rise 8s linear infinite;
}
.sparks span:nth-child(1) { left: 8%; animation-delay: -1s; --dx: 18px; }
.sparks span:nth-child(2) { left: 18%; animation-delay: -5s; animation-duration: 9s; --dx: -14px; }
.sparks span:nth-child(3) { left: 27%; animation-delay: -3s; animation-duration: 7s; --dx: 10px; }
.sparks span:nth-child(4) { left: 39%; animation-delay: -7s; --dx: -20px; }
.sparks span:nth-child(5) { left: 50%; animation-delay: -2s; animation-duration: 10s; --dx: 16px; }
.sparks span:nth-child(6) { left: 61%; animation-delay: -6s; --dx: -8px; }
.sparks span:nth-child(7) { left: 72%; animation-delay: -4s; animation-duration: 9s; --dx: 22px; }
.sparks span:nth-child(8) { left: 82%; animation-delay: -1.5s; animation-duration: 7.5s; --dx: -16px; }
.sparks span:nth-child(9) { left: 91%; animation-delay: -6.5s; --dx: 12px; }
.sparks span:nth-child(10) { left: 66%; animation-delay: -3.5s; animation-duration: 11s; --dx: -24px; }
@keyframes rise {
  0% { transform: translate(0, 0) scale(1); opacity: 0; }
  8% { opacity: 0.9; }
  55% { opacity: 0.55; }
  100% { transform: translate(var(--dx, 12px), -440px) scale(0.35); opacity: 0; }
}

/* Sections */

.section { position: relative; padding-block: clamp(96px, 12vw, 168px); }
.section-alt { background: var(--surface-alt); border-block: 1px solid var(--line); }

.kicker {
  display: flex; align-items: center; gap: 14px; margin-bottom: 26px;
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--primary);
}
.kicker-n { color: var(--text-2); }
.kicker-line { width: 36px; height: 1px; background: currentColor; opacity: 0.6; }

h2 {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2.2rem, 1.25rem + 3.1vw, 3.8rem);
  line-height: 1.04; letter-spacing: -0.026em;
  text-wrap: balance;
}

.intro {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: start; gap: clamp(24px, 5vw, 80px);
}
.intro .lede { padding-top: 0.55em; }
.lede { font-size: clamp(1.05rem, 1rem + 0.25vw, 1.2rem); line-height: 1.66; color: var(--text-2); text-wrap: pretty; }

/* 01 What */

.facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: clamp(56px, 7vw, 96px); border-top: 1px solid var(--line);
}
.fact { padding: 38px 32px 6px 0; }
.fact + .fact { padding-left: 32px; border-left: 1px solid var(--line); }
.fact-ico, .f-ico {
  display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 24px;
  border-radius: 14px; background: var(--primary-soft); color: var(--primary);
}
.fact h3, .feature h3, .step h3 { margin-bottom: 8px; font-size: 18.5px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.fact p, .feature p, .step p { font-size: 16px; line-height: 1.62; color: var(--text-2); }

/* 02 Built on Meshtastic: the network Firepit runs on, as one card */

.section-mesh { padding-top: 0; }
.mesh-card {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr); align-items: center;
  gap: clamp(32px, 5vw, 72px); padding: clamp(30px, 5vw, 64px);
  border: 1px solid var(--line); border-radius: 32px;
  background:
    radial-gradient(60% 80% at 100% 0%, color-mix(in srgb, var(--primary) 8%, transparent), transparent 70%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow-sm);
}
.mesh-copy .lede { max-width: 46ch; margin-top: 24px; }
.mesh-note { max-width: 52ch; margin-top: 16px; font-size: 14.5px; line-height: 1.55; color: var(--text-2); }
.mesh-link { gap: 8px; margin-top: 28px; }
.mesh-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mesh-facts { display: grid; gap: 26px; }
.mesh-facts li { display: grid; grid-template-columns: 46px 1fr; align-items: start; gap: 16px; }
.mesh-facts .fact-ico { margin-bottom: 0; }
.mesh-facts h3 { margin-bottom: 4px; font-size: 17px; font-weight: 600; line-height: 1.3; }
.mesh-facts p { font-size: 15px; line-height: 1.55; color: var(--text-2); }

/* 03 Why */

.why-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: clamp(32px, 6vw, 96px); }
.prose p { font-size: 17.5px; line-height: 1.75; color: var(--text-2); }
.prose p:first-child { font-size: 19.5px; line-height: 1.6; color: var(--text); }
.prose p + p { margin-top: 1.15em; }

.quote {
  margin-top: clamp(64px, 8vw, 112px); padding-top: clamp(48px, 6vw, 80px);
  border-top: 1px solid var(--line); text-align: center;
}
.quote blockquote {
  max-width: 24ch; margin-inline: auto;
  font-family: var(--font-display); font-style: italic;
  font-size: clamp(1.75rem, 1.05rem + 2.4vw, 3rem); line-height: 1.22; letter-spacing: -0.015em;
  text-wrap: balance;
}
.quote blockquote::before {
  content: "\201C"; display: block; margin-bottom: 0.2em;
  font-size: 1.9em; font-style: normal; line-height: 0.6; color: var(--primary);
}

/* 04 How */

.flow {
  display: grid;
  grid-template-columns: auto minmax(36px, 1fr) auto minmax(36px, 1.3fr) auto minmax(36px, 1.3fr) auto minmax(36px, 1fr) auto;
  align-items: start;
  margin-top: clamp(56px, 7vw, 88px);
  padding: clamp(70px, 7vw, 86px) clamp(18px, 3vw, 40px) clamp(24px, 3vw, 34px);
  border: 1px solid var(--line); border-radius: 28px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow-sm);
}

/* The path: phones, radios and the links between them. */

.node { position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px; width: 128px; text-align: center; }
.node-ico {
  display: grid; place-items: center; width: 64px; height: 64px;
  border: 1px solid var(--line-strong); border-radius: 20px;
  background: var(--surface); color: var(--text);
  transition: border-color 0.35s, color 0.35s;
}
.node-ico svg { width: 28px; height: 28px; }
.nd-1 .node-ico, .nd-5 .node-ico {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
  background: var(--primary-soft); color: var(--primary);
}
.node-txt { display: flex; flex-direction: column; gap: 3px; }
.node-txt strong { font-size: 15px; font-weight: 600; }
.node-txt small { font-size: 13.5px; line-height: 1.4; color: var(--text-2); transition: color 0.35s; }

.link { position: relative; height: 64px; }
.link::before { content: ""; position: absolute; left: 4px; right: 4px; top: 50%; border-top: 1.5px dashed var(--line-strong); }
.link-lora::before { border-top: 2px dotted color-mix(in srgb, var(--infra) 60%, transparent); }
.link-label {
  position: absolute; left: 50%; top: calc(50% - 30px); translate: -50% 0;
  display: inline-flex; align-items: center; gap: 2px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-2); white-space: nowrap;
}
.link-label .lock:last-of-type { margin-right: 4px; }

.lock { display: inline-grid; place-items: center; width: 14px; height: 14px; flex: none; }
.lock svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.lock-room { color: var(--primary); }
.lock-chan { color: var(--infra); }

/* The packet: sealed with the room key on Bluetooth, wrapped in the channel layer on the air. */

.pk {
  position: absolute; top: calc(50% - 12px); left: 0;
  display: grid; place-items: center; width: 34px; height: 24px; border-radius: 999px;
  background: var(--primary); color: var(--on-primary);
  box-shadow: 0 0 18px -2px var(--primary);
  opacity: 0; pointer-events: none;
}
.pk svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.link-lora .pk {
  box-shadow: 0 0 0 2.5px var(--surface-2), 0 0 0 5px var(--infra), 0 0 24px 3px color-mix(in srgb, var(--infra) 45%, transparent);
}
.link.is-moving .pk { animation: travel-x 1.2s cubic-bezier(0.45, 0.05, 0.55, 0.95) both; }
.link.is-moving.is-back .pk { animation-direction: reverse; }

@keyframes travel-x {
  0% { left: 0; opacity: 0; scale: 0.5; }
  14%, 86% { opacity: 1; scale: 1; }
  100% { left: calc(100% - 34px); opacity: 0; scale: 0.5; }
}
@keyframes travel-y {
  0% { top: 0; opacity: 0; scale: 0.5; }
  14%, 86% { opacity: 1; scale: 1; }
  100% { top: calc(100% - 24px); opacity: 0; scale: 0.5; }
}

/* What happens at each stop. The script marks the stop that acts, whichever way the message is going. */

.node.is-act-room .node-ico { animation: ring-room 0.9s ease-out; }
.node.is-act-chan .node-ico { animation: ring-chan 0.9s ease-out; border-color: var(--infra); color: var(--infra); }
.node.is-act-relay .node-ico { animation: ring-relay 0.9s ease-out; border-color: var(--text-2); }
.node.is-current small { color: var(--text); }

/* Captions for both directions: yours going out, Maya's coming in. */
.when-in { display: none; }
.flow[data-dir="in"] .when-in { display: inline; }
.flow[data-dir="in"] .when-out { display: none; }

@keyframes ring-room { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 55%, transparent); } to { box-shadow: 0 0 0 18px transparent; } }
@keyframes ring-chan { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--infra) 55%, transparent); } to { box-shadow: 0 0 0 18px transparent; } }
@keyframes ring-relay { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--text-2) 45%, transparent); } to { box-shadow: 0 0 0 16px transparent; } }

/* The message as words: above the sender's phone before it is sealed, above the other phone once it is opened.
   Tinted where it was written, plain where it arrived, like a chat. */

.bubble {
  position: absolute; top: -16px; translate: 0 -100%;
  padding: 7px 12px; border: 1px solid transparent; border-radius: 14px;
  font-size: 13px; line-height: 1.3; white-space: nowrap; color: var(--text);
  background: var(--bubble-in); border-color: var(--line);
  box-shadow: var(--shadow-sm);
  opacity: 0; scale: 0.6;
  transition: opacity 0.35s var(--ease), scale 0.35s var(--ease), translate 0.45s var(--ease);
  pointer-events: none;
}
.bubble::after {
  content: ""; position: absolute; bottom: -6px; width: 10px; height: 10px; rotate: 45deg;
  background: inherit; border: inherit; border-top-color: transparent; border-left-color: transparent;
}
.bubble-ryan { left: 0; transform-origin: 64px 100%; }
.bubble-ryan::after { left: 58px; }
.bubble-maya { right: 0; transform-origin: calc(100% - 64px) 100%; }
.bubble-maya::after { right: 58px; }

.flow[data-dir="out"] .bubble-ryan,
.flow[data-dir="in"] .bubble-maya { background: var(--bubble-out); border-color: transparent; }

.flow[data-dir="out"][data-stage="plain"] .bubble-ryan,
.flow[data-dir="in"][data-stage="plain"] .bubble-maya,
.flow[data-dir="out"][data-stage="open"] .bubble-maya,
.flow[data-dir="in"][data-stage="open"] .bubble-ryan { opacity: 1; scale: 1; }
.flow[data-dir="out"][data-stage="seal"] .bubble-ryan,
.flow[data-dir="in"][data-stage="seal"] .bubble-maya { opacity: 0; scale: 0.25; translate: 0 -40%; }

/* Under the path: what the packet holds right now, what is happening, and the two keys. */

.readout {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); align-items: center; gap: 16px 30px;
  margin-top: clamp(28px, 3.5vw, 40px); padding-top: clamp(22px, 3vw, 30px);
  border-top: 1px solid var(--line);
}
.wire { display: grid; }
.wire-val {
  grid-area: 1 / 1; min-width: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface);
  opacity: 0; translate: 0 6px;
  transition: opacity 0.35s var(--ease), translate 0.35s var(--ease);
}
.wire-tag {
  flex: none; display: inline-flex; align-items: center; gap: 2px;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-2);
}
.wire-tag .lock:last-of-type { margin-right: 4px; }
/* Long values fade out at the edge rather than end in an ellipsis. */
.wire-val code, .wire-text {
  min-width: 0; overflow: hidden; white-space: nowrap;
  -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent);
  mask-image: linear-gradient(90deg, #000 82%, transparent);
}
.wire-val code { font-family: var(--font-mono); font-size: 13.5px; letter-spacing: 0.04em; }
.wire-text { font-size: 15px; color: var(--text); }
.v-sealed { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, var(--line)); }
.v-sealed code, .v-sealed .wire-tag { color: var(--primary-ink); }
.v-wrapped { background: var(--infra-soft); border-color: color-mix(in srgb, var(--infra) 35%, var(--line)); }
.v-wrapped code, .v-wrapped .wire-tag { color: var(--infra); }
.flow[data-content="plain"] .v-plain,
.flow[data-content="sealed"] .v-sealed,
.flow[data-content="wrapped"] .v-wrapped { opacity: 1; translate: none; }

.caps { display: grid; }
.cap {
  grid-area: 1 / 1;
  font-size: 15.5px; line-height: 1.5; color: var(--text); text-wrap: pretty;
  opacity: 0; translate: 0 6px;
  transition: opacity 0.4s var(--ease), translate 0.4s var(--ease);
}
.flow[data-phase="a"] .cap-a, .flow[data-phase="b"] .cap-b, .flow[data-phase="c"] .cap-c,
.flow[data-phase="d"] .cap-d, .flow[data-phase="e"] .cap-e { opacity: 1; translate: none; }
.cap-static { display: none; }

.keys { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 13px; color: var(--text-2); }
.key { display: inline-flex; align-items: center; gap: 6px; }

/* Without the script, or with reduced motion: the whole story at once. */
.flow:not([data-stage]) .readout { grid-template-columns: 1fr; }
.flow:not([data-stage]) .wire { display: none; }
.flow:not([data-stage]) .cap-static { display: block; opacity: 1; translate: none; }

.how-grid {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  align-items: center; gap: clamp(40px, 7vw, 110px);
  margin-top: clamp(64px, 8vw, 104px);
}
.step { display: grid; grid-template-columns: 44px 1fr; gap: 22px; padding: 28px 0; border-top: 1px solid var(--line); }
.step:last-child { border-bottom: 1px solid var(--line); }
.step-n {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--primary) 50%, var(--line));
  font-family: var(--font-display); font-size: 19px; font-style: italic; color: var(--primary);
}
.showcase { display: grid; justify-items: center; gap: 26px; }
.showcase .device { --w: clamp(220px, 22vw, 276px); grid-area: auto; }
.showcase figcaption { max-width: 30ch; text-align: center; font-size: 14.5px; line-height: 1.55; color: var(--text-2); }

/* The invite screen, live. The app's own layout in container units (1cqw = 1% of the 402 pt-wide screen), so it scales
   with the phone frame: 16 pt margins, a white card with 24 pt corners, subheadline text, a callout key line. */

.invite-screen {
  container-type: inline-size;
  aspect-ratio: 660 / 1435;
  background: var(--surface); color: var(--text);
  font-family: var(--font-body); text-align: center;
}
.sb {
  position: absolute; top: 0; left: 0; right: 0; height: 15.8cqw;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8.6cqw 0 14cqw;
}
.sb-time { font-size: 4.23cqw; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.sb-icons { display: flex; align-items: center; gap: 1.4cqw; }
.sb-icons svg { fill: currentColor; }
.sb-cell { width: 4.5cqw; opacity: 0.3; }
.sb-wifi { width: 4cqw; opacity: 0.3; }
.sb-battery { width: 6.7cqw; }

.inv { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; gap: 3.98cqw; padding: 33cqw 3.98cqw 0; }
.inv-title { position: absolute; top: 20.9cqw; left: 0; right: 0; translate: 0 -50%; font-size: 4.23cqw; font-weight: 600; }
.inv-card { display: grid; width: 100%; aspect-ratio: 1; padding: 3.98cqw; border-radius: 5.97cqw; background: #FFFFFF; }
.inv-qr { grid-area: 1 / 1; width: 100%; height: auto; opacity: 0; transition: opacity 0.12s linear; }
.inv-qr.is-current { opacity: 1; }
.inv-timer { display: inline-flex; align-items: center; gap: 1.5cqw; font-size: 3.73cqw; line-height: 1.33; color: var(--text-2); }
.inv-timer svg { width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }
.inv-secs { font-variant-numeric: tabular-nums; }
.inv-help { font-size: 3.73cqw; line-height: 1.33; color: var(--text-2); }
.inv-key { font-size: 3.98cqw; font-weight: 600; line-height: 1.31; }

/* 05 Features */

.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: clamp(56px, 7vw, 88px); }
.feature {
  position: relative; overflow: hidden;
  padding: 30px 28px 32px; border: 1px solid var(--line); border-radius: 24px;
  background: var(--surface-2);
  transition: transform 0.35s var(--ease), box-shadow 0.35s, border-color 0.35s;
}
.feature::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 70% at 0% 0%, color-mix(in srgb, var(--primary) 9%, transparent), transparent 60%);
  opacity: 0; transition: opacity 0.35s;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--primary) 30%, var(--line)); }
.feature:hover::before { opacity: 1; }

.ticks { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.ticks li {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 8px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: 12.5px; color: var(--text-2);
}
.ticks svg { width: 15px; height: 15px; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.t-wait, .t-sent { stroke: var(--text-2); }
.t-mesh { stroke: var(--live); }

.extras-block {
  display: grid; grid-template-columns: 250px 1fr; align-items: start; gap: 24px;
  margin-top: 56px; padding-top: 40px; border-top: 1px solid var(--line);
}
.extras-title { font-family: var(--font-display); font-size: 23px; font-style: italic; font-weight: 400; line-height: 1.3; }
.extras { display: flex; flex-wrap: wrap; gap: 10px; }
.extras li {
  display: inline-flex; align-items: center; gap: 9px; padding: 9px 16px 9px 13px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2);
  font-size: 14.5px;
}
.extras li::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }

/* Closing: around the fire, by night in the dark theme and by day in the light one */

.closing {
  position: relative; overflow: clip; isolation: isolate;
  padding-block: clamp(110px, 14vw, 190px);
  background: var(--closing-bg); color: var(--text); text-align: center;
}
.closing-glow {
  position: absolute; left: 50%; top: 50%; z-index: -1;
  width: min(960px, 130vw); aspect-ratio: 1; translate: -50% -50%;
  background: radial-gradient(circle, var(--closing-glow), var(--closing-glow-soft) 36%, transparent 64%);
  animation: flicker 5s ease-in-out infinite;
}
@keyframes flicker {
  0%, 100% { opacity: 0.9; scale: 1; }
  30% { opacity: 1; scale: 1.03; }
  55% { opacity: 0.8; scale: 0.99; }
  75% { opacity: 0.96; scale: 1.02; }
}
.closing-inner { display: grid; justify-items: center; gap: 26px; }
.closing-icon { width: 96px; height: 96px; filter: drop-shadow(0 26px 46px rgba(244, 106, 16, 0.5)); }
.closing h2, .closing h1 { color: var(--text); font-size: clamp(2.8rem, 1.4rem + 5vw, 5.4rem); }
.closing h1 { font-weight: 500; }
.lost { min-height: 100vh; min-height: 100dvh; display: grid; align-items: center; }
.closing p { max-width: 34rem; font-size: 18px; line-height: 1.6; color: var(--text-2); text-wrap: balance; }
.closing .btn { margin-top: 6px; }

.site-footer { padding-block: 52px 64px; background: var(--closing-bg); border-top: 1px solid var(--line); color: var(--text-2); }
.footer-inner { display: grid; justify-items: start; gap: 10px; }
.footer-brand {
  display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
  font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--text);
}
.site-footer p { font-size: 15px; }
.site-footer .fine { max-width: 72ch; font-size: 13px; color: var(--text-2); }

/* Reveal on scroll (only when the script runs, so nothing is hidden without it) */

.js .reveal {
  opacity: 0; translate: 0 22px;
  transition: opacity 0.9s var(--ease), translate 0.9s var(--ease);
}
.js .feature.reveal {
  transition: opacity 0.9s var(--ease), translate 0.9s var(--ease),
    transform 0.35s var(--ease), box-shadow 0.35s, border-color 0.35s;
}
.js .reveal.is-in { opacity: 1; translate: none; }
.js .facts .reveal:nth-child(2), .js .features .reveal:nth-child(3n + 2), .js .steps .reveal:nth-child(2) { transition-delay: 0.08s, 0.08s, 0s, 0s, 0s; }
.js .facts .reveal:nth-child(3), .js .features .reveal:nth-child(3n + 3), .js .steps .reveal:nth-child(3) { transition-delay: 0.16s, 0.16s, 0s, 0s, 0s; }
.js .steps .reveal:nth-child(4) { transition-delay: 0.24s; }

/* Responsive */

@media (max-width: 1020px) {
  .mesh { opacity: 0.55; }
  .mesh-packets { display: none; }
  .hero-grid, .intro, .why-grid, .how-grid, .mesh-card { grid-template-columns: 1fr; }
  .hero-devices { min-height: 0; padding-block: 36px 20px; }
  .device { --w: clamp(190px, 40vw, 270px); }
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .extras-block { grid-template-columns: 1fr; }
  .how-grid .showcase { order: -1; }
}

@media (max-width: 860px) {
  .flow { grid-template-columns: 1fr; padding: 30px 24px 26px; }
  .node { flex-direction: row; gap: 18px; width: auto; text-align: left; }
  .link { width: 64px; height: 58px; }
  .link::before { left: 50%; right: auto; top: 6px; bottom: 6px; border-top: 0; border-left: 1.5px dashed var(--line-strong); }
  .link-lora::before { border-top: 0; border-left: 2px dotted color-mix(in srgb, var(--infra) 60%, transparent); }
  .link-label { left: calc(50% + 26px); top: 50%; translate: 0 -50%; }
  .pk { left: calc(50% - 17px); top: 0; }
  .link.is-moving .pk { animation-name: travel-y; }
  .bubble { display: none; }
  .readout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  body { font-size: 16.5px; }
  .facts { grid-template-columns: 1fr; }
  .fact, .fact + .fact { padding: 30px 0 4px; border-left: 0; }
  .fact + .fact { border-top: 1px solid var(--line); margin-top: 26px; }
  .features { grid-template-columns: 1fr; }
  .nav-links { gap: 16px; font-size: 14.5px; }
  .nav-end { gap: 14px; }
  .actions .btn { flex: 1 1 auto; }
}

/* Phones: the five section links fold into a menu, so the header keeps the name, the menu and the theme. Only when
   the script runs: without it the links stay where they are. */
@media (max-width: 600px) {
  .js .menu-button { display: grid; }
  .js .nav-links {
    position: absolute; top: calc(100% + 16px); right: 0; z-index: 60;
    display: grid; gap: 2px; min-width: 200px; padding: 6px;
    border: 1px solid var(--line); border-radius: 16px;
    background: var(--surface-2); box-shadow: var(--shadow-md);
    font-size: 15px;
    opacity: 0; visibility: hidden; translate: 0 -4px;
    transition: opacity 0.18s var(--ease), translate 0.18s var(--ease), visibility 0s linear 0.18s;
  }
  .js .nav-end.is-open .nav-links {
    opacity: 1; visibility: visible; translate: none;
    transition: opacity 0.18s var(--ease), translate 0.18s var(--ease);
  }
  .js .nav-links a { display: flex; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--text); }
  .js .nav-links a:hover { background: var(--surface-alt); }
  .js .nav-links a::after {
    position: static; width: 7px; height: 7px; margin-left: auto; border-radius: 50%;
    transform: none; opacity: 0; transition: opacity 0.2s;
  }
  .js .nav-links a[aria-current] { color: var(--primary); font-weight: 600; }
  .js .nav-links a[aria-current]::after { opacity: 1; }
}

@media (max-width: 400px) {
  html:not(.js) .brand span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; translate: none; }
  .sparks, .mesh-packets, .pk, .bubble { display: none; }
}

.night { background: var(--closing-bg); }
