/* Gambut Intelijen map. Palette from the subject: black-brown peat, moss, blackwater, the amber of a peat fire. */
:root {
  color-scheme: dark;
  --canvas: #0e0b08; --surface: #17120d; --surface-2: #211a12; --surface-3: #2c2318;
  --ink: #efe6d6; --ink-soft: #b5a68f; --ink-faint: #85775f; --line: rgb(239 230 214 / .11); --line-2: rgb(239 230 214 / .2);
  --moss: #a8c64c; --moss-ink: #10140a; --water: #57c4d8; --fire: #ff8a3d; --danger: #ef5b4c; --ok: #7ccf9a;
  --d0: #ecdf92; --d1: #dcb65b; --d2: #c98a3a; --d3: #a65a2a; --d4: #7a2e1d;
  --font-display: 'Fraunces', Georgia, serif; --font-text: 'Inter Tight', system-ui, -apple-system, 'Segoe UI', sans-serif; --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --r: 14px; --shadow: 0 18px 50px -18px rgb(0 0 0 / .7), 0 2px 8px -2px rgb(0 0 0 / .5);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --bar-h: 58px; --panel-w: 392px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--canvas); color: var(--ink); font: 15px/1.5 var(--font-text); -webkit-font-smoothing: antialiased; overflow: hidden; }
::selection { background: var(--moss); color: var(--moss-ink); }
a { color: var(--water); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }
.n, .num { font-variant-numeric: tabular-nums; }

