/* cosy — design spine. Premium, warm, calm. All pages link this file.
   Palette & rules derived from research/05-design-reference.md. Do not add new accent colors. */

:root {
  --bg: #FBF7F0;
  --bg-alt: #F3ECE3;
  --text: #2B2621;
  --text-muted: #7A7168;
  --accent: #7C5CFF;
  --accent-ink: #5B3FE0;
  --accent-warm: #E8956B;
  --success: #5B8A5A;
  --border: #E5DDD0;
  --card: #FFFFFF;

  /* decorative-only (hero gradients / mask-image), never block fills */
  --d-bone: #D2CABC;
  --d-sand: #C5BB9F;
  --d-sage: #BCC8BC;

  --shadow-soft: 0 8px 30px rgba(43, 38, 33, 0.06);
  --shadow-lift: 0 14px 40px rgba(43, 38, 33, 0.09);
  --radius: 12px;
  --radius-sm: 8px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  --maxw: 960px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 1.0625rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---------- Layout ---------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: 88px 0; }
.section--tight { padding: 56px 0; }
.section--alt { background: var(--bg-alt); }
.bleed { width: 100%; }

@media (max-width: 640px) {
  .section { padding: 60px 0; }
  body { font-size: 1rem; }
}

/* ---------- Typography ---------- */
h1, h2, h3, .display { font-family: var(--serif); font-weight: 500; line-height: 1.12; letter-spacing: -0.01em; color: var(--text); }
h1, .h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); }
h2, .h2 { font-size: clamp(1.6rem, 3vw, 2.15rem); font-weight: 600; }
h3, .h3 { font-size: clamp(1.2rem, 2vw, 1.4rem); font-weight: 600; }
p { max-width: 62ch; }
.lead { font-size: clamp(1.1rem, 1.6vw, 1.3rem); color: var(--text-muted); font-weight: 400; }
a { color: var(--accent-ink); text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { color: var(--accent); }
.muted { color: var(--text-muted); }
.serif { font-family: var(--serif); }

/* editorial pull-line between sections */
.pull {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(1.5rem, 3.4vw, 2.4rem); line-height: 1.25;
  max-width: 24ch; color: var(--text); letter-spacing: -0.01em;
}
.pull em { font-style: italic; color: var(--accent-ink); }

/* ---------- Labels / badges (mono, sparing) ---------- */
.label {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted);
}
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.04em;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); color: var(--text-muted);
}
.badge--live { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); background: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.badge--warm { color: #B5623B; border-color: color-mix(in srgb, var(--accent-warm) 40%, var(--border)); background: color-mix(in srgb, var(--accent-warm) 10%, var(--card)); }
.badge .dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; }

.eyebrow { display: inline-block; margin-bottom: 18px; }

/* ---------- Header / nav ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.2) blur(10px); border-bottom: 1px solid var(--border); }
.nav { display: flex; align-items: center; justify-content: space-between; padding: 15px 0; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-ink) 100%); box-shadow: var(--shadow-soft); }
.brand-mark i, .brand-mark svg { width: 17px; height: 17px; }
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 1.35rem; letter-spacing: -0.01em; }
.brand-sub { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.nav-links { display: flex; gap: 26px; align-items: center; }
.nav-links a { font-size: 0.92rem; color: var(--text-muted); }
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); font-weight: 500; }
a.card { display: block; color: inherit; }
a.card:hover { color: inherit; }
.card .go { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; font-size: 0.9rem; color: var(--accent-ink); }
.card .go i, .card .go svg { width: 15px; height: 15px; transition: transform 0.2s var(--ease); }
a.card:hover .go i, a.card:hover .go svg { transform: translateX(3px); }
@media (max-width: 720px) { .nav-links { display: none; } }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 96px 0 72px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto -10%; height: 620px; z-index: -1;
  background:
    radial-gradient(60% 60% at 22% 18%, color-mix(in srgb, var(--accent) 22%, transparent) 0%, transparent 60%),
    radial-gradient(50% 50% at 82% 8%, color-mix(in srgb, var(--accent-warm) 26%, transparent) 0%, transparent 62%),
    radial-gradient(70% 60% at 55% 60%, color-mix(in srgb, var(--d-sand) 40%, transparent) 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(72% 70% at 50% 30%, #000 0%, transparent 78%);
          mask-image: radial-gradient(72% 70% at 50% 30%, #000 0%, transparent 78%);
  opacity: 0.9; filter: saturate(1.05);
}
.hero h1 { max-width: 18ch; }

/* ---------- Keystats ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 40px; }
.stat .num { font-family: var(--serif); font-weight: 500; font-size: clamp(1.9rem, 4vw, 2.8rem); line-height: 1; color: var(--text); }
.stat .num .unit { font-size: 0.5em; color: var(--text-muted); }
.stat .cap { display: block; margin-top: 8px; font-size: 0.85rem; color: var(--text-muted); max-width: 22ch; }

/* ---------- Cards & grid ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow-soft);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.card h3 { margin-bottom: 8px; }
.card .card-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 16px;
  background: color-mix(in srgb, var(--accent) 10%, var(--card)); color: var(--accent-ink); border: 1px solid var(--border); }
.card .card-ico i, .card .card-ico svg { width: 20px; height: 20px; }
.card--warm .card-ico { background: color-mix(in srgb, var(--accent-warm) 12%, var(--card)); color: #B5623B; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
table.cosy { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
table.cosy th, table.cosy td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.cosy thead th { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); font-weight: 500; }
table.cosy tbody tr:last-child td { border-bottom: none; }
table.cosy .col-accent { color: var(--text); font-weight: 500; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 9px; font-family: var(--sans); font-size: 0.95rem; font-weight: 500;
  padding: 12px 22px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; transition: all 0.2s var(--ease); }
.btn i, .btn svg { width: 17px; height: 17px; }
.btn--primary { background: var(--text); color: var(--bg); }
.btn--primary:hover { background: #000; color: var(--bg); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--text-muted); color: var(--text); }

/* ---------- Thread motif (signature) ---------- */
.thread { display: block; height: 1px; border: none; border-top: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--border)); margin: 0; opacity: 0.7; }
.thread-node { position: relative; padding-left: 26px; }
.thread-node::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: -6px; width: 1px; border-left: 1px dashed var(--border); }
.thread-node::after { content: ""; position: absolute; left: 0; top: 4px; width: 9px; height: 9px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--accent); }
.thread-node:last-child::before { display: none; }

