/* ==========================================================================
   Abertide — abertide.com
   Shared design system. Editorial / calm-tide direction: warm paper, deep
   teal "tide" accent, a serif display + clean sans body. Local-first brand:
   quiet, private, trustworthy. No framework, no build step.
   ========================================================================== */

/* ── Self-hosted fonts (replaces the Google Fonts <link>) ─────────────────
   Fraunces — display serif (headings).  Inter — UI sans (body).
   Only the weights actually used on the site are bundled, so we ship the
   smallest possible payload AND keep the site free of any third-party origin
   (the privacy site practices the privacy it preaches). Binaries are a build
   TODO — see fonts/README.md (gwfh.mranftl.com or pyftsubset). Update the
   url() hashes if the committed filenames are content-hashed.
   font-display: swap keeps text visible during load; the fallback stack below
   makes the swap barely perceptible. ──────────────────────────────────────── */

/* Fraunces 500 (medium) — some headings/labels */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/fraunces-latin-500.woff2') format('woff2');
  unicode-range: 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+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Fraunces 600 (semibold) — primary heading weight (h1/h2/h3, brand) */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/fraunces-latin-600.woff2') format('woff2');
  unicode-range: 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+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Inter 400 (regular) — body text */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/inter-latin-400.woff2') format('woff2');
  unicode-range: 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+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Inter 500 (medium) — nav, buttons, kickers */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/inter-latin-500.woff2') format('woff2');
  unicode-range: 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+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Inter 600 (semibold) — emphasis, tags */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/inter-latin-600.woff2') format('woff2');
  unicode-range: 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+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ---- Palette (oklch for perceptual evenness) ---- */
  --paper:        oklch(98.5% 0.006 95);     /* warm off-white */
  --paper-2:      oklch(96.2% 0.008 95);     /* card / alt surface */
  --ink:          oklch(24% 0.02 240);       /* near-black, faint cool */
  --ink-soft:     oklch(44% 0.02 240);       /* secondary text */
  --ink-faint:    oklch(60% 0.015 240);      /* tertiary / captions */
  --tide:         oklch(52% 0.10 215);       /* deep teal accent */
  --tide-deep:    oklch(40% 0.10 220);       /* hover / strong */
  --tide-wash:    oklch(94% 0.03 210);       /* tint surface */
  --tide-ink:     oklch(22% 0.045 218);      /* darkest tide — theme-color, footers */
  --line:         oklch(89% 0.01 240);       /* hairlines */
  --code-bg:      oklch(22% 0.02 235);       /* dark code surface (verify snippets) */
  --code-ink:     oklch(92% 0.012 220);      /* text on code surface */
  /* NOTE: <meta name="theme-color"> in index.html (#0c2228) is the sRGB
     equivalent of --tide-ink; keep the two in sync if this token changes. */

  /* ---- Elevation (depth, not noise — used sparingly per design-quality) ---- */
  --shadow-sm:  0 1px 2px -1px oklch(22% 0.04 220 / 0.10), 0 2px 6px -2px oklch(22% 0.04 220 / 0.08);
  --shadow-md:  0 6px 24px -10px oklch(22% 0.05 220 / 0.18);

  /* ---- Type ---- */
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans:  'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --text-hero:  clamp(2.6rem, 1.2rem + 5vw, 5rem);
  --text-h2:    clamp(1.6rem, 1.1rem + 1.8vw, 2.4rem);
  --text-h3:    clamp(1.15rem, 1rem + 0.5vw, 1.35rem);
  --text-body:  clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --text-small: 0.85rem;

  /* ---- Space / shape ---- */
  --measure: 68ch;
  --space-section: clamp(3.5rem, 2rem + 6vw, 7rem);
  --radius: 14px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--text-body);
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  /* faint atmospheric tide gradient, fixed so it doesn't scroll-jank */
  background-image:
    radial-gradient(120% 80% at 100% -10%, var(--tide-wash) 0%, transparent 55%),
    radial-gradient(90% 70% at -10% 0%, oklch(95% 0.02 150) 0%, transparent 50%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Layout primitives ---- */
.wrap { width: min(100% - 2.5rem, 1080px); margin-inline: auto; }
.prose { width: min(100% - 2.5rem, var(--measure)); margin-inline: auto; }

/* ---- Header ---- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(1.2) blur(8px);
  background: color-mix(in oklch, var(--paper) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--serif); font-weight: 600; font-size: 1.3rem;
  letter-spacing: -0.01em; color: var(--ink); text-decoration: none;
}
.brand-mark {
  width: 22px; height: 22px; flex: none;
  color: var(--tide);
}
.nav { display: flex; gap: 1.4rem; align-items: center; }
.nav a {
  color: var(--ink-soft); text-decoration: none; font-size: 0.95rem;
  transition: color 150ms var(--ease);
}
.nav a:hover { color: var(--tide-deep); }

/* ---- Hero ---- */
.hero { padding: clamp(3rem, 2rem + 6vw, 7rem) 0 var(--space-section); }
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: var(--text-hero);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 1.2rem;
  max-width: 16ch;
}
.hero .lede {
  font-size: clamp(1.1rem, 1rem + 0.6vw, 1.4rem);
  color: var(--ink-soft);
  max-width: 48ch;
  margin: 0 0 2rem;
}
.kicker {
  display: inline-block;
  font-size: var(--text-small);
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--tide-deep); font-weight: 600;
  margin-bottom: 1.1rem;
}
.cta-row { display: flex; gap: 0.8rem; flex-wrap: wrap; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.3rem; border-radius: 999px;
  font-weight: 600; font-size: 0.98rem; text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
  transition: transform 150ms var(--ease), background 150ms var(--ease), box-shadow 150ms var(--ease);
}
.btn-primary { background: var(--tide); color: oklch(99% 0 0); box-shadow: 0 6px 20px -8px var(--tide); }
.btn-primary:hover { background: var(--tide-deep); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--tide); color: var(--tide-deep); }
.btn-lg { padding: 0.85rem 1.6rem; font-size: 1.02rem; }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.88rem; }
.nav-cta { color: var(--ink-soft); }