/* ---------- boot: a peat core drawn up layer by layer ---------- */
#boot { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 22px;
  background: radial-gradient(80% 60% at 50% 40%, #1f170f 0%, var(--canvas) 70%); transition: opacity .6s var(--ease), visibility .6s; }
#boot.done { opacity: 0; visibility: hidden; }
.core { display: flex; gap: 12px; align-items: stretch; height: 220px; }
.core-tube { position: relative; width: 46px; border-radius: 10px; overflow: hidden; background: #120d08; box-shadow: inset 0 0 0 1px var(--line-2), 0 0 40px -10px rgb(168 198 76 / .25); }
.core-tube .l { position: absolute; left: 0; right: 0; height: 20%; transform: scaleY(0); transform-origin: top; animation: layer .5s var(--ease) forwards; }
.l1 { top: 0; background: linear-gradient(#5e7a2a, #3d4f1b); animation-delay: .1s !important; }
.l2 { top: 20%; background: linear-gradient(#6b4a26, #57391c); animation-delay: .35s !important; }
.l3 { top: 40%; background: linear-gradient(#4e3118, #3e2512); animation-delay: .6s !important; }
.l4 { top: 60%; background: linear-gradient(#36200f, #2a180b); animation-delay: .85s !important; }
.l5 { top: 80%; background: linear-gradient(#5d5a52, #44423d); animation-delay: 1.1s !important; }
.core-tube .water { position: absolute; left: -2px; right: -2px; height: 2px; top: 18%; background: var(--water); box-shadow: 0 0 12px var(--water); animation: water 2.4s ease-in-out 1.3s infinite alternate; opacity: 0; }
@keyframes layer { to { transform: scaleY(1); } }
@keyframes water { 0% { opacity: .9; top: 8%; } 100% { opacity: .9; top: 34%; } }
.core-scale { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; justify-content: space-between; font: 11px var(--font-mono); color: var(--ink-faint); }
.boot-word { font: 800 30px/1 var(--font-display); letter-spacing: -.01em; color: var(--ink-soft); }
.boot-word b { color: var(--ink); }
.boot-step { font: 12px var(--font-mono); color: var(--ink-faint); min-height: 1.4em; letter-spacing: .02em; }

/* ---------- map ---------- */
#map { position: fixed; inset: 0; }
.maplibregl-ctrl-bottom-right { bottom: 8px; }
.maplibregl-ctrl-attrib { background: rgb(14 11 8 / .7) !important; color: var(--ink-faint); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--ink-soft); }
.maplibregl-ctrl-group { background: var(--surface) !important; box-shadow: var(--shadow) !important; border: 1px solid var(--line); }
.maplibregl-ctrl-group button + button { border-top-color: var(--line) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(.9) sepia(.2); }

/* ---------- top bar ---------- */
.bar { position: fixed; top: 0; left: 0; right: 0; height: var(--bar-h); z-index: 20; display: flex; align-items: center; gap: 14px; padding: 0 14px;
  background: linear-gradient(rgb(14 11 8 / .92), rgb(14 11 8 / .75)); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font: 600 18px/1 var(--font-display); white-space: nowrap; }
.brand b { font-weight: 800; }
.search { position: relative; flex: 1; max-width: 440px; }
.search input { width: 100%; height: 38px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); padding: 0 12px; font: inherit; }
.search input::placeholder { color: var(--ink-faint); }
#hits { position: absolute; top: 44px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); max-height: 60vh; overflow: auto; }
#hits li { padding: 9px 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
#hits li[aria-selected="true"], #hits li:hover { background: var(--surface-3); }
#hits small { color: var(--ink-faint); }
.links { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.links a { color: var(--ink-soft); text-decoration: none; font-weight: 500; font-size: 14px; }
.links a:hover { color: var(--ink); }
.lang { height: 30px; min-width: 38px; border-radius: 8px; border: 1px solid var(--line-2); background: transparent; cursor: pointer; font: 600 12px var(--font-mono); }

/* ---------- side panel (bottom sheet on phones) ---------- */
.panel { position: fixed; z-index: 15; top: calc(var(--bar-h) + 12px); left: 12px; bottom: 12px; width: var(--panel-w); display: flex; flex-direction: column;
  background: rgb(23 18 13 / .94); backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.panel-grip { display: none; }
.panel-body { overflow: auto; padding: 18px 18px 22px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
.panel h1 { font: 800 26px/1.12 var(--font-display); letter-spacing: -.015em; margin: 0 0 10px; text-wrap: balance; }
.panel h2 { font: 700 13px/1.3 var(--font-text); letter-spacing: .04em; color: var(--ink-faint); margin: 22px 0 8px; text-transform: none; }
.panel p { margin: 0 0 10px; color: var(--ink-soft); }
.panel p b { color: var(--ink); }
.panel ul { margin: 0; padding: 0; list-style: none; }
.ssr ul li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.ssr ul li a { color: var(--ink); text-decoration: none; }
.back { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--ink-faint); cursor: pointer; padding: 0; margin: 0 0 10px; font-size: 13px; }
.back:hover { color: var(--ink); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 4px; }
.kpi { background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; }
.kpi b { display: block; font: 800 clamp(18px, 1.6vw, 22px)/1.12 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--ink-faint); }
.kpi.fire b { color: var(--fire); }
.kpi.moss b { color: var(--moss); }

.rows { display: grid; gap: 1px; background: var(--line); border-radius: 11px; overflow: hidden; border: 1px solid var(--line); }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 12px; background: var(--surface); font-size: 14px; }
.row span { color: var(--ink-soft); }
.row b { color: var(--ink); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.row b small { color: var(--ink-faint); font-weight: 400; }

.tier { display: inline-flex; align-items: center; gap: 6px; font: 600 11px/1 var(--font-text); letter-spacing: .02em; padding: 4px 8px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.tier::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tier.resmi { color: #8fd0e0; border-color: rgb(87 196 216 / .35); background: rgb(87 196 216 / .08); }
.tier.engine { color: #c6dc7c; border-color: rgb(168 198 76 / .35); background: rgb(168 198 76 / .08); }
.tier.survei { color: #f2b37a; border-color: rgb(255 138 61 / .35); background: rgb(255 138 61 / .08); }
.sec { margin-top: 18px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.sec-h h2 { margin: 0 !important; }

.depthbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; margin: 8px 0 6px; background: var(--surface-3); }
.depthbar i { display: block; height: 100%; }
.dkey { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 13px; color: var(--ink-soft); }
.dkey span::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 7px; background: var(--c); vertical-align: 0; }
.dkey b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.yrbars { display: flex; align-items: flex-end; gap: 3px; height: 74px; margin: 10px 0 2px; }
.yrbars i { flex: 1; background: linear-gradient(var(--fire), #a63c1a); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.yrbars i.now { background: var(--moss); }
.yrlab { display: flex; justify-content: space-between; font: 10px var(--font-mono); color: var(--ink-faint); }

.chips { display: flex !important; flex-wrap: wrap; gap: 6px; }
.chips li a, .chips li button { display: inline-block; padding: 5px 9px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font: 500 12px var(--font-mono); cursor: pointer; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.list li:hover b { color: var(--moss); }
.list li b { font-weight: 600; }
.list li span { color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.note { font-size: 12.5px; color: var(--ink-faint) !important; }
.cta { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; background: var(--moss); color: var(--moss-ink); font-weight: 700; text-decoration: none; border: 0; cursor: pointer; }
.ghost { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: transparent; color: var(--ink); border: 1px solid var(--line-2); text-decoration: none; cursor: pointer; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; margin: 10px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }
.fire-item { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.fire-item b { color: var(--ink); font-weight: 600; }
.fire-item span { color: var(--ink-soft); }
.live { color: var(--fire); font-weight: 700; }

/* ---------- layers ---------- */
.layers { position: fixed; z-index: 14; top: calc(var(--bar-h) + 12px); right: 12px; width: 288px; }
.layers-toggle { display: none; }
.layers-list { background: rgb(23 18 13 / .94); backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 8px; max-height: calc(100vh - var(--bar-h) - 120px); overflow: auto; }
.lgroup { padding: 6px 6px 2px; font: 600 11px var(--font-text); color: var(--ink-faint); letter-spacing: .05em; text-transform: uppercase; }
.lyr { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 10px; cursor: pointer; user-select: none; }
.lyr:hover { background: var(--surface-2); }
.lyr input { appearance: none; width: 34px; height: 20px; border-radius: 999px; background: var(--surface-3); position: relative; cursor: pointer; margin: 0; transition: background .2s var(--ease); }
.lyr input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink-faint); transition: transform .2s var(--ease), background .2s; }
.lyr input:checked { background: rgb(168 198 76 / .35); }
.lyr input:checked::after { transform: translateX(14px); background: var(--moss); }
.lyr span { font-size: 13.5px; line-height: 1.25; }
.lyr .tier { font-size: 10px; padding: 3px 6px; }

/* ---------- legend, toast, cookie ---------- */
.legend { position: fixed; z-index: 13; right: 12px; bottom: 54px; max-width: 288px; display: grid; gap: 8px; }
.leg { background: rgb(23 18 13 / .92); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; font-size: 12px; color: var(--ink-soft); box-shadow: var(--shadow); }
.leg b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 6px; font-size: 12.5px; }
.ramp { display: flex; height: 8px; border-radius: 4px; overflow: hidden; }
.ramp i { flex: 1; }
.ramp-l { display: flex; justify-content: space-between; margin-top: 4px; font: 10.5px var(--font-mono); color: var(--ink-faint); }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--surface-3); color: var(--ink); border: 1px solid var(--line-2); padding: 10px 14px; border-radius: 11px; box-shadow: var(--shadow); font-size: 14px; max-width: min(92vw, 460px); }
.cookie { position: fixed; z-index: 31; left: 12px; bottom: 12px; max-width: 380px; display: flex; gap: 12px; align-items: center; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; color: var(--ink-soft); box-shadow: var(--shadow); }
.cookie button { border: 0; border-radius: 8px; background: var(--moss); color: var(--moss-ink); font-weight: 700; padding: 7px 12px; cursor: pointer; }
.noscript { position: fixed; inset: auto 12px 12px 12px; z-index: 60; background: var(--surface-2); padding: 12px; border-radius: 12px; }

/* popup on hover over a fire */
.maplibregl-popup-content { background: var(--surface-2) !important; color: var(--ink); border: 1px solid var(--line-2); border-radius: 10px !important; padding: 8px 10px !important; font-size: 13px; box-shadow: var(--shadow) !important; }
.maplibregl-popup-tip { border-top-color: var(--surface-2) !important; border-bottom-color: var(--surface-2) !important; }

@media (hover: hover) and (pointer: fine) {
  .cta:hover { filter: brightness(1.08); }
  .ghost:hover { background: var(--surface-2); }
}

/* ---------- phones: panel becomes a bottom sheet, layers a sheet behind a button ---------- */
@media (max-width: 760px) {
  :root { --bar-h: 54px; }
  .links a { display: none; }
  .brand span { display: none; }
  .bar { gap: 10px; padding: 0 10px; }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 42vh; border-radius: 18px 18px 0 0; border-bottom: 0; transition: height .3s var(--ease); }
  .panel.tall { height: calc(100vh - var(--bar-h) - 10px); height: calc(100dvh - var(--bar-h) - 10px); }
  .panel.low { height: 112px; }
  .panel-grip { display: block; height: 22px; flex: none; cursor: grab; touch-action: none; }
  .panel-grip::before { content: ''; display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 9px auto 0; }
  .panel-body { padding: 4px 16px 24px; }
  .panel h1 { font-size: 22px; }
  .layers { top: calc(var(--bar-h) + 10px); right: 10px; width: auto; }
  .layers-toggle { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: rgb(23 18 13 / .94); box-shadow: var(--shadow); cursor: pointer; font-weight: 600; font-size: 13px; }
  .layers-list { display: none; position: fixed; top: calc(var(--bar-h) + 56px); right: 10px; left: 10px; max-height: 60vh; }
  .layers.open .layers-list { display: block; }
  .legend { right: 10px; left: 10px; bottom: calc(42vh + 10px); max-width: none; grid-template-columns: 1fr; }
  body.sheet-tall .legend, body.sheet-low .legend { display: none; }
  .cookie { left: 10px; right: 10px; bottom: calc(42vh + 10px); max-width: none; }
  .maplibregl-ctrl-top-right { top: calc(var(--bar-h) + 56px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
