/* Amikind — Human Futures Platform
   "Civic observatory": a calm instrument for shared, cited knowledge.
   Signature = the living knowledge graph. Serif for voice, mono for the typed schema
   (node types, relations, confidence — a real controlled vocabulary, so it wears mono). */

:root {
  /* Light — cool field-notebook paper, not cream */
  --paper: #eaeee9;
  --surface: #f5f8f3;
  --panel: #ffffff;
  --ink: #10201d;
  --ink-soft: #47574f;
  --ink-faint: #75857c;
  --line: #d2dbd2;
  --line-soft: #e0e7e0;
  --accent: #0c7d70;
  --accent-strong: #094f47;
  --accent-wash: #0c7d7014;
  --amber: #a86a12;
  --rose: #a83a54;
  --shadow: 0 1px 2px #10201d0f, 0 8px 24px -12px #10201d1f;

  /* Node-type families (identity always paired with a text label / legend) */
  --fam-idea: #0c7d70;      /* concept */
  --fam-evidence: #b06a12;  /* research, case_study, metric */
  --fam-framework: #4b5bd6; /* standard, policy */
  --fam-actor: #b03a63;     /* organization, expert, community */
  --fam-enabler: #2f8a52;   /* education, funding, event, project */
  --fam-lesson: #96712a;    /* lesson */

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --wrap: 74rem;
  --radius: 14px;
  --radius-sm: 8px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --paper: #0a1412; --surface: #0e1b18; --panel: #132320; --ink: #e8f0eb;
    --ink-soft: #a2b4ac; --ink-faint: #6f827a; --line: #223530; --line-soft: #1a2825;
    --accent: #34bda9; --accent-strong: #6fe0cf; --accent-wash: #34bda91c;
    --amber: #e0a848; --rose: #e37e93; --shadow: 0 1px 2px #0006, 0 12px 32px -14px #0009;
    --fam-idea: #34bda9; --fam-evidence: #e0a848; --fam-framework: #8b98ff;
    --fam-actor: #e881a3; --fam-enabler: #5fc07f; --fam-lesson: #d3b063;
  }
}
:root[data-theme="dark"] {
  --paper: #0a1412; --surface: #0e1b18; --panel: #132320; --ink: #e8f0eb;
  --ink-soft: #a2b4ac; --ink-faint: #6f827a; --line: #223530; --line-soft: #1a2825;
  --accent: #34bda9; --accent-strong: #6fe0cf; --accent-wash: #34bda91c;
  --amber: #e0a848; --rose: #e37e93; --shadow: 0 1px 2px #0006, 0 12px 32px -14px #0009;
  --fam-idea: #34bda9; --fam-evidence: #e0a848; --fam-framework: #8b98ff;
  --fam-actor: #e881a3; --fam-enabler: #5fc07f; --fam-lesson: #d3b063;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 1.4rem; }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; font-weight: 600; letter-spacing: -0.01em; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.muted { color: var(--ink-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff; padding: .6rem 1rem; z-index: 20; }
.skip-link:focus { left: 0; }

/* The typed-vocabulary voice: node types, relations, confidence, eyebrows. */
.mono, .eyebrow, .pill, .confidence, .edge-rel, .facet-btn, .metric-k {
  font-family: var(--font-mono); font-variant-ligatures: none;
}
.eyebrow {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .18em; color: var(--ink-faint);
  display: inline-flex; align-items: center; gap: .5rem;
}
.eyebrow::before { content: ""; width: 1.6rem; height: 1px; background: var(--accent); }

/* Header */
.site-header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; padding-block: .7rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); }
.brand svg { width: 30px; height: 30px; }
.brand-text { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; line-height: 1; }
.brand-sub { display: block; font-family: var(--font-mono); font-size: .64rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint); margin-top: 3px; }
.site-nav { display: flex; align-items: center; gap: 1.3rem; }
.site-nav a { text-decoration: none; color: var(--ink-soft); font-weight: 500; font-size: .95rem; }
.site-nav a:hover { color: var(--ink); }
#theme-toggle { background: var(--panel); border: 1px solid var(--line); color: var(--ink); border-radius: 999px; width: 2.2rem; height: 2.2rem; cursor: pointer; font-size: .95rem; display: grid; place-items: center; }
#theme-toggle:hover { border-color: var(--accent); }

/* Hero */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero-graph { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: .5; mask-image: radial-gradient(90% 90% at 82% 34%, #000 30%, transparent 80%); }
/* Scrim keeps the headline crisp while the graph breathes on the right. */
.hero::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(97deg, var(--paper) 20%, color-mix(in srgb, var(--paper) 55%, transparent) 46%, transparent 72%); }
.hero-inner { position: relative; z-index: 1; padding-block: clamp(3rem, 9vw, 6.5rem); max-width: 40rem; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); margin: .8rem 0 .4rem; }
.hero h1 .q { font-style: italic; color: var(--accent-strong); }
.hero .lede { font-size: 1.2rem; color: var(--ink-soft); max-width: 34rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.6rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .7rem 1.2rem; border-radius: 999px; font-weight: 600; text-decoration: none; cursor: pointer; border: 1px solid transparent; font-size: .95rem; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); }