/* Skip link — keyboard a11y, hidden until focused */
.skip-link {
  position: absolute; left: 0.75rem; top: -3rem; z-index: 50;
  background: var(--tide); color: oklch(99% 0 0);
  padding: 0.55rem 1rem; border-radius: 0 0 var(--radius) var(--radius);
  text-decoration: none; font-weight: 600; font-size: 0.9rem;
  transition: top 150ms var(--ease);
}
.skip-link:focus { top: 0; }

/* ---- Feature cards (bento-ish, not uniform) ---- */
.features { padding-bottom: var(--space-section); }
.feature-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(2, 1fr);
}
.card {
  background: color-mix(in oklch, var(--paper-2) 70%, var(--paper));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem 1.5rem;
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease), transform 200ms var(--ease);
}
.card:hover { border-color: color-mix(in oklch, var(--tide) 28%, var(--line)); box-shadow: var(--shadow-sm); }
.card.span-2 { grid-column: 1 / -1; }
.card h3 {
  font-family: var(--serif); font-weight: 600;
  font-size: var(--text-h3); margin: 0 0 0.5rem; letter-spacing: -0.01em;
}
.card p { margin: 0; color: var(--ink-soft); font-size: 0.98rem; }
.card .ico { color: var(--tide); margin-bottom: 0.8rem; display: block; }

@media (max-width: 680px) {
  .feature-grid { grid-template-columns: 1fr; }
  .nav .nav-hide { display: none; }
  /* Keep the early-access CTA reachable on mobile; tighten the nav gap. */
  .nav { gap: 0.8rem; }
}

