/*
 * KidCloak marketing site: one stylesheet for every page.
 *
 * Colors mirror the app's design system (KidCloak/Views/Theme.swift, teal
 * accent) so the site and the app feel like one product. Every token is a
 * light/dark pair, switched by prefers-color-scheme.
 */

/* ---------- Tokens ---------- */

:root {
  color-scheme: light dark;

  /* Theme.swift → AccentChoice.teal */
  --accent: #0F766E;          /* fill: buttons, selected states (white text 5.5:1) */
  --accent-tint: #0F766E;     /* accent text/icons on the page background */
  --accent-soft: #E3F5F2;     /* chips, tinted panels */
  --on-accent: #FFFFFF;

  /* Theme.warm: amber highlight for the fun moments (decoration only, never body text) */
  --warm: #F59E0B;
  --warm-soft: #FEF3C7;

  /* Neutrals (Theme.background / surface / text / separator) */
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --text: #111318;
  --text-2: #5B6170;
  --line: #E2E4E9;
  --shadow: 0 1px 2px rgb(17 19 24 / 0.04), 0 8px 24px rgb(17 19 24 / 0.07);

  /* Theme.Radius */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;

  /* Rounded system type, same feel as the app's .rounded design. No web fonts. */
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI",
          Roboto, "Helvetica Neue", Arial, sans-serif;

  --max: 1120px;
  --gutter: clamp(16px, 5vw, 32px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #0F766E;        /* light-mode fill kept: white text stays above 4.5:1 */
    --accent-tint: #2DD4BF;
    --accent-soft: #133A37;
    --warm: #FBBF24;
    --warm-soft: #3A2E12;
    --bg: #0F1012;
    --surface: #1C1E24;
    --text: #F2F3F5;
    --text-2: #9AA0AD;
    --line: #2C2E36;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
  }
}

/* ---------- Base ---------- */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
}

img, svg { display: block; max-width: 100%; }

h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.015em; }
h1 { font-size: clamp(2.25rem, 6vw + 0.5rem, 4rem); font-weight: 800; }
h2 { font-size: clamp(1.75rem, 3vw + 0.75rem, 2.5rem); font-weight: 800; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }

a { color: var(--accent-tint); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--accent-tint);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; left: 12px; top: -100px; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: 10px 16px; border-radius: 999px; font-weight: 700;
}
.skip-link:focus { top: 12px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 64px;
}
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.2rem;
}
.logo svg { width: 32px; height: 32px; flex: none; }

.site-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.site-nav a {
  display: block; padding: 8px 12px; border-radius: 999px;
  color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 0.95rem;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); background: var(--accent-soft); }

/* Phone: just the logo + "Join the beta" pill; the other links live in the
   footer and the page itself. */
