/* Patterns web — warm linen paper, ink text, gold accent, ten-color thread
   palette. Same tokens as the iOS DesignSystem (Packages/DesignSystem/Tokens/DS.swift):
   loom-at-night dark mode, daylight-linen light mode. Light is the default here
   because the marketing site reads best in daylight; dark follows OS preference. */

:root {
  --surface: #F2EEE6;
  --surface-raised: #FBF7EF;
  --ink: #24211B;
  --ink-muted: #6E6656;
  --accent: #AD7C1E;
  --accent-soft: #C89A3E;
  --amber: #B4791C;
  --hair: rgba(36, 33, 27, 0.13);
  --hair-strong: rgba(36, 33, 27, 0.22);

  /* thread palette — order: madder, ochre, indigo, teal, moss, plum, rust, sand, sky, rose */
  --t-madder: #9C332A;
  --t-ochre: #A06A1E;
  --t-indigo: #2F4A78;
  --t-teal: #1F6B62;
  --t-moss: #55702F;
  --t-plum: #6E4267;
  --t-rust: #8F4A1E;
  --t-sand: #A0824C;
  --t-sky: #3E76A8;
  --t-rose: #A05A68;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(36, 33, 27, 0.06), 0 8px 24px -12px rgba(36, 33, 27, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #16151A;
    --surface-raised: #1E1D24;
    --ink: #EDE9DF;
    --ink-muted: #A79F8F;
    --accent: #D8B23C;
    --accent-soft: #C89A3E;
    --amber: #E2A335;
    --hair: rgba(237, 233, 223, 0.11);
    --hair-strong: rgba(237, 233, 223, 0.2);

    --t-madder: #C1483D;
    --t-ochre: #C98A2C;
    --t-indigo: #4A6FA5;
    --t-teal: #359E90;
    --t-moss: #7A9A52;
    --t-plum: #9A5F92;
    --t-rust: #BD6A34;
    --t-sand: #C9A66B;
    --t-sky: #5FA0D6;
    --t-rose: #C9808F;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 28px -12px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -999px; top: 0; z-index: 20;
  background: var(--surface-raised); color: var(--ink); padding: 10px 14px;
  border: 1px solid var(--hair-strong); border-radius: 8px; text-decoration: none;
}
.skip:focus { left: 12px; top: 12px; }

.micro-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 600;
}

/* ===================== MASTHEAD ===================== */
.masthead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; max-width: 760px; margin: 0 auto;
  padding: clamp(18px, 4vh, 28px) 22px 0;
}
.masthead .brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 18px; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none;
}
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  background: conic-gradient(from 140deg, var(--t-madder), var(--t-ochre), var(--t-teal), var(--t-indigo), var(--t-plum), var(--t-madder));
}
.masthead-nav { display: flex; gap: clamp(10px, 3vw, 20px); align-items: center; }
.masthead-nav .cta-small {
  background: var(--ink); color: var(--surface);
  padding: 9px 16px; border-radius: 999px; text-decoration: none;
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.masthead-nav .cta-small:hover { background: var(--accent); }

/* ===================== HERO ===================== */
.hero {
  max-width: 760px; margin: 0 auto;
  padding: clamp(28px, 6vh, 56px) 22px clamp(20px, 4vh, 40px);
  text-align: center;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-raised); border: 1px solid var(--hair-strong);
  border-radius: 999px; padding: 6px 14px; margin-bottom: 26px;
  font-size: 12.5px; color: var(--ink-muted); font-weight: 600;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--t-teal); flex: none; }

h1 {
  font-weight: 700; letter-spacing: -0.025em; line-height: 1.05;
  font-size: clamp(38px, 7vw, 64px); margin: 0 0 20px;
}
h1 .accent-word { color: var(--accent); }
.lede {
  max-width: 540px; margin: 0 auto; color: var(--ink-muted);
  font-size: clamp(17px, 2.2vw, 20px);
}
.lede strong { color: var(--ink); font-weight: 600; }