/* ---- Section heading ---- */
.section-head { margin-bottom: 2rem; }
.section-head h2 {
  font-family: var(--serif); font-weight: 600;
  font-size: var(--text-h2); letter-spacing: -0.02em; margin: 0 0 0.4rem;
}
.section-head p { color: var(--ink-soft); margin: 0; max-width: 52ch; }
.section-head .kicker { margin-bottom: 0.6rem; }

/* ---- Hero trust line ---- */
.hero-note {
  list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem;
  margin: 1.6rem 0 0; padding: 0;
  color: var(--ink-faint); font-size: var(--text-small);
}
.hero-note li { display: inline-flex; align-items: center; gap: 0.45rem; }
.hero-note li::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--tide); flex: none;
}

/* ---- 3-up grid variant (modes, sync tiers) ---- */
.feature-grid.grid-3 { grid-template-columns: repeat(3, 1fr); }
.feature-grid.grid-stack { margin-top: 1rem; }  /* second sub-grid spacing (replaces inline style) */
@media (max-width: 880px) { .feature-grid.grid-3 { grid-template-columns: 1fr; } }

/* ---- Tags / pills on cards ---- */
.tag {
  display: inline-block; font-family: var(--sans);
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  padding: 0.2rem 0.55rem; border-radius: 999px; vertical-align: middle;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-soft);
}
.card > .tag:first-child { margin-bottom: 0.7rem; }
.tag-free { color: var(--tide-deep); background: var(--tide-wash); border-color: color-mix(in oklch, var(--tide) 30%, var(--line)); }
.tag-paid { color: oklch(99% 0 0); background: var(--tide); border-color: transparent; }
.tag-soon { margin-left: 0.35rem; }

/* ---- Highlighted feature card (Director, local-first hero card) ---- */
.card-feature {
  background: linear-gradient(180deg, var(--tide-wash), color-mix(in oklch, var(--paper-2) 70%, var(--paper)));
  border-color: color-mix(in oklch, var(--tide) 22%, var(--line));
  box-shadow: var(--shadow-sm);
}

/* ---- Subheads inside a long section (workspace modes / extras) ---- */
.subhead {
  font-family: var(--serif); font-weight: 600; font-size: var(--text-h3);
  letter-spacing: -0.01em; margin: 2.6rem 0 0.4rem;
}
.subhead-lede { color: var(--ink-soft); margin: 0 0 1.2rem; max-width: 52ch; }
.subhead-muted { color: var(--ink-soft); font-size: 1.05rem; margin-top: 2.4rem; }

/* ---- Compact secondary band — commodity/table-stakes features ---- */
.mini-grid {
  list-style: none; margin: 1rem 0 0; padding: 0;
  display: grid; gap: 0.9rem 1.4rem;
  grid-template-columns: repeat(2, 1fr);
}
.mini {
  display: flex; gap: 0.8rem; align-items: flex-start;
  padding: 0.4rem 0;
}
.mini .ico-sm { color: var(--tide); flex: none; margin-top: 0.15rem; }
.mini strong {
  display: block; font-family: var(--sans); font-weight: 600;
  font-size: 0.96rem; color: var(--ink); margin-bottom: 0.1rem;
}
.mini span { display: block; color: var(--ink-soft); font-size: 0.9rem; line-height: 1.55; }
@media (max-width: 680px) { .mini-grid { grid-template-columns: 1fr; } }

/* ---- Section aside (transparency / manual-update line) + honest disclaimer ---- */
.section-aside {
  margin: 1.6rem 0 0; padding: 1rem 1.2rem;
  border-left: 3px solid var(--tide);
  background: color-mix(in oklch, var(--tide-wash) 55%, var(--paper));
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink); font-size: 0.96rem; max-width: 64ch;
}
.section-aside a { color: var(--tide-deep); text-underline-offset: 3px; white-space: nowrap; }
.section-note-honest {
  margin: 1.4rem 0 0; color: var(--ink-faint); font-size: var(--text-small);
  max-width: 60ch;
}

