/* ============================================================
   EDITORIAL — a portable design system
   Warm-paper editorial style: Bodoni display, Space Mono labels,
   Jost/Sora body, generous whitespace, hairline rules, arch + badge motifs.

   USAGE
   -----
   1. Load the four typefaces (the @import below does this for you, or
      add the same <link> in your <head> for faster loading).
   2. <link rel="stylesheet" href="editorial.css"> in your page.
   3. Build with the component classes (see STYLE-GUIDE.md).
   Drop-in and self-contained — no build step, no JS required.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bodoni+Moda:ital,opsz,wght@0,6..96,400;0,6..96,500;0,6..96,600;1,6..96,400;1,6..96,500&family=Jost:wght@300;400;500;600&family=Sora:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  /* ---- paper / surfaces ---- */
  --paper:       #EFE6D2;   /* page background (warm cream) */
  --paper-2:     #E7DBC1;   /* deeper band / table headers */
  --card:        #FBF7EC;   /* raised surface (warm white) */
  --ink:         #26221D;   /* primary text (espresso) */
  --ink-soft:    #3D362A;   /* secondary headings */
  --muted:       #6E6451;   /* body muted text */
  --faint:       #9A9079;   /* hints, captions */
  --line:        rgba(38, 34, 29, 0.16);  /* hairline */
  --line-strong: rgba(38, 34, 29, 0.30);  /* emphasized hairline */

  /* ---- accents (use sparingly, max ~2 per view) ---- */
  --gold:  #B89248;   /* primary accent, ticks, highlights */
  --green: #3F5E3A;   /* positive / nature / "go" */
  --rust:  #A8612F;   /* warm emphasis / alerts */
  --indigo:#3A4A63;   /* optional cool accent */

  /* ---- type ---- */
  --serif: 'Bodoni Moda', Georgia, 'Times New Roman', serif;  /* display */
  --sans:  'Jost', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; /* body/UI */
  --sora:  'Sora', var(--sans);   /* numbers, tabular */
  --mono:  'Space Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace; /* labels */

  /* ---- layout ---- */
  --radius:    14px;
  --radius-lg: 22px;
  --maxw:      1080px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ============================================================
   TYPOGRAPHY PRIMITIVES
   ============================================================ */
.display { font-family: var(--serif); font-weight: 500; line-height: 1.02; letter-spacing: -0.015em; }
.display em, .serif-italic { font-style: italic; font-weight: 400; }

.eyebrow {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 400;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted);
  display: inline-flex; align-items: center; gap: 9px;
}
.eyebrow::before { content: ''; width: 18px; height: 1px; background: var(--gold); display: inline-block; }
.eyebrow.no-tick::before { display: none; }

.lede { font-size: 1.18rem; font-weight: 300; color: var(--ink-soft); line-height: 1.7; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

/* ============================================================
   NAVIGATION
   ============================================================ */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(18px, 4vw, 40px);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-nav .brand { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.18em; text-transform: uppercase; display: inline-flex; align-items: center; gap: 8px; }
.site-nav .brand .deg { color: var(--rust); }
.site-nav .links { display: flex; align-items: center; gap: clamp(14px, 3vw, 30px); }
.site-nav .navlink {
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); display: inline-flex; align-items: center; gap: 7px; padding: 4px 0;
  border-bottom: 1px solid transparent; transition: color .18s, border-color .18s;
}
.site-nav .navlink:hover, .site-nav .navlink.is-active { color: var(--ink); }
.site-nav .navlink .tick { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); opacity: 0; transition: opacity .18s; }
.site-nav .navlink:hover .tick, .site-nav .navlink.is-active .tick { opacity: 1; }

/* ============================================================
   LAYOUT
   ============================================================ */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(18px, 4vw, 40px); }
.section { padding: clamp(48px, 8vw, 88px) 0; }
.section-head { margin-bottom: 32px; }
.section-head h2 { font-family: var(--serif); font-weight: 500; font-size: clamp(1.8rem, 4.5vw, 2.8rem); letter-spacing: -0.01em; margin-top: 10px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 13px 26px; border-radius: 999px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper);
  transition: gap .18s, background .18s, color .18s, transform .18s; cursor: pointer;
}
.btn:hover { gap: 14px; transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); }

/* ============================================================
   CARDS
   ============================================================ */
