/* ──────────────────────────────────────────────────────────────────────
   Stash — landing-page styles
   Ported from Design/tokens.jsx. Dark-first, warm, editorial.
   ────────────────────────────────────────────────────────────────────── */

:root {
  /* Color — dark theme is primary */
  --bg:        #0C0C0E;
  --surface1:  #17171B;
  --surface2:  #202026;
  --surface3:  #2A2A31;
  --hairline:  rgba(255, 255, 255, 0.08);
  --divider:   rgba(255, 255, 255, 0.06);

  --text:      #F5F4EF;
  --text-muted:#A4A2A0;
  --text-dim:  #6A6A70;

  --accent:       #F2A65A;
  --accent-ink:   #1A0E02;
  --accent-soft:  rgba(242, 166, 90, 0.16);
  --accent-glow:  rgba(242, 166, 90, 0.35);
  /* Accent tuned for small text/icons so it clears WCAG AA (4.5:1).
     On dark, the standard accent already passes; light theme needs a darker tone. */
  --accent-text:  #F2A65A;

  --success: #7FB59B;
  --danger:  #E06B5E;
  --warn:    #E3B341;

  /* Board palette swatches used in the category strip */
  --hue-saffron:   #F2A65A;
  --hue-persimmon: #E88865;
  --hue-rose:      #E08298;
  --hue-mulberry:  #BE87C2;
  --hue-iris:      #8F93D6;
  --hue-sky:       #7EB6D6;
  --hue-teal:      #6FB3A8;
  --hue-moss:      #9CB37A;
  --hue-olive:     #B7A963;
  --hue-sand:      #D4B58A;
  --hue-clay:      #B68968;
  --hue-stone:     #9E9A92;

  /* Type families */
  --display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --ui:      'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono:    'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;

  /* Spacing scale (4pt) */
  --s1:  4px;  --s2:  8px;  --s3: 12px;  --s4: 16px;
  --s5: 20px;  --s6: 24px;  --s7: 32px;  --s8: 40px;
  --s9: 56px;  --s10: 72px; --s11: 96px;

  /* Radii */
  --r-chip:   10px;
  --r-card:   14px;
  --r-tile:   20px;
  --r-sheet:  28px;
  --r-island: 36px;

  /* Shadows — multi-layer per design spec */
  --shadow-e1: 0 1px 2px rgba(0,0,0,0.20), 0 1px 3px rgba(0,0,0,0.12);
  --shadow-e2: 0 4px 12px rgba(0,0,0,0.28), 0 2px 4px rgba(0,0,0,0.12);
  --shadow-e3: 0 12px 32px rgba(0,0,0,0.38), 0 4px 8px rgba(0,0,0,0.18);
  --shadow-accent: 0 8px 24px rgba(242,166,90,0.28), 0 2px 6px rgba(242,166,90,0.18);

  --maxw-content: 1080px;
  --maxw-reader:  680px;

  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light theme honors prefers-color-scheme: light. Dark stays default. */
@media (prefers-color-scheme: light) {
  :root {
    --bg:        #FAF8F3;
    --surface1:  #FFFFFF;
    --surface2:  #FFFDF7;
    --surface3:  #F1EEE5;
    --hairline:  rgba(20, 16, 10, 0.08);
    --divider:   rgba(20, 16, 10, 0.06);

    --text:       #1A1714;
    --text-muted: #5A564F;
    --text-dim:   #8A8680;

    --accent:      #C96F2E;
    --accent-ink:  #FFF7EE;
    --accent-soft: rgba(201, 111, 46, 0.12);
    --accent-glow: rgba(201, 111, 46, 0.22);
    --accent-text: #9E4E18;

    --success: #3E8A6E;
    --danger:  #B54436;
    --warn:    #B07D10;

    --shadow-e1: 0 1px 2px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.05);
    --shadow-e2: 0 4px 12px rgba(0,0,0,0.12), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-e3: 0 12px 32px rgba(0,0,0,0.18), 0 4px 8px rgba(0,0,0,0.08);
    --shadow-accent: 0 8px 24px rgba(201,111,46,0.20), 0 2px 6px rgba(201,111,46,0.14);
  }
}

