/* Zittl marketing site.
   Tokens match the dashboard (src/app/globals.css) so the site and the product look related.
   Fonts: Geist Variable + Geist Mono Variable, self-hosted (SIL OFL). Icons: Phosphor (MIT).
   Shape system: containers 20px, interactive elements 12px, pills only for status chips.
   Motion: transform and opacity only, all of it off under prefers-reduced-motion. */

@font-face {
  font-family: "Geist";
  src: url("/fonts/geist-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/geist-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --background: #f4f1ea;
  --foreground: #171717;
  --surface: #fcfcfb;
  --surface-sunken: #ebe7de;
  --muted: #e4dfd4;
  --muted-foreground: #5f5d57;
  --border: rgba(23, 23, 23, 0.12);
  --accent: #1c5cab;
  --accent-soft: #6da7ec;
  --accent-tint: #dfe9f6;
  --positive: #006300;
  --shadow: 0 1px 2px rgba(60, 50, 30, 0.06), 0 14px 36px rgba(60, 50, 30, 0.08);
  --line-hi: #171717;
  --line-edge: #3d3b36;
  --line-mid: #85827a;
  --line-lo: #c9c4b8;
  --r-container: 20px;
  --r-control: 12px;
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --z-header: 40;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #111110;
  --foreground: #ededea;
  --surface: #1a1a19;
  --surface-sunken: #151514;
  --muted: #262624;
  --muted-foreground: #a3a29a;
  --border: rgba(255, 255, 255, 0.12);
  --accent: #6da7ec;
  --accent-soft: #6da7ec;
  --accent-tint: #1b2a3f;
  --positive: #3fb950;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 14px 36px rgba(0, 0, 0, 0.4);
  --line-hi: #ededea;
  --line-edge: #b5b4ab;
  --line-mid: #6f6e66;
  --line-lo: #34332f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #111110;
    --foreground: #ededea;
    --surface: #1a1a19;
    --surface-sunken: #151514;
    --muted: #262624;
    --muted-foreground: #a3a29a;
    --border: rgba(255, 255, 255, 0.12);
    --accent: #6da7ec;
    --accent-tint: #1b2a3f;
    --positive: #3fb950;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 14px 36px rgba(0, 0, 0, 0.4);
    --line-hi: #ededea;
    --line-edge: #b5b4ab;
    --line-mid: #6f6e66;
    --line-lo: #34332f;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; overflow-x: clip; }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* A fixed, pointer-free grain layer breaks the digital flatness without touching scroll performance. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.35 0 0 0 0 0.25 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] body::before { opacity: 0.15; }

a, button { touch-action: manipulation; -webkit-tap-highlight-color: rgba(28, 92, 171, 0.18); }
a { color: inherit; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent-soft); color: #0b0b0b; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--foreground); color: var(--background);
  padding: 10px 16px; border-radius: var(--r-control); text-decoration: none;
}
.skip-link:focus { top: 12px; }

.ph { width: 1.1em; height: 1.1em; flex: none; }

/* ---------- Header ---------- */
header.site {
  position: sticky; top: 0; z-index: var(--z-header);
  background: color-mix(in srgb, var(--background) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
header.site.scrolled { border-bottom-color: var(--border); }
header.site nav { display: flex; align-items: center; height: 68px; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; font-size: 18px; letter-spacing: -0.02em; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 800;
}
:root[data-theme="dark"] .brand-mark { color: #0b0b0b; }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  padding: 8px 14px; border-radius: var(--r-control); text-decoration: none;
  font-size: 15px; color: var(--muted-foreground);
  transition: color 0.2s ease, background-color 0.2s ease;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--foreground); background: var(--muted); }
.theme-toggle {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-control);
  border: 1px solid var(--border); background: transparent; color: var(--foreground); cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s var(--ease);
}
.theme-toggle:hover { background: var(--muted); }
.theme-toggle:active { transform: scale(0.96); }
.theme-toggle .ph { width: 20px; height: 20px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px; border-radius: var(--r-control);
  font: inherit; font-weight: 600; font-size: 16px; text-decoration: none; white-space: nowrap;
  border: 1px solid transparent; cursor: pointer;
  transition: transform 0.2s var(--ease), background-color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.btn:active { transform: translateY(1px) scale(0.985); }
.btn-primary { background: var(--foreground); color: var(--background); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(23, 23, 23, 0.22); }
.btn-primary:active { transform: translateY(1px) scale(0.985); }
.btn-text { padding: 0 6px; color: var(--foreground); }
.btn-text .ph { transition: transform 0.25s var(--ease); }
.btn-text:hover .ph { transform: translateX(4px); }

/* ---------- Type ---------- */
h1, h2, h3 { margin: 0; font-weight: 620; letter-spacing: -0.03em; text-wrap: balance; }
h1 { font-size: clamp(2.5rem, 4.7vw, 3.8rem); line-height: 1.02; letter-spacing: -0.04em; }
h2 { font-size: clamp(1.9rem, 3.4vw, 2.9rem); line-height: 1.08; }
h3 { font-size: 1.3rem; line-height: 1.2; letter-spacing: -0.02em; }
p { margin: 0; text-wrap: pretty; }
.lead { font-size: clamp(1.1rem, 1.5vw, 1.3rem); color: var(--muted-foreground); max-width: 46ch; line-height: 1.5; }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }
.eyebrow {
  display: inline-block; font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent);
}
.caption { font-size: 13px; color: var(--muted-foreground); margin-top: 12px; max-width: 70ch; }
.section { padding-top: 112px; }
.section-head { max-width: 62ch; display: grid; gap: 16px; margin-bottom: 44px; }
.section-head p { color: var(--muted-foreground); font-size: 1.1rem; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr); gap: 40px; align-items: center; padding-top: 64px; padding-bottom: 8px; }
.hero-copy { display: grid; gap: 26px; justify-items: start; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }
.hero-figure { position: relative; width: 100%; aspect-ratio: 5 / 4; }
.hero-figure [data-figure] { position: absolute; inset: -9% -12%; }

