/* Wren — shared design system.
   Register per dossier: warm cream canvas, near-black ink, single terracotta
   accent; literary serif display (Fraunces) + grotesque UI sans (Schibsted)
   + mono (JetBrains). Restrained motion, editorial spacing. */

:root {
  /* palette */
  --paper:      #faf7f0;
  --paper-2:    #f4efe3;   /* raised surface / user card */
  --paper-3:    #ede6d6;   /* deeper band */
  --ink:        #1c1b18;
  --ink-2:      #57534a;   /* muted body */
  --ink-3:      #8a857a;   /* faint / captions */
  --coral:      #c96442;
  --coral-deep: #a94b2c;
  --coral-wash: #f6e7de;
  --line:       rgba(28, 27, 24, 0.10);
  --line-2:     rgba(28, 27, 24, 0.16);
  --good:       #4f7a52;
  --warn:       #b6893a;

  /* type */
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* scale (1.25 major-third-ish, tuned) */
  --step--1: 0.833rem;
  --step-0:  1rem;
  --step-1:  1.25rem;
  --step-2:  1.6rem;
  --step-3:  2.1rem;
  --step-4:  2.9rem;
  --step-5:  3.9rem;
  --step-6:  5.2rem;

  /* spacing */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;
  --sp-9: 96px; --sp-10: 140px;

  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(28,27,24,.05), 0 8px 30px rgba(28,27,24,.06);
  --shadow-lg: 0 2px 6px rgba(28,27,24,.06), 0 24px 60px rgba(28,27,24,.10);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-in-out: cubic-bezier(.65, .05, .3, 1);
  --maxw: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

body {
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv05";
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; border-radius: 4px; }

/* ---------- type helpers ---------- */
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 460; line-height: 1.06; letter-spacing: -0.01em; }
.serif { font-family: var(--serif); }
.mono  { font-family: var(--mono); }
.eyebrow {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--coral-deep);
  font-weight: 500;
}
.muted { color: var(--ink-2); }
.lead { font-size: var(--step-1); line-height: 1.5; color: var(--ink-2); max-width: 40ch; }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--sp-5); }
.wrap-narrow { max-width: 760px; }
section { padding-block: var(--sp-9); }
.band { background: var(--paper-2); }
.band-deep { background: var(--paper-3); }
.hr { height: 1px; background: var(--line); border: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px;
  font-weight: 500; font-size: 0.96rem;
  transition: transform .15s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease), color .2s;
  white-space: nowrap;
}
.btn-primary { background: var(--coral); color: #fff; }
.btn-primary:hover { background: var(--coral-deep); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(201,100,66,.28); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
.btn-ghost:hover { background: var(--paper-2); border-color: var(--ink-3); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: #000; transform: translateY(-1px); }
.btn-lg { padding: 15px 26px; font-size: 1.02rem; }

/* ---------- link underline ---------- */
.ulink { color: var(--coral-deep); position: relative; }
.ulink::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: currentColor; opacity: .35; transition: opacity .2s; }
.ulink:hover::after { opacity: 1; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: var(--sp-6); height: 62px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-family: var(--serif); font-size: 1.32rem; font-weight: 500; letter-spacing: -0.02em; }
.brand svg { width: 22px; height: 22px; }
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: 6px; }
.nav-links a { padding: 7px 12px; border-radius: 8px; font-size: 0.92rem; color: var(--ink-2); transition: background .15s, color .15s; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); background: var(--paper-2); }
.nav-cta { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-burger { display: none; margin-left: auto; padding: 8px; border-radius: 8px; }
.nav-burger:hover { background: var(--paper-2); }
.mobile-menu { display: none; }

@media (max-width: 860px) {
  .nav-inner { gap: var(--sp-3); }
  .nav-links { display: none; }
  .nav-cta { gap: 6px; }
  .nav-cta .btn-ghost { display: none; }
  .nav-cta .btn-primary { padding: 8px 14px; font-size: .85rem; }
  .nav-burger { display: inline-flex; }
  .mobile-menu {
    display: block; position: fixed; inset: 62px 0 auto 0; z-index: 49;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: var(--sp-4) var(--sp-5) var(--sp-6);
    transform: translateY(-8px); opacity: 0; pointer-events: none;
    transition: transform .22s var(--ease), opacity .22s var(--ease);
    max-height: calc(100vh - 62px); overflow: auto;
  }
  .mobile-menu.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .mobile-menu a { display: block; padding: 12px 4px; font-size: 1.1rem; font-family: var(--serif); border-bottom: 1px solid var(--line); }
  .mobile-menu .btn { width: 100%; justify-content: center; margin-top: var(--sp-4); }
}

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); background: var(--paper-2); padding-block: var(--sp-8) var(--sp-7); margin-top: var(--sp-9); }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: var(--sp-6); }
.footer h5 { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: var(--sp-4); font-weight: 500; }
.footer ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer a { color: var(--ink-2); font-size: .92rem; }
.footer a:hover { color: var(--coral-deep); }
.footer-brand p { color: var(--ink-2); font-size: .92rem; max-width: 30ch; margin-top: var(--sp-3); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: var(--sp-8); padding-top: var(--sp-5); border-top: 1px solid var(--line); color: var(--ink-3); font-size: .84rem; gap: var(--sp-4); flex-wrap: wrap; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-6) var(--sp-5); } .footer-brand { grid-column: 1 / -1; } }