/* ==========================================================================
   Download slot — dual-state (early-access ↔ download). One component,
   two visible states; /dl.js flips data-state when a release is live.
   Built from the existing system (btn/card/tag/--tide). Spec:
   download/download-requirements-for-index.md.
   ========================================================================== */
.dl-slot { margin: 0.4rem 0 0.2rem; }

/* State visibility driven by data-state; [hidden] is the JS-off / pre-flip default. */
.dl-slot[data-state="early-access"] [data-dl-when="download"] { display: none; }
.dl-slot[data-state="download"]     [data-dl-when="early-access"] { display: none; }
.dl-slot[data-state="download"]     [data-dl-when="download"][hidden] { display: block; }

.dl-early-note {
  margin: 0.9rem 0 0; color: var(--ink-soft); font-size: 0.95rem; max-width: 46ch;
}
.dl-platform-line {
  margin: 0.5rem 0 0; color: var(--ink-faint); font-size: var(--text-small);
}
.dl-platform-line strong { color: var(--ink-soft); font-weight: 600; }
.dl-meta {
  margin: 0.85rem 0 0; color: var(--ink-faint); font-size: var(--text-small);
  font-variant-numeric: tabular-nums;
}

/* ---- Trust-proof row (checksum + signature chip + verify expander) ---- */
.dl-trust {
  margin: 1rem 0 0; padding: 1rem 1.1rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: color-mix(in oklch, var(--paper-2) 60%, var(--paper));
  max-width: 52ch;
}
.dl-trust-head {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  font-size: var(--text-small); color: var(--ink-soft); margin-bottom: 0.5rem;
}
.dl-sig {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.2rem 0.55rem; border-radius: 999px;
  color: var(--tide-deep); background: var(--tide-wash);
  border: 1px solid color-mix(in oklch, var(--tide) 30%, var(--line));
  text-decoration: none;
}
.dl-hash {
  display: flex; align-items: center; gap: 0.5rem;
}
.dl-hash code {
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;
  font-size: 0.8rem; color: var(--ink);
  background: color-mix(in oklch, var(--tide-wash) 50%, var(--paper));
  border: 1px solid var(--line); border-radius: 8px;
  padding: 0.35rem 0.55rem; overflow-x: auto; white-space: nowrap;
  flex: 1 1 auto; min-width: 0;
}
.dl-copy {
  flex: none; cursor: pointer; font-family: var(--sans); font-size: var(--text-small);
  font-weight: 600; color: var(--tide-deep);
  background: transparent; border: 1px solid var(--line); border-radius: 8px;
  padding: 0.35rem 0.6rem; transition: border-color 150ms var(--ease), color 150ms var(--ease);
}
.dl-copy:hover { border-color: var(--tide); }
.dl-copy[data-copied="true"] { color: oklch(99% 0 0); background: var(--tide); border-color: transparent; }

/* Verify expander reuses the FAQ disclosure look but tighter. */
.dl-verify { margin-top: 0.7rem; border-top: 1px solid var(--line); padding-top: 0.6rem; }
.dl-verify summary {
  cursor: pointer; list-style: none; font-size: var(--text-small);
  font-weight: 600; color: var(--tide-deep);
}
.dl-verify summary::-webkit-details-marker { display: none; }
.dl-verify pre {
  margin: 0.6rem 0 0; padding: 0.85rem 1rem; border-radius: 10px;
  background: var(--code-bg); color: var(--code-ink);
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;
  font-size: 0.78rem; line-height: 1.55; overflow-x: auto;
}

/* ---- Download matrix (for /download page; styles ship here so they're ready) ---- */
.dl-matrix-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.dl-matrix-row:last-child { border-bottom: 0; }
.dl-matrix-row.is-detected { border-left: 3px solid var(--tide); padding-left: 0.8rem; margin-left: -0.8rem; }