.card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 24px; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.card-link:hover { transform: translateY(-4px); box-shadow: 0 22px 48px -28px rgba(38,34,29,0.45); border-color: var(--line-strong); }
.card .num { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.18em; color: var(--faint); }
.card h3 { font-family: var(--serif); font-weight: 500; font-size: 1.5rem; margin: 12px 0 6px; letter-spacing: -0.01em; }
.card p { color: var(--muted); font-size: 0.95rem; }
.card .go { margin-top: 18px; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); display: inline-flex; gap: 8px; transition: gap .18s; }
.card-link:hover .go { gap: 13px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 18px; }

/* optional left accent on a card: add style="--accent: var(--rust)" + class card-accent */
.card-accent::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent, var(--gold)); border-top-left-radius: var(--radius); border-bottom-left-radius: var(--radius); }

/* ============================================================
   METRICS (big numbers)
   ============================================================ */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px; }
.metric .k { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.metric .v { font-family: var(--serif); font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 600; line-height: 1.05; margin-top: 10px; }
.metric .s { color: var(--muted); font-size: 0.84rem; margin-top: 4px; }

/* ============================================================
   PILLS / TAGS
   ============================================================ */
.pill { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-soft); background: var(--card); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.pill.gold .dot   { background: var(--gold); }
.pill.green .dot  { background: var(--green); }
.pill.rust .dot   { background: var(--rust); }
.pill.indigo .dot { background: var(--indigo); }

/* ============================================================
   TABLES
   ============================================================ */
.etable { width: 100%; border-collapse: collapse; font-size: 0.92rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.etable th { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); text-align: left; font-weight: 700; padding: 13px 16px; border-bottom: 1px solid var(--line-strong); background: var(--paper-2); }
.etable td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.etable tr:last-child td { border-bottom: none; }
.etable tr:hover td { background: color-mix(in srgb, var(--gold) 7%, transparent); }
.etable td.num, .etable th.num { text-align: right; font-family: var(--sora); font-variant-numeric: tabular-nums; }
/* wrap wide tables: <div class="table-scroll"><table class="etable">…</table></div> */
.table-scroll { overflow-x: auto; border-radius: var(--radius); }

/* ============================================================
   NOTES / CALLOUTS
   ============================================================ */
.note { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent, var(--gold)); border-radius: 0 var(--radius) var(--radius) 0; padding: 16px 20px; }
.note .note-label { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent, var(--gold)); margin-bottom: 6px; }
.note p { color: var(--ink-soft); font-size: 0.95rem; }
.note.tip  { --accent: var(--green); }
.note.warn { --accent: var(--rust); }
.note.info { --accent: var(--indigo); }

/* ============================================================
   TIMELINE (vertical)
   ============================================================ */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: var(--line-strong); }
.timeline .t-row { position: relative; padding: 0 0 22px; }
.timeline .t-row::before { content: ''; position: absolute; left: -23px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent, var(--gold)); border: 2px solid var(--paper); }
.timeline .t-time { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; color: var(--muted); }
.timeline .t-title { font-family: var(--serif); font-size: 1.15rem; font-weight: 500; margin: 2px 0 4px; }
.timeline .t-row p { color: var(--muted); font-size: 0.92rem; }

/* ============================================================
   ARCH + BADGE MOTIFS
   ============================================================ */
.arch { border-top-left-radius: 999px; border-top-right-radius: 999px; overflow: hidden; border: 1px solid var(--line-strong); background: var(--paper-2); }
.arch > img { width: 100%; height: 100%; object-fit: cover; }

.badge { position: relative; width: 104px; height: 104px; }
.badge svg { width: 100%; height: 100%; animation: badge-spin 22s linear infinite; }
.badge .badge-text { font-family: var(--mono); font-size: 8.2px; letter-spacing: 2.2px; fill: var(--ink); text-transform: uppercase; }
.badge .badge-dot { position: absolute; inset: 0; margin: auto; width: 9px; height: 9px; border-radius: 50%; background: var(--rust); }
@keyframes badge-spin { to { transform: rotate(360deg); } }

/* ============================================================
   RULES / DIVIDERS
   ============================================================ */
