/* Layout: one calm instrument panel. Header with controls, a strip of six
   concentration tiles, then structure now (ring + tier table), the trend,
   the change matrix, movers and the holder table. Cards only where a chart
   or table needs its own surface. */

/* Colors: one green family taken from the Pepecoin logo (OKLCH hue 150), muted. Tier ramp and the
   single series were run through the dataviz palette validator in both themes. Up/down is green vs
   purple so it survives red-green colour blindness. Neutrals match the fact pages. */

:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --surface: #ffffff;
  --ink: #15201b;
  --ink-2: #3f4b44;
  --muted: #56645d;
  --grid: #e0e6e3;
  --line: #bfcac4;
  --ring: rgba(21, 32, 27, 0.10);
  --accent: #269B4D;
  --accent-ink: #ffffff;
  --accent-wash: rgba(35, 117, 61, 0.10);
  --s1: #269B4D;
  --t1: #16532A;
  --t2: #208241;
  --t3: #318c4c;
  --t4: #56a76a;
  --t5: #7fc08c;
  --rest: #d5d9d6;
  --up: 37, 131, 67;       /* concentration up   (diverging green)  */
  --down: 121, 85, 160;    /* concentration down (diverging purple) */
  --warn-bg: #F6BB60;
  --warn-ink: #0b0b0b;
  --font: "Ubuntu", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: "Ubuntu Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101512;
    --surface: #161d19;
    --ink: #e4ebe7;
    --ink-2: #b6c1ba;
    --muted: #9caaa3;
    --grid: #202924;
    --line: #2d3932;
    --ring: rgba(255, 255, 255, 0.10);
    --accent: #76c788;
    --accent-ink: #0b100d;
    --accent-wash: rgba(118, 199, 136, 0.14);
    --s1: #419f5b;
    --t1: #b7e5bf;
    --t2: #88ca95;
    --t3: #59ae6e;
    --t4: #398e51;
    --t5: #286e3c;
    --rest: #3a3e3b;
    --up: 105, 194, 126;
    --down: 187, 153, 227;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101512;
  --surface: #161d19;
  --ink: #e4ebe7;
  --ink-2: #b6c1ba;
  --muted: #9caaa3;
  --grid: #202924;
  --line: #2d3932;
  --ring: rgba(255, 255, 255, 0.10);
  --accent: #76c788;
  --accent-ink: #0b100d;
  --accent-wash: rgba(118, 199, 136, 0.14);
  --s1: #419f5b;
  --t1: #b7e5bf;
  --t2: #88ca95;
  --t3: #59ae6e;
  --t4: #398e51;
  --t5: #286e3c;
  --rest: #3a3e3b;
  --up: 105, 194, 126;
  --down: 187, 153, 227;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  padding-inline: 16px;
  padding-block: 20px 56px;
}

.wrap { max-width: 1120px; margin-inline: auto; display: grid; gap: 28px; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

button { font: inherit; color: inherit; }

h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-size: 1.5rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.125rem; line-height: 1.3; font-weight: 650; }
h3 { font-size: 0.9375rem; font-weight: 650; }

.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 0.9375rem; }
.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }
.eyebrow { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

/* ---------- header ---------- */
.top { display: grid; gap: 14px; }
.top-row { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-start; justify-content: space-between; }
.brand { display: grid; gap: 4px; min-width: 0; }
.brand p { margin: 0; color: var(--ink-2); max-width: 62ch; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); font-size: 0.8125rem; }
.meta b { color: var(--ink); font-weight: 600; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: var(--warn-bg); color: var(--warn-ink); }
.notice { background: var(--accent-wash); border-radius: 8px; padding: 10px 14px; color: var(--ink); font-size: 0.875rem; }
.notice[hidden] { display: none; }

/* ---------- controls ---------- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; font-size: 0.8125rem; font-weight: 550; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg button:hover:not([aria-pressed="true"]) { background: var(--accent-wash); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 11px; cursor: pointer; font-size: 0.8125rem; font-weight: 550; color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip:hover:not([aria-pressed="true"]) { background: var(--accent-wash); }

.iconbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 0.8125rem; font-weight: 550; color: var(--ink-2); }
.iconbtn:hover { background: var(--accent-wash); }

/* ---------- sections ---------- */
section { display: grid; gap: 12px; min-width: 0; }
.sec-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: end; justify-content: space-between; }
.sec-head p { margin: 2px 0 0; color: var(--ink-2); font-size: 0.875rem; max-width: 70ch; }

