/* TERRA · Nicoya engine. Forest scope: deep ground, sand ink, gold deed lines, teal data. Square corners. */
:root {
  --forest-deep: #161e19; --forest: #1f2a23; --sand: #e8e2d6; --sand-2: rgba(232,226,214,.78);
  --sand-3: rgba(232,226,214,.6); --line: rgba(232,226,214,.18); --line-2: rgba(232,226,214,.1);
  --gold: #c6a76a; --teal: #34b294; --water: #7fc8d8; --rust: #c98a6c;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--forest-deep); color: var(--sand); font: 400 14px/1.5 var(--sans); }
button, input { font: inherit; color: inherit; }
a { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mono { font-family: var(--mono); }
.dim { color: var(--sand-3); }
.small { font-size: 12px; }
.micro { font: 500 11px var(--mono); letter-spacing: .12em; color: var(--sand-3); text-transform: uppercase; }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; min-width: 0; }
.mark { font-weight: 500; letter-spacing: .22em; font-size: 15px; }
.lablink { display: inline-flex; align-items: center; min-height: 44px; color: var(--sand); text-decoration: none; }
.lablink span { margin-left: .5em; letter-spacing: .08em; font-weight: 400; color: var(--gold); }
.lablink:hover, .lablink:hover span { color: var(--gold); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.brand .mono { font-size: 11px; letter-spacing: .12em; }
.brand .exp { color: var(--gold); border: 1px solid rgba(198,167,106,.45); padding: 2px 7px; }
.ask { flex: 1 1 380px; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 1px solid rgba(232,226,214,.28); background: var(--forest); }
.ask:focus-within { border-color: var(--gold); }
.ask input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; font-size: 14px; }
.ask input::placeholder { color: var(--sand-3); }
kbd { font: 11px var(--mono); border: 1px solid rgba(232,226,214,.28); padding: 1px 6px; color: var(--sand-3); }
.btn { min-height: 40px; padding: 0 14px; border: 1px solid var(--sand); background: var(--sand); color: var(--forest-deep); font-weight: 500; font-size: 13px; cursor: pointer; }
.btn:hover { background: transparent; color: var(--sand); }
.btn.ghost { background: transparent; color: var(--sand); border-color: rgba(232,226,214,.35); }
.btn.ghost:hover { border-color: var(--sand); }
.btn.small { min-height: 44px; font: 500 11px var(--mono); letter-spacing: .08em; }
.btn.gold { background: transparent; color: var(--gold); border-color: rgba(198,167,106,.6); }

.body { display: flex; flex-wrap: wrap; gap: 14px; padding: 14px 20px 20px; align-items: flex-start; }
.lenses { flex: 0 1 250px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.lensList { display: flex; flex-direction: column; gap: 6px; }
.lens { text-align: left; width: 100%; min-height: 44px; padding: 10px 12px; background: transparent; border: 1px solid var(--line); cursor: pointer; }
.lens:hover { border-color: rgba(232,226,214,.5); }
.lens[aria-pressed="true"] { background: var(--forest); border-color: var(--gold); box-shadow: inset 2px 0 0 var(--gold); }
.lens b { display: block; font-weight: 500; font-size: 13.5px; }
.lens span { display: block; margin-top: 3px; font-size: 12px; line-height: 1.4; color: var(--sand-3); }
.lens[disabled] { opacity: .45; cursor: not-allowed; }
.legend { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--sand-2); }
.ramp { display: flex; height: 10px; }
.ramp i { flex: 1; }
.ramp-ends { display: flex; justify-content: space-between; color: var(--sand-3); }
.sw { display: inline-block; width: 12px; height: 12px; vertical-align: -2px; margin-right: 6px; }
.foot { margin-top: 8px; font-size: 10.5px; line-height: 1.6; }

.mapcol { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.mapwrap { position: relative; width: 100%; height: min(78vh, 860px); min-height: 420px; border: 1px solid rgba(232,226,214,.14); overflow: hidden; background: var(--forest-deep); cursor: crosshair; touch-action: none; }
#map { width: 100%; height: 100%; display: block; }
.mapHint { position: absolute; top: 10px; right: 12px; font-size: 10.5px; letter-spacing: .1em; color: var(--sand-3); pointer-events: none; }
.scale { position: absolute; left: 12px; bottom: 10px; display: flex; align-items: center; gap: 8px; font-size: 10.5px; color: var(--sand-3); pointer-events: none; }
.scalebar { display: inline-block; height: 6px; border: 1px solid var(--sand-3); border-top: 0; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; letter-spacing: .14em; color: var(--sand-3); background: var(--forest-deep); }
.loading[hidden] { display: none; }

.timebar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); background: var(--forest); }
.track { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.track input[type=range] { width: 100%; accent-color: var(--gold); }
.years { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--sand-3); }
.monthLabel { flex: 0 1 230px; display: flex; flex-direction: column; }
.monthLabel .mono { font-size: 13px; color: var(--gold); }

