/* Tropics Scorecard. White ground with a faint blue glow, rounded cards, near-black text.
   One light look by choice. Blue is the only accent; other colour is for data. */
:root {
  --ink: #0a0a0a; --ink-2: #5e5e5e; --ink-3: #8f8f8f; --rule: #d9d9d9; --rule-2: #f1f1f1; --paper: #ffffff; --card: #ffffff;
  --land: #f1f1f1; --coast: #cfcfcf; --none: #f1f1f1; --accent: #0a78d6; --glow: rgba(0,120,215,.10); --glow-2: rgba(0,120,215,.03);
  /* Categorical slots, fixed order, assigned per entity in app.js. */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #b07a00; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  /* Sequential ramp, low to high. */
  --r1: #cde2fb; --r2: #9ec5f4; --r3: #6da7ec; --r4: #3987e5; --r5: #256abf; --r6: #184f95; --r7: #0d366b;
  --shadow: rgba(0, 0, 0, 0.08);
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #ffffff; --ink-2: #a3a3a3; --ink-3: #6e6e6e; --rule: #2c2c2c; --rule-2: #1c1c1c; --paper: #030303; --card: #101010;
  --land: #161616; --coast: #333333; --none: #1a1a1a; --accent: #1e9bff; --glow: rgba(0,105,190,.24); --glow-2: rgba(0,80,150,.07);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --r1: #0d366b; --r2: #184f95; --r3: #256abf; --r4: #3987e5; --r5: #6da7ec; --r6: #9ec5f4; --r7: #cde2fb;
  --shadow: rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}
.theme-toggle { margin-left: auto; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper) radial-gradient(ellipse 90% 640px at 50% 0, var(--glow), var(--glow-2) 45%, transparent 100%) no-repeat;
  color: var(--ink);
  font: 16px/1.5 var(--sans);
}
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

header.site { border-bottom: 1px solid var(--rule); }
header.site .wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 32px; padding-top: 20px; padding-bottom: 14px; }
.brand { font-weight: 600; font-size: 18px; letter-spacing: -0.01em; text-decoration: none; }
nav.site { display: flex; flex-wrap: wrap; gap: 4px 20px; }
nav.site a { text-decoration: none; font-size: 14px; color: var(--ink-2); padding: 2px 0; border-bottom: 2px solid transparent; }
nav.site a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

main { padding: 28px 0 56px; }
h1 { font-size: clamp(26px, 4vw, 36px); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 8px; font-weight: 600; }
h2 { font-size: 20px; letter-spacing: -0.01em; margin: 40px 0 6px; font-weight: 600; }
h3 { font-size: 16px; margin: 0 0 4px; font-weight: 600; }
p { margin: 0 0 12px; max-width: 68ch; }
.lede { font-size: 18px; color: var(--ink-2); max-width: 62ch; }
.note { color: var(--ink-2); font-size: 14px; }

.label, th, .tick, .legend, .chip, .kv dt {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 500;
}
.num, td.num, .kv dd { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }

.card { border: 1px solid var(--rule); border-radius: 14px; padding: 16px; background: var(--card); min-width: 0; }
.card > .label { display: block; margin-bottom: 6px; }

.limits { border-left: 3px solid var(--accent); padding: 4px 0 4px 16px; margin: 32px 0 0; }
.limits ul { margin: 6px 0 0; padding-left: 18px; }
.limits li { margin: 4px 0; max-width: 72ch; }


.controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: end; margin: 16px 0 8px; }
.controls label { display: grid; gap: 4px; }
select, button {
  font: 14px var(--sans); color: var(--ink); background-color: var(--card);
  border: 1px solid var(--rule); border-radius: 10px; padding: 6px 28px 6px 10px; min-height: 34px;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
button { padding: 6px 12px; cursor: pointer; }
button[aria-pressed="true"] { border-color: var(--ink); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--rule); stroke-width: 1; }
.chart .axis-line { stroke: var(--ink-3); stroke-width: 1; }
.chart text { font-family: var(--mono); font-size: 11px; fill: var(--ink-2); }
.chart text.series-label { font-family: var(--sans); font-size: 12px; fill: var(--ink); font-weight: 500; }
.chart .hair { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; pointer-events: none; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 8px; text-transform: none; letter-spacing: 0; font-family: var(--sans); font-size: 13px; color: var(--ink); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { width: 22px; height: 10px; flex: none; }

.tip {
  position: absolute; pointer-events: none; z-index: 5; background: var(--card); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 10px; padding: 8px 10px; font-size: 13px; line-height: 1.35;
  box-shadow: 0 6px 20px var(--shadow); min-width: 140px; max-width: 280px;
}
.tip .t-head { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 4px; }
.tip .t-row { display: grid; grid-template-columns: 14px auto 1fr; gap: 6px; align-items: center; }
.tip .t-row b { font-family: var(--mono); font-weight: 600; }
.tip .t-row span { color: var(--ink-2); }

table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 500; }
td.num, th.num { text-align: right; padding-right: 0; padding-left: 10px; }
.table-scroll { overflow-x: auto; }
details summary { cursor: pointer; font-size: 14px; color: var(--ink-2); margin-top: 8px; }

.empty { border: 1px dashed var(--coast); border-radius: 14px; padding: 28px 18px; color: var(--ink-2); font-size: 14px; text-align: center; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.kv dd { margin: 0; font-size: 14px; }

footer.site { border-top: 1px solid var(--rule); color: var(--ink-2); font-size: 13px; }
footer.site .wrap { padding-top: 18px; padding-bottom: 28px; }
footer.site p { max-width: none; }

.cmp { display: grid; gap: 1px; min-width: 112px; }
.cmp .note { font-size: 12px; }
.cmp .verdict { font-size: 12px; color: var(--ink-2); }