/* Hairline figures read their colours from these tokens; plates must match the page background. */
[data-figure] {
  --hairline-plate: var(--background);
  --hairline-hi: var(--line-hi);
  --hairline-edge: var(--line-edge);
  --hairline-mid: var(--line-mid);
  --hairline-lo: var(--line-lo);
}

/* ---------- Product cards ---------- */
.product-grid { align-items: start; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
.product-card {
  display: grid; align-content: start; text-decoration: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-container); overflow: hidden; box-shadow: var(--shadow);
  transition: transform 0.35s var(--ease), box-shadow 0.35s ease;
}
.product-card:hover { transform: translateY(-4px); }
.product-card:nth-child(1) { grid-column: span 7; }
.product-card:nth-child(2) { grid-column: span 5; margin-top: 56px; }
.product-card .media { overflow: hidden; background: var(--surface-sunken); }
.product-card:nth-child(1) .media { aspect-ratio: 16 / 10; }
.product-card:nth-child(2) .media { aspect-ratio: 4 / 4.4; }
.product-card .media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s var(--ease); }
.product-card:hover .media img { transform: scale(1.035); }
.product-card .body { padding: 26px 28px 30px; display: grid; gap: 10px; }
.product-card .body p { color: var(--muted-foreground); max-width: 44ch; }
.product-card .go { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; font-weight: 600; font-size: 15px; }
.product-card .go .ph { transition: transform 0.25s var(--ease); }
.product-card:hover .go .ph { transform: translate(3px, -3px); }
.status-chip {
  display: inline-block; justify-self: start; font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: 999px; background: var(--muted); color: var(--muted-foreground);
}
.status-chip.live { background: var(--accent-tint); color: var(--accent); }

