/* ============================================================
   tootly.ai — Design system stylesheet
   Single stylesheet, all pages. Owns tokens, type scale, layout
   primitives, and every component. Pages own content order only.
   Per DESIGN-SPEC.md (Cindy) — light theme only, mobile-first,
   zero JavaScript-dependent styling.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Locked brand tokens (design spec §5 — do not rename) */
  --surface:          #FAF7F1;
  --surface-card:     #F2EEE5;
  --surface-elevated: #EDE8DD;
  --ink:               #0E0E10;
  --muted:             #6B6B6E;
  --accent:            #12522E;
  --accent-hover:      #0E3F23;
  --text-inverse:      #FAF7F1;

  /* Extended (site-only, additive) */
  --border-default:   #D8D4CC;
  --border-subtle:    #E4E0D8;
  --accent-tint-6:    rgba(18, 82, 46, 0.06);
  --accent-light:     #D1FAE5;
  --warn:              #A16207;
  --warn-bg:           #FEF9C3;
  --error:             #B91C1C;

  /* Fonts — system-sans stack only. Inter Tight is NOT self-hosted: no
     licensed woff2 source exists anywhere in the Tootly repo (confirmed,
     DESIGN-SPEC.md §F.1 / INVESTIGATION.md §5), and the shipped app itself
     renders system-sans everywhere (fonts.ts is a documented no-op stub —
     team memory reference_tootly_fonts_stub_not_loaded.md). Shipping a
     @font-face pointed at a file that doesn't exist would 404 on every
     page load. This is DESIGN-SPEC §F.1's own stated one-line fix,
     applied: the site matches what the app actually renders today. */
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Type scale */
  --text-display-size: clamp(2.5rem, 4vw + 1.5rem, 4rem);       /* 40px -> 64px */
  --text-display-leading: 1.08;
  --text-h1-size: clamp(1.875rem, 2.5vw + 1.25rem, 2.75rem);     /* 30px -> 44px */
  --text-h1-leading: 1.18;
  --text-h2-size: clamp(1.5rem, 1.2vw + 1.2rem, 1.875rem);       /* 24px -> 30px */
  --text-h2-leading: 1.25;
  --text-h3-size: clamp(1.25rem, 0.4vw + 1.15rem, 1.375rem);     /* 20px -> 22px */
  --text-h3-leading: 1.3;
  --text-body-lg-size: 1.25rem;    /* 20px */
  --text-body-size: 1.125rem;      /* 18px */
  --text-body-sm-size: 1.0625rem;  /* 17px */
  --text-label-size: 1rem;         /* 16px */
  --text-eyebrow-size: 0.8125rem;  /* 13px */
  --text-caption-size: 0.8125rem;  /* 13px */

  /* Spacing (8px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;

  /* Radius / shadow / motion */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 3px rgba(14,14,16,0.06), 0 1px 2px rgba(14,14,16,0.04);
  --shadow-lift: 0 2px 8px rgba(14,14,16,0.10);
  --shadow-modal: 0 8px 32px rgba(14,14,16,0.14);
  --motion-fast: 120ms;
  --motion-default: 200ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout primitives */
  --container-max: 1180px;
  --container-pad: clamp(20px, 5vw, 64px);
  --prose-max: 42rem; /* 672px */
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }
html { font-size: 100%; } /* respects user zoom / OS text-size settings */
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-body-size);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
a { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}

/* ---------- Layout primitives ---------- */
.section { padding-block: var(--space-8); padding-inline: var(--container-pad); }
@media (min-width: 900px) { .section { padding-block: var(--space-9); } }
.section-inner { max-width: var(--container-max); margin-inline: auto; }
.prose { max-width: var(--prose-max); margin-inline: auto; }
.band-card { background: var(--surface-card); }
.band-surface { background: var(--surface); }

/* ---------- Small utilities (kept out of inline style="" so CSP needs no
   'unsafe-inline' for style-src) ---------- */
.u-text-left { text-align: left; }
.u-mt-6 { margin-top: var(--space-6); }
.u-body-lg { font-size: var(--text-body-lg-size); line-height: 1.6; }

/* ---------- Eyebrow ---------- */
.eyebrow {
  font: 400 var(--text-eyebrow-size)/1 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  display: block;
  margin-bottom: var(--space-6);
  text-align: center;
}

