/* Autonomyware — Research / Engineering notes. Shares the sage design system with the homepage. */
:root {
  --ink: #16181C;
  --ink-soft: #454A52;
  --muted: #7C818A;

  --paper: #E8EAE0;        /* base off-white with a pale sage cast */
  --paper-deep: #DFE2D5;   /* deeper alternating band (sage) */
  --raised: #F2F4EC;       /* cards / raised surfaces */
  --line: rgba(22,24,28,0.12);
  --line-soft: rgba(22,24,28,0.07);

  --teal: #1A7A9A;
  --teal-deep: #0F5468;
  --teal-bright: #29A0C4;
  --teal-mist: #CFE2E4;
  --teal-wash: #E1EDEC;

  --clay: #DB5C34;         /* secondary accent, sparingly */

  --grid-line: rgba(40, 80, 70, 0.15);

  --radius: 16px;
  --radius-lg: 26px;
  --shadow-soft: 0 1px 2px rgba(22,24,28,0.05);
  --shadow-raised: 0 2px 10px rgba(22,24,28,0.06);
  --measure: 640px;   /* fixed width so headings and body share one centred column (ch scales with font size) */
  --nav-bg: linear-gradient(to bottom, rgba(232,234,224,0.94), rgba(232,234,224,0.7));
}

/* ===== Dark theme — neutral charcoal (Cursor-like), fully desaturated.
   Greys carry NO tint; teal + clay accents are identical to light mode. ===== */
:root[data-theme="dark"]{
  --ink:#ECECED; --ink-soft:#A6A7A9; --muted:#77787B;
  --paper:#131314; --paper-deep:#1A1A1B; --raised:#202021;
  --line:rgba(255,255,255,0.10); --line-soft:rgba(255,255,255,0.055);
  --teal:#1A7A9A; --teal-deep:#5FC2DC; --teal-bright:#29A0C4;
  --teal-mist:rgba(41,160,196,0.30); --teal-wash:rgba(41,160,196,0.12);
  --clay:#DB5C34;
  --grid-line:rgba(255,255,255,0.05);
  --shadow-soft:none; --shadow-raised:none;
  --nav-bg:linear-gradient(to bottom, rgba(19,19,20,0.92), rgba(19,19,20,0.66));
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --ink:#ECECED; --ink-soft:#A6A7A9; --muted:#77787B;
    --paper:#131314; --paper-deep:#1A1A1B; --raised:#202021;
    --line:rgba(255,255,255,0.10); --line-soft:rgba(255,255,255,0.055);
    --teal:#1A7A9A; --teal-deep:#5FC2DC; --teal-bright:#29A0C4;
    --teal-mist:rgba(41,160,196,0.30); --teal-wash:rgba(41,160,196,0.12);
    --clay:#DB5C34;
    --grid-line:rgba(255,255,255,0.05);
    --shadow-soft:none; --shadow-raised:none;
    --nav-bg:linear-gradient(to bottom, rgba(19,19,20,0.92), rgba(19,19,20,0.66));
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; }
body {
  margin: 0; color: var(--ink); background: var(--paper);
  font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px; line-height: 1.62; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--teal-mist); }

/* Display + heading type uses the site sans stack (Inter), matching the rest of
   the site. No serif/typewriter face for headlines or article titles. */
.display { font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-weight: 800; letter-spacing: -0.03em; line-height: 1.04; }
.serif { font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }

.shell { width: min(1280px, calc(100% - 48px)); margin-inline: auto; }
.measure { width: min(var(--measure), calc(100% - 48px)); margin-inline: auto; }

/* Nav + footer chrome is worker-injected and styled by the shared pages.css,
   so research pages inherit the exact same header/footer as the rest of the site. */

/* ---------- Category tag / kicker ---------- */
/* Editorial mono kicker with a clay accent rule (deliberately not a rounded pill). */
.tag { align-self: flex-start; display: inline-flex; align-items: center; gap: 10px;
  padding: 0; background: none; border: 0; border-radius: 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; color: var(--teal-deep); }
.tag::before { content: ""; width: 24px; height: 2px; background: var(--clay); flex: none; }

/* ---------- Post header ---------- */
.post-top { position: relative; overflow: hidden; padding: 66px 0 34px; border-bottom: 1px solid var(--line-soft);
  background: var(--paper); }