/* woven tile hero graphic */
.weave {
  --gap: 6px;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: var(--gap);
  max-width: 460px;
  margin: clamp(28px, 5vh, 44px) auto;
  padding: 14px;
  background: var(--surface-raised);
  border: 1px solid var(--hair);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.weave-tile {
  aspect-ratio: 1;
  border-radius: 5px;
  background: var(--hair);
}
.weave-tile[data-t] { background: var(--tile-color, var(--accent)); }
.weave-tile.cross {
  background: linear-gradient(135deg, var(--tile-color, var(--accent)) 0 50%, var(--tile-color-2, var(--accent-soft)) 50% 100%);
}
.weave-tile.wobble { transform: rotate(var(--wob, 0deg)); }

/* waitlist */
.waitlist {
  max-width: 440px; margin: clamp(24px, 4vh, 36px) auto 0; text-align: left;
}
.waitlist label { display: block; margin-bottom: 10px; text-align: center; }
.hp-field {
  position: absolute !important; left: -9999px !important;
  width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.waitlist-row { display: flex; gap: 8px; }
.waitlist input[type="email"] {
  flex: 1; min-width: 0;
  background: var(--surface-raised); border: 1px solid var(--hair-strong); border-radius: 12px;
  color: var(--ink); font-family: var(--sans); font-size: 16px;
  padding: 13px 15px;
}
.waitlist input[type="email"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.waitlist button {
  background: var(--ink); color: var(--surface); border: none; border-radius: 12px;
  font-family: var(--sans); font-size: 15px; font-weight: 600; padding: 13px 20px;
  cursor: pointer; white-space: nowrap;
}
.waitlist button:hover { background: var(--accent); }
.waitlist button:active { transform: translateY(1px); }
.waitlist button:disabled { opacity: 0.6; cursor: default; }
.waitlist-note { font-size: 13.5px; color: var(--ink-muted); margin: 12px 2px 0; text-align: center; }
.waitlist-note.is-status { color: var(--ink); font-weight: 600; }

.store-badge {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: clamp(20px, 3vh, 28px);
  font-size: 13px; color: var(--ink-muted);
  border: 1px dashed var(--hair-strong); border-radius: 999px; padding: 8px 16px;
}
.store-badge svg { width: 15px; height: 15px; flex: none; }

/* ===================== SECTIONS (shared) ===================== */
.section {
  max-width: 760px; margin: 0 auto;
  padding: clamp(48px, 8vh, 84px) 22px 0;
}
.section-head { max-width: 560px; margin: 0 auto clamp(28px, 4vh, 44px); text-align: center; }
.section-head h2 {
  font-weight: 700; letter-spacing: -0.015em;
  font-size: clamp(26px, 4vw, 36px); margin: 10px 0 12px;
}
.section-head p { color: var(--ink-muted); font-size: 16.5px; margin: 0; }

/* pillars / feature grid */
.pillars { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .pillars { grid-template-columns: repeat(3, 1fr); } }
.pillar {
  background: var(--surface-raised); border: 1px solid var(--hair);
  border-radius: 18px; padding: 24px;
}
.pillar .th {
  display: block; width: 34px; height: 6px; border-radius: 3px; margin-bottom: 16px;
}
.pillar h3 { font-size: 18.5px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.01em; }
.pillar p { font-size: 14.5px; color: var(--ink-muted); margin: 0; line-height: 1.55; }

/* how it works */
.steps { list-style: none; margin: 0; padding: 0; max-width: 560px; margin-inline: auto; }
.steps li {
  display: flex; gap: 18px; padding: 20px 0; border-top: 1px solid var(--hair);
}
.steps li:last-child { border-bottom: 1px solid var(--hair); }
.step-num {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-raised); border: 1px solid var(--hair-strong);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: var(--accent);
}
.step-body h3 { margin: 2px 0 6px; font-size: 17px; font-weight: 700; }
.step-body p { margin: 0; color: var(--ink-muted); font-size: 15px; }

/* science / quote strip */
.science {
  background: var(--surface-raised); border: 1px solid var(--hair);
  border-radius: 20px; padding: clamp(24px, 4vw, 36px);
}
.science-grid { display: grid; gap: 22px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .science-grid { grid-template-columns: repeat(3, 1fr); } }
.science-item .num { font-size: 13px; color: var(--accent); font-weight: 700; letter-spacing: 0.04em; }
.science-item h3 { margin: 6px 0 8px; font-size: 16.5px; font-weight: 700; }
.science-item p { margin: 0; color: var(--ink-muted); font-size: 14.5px; }

/* pricing strip */
.pricing-note {
  text-align: center; color: var(--ink-muted); font-size: 15px;
  border-top: 1px solid var(--hair); padding-top: clamp(28px, 4vh, 40px);
}
.pricing-note strong { color: var(--ink); font-weight: 700; }

/* FAQ */
.faq details {
  border-top: 1px solid var(--hair);
  padding: 18px 0;
}
.faq details:last-child { border-bottom: 1px solid var(--hair); }
.faq summary {
  cursor: pointer; color: var(--ink); font-size: 16.5px; font-weight: 600;
  list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--accent); font-size: 22px; font-weight: 400; flex: none; }
.faq details[open] summary::after { content: '\2212'; }
.faq details p { margin: 12px 0 0; color: var(--ink-muted); font-size: 15px; }

/* final cta band */
.final-cta {
  text-align: center; margin: clamp(56px, 8vh, 90px) auto 0;
  padding: clamp(36px, 6vh, 56px) 22px;
  background: var(--ink); color: var(--surface);
  border-radius: 0;
}
.final-cta h2 { color: var(--surface); font-size: clamp(26px, 4vw, 34px); margin: 0 0 14px; letter-spacing: -0.015em; }
.final-cta p { color: rgba(242, 238, 230, 0.72); max-width: 480px; margin: 0 auto; }
@media (prefers-color-scheme: dark) {
  .final-cta { background: var(--surface-raised); color: var(--ink); border: 1px solid var(--hair-strong); }
  .final-cta h2 { color: var(--ink); }
  .final-cta p { color: var(--ink-muted); }
}
.final-cta .waitlist { margin-top: clamp(24px, 4vh, 32px); }
.final-cta .waitlist input[type="email"] { background: rgba(242,238,230,0.08); border-color: rgba(242,238,230,0.24); color: var(--surface); }
.final-cta .waitlist button { background: var(--accent); color: #201705; }
.final-cta .waitlist-note { color: rgba(242, 238, 230, 0.6); }
@media (prefers-color-scheme: dark) {
  .final-cta .waitlist input[type="email"] { background: var(--surface); border-color: var(--hair-strong); color: var(--ink); }
  .final-cta .waitlist-note { color: var(--ink-muted); }
}

/* ===================== FOOTER ===================== */
.site-footer {
  max-width: 760px; margin: clamp(56px, 8vh, 90px) auto 0;
  padding: clamp(30px, 5vh, 48px) 22px clamp(48px, 8vh, 80px);
  border-top: 1px solid var(--hair);
  color: var(--ink-muted);
}
.site-footer strong { color: var(--ink); font-weight: 700; }
.footer-cta { color: var(--accent); text-decoration: none; font-weight: 600; border-bottom: 1px solid rgba(173,124,30,0.4); }
.footer-cta:hover { border-bottom-color: var(--accent); }
.fineprint { font-size: 13px; color: var(--ink-muted); margin-top: 6px; }

.site-nav { margin-top: 20px; font-size: 14px; display: flex; gap: 16px; flex-wrap: wrap; }
.site-nav a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--hair-strong); }
.site-nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.site-nav--legal { margin-top: 22px; }
.site-nav--cluster { margin-top: 14px; gap: 13px; font-size: 13px; }
.site-nav--cluster a { color: var(--ink-muted); border-bottom-color: transparent; }
.site-nav--cluster a:hover { color: var(--accent); }
.site-nav--cluster p.cluster-label { width: 100%; margin: 0 0 2px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-muted); }

