:root {
  --canopy: #0E5A44;
  --crown: #FFC63D;
  --ink: #1B1F1D;
  --muted: #5C6662;
  --paper: #FFFFFF;
  --mist: #F3F7F5;
  --line: #E3E7E5;
  --accent: var(--canopy);
  --on-canopy: #FFFFFF;
  --on-canopy-soft: #CFE5DB;
  --on-crown: #1B1F1D;
  --card: #FFFFFF;
  --socket: #6F7B75;
  --danger: #B3261E;
  --on-accent: #FFFFFF;
  --on-danger: #FFFFFF;
  --bezel: #141917;
  --board-top: #0E5A44;
  --board-bottom: #083A2D;
  --tile: #17624C;
  --tile-fill: #22775D;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ECEFED;
    --muted: #A3ADA9;
    --paper: #111614;
    --mist: #182320;
    --line: #2A322F;
    --accent: #6FD3AE;
    --card: #1A221E;
    --socket: #75837B;
    --danger: #FF8A80;
    --on-accent: #06281C;
    --on-danger: #3B0906;
    --bezel: #3A4541;
    --board-top: #124636;
    --board-bottom: #0A2E23;
    --tile: #124636;
    --tile-fill: #1B5C48;
  }
}

:root[data-theme="dark"] {
  --ink: #ECEFED;
  --muted: #A3ADA9;
  --paper: #111614;
  --mist: #182320;
  --line: #2A322F;
  --accent: #6FD3AE;
  --card: #1A221E;
  --socket: #75837B;
  --danger: #FF8A80;
  --on-accent: #06281C;
  --on-danger: #3B0906;
  --bezel: #3A4541;
  --board-top: #124636;
  --board-bottom: #0A2E23;
  --tile: #124636;
  --tile-fill: #1B5C48;
}
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }

html { font-size: 106.25%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

::selection { background: var(--crown); color: var(--on-crown); }

a { color: var(--accent); text-underline-offset: 0.18em; }
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
header a:focus-visible,
header button:focus-visible,
.hero a:focus-visible,
.privacy-band a:focus-visible { outline-color: var(--crown); }

.wrap { max-width: 680px; margin: 0 auto; padding: 0 1.25rem; }
.wrap-wide { max-width: 1060px; margin: 0 auto; padding: 0 1.25rem; }

/* Header */

header { background: var(--canopy); color: var(--on-canopy); }

header .wrap,
header .wrap-wide {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 4rem;
}

header a.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  color: var(--on-canopy);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.2rem;
}

header img { width: 36px; height: 36px; border-radius: 8px; }

header nav { margin-left: auto; display: flex; gap: 0.5rem; }
.theme-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -0.4rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--on-canopy);
  cursor: pointer;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.12); }
.theme-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}
header nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.6rem;
  color: var(--on-canopy);
  text-decoration: none;
  opacity: 0.85;
}
header nav a:hover,
header nav a[aria-current="page"] {
  opacity: 1;
  text-decoration: underline;
  text-decoration-color: var(--crown);
  text-underline-offset: 4px;
}

/* Text pages */

main.wrap { padding-top: 2.5rem; padding-bottom: 3.5rem; }

h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 0.5rem; text-wrap: balance; }
h2 { font-size: 1.2rem; line-height: 1.3; margin: 2rem 0 0.5rem; text-wrap: balance; }
p, li { margin: 0 0 0.75rem; text-wrap: pretty; }
ul { padding-left: 1.3rem; }

.lead { font-size: 1.2rem; color: var(--muted); margin-bottom: 1.75rem; }
.meta { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.75rem; }

.not-found { text-align: center; padding-top: 4rem; padding-bottom: 5rem; }
.not-found img { width: 96px; height: 96px; border-radius: 22px; margin-bottom: 1.25rem; }

/* Footer */

footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }
footer .wrap,
footer .wrap-wide {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 1.25rem;
  padding-top: 0.75rem;
  padding-bottom: 1.5rem;
}
footer span { padding: 0.75rem 0; margin-right: auto; }
footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
}

@media (max-width: 30rem) {
  header nav a { padding: 0 0.4rem; }
  footer span { width: 100%; }
}

/* Home */

