/* ============ tokens ============ */
:root {
  --bg: #f5f2ec;
  --bg-2: #efeadf;
  --surface: #ffffff;
  --surface-2: #f6f2e9;
  --border: #e6dfce;
  --border-strong: #14213d;
  --text: #14213d;
  --text-soft: #3b4a6b;
  --muted: #6b6a5e;
  --accent: #ff3b6b;
  --accent-ink: #ffffff;
  --accent-soft: #ffe1e9;
  --highlight: #ffe66b;
  --highlight-soft: #fff5b8;
  --good: #4b7a3a;
  --warn: #b08508;
  --crit: #a63b2a;
  --ring: rgba(20, 33, 61, .12);
  --shadow-sm: 0 1px 0 rgba(20, 33, 61, .05);
  --shadow: 0 1px 2px rgba(20, 33, 61, .04), 0 10px 30px rgba(20, 33, 61, .06);
  --shadow-nav: 0 1px 0 rgba(20, 33, 61, .04), 0 12px 40px rgba(20, 33, 61, .08);
  --pop: 6px 6px 0 var(--border-strong);
}

:root[data-theme="dark"] {
  --bg: #0d1220;
  --bg-2: #121a2e;
  --surface: #16203a;
  --surface-2: #1c2947;
  --border: #263356;
  --border-strong: #0b1220;
  --text: #eef2fb;
  --text-soft: #c2ccdf;
  --muted: #8a97b3;
  --accent: #ff5c85;
  --accent-ink: #0d1220;
  --accent-soft: #3a1b2a;
  --highlight: #ffd447;
  --highlight-soft: #4a3a10;
  --good: #6fd39a;
  --warn: #f2c268;
  --crit: #ef7a7a;
  --ring: rgba(238, 242, 251, .12);
  --shadow-sm: 0 1px 0 rgba(0, 0, 0, .35);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .45);
  --shadow-nav: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 40px rgba(0, 0, 0, .5);
  --pop: 6px 6px 0 #05080f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0d1220; --bg-2: #121a2e; --surface: #16203a; --surface-2: #1c2947;
    --border: #263356; --border-strong: #0b1220; --text: #eef2fb; --text-soft: #c2ccdf;
    --muted: #8a97b3; --accent: #ff5c85; --accent-ink: #0d1220; --accent-soft: #3a1b2a;
    --highlight: #ffd447; --highlight-soft: #4a3a10;
    --good: #6fd39a; --warn: #f2c268; --crit: #ef7a7a;
    --ring: rgba(238, 242, 251, .12);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .45);
    --shadow-nav: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 40px rgba(0, 0, 0, .5);
    --pop: 6px 6px 0 #05080f;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1200px 500px at 90% -10%, var(--bg-2), transparent 60%),
    radial-gradient(900px 400px at -10% 110%, var(--bg-2), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  padding: 20px clamp(14px, 3vw, 32px) 40px;
  transition: background-color .5s ease, color .5s ease;
}

/* ============ theme transition ============ */
html.theme-anim,
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
  transition:
    background-color .5s ease,
    background .5s ease,
    color .5s ease,
    border-color .5s ease,
    fill .5s ease,
    stroke .5s ease,
    box-shadow .5s ease !important;
}
/* View Transitions API — circle wipe from toggle */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }
@keyframes theme-clip {
  from { clip-path: circle(0% at var(--tx, 90%) var(--ty, 5%)); }
  to   { clip-path: circle(150% at var(--tx, 90%) var(--ty, 5%)); }
}
::view-transition-new(root) {
  animation: theme-clip .6s cubic-bezier(.22, 1, .36, 1);
}

/* ============ brand nav (matches choropleth) ============ */
body { padding: 0 !important; }
.brand-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
}
.brand-logo {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, #a77bff, var(--accent));
  color: #fff; flex-shrink: 0;
}
.brand-logo svg { width: 16px; height: 16px; }
.brand-name { font-weight: 800; letter-spacing: -0.02em; font-size: 16px; }
.brand-slash { color: var(--muted); font-weight: 500; margin: 0 2px; }
.brand-app { color: var(--accent); font-weight: 700; font-size: 15px; }
.brand-chip {
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 10px 3px 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 999px;
  color: var(--text);
  display: inline-flex; align-items: center; gap: 6px;
}
.brand-chip::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: #37c47a; box-shadow: 0 0 0 2px rgba(55, 196, 122, .2);
}