.rule { height: 1px; background: var(--line); border: none; }
.rule-strong { height: 1px; background: var(--line-strong); border: none; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer { border-top: 1px solid var(--line); padding: 44px clamp(18px,4vw,40px) 52px; text-align: center; color: var(--muted); }
.site-footer .mark { font-family: var(--serif); font-style: italic; font-size: 1.4rem; color: var(--ink); }
.site-footer .meta { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; margin-top: 12px; color: var(--faint); }

/* ============================================================
   ENTRANCE ANIMATION (optional)
   ============================================================ */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.reveal { animation: rise .8s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.reveal.d1 { animation-delay: .08s; }
.reveal.d2 { animation-delay: .18s; }
.reveal.d3 { animation-delay: .28s; }
.reveal.d4 { animation-delay: .38s; }

@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; }
  .badge svg { animation: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   RESPONSIVE — HAMBURGER NAV
   ============================================================ */
.nav-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  background: none; border: none; cursor: pointer;
  padding: 10px; border-radius: 8px;
  flex-shrink: 0; margin-left: auto;
}
.nav-hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--ink); border-radius: 2px;
  transition: transform .22s ease, opacity .18s ease, transform .22s ease;
  transform-origin: center;
  pointer-events: none;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   RESPONSIVE — MOBILE (≤768px)
   ============================================================ */
@media (max-width: 768px) {
  /* Nav */
  .site-nav { flex-wrap: wrap; padding: 12px clamp(16px, 4vw, 24px); align-items: center; }
  .site-nav .links { display: none; }
  .site-nav .navlink {
    padding: 13px 2px; min-height: 44px; font-size: 0.8rem;
    border-bottom: 1px solid var(--line); width: 100%;
  }
  .site-nav .navlink:last-child { border-bottom: none; }

  /* Layout */
  .section { padding: clamp(32px, 6vw, 56px) 0; }
  .section-head h2 { font-size: clamp(1.6rem, 5vw, 2.2rem); }

  /* Cards */
  .card-grid { grid-template-columns: 1fr; }
  .card { padding: 20px 18px; }

  /* Metrics */
  .metric-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }

  /* Timeline */
  .timeline { padding-left: 20px; }
  .timeline::before { left: 5px; }
  .timeline .t-row::before { left: -17px; width: 8px; height: 8px; }
  .timeline .t-title { font-size: 1rem; }

  /* Tables */
  .etable { font-size: 0.84rem; }
  .etable th, .etable td { padding: 10px 12px; }

  /* Pills */
  .pill { font-size: 0.62rem; padding: 4px 10px; }

  /* Footer */
  .site-footer { padding: 32px clamp(16px, 4vw, 24px) 40px; }
}

/* ============================================================
   RESPONSIVE — SMALL MOBILE (≤480px)
   ============================================================ */
@media (max-width: 480px) {
  .card-grid { gap: 12px; }
  .metric { padding: 16px 14px; }
  .metric .v { font-size: clamp(1.5rem, 8vw, 2rem); }
  .note { padding: 13px 16px; }
  .lede { font-size: 1.05rem; }
}

/* ============================================================
   NAV DRAWER
   ============================================================ */
.nav-drawer-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(38,34,29,0.5);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.nav-drawer-overlay.open {
  opacity: 1; pointer-events: all;
}
.nav-drawer {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(300px, 88vw);
  background: var(--paper);
  border-left: 1px solid var(--line);
  overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column;
}
.nav-drawer-overlay.open .nav-drawer {
  transform: translateX(0);
}

/* close × button */
.drawer-close {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin: 16px 16px 8px auto;
  background: none; border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; flex-shrink: 0; position: relative;
  transition: background 0.15s;
}
.drawer-close:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.drawer-close span {
  position: absolute; width: 16px; height: 1.5px;
  background: var(--ink); border-radius: 2px;
}
.drawer-close span:nth-child(1) { transform: rotate(45deg); }
.drawer-close span:nth-child(2) { transform: rotate(-45deg); }

/* sections */
.drawer-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.drawer-section:last-child { border-bottom: none; padding-bottom: 32px; }
.drawer-label {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--faint);
  margin: 0 0 10px 0;
}
.drawer-link {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  transition: color 0.14s, padding-left 0.14s;
  text-decoration: none;
}
.drawer-link:last-child { border-bottom: none; }
.drawer-link::before {
  content: ''; display: block; width: 5px; height: 5px;
  border-radius: 50%; background: var(--gold);
  opacity: 0; flex-shrink: 0;
  transition: opacity 0.14s;
}
.drawer-link:hover { color: var(--ink); padding-left: 4px; }
.drawer-link:hover::before { opacity: 1; }
.drawer-link.is-active { color: var(--ink); font-weight: 600; }
.drawer-link.is-active::before { opacity: 1; }
