/* Indonesia Region API — site styles. No external fonts or frameworks. */
:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --surface-2: #f3f4f2;
  --text: #1b1f1d;
  --muted: #5b635f;
  --border: #dfe3e0;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #e6f2f0;
  --code-bg: #f5f6f4;
  --code-text: #1f2a26;
  --tok-key: #0f5f8a;
  --tok-str: #1f7a3a;
  --tok-num: #9a4d00;
  --tok-lit: #7a3fa0;
  --warn-bg: #fff7e6;
  --warn-border: #f0d9a6;
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111413;
    --surface: #171b19;
    --surface-2: #1e2320;
    --text: #e6ebe8;
    --muted: #9aa5a0;
    --border: #2c3330;
    --accent: #3fb8a9;
    --accent-strong: #6fd0c3;
    --accent-soft: #16302c;
    --code-bg: #151917;
    --code-text: #dfe7e3;
    --tok-key: #7cc4f0;
    --tok-str: #8fd19e;
    --tok-num: #f0b775;
    --tok-lit: #d0a4f0;
    --warn-bg: #2a2416;
    --warn-border: #5a4a22;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
code, pre, kbd { font-family: var(--mono); font-size: 0.9em; }
:not(pre) > code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.05em 0.35em;
  overflow-wrap: anywhere;
}
pre {
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.5;
  margin: 0 0 1.2em;
}
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
h2 { margin-top: 2.2em; font-size: 1.5rem; }
h3 { margin-top: 1.6em; font-size: 1.15rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
.table-wrap { overflow-x: auto; margin-bottom: 1.2em; }
/* Codes in tables never break mid-word; wide tables scroll inside .table-wrap. */
td > code { white-space: nowrap; overflow-wrap: normal; }
@media (max-width: 600px) { .table-wrap table:has(th:nth-child(4)) { min-width: 640px; } }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip-link:focus { left: 8px; }

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

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header .container { display: flex; align-items: center; gap: 8px 16px; min-height: 60px; flex-wrap: wrap; }
.brand { margin-right: auto; display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; }
.brand:hover { color: var(--text); }
.brand-mark { width: 26px; height: 26px; flex: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: 0.95rem; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); font-weight: 600; }
.lang { display: flex; gap: 2px; border: 1px solid var(--border); border-radius: 7px; padding: 2px; }
.lang a { color: var(--muted); text-decoration: none; padding: 2px 8px; border-radius: 5px; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em; }
.lang a:hover { color: var(--text); background: var(--surface-2); }
.lang a[aria-current="true"] { color: var(--text); background: var(--surface-2); }
@media (max-width: 640px) {
  .site-header .lang { order: 1; }
  .site-header .nav { order: 2; width: 100%; margin-left: -10px; }
}