.nav-mid { display: flex; justify-content: flex-start; }
@media (max-width: 720px) { .nav-mid { display: none; } }

.nav-actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  gap: 2px;
}
.theme-toggle button {
  appearance: none; border: 0;
  width: 28px; height: 28px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background-color .2s, color .2s;
}
.theme-toggle button svg { width: 14px; height: 14px; }
.theme-toggle button:hover { color: var(--text); }
.theme-toggle button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 3px var(--ring);
}
.theme-toggle button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  font-size: 12px; font-weight: 600;
  transition: background-color .15s, color .15s, border-color .15s;
}
.back-link:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.back-link svg { width: 12px; height: 12px; }

/* ============ shell ============ */
.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(14px, 3vw, 32px) 40px;
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 2.5vw, 32px);
}

/* ============ hero ============ */
.hero {
  display: block;
  padding: clamp(16px, 3vw, 32px) 8px;
}

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 var(--border-strong);
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 59, 107, .5); }
  70% { box-shadow: 0 0 0 10px rgba(255, 59, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 59, 107, 0); }
}

.headline {
  margin: 20px 0 14px;
  font-size: clamp(38px, 6vw, 68px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 800;
  color: var(--text);
}
.mark {
  background: linear-gradient(180deg, transparent 60%, var(--highlight) 60%);
  padding: 0 4px;
  border-radius: 4px;
}
.accent { color: var(--accent); }
.star {
  display: inline-block;
  color: var(--highlight);
  font-size: 0.5em;
  vertical-align: super;
  margin-left: 6px;
  transform: rotate(12deg);
}

.lead {
  max-width: 46ch;
  color: var(--text-soft);
  font-size: 16px;
  margin: 0 0 24px;
}
.lead b { color: var(--text); font-weight: 700; }

.clock-block {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 18px 22px;
  box-shadow: var(--pop);
  margin-bottom: 20px;
}
.clock-top {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
}
.clock-label {
  font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}
.fmt-toggle {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  gap: 2px;
}
.fmt-toggle button {
  appearance: none; border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit; font-size: 11px; font-weight: 700;
  letter-spacing: .06em;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .2s, color .2s;
  font-variant-numeric: tabular-nums;
}
.fmt-toggle button:hover { color: var(--text); }
.fmt-toggle button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 2px var(--ring);
}
.fmt-toggle button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.clock .ap {
  font-size: 0.32em;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .04em;
  margin-left: 4px;
  align-self: baseline;
}
.clock {
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: clamp(44px, 7vw, 72px);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 700;
  color: var(--text);
  display: flex; align-items: baseline; gap: 10px;
  margin-top: 4px;
}
.clock .sec {
  font-size: 0.4em;
  color: var(--accent);
  font-weight: 600;
}
.date-line { margin-top: 4px; color: var(--muted); font-size: 14px; }
.date-line strong { color: var(--text); font-weight: 700; }

.chip-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 10px 16px;
}
.chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  text-decoration: none; color: var(--text);
  box-shadow: 3px 3px 0 var(--border-strong);
  transition: transform .1s, box-shadow .1s;
}
.chip:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--border-strong); }
.chip-ic {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--highlight-soft);
  font-size: 14px;
}
.chip b { display: block; font-size: 13px; font-weight: 700; line-height: 1.1; }
.chip em {
  display: block; font-style: normal;
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
}
.chip-text {
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  color: var(--text); text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 2px solid var(--text);
}
.chip-text:hover { color: var(--accent); border-color: var(--accent); }

/* ============ year progress ============ */
.year {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: clamp(22px, 3vw, 36px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.year-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
}
.year-title {
  margin: 0;
  font-family: inherit;
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}
.grad { color: var(--accent); }
.year-sub {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.year-sub a { color: var(--accent); text-decoration: none; font-weight: 700; }
.year-sub a:hover { text-decoration: underline; }

.year-big {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(48px, 9vw, 96px);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 700;
  color: var(--text);
  margin: 8px 0 2px;
  font-variant-numeric: tabular-nums;
}
.year-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  margin: 4px 0 0;
}
.year-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .8s cubic-bezier(.22, 1, .36, 1);
}
.year-bar-labels {
  display: flex; justify-content: space-between;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--muted);
}
.year-toward {
  margin: 6px 0 4px;
  color: var(--muted);
  font-size: 13px;
}
.year-toward b { color: var(--accent); font-weight: 700; }