/* ---------- Timeline / roadmap ---------- */
.timeline { display: grid; gap: 4px; }
.phase { position: relative; padding: 22px 24px 22px 30px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-soft); }
.phase--now { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: color-mix(in srgb, var(--accent) 5%, var(--card)); }
.phase .yr { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.04em; color: var(--accent-ink); }
.phase--now .yr { color: var(--accent-ink); font-weight: 500; }
.phase h3 { margin: 4px 0 6px; }

/* ---------- Device mockup (product-as-hero) ---------- */
.device { border: 1px solid var(--border); border-radius: 18px; background: var(--card); box-shadow: var(--shadow-lift); padding: 14px; }
.device .screen { border-radius: 10px; background: var(--bg-alt); border: 1px solid var(--border); overflow: hidden; }

/* ---------- Code block (manifest / snippets) ---------- */
.code-block {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; overflow-x: auto; box-shadow: var(--shadow-soft);
}
.code-block code { font-family: var(--mono); font-size: 0.86rem; line-height: 1.7; color: var(--text); }

/* ---------- Prose (changelog / agents / reflection) ---------- */
.prose { max-width: 720px; }
.prose h2 { margin: 44px 0 14px; }
.prose h3 { margin: 30px 0 10px; }
.prose p { margin-bottom: 16px; }
.prose ul, .prose ol { margin: 0 0 18px 22px; }
.prose li { margin-bottom: 7px; }
.prose code { font-family: var(--mono); font-size: 0.86em; background: var(--bg-alt); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border); }
.prose blockquote { border-left: 2px solid var(--accent); padding: 4px 0 4px 18px; margin: 18px 0; color: var(--text-muted); font-family: var(--serif); font-size: 1.2rem; font-style: italic; }

/* changelog entries */
.entry { padding: 28px 0; border-top: 1px solid var(--border); }
.entry:first-of-type { border-top: none; }
.entry .when { font-family: var(--mono); font-size: 0.78rem; color: var(--text-muted); }
.entry h3 { margin: 6px 0 10px; }

/* boundaries ✅/⚠️/🚫 */
.bounds { display: grid; gap: 12px; }
.bound { display: flex; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); }
.bound .mk { font-size: 1.1rem; line-height: 1.5; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-alt); padding: 40px 0; margin-top: 20px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center; }
.footer-links { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-links a { font-size: 0.88rem; color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }
.footer-meta { font-family: var(--mono); font-size: 0.72rem; color: var(--text-muted); letter-spacing: 0.03em; }

/* ---------- Reveal on scroll (progressive enhancement) ----------
   Content is visible by default. Hiding only applies once JS confirms support
   (html.cosy-anim), so no-JS users, crawlers, and slow loads always see content. */
.reveal { opacity: 1; transform: none; }
html.cosy-anim .reveal { opacity: 0; transform: translateY(12px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
html.cosy-anim .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { html.cosy-anim .reveal { opacity: 1; transform: none; transition: none; } html { scroll-behavior: auto; } }

/* utilities */
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}.mt-4{margin-top:36px}.mt-5{margin-top:52px}
.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}.mb-4{margin-bottom:36px}
.center{text-align:center}.wrap-narrow{max-width:680px}.mx-auto{margin-left:auto;margin-right:auto}
.flex{display:flex}.gap-2{gap:16px}.gap-3{gap:24px}.items-center{align-items:center}.wrap{flex-wrap:wrap}
