/* ===========================================================================
   drought.ownmap.id — Kekeringan Sawah Indonesia
   Palette follows the ownmap.id brand (DM Sans / Bricolage Grotesque),
   with a green -> amber -> red scale encoding the drought classes.
   =========================================================================== */

:root {
  --ink:        #1a1a2e;
  --ink-soft:   #3d3d5c;
  --muted:      #6b7280;
  --line:       #e5e7eb;
  --paper:      #fbfaf8;
  --card:       #ffffff;

  /* drought classes */
  --c-extreme:  #7f1d1d;
  --c-severe:   #dc2626;
  --c-moderate: #ea580c;
  --c-watch:    #ca8a04;
  --c-normal:   #16a34a;
  --c-wet:      #0f766e;

  --accent:     #0f766e;
  --font-body:  'DM Sans', system-ui, -apple-system, sans-serif;
  --font-head:  'Bricolage Grotesque', 'DM Sans', sans-serif;
  --font-mono:  'JetBrains Mono', ui-monospace, monospace;

  --shadow:     0 1px 2px rgba(26,26,46,.04), 0 8px 24px -12px rgba(26,26,46,.12);
  --radius:     14px;
  --maxw:       1180px;
}

* { box-sizing: border-box; }

/* ---------- bilingual prose ----------
   Long-form text lives in the HTML as paired .i-id / .i-en spans so the two
   versions can be edited side by side; exactly one is shown at a time. */
html[lang="id"] .i-en, html[lang="en"] .i-id { display: none; }
html[lang="en"] .i-en, html[lang="id"] .i-id { display: inline; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.2; letter-spacing: -.02em; }

a { color: var(--accent); }
a:hover { text-decoration: none; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------- header ---------- */
header.site {
  position: sticky; top: 0; z-index: 900;
  background: rgba(251,250,248,.88);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-inner { display: flex; align-items: center; gap: 18px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head);
         font-weight: 700; font-size: 1.02rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand .mark { width: 26px; height: 26px; flex: 0 0 26px; }
nav.main { margin-left: auto; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
nav.main a { color: var(--ink-soft); text-decoration: none; font-size: .875rem; padding: 7px 11px; border-radius: 8px; }
nav.main a:hover { background: rgba(26,26,46,.05); color: var(--ink); }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-left: 6px; }
.lang button { border: 0; background: transparent; font: inherit; font-size: .78rem; font-weight: 600;
               padding: 6px 12px; cursor: pointer; color: var(--muted); }
.lang button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line);
        background:
          radial-gradient(1200px 420px at 12% -10%, rgba(202,138,4,.20), transparent 62%),
          radial-gradient(900px 380px at 88% 0%, rgba(234,88,12,.16), transparent 60%),
          linear-gradient(180deg, #fffdf8, var(--paper)); }
.hero .wrap { padding: 62px 22px 46px; }
.eyebrow { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .16em; text-transform: uppercase;
           color: var(--c-moderate); font-weight: 600; margin-bottom: 14px; }
.hero h1 { font-size: clamp(2.05rem, 5.2vw, 3.5rem); margin: 0 0 16px; max-width: 20ch; }
.hero p.lede { font-size: clamp(1.02rem, 2.1vw, 1.2rem); color: var(--ink-soft); max-width: 66ch; margin: 0 0 26px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-family: var(--font-mono);
             font-size: .78rem; color: var(--muted); }
.hero-meta b { color: var(--ink-soft); font-weight: 600; }

/* ---------- status strip ---------- */
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 28px;
          background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
          padding: 16px 18px; box-shadow: var(--shadow); }
.status .big { font-family: var(--font-mono); font-size: 1.9rem; font-weight: 600; line-height: 1;
               padding-right: 16px; border-right: 1px solid var(--line); }
.status .txt { font-size: .95rem; color: var(--ink-soft); min-width: 22ch; flex: 1; }
.status .txt strong { color: var(--ink); }

/* ---------- sections ---------- */
section { padding: 56px 0; border-bottom: 1px solid var(--line); }
section:last-of-type { border-bottom: 0; }
h2.sec { font-size: clamp(1.5rem, 3.2vw, 2.05rem); margin: 0 0 10px; }
p.sec-sub { color: var(--muted); max-width: 74ch; margin: 0 0 30px; font-size: .96rem; }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 18px; box-shadow: var(--shadow); }
.stat .k { font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
.stat .v { font-family: var(--font-mono); font-size: 1.85rem; font-weight: 600; line-height: 1.1; }
.stat .n { font-size: .8rem; color: var(--muted); margin-top: 6px; }

/* ---------- map ---------- */
.map-shell { position: relative; border: 1px solid var(--line); border-radius: var(--radius);
             overflow: hidden; box-shadow: var(--shadow); background: #eef1f4; }
#map { height: 480px; width: 100%; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center;
              padding: 12px 16px; background: var(--card); border-top: 1px solid var(--line); font-size: .8rem; }
.map-legend .li { display: flex; align-items: center; gap: 7px; color: var(--ink-soft); }
.dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 11px; }
.leaflet-popup-content { margin: 14px 16px; font-family: var(--font-body); }
.pop h4 { margin: 0 0 2px; font-size: 1rem; }
.pop .pv { font-size: .8rem; color: var(--muted); margin-bottom: 10px; }
.pop table { border-collapse: collapse; font-size: .82rem; width: 100%; }
.pop td { padding: 3px 0; }
.pop td:last-child { text-align: right; font-family: var(--font-mono); }
.pill { display: inline-block; font-family: var(--font-mono); font-size: .7rem; font-weight: 600;
        text-transform: uppercase; letter-spacing: .06em; padding: 3px 9px; border-radius: 999px; color: #fff; }

/* ---------- table ---------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius);
                background: var(--card); box-shadow: var(--shadow); }
table.data { border-collapse: collapse; width: 100%; font-size: .875rem; min-width: 880px; }
table.data th, table.data td { padding: 11px 14px; text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child,
table.data th:nth-child(2), table.data td:nth-child(2) { text-align: left; }
table.data thead th { background: #f9fafb; border-bottom: 1px solid var(--line);
                      font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
table.data tbody tr { border-bottom: 1px solid #f3f4f6; }
table.data tbody tr:hover { background: #fcfcfb; }
table.data td.num { font-family: var(--font-mono); }
.neg { color: var(--c-severe); }
.pos { color: var(--accent); }
.sitename { font-weight: 600; }
.siteprov { display: block; font-size: .76rem; color: var(--muted); font-weight: 400; }

/* ---------- charts ---------- */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; }
.chart-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
              padding: 18px; box-shadow: var(--shadow); }