/* ── Reset / base ─────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01', 'cv11';
}
img, svg { display: block; max-width: 100%; }
a {
  color: var(--accent-text);
  text-decoration: none;
  transition: color 160ms var(--ease-standard);
}
a:hover { color: var(--text); }
button { font: inherit; }

/* ── Type scale ───────────────────────────────────────────────────── */

.t-eyebrow {
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.t-display {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.02;
  font-size: clamp(36px, 9vw, 76px);
  color: var(--text);
}
.t-display em {
  font-style: italic;
  color: var(--accent);
}
.t-title1 {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.1;
  font-size: clamp(26px, 6vw, 44px);
  color: var(--text);
}
.t-title2 {
  font-family: var(--ui);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  font-size: 22px;
  color: var(--text);
}
.t-body {
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
}
.t-subhead {
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-muted);
}
.t-footnote {
  font-family: var(--ui);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
.t-caption {
  font-family: var(--ui);
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: var(--text-dim);
}
.t-muted { color: var(--text-muted); }
.t-dim   { color: var(--text-dim); }

/* ── Layout primitives ────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--maxw-content);
  margin: 0 auto;
  /* Horizontal gutter only. Section classes below (.hero, .reader, …) own the
     vertical padding via padding-block, so the two never clobber each other —
     a `padding:` shorthand on those would otherwise reset this inline gutter to 0. */
  padding-inline: var(--s5);
}
.container--reader {
  max-width: var(--maxw-reader);
}

/* ── Top bar ──────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--s5);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: -0.02em;
  font-weight: 400;
}
.brand:hover { color: var(--text); }
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--r-chip);
  background-image: url(/apple-touch-icon.png);
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-e1);
}
.topbar-nav {
  display: flex;
  align-items: center;
  gap: var(--s5);
}
.topbar-nav a {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}
.topbar-nav a:hover { color: var(--text); }
@media (max-width: 540px) {
  .topbar-nav a:not(.cta-mini) { display: none; }
}

/* ── Privacy badge (mirrors PrivacyBadge in the app) ──────────────── */

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 6px var(--s3);
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--hairline);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.privacy-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ── CTAs (PillButton equivalent) ─────────────────────────────────── */

.pill {
  --pad-x: 22px;
  --h: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--h);
  padding: 0 var(--pad-x);
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--ui);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 160ms var(--ease-out-expo),
              box-shadow 240ms var(--ease-standard),
              background 240ms var(--ease-standard);
  white-space: nowrap;
}
.pill:active { transform: scale(0.98); }
.pill--primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow-accent);
}
.pill--primary:hover {
  color: var(--accent-ink);
  filter: brightness(1.04);
}
.pill--secondary {
  background: var(--surface1);
  color: var(--text);
  border-color: var(--hairline);
}
.pill--secondary:hover {
  background: var(--surface3);
  color: var(--text);
}
.pill--sm { --h: 38px; --pad-x: 16px; font-size: 14px; }
.cta-mini {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.01em;
}
.cta-mini:hover { color: var(--accent-ink); filter: brightness(1.06); }

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

.hero {
  padding-block: clamp(40px, 8vw, 96px) clamp(56px, 9vw, 120px);
  position: relative;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}
@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; }
}
.hero-copy { display: flex; flex-direction: column; gap: var(--s5); }
.hero-headline { margin: var(--s2) 0 0; }
.hero-sub {
  max-width: 480px;
  color: var(--text-muted);
  font-size: 19px;
  line-height: 1.55;
}
.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  margin-top: var(--s3);
}
.hero-footnote {
  color: var(--text-muted);
  font-size: 13px;
}

/* Hero device mock — a phone-shaped card showing screenshot tiles */
.device {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  aspect-ratio: 9 / 19;
  border-radius: 44px;
  background: var(--surface1);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-e3);
  overflow: hidden;
  padding: 18px 16px;
}
.device::before {
  /* Notch */
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 88px;
  height: 22px;
  background: #050507;
  border-radius: 999px;
  z-index: 2;
}
.device-screen {
  position: absolute;
  inset: 18px 16px;
  border-radius: 28px;
  background: var(--bg);
  padding: 44px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.device-title {
  font-family: var(--display);
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.device-search {
  height: 38px;
  border-radius: 999px;
  background: var(--surface1);
  border: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--text-dim);
  font-size: 13px;
}
.device-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
  flex: 1;
}
.device-tile {
  border-radius: 14px;
  background: var(--surface1);
  border: 1px solid var(--hairline);
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  position: relative;
  overflow: hidden;
}
.device-tile .emoji {
  font-size: 22px;
  line-height: 1;
}
.device-tile .name {
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
}
.device-tile .count { color: var(--text-muted); font-size: 11px; }
.device-tile.tall { grid-row: span 2; }

