/* Goal Atlas — shared tokens and components.
   Base token set matches the obot report family (executive overview, 2026-07-21).
   Goal hues are the validated categorical slots 1-4, used only in the fixed
   order charts -> app -> autonomy -> keynote so that every on-screen pair is an
   adjacent pair (validated: worst adjacent CVD dE 9.1 light / 8.4 dark).
   Light-mode aqua and yellow sit below 3:1 on the surface, so the relief rule
   applies: every goal-colored mark carries a visible label or letter glyph. */

:root {
  --ground: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #eef2f3;
  --ink: #16232d;
  --muted: #536470;
  --faint: #7f929e;
  --border: #dde4e7;
  --hairline: #e8edef;
  --accent: #0e7c86;
  --accent-deep: #0a5b63;
  --accent-tint: #e2f1f2;

  --g-charts: #2a78d6;
  --g-app: #eb6834;
  --g-autonomy: #1baf7a;
  --g-keynote: #eda100;
  --g-orphan: #8b9aa4;
  --g-charts-tint: #e6effb;
  --g-app-tint: #fdece5;
  --g-autonomy-tint: #e4f6ef;
  --g-keynote-tint: #fbf1dc;
  --g-orphan-tint: #eaeef0;

  --f-display: "SF Pro Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --f-serif: "Iowan Old Style", "Palatino Linotype", "Charter", Georgia, Cambria, "Times New Roman", serif;
  --f-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(20, 40, 55, .05), 0 8px 24px -12px rgba(20, 40, 55, .14);
  --shadow-soft: 0 1px 2px rgba(20, 40, 55, .04);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0d141a; --surface: #141e26; --surface-2: #1a2831;
    --ink: #e7eef2; --muted: #9aabb6; --faint: #6f828e;
    --border: #263640; --hairline: #1f2d36;
    --accent: #3cc3d0; --accent-deep: #7fd8e0; --accent-tint: #0f2e33;
    --g-charts: #3987e5; --g-app: #d95926; --g-autonomy: #199e70; --g-keynote: #c98500;
    --g-orphan: #75858f;
    --g-charts-tint: #16273a; --g-app-tint: #33190f; --g-autonomy-tint: #0e2a20;
    --g-keynote-tint: #2e2109; --g-orphan-tint: #1c262c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, .25);
  }
}

:root[data-theme="dark"] {
  --ground: #0d141a; --surface: #141e26; --surface-2: #1a2831;
  --ink: #e7eef2; --muted: #9aabb6; --faint: #6f828e;
  --border: #263640; --hairline: #1f2d36;
  --accent: #3cc3d0; --accent-deep: #7fd8e0; --accent-tint: #0f2e33;
  --g-charts: #3987e5; --g-app: #d95926; --g-autonomy: #199e70; --g-keynote: #c98500;
  --g-orphan: #75858f;
  --g-charts-tint: #16273a; --g-app-tint: #33190f; --g-autonomy-tint: #0e2a20;
  --g-keynote-tint: #2e2109; --g-orphan-tint: #1c262c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, .25);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-display);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl { margin: 0; }
ul, ol { padding: 0; }

a { color: var(--accent-deep); text-decoration: none; border-bottom: 1px solid transparent; }
a:hover { border-bottom-color: currentColor; }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px;
}

code, .mono { font-family: var(--f-mono); font-size: .85em; }

/* mono = a real GitHub item you can click */
a.ref {
  font-family: var(--f-mono); font-size: .82em; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: 4px; padding: .08em .38em; color: var(--ink);
}
a.ref:hover { background: var(--accent-tint); border-color: var(--accent); border-bottom-color: var(--accent); }

.wrap { max-width: 62rem; margin: 0 auto; padding: 0 1.25rem 5rem; }
.wrap.wide { max-width: 76rem; }

/* ---------- masthead ---------- */
header.masthead { padding: 3rem 0 1.5rem; border-bottom: 1px solid var(--border); }
.kicker { font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-deep); font-weight: 650; }
h1 { font-size: clamp(1.9rem, 4.4vw, 2.9rem); line-height: 1.1; margin: .5rem 0 .7rem; font-weight: 700; letter-spacing: -.025em; }
.standfirst { font-family: var(--f-serif); font-size: 1.15rem; color: var(--muted); max-width: 46rem; }
.byline { margin-top: 1rem; font-size: .85rem; color: var(--faint); }
.byline a { color: var(--faint); }

nav.parts { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1.4rem 0 0; }
nav.parts a {
  font-size: .82rem; padding: .35rem .7rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
nav.parts a:hover { border-color: var(--accent); color: var(--accent-deep); }
nav.parts a[aria-current="page"] { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-deep); font-weight: 600; }

h2 { font-size: 1.4rem; margin: 3rem 0 .3rem; letter-spacing: -.012em; scroll-margin-top: 1rem; }
h3 { font-size: 1.03rem; margin: 1.7rem 0 .45rem; }
h4 { font-size: .92rem; margin: 1.2rem 0 .3rem; color: var(--muted); }
.lede { color: var(--muted); margin-bottom: 1.1rem; max-width: 46rem; }
p + p { margin-top: .75rem; }
section > p, section > ul { max-width: 46rem; }
section > ul, .bullets { margin: .6rem 0 0 1.1rem; }
section > ul li, .bullets li { margin: .25rem 0; }