/* ---------- Screenshot frame ---------- */
.screenshot-frame {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  background: var(--surface-card);
}
.screenshot-frame img { width: 100%; height: auto; display: block; }

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent);
  color: var(--text-inverse);
  font: 500 var(--text-label-size)/1 var(--font-body);
  padding: 16px 28px;
  border-radius: var(--radius-xl);
  border: none;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--motion-default) var(--ease-out);
}
.btn-primary:hover, .btn-primary:focus-visible { background: var(--accent-hover); }
.btn-primary:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; }
@media (min-width: 900px) { .btn-primary { padding: 18px 32px; } }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  color: var(--accent);
  font: 500 var(--text-label-size)/1 var(--font-body);
  padding: 15px 27px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--accent);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--motion-default) var(--ease-out), color var(--motion-default) var(--ease-out);
}
.btn-secondary:hover, .btn-secondary:focus-visible { background: var(--accent); color: var(--text-inverse); }
.btn-secondary:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; }

/* ---------- App Store badge (real Apple artwork, inline SVG per-page) ---------- */
.badge-link {
  display: inline-block;
  line-height: 0;
}
.badge-link img { height: 44px; width: auto; }
@media (min-width: 900px) { .badge-link img { height: 52px; } }
.badge-link.badge-sm img { height: 36px; }

/* ---------- Card ---------- */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  padding: var(--space-5);
}

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  padding-inline: var(--container-pad);
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
}
@media (min-width: 900px) { .nav { height: 72px; } }
.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.nav .btn-secondary { height: 36px; padding: 0 20px; font-size: 0.9375rem; }
@media (min-width: 900px) { .nav .btn-secondary { height: 40px; } }

/* ---------- Hero ---------- */
.hero-inner {
  display: grid; gap: var(--space-7);
  text-align: center;
}
.hero-text { display: flex; flex-direction: column; align-items: center; }
@media (min-width: 900px) {
  .hero-inner { grid-template-columns: 1.1fr 1fr; align-items: center; text-align: left; gap: var(--space-8); }
  .hero-text { align-items: flex-start; }
}
.hero-headline {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: var(--text-display-size);
  line-height: var(--text-display-leading);
  color: var(--ink);
  max-width: 90%;
}
@media (min-width: 900px) { .hero-headline { max-width: 46ch; } }
.hero-sub {
  font-size: var(--text-body-lg-size);
  line-height: 1.5;
  color: var(--muted);
  max-width: 34ch;
  margin-top: var(--space-4);
}
.hero-microcopy {
  font-size: var(--text-caption-size);
  color: var(--muted);
  margin-top: var(--space-3);
}
.hero-screenshot { max-width: 340px; margin-inline: auto; }
@media (min-width: 900px) { .hero-screenshot { max-width: 400px; margin-inline: 0; } }

/* ---------- Problem section ---------- */
.problem-heading {
  font-family: var(--font-display); font-weight: 700;
  font-size: var(--text-h1-size); line-height: var(--text-h1-leading);
  margin-bottom: var(--space-5);
}
.problem-body p {
  font-size: var(--text-body-lg-size); line-height: 1.6; color: var(--ink);
  margin-bottom: var(--space-5);
}
.problem-body p:last-child { margin-bottom: 0; }

/* ---------- Core capabilities — stacked, alternating rows ----------
   Each capability is a full-width row: a large screenshot on one side,
   heading/lede/copy on the other, sides alternating per row (image
   right / left / right — the first row mirrors the hero's own
   text-left, image-right rhythm). Mobile collapses to one column,
   screenshot above copy. DOM order is always copy-then-media (reading
   order / SEO order preserved); grid-template-areas does the visual
   left-right placement on desktop, same technique as the hero.

   Screenshot treatment reuses .screenshot-frame — the same border,
   shadow-lift, radius-lg corners, and --surface-card background as
   the hero screenshot (.hero-screenshot). Hero and all three
   capability shots must read as the same framed object; a prior
   pass wrongly stripped the frame from these three, reasoning that
   the hero itself looked frameless — it isn't, its content colour
   just blends with the page surface. .capability-screenshot itself
   carries only sizing/alignment (max-width, row-alternating margin),
   never a parallel border/shadow implementation. Hero's own
   markup/CSS is untouched. */
.capabilities-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
@media (min-width: 900px) { .capabilities-list { gap: var(--space-9); } }

.capability-row {
  display: grid;
  gap: var(--space-6);
}
.capability-media { order: -1; } /* mobile: image above copy */
@media (min-width: 900px) {
  .capability-row {
    grid-template-columns: 1.1fr 1fr;
    grid-template-areas: "copy media";
    align-items: center;
    gap: var(--space-8);
  }
  .capability-row--reverse { grid-template-columns: 1fr 1.1fr; grid-template-areas: "media copy"; }
  .capability-copy { grid-area: copy; }
  .capability-media { grid-area: media; order: initial; }
}