/* ===================== LONGFORM (blog / legal) ===================== */
.reading {
  max-width: 680px; margin: 0 auto;
  padding: clamp(40px, 8vh, 76px) 22px clamp(40px, 8vh, 70px);
}
.reading-head h1 {
  font-size: clamp(30px, 6vw, 44px); line-height: 1.12; margin: 0 0 18px;
}
.reading .lede { text-align: left; margin: 0; max-width: none; }
.reading section { margin-top: clamp(32px, 5vh, 48px); }
.reading h2 { font-size: clamp(20px, 3vw, 25px); font-weight: 700; margin: 0 0 12px; letter-spacing: -0.01em; }
.reading h3 { font-size: 17px; font-weight: 700; margin: 20px 0 8px; }
.reading p { color: var(--ink-muted); margin: 0 0 14px; }
.reading ul, .reading ol { color: var(--ink-muted); padding-left: 22px; margin: 0 0 14px; }
.reading li { margin-bottom: 8px; }
.reading li::marker { color: var(--accent); }
.reading a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(173,124,30,0.35); }
.reading a:hover { text-decoration-color: var(--accent); }
.reading table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: 15px; }
.reading th, .reading td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--hair); color: var(--ink-muted); }
.reading th { color: var(--ink); font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: 0.06em; }
.reading strong { color: var(--ink); }