/* Ask / search field */
.ask { display: flex; gap: .5rem; }
.ask input { flex: 1; padding: .85rem 1.05rem; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); font-size: 1rem; box-shadow: var(--shadow); }
.ask input:focus-visible { border-color: var(--accent); outline-offset: 0; }
.ask .btn { border-radius: 999px; }

/* Section rhythm */
section.band { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: .3rem 0 0; }
.section-head .link { font-family: var(--font-mono); font-size: .82rem; text-decoration: none; }

/* Objectives — the platform's verbs */
.objectives { display: flex; flex-wrap: wrap; gap: .5rem; }
.objective { font-family: var(--font-mono); font-size: .8rem; letter-spacing: .04em; padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink-soft); }
.objective b { color: var(--accent); font-weight: 600; }

/* Pills (node type) — colored by family, labeled always */
.pill { display: inline-block; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding: .18rem .5rem; border-radius: 6px; border: 1px solid; background: var(--panel); }
.pill-sm { font-size: .6rem; padding: .12rem .4rem; }
.fam-idea { color: var(--fam-idea); border-color: color-mix(in srgb, var(--fam-idea) 45%, transparent); background: color-mix(in srgb, var(--fam-idea) 10%, var(--panel)); }
.fam-evidence { color: var(--fam-evidence); border-color: color-mix(in srgb, var(--fam-evidence) 45%, transparent); background: color-mix(in srgb, var(--fam-evidence) 10%, var(--panel)); }
.fam-framework { color: var(--fam-framework); border-color: color-mix(in srgb, var(--fam-framework) 45%, transparent); background: color-mix(in srgb, var(--fam-framework) 10%, var(--panel)); }
.fam-actor { color: var(--fam-actor); border-color: color-mix(in srgb, var(--fam-actor) 45%, transparent); background: color-mix(in srgb, var(--fam-actor) 10%, var(--panel)); }
.fam-enabler { color: var(--fam-enabler); border-color: color-mix(in srgb, var(--fam-enabler) 45%, transparent); background: color-mix(in srgb, var(--fam-enabler) 10%, var(--panel)); }
.fam-lesson { color: var(--fam-lesson); border-color: color-mix(in srgb, var(--fam-lesson) 45%, transparent); background: color-mix(in srgb, var(--fam-lesson) 10%, var(--panel)); }

/* Confidence signal — status encoding: 4 segments filled + icon/word, never color-alone */
.confidence { display: inline-flex; align-items: center; gap: .45rem; font-size: .72rem; letter-spacing: .05em; color: var(--ink-soft); }
.confidence .bars { display: inline-flex; gap: 2px; }
.confidence .bars i { width: 4px; height: 11px; border-radius: 1px; background: var(--line); display: inline-block; }
.confidence[data-level="established"] .bars i:nth-child(-n+4) { background: var(--fam-enabler); }
.confidence[data-level="emerging"] .bars i:nth-child(-n+3) { background: var(--amber); }
.confidence[data-level="contested"] .bars i:nth-child(-n+2) { background: var(--rose); }
.confidence[data-level="uncertain"] .bars i:nth-child(-n+1) { background: var(--ink-faint); }

/* Node grid / cards */
.node-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.node-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); transition: transform .16s, border-color .16s, box-shadow .16s; }
.node-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); box-shadow: var(--shadow); }
.node-card a { display: grid; gap: .55rem; text-decoration: none; color: var(--ink); padding: 1.1rem 1.15rem; height: 100%; }
.node-card .row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.node-card-title { font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; line-height: 1.2; }
.node-card-summary { color: var(--ink-soft); font-size: .92rem; }
.node-card .foot { display: flex; align-items: center; gap: .6rem; color: var(--ink-faint); font-family: var(--font-mono); font-size: .7rem; }

/* Faceted browse */
.facets { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0 1.3rem; }
.facet-btn { font-size: .74rem; padding: .38rem .7rem; border: 1px solid var(--line); background: var(--panel); color: var(--ink-soft); border-radius: 999px; cursor: pointer; }
.facet-btn[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.facet-btn .n { opacity: .6; margin-left: .3rem; }
.browse-search { width: 100%; max-width: 30rem; padding: .7rem 1rem; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); margin-bottom: 1rem; }

/* Search results */
.results { display: grid; gap: .6rem; margin-top: 1rem; }
.result { display: block; text-decoration: none; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .85rem 1rem; }
.result:hover { border-color: var(--accent); }
.result .top { display: flex; align-items: center; gap: .6rem; margin-bottom: .2rem; }
.result .score { margin-left: auto; font-family: var(--font-mono); font-size: .7rem; color: var(--ink-faint); }
.result .snip { color: var(--ink-soft); font-size: .9rem; }