.chart-card h3 { margin: 0 0 4px; font-size: 1rem; }
.chart-card .cap { font-size: .8rem; color: var(--muted); margin-bottom: 14px; }
.chart-card svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-wide { grid-column: 1 / -1; }
.axis { font-family: var(--font-mono); font-size: 9.5px; fill: var(--muted); }
.gridline { stroke: #eef0f2; stroke-width: 1; }
.thresh { stroke-dasharray: 4 4; stroke-width: 1; }
.legend-inline { display: flex; flex-wrap: wrap; gap: 5px 15px; font-size: .78rem; color: var(--muted); margin-top: 10px; }
.legend-inline span { display: flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 3px; border-radius: 2px; }

/* ---------- prose ---------- */
.prose { max-width: 78ch; }
.prose h3 { font-size: 1.16rem; margin: 30px 0 8px; }
.prose h3:first-child { margin-top: 0; }
.prose p { margin: 0 0 14px; color: var(--ink-soft); }
.prose ul { margin: 0 0 16px; padding-left: 20px; color: var(--ink-soft); }
.prose li { margin-bottom: 7px; }
.prose strong { color: var(--ink); }

.callout { border-left: 3px solid var(--c-moderate); background: #fffaf1; padding: 15px 18px;
           border-radius: 0 var(--radius) var(--radius) 0; margin: 22px 0; font-size: .92rem; color: var(--ink-soft); }
.callout.warn { border-left-color: var(--c-severe); background: #fff6f6; }
.callout.note { border-left-color: var(--accent); background: #f2fbfa; }
.callout b { color: var(--ink); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; font-size: .88rem; margin: 0 0 18px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--font-mono); font-size: .82rem; }

code, pre { font-family: var(--font-mono); font-size: .82rem; }
pre { background: #f7f8f9; border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow-x: auto; }

.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 26px; }

/* ---------- stages ---------- */
.stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 22px 0; }
.stage { border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; background: var(--card); }
.stage .h { font-family: var(--font-mono); font-size: .74rem; color: var(--muted); margin-bottom: 6px; }
.stage h4 { margin: 0 0 6px; font-size: .95rem; }
.stage p { margin: 0; font-size: .84rem; color: var(--muted); }
.stage.sensitive { border-color: var(--c-severe); box-shadow: 0 0 0 3px rgba(220,38,38,.07); }
.stage.sensitive .h { color: var(--c-severe); font-weight: 600; }

/* ---------- footer ---------- */
footer.site { background: var(--ink); color: #c9c9d6; padding: 44px 0 30px; font-size: .88rem; }
footer.site a { color: #fff; }
footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 26px; margin-bottom: 28px; }
footer h4 { color: #fff; margin: 0 0 10px; font-size: .95rem; }
footer ul { list-style: none; margin: 0; padding: 0; }
footer li { margin-bottom: 6px; }
footer .fine { border-top: 1px solid rgba(255,255,255,.14); padding-top: 20px;
               font-size: .79rem; color: #9494a8; line-height: 1.7; }

.loading { color: var(--muted); font-family: var(--font-mono); font-size: .85rem; }

/* ---------- paddy condition layer ---------- */
/* The provisional badge is not decoration: it must be impossible to read a proxy number
   without noticing that no crop model has been run yet. */
.badge { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono);
         font-size: .72rem; font-weight: 600; letter-spacing: .01em; text-transform: uppercase;
         padding: 5px 11px; border-radius: 999px; border: 1px solid transparent; }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 7px; }
.badge.prov { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.badge.up { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
a.dl { display: inline-block; font-family: var(--font-mono); font-size: .82rem;
       padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px;
       background: var(--card); text-decoration: none; color: var(--ink); }
a.dl:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 720px) {
  nav.main a { padding: 6px 8px; font-size: .8rem; }
  #map { height: 400px; }
  section { padding: 42px 0; }
}