.tldr {
  background: var(--surface-raised); border: 1px solid var(--hair); border-radius: 14px;
  padding: 18px 20px; margin: 24px 0 0;
}
.tldr p { margin: 0; color: var(--ink); }
.tldr .micro-label { display: block; margin-bottom: 8px; }

.post-cta {
  margin-top: clamp(36px, 6vh, 56px); padding: clamp(22px, 4vw, 30px);
  border: 1px solid var(--hair); border-radius: 18px; background: var(--surface-raised);
}
.post-cta h2 { margin-top: 0; }
.post-cta p { margin-bottom: 16px; }

.related-posts { margin-top: clamp(36px, 6vh, 56px); }
.related-posts h2 { margin-bottom: 8px; }
.related-posts ul { list-style: none; padding: 0; margin: 8px 0 0; }
.related-posts li { padding: 12px 0; border-top: 1px solid var(--hair); margin: 0; }
.related-posts li:last-child { border-bottom: 1px solid var(--hair); }
.related-posts a { text-decoration: none; font-weight: 600; color: var(--ink); }
.related-posts a:hover { color: var(--accent); }

/* legal pages */
.legal .reading h2 { margin-top: 6px; }
.legal .updated { color: var(--ink-muted); font-size: 13.5px; margin-bottom: 4px; }

/* ===================== BLOG INDEX ===================== */
.blog-hero { max-width: 680px; margin: 0 auto; padding: clamp(34px, 6vh, 60px) 22px 0; }
.blog-hero h1 { font-size: clamp(30px, 6vw, 44px); line-height: 1.12; margin: 0 0 16px; }
.blog-list { max-width: 680px; margin: clamp(20px, 4vh, 36px) auto 0; padding: 0 22px clamp(56px, 10vh, 96px); }
.blog-card { display: block; padding: 24px 0; border-top: 1px solid var(--hair); text-decoration: none; color: inherit; }
.blog-list .blog-card:last-child { border-bottom: 1px solid var(--hair); }
.blog-card .post-meta { margin: 0 0 6px; }
.blog-card h2 { font-weight: 700; font-size: clamp(19px, 3vw, 23px); margin: 0 0 8px; color: var(--ink); transition: color 150ms ease; letter-spacing: -0.01em; }
.blog-card:hover h2 { color: var(--accent); }
.blog-card p { color: var(--ink-muted); margin: 0; font-size: 15px; }
.post-meta {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-muted); font-weight: 700; margin: 0 0 14px;
}

/* ===================== SUPPORT PAGE ===================== */
.support-item { border-top: 1px solid var(--hair); padding: 18px 0; }
.support-item:last-child { border-bottom: 1px solid var(--hair); }
.support-item h2 { font-size: 17px; font-weight: 700; margin: 0 0 8px; }
.contact-card {
  background: var(--surface-raised); border: 1px solid var(--hair); border-radius: 16px;
  padding: 24px; margin-top: 26px; text-align: center;
}
.contact-card a.mail {
  display: inline-block; margin-top: 10px; font-size: 18px; font-weight: 700;
  color: var(--accent); text-decoration: none;
}
.contact-card a.mail:hover { text-decoration: underline; }

/* ===================== 404 ===================== */
.not-found {
  max-width: 480px; margin: 0 auto; text-align: center;
  padding: clamp(80px, 20vh, 160px) 22px;
}
.not-found h1 { font-size: clamp(28px, 5vw, 38px); margin-bottom: 12px; }
.not-found p { color: var(--ink-muted); margin-bottom: 20px; }
.not-found a { color: var(--accent); font-weight: 600; text-decoration: none; }
.not-found a:hover { text-decoration: underline; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 480px) {
  .waitlist-row { flex-direction: column; }
  .waitlist button { width: 100%; }
  .masthead-nav { gap: 10px; }
}