/* Graph explorer */
.graph-stage { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: radial-gradient(120% 120% at 50% 0%, color-mix(in srgb, var(--accent) 6%, var(--surface)), var(--surface)); overflow: hidden; }
.graph-stage svg { display: block; width: 100%; height: 100%; touch-action: none; }
.graph-legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin-top: .8rem; }
.graph-legend span { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--font-mono); font-size: .72rem; color: var(--ink-soft); }
.graph-legend span::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.g-node circle { cursor: pointer; transition: r .15s; }
.g-node text { font-family: var(--font-body); font-size: 11px; fill: var(--ink); paint-order: stroke; stroke: var(--paper); stroke-width: 3px; pointer-events: none; }
.g-edge { stroke: var(--line); stroke-width: 1.2; fill: none; }
.g-edge.dim, .g-node.dim { opacity: .12; }
.g-edge.hot { stroke: var(--accent); stroke-width: 2; }
.graph-tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .65rem; font-size: .82rem; box-shadow: var(--shadow); max-width: 16rem; opacity: 0; transition: opacity .12s; }
.graph-tip .t { font-family: var(--font-display); font-weight: 600; }
.graph-tip .k { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-faint); }

/* Node page */
.breadcrumb { font-family: var(--font-mono); font-size: .76rem; color: var(--ink-faint); margin-top: 1.2rem; }
.breadcrumb a { color: var(--ink-faint); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.node-head { padding: 1rem 0 1.4rem; border-bottom: 1px solid var(--line); }
.node-head .meta { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .6rem; }
.node-head h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); margin: 0 0 .5rem; }
.node-head .lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 46rem; margin: 0; }
.answers { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1.1rem; }
.answer-chip { font-family: var(--font-mono); font-size: .72rem; padding: .25rem .6rem; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--ink-soft); background: var(--panel); }
.answer-chip:hover { border-color: var(--accent); color: var(--ink); }
.answer-chip.missing { opacity: .45; }
.answer-chip .dot { color: var(--fam-enabler); }

.node-layout { display: grid; grid-template-columns: 1fr; gap: 2.2rem; margin-top: 1.6rem; }
@media (min-width: 62rem) { .node-layout { grid-template-columns: minmax(0,1fr) 21rem; align-items: start; } }
.node-content h2 { font-size: 1.4rem; margin: 2rem 0 .5rem; scroll-margin-top: 5rem; }
.node-content h2::before { content: ""; display: block; width: 2.2rem; height: 3px; border-radius: 3px; background: var(--accent); margin-bottom: .5rem; }
.node-content p { max-width: 42rem; }
.sources { margin-top: 2rem; }
.source-card { display: flex; gap: .7rem; align-items: baseline; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); margin-bottom: .5rem; text-decoration: none; color: var(--ink); }
.source-card:hover { border-color: var(--accent); }
.source-card .idx { font-family: var(--font-mono); color: var(--accent); font-size: .8rem; }

.rail { display: grid; gap: 1rem; }
@media (min-width: 62rem) { .rail { position: sticky; top: 5rem; } }
.rail-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.rail-card h2 { font-size: 1rem; margin: 0 0 .7rem; font-family: var(--font-body); font-weight: 700; letter-spacing: 0; }
.rail-card .mini-graph { width: 100%; height: 200px; border-radius: var(--radius-sm); border: 1px solid var(--line-soft); background: var(--surface); margin-bottom: .3rem; }

/* Edge list */
.edge-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.edge-rel { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); display: flex; align-items: center; gap: .35rem; }
.edge-target { display: inline-flex; gap: .45rem; align-items: baseline; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem; }
.edge-target:hover { color: var(--accent); }

/* Navigator */
.navigator .muted { font-size: .85rem; }
.navigator-answer { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 1rem 1.15rem; margin-top: 1rem; }
.nav-answer-main { display: grid; gap: .45rem; }
.nav-answer-main .head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.nav-mode { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-faint); }
.nav-block { margin-top: .85rem; border-top: 1px dashed var(--line); padding-top: .65rem; }
.nav-block h3 { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); margin: 0 0 .35rem; }
.nav-cites { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.nav-cites a { text-decoration: none; }
.nav-cites a::before { content: "▸ "; color: var(--accent); }
.nav-disclaimer { font-size: .78rem; margin-top: .85rem; }
.nav-error { color: var(--rose); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; background: var(--surface); }
.site-footer .wrap { padding-block: 2rem; display: grid; gap: .4rem; }
.site-footer .credo { font-family: var(--font-display); font-size: 1.15rem; max-width: 44rem; }

.stat-row { display: flex; flex-wrap: wrap; gap: 1.6rem; margin-top: 1rem; }
.stat { display: grid; }
.stat .metric-v { font-family: var(--font-display); font-size: 2rem; line-height: 1; }
.stat .metric-k { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); margin-top: .3rem; }