.home main { overflow-x: clip; }

.hero {
  background: var(--canopy);
  color: var(--on-canopy);
  padding: 3rem 0 4rem;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 27rem);
  gap: 3.5rem;
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.4rem, 1.4rem + 3.6vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin-bottom: 1.25rem;
}
.hero h1 span { color: var(--crown); }
.hero-lead {
  font-size: clamp(1.15rem, 1rem + 0.5vw, 1.35rem);
  color: var(--on-canopy-soft);
  max-width: 32rem;
  margin-bottom: 1.75rem;
}
.availability {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  font-weight: 600;
  font-size: 1rem;
}
.availability::before {
  content: "";
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--crown);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--crown) 30%, transparent);
}

/* Playable example */

.demo {
  background: var(--paper);
  color: var(--ink);
  border-radius: 28px;
  padding: 1.25rem;
  box-shadow: 0 24px 48px -20px rgba(2, 24, 17, 0.55);
}
.demo-title { font-size: 1.6rem; font-weight: 800; margin: 0; }
.demo-about { color: var(--muted); font-size: 0.9rem; margin: 0.15rem 0 0.75rem; }

.demo-board {
  border-radius: 22px;
  padding: 10px;
  background: linear-gradient(180deg, var(--board-top), var(--board-bottom));
}
.demo-tiles { position: relative; height: calc(3 * 3.5rem + 12px); }
.tile {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.9rem;
  border-radius: 14px;
  background: var(--tile);
  color: #FFFFFF;
  overflow: hidden;
}
.demo.ready .tile { transition: transform 420ms cubic-bezier(0.16, 1, 0.3, 1), background-color 200ms ease; }
.demo.ready .tile-bar { transition: width 420ms cubic-bezier(0.16, 1, 0.3, 1); }
.tile-bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--tile-fill);
}
.tile > :not(.tile-bar) { position: relative; }
.tile-rank { width: 1.1rem; font-weight: 800; font-size: 1.05rem; }
.tile-names { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.tile-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-tag { font-size: 0.72rem; font-weight: 700; }
.tile-tag:empty { display: none; }
.tile-score { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile.mine { box-shadow: inset 0 0 0 2px #FFFFFF; }
.tile.leading { background: #F2AE14; color: #2A1A00; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.45); }
.tile.leading .tile-bar { background: var(--crown); }
.tile.leading.mine { box-shadow: inset 0 0 0 2px #2A1A00, 0 6px 14px -6px rgba(0, 0, 0, 0.45); }
.tile.out { background: #3A4541; }
.tile.out .tile-bar { display: none; }
.tile.out .tile-score { text-decoration: line-through; }
.tile-score.pop { animation: pop 380ms cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes pop { 40% { transform: scale(1.28); } }
.tile.sheen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: sheen 700ms ease-out 120ms forwards;
}
@keyframes sheen { to { transform: translateX(100%); } }

.demo-status {
  min-height: 4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0;
}
.demo-status > div { flex: 1; }
.demo-status p { margin: 0; font-weight: 600; font-size: 0.95rem; }
.demo-status .demo-status-title { font-weight: 800; font-size: 1rem; }
.demo-status-title[data-state="yes"],
.demo-status-title[data-state="great"] { color: var(--accent); }
.demo-status-title[data-state="no"] { color: var(--danger); }
.demo-undo {
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.25rem;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.demo-list { font-size: 0.8rem; font-weight: 600; color: var(--muted); margin: 0 0 0.4rem; }
.demo-rows { display: grid; gap: 0.5rem; }

.tick-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 3.5rem;
  padding: 0.35rem 0.5rem 0.35rem 0.9rem;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 2px 8px -3px rgba(16, 40, 31, 0.18);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 120ms ease;
}
.tick-row:active { transform: scale(0.985); }
.tick-text { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; column-gap: 0.4rem; }
.tick-name { font-weight: 600; }
.must {
  font-size: 0.7rem;
  font-weight: 800;
  border: 1px solid var(--socket);
  border-radius: 6px;
  padding: 0 0.35rem;
}
.tick-answer { width: 100%; font-size: 0.82rem; font-weight: 700; color: var(--accent); }
.tick-row[data-state="none"] .tick-answer { color: var(--muted); font-weight: 600; }
.tick-row.must-no .tick-answer { color: var(--danger); }
.tick-points { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.socket {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border: 2px solid var(--socket);
  border-radius: 14px;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.socket svg { width: 24px; height: 24px; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.socket path { display: none; }
.tick-row[data-state="yes"] .socket { background: var(--accent); border-color: var(--accent); stroke: var(--on-accent); }
.tick-row[data-state="great"] .socket { background: var(--crown); border-color: var(--crown); stroke: #2A1A00; }
.tick-row[data-state="no"] .socket { background: var(--danger); border-color: var(--danger); stroke: var(--on-danger); }
.tick-row[data-state="yes"] .m-yes,
.tick-row[data-state="great"] .m-great,
.tick-row[data-state="no"] .m-no { display: block; }
.tick-row.invite .socket { animation: invite 1.6s ease-in-out 3; }
@keyframes invite { 50% { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); } }

.demo-key-title { font-size: 0.8rem; font-weight: 700; color: var(--ink); margin: 0.9rem 0 0.35rem; }
.demo-key {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  padding: 0;
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.demo-key li { display: flex; align-items: center; gap: 0.35rem; margin: 0; }
.demo-key li.active { color: var(--ink); font-weight: 700; }
.key-mark { width: 0.85rem; height: 0.85rem; border-radius: 4px; border: 2px solid var(--socket); }
.demo-key [data-state="yes"] .key-mark { background: var(--accent); border-color: var(--accent); }
.demo-key [data-state="great"] .key-mark { background: var(--crown); border-color: var(--crown); }
.demo-key [data-state="no"] .key-mark { background: var(--danger); border-color: var(--danger); }
.demo-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); margin: 0; }

/* Features */

.feature { padding: 4.5rem 0; }
.feature + .feature { padding-top: 1rem; }
.feature-grid {
  display: grid;
  grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
  gap: 4rem;
  align-items: center;
}
.feature-grid.flip .phone { order: 2; }
.voice-steps { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 1rem; }
.voice-steps li { margin: 0; padding-top: 0.9rem; border-top: 2px solid var(--accent); color: var(--muted); }
.voice-steps strong { display: block; color: var(--ink); margin-bottom: 0.15rem; }
.feature-copy { max-width: 34rem; }
.feature h2 {
  font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.4rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
.feature-copy p { font-size: 1.05rem; color: var(--muted); }
.feature-copy strong { color: var(--ink); }

.phone { margin: 0; justify-self: center; width: 100%; max-width: 20rem; }
.phone img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2.4rem;
  border: 9px solid var(--bezel);
  background: var(--bezel);
  box-shadow: 0 30px 50px -28px rgba(10, 40, 30, 0.55);
}

.uses { margin: 1.5rem 0 0; }
.uses dt { font-weight: 700; margin-top: 1rem; }
.uses dd { margin: 0.2rem 0 0; color: var(--muted); }

/* iPhone Duo: folds open as you scroll */

.duo { padding: 3rem 0; }
.duo-sticky {
  display: grid;
  grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
}
.duo h2 {
  font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.4rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
}
.duo-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.9rem; }
.duo-steps li {
  margin: 0;
  padding-left: 1rem;
  border-left: 0;
  color: var(--muted);
  position: relative;
  transition: color 200ms ease, opacity 200ms ease;
}
.duo-steps li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--line);
  transition: background-color 200ms ease, transform 200ms ease;
}
.duo-steps strong { display: block; color: var(--ink); }
.is-scrolly .duo-steps li { opacity: 0.45; }
.is-scrolly .duo-steps li.active { opacity: 1; }
.duo-steps li.active::before { background: var(--accent); transform: scale(1.5); }
.duo-note { margin: 1.5rem 0 0; color: var(--muted); font-size: 0.95rem; }

.duo-stage { margin: 0; display: grid; place-items: center; }
.duo-stage > img.duo-inner {
  display: block;
  width: min(100%, 46rem);
  height: auto;
  border-radius: 1.6rem;
  border: 8px solid var(--bezel);
  background: var(--bezel);
}

/* Real 3D phones (device3d.js). The <img> stays for screen readers and as the fallback. */
.is-3d { position: relative; }
.is-3d > img {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0 !important;
  box-shadow: none !important;
}
.device-canvas { display: block; width: 100%; }
/* Life size: the camera frames each phone with a fixed margin, so these widths show the real device at its real size (CSS millimetres). */
.phone.is-3d { width: min(100%, 82.7mm); max-width: none; }
.phone.turns.is-3d { width: min(100%, 159mm); }
.phone.turns .device-canvas { aspect-ratio: 1; }
.feature-grid.turns-grid { grid-template-columns: minmax(0, 159mm) minmax(0, 1fr); }
.feature-grid.turns-grid.flip { grid-template-columns: minmax(0, 1fr) minmax(0, 159mm); }
.phone .device-canvas { aspect-ratio: 0.52; filter: drop-shadow(0 28px 24px rgba(10, 40, 30, 0.22)); }
.duo-stage .device-canvas { width: min(100%, 204mm); aspect-ratio: 1.55; filter: drop-shadow(0 30px 26px rgba(10, 40, 30, 0.22)); }

.is-scrolly .duo-track { height: 280vh; }
.is-scrolly .duo-stage .device-canvas { width: min(100%, 204mm, (100svh - 3rem) * 1.55); }
.duo-sticky.wrap-wide { max-width: 88rem; }
.is-scrolly .duo-sticky {
  position: sticky;
  top: 0;
  min-height: 100vh;
  min-height: 100svh;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

/* Privacy */

.privacy-band {
  margin-top: 3.5rem;
  padding: 4.5rem 0;
  background: var(--canopy);
  color: var(--on-canopy);
}
.privacy-band h2 {
  font-size: clamp(1.9rem, 1.3rem + 2vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
.band-lead { font-size: 1.2rem; color: var(--on-canopy-soft); max-width: 38rem; margin-bottom: 2.5rem; }
.promises {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.75rem 3rem;
}
.promises li { margin: 0; color: var(--on-canopy-soft); padding-top: 1rem; border-top: 2px solid var(--crown); }
.promises strong { display: block; color: var(--on-canopy); font-size: 1.1rem; margin-bottom: 0.2rem; }
.band-more { margin: 2.5rem 0 0; }
.band-more a { color: var(--on-canopy); text-decoration-color: var(--crown); }

/* Closing */

.closing { text-align: center; padding: 4.5rem 0 4rem; }
.closing img { width: 96px; height: 96px; border-radius: 22px; margin-bottom: 1rem; }
.closing h2 { font-size: 1.7rem; margin: 0 0 0.75rem; }
.closing p { color: var(--muted); }
.closing .availability { margin-top: 1rem; color: var(--ink); }

@media (max-width: 52rem) {
  /* The iPhone Duo section is for larger screens only. */
  .duo { display: none; }
  /* Stacked layout: heading and step sit above the phone, so leave room for them in the viewport. */
  .is-scrolly .duo-stage .device-canvas { width: min(100%, (100svh - 16rem) * 1.55); }
  .hero { padding: 2.25rem 0 2.5rem; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .feature { padding: 3rem 0; }
  .feature-grid, .feature-grid.turns-grid, .feature-grid.turns-grid.flip { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .feature-grid.flip .phone { order: 0; }
  .phone { max-width: 17rem; }
  .phone.is-3d { width: min(100%, 82.7mm); max-width: none; }
  .phone.turns.is-3d { width: min(100%, 82.7mm); }
  .phone.turns .device-canvas { aspect-ratio: 0.52; }
  .duo-sticky { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; align-content: center; }
  /* One cell for all steps, so the heading and phone never shift when the step changes. */
  .is-scrolly .duo-steps li { grid-area: 1 / 1; visibility: hidden; }
  .is-scrolly .duo-steps li.active { visibility: visible; }
  .duo-note { display: none; }
  .promises { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 30rem) {
  .demo { padding: 1rem; border-radius: 22px; margin: 0 -0.25rem; }
  .tile-name { font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
  .demo.ready .tile, .demo.ready .tile-bar { transition-duration: 1ms; }
  .tile-score.pop, .tile.sheen::after { animation: none; }
  .tick-row.invite .socket { animation: none; border-color: var(--accent); }
}