.year-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(10px, 1.5vw, 14px);
  margin-top: 8px;
}
@media (max-width: 820px) { .year-stats { grid-template-columns: 1fr 1fr; } }
.ystat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 110px;
}
.ystat-lbl {
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}
.ystat-val {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(18px, 2.2vw, 22px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  margin-top: auto;
}
.ystat-val em {
  font-style: normal; font-size: 0.55em;
  color: var(--muted); font-weight: 500;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.ystat-g { color: var(--accent); }

/* ============ cards grid ============ */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(14px, 2vw, 20px);
}
@media (max-width: 960px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 280px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: 0 1px 2px var(--ring), 0 18px 40px var(--ring);
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin: 0;
}
.card-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.tag {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  text-transform: uppercase;
}
.tag-warm { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag-cool { background: var(--highlight-soft); color: var(--warn); border-color: transparent; }

/* -------- weather card -------- */
.weather-main {
  display: flex; align-items: baseline; gap: 14px;
}
.weather-main .temp {
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 60px; font-weight: 700;
  line-height: 1; letter-spacing: -0.04em;
}
.weather-main .cond { color: var(--muted); font-size: 14px; }
.weather-meta {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px 16px; font-size: 13px; color: var(--muted);
  padding-top: 10px; border-top: 1px dashed var(--border);
}
.weather-meta b {
  color: var(--text); font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

/* -------- adzan card -------- */
.adzan-next {
  background: var(--highlight-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px;
}
.adzan-next .lbl {
  font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); font-weight: 700;
}
.adzan-next .name { font-size: 18px; font-weight: 700; margin-top: 2px; }
.adzan-next .cd {
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 22px; font-weight: 700;
  color: var(--accent); letter-spacing: -0.02em;
}
.adzan-list {
  display: flex; flex-direction: column; gap: 2px;
  margin: 0; padding: 0; list-style: none;
}
.adzan-list li {
  display: flex; justify-content: space-between;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.adzan-list li:last-child { border-bottom: 0; }
.adzan-list li[data-next="true"] {
  color: var(--accent); font-weight: 700;
}
.adzan-list li .time {
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}
.adzan-list li.passed { color: var(--muted); opacity: .55; }

/* -------- location card -------- */
.loc-place { font-size: 20px; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; }
.loc-region { color: var(--muted); font-size: 14px; margin-top: 2px; }
.coords {
  display: grid; grid-template-columns: auto 1fr;
  gap: 6px 12px; font-size: 13px; color: var(--muted);
  padding-top: 10px; border-top: 1px dashed var(--border);
}
.coords b {
  color: var(--text); font-weight: 600;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}
.map {
  height: 180px;
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface-2);
  position: relative;
  z-index: 0;
}
.map:empty::before {
  content: "peta muncul setelah lokasi tersedia";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--muted); font-size: 12px;
}
.leaflet-container {
  background: var(--surface-2);
  font-family: inherit;
}
.leaflet-control-attribution {
  background: rgba(255, 255, 255, .8) !important;
  color: var(--muted) !important;
  font-size: 10px !important;
}
:root[data-theme="dark"] .leaflet-control-attribution {
  background: rgba(13, 18, 32, .8) !important;
}
:root[data-theme="dark"] .leaflet-control-attribution a { color: var(--accent) !important; }
.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
:root[data-theme="dark"] .leaflet-tile { filter: brightness(.85); }

.refresh {
  margin-top: auto;
  appearance: none;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 14px;
  font: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer;
  align-self: flex-start;
  box-shadow: 2px 2px 0 var(--border-strong);
  transition: transform .1s, box-shadow .1s;
}
.refresh:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--border-strong); }
.refresh:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--border-strong); }
.refresh:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* -------- states -------- */
.status { font-size: 13px; color: var(--muted); }
.status.err { color: var(--crit); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* -------- footer -------- */
.meta {
  display: flex; gap: 16px; justify-content: space-between;
  flex-wrap: wrap;
  color: var(--muted); font-size: 12px;
  padding: 6px 6px 0;
  border-top: 1px dashed var(--border);
  margin-top: 8px;
  padding-top: 16px;
}
.meta a { color: var(--accent); text-decoration: none; font-weight: 600; }
.meta a:hover { text-decoration: underline; }
