/* Shared styles for project pages: mirrors the main site's tokens. */

/* Self-hosted, so rendering text contacts no third party. Both families
   are under the SIL Open Font License; the licences sit beside the files
   in assets/fonts/. The weight ranges are declared rather than listed
   because these are variable fonts: one file covers 300-600, and Fraunces
   keeps its optical-size axis, which .hero-name relies on. */
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 300 600;
  font-display: swap;
  src: url(../assets/fonts/fraunces-italic-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 300 600;
  font-display: swap;
  src: url(../assets/fonts/fraunces-italic-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url(../assets/fonts/fraunces-normal-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url(../assets/fonts/fraunces-normal-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(../assets/fonts/inter-normal-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(../assets/fonts/inter-normal-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
:root {
  --ink: #0A0A0C;
  --ink2: #121214;
  --ink3: #18181B;
  --accent: #C9A876;
  --accent-bright: #E8D5B0;
  --accent-soft: rgba(201, 168, 118, 0.12);
  --accent-line: rgba(201, 168, 118, 0.25);
  --text-primary: #EDEDEF;
  --text-secondary: #A8A8B0;
  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
/* the topbar is sticky, so "Jump to results" must clear it */
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  background: var(--ink);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--accent); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 24px; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 10, 12, 0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.topbar-inner {
  max-width: 880px; margin: 0 auto; padding: 16px 24px;
  display: flex; justify-content: space-between; align-items: center;
}
.topbar a { color: var(--text-primary); text-decoration: none; font-size: 14px; letter-spacing: .02em; }
.topbar a:hover { color: var(--accent); }
.topbar .back { color: var(--text-secondary); }

.hero { padding: 72px 0 40px; }
.eyebrow {
  font-size: 12px; letter-spacing: .22em; color: var(--accent);
  text-transform: uppercase; font-weight: 500; margin-bottom: 18px;
}
h1 {
  font-family: var(--font-display); font-weight: 400; color: var(--text-primary);
  font-size: clamp(30px, 5.4vw, 46px); line-height: 1.12; letter-spacing: -0.01em;
  margin-bottom: 18px;
}
h1 em { font-style: italic; color: var(--accent); font-weight: 300; }
.lede { font-size: 18px; max-width: 640px; margin-bottom: 28px; }
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.btn-primary, .btn-secondary {
  display: inline-block; padding: 13px 26px; border-radius: 100px;
  font-size: 14px; font-weight: 500; letter-spacing: .02em; text-decoration: none;
  transition: all .25s ease;
}
.btn-primary { background: var(--accent); color: var(--ink); }
.btn-primary:hover { box-shadow: 0 0 28px rgba(201, 168, 118, 0.4); }
.btn-secondary { color: var(--text-primary); border: 1px solid rgba(255, 255, 255, 0.18); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.metric-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px; margin: 36px 0 8px;
}
.metric {
  background: var(--ink2); border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px; padding: 18px 20px;
}
.metric-num { font-family: var(--font-display); font-size: 30px; color: var(--accent); line-height: 1.15; }
.metric-label { font-size: 12.5px; margin-top: 4px; line-height: 1.45; }

section.block { padding: 34px 0 6px; }
h2 {
  font-family: var(--font-display); font-weight: 400; color: var(--text-primary);
  font-size: 26px; margin-bottom: 14px;
}
h2 em { font-style: italic; color: var(--accent); font-weight: 300; }
.block p { max-width: 700px; margin-bottom: 14px; }
.block strong { color: var(--text-primary); font-weight: 500; }
.block ul { margin: 0 0 14px 20px; max-width: 700px; }
.block li { margin-bottom: 6px; }

/* Inline prose links, which otherwise fall back to default browser blue
   on every project page that cross-references another. */
.block p a, .block li a, .lede a, figcaption a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-line);
  transition: color .2s ease, border-color .2s ease;
}
.block p a:hover, .block li a:hover, .lede a:hover, figcaption a:hover {
  color: var(--accent-bright);
  border-bottom-color: var(--accent-bright);
}
.block p code, .block li code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.9em;
  color: var(--text-primary);
}

figure {
  background: var(--ink2); border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px; padding: 14px; margin: 22px 0;
}
figure.light { background: #f6f4ef; }
img { max-width: 100%; height: auto; }
figure img { width: 100%; height: auto; display: block; border-radius: 8px; }
figcaption { font-size: 13px; color: var(--text-secondary); padding: 12px 6px 2px; line-height: 1.5; }
.fig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 700px) { .fig-grid { grid-template-columns: 1fr; } }

.footer {
  margin-top: 56px; padding: 30px 0 44px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
}
.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { color: var(--accent-bright); }

@media (prefers-reduced-motion: no-preference) {
  .hero, section.block { animation: rise .5s ease both; }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
}

pre.code-block {
  background: #101216;
  border: 1px solid rgba(237, 234, 227, 0.09);
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  color: #d7d3ca;
  margin: 14px 0;
}

/* ============ PRINT ============
   Story pages get the same treatment as the homepage: a reader who prints one
   is usually taking it somewhere the screen will not follow. The tokens carry
   most of it, but the topbar's translucent panel, the light-figure plate and
   the code block all set their colours directly and have to be named. */
@media print {
  :root {
    --ink: #FFFFFF;
    --ink2: #FFFFFF;
    --ink3: #FFFFFF;
    --accent: #6B5220;
    --accent-bright: #4A3814;
    --accent-soft: rgba(107, 82, 32, 0.07);
    --accent-line: rgba(107, 82, 32, 0.40);
    --text-primary: #14141A;
    --text-secondary: #3A3A42;
  }

  @page { margin: 16mm; }

  body { background: #FFFFFF; color: #14141A; }
  .topbar, .back-to-top { display: none !important; }

  /* The solid accent button carries its label in --ink, which is now white.
     Without its background it would print white on white. */
  .btn-primary {
    color: var(--accent);
    background: none;
    border: 1px solid var(--accent-line);
  }

  figure {
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.18);
  }
  figure.light { background: #FFFFFF; }

  pre.code-block {
    background: #F5F4F1;
    border: 1px solid rgba(0, 0, 0, 0.18);
    color: #14141A;
  }

  .footer { border-top: 1px solid rgba(0, 0, 0, 0.18); }

  /* A table that scrolls sideways on screen has nowhere to scroll on paper.
     These rules are !important because the story pages set their table styles
     in an inline <style> that would otherwise win on order. */
  .data-table-scroll { overflow: visible !important; }
  .data-table { font-size: 0.72rem !important; table-layout: fixed; }
  .data-table th, .data-table td {
    white-space: normal !important;
    word-break: break-word;
  }

  /* Evidence should not be split down the middle by a page break */
  figure, .metric, .data-table-scroll, .fig-grid { break-inside: avoid; }
  h1, h2, h3 { break-after: avoid; }

  /* A paper copy has to carry its own references */
  .cta-row a[href^="http"]::after,
  .block p a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.78em;
    word-break: break-all;
    color: var(--text-secondary);
  }
}