/* ---- FAQ (native disclosure, no JS) ---- */
.faq { display: grid; gap: 0.7rem; max-width: var(--measure); }
.faq details {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: color-mix(in oklch, var(--paper-2) 60%, var(--paper));
  padding: 0 1.3rem; transition: border-color 150ms var(--ease);
}
.faq details[open] { border-color: color-mix(in oklch, var(--tide) 22%, var(--line)); }
.faq summary {
  cursor: pointer; list-style: none; display: flex;
  justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1.05rem 0; font-family: var(--serif); font-weight: 600;
  font-size: var(--text-h3); color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; font-family: var(--sans); font-weight: 400; font-size: 1.5rem;
  line-height: 1; color: var(--tide-deep); flex: none;
}
.faq details[open] summary::after { content: "\2013"; }
.faq details > p { margin: 0 0 1.1rem; color: var(--ink-soft); }

/* ---- Inline CTA callout (early access) ---- */
.cta-callout {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem 2rem; flex-wrap: wrap;
  padding: 1.7rem 1.9rem; margin-bottom: var(--space-section);
}
.cta-callout > div { min-width: min(100%, 30ch); }
.cta-callout-title {
  font-family: var(--serif); font-weight: 600; font-size: var(--text-h2);
  letter-spacing: -0.02em; margin: 0 0 0.3rem;
}
.cta-callout p { margin: 0; max-width: 48ch; }
.cta-callout .btn { flex: none; }

/* ==========================================================================
   Legal pages (privacy / terms) — readable document layout
   ========================================================================== */
.doc { padding: clamp(2.5rem, 1.5rem + 4vw, 4.5rem) 0 var(--space-section); }
.doc h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(2rem, 1.4rem + 2.5vw, 3rem); letter-spacing: -0.02em;
  margin: 0 0 0.4rem;
}
.doc .updated { color: var(--ink-faint); font-size: var(--text-small); margin: 0 0 2.5rem; }
.doc h2 {
  font-family: var(--serif); font-weight: 600; font-size: var(--text-h2);
  letter-spacing: -0.015em; margin: 2.6rem 0 0.7rem;
  scroll-margin-top: 84px;
}
.doc h3 { font-size: var(--text-h3); margin: 1.6rem 0 0.4rem; font-weight: 650; }
.doc p, .doc li { color: var(--ink-soft); }
.doc strong { color: var(--ink); font-weight: 650; }
.doc a { color: var(--tide-deep); text-underline-offset: 3px; }
.doc ul { padding-left: 1.2rem; }
.doc li { margin-bottom: 0.4rem; }
.callout {
  background: var(--tide-wash); border: 1px solid color-mix(in oklch, var(--tide) 25%, var(--line));
  border-radius: var(--radius); padding: 1.1rem 1.3rem; margin: 1.5rem 0;
}
.callout p { margin: 0; color: var(--ink); }
.toc {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.4rem; margin-bottom: 2.5rem; font-size: 0.95rem;
}
.toc strong { display: block; margin-bottom: 0.5rem; font-family: var(--sans); }
.toc ol { margin: 0; padding-left: 1.2rem; columns: 2; column-gap: 2rem; }
.toc a { color: var(--ink-soft); text-decoration: none; }
.toc a:hover { color: var(--tide-deep); }
@media (max-width: 560px) { .toc ol { columns: 1; } }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2.5rem 0;
  color: var(--ink-faint); font-size: 0.9rem;
}
.site-footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }
.site-footer a { color: var(--ink-soft); text-decoration: none; margin-left: 1.2rem; }
.site-footer a:first-of-type { margin-left: 0; }
.site-footer a:hover { color: var(--tide-deep); }
.foot-links { display: flex; flex-wrap: wrap; }

:focus-visible { outline: 2px solid var(--tide); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; transition: none !important; }
}