.tldr {
  margin: 2rem 0 0; background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--accent); border-radius: 10px; padding: 1.15rem 1.4rem; box-shadow: var(--shadow-soft);
}
.tldr h2 { margin: 0 0 .45rem; font-size: .95rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-deep); }
.tldr p { max-width: none; }

.note {
  margin: 1.2rem 0 0; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: .8rem 1rem; font-size: .9rem; color: var(--muted);
}

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; margin: 1.6rem 0 0; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .85rem 1rem; box-shadow: var(--shadow-soft); }
.kpi .n { font-size: 1.9rem; font-weight: 700; letter-spacing: -.025em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: .78rem; color: var(--muted); margin-top: .2rem; line-height: 1.35; }

/* ---------- the ridge ---------- */
.ridge { margin: 1.75rem 0 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.15rem 1.25rem 1rem; box-shadow: var(--shadow-soft); }
.ridge-groups { display: flex; flex-wrap: wrap; gap: 1.15rem; align-items: flex-start; }
.ridge-group { min-width: 0; }
.ridge-label { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 650; color: var(--muted); display: flex; align-items: center; gap: .35rem; margin-bottom: .4rem; }
.ridge-label .glyph { width: 1.05rem; height: 1.05rem; border-radius: 3px; display: grid; place-items: center; font-family: var(--f-mono); font-size: .62rem; font-weight: 700; color: #fff; }
.ridge-label .count { color: var(--faint); font-weight: 500; letter-spacing: 0; text-transform: none; }
.ridge-cells { display: flex; flex-wrap: wrap; gap: 2px; max-width: 100%; }
.cell {
  width: 15px; height: 15px; border-radius: 3px; display: block; padding: 0; border: 0;
  cursor: pointer; position: relative;
}
.cell:hover { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--ink); z-index: 2; }
.cell.offboard::after {
  content: ""; position: absolute; inset: 4px; border-radius: 50%;
  border: 1.5px solid var(--surface); opacity: .95;
}
.ridge-foot { margin-top: .9rem; padding-top: .8rem; border-top: 1px solid var(--hairline); font-size: .84rem; color: var(--muted); }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .78rem; color: var(--muted); margin-top: .8rem; }
.legend .item { display: flex; align-items: center; gap: .35rem; }
.legend .swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend .swatch.ring { position: relative; background: var(--g-orphan); }
.legend .swatch.ring::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; border: 1.5px solid var(--surface); }
.legend .swatch.closed { background: var(--g-orphan); opacity: .35; }