.panel { flex: 0 1 360px; min-width: 0; border: 1px solid var(--line); background: var(--forest); padding: 18px; display: flex; flex-direction: column; gap: 14px; max-height: calc(78vh + 70px); overflow-y: auto; }
.panel h1, .panel h2 { margin: 0; font-family: var(--serif); font-weight: 300; letter-spacing: -.018em; }
.panel h1 { font-size: 27px; line-height: 1.15; }
.panel h2 { font-size: 22px; line-height: 1.2; }
.panel p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--sand-2); }
.eyebrow { font: 500 11px var(--mono); letter-spacing: .12em; color: var(--gold); text-transform: uppercase; }
.figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.fig b { display: block; font: 300 25px/1.15 var(--serif); }
.fig span { font-size: 12px; color: var(--sand-3); }
.links { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.links button, .links a { display: flex; justify-content: space-between; align-items: center; min-height: 42px; background: transparent; border: 0; border-bottom: 1px solid var(--line-2); padding: 0; text-align: left; cursor: pointer; color: var(--sand); text-decoration: none; }
.links button:hover, .links a:hover { color: var(--gold); }
.links button::after, .links a::after { content: "→"; color: var(--gold); }
.rows { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.row span:last-child { text-align: right; color: var(--sand); }
.row span:first-child { color: var(--sand-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 9px; border: 1px solid rgba(232,226,214,.35); font-size: 12px; background: transparent; cursor: pointer; }
.chip.on { border-color: rgba(52,178,148,.7); color: var(--teal); }
.chip:hover { border-color: var(--sand); }
.results { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.results li button { width: 100%; display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: baseline; padding: 10px 0; background: transparent; border: 0; border-bottom: 1px solid var(--line-2); text-align: left; cursor: pointer; }
.results li button:hover, .results li button[aria-current="true"] { color: var(--gold); }
.results .n { font-family: var(--mono); color: var(--gold); }
.results .ha { font: 300 19px var(--serif); }
.results small { display: block; font-size: 12px; color: var(--sand-3); }
.note { font-size: 12px; line-height: 1.55; color: var(--sand-3); }
.strip { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.strip .lbl { display: flex; justify-content: space-between; font-size: 13px; }
.strip .lbl b { font: 300 18px var(--serif); }
.strip .bar { position: relative; height: 14px; background: rgba(232,226,214,.08); }
.strip .bar i { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--gold); }
.blockc { width: 100%; height: auto; display: block; background: var(--forest-deep); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.actions .btn { min-height: 38px; font-size: 12.5px; }
@media (max-width: 760px) {
  /* a phone: the map first, then the lenses as a row of buttons, then the panel, all full width */
  .bar { padding: 6px 12px 10px; gap: 6px 12px; }
  .ask { flex-basis: 100%; }
  .ask input { font-size: 16px; } /* 16 px stops the phone zooming the page when the field takes focus */
  .slashkey { display: none; }
  .navbtns { display: flex; flex-wrap: wrap; gap: 6px; }
  .navbtns .btn { min-height: 44px; }
  .body { padding: 10px 12px 16px; gap: 10px; }
  .mapcol { order: 1; flex: 1 1 100%; }
  .lenses { order: 2; flex: 1 1 100%; }
  .panel { order: 3; flex: 1 1 100%; max-height: none; padding: 16px 14px; }
  .mapwrap { height: 60vh; min-height: 340px; }
  .mapHint { display: none; }
  .lensList { flex-direction: row; flex-wrap: wrap; }
  .lens { width: auto; flex: 1 1 140px; padding: 8px 10px; }
  .lens span { display: none; }
  .lens[aria-pressed="true"] span { display: block; }
  .monthLabel { flex: 1 1 100%; }
  .row { grid-template-columns: minmax(0, 1fr) auto; }
  .row span:last-child { min-width: 0; overflow-wrap: anywhere; }
  .panel h1 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* feature slots: 3D view, hover readout, map tools */
.view3d { position: absolute; inset: 0; background: var(--forest-deep); }
.view3d[hidden], .tip[hidden] { display: none; }
.tip { position: absolute; pointer-events: none; z-index: 5; max-width: 260px; padding: 8px 10px; background: rgba(22,30,25,.94); border: 1px solid var(--line); font-size: 12px; line-height: 1.45; color: var(--sand); }
.mapTools { position: absolute; left: 12px; top: 10px; display: flex; gap: 6px; z-index: 4; }