/* ---------- Dashboard ---------- */
.band { border-radius: var(--r-container); overflow: hidden; background: var(--surface-sunken); border: 1px solid var(--border); }
.band img { width: 100%; aspect-ratio: 21 / 9; object-fit: cover; }
.bento { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin-top: 56px; }
.cell {
  position: relative; overflow: hidden; border-radius: var(--r-container); padding: 28px; display: grid;
  align-content: end; gap: 10px; min-height: 230px; background: var(--surface); border: 1px solid var(--border);
}
.cell p { color: var(--muted-foreground); font-size: 16px; max-width: 46ch; }
.cell.span-4 { grid-column: span 4; } .cell.span-2 { grid-column: span 2; } .cell.span-3 { grid-column: span 3; }
.cell.tint { background: var(--accent-tint); border-color: transparent; }
.cell.tint p { color: color-mix(in srgb, var(--foreground) 72%, transparent); }
.cell.dots {
  background-color: var(--surface-sunken);
  background-image: radial-gradient(color-mix(in srgb, var(--foreground) 22%, transparent) 1px, transparent 1.2px);
  background-size: 14px 14px;
}
.cell.photo { color: #fff; border-color: transparent; }
.cell.photo > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.cell.photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(18, 17, 15, 0.78), rgba(18, 17, 15, 0.1) 70%); z-index: 1; }
.cell.photo > * { position: relative; z-index: 2; }
.cell.photo p { color: rgba(255, 255, 255, 0.86); }
.cell .ph-big { width: 28px; height: 28px; color: var(--accent); margin-bottom: auto; }

.ask { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 72px; align-items: start; }
.ask .section-head { margin-bottom: 0; position: sticky; top: 110px; }
.qa { display: grid; gap: 0; }
.qa-item { padding: 26px 0; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.qa-item:last-of-type { border-bottom: 1px solid var(--border); }
.qa-q { font-size: 1.15rem; font-weight: 560; letter-spacing: -0.015em; }
.qa-a { color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.qa-a b { color: var(--foreground); font-weight: 600; }
.qa-label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-foreground); }

.runs { display: grid; grid-template-columns: 180px minmax(0, 1fr); border-top: 1px solid var(--border); margin: 0; }
.runs dt, .runs dd { padding: 26px 0; border-bottom: 1px solid var(--border); margin: 0; }
.runs dt { font-family: var(--font-mono); font-size: 14px; color: var(--accent); }
.runs dd { max-width: 62ch; color: var(--muted-foreground); }
.runs dd b { color: var(--foreground); font-weight: 600; display: block; margin-bottom: 4px; font-size: 1.05rem; }

/* ---------- Wuxigen ---------- */
.wuxigen-intro { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: 64px; align-items: center; }
.wuxigen-intro .section-head { margin-bottom: 0; }
.figure-box { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-container); }
.figure-box [data-figure] { position: absolute; inset: -10% -8%; }
.pipeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 72px; }
.pipe { position: relative; padding: 24px 22px 0 0; border-top: 2px solid var(--border); }
.pipe::before {
  content: ""; position: absolute; left: 0; top: -6px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--background);
}
.pipe h3 { font-size: 1.1rem; margin-bottom: 6px; }
.pipe p { font-size: 15px; color: var(--muted-foreground); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 64px; margin-top: 72px; }
.fact { padding: 28px 0; border-top: 1px solid var(--border); display: grid; gap: 8px; }
.fact p { color: var(--muted-foreground); max-width: 48ch; }

/* ---------- Privacy ---------- */
.privacy-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 20px; align-items: start; }
.privacy-col { border-radius: var(--r-container); padding: 36px; border: 1px solid var(--border); background: var(--surface); }
.privacy-col.next { background: transparent; border-style: dashed; }
.privacy-col h3 { margin-bottom: 22px; display: flex; align-items: center; gap: 10px; }
.privacy-col h3 .ph { color: var(--accent); }
.privacy-item { padding: 18px 0; border-top: 1px solid var(--border); }
.privacy-item:first-of-type { border-top: 0; padding-top: 0; }
.privacy-item b { display: block; margin-bottom: 4px; font-size: 1.05rem; letter-spacing: -0.01em; }
.privacy-item p { color: var(--muted-foreground); }

/* ---------- Blog cards (home teaser and /blog/ index) ---------- */
.posts, .post-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.post-card {
  display: grid; align-content: start; gap: 10px; padding: 28px; text-decoration: none; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-container);
  transition: transform 0.3s var(--ease), box-shadow 0.3s ease;
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.post-card h2, .post-card h3 { font-size: 1.35rem; line-height: 1.2; letter-spacing: -0.02em; }
.post-card p { color: var(--muted-foreground); font-size: 16px; }
.post-meta { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted-foreground); }
.post-meta a, button { touch-action: manipulation; -webkit-tap-highlight-color: rgba(28, 92, 171, 0.18); }
a { color: inherit; }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.post-tags span { font-family: var(--font-mono); font-size: 12px; background: var(--muted); color: var(--muted-foreground); padding: 3px 10px; border-radius: 999px; }
.more { margin-top: 28px; }