/* ── Section base ─────────────────────────────────────────────────── */

.section {
  padding: clamp(56px, 9vw, 112px) 0;
  border-top: 1px solid var(--hairline);
}
.section-head {
  max-width: 720px;
  margin: 0 auto var(--s8);
  text-align: center;
}
.section-head .eyebrow {
  display: inline-block;
  margin-bottom: var(--s3);
}
.section-head .t-title1 {
  margin: 0 0 var(--s3);
}
.section-head .sub {
  color: var(--text-muted);
  font-size: 17px;
  max-width: 560px;
  margin: 0 auto;
}

/* ── Category strip ───────────────────────────────────────────────── */

.cat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--s3);
}
.cat-tile {
  aspect-ratio: 1;
  border-radius: var(--r-tile);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--s4);
  background: var(--surface1);
  border: 1px solid var(--hairline);
  transition: transform 240ms var(--ease-out-expo),
              border-color 240ms var(--ease-standard);
  position: relative;
  overflow: hidden;
}
.cat-tile:hover { transform: translateY(-3px); border-color: rgba(255,255,255,0.16); }
.cat-tile .emoji { font-size: 32px; line-height: 1; }
.cat-tile .label {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.cat-tile .swatch {
  position: absolute;
  inset: auto -28px -28px auto;
  width: 90px;
  height: 90px;
  border-radius: 999px;
  opacity: 0.35;
  filter: blur(8px);
}

/* ── Feature pillars ──────────────────────────────────────────────── */

.pillars {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s4);
}
@media (max-width: 900px) {
  .pillars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .pillars { grid-template-columns: 1fr; }
}
.pillar {
  padding: var(--s6);
  border-radius: var(--r-tile);
  background: var(--surface1);
  border: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}
.pillar h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
  color: var(--text);
}
.pillar p {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.55;
}
.pillar .glyph {
  width: 44px;
  height: 44px;
  border-radius: var(--r-chip);
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 20px;
}

/* ── Privacy block (full-bleed callout) ───────────────────────────── */

.privacy-block {
  border-radius: var(--r-tile);
  background:
    radial-gradient(80% 100% at 20% 0%, var(--accent-soft), transparent 60%),
    var(--surface1);
  border: 1px solid var(--hairline);
  padding: clamp(28px, 5vw, 56px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: var(--s7);
  align-items: center;
}
@media (max-width: 740px) {
  .privacy-block { grid-template-columns: 1fr; }
}
.privacy-block ul {
  margin: var(--s4) 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--s2);
}
.privacy-block li {
  display: flex;
  gap: var(--s3);
  font-size: 15px;
  color: var(--text-muted);
}
.privacy-block li::before {
  content: '✓';
  color: var(--accent-text);
  font-weight: 700;
  margin-top: 1px;
}

/* ── Pricing peek ─────────────────────────────────────────────────── */

.pricing {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s4);
}
.plan {
  padding: var(--s6);
  border-radius: var(--r-card);
  background: var(--surface1);
  border: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  position: relative;
}
.plan--featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.plan .tag {
  position: absolute;
  top: -10px;
  right: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}
.plan .name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.plan .price {
  font-family: var(--display);
  font-size: 34px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.plan .price .per {
  font-family: var(--ui);
  font-size: 14px;
  color: var(--text-muted);
  margin-left: 4px;
  letter-spacing: 0;
}
.plan .desc {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

/* ── CTA section ──────────────────────────────────────────────────── */

.cta-section {
  text-align: center;
  padding-block: clamp(56px, 9vw, 120px);
}
.cta-section .t-display {
  margin: 0 auto var(--s5);
  max-width: 16ch;
}

/* ── Footer ───────────────────────────────────────────────────────── */

.footer {
  padding: var(--s8) 0 var(--s7);
  border-top: 1px solid var(--hairline);
  color: var(--text-muted);
  font-size: 13px;
}
.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--s5);
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s5);
}
.footer-links a {
  color: var(--text-muted);
  font-size: 13px;
}
.footer-links a:hover { color: var(--text); }