@media (max-width: 760px) {
  .site-nav { display: none; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 24px; border-radius: 999px;
  font: inherit; font-weight: 700; font-size: 1rem; text-decoration: none;
  border: 1.5px solid transparent; cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn-secondary {
  background: var(--surface); color: var(--accent-tint);
  border-color: color-mix(in srgb, var(--accent-tint) 50%, transparent);
}
.btn-small { min-height: 40px; padding: 8px 16px; font-size: 0.95rem; }

/* App Store placeholder: deliberately not a link (there's nothing to link to yet). */
.store-badge {
  display: inline-flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 8px 20px 8px 16px; border-radius: 14px;
  background: var(--text); color: var(--bg);
  border: 1px solid var(--line);
}
.store-badge svg { width: 26px; height: 26px; flex: none; }
.store-badge small { display: block; font-size: 0.72rem; line-height: 1.1; opacity: 0.8; font-weight: 600; }
.store-badge strong { display: block; font-size: 1.1rem; line-height: 1.2; }

/* ---------- Sections ---------- */

section { padding-block: clamp(56px, 9vw, 104px); scroll-margin-top: 64px; }
.section-alt { background: var(--surface); border-block: 1px solid var(--line); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 14px; padding: 4px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-tint);
  font-size: 0.85rem; font-weight: 700; letter-spacing: 0.01em;
}
.section-head { max-width: 680px; margin-bottom: clamp(32px, 5vw, 48px); }
.section-head.center { margin-inline: auto; text-align: center; }
.lede { font-size: clamp(1.1rem, 1vw + 0.9rem, 1.3rem); color: var(--text-2); }

/* ---------- Hero ---------- */

.hero { padding-block: clamp(32px, 6vw, 80px) clamp(56px, 8vw, 96px); }
.hero .wrap {
  display: grid; gap: clamp(32px, 5vw, 64px); align-items: center;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) { .hero .wrap { grid-template-columns: 1.05fr 1fr; } }

.hero h1 { text-wrap: balance; }
.hero h1 .hl {
  white-space: nowrap;
  /* the warm amber underline: the one "fun" flourish in the headline */
  background: linear-gradient(transparent 68%, color-mix(in srgb, var(--warm) 55%, transparent) 68% 92%, transparent 92%);
  padding-inline: 0.05em;
}
@media (prefers-color-scheme: dark) {
  /* a translucent amber band reads muddy brown on the dark page: use a thinner solid stripe */
  .hero h1 { text-wrap: balance; }
.hero h1 .hl {
  white-space: nowrap; background: linear-gradient(transparent 84%, var(--warm) 84% 93%, transparent 93%); }
}
.hero .lede { max-width: 32ch; margin-bottom: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.hero-note { margin-top: 20px; color: var(--text-2); font-size: 0.95rem; display: flex; gap: 8px; align-items: center; }
.hero-note svg { width: 18px; height: 18px; color: var(--accent-tint); flex: none; }

/* ---------- Before / after slider ---------- */

.compare {
  --pos: 50%;
  position: relative; aspect-ratio: 1 / 1; width: 100%; max-width: 560px; margin-inline: auto;
  border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  background: var(--accent-soft);
  touch-action: pan-y; /* vertical swipes still scroll the page on phones */
  user-select: none; -webkit-user-select: none;
}
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
/* The "after" (covered) image is revealed to the RIGHT of the divider. */
.compare .after { clip-path: inset(0 0 0 var(--pos)); }

.compare-label {
  position: absolute; top: 12px; z-index: 2;
  padding: 4px 10px; border-radius: 999px;
  background: rgb(0 0 0 / 0.55); color: #fff; font-size: 0.8rem; font-weight: 700;
  pointer-events: none;
}
.compare-label.before { left: 12px; }
.compare-label.after-label { right: 12px; }

.compare-divider {
  position: absolute; top: 0; bottom: 0; left: var(--pos); z-index: 2;
  width: 3px; margin-left: -1.5px; background: #fff;
  box-shadow: 0 0 4px rgb(0 0 0 / 0.35); pointer-events: none;
}
.compare-handle {
  position: absolute; top: 50%; left: 50%; width: 44px; height: 44px;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: #fff; box-shadow: 0 2px 8px rgb(0 0 0 / 0.3);
  display: grid; place-items: center; color: #0F766E;
}
.compare-handle svg { width: 22px; height: 22px; }

/* The real control: a full-size, invisible range input. Gives keyboard,
   screen-reader, and touch support for free. */
.compare input[type="range"] {
  position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: ew-resize;
  -webkit-appearance: none; appearance: none; background: transparent;
}
.compare input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 44px; height: 100%; }
.compare input[type="range"]::-moz-range-thumb { width: 44px; height: 100%; border: 0; }
.compare:has(input:focus-visible) { outline: 3px solid var(--accent-tint); outline-offset: 4px; }
.compare:has(input:focus-visible) .compare-handle { box-shadow: 0 0 0 4px var(--accent-tint), 0 2px 8px rgb(0 0 0 / 0.3); }

.compare-caption { margin-top: 12px; text-align: center; color: var(--text-2); font-size: 0.9rem; }

/* A gentle one-time nudge so people notice it's draggable (JS adds .nudge;
   reduced motion turns it off via the global rule above). */
.compare.nudge .after, .compare.nudge .compare-divider { transition: clip-path 0.9s ease-in-out, left 0.9s ease-in-out; }

/* ---------- Steps ---------- */

.steps { display: grid; gap: 20px; grid-template-columns: 1fr; counter-reset: step; list-style: none; padding: 0; margin: 0; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step {
  position: relative; padding: 28px 24px 24px; border-radius: var(--r-lg);
  background: var(--bg); border: 1px solid var(--line);
}
.step-num {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--warm); color: #111318; font-weight: 800; margin-bottom: 16px;
}
.step-icon { width: 56px; height: 56px; color: var(--accent-tint); margin-bottom: 14px; }
.step p { color: var(--text-2); margin: 0; }

/* ---------- Cards / features ---------- */

.grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2, .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.card {
  padding: 24px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.section-alt .card { background: var(--bg); box-shadow: none; }
.card p { color: var(--text-2); margin: 0; }
.card .icon {
  width: 48px; height: 48px; border-radius: 14px; margin-bottom: 16px;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-tint);
}
.card .icon svg { width: 26px; height: 26px; }

/* Cover-style swatches inside the "4 cover styles" card */
.styles-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.style-chip { text-align: center; font-size: 0.8rem; font-weight: 700; color: var(--text-2); }
.style-chip svg { width: 100%; height: auto; border-radius: 12px; margin-bottom: 6px; }

/* ---------- Privacy ---------- */

.privacy-band {
  background: linear-gradient(160deg, #0F766E, #0B5B55);
  color: #F2FBF9;
}
.privacy-band .eyebrow { background: rgb(255 255 255 / 0.14); color: #fff; }
.privacy-band .lede { color: rgb(242 251 249 / 0.85); }
.privacy-band a { color: #fff; }
.privacy-band :focus-visible { outline-color: #fff; }
@media (prefers-color-scheme: dark) {
  .privacy-band { background: linear-gradient(160deg, #0E3B38, #0B2725); }
}
.promise-list { display: grid; gap: 16px; grid-template-columns: 1fr; list-style: none; padding: 0; margin: 0; }
@media (min-width: 720px) { .promise-list { grid-template-columns: repeat(2, 1fr); } }
.promise {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 20px; border-radius: var(--r-md);
  background: rgb(255 255 255 / 0.08); border: 1px solid rgb(255 255 255 / 0.14);
}
.promise svg { width: 28px; height: 28px; flex: none; color: #FBBF24; margin-top: 2px; }
.promise h3 { margin-bottom: 4px; }
.promise p { margin: 0; color: rgb(242 251 249 / 0.85); }
.fine-print { margin-top: 28px; font-size: 0.95rem; color: rgb(242 251 249 / 0.8); max-width: 760px; }

/* ---------- Audience ---------- */

.audience .card h3 { display: flex; gap: 12px; align-items: center; }
.audience .card h3 svg { width: 32px; height: 32px; color: var(--warm); flex: none; }

/* ---------- FAQ ---------- */

.faq { max-width: 800px; margin-inline: auto; }
.faq details {
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line);
  margin-bottom: 12px;
}
.faq summary {
  cursor: pointer; list-style: none; padding: 18px 56px 18px 20px; position: relative;
  font-weight: 700; font-size: 1.05rem; border-radius: var(--r-md);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 20px; top: 50%; width: 12px; height: 12px;
  border-right: 2.5px solid var(--accent-tint); border-bottom: 2.5px solid var(--accent-tint);
  transform: translateY(-70%) rotate(45deg); transition: transform 0.2s ease;
}
.faq details[open] summary::after { transform: translateY(-30%) rotate(225deg); }
.faq .answer { padding: 0 20px 18px; color: var(--text-2); }
.faq .answer p:last-child { margin-bottom: 0; }

/* ---------- Beta signup ---------- */

.signup {
  max-width: 760px; margin-inline: auto; text-align: center;
  padding: clamp(28px, 5vw, 48px); border-radius: var(--r-lg);
  background: var(--warm-soft); border: 1px solid color-mix(in srgb, var(--warm) 40%, transparent);
}
.signup form { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 20px; }
.signup label.visually-hidden + input { flex: 1 1 260px; }
.signup input[type="email"] {
  flex: 1 1 260px; max-width: 380px; min-height: 48px; padding: 10px 18px;
  font: inherit; color: var(--text); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 999px;
}
.signup input[type="email"]:focus-visible { border-color: var(--accent-tint); outline-offset: 2px; }
.signup .form-note { margin: 14px 0 0; font-size: 0.9rem; color: var(--text-2); }
.signup .form-status { margin: 14px 0 0; font-weight: 700; color: var(--text); }
.signup .form-status:empty { display: none; }

/* ---------- Footer ---------- */

.site-footer { padding-block: 48px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 0.95rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 24px 48px; justify-content: space-between; align-items: flex-start; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 24px; }
.site-footer a { color: var(--text-2); }
.site-footer a:hover { color: var(--text); }
.site-footer .logo { font-size: 1.05rem; margin-bottom: 8px; }
.site-footer p { margin: 0 0 4px; }

/* ---------- Document pages (privacy / support / terms) ---------- */

.doc { padding-block: clamp(32px, 6vw, 64px) 72px; }
.doc .wrap { max-width: 780px; }
.doc h1 { font-size: clamp(2rem, 4vw + 0.5rem, 3rem); }
.doc h2 { font-size: 1.5rem; margin-top: 2em; }
.doc h3 { margin-top: 1.5em; }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc li { margin-bottom: 0.4em; }
.doc .updated { color: var(--text-2); }
.draft-banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px 20px; margin-bottom: 32px; border-radius: var(--r-md);
  background: var(--warm-soft); border: 1px solid color-mix(in srgb, var(--warm) 45%, transparent);
}
.draft-banner svg { width: 22px; height: 22px; flex: none; color: var(--warm); margin-top: 3px; }
.draft-banner p { margin: 0; }
.summary-box {
  padding: 20px 24px; border-radius: var(--r-md); margin-bottom: 8px;
  background: var(--accent-soft);
}
.summary-box ul { margin: 0; }
.doc table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table-scroll { overflow-x: auto; margin-bottom: 1em; }
.doc th, .doc td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { font-weight: 700; }