.post-top::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 34px 34px; -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 45%, transparent 100%); mask-image: radial-gradient(120% 90% at 50% 0%, #000 45%, transparent 100%); }
.post-top > * { position: relative; }
.crumbs { font-size: 13.5px; color: var(--muted); margin-bottom: 22px; }
.crumbs a:hover { color: var(--teal); }
.post-top h1 { font-size: clamp(34px, 5vw, 62px); margin: 16px 0 0; max-width: 20ch; }
.post-dek { margin: 20px 0 0; font-size: clamp(18px, 2vw, 22px); color: var(--ink-soft); max-width: 62ch; }
/* ---------- Prose ---------- */
.prose { padding: 46px 0 40px; }
.prose > * { width: min(var(--measure), calc(100% - 48px)); margin-inline: auto; }
.prose p { margin: 0 auto 22px; }
.prose h2 { font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-weight: 700; letter-spacing: -0.02em; font-size: clamp(24px, 3vw, 34px); margin: 46px auto 16px; line-height: 1.16; }
.prose h3 { font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-weight: 700; letter-spacing: -0.01em; font-size: 21px; margin: 34px auto 10px; }
.prose a.link { color: var(--teal); border-bottom: 1px solid var(--teal-mist); }
.prose a.link:hover { border-color: var(--teal); }
.prose ul { margin: 0 auto 22px; padding: 0; list-style: none; }
.prose ul li { position: relative; padding-left: 24px; margin-bottom: 12px; }
.prose ul li::before { content: ""; position: absolute; left: 4px; top: 11px; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.prose strong { font-weight: 600; }
.prose em { font-style: italic; }
.lead { font-size: 20px; color: var(--ink-soft); }

.pull { font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-weight: 600; font-size: clamp(22px, 3vw, 30px); line-height: 1.3; color: var(--teal-deep);
  border-left: 3px solid var(--teal); padding: 6px 0 6px 24px; margin: 32px auto; }

/* ---------- Figure / callout / mono ---------- */
.figure { width: min(860px, calc(100% - 48px)) !important; margin: 34px auto; border-radius: var(--radius-lg);
  background: var(--raised); border: 1px solid var(--line-soft); box-shadow: var(--shadow-soft); overflow: hidden; }
.figure .frame { position: relative; padding: 30px; background:
  radial-gradient(120% 120% at 50% 0%, var(--teal-wash), transparent 70%); border-bottom: 1px solid var(--line-soft); }
.figure .frame::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .6;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 30px 30px; -webkit-mask-image: radial-gradient(80% 80% at 50% 50%, #000 30%, transparent 85%); mask-image: radial-gradient(80% 80% at 50% 50%, #000 30%, transparent 85%); }
.figure .frame > * { position: relative; }
.figure .frame img { display: block; width: 100%; height: auto; border-radius: 8px; box-shadow: 0 6px 18px rgba(15,84,104,0.10); }
.figure figcaption { padding: 16px 22px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.figure figcaption b { color: var(--ink-soft); font-weight: 600; }

.callout { width: min(var(--measure), calc(100% - 48px)); margin: 30px auto; padding: 22px 24px; border-radius: var(--radius);
  background: var(--teal-wash); border: 1px solid var(--teal-mist); color: var(--teal-deep); font-size: 15.5px; }
.callout b { color: var(--teal-deep); }

.mono { width: min(720px, calc(100% - 48px)); margin: 26px auto; padding: 20px 22px; border-radius: var(--radius);
  background: #0E3B49; color: #CFEAF0; border: 1px solid rgba(255,255,255,0.08);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; line-height: 1.7; white-space: pre; overflow-x: auto; }
.mono .k { color: #7fe0b0; } .mono .n { color: #ffd9a8; } .mono .z { color: #ff9f80; }

/* ---------- Funding acknowledgement (transparent logos, embedded directly) ---------- */
.fund { width: min(var(--measure), calc(100% - 48px)); margin: 48px auto 8px; padding-top: 28px; border-top: 1px solid var(--line); text-align: center; }
.fund .lab { display: inline-flex; align-items: center; gap: 9px; font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--teal-deep); }
.fund .lab::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 5px rgba(26,122,154,0.14); }
.fund-logos { display: flex; align-items: center; justify-content: center; gap: 34px; margin: 22px 0 18px; flex-wrap: wrap; }
.fund-logos img { display: block; width: auto; }
.fund-logos img.eu { height: 80px; }
.fund-logos img.snn { height: 66px; }
.fund-logos .sep { width: 1px; align-self: stretch; min-height: 56px; background: var(--line); }
.fund p { margin: 0; font-size: 12.5px; line-height: 1.62; color: var(--muted); }
@media (max-width: 620px){ .fund-logos { gap: 24px; } .fund-logos .sep { display: none; } }

/* ---------- Interactive fit figure (Figure 3) ---------- */
.fitfig { width: min(860px, calc(100% - 48px)) !important; margin: 34px auto; border-radius: var(--radius-lg);
  background: var(--raised); border: 1px solid var(--line-soft); box-shadow: var(--shadow-soft); overflow: hidden; }
.fitfig .fit-head { display: flex; align-items: center; gap: 10px; padding: 20px 26px 0; font-size: 14px; font-weight: 600; color: var(--teal-deep); }
.fitfig .stage { position: relative; padding: 22px 30px 8px; background: radial-gradient(120% 120% at 50% 0%, var(--teal-wash), transparent 72%); }
.fitfig svg { width: 100%; height: auto; display: block; }
.fitfig .ctrl { padding: 18px 26px 8px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.fitfig .ctrl input[type=range] { flex: 1; min-width: 220px; accent-color: var(--teal); }
.fitfig .dval { font-family: "JetBrains Mono", monospace; font-size: 15px; font-weight: 600; color: var(--teal-deep); min-width: 130px; }
.fitfig .readout { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 8px 26px 24px; }
.fitfig .cell { border-radius: var(--radius); padding: 14px 16px; border: 1px solid var(--line-soft); background: var(--paper); }
.fitfig .cell .lab { font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.fitfig .cell .big { font-family: "JetBrains Mono", monospace; font-size: 22px; font-weight: 600; margin-top: 4px; }
.fitfig .cell.truth .big { color: var(--teal-deep); }
.fitfig .cell.bbox .big { color: var(--clay); }
.fitfig .verdict { margin: 0 26px 22px; padding: 12px 16px; border-radius: var(--radius); font-size: 14.5px; font-weight: 600; text-align: center;
  background: var(--teal-wash); border: 1px solid var(--teal-mist); color: var(--teal-deep); }
.fitfig .verdict.press { background: #F7E4DB; border-color: #E9C6B6; color: #A5401F; }
.fitfig figcaption { padding: 4px 26px 22px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }

/* ---------- Hub ---------- */
.hub-intro { padding: 60px 0 8px; }
.hub-intro h1 { font-size: clamp(36px, 5.4vw, 66px); margin: 16px 0 0; max-width: 16ch; }
.hub-intro p { margin: 22px 0 0; font-size: 20px; color: var(--ink-soft); max-width: 60ch; }
.hub-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; padding: 40px 0 20px; }
.hub-card { display: flex; flex-direction: column; gap: 14px; padding: 30px 30px 28px; border-radius: var(--radius-lg);
  background: var(--raised); border: 1px solid var(--line-soft); box-shadow: var(--shadow-soft);
  transition: transform .24s cubic-bezier(.2,.7,.2,1), border-color .24s ease, box-shadow .24s ease; }
.hub-card:hover { transform: translateY(-6px); border-color: var(--teal-mist); box-shadow: var(--shadow-raised); }
.hub-card h2 { font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-weight: 700; font-size: 25px; line-height: 1.18; letter-spacing: -0.02em; margin: 4px 0 0; }
.hub-card p { color: var(--ink-soft); font-size: 15px; flex: 1; margin: 0; }
.hub-card .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hub-card .read { font-size: 13.5px; font-weight: 600; color: var(--teal); }
.hub-card.feature { grid-column: 1 / -1; background: var(--raised); }
.hub-card.feature h2 { font-size: clamp(26px, 3.4vw, 38px); max-width: 22ch; }

/* Footer is worker-injected and styled by the shared pages.css. */
.backlink { display: inline-flex; align-items: center; gap: 8px; margin: 8px auto 0; width: min(var(--measure), calc(100% - 48px)); font-weight: 600; color: var(--teal); }

@media (max-width: 820px) {
  .hub-grid { grid-template-columns: 1fr; }
  .fitfig .readout { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