.capability-screenshot {
  max-width: 340px;
  margin-inline: auto;
}
@media (min-width: 900px) {
  .capability-screenshot { max-width: 400px; margin-left: 0; margin-right: auto; }
  .capability-row--reverse .capability-screenshot { margin-left: auto; margin-right: 0; }
}

.capability-copy { text-align: center; }
@media (min-width: 900px) { .capability-copy { text-align: left; } }
.capability-copy h3 {
  font-family: var(--font-display); font-weight: 700;
  font-size: var(--text-h2-size); line-height: var(--text-h2-leading);
  margin-bottom: var(--space-3);
}
.capability-copy p, .capability-copy li {
  font-size: var(--text-body-sm-size); line-height: 1.55; color: var(--ink);
  text-align: left;
}
.capability-copy .lede { font-weight: 600; margin-bottom: var(--space-3); }
.capability-copy ul { margin: var(--space-3) 0 0; padding-left: 1.2em; }
.capability-copy ul li { margin-bottom: var(--space-2); }
.capability-copy ul li::marker { color: var(--accent); }
.capability-copy .reminder-note { color: var(--muted); margin-top: var(--space-3); }

/* ---------- How it works ---------- */
.steps-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-6); }
.step {
  display: flex; align-items: flex-start; gap: var(--space-4);
  position: relative; padding-left: var(--space-1);
}
.step-badge {
  flex-shrink: 0;
  width: 32px; height: 32px; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--text-inverse);
  display: flex; align-items: center; justify-content: center;
  font: 600 var(--text-label-size)/1 var(--font-body);
}
.step h3 { font-size: var(--text-h3-size); line-height: var(--text-h3-leading); font-weight: 600; margin-bottom: var(--space-2); }
.step p { font-size: var(--text-body-sm-size); color: var(--muted); line-height: 1.55; }
.steps-closing { text-align: center; color: var(--muted); font-size: var(--text-body-sm-size); margin-top: var(--space-6); }

@media (min-width: 900px) {
  .steps-list { flex-direction: row; gap: var(--space-6); }
  .step { flex-direction: column; align-items: center; text-align: center; flex: 1; }
  .step h3, .step p { text-align: center; }
}

/* ---------- Why it's credible ---------- */
.credible-callout {
  background: var(--accent-tint-6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin-block: var(--space-5);
  font-size: var(--text-body-lg-size);
  line-height: 1.6;
}
.credible-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.credible-screenshot { max-width: 340px; margin: var(--space-6) auto 0; text-align: center; padding: 0; }
.credible-screenshot figcaption { font-size: var(--text-caption-size); color: var(--muted); margin-top: var(--space-3); }

/* ---------- Free vs Pro ---------- */
.free-pro-body p { font-size: var(--text-body-lg-size); line-height: 1.6; color: var(--ink); margin-bottom: var(--space-4); }
.free-pro-body p:last-child { margin-bottom: 0; }

/* ---------- FAQ ---------- */
.faq-item { border-bottom: 1px solid var(--border-subtle); padding-block: var(--space-4); }
.faq-item:first-child { border-top: 1px solid var(--border-subtle); }
.faq-q {
  font: 600 var(--text-h3-size)/var(--text-h3-leading) var(--font-body);
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
}
.faq-q::-webkit-details-marker { display: none; }
.faq-q::after {
  content: '+';
  font: 400 20px/1 var(--font-body);
  color: var(--accent);
  transition: transform var(--motion-default) var(--ease-out);
  flex-shrink: 0;
}
details[open] .faq-q::after { transform: rotate(45deg); }
.faq-a { padding-top: var(--space-3); color: var(--ink); font: 400 var(--text-body-size)/1.55 var(--font-body); }
.faq-a p { margin-bottom: var(--space-3); }
.faq-a p:last-child { margin-bottom: 0; }
.faq-a a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Closing CTA ---------- */
.closing {
  background: var(--accent);
  color: var(--text-inverse);
  text-align: center;
}
.closing h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: var(--text-h1-size); line-height: var(--text-h1-leading);
}
.closing .sub { font-size: var(--text-body-lg-size); color: rgb(250 247 241 / 0.9); margin-top: var(--space-4); }
.closing .micro { font-size: var(--text-caption-size); color: rgb(250 247 241 / 0.8); margin-top: var(--space-3); }