/* ---------- cards ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--sp-6); box-shadow: var(--shadow); transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }

/* ---------- pill / badge ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--coral-wash); color: var(--coral-deep); font-size: .8rem; font-weight: 500; font-family: var(--mono); letter-spacing: .02em; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 6px; font-size: .74rem; font-family: var(--mono); border: 1px solid var(--line-2); color: var(--ink-2); }

/* ---------- prose (blog / notes / docs) ---------- */
.prose { font-family: var(--serif); font-size: 1.16rem; line-height: 1.72; color: #2a2822; }
.prose > * + * { margin-top: 1.2em; }
.prose h2 { font-size: var(--step-2); margin-top: 1.8em; letter-spacing: -.015em; }
.prose h3 { font-size: var(--step-1); margin-top: 1.6em; }
.prose p { max-width: 68ch; }
.prose a { color: var(--coral-deep); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; text-decoration-color: rgba(169,75,44,.4); }
.prose a:hover { text-decoration-color: var(--coral-deep); }
.prose ul, .prose ol { padding-left: 1.3em; max-width: 66ch; }
.prose li + li { margin-top: .5em; }
.prose blockquote { border-left: 3px solid var(--coral); padding-left: 1.1em; color: var(--ink-2); font-style: italic; }
.prose code { font-family: var(--mono); font-size: .86em; background: var(--paper-2); padding: 2px 6px; border-radius: 6px; }
.prose pre { font-family: var(--mono); font-size: .84rem; background: #201e1a; color: #efe9dd; padding: var(--sp-5); border-radius: var(--radius); overflow-x: auto; line-height: 1.6; }
.prose pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.prose hr { margin-block: 2em; }
.prose img { border-radius: var(--radius); border: 1px solid var(--line); margin-block: 1.5em; }
.prose figcaption { font-family: var(--sans); font-size: .86rem; color: var(--ink-3); text-align: center; margin-top: .6em; }

/* ---------- table ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: .94rem; }
.tbl th, .tbl td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tbl th { font-family: var(--mono); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.tbl td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

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

/* ---------- utility ---------- */
.grid { display: grid; gap: var(--sp-5); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .g-3, .g-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .g-2, .g-3, .g-4 { grid-template-columns: 1fr; } }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.mt-2 { margin-top: var(--sp-2); } .mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); } .mt-7 { margin-top: var(--sp-7); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