/* ---------- strata (icicle) ---------- */
.strata-scroll { overflow-x: auto; margin-top: 1.2rem; }
.strata { display: flex; gap: 6px; min-width: 46rem; align-items: stretch; }
.stratum { display: flex; flex-direction: column; gap: 2px; }
.stratum.col-goal { flex: 0 0 11rem; }
.stratum.col-req { flex: 0 0 19rem; }
.stratum.col-task { flex: 1 1 20rem; min-width: 14rem; }
.strata-head { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 650; padding-bottom: .35rem; }
.band {
  border-radius: 5px; padding: .1rem .45rem; overflow: hidden; position: relative;
  font-size: .76rem; line-height: 1.25; color: var(--ink); text-align: left;
  border: 1px solid transparent;
  display: flex; flex-direction: row; align-items: center; gap: .45rem;
}
.band:hover { border-color: var(--ink); }
.band .bt { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.band .bn { flex: none; font-family: var(--f-mono); font-size: .68rem; opacity: .78; }
.band.tall { flex-direction: column; align-items: stretch; justify-content: center; gap: .1rem; padding: .25rem .5rem; }
.band.tall .bt { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.band.goalband { color: #fff; font-weight: 650; padding: .1rem .55rem; }
.band.goalband.tall { padding: .4rem .6rem; }
.band.goalband .bn { color: rgba(255, 255, 255, .85); font-weight: 500; }
.band.closed { opacity: .45; }
.band.spacer { background: transparent; border: 0; pointer-events: none; }

/* ---------- outline tree ---------- */
.controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 1.2rem 0 .6rem; }
.controls label { font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: .3rem; }
.controls select, .controls input[type="search"] {
  font: inherit; font-size: .82rem; padding: .3rem .5rem; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
}
.controls button {
  font: inherit; font-size: .8rem; padding: .32rem .7rem; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer;
}
.controls button:hover { border-color: var(--accent); color: var(--accent-deep); }
.result-count { font-size: .8rem; color: var(--faint); margin-left: auto; font-variant-numeric: tabular-nums; }

.tree { margin-top: .5rem; }
.tree ul { list-style: none; margin: 0; padding: 0 0 0 1.15rem; border-left: 1px solid var(--hairline); }
.tree > ul { padding-left: 0; border-left: 0; }
.tree li { margin: 0; }
.row {
  display: flex; align-items: baseline; gap: .45rem; padding: .22rem .35rem;
  border-radius: 6px; position: relative;
}
.row:hover { background: var(--surface-2); }
.row.hit { background: var(--accent-tint); }
.twisty {
  flex: none; width: 1.1rem; height: 1.1rem; border: 0; background: none; cursor: pointer;
  color: var(--faint); font-size: .7rem; line-height: 1; padding: 0; align-self: center;
}
.twisty.leaf { cursor: default; opacity: .35; }
.gbar { flex: none; width: 3px; align-self: stretch; border-radius: 2px; }
.row .title { flex: 1 1 auto; min-width: 0; font-size: .9rem; }
.row.goalrow .title { font-weight: 650; font-size: .98rem; }
.row.reqrow .title { font-weight: 550; }
.dot { flex: none; width: .52rem; height: .52rem; border-radius: 50%; background: var(--g-orphan); align-self: center; }
.dot.open { background: var(--accent); }
.dot.closed { background: transparent; border: 1.5px solid var(--faint); }

.chip {
  flex: none; font-size: .68rem; padding: .07em .4em; border-radius: 4px; letter-spacing: .01em;
  border: 1px solid var(--border); color: var(--muted); background: var(--surface); white-space: nowrap;
}
.chip.repo { font-family: var(--f-mono); font-size: .66rem; }
.chip.stage-dev { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-tint); }
.chip.stage-review { border-color: var(--accent); color: var(--accent-deep); }
.chip.stage-released { opacity: .7; }
.chip.stage-none { border-style: dashed; color: var(--faint); }
.chip.goalchip { color: #fff; border: 0; font-weight: 600; }

/* ---------- orphan gallery ---------- */
.clusters { display: grid; gap: 1rem; margin-top: 1.4rem; }
@media (min-width: 62rem) { .clusters { grid-template-columns: 1fr 1fr; } }
.cluster { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.05rem 1.15rem; box-shadow: var(--shadow-soft); }
.cluster h3 { margin: 0 0 .2rem; font-size: 1rem; display: flex; align-items: baseline; gap: .5rem; }
.cluster h3 .tag { font-family: var(--f-mono); font-size: .7rem; color: var(--faint); }
.cluster .home { font-size: .78rem; color: var(--muted); margin-bottom: .7rem; }
.cluster .home b { color: var(--ink); font-weight: 600; }
.olist { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.olist li { display: flex; align-items: baseline; gap: .4rem; font-size: .84rem; line-height: 1.35; }
.olist .t { flex: 1 1 auto; min-width: 0; }

/* ---------- matrix ---------- */
.matrix-scroll { overflow-x: auto; margin-top: 1.1rem; }
table.matrix { border-collapse: collapse; font-size: .84rem; min-width: 34rem; }
table.matrix th, table.matrix td { padding: .4rem .6rem; text-align: right; border-bottom: 1px solid var(--hairline); font-variant-numeric: tabular-nums; }
table.matrix th:first-child, table.matrix td:first-child { text-align: left; font-weight: 600; }
table.matrix thead th { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 650; }
table.matrix td.zero { color: var(--faint); opacity: .5; }
table.matrix tr.total td, table.matrix tr.total th { border-top: 1px solid var(--border); border-bottom: 0; font-weight: 650; }

/* ---------- proposal cards ---------- */
.props { display: grid; gap: .7rem; margin-top: 1rem; }
.prop { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .85rem 1rem; box-shadow: var(--shadow-soft); border-left: 3px solid var(--g-orphan); }
.prop h4 { margin: 0 0 .25rem; font-size: .95rem; color: var(--ink); display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.prop h4 .id { font-family: var(--f-mono); font-size: .72rem; color: var(--faint); }
.prop p { font-size: .88rem; margin: .3rem 0 0; max-width: none; }
.prop .why { color: var(--muted); }
.prop .meta { margin-top: .5rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.size { font-size: .68rem; font-family: var(--f-mono); padding: .07em .45em; border-radius: 4px; border: 1px solid var(--border); color: var(--muted); }

.prop.charts { border-left-color: var(--g-charts); }
.prop.app { border-left-color: var(--g-app); }
.prop.autonomy { border-left-color: var(--g-autonomy); }
.prop.keynote { border-left-color: var(--g-keynote); }

/* ---------- tooltip ---------- */
#tip {
  position: fixed; z-index: 50; pointer-events: none; opacity: 0; transition: opacity .1s;
  max-width: 22rem; background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow); padding: .55rem .7rem; font-size: .82rem; line-height: 1.4;
}
#tip.on { opacity: 1; }
#tip .tt { font-weight: 600; display: block; margin-bottom: .2rem; }
#tip .tm { color: var(--muted); font-size: .76rem; font-family: var(--f-mono); }

footer.foot { margin-top: 4rem; padding-top: 1.2rem; border-top: 1px solid var(--border); font-size: .82rem; color: var(--faint); }
footer.foot a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
