/*
 * Capydown — landing page
 * Strict monochrome, typography-led. No web fonts: system serif for headlines,
 * system sans for text. The only colour on the page comes from real screenshots.
 */

:root {
  --ink: #111;
  --ink-2: #333;
  --muted: #6b6b6b;
  --faint: #9b9b9b;
  --line: #e8e8e6;
  --paper: #fff;
  --paper-2: #f7f7f5;
  --serif: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC", "Noto Serif SC", "SimSun", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Monaco, "Cascadia Mono", Consolas, monospace;
  --wrap: 1120px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.8 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 700; }
.wrap { width: 100%; max-width: calc(var(--wrap) + 48px); margin: 0 auto; padding: 0 24px; }
.serif { font-family: var(--serif); }
/* headlines break at punctuation, never inside a CJK word */
.hero-title, .section-head h2, .section-head .lede, .closing h2, .ai-card h3, .byok h3, .hero-sub { word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

/* ------------------------------------------------------------------ nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.nav.is-stuck { border-bottom-color: var(--line); }
.nav .wrap { display: flex; align-items: center; height: 60px; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 15px; letter-spacing: 0.01em; }
.brand img { width: 24px; height: 24px; }
.brand .dot { color: var(--faint); font-weight: 400; }
.nav-links { display: flex; gap: 26px; margin-left: auto; font-size: 14px; }
.nav-links a, .lang { text-decoration: none; color: var(--muted); transition: color 0.2s; }
.nav-links a:hover, .lang:hover { color: var(--ink); }
.lang { font-size: 13px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px; border-radius: 999px;
  font: 500 15px/1 var(--sans); text-decoration: none; letter-spacing: 0.02em;
  border: 1px solid var(--ink); transition: background 0.2s, color 0.2s, transform 0.2s;
}
.btn:active { transform: translateY(1px); }
.btn-solid { background: var(--ink); color: #fff; }
.btn-solid:hover { background: #333; }
.btn-ghost { background: transparent; color: var(--ink); border-color: #cfcfcc; }
.btn-ghost:hover { border-color: var(--ink); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-sm { height: 34px; padding: 0 16px; font-size: 13px; }

/* ------------------------------------------------------------------ hero */
.hero { padding: 112px 0 0; text-align: center; }
/* logo lockup: [coloured letter-animal C] apydown — the C of the wordmark IS the capybara, so the
 * mascot's letter ink is cap-aligned with the text. Generated by letter_capy.py, don't hand-edit. */
/* lockup:start */
.hero-lockup { position: relative; width: min(560px, 88vw); aspect-ratio: 734.9 / 155.1; margin: 0 auto; color: var(--ink); }
.hero-lockup > * { position: absolute; display: block; overflow: visible; }
.hl-mark { left: 0.00%; top: 0.00%; width: 18.44%; height: auto; }
.hl-word { left: 16.28%; top: 13.73%; width: 83.72%; height: 86.27%; }
/* lockup:end */
.hero-slogan { margin-top: 34px; font: 400 20px/1.5 var(--serif); letter-spacing: 0.06em; color: var(--muted); }
.hero-title { margin-top: 14px; font: 700 34px/1.45 var(--serif); letter-spacing: 0.02em; }
.hero-sub { margin: 14px auto 0; max-width: 560px; color: var(--muted); font-size: 17px; }
.hero-cta { display: flex; justify-content: center; gap: 12px; margin-top: 38px; flex-wrap: wrap; }
.hero-note { margin-top: 18px; font-size: 13px; color: var(--faint); letter-spacing: 0.02em; }
.hero-note span + span::before { content: " · "; }
/* the app window, with the letter-animal C leaning out from behind its top edge */
.hero-stage { position: relative; margin-top: 96px; }
.hero-stage .peek { position: absolute; right: 7%; bottom: 100%; width: 210px; height: auto; margin-bottom: -22px; z-index: 0; pointer-events: none; }
.hero-shot { position: relative; z-index: 1; }

/* splash-like intro: the capybara settles, the wordmark slides in */
.anim .hl-mark { animation: settle 0.7s var(--ease) 0.15s both; }
.anim .hl-word { animation: word-in 0.7s var(--ease) 0.85s both; }
.anim .hero-slogan { animation: rise 0.7s var(--ease) 1.3s both; }
.anim .hero-title { animation: rise 0.7s var(--ease) 1.4s both; }
.anim .hero-sub, .anim .hero-cta, .anim .hero-note { animation: rise 0.7s var(--ease) 1.6s both; }
.anim .hero-shot { animation: rise-lg 1s var(--ease) 1.75s both; }
.anim .hero-stage .peek { animation: peek 1.4s var(--ease) 2.2s both; } /* unhurried, like a capybara */

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes settle { from { opacity: 0; transform: translateY(14px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes word-in { from { opacity: 0; transform: translateX(-14px); filter: blur(3px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes peek { from { opacity: 0; transform: translateY(70%); } 25% { opacity: 1; } to { opacity: 1; transform: none; } }
@keyframes rise-lg { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ window frame */
.win {
  position: relative; border-radius: 12px; overflow: hidden; background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04), 0 24px 60px -12px rgba(0, 0, 0, 0.18);
}
.win img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.win.doc img { object-position: top; }
.cap { margin-top: 16px; font-size: 13px; color: var(--faint); text-align: center; }

/* ------------------------------------------------------------------ sections */
.section { padding: 168px 0 0; }
.eyebrow { font-size: 13px; letter-spacing: 0.16em; color: var(--faint); text-transform: uppercase; }
.section-head { max-width: 680px; margin: 0 auto; text-align: center; }
.section-head h2 { margin-top: 18px; font: 700 48px/1.3 var(--serif); letter-spacing: 0.02em; }
.section-head .lede { margin-top: 22px; color: var(--muted); font-size: 18px; }
.section-body { margin-top: 72px; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 44px 56px; margin-top: 72px; }
.feature h3 { font-size: 16px; font-weight: 600; letter-spacing: 0.01em; }
.feature p { margin-top: 8px; font-size: 15px; line-height: 1.75; color: var(--muted); }
.feature kbd, .keys kbd, .lede kbd { font-size: 0.86em; }

kbd {
  display: inline-block; min-width: 1.6em; padding: 0.05em 0.45em; border-radius: 5px;
  font: 500 0.86em/1.5 var(--sans); text-align: center; color: var(--ink-2);
  background: var(--paper); border: 1px solid #dcdcd8; box-shadow: 0 1px 0 #dcdcd8;
}
code { font: 0.9em var(--mono); background: var(--paper-2); padding: 0.1em 0.35em; border-radius: 4px; }

/* editor theme switcher */
.switcher { display: flex; justify-content: center; gap: 6px; margin-bottom: 28px; }
.switcher button {
  font: 500 13px/1 var(--sans); color: var(--muted); background: none; cursor: pointer;
  border: 1px solid transparent; border-radius: 999px; padding: 9px 16px; transition: color 0.2s, border-color 0.2s;
}
.switcher button:hover { color: var(--ink); }
.switcher button[aria-selected="true"] { color: var(--ink); border-color: var(--ink); }
.stack { display: grid; }
.stack > img { grid-area: 1 / 1; opacity: 0; transition: opacity 0.5s ease; }
.stack > img.is-on { opacity: 1; }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-top: 32px; }

/* AI cards */
.ai-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 72px; }
.ai-card h3 { margin-top: 32px; font: 700 26px/1.4 var(--serif); }
.ai-card p { margin-top: 10px; color: var(--muted); font-size: 15.5px; }
.ai-card ul { margin: 16px 0 0; padding: 0; list-style: none; font-size: 15px; color: var(--ink-2); }
.ai-card li { padding: 9px 0; border-top: 1px solid var(--line); }
.ai-card li:last-child { border-bottom: 1px solid var(--line); }

.byok {
  display: grid; grid-template-columns: 220px 1fr; gap: 40px; margin-top: 80px;
  padding: 40px 44px; background: var(--paper-2); border-radius: 14px;
}
.byok h3 { font: 700 22px/1.45 var(--serif); }
.byok p { color: var(--muted); font-size: 15px; }
.byok p + p { margin-top: 10px; }
.providers { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.providers span { font-size: 13px; color: var(--ink-2); border: 1px solid #dcdcd8; border-radius: 999px; padding: 3px 12px; background: #fff; }

/* local-first band */
.local { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 72px; border-top: 1px solid var(--line); }
.local div { padding: 32px 28px 0 0; }
.local div + div { padding-left: 28px; border-left: 1px solid var(--line); }
.local strong { display: block; font: 700 20px/1.4 var(--serif); }
.local span { display: block; margin-top: 10px; font-size: 14.5px; line-height: 1.75; color: var(--muted); }

/* shortcuts */
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 0 72px; max-width: 880px; margin: 72px auto 0; }
.keys div { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.keys span { color: var(--ink-2); }
.keys kbd + kbd { margin-left: 4px; }
.keys-note { margin-top: 28px; text-align: center; font-size: 13px; color: var(--faint); }
.keys-note a { color: var(--muted); }

/* FAQ */
.faq { max-width: 760px; margin: 64px auto 0; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  padding: 24px 0; cursor: pointer; list-style: none; font-size: 17px; font-weight: 500;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 300 24px/1 var(--sans); color: var(--faint); transition: transform 0.3s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 48px 26px 0; color: var(--muted); font-size: 15.5px; }

/* closing */
.closing { position: relative; overflow: hidden; padding: 200px 0 300px; text-align: center; }
.closing-peek { position: absolute; left: 50%; bottom: 24px; width: 200px; height: auto; transform: translateX(-50%); pointer-events: none; }
.closing h2 { font: 700 56px/1.3 var(--serif); letter-spacing: 0.04em; }
.closing p { margin-top: 18px; color: var(--muted); }
.closing .hero-cta { margin-top: 36px; }

/* footer */
.footer { border-top: 1px solid var(--line); padding: 44px 0 56px; font-size: 13px; color: var(--muted); }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; }
.footer nav { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-left: auto; }
.footer a { text-decoration: none; color: var(--muted); }
.footer a:hover { color: var(--ink); }
.footer .fine { flex-basis: 100%; color: var(--faint); font-size: 12px; line-height: 1.7; }

/* ------------------------------------------------------------------ reveal on scroll */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 960px) {
  .features { grid-template-columns: 1fr 1fr; }
  .local { grid-template-columns: 1fr 1fr; }
  .local div:nth-child(3) { padding-left: 0; border-left: 0; }
  .byok { grid-template-columns: 1fr; gap: 16px; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .nav-links a:not(.keep) { display: none; }
  .nav .wrap { gap: 16px; }
  .hero { padding-top: 64px; }
  .hero-slogan { margin-top: 24px; font-size: 17px; }
  .hero-title { font-size: 24px; margin-top: 26px; }
  .hero-sub { font-size: 15px; }
  .hero-title span { display: block; }
  .hero-note span { display: block; }
  .hero-note span + span::before { content: none; }
  .hero-stage { margin-top: 64px; }
  .hero-stage .peek { width: 140px; margin-bottom: -40px; }
  .closing-peek { width: 150px; }
  .win { border-radius: 8px; }
  .section { padding-top: 112px; }
  .section-head h2 { font-size: 32px; }
  .section-head .lede { font-size: 16px; }
  .section-body, .features, .ai-grid { margin-top: 48px; }
  .features { grid-template-columns: 1fr; gap: 28px; }
  .duo, .ai-grid { grid-template-columns: 1fr; gap: 28px; }
  .ai-card h3 { margin-top: 22px; font-size: 22px; }
  .byok { padding: 28px 24px; margin-top: 56px; }
  .local { grid-template-columns: 1fr; margin-top: 48px; }
  .local div, .local div + div { padding: 24px 0; border-left: 0; border-bottom: 1px solid var(--line); }
  .keys { grid-template-columns: 1fr; margin-top: 48px; }
  .switcher button { padding: 8px 12px; }
  .faq details p { padding-right: 0; }
  .closing { padding: 140px 0 220px; }
  .closing h2 { font-size: 38px; }
  .footer nav { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .anim .hl-mark, .anim .hl-word, .anim .hero-slogan, .anim .hero-stage .peek, .anim .hero-title, .anim .hero-sub, .anim .hero-cta, .anim .hero-note, .anim .hero-shot {
    animation: fade 0.4s ease-out both !important;
  }
  .js .reveal { transform: none; transition: opacity 0.4s ease-out; }
  .stack > img { transition: none; }
}