.panel { background: var(--surface); border-radius: 10px; box-shadow: 0 0 0 1px var(--ring); padding: 16px; min-width: 0; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border-radius: 10px; box-shadow: 0 0 0 1px var(--ring); padding: 12px 14px 10px; display: grid; gap: 2px; min-width: 0; align-content: start; }
.tile .val { font-size: 1.875rem; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile .val small { font-size: 1rem; font-weight: 600; color: var(--ink-2); margin-left: 1px; }
.tile .delta { font-size: 0.8125rem; font-weight: 600; font-variant-numeric: tabular-nums; min-height: 1.3em; color: var(--ink-2); }
.tile .delta .arrow { display: inline-block; width: 1em; }
.tile .spark { margin-top: 4px; height: 36px; position: relative; }
.tile .spark svg { display: block; width: 100%; height: 36px; overflow: visible; }
.tile .foot { font-size: 0.75rem; color: var(--muted); min-height: 1.2em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- structure now ---------- */
.split { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 24px; align-items: center; }
.ring { position: relative; justify-self: center; width: 100%; max-width: 300px; }
.ring svg { display: block; width: 100%; height: auto; }
.ring path { stroke: var(--surface); stroke-width: 2; transition: opacity 0.12s; }
.ring.hl path:not(.on) { opacity: 0.35; }

table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
tbody td { border-bottom: 1px solid var(--grid); }
tbody tr:last-child td { border-bottom: 0; }
.scroll { overflow-x: auto; max-width: 100%; }

.tiers tbody tr { cursor: default; }
.tiers tbody tr.on td { background: var(--accent-wash); }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }

/* ---------- trend ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; touch-action: pan-y; }
.axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.axis line, .grid line { stroke: var(--grid); stroke-width: 1; }
.axis .base { stroke: var(--line); }
.empty { padding: 36px 12px; text-align: center; color: var(--muted); font-size: 0.875rem; }

.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--surface); color: var(--ink); border-radius: 8px; box-shadow: 0 0 0 1px var(--ring), 0 6px 18px rgba(0, 0, 0, 0.18); padding: 8px 10px; font-size: 0.8125rem; line-height: 1.35; max-width: 260px; font-variant-numeric: tabular-nums; }
.tip[hidden] { display: none; }
.tip b { font-weight: 650; }
.tip .k { color: var(--ink-2); }

/* ---------- change matrix ---------- */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; font-weight: 600; }
.matrix td { border-bottom: 1px solid var(--surface); font-weight: 550; }
.matrix td.na { color: var(--muted); font-weight: 400; }
.legend-line { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.8125rem; color: var(--ink-2); }

/* ---------- movers ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 6px 24px; font-size: 0.875rem; color: var(--ink-2); }
.stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.movers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px; }
.movers .panel { display: grid; gap: 6px; align-content: start; }
.movers td, .movers th { padding: 5px 8px; }
.movers td:first-child, .movers th:first-child { padding-left: 0; }
.movers td:last-child, .movers th:last-child { padding-right: 0; }
.tag { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; font-size: 0.6875rem; font-weight: 600; background: var(--accent-wash); color: var(--ink-2); vertical-align: 1px; }

/* ---------- holder table ---------- */
.tools-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
input[type="search"] { font: inherit; padding: 7px 10px; min-width: 0; width: min(100%, 320px); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
input[type="search"]::placeholder { color: var(--muted); }
.pager { display: flex; align-items: center; gap: 10px; font-size: 0.8125rem; color: var(--ink-2); }
.pager button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 5px 12px; cursor: pointer; }
.pager button:disabled { opacity: 0.4; cursor: default; }
.holders td:nth-child(2) { text-align: left; }
.holders th:nth-child(2) { text-align: left; }

/* ---------- footer ---------- */
.notes { display: grid; gap: 8px; color: var(--ink-2); font-size: 0.875rem; max-width: 80ch; }
.notes ul { margin: 0; padding-left: 1.1em; display: grid; gap: 6px; }
footer { display: flex; flex-wrap: wrap; gap: 6px 20px; color: var(--muted); font-size: 0.8125rem; }

@media (max-width: 720px) {
  .split { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  h1 { font-size: 1.3rem; }
  .tile .val { font-size: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- reconstructed history (rebuilt from the blockchain, not a live snapshot) ---------- */
.matrix th.rc { text-decoration: underline dashed; text-underline-offset: 4px; }
.matrix td.rc { outline: 1px dashed var(--muted); outline-offset: -3px; }
.sw.rc-sw { background: transparent; outline: 1px dashed var(--muted); outline-offset: -1px; }
.delta.rc { text-decoration: underline dashed var(--muted); text-underline-offset: 3px; }
.rc-swatch { display: inline-block; width: 22px; height: 0; border-top: 2px dashed var(--s1); margin-right: 8px; vertical-align: middle; }
.rc-text { font-style: italic; color: var(--muted); }