/* ── Reader pages (privacy / terms) ───────────────────────────────── */

.reader {
  padding-block: clamp(40px, 7vw, 80px) clamp(56px, 9vw, 96px);
}
.reader h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(28px, 7.5vw, 52px);
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0 0 var(--s3);
  color: var(--text);
}
.reader .lede {
  color: var(--text-muted);
  font-size: 17px;
  margin: 0 0 var(--s7);
}
.reader h2 {
  font-family: var(--ui);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin: var(--s8) 0 var(--s3);
  color: var(--text);
}
.reader h3 {
  font-family: var(--ui);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: var(--s6) 0 var(--s2);
  color: var(--text);
}
.reader p,
.reader li {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
}
.reader p { margin: 0 0 var(--s4); }
.reader ul, .reader ol {
  margin: 0 0 var(--s5);
  padding-left: var(--s5);
}
.reader li { margin: var(--s2) 0; }
.reader li::marker { color: var(--text-dim); }
.reader strong { color: var(--text); font-weight: 600; }
.reader .meta {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s5);
  padding: 6px var(--s3);
  border-radius: 999px;
  background: var(--surface1);
  border: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.reader hr {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: var(--s7) 0;
}
.reader a { text-decoration: underline; text-underline-offset: 3px; }
.reader-toc {
  margin: 0 0 var(--s8);
  padding: var(--s5);
  border-radius: var(--r-card);
  background: var(--surface1);
  border: 1px solid var(--hairline);
}
.reader-toc h2 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--s3);
}
.reader-toc ol {
  margin: 0;
  padding-left: var(--s5);
  display: grid;
  gap: 6px;
}
.reader-toc a {
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
}
.reader-toc a:hover { color: var(--accent-text); }

/* ── Accessibility: focus ring, tap targets ──────────────────────── */

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}
/* On the saffron primary pill an accent ring would disappear — use the ink tone. */
.pill--primary:focus-visible { outline-color: var(--accent-ink); outline-offset: 2px; }

/* Roomier hit areas for inline nav/footer links (WCAG 2.5.8 Target Size). */
.topbar-nav a:not(.cta-mini),
.footer-links a { padding-block: 6px; }

/* ── Phone tuning ─────────────────────────────────────────────────── */
/* Desktop grids stay fluid above; this tightens type + spacing so the
   reader pages and landing sections read comfortably on a real phone. */
@media (max-width: 600px) {
  body { font-size: 16px; }

  .container { padding-inline: var(--s4); }

  /* Top bar — smaller mark + brand, tighter vertical rhythm */
  .topbar { padding-block: var(--s4); }
  .brand { font-size: 21px; gap: 8px; }
  .brand-mark { width: 28px; height: 28px; }

  /* Hero */
  .hero { padding-block: var(--s6) var(--s8); }
  .hero-sub { font-size: 17px; }

  /* Sections — pull in the generous desktop padding */
  .section { padding-block: var(--s8); }
  .section-head { margin-bottom: var(--s6); }
  .section-head .sub { font-size: 16px; }

  /* Reader pages (privacy / terms) */
  .reader { padding-block: var(--s6) var(--s8); }
  .reader .lede { font-size: 16px; margin-bottom: var(--s6); }
  .reader h2 { font-size: 20px; margin-top: var(--s7); }
  .reader h3 { font-size: 16px; }
  .reader p,
  .reader li { font-size: 15.5px; line-height: 1.65; }
  .reader hr { margin: var(--s6) 0; }
  .reader-toc { padding: var(--s4); margin-bottom: var(--s7); }
  .reader-toc a { font-size: 14px; }

  /* Footer stacks cleanly instead of wrapping mid-row */
  .footer-grid {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s4);
  }
}

/* ── Reduced motion respects user preference ──────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