/* ---------- Blog pages ---------- */
.post, .post-index { max-width: 760px; padding-top: 64px; padding-bottom: 40px; }
.post-index { max-width: 1000px; }
.post h1, .post-index h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); line-height: 1.08; margin: 12px 0 14px; }
.post-index .lead { margin-bottom: 8px; }
.post-body { font-size: 18px; line-height: 1.72; margin-top: 28px; }
.post-body h2 { font-size: 1.65rem; margin: 48px 0 10px; }
.post-body h3 { font-size: 1.2rem; margin: 30px 0 4px; }
.post-body p, .post-body ul, .post-body ol { margin: 0 0 18px; max-width: 68ch; }
.post-body li { margin-bottom: 6px; }
.post-body a, .toc a { color: var(--accent); text-underline-offset: 3px; }
.post-body code { font-family: var(--font-mono); background: var(--muted); padding: 1px 6px; border-radius: 6px; font-size: 0.88em; }
.post-body blockquote { margin: 0 0 18px; padding: 4px 18px; border-left: 3px solid var(--accent); color: var(--muted-foreground); }
.post-body img { border-radius: var(--r-container); }
.crumbs { color: var(--muted-foreground); font-size: 14px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--foreground); }
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-container); padding: 18px 22px; margin: 26px 0 0; font-size: 15px; }
.toc ul { margin: 8px 0 0; padding-left: 18px; }
.related { max-width: 1000px; padding-top: 40px; }
.related h2 { font-size: 1.5rem; margin-bottom: 4px; }
.post-grid { margin-top: 28px; }

/* ---------- Footer ---------- */
footer.site { margin-top: 128px; border-top: 1px solid var(--border); padding: 36px 0 48px; }
.footer-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; }
.footer-links { display: flex; gap: 20px; margin-left: auto; }
.footer-links a, .footer-note { font-size: 14px; color: var(--muted-foreground); }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--foreground); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); transition-delay: var(--d, 0ms); }
  .reveal.in { opacity: 1; transform: none; }
  .hero-copy > * { animation: rise 0.9s var(--ease) both; }
  .hero-copy > :nth-child(2) { animation-delay: 80ms; }
  .hero-copy > :nth-child(3) { animation-delay: 160ms; }
  .hero-copy > :nth-child(4) { animation-delay: 240ms; }
  @keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; animation: none !important; }
}
:root[data-theme="dark"] .product-card .media img,
:root[data-theme="dark"] .band img { filter: brightness(0.82) contrast(1.05); }

/* ---------- Tablet and phone ---------- */
@media (max-width: 1000px) {
  .hero, .wuxigen-intro, .ask, .privacy-grid { grid-template-columns: 1fr; gap: 40px; }
  .ask .section-head { position: static; }
  .hero-figure { max-width: 560px; }
  .hero-figure [data-figure], .figure-box [data-figure] { inset: 0; }
  .product-card:nth-child(1), .product-card:nth-child(2) { grid-column: span 12; margin-top: 0; }
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cell.span-4, .cell.span-3 { grid-column: span 2; }
  .cell.span-2 { grid-column: span 1; }
  .pipeline { grid-template-columns: 1fr; gap: 0; margin-top: 48px; }
  .pipe { padding: 20px 0 20px 28px; border-top: 0; border-left: 2px solid var(--border); }
  .pipe::before { left: -6px; top: 26px; }
  .facts, .posts, .post-grid { grid-template-columns: 1fr; }
  .runs { grid-template-columns: 1fr; }
  .runs dt { padding-bottom: 0; border-bottom: 0; }
  .runs dd { padding-top: 6px; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .section { padding-top: 80px; }
  .nav-links a { padding: 8px 10px; }
  .nav-links a.hide-sm { display: none; }
  header.site nav { gap: 8px; }
  .hero { padding-top: 40px; }
  .bento { grid-template-columns: 1fr; }
  .cell.span-4, .cell.span-3, .cell.span-2 { grid-column: span 1; }
  .privacy-col { padding: 26px; }
  .footer-links { margin-left: 0; }
  .post-body { font-size: 17px; }
}