/* Hero */
.hero { padding: 56px 0 32px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 12px; }
.hero .lead { font-size: 1.2rem; color: var(--muted); max-width: 46rem; margin: 0 0 24px; }
.eyebrow { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); letter-spacing: 0.04em; text-transform: uppercase; margin: 0 0 8px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); text-decoration: none; font-weight: 550; font-size: 0.95rem;
  cursor: pointer; font-family: inherit;
}
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-primary, .btn-primary:hover { color: #0b1512; } }
.btn-small { padding: 4px 10px; font-size: 0.85rem; font-weight: 500; }

.base-url { margin-top: 20px; font-family: var(--mono); font-size: 0.9rem; color: var(--muted); overflow-wrap: anywhere; }

/* Level ladder */
.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 8px 0 40px; padding: 0; list-style: none; }
.level {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.level + .level::before {
  content: ""; position: absolute; left: -12px; top: 50%; width: 12px; height: 1px; background: var(--border);
}
.level-name { font-weight: 650; margin: 0; }
.level-id { color: var(--muted); font-size: 0.9rem; margin: 0 0 10px; }
.level-count { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 0; line-height: 1.1; }
.level-code { font-family: var(--mono); font-size: 0.85rem; color: var(--accent); margin: 8px 0 0; }
.level-note { font-size: 0.82rem; color: var(--muted); margin: 4px 0 0; }
@media (max-width: 800px) {
  .levels { grid-template-columns: repeat(2, 1fr); }
  .level + .level::before { display: none; }
}
@media (max-width: 420px) {
  .level { padding: 12px; }
  .level-count { font-size: 1.45rem; }
  .nav a { padding: 6px 8px; }
}
@media (max-width: 340px) { .levels { grid-template-columns: 1fr; } }

/* Sections and cards */
.section { padding: 8px 0 32px; }
.section > h2:first-child { margin-top: 0.5em; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card h3, .card > h2:first-child { margin-top: 0; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.small { font-size: 0.88rem; }
.notice { background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: var(--radius); padding: 12px 14px; font-size: 0.95rem; }

/* Tabs (examples) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 0; flex-wrap: wrap; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; color: var(--muted); font: inherit; font-size: 0.92rem; cursor: pointer; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab-panel pre { border-top-left-radius: 0; border-top-right-radius: 0; border-top: 0; }
.tab-panel[hidden] { display: none; }

/* Endpoint list */
.endpoint { font-family: var(--mono); font-size: 0.88rem; overflow-wrap: anywhere; }
td.endpoint { min-width: 16rem; }
@media (max-width: 600px) { td.endpoint { min-width: 0; width: 55%; } th, td { padding: 8px 6px; } }
.endpoint-list { list-style: none; margin: 0 0 12px; padding: 0; }
.endpoint-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.endpoint-desc { display: block; color: var(--muted); font-size: 0.85rem; margin-left: 38px; }
.method { display: inline-block; font-family: var(--mono); font-size: 0.75rem; font-weight: 700; color: var(--accent); margin-right: 6px; }

/* Docs layout */
.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; padding-top: 32px; padding-bottom: 64px; }
.toc { position: sticky; top: 16px; align-self: start; font-size: 0.92rem; max-height: calc(100vh - 32px); overflow-y: auto; }
.toc ol { list-style: none; padding: 0; margin: 0; }
.toc a { display: block; padding: 4px 8px; color: var(--muted); text-decoration: none; border-radius: 5px; }
.toc a:hover { background: var(--surface-2); color: var(--text); }
.docs-body h1 { margin-top: 0; }
.docs-body h2 { padding-top: 8px; border-top: 1px solid var(--border); }
.docs-body h2, .docs-body h3 { scroll-margin-top: 16px; }
@media (max-width: 860px) {
  .docs { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .toc { position: static; max-height: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; background: var(--surface); }
  .toc ol { columns: 2; column-gap: 8px; }
}

/* Explorer */
.explorer { padding-top: 32px; padding-bottom: 64px; }
.explorer-grid { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 900px) { .explorer-grid { grid-template-columns: minmax(0, 1fr); } }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.field .hint { font-weight: 400; color: var(--muted); }
select, input[type="search"] {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.95rem;
}
select:disabled { opacity: 0.55; }
.request { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.request-url {
  flex: 1 1 280px; min-width: 0; font-family: var(--mono); font-size: 0.88rem;
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; overflow-wrap: anywhere;
}
.endpoint-picker { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.endpoint-picker button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.response-meta { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; min-height: 1.2em; }
.downloads { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.downloads .btn:disabled { opacity: 0.5; cursor: default; }
.download-status { margin: 6px 0 0; min-height: 1.2em; overflow-wrap: anywhere; }
.response { max-height: 560px; overflow: auto; font-size: 0.82rem; }
.tok-key { color: var(--tok-key); }
.tok-str { color: var(--tok-str); }
.tok-num { color: var(--tok-num); }
.tok-lit { color: var(--tok-lit); }
.summary { list-style: none; padding: 0; margin: 0 0 14px; font-size: 0.92rem; }
.summary li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.summary .k { color: var(--muted); }
.summary .v { font-family: var(--mono); text-align: right; overflow-wrap: anywhere; }
.search-status { margin: 6px 0 0; }
.search-status:empty { display: none; }
.search-results { list-style: none; padding: 0; margin: 6px 0 0; max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.search-results:empty { display: none; }
.search-results button { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--border); padding: 7px 10px; font: inherit; font-size: 0.9rem; color: var(--text); cursor: pointer; }
.search-results button:hover, .search-results button:focus-visible { background: var(--surface-2); }
.search-results .code { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); margin-right: 8px; }
.search-results .lvl { float: right; font-size: 0.75rem; color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0 40px; color: var(--muted); font-size: 0.9rem; background: var(--surface); }
.site-footer p { margin: 0.4em 0; max-width: 60rem; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Island map */
.map-page { padding-top: 32px; padding-bottom: 48px; }
.map-page .notice:empty { display: none; }
.map-grid { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 20px; align-items: start; }
.map-wrap { position: relative; min-width: 0; }
.map-canvas { height: min(78vh, 760px); min-height: 420px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.map-panel { max-height: min(78vh, 760px); overflow-y: auto; }
@media (max-width: 900px) {
  .map-grid { grid-template-columns: minmax(0, 1fr); }
  .map-wrap { order: -1; }
  .map-canvas { height: 60vh; min-height: 360px; }
  .map-panel { max-height: none; }
}
.legend { border: 0; padding: 0; margin: 0 0 14px; }
.legend legend { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; padding: 0; }
.legend label { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; margin: 3px 0; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; border: 1px solid var(--surface); }
.dot-bp { background: #d97706; }
.dot-tbp { background: #0f766e; }
.dot-unk { background: #8b95a1; }
.map-detail h3 { margin: 0 0 6px; font-size: 1.05rem; }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 10px; margin: 0 0 10px; font-size: 0.88rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.maplibregl-popup-content { font: 0.85rem/1.4 var(--sans); color: #1b1f1d; padding: 6px 10px; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; }
.mode-switch .btn { justify-content: center; padding: 8px 10px; font-size: 0.9rem; }
.mode-switch .btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 650; }
.map-chip {
  position: absolute; z-index: 2; top: 10px; left: 10px; right: 56px; margin: 0; width: fit-content; max-width: calc(100% - 66px);
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid #dc2626;
  border-radius: 6px; padding: 5px 10px; font-size: 0.85rem; box-shadow: 0 1px 4px rgba(0,0,0,0.15); overflow-wrap: anywhere;
}
.map-detail .actions { gap: 6px; margin-top: 4px; }

/* Explorer: whole-dataset file list */
.dataset-files-wrap { margin-top: 10px; }
.dataset-files-wrap summary { cursor: pointer; color: var(--muted); }
.dataset-files { list-style: none; margin: 8px 0 0; padding: 0; font-size: 0.88rem; }
.dataset-files li { padding: 2px 0; overflow-wrap: anywhere; }
.dataset-files .dataset-files-head { margin-top: 8px; font-weight: 600; color: var(--muted); font-size: 0.82rem; }
