/* Ground, on the web. Tokens from SPEC.md §2.2 "Afterglow".
   Dark is the design. Light follows the system, or data-theme when set.

   Fonts are the faces shipped in the app, subset for the web:
     fonttools varLib.instancer google_sans_flex.ttf slnt=0 -o flex.ttf
     pyftsubset flex.ttf --unicodes="U+0000-00FF,U+0131,U+0152-0153,
       U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,
       U+2190-2199,U+2212,U+2215,U+2248,U+2260,U+2264-2265,U+2026"
       --layout-features='*' --flavor=woff2
   Google Sans Code takes the same subset, with every axis kept. */

@font-face {
  font-family: "Google Sans Flex";
  src: url("/projects/cachette/fonts/google-sans-flex.woff2") format("woff2");
  font-weight: 1 1000;
  font-stretch: 25% 151%;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Google Sans Code";
  src: url("/projects/cachette/fonts/google-sans-code.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

/* ── Tokens ─────────────────────────────────────────────────────────── */

:root {
  color-scheme: dark;
  --bg: #100c18;
  --bg-deep: #0a0710;
  --ink: #fbf6ff;
  --ink-2: #d8cceb;
  --outline: #9b8fb3;
  --line: #312842;
  --primary: #ffb84d;
  --error: #ff8c82;
  --trail-from: #c9a8ff;
  --trail-to: #ffb84d;
  --grad: 0;
  --sans: "Google Sans Flex", "Google Sans", "Roboto Flex", system-ui, sans-serif;
  --code: "Google Sans Code", "Roboto Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --gutter: clamp(1rem, 4.5vw, 2.5rem);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #fff8f3;
    --bg-deep: #fbeadf;
    --ink: #1f1a17;
    --ink-2: #4e4239;
    --outline: #85766b;
    --line: #e6d3c5;
    --primary: #7a3f00;
    --error: #a8111a;
    --trail-from: #5a2dbf;
    --trail-to: #b35a00;
    --grad: 25;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fff8f3;
  --bg-deep: #fbeadf;
  --ink: #1f1a17;
  --ink-2: #4e4239;
  --outline: #85766b;
  --line: #e6d3c5;
  --primary: #7a3f00;
  --error: #a8111a;
  --trail-from: #5a2dbf;
  --trail-to: #b35a00;
  --grad: 25;
}

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

/* ── Base ───────────────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  font-variation-settings: "ROND" 0, "GRAD" var(--grad);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: color-mix(in srgb, var(--primary) 34%, transparent);
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
  margin: 0;
  padding: 0;
}

h1,
h2,
h3 {
  font-weight: 680;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-wrap: balance;
}

p,
li,
dd {
  text-wrap: pretty;
}

code {
  font-family: var(--code);
  font-size: 0.88em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  background: var(--primary);
  color: var(--bg);
  font-weight: 650;
  text-decoration: none;
}

.skip:focus {
  top: 0.75rem;
}

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

.eyebrow,
.status,
dt,
.cannot h3 {
  font-family: var(--code);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.lede {
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 34rem;
}

/* ── Bar ────────────────────────────────────────────────────────────── */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.25rem;
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 680;
  font-size: clamp(2.75rem, 13vw, 5rem);
  text-decoration: none;
}

.mark img {
  width: clamp(3.5rem, 15vw, 5.5rem);
  height: auto;
  border-radius: 28%;
}

.bar nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.9rem;
}

.bar nav a {
  color: var(--ink-2);
  text-decoration: none;
}

.bar nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ── Hero ───────────────────────────────────────────────────────────── */

.hero {
  display: grid;
  gap: 2.5rem;
  align-items: start;
  padding-block: clamp(0.5rem, 2vw, 1.5rem) clamp(2.5rem, 5vw, 3.5rem);
}

.hero-copy {
  display: grid;
  gap: 1.25rem;
  align-content: start;
}

h1 {
  font-size: clamp(2.6rem, 6vw, 4.25rem);
  font-weight: 720;
  letter-spacing: -0.035em;
  line-height: 1;
}

.accent {
  color: var(--primary);
}

.status {
  color: var(--outline);
  letter-spacing: 0.08em;
}

.phone {
  justify-self: center;
  width: min(72vw, 16.5rem);
  padding: 0.55rem;
  border-radius: 2.6rem;
  background: #0a0710;
  box-shadow:
    inset 0 0 0 1px #2e2640,
    0 0 0 1px rgb(0 0 0 / 0.4),
    0 40px 80px -40px rgb(0 0 0 / 0.9);
}

.phone video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 540 / 1170;
  border-radius: 2.1rem;
  background: #100c18;
}

@media (min-width: 860px) {
  .hero {
    grid-template-columns: 1fr auto;
    gap: 4rem;
  }
}

/* ── Sections ───────────────────────────────────────────────────────── */

.block {
  padding-block: clamp(2.5rem, 6vw, 4rem);
  border-top: 1px solid var(--line);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin-bottom: 1.75rem;
}

.spec {
  display: grid;
  column-gap: 3rem;
}

.spec div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1rem;
  padding-block: 0.85rem;
  border-top: 1px solid var(--line);
}

dt {
  padding-top: 0.2rem;
  color: var(--primary);
}

dd {
  font-size: 0.97rem;
  line-height: 1.5;
  color: var(--ink-2);
}

@media (min-width: 900px) {
  .spec {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .spec div {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

/* ── Before you install ─────────────────────────────────────────────── */

.yours {
  display: grid;
  gap: 2.5rem;
}

.yours .warn {
  color: var(--error);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 760;
  max-width: 18ch;
  margin-bottom: 1rem;
}

.rules {
  display: grid;
  gap: 0.6rem;
  margin-top: 1.5rem;
  padding-left: 1.9rem;
  color: var(--ink-2);
}

.rules li::marker {
  font-family: var(--code);
  color: var(--primary);
}

.rules strong {
  color: var(--ink);
  font-weight: 620;
}

.cannot {
  align-self: start;
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
}

.cannot h3 {
  margin-bottom: 0.75rem;
}

.cannot ul {
  display: grid;
  gap: 0.5rem;
  padding-left: 1.1rem;
  color: var(--ink-2);
  font-size: 0.97rem;
}

@media (min-width: 860px) {
  .yours {
    grid-template-columns: 1.4fr 1fr;
    gap: 4rem;
  }
}

/* ── Download ───────────────────────────────────────────────────────── */

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.cta {
  display: inline-block;
  padding: 0.8rem 1.4rem;
  border-radius: 8px;
  background: var(--primary);
  color: var(--bg);
  font-weight: 680;
  text-decoration: none;
}

.cta:hover,
.cta:focus-visible {
  color: var(--bg);
  text-decoration: none;
  background: color-mix(in srgb, var(--primary) 82%, var(--ink));
}

.hero-actions .aside {
  color: var(--ink-2);
  font-family: var(--code);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legal {
  margin-top: 1.5rem;
  color: var(--ink-2);
  font-size: 0.95rem;
}

.legal a {
  color: var(--ink);
}

/* ── Preferences ────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: var(--outline);
    --ink-2: var(--ink);
  }
}
