/* ==========================================================================
   Indonesia Bisa - shared theme system
   Light theme only, 7 selectable brand colours, glassmorphism (no gradients,
   no orbs/blobs - flat colours only).
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Jua&display=swap");

:root,
:root[data-theme="classic"] {
  --brand: #ccffcc;
  --brand-ink: #14532d;
  --bg: #eafcea;
}

:root[data-theme="notgreen-1"] {
  --brand: #ffcccc;
  --brand-ink: #7f1d1d;
  --bg: #fff0f0;
}

:root[data-theme="notgreen-2"] {
  --brand: #ccccff;
  --brand-ink: #312e81;
  --bg: #f1f0ff;
}

:root[data-theme="notgreen-3"] {
  --brand: #ffffcc;
  --brand-ink: #713f12;
  --bg: #fffceb;
}

:root[data-theme="notgreen-4"] {
  --brand: #ffccff;
  --brand-ink: #701a75;
  --bg: #fff0ff;
}

:root[data-theme="notgreen-5"] {
  --brand: #ccffff;
  --brand-ink: #164e63;
  --bg: #eafeff;
}

:root[data-theme="lightest-green"] {
  --brand: #ffffff;
  --brand-ink: #1f2937;
  --bg: #ffffff;
}

:root {
  color-scheme: light;

  --ink: #10241a;
  --muted: #4b5a52;
  --card: rgba(255, 255, 255, 0.55);
  --card-border: rgba(255, 255, 255, 0.65);
  --card-solid: #ffffff;
  --line: rgba(16, 36, 26, 0.1);

  --ok: #15803d;
  --warn: #b45309;
  --busy: #b91c1c;

  --radius: 18px;
  --radius-sm: 12px;
  --blur: 16px;

  --shadow: 0 8px 30px rgba(16, 36, 26, 0.08);
  --shadow-sm: 0 2px 10px rgba(16, 36, 26, 0.06);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Jua", sans-serif;

  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--ink);
}

::selection {
  color: #fff;
  background: color-mix(in srgb, var(--brand) 65%, #000);
}

a {
  color: color-mix(in srgb, var(--brand) 55%, #000);
  text-decoration: none;
}

a:visited {
  color: color-mix(in srgb, var(--brand) 40%, #333);
}

a:hover {
  text-decoration: none;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

svg {
  display: block;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  stroke: currentColor;
}

/* ---------- layout shell ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--card);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-bottom: 1px solid var(--card-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  color: var(--ink);
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

/* ---------- glass surfaces ---------- */

.glass {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow);
}

/* ---------- header icon buttons ---------- */

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--card-border);
  color: var(--ink);
  font-size: 0.95rem;
  transition: background 0.15s ease, transform 0.1s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.85);
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn.square {
  width: 42px;
  padding: 0;
}

.coffee-btn {
  background: color-mix(in srgb, var(--brand) 70%, #ffffff);
  color: var(--brand-ink);
  border-color: color-mix(in srgb, var(--brand) 40%, #ffffff);
}

.coffee-btn:hover {
  background: color-mix(in srgb, var(--brand) 90%, #ffffff);
}

/* ---------- modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 36, 26, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal {
  width: 100%;
  max-width: 420px;
  padding: 22px;
  background: color-mix(in srgb, var(--card-solid) 88%, transparent);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  transform: scale(0.96) translateY(6px);
  transition: transform 0.18s ease;
}

.modal-overlay.show .modal {
  transform: scale(1) translateY(0);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-head h2 {
  font-size: 1.15rem;
  font-weight: normal;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
  text-align: left;
  font-size: 0.9rem;
}

.theme-option:hover {
  background: rgba(255, 255, 255, 0.85);
}

.theme-option[aria-pressed="true"] {
  border-color: var(--ink);
  outline: 2px solid color-mix(in srgb, var(--brand) 70%, #000);
  outline-offset: -1px;
}

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  flex: none;
}

/* ---------- back-to-directory link ---------- */

.back-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.85rem;
}

.back-home:hover {
  color: var(--ink);
}

/* ---------- loading spinner ---------- */

.skeleton {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 0.85rem;
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(16, 36, 26, 0.15);
  border-top-color: var(--brand-ink);
  animation: idb-spin 0.7s linear infinite;
}

@keyframes idb-spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner.sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

/* ---------- misc ---------- */

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

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 24px 20px 40px;
}

/* ---------- entrance transitions ---------- */
/* Elements that a page script reveals via .show (banners, result cards,
   empty states) fade and settle in instead of popping in abruptly. Exit is
   instant (display: none has no transition target), which is an acceptable
   trade-off for not having to touch every page script's show/hide logic. */

.banner.show,
.current-card.show,
.ticker-card.show,
.latest-card.show,
.result-card.show,
.empty-state.show {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

@starting-style {

  .banner.show,
  .current-card.show,
  .ticker-card.show,
  .latest-card.show,
  .result-card.show,
  .empty-state.show {
    opacity: 0;
    transform: translateY(-4px);
  }
}

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  .site-header {
    padding: 12px 14px;
  }

  .brand {
    font-size: 1.1rem;
  }

  main {
    padding: 20px 14px 48px;
  }

  .modal {
    padding: 18px;
  }

  .theme-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .coffee-btn {
    width: 42px;
    padding: 0;
  }

  .coffee-btn .btn-label {
    display: none;
  }
}

@media (max-width: 380px) {
  .brand span {
    display: none;
  }
}