/* ---------- Footer ---------- */
.footer { background: var(--surface-elevated); }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); list-style: none; padding: 0; margin: 0; }
.footer-links a { color: var(--ink); text-decoration: none; font-size: var(--text-body-sm-size); }
.footer-links a:hover, .footer-links a:focus-visible { text-decoration: underline; }
.footer-links li { display: flex; align-items: center; }
.footer-links li::after { content: '\00b7'; margin-left: var(--space-3); color: var(--muted); }
.footer-links li:last-child::after { content: ''; }
.footer-contact { text-align: center; margin-top: var(--space-4); font-size: var(--text-body-sm-size); }
.footer-contact a { color: var(--ink); }
.footer-meta { text-align: center; margin-top: var(--space-3); font-size: var(--text-caption-size); color: var(--ink); max-width: 60ch; margin-inline: auto; }
@media (min-width: 900px) {
  .footer-links { justify-content: flex-start; }
  .footer-contact, .footer-meta { text-align: left; margin-inline: 0; }
}

/* ---------- Long-form page shell (privacy, terms, support, delete-account) ---------- */
.page-header {
  background: var(--surface-card);
  padding-block: var(--space-7);
}
@media (min-width: 900px) { .page-header { padding-block: var(--space-8); } }
.page-header .eyebrow { text-align: left; margin-bottom: var(--space-3); }
.page-header h1 {
  font: 700 var(--text-h1-size)/var(--text-h1-leading) var(--font-display);
  color: var(--ink);
  max-width: var(--prose-max);
  margin-inline: auto;
}
.page-header .dek {
  font-size: var(--text-body-lg-size);
  color: var(--muted);
  max-width: var(--prose-max);
  margin: var(--space-3) auto 0;
  line-height: 1.5;
}

.prose { padding-block: var(--space-8); }
.prose h2 {
  font: 700 var(--text-h2-size)/var(--text-h2-leading) var(--font-display);
  margin-top: var(--space-7);
  margin-bottom: var(--space-3);
}
.prose h2:first-child { margin-top: 0; }
.prose h3 {
  font: 600 var(--text-h3-size)/var(--text-h3-leading) var(--font-body);
  margin-top: var(--space-6);
  margin-bottom: var(--space-2);
}
.prose p {
  font: 400 var(--text-body-size)/1.6 var(--font-body);
  color: var(--ink);
  margin-bottom: var(--space-4);
  max-width: 68ch;
}
.prose ul, .prose ol { padding-left: 1.25em; margin-bottom: var(--space-4); max-width: 68ch; }
.prose li { font: 400 var(--text-body-size)/1.6 var(--font-body); margin-bottom: var(--space-2); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover, .prose a:focus-visible { color: var(--accent-hover); }
.prose strong { font-weight: 600; }
.prose .callout {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin-block: var(--space-5);
}
.prose .callout p:last-child { margin-bottom: 0; }
.prose .callout h3 { margin-top: 0; }
.prose .lede {
  font-size: var(--text-body-lg-size);
  color: var(--ink);
  line-height: 1.6;
  margin-bottom: var(--space-5);
  max-width: 68ch;
}

/* ---------- Support / Delete Account contact block ---------- */
.contact-block {
  background: var(--accent-tint-6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin-block: var(--space-5);
}
.contact-block h3 { margin-top: 0; }
.contact-block p:last-child { margin-bottom: 0; }

/* ---------- Legal embed frame ---------- */
.legal-embed-frame {
  max-width: var(--prose-max);
  margin-inline: auto;
  min-height: 600px;
  padding: var(--space-5) 0;
}
.legal-embed-fallback {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  text-align: center;
}
.legal-embed-fallback p {
  font: 400 var(--text-body-sm-size)/1.5 var(--font-body);
  color: var(--ink);
  margin-bottom: var(--space-4);
}

/* ---------- 404 page ---------- */
.notfound {
  min-height: calc(100vh - 65px - 200px);
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding-block: var(--space-9);
}
.notfound-inner { max-width: 480px; margin-inline: auto; }
.notfound .eyebrow { margin-bottom: var(--space-4); }
.notfound h1 { font: 700 var(--text-h1-size)/var(--text-h1-leading) var(--font-display); margin-bottom: var(--space-4); }
.notfound p { font-size: var(--text-body-lg-size); color: var(--muted); margin-bottom: var(--space-6); }
.notfound-actions { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); }
@media (min-width: 600px) { .notfound-actions { flex-direction: row; justify-content: center; } }
