/* ─── RESET + ROOT ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }

/* ─── TOKENS ──────────────────────────────────────────────── */
:root {
  --bg:        #080808;
  --surface:   #111111;
  --surface-2: #1a1a1a;
  --border:    #252525;
  --border-2:  #333;
  --text:      #f0f0f0;
  --muted:     #666;
  --muted-2:   #888;
  --accent:    #228891;
  --accent-dim:#1a6c74;
  --red:       #ff3c3c;
  --green:     #22c55e;
  --radius:    8px;
  --radius-lg: 14px;
  --nav-h:     60px;
  --max-w:     1100px;
}

/* ─── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

/* ─── TYPOGRAPHY ──────────────────────────────────────────── */
h1,h2,h3,h4,h5 { font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
p { line-height: 1.7; }

/* ─── NAVBAR ──────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--nav-h);
  background: rgba(8,8,8,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
}
.nav-brand {
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-brand .bug { font-size: 1.3rem; display: inline-block; animation: crawl 2.4s ease-in-out infinite; }
@keyframes crawl {
  0%,100% { transform: rotate(-8deg) translateX(-1px); }
  50%      { transform: rotate(8deg)  translateX(1px);  }
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.nav-links a {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted-2);
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--surface-2); }
.nav-links .nav-cta {
  background: var(--accent);
  color: #fff;
  color: #000;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.nav-links .nav-cta:hover { background: #1d7880; color: #fff; }
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  margin-left: auto;
  padding: 8px;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: all 0.2s; }
@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    gap: 4px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 16px; border-radius: var(--radius); }
  .nav-links .nav-cta { text-align: center; margin-top: 4px; }
}

/* ─── FOOTER ──────────────────────────────────────────────── */
.footer {
  margin-top: auto;
  padding: 40px 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
}
.footer-brand { font-weight: 700; font-size: 1rem; }
.footer-brand span { color: var(--accent); }
.footer-text { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { font-size: 0.85rem; color: var(--muted); transition: color 0.15s; }
.footer-links a:hover { color: var(--text); }
@media (max-width: 600px) {
  .footer-inner { grid-template-columns: 1fr; text-align: center; }
  .footer-links { justify-content: center; }
}

/* ─── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 600;
  transition: all 0.15s; white-space: nowrap; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d7880; transform: translateY(-1px); }
.btn-ghost { background: transparent; border: 1px solid var(--border-2); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius-lg); }

.btn-scurry {
  background: rgba(34,136,145,0.1); border: 1px solid rgba(34,136,145,0.3); color: var(--accent);
  padding: 8px 16px; border-radius: var(--radius); font-size: 0.85rem; font-weight: 700; transition: all 0.15s;
}
.btn-scurry:hover, .btn-scurry.active {
  background: rgba(34,136,145,0.2); border-color: var(--accent); transform: scale(1.04);
}
.btn-squash {
  background: rgba(255,60,60,0.08); border: 1px solid rgba(255,60,60,0.25); color: var(--red);
  padding: 8px 16px; border-radius: var(--radius); font-size: 0.85rem; font-weight: 700; transition: all 0.15s;
}
.btn-squash:hover, .btn-squash.active {
  background: rgba(255,60,60,0.16); border-color: var(--red); transform: scale(1.04);
}

/* ─── CARDS ───────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; transition: border-color 0.2s; }
.card:hover { border-color: var(--border-2); }

/* ─── RANT CARD ───────────────────────────────────────────── */
.rant-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 22px; transition: border-color 0.2s, transform 0.15s; }
.rant-card:hover { border-color: var(--border-2); transform: translateY(-1px); }
.rant-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.rant-category {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted-2);
}
.rant-time { font-size: 0.75rem; color: var(--muted); margin-left: auto; }
.rant-title { font-size: 1rem; font-weight: 700; margin-bottom: 8px; line-height: 1.4; }
.rant-body {
  font-size: 0.88rem; color: var(--muted-2); line-height: 1.6;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; margin-bottom: 14px;
}
.rant-footer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.cockroach-meter { width: 100%; margin: 10px 0 14px; }
.meter-bar { height: 4px; background: rgba(255,60,60,0.3); border-radius: 99px; overflow: hidden; margin-bottom: 4px; }
.meter-fill { height: 100%; background: var(--accent); border-radius: 99px; width: var(--pct, 50%); transition: width 0.5s ease; }
.meter-labels { display: flex; justify-content: space-between; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; }
.label-scurry { color: var(--accent); }
.label-squash { color: var(--red); }

/* ─── BADGE ───────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 600; border: 1px solid transparent; }
.badge-accent  { background: rgba(34,136,145,0.1); border-color: rgba(34,136,145,0.3); color: var(--accent); }
.badge-red     { background: rgba(255,60,60,0.1);  border-color: rgba(255,60,60,0.3);  color: var(--red); }
.badge-neutral { background: var(--surface-2); border-color: var(--border); color: var(--muted-2); }

/* ─── SECTION ─────────────────────────────────────────────── */
.section { padding: 80px 24px; }
.section-inner { max-width: var(--max-w); margin: 0 auto; }
.section-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.section-title { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; margin-bottom: 16px; }
.section-sub { font-size: 1rem; color: var(--muted-2); max-width: 600px; line-height: 1.7; }

/* ─── FORM ────────────────────────────────────────────────── */
.input, .textarea, .select {
  background: var(--surface); border: 1px solid var(--border-2); color: var(--text);
  border-radius: var(--radius); padding: 10px 14px; font-family: inherit; font-size: 0.9rem; width: 100%;
  transition: border-color 0.15s; appearance: none;
}
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.textarea { resize: vertical; min-height: 120px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--muted-2); }
.form-group { margin-bottom: 16px; }
.form-error { font-size: 0.8rem; color: var(--red); margin-top: 4px; }

/* ─── SPINNER ─────────────────────────────────────────────── */
.spinner { width: 28px; height: 28px; border: 3px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { text-align: center; color: var(--muted); font-size: 0.85rem; font-style: italic; padding: 40px 0; }

/* ─── TOAST ───────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text);
  padding: 12px 20px; border-radius: var(--radius); font-size: 0.88rem; font-weight: 500;
  z-index: 9999; transform: translateY(80px); opacity: 0; transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1); max-width: 320px;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ─── UTILS ───────────────────────────────────────────────── */
.glow { text-shadow: 0 0 20px rgba(34,136,145,0.5); }
.page-wrap { min-height: 100vh; display: flex; flex-direction: column; padding-top: var(--nav-h); }
.live-dot { display: inline-block; width: 7px; height: 7px; background: var(--green); border-radius: 50%; margin-right: 5px; animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.text-accent { color: var(--accent); }
.text-muted  { color: var(--muted); }
.text-red    { color: var(--red); }
.text-center { text-align: center; }
.divider { height: 1px; background: var(--border); margin: 40px 0; }
.sr-only { position: absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }

/* Category label colors */
[data-cat="unemployment"]    { --cat-color: #f59e0b; }
[data-cat="exam-scams"]      { --cat-color: #8b5cf6; }
[data-cat="judiciary"]       { --cat-color: #06b6d4; }
[data-cat="godi-media"]      { --cat-color: #f97316; }
[data-cat="crony-capitalism"]{ --cat-color: #ec4899; }
[data-cat="elections"]       { --cat-color: #22c55e; }
[data-cat="how-they-see-us"] { --cat-color: #e879f9; }
[data-cat="general"]         { --cat-color: var(--accent); }
.rant-category { color: var(--cat-color, var(--muted-2)); border-color: color-mix(in srgb, var(--cat-color, var(--muted-2)) 25%, transparent); }

/* ─── LIGHT THEME (opentalk-inspired) ────────────────────── */
html.light {
  --bg:        #ffffff;
  --surface:   #f7f8fa;
  --surface-2: #eeeff2;
  --border:    #e0e2e8;
  --border-2:  #c8ccd4;
  --text:      #0f0f13;
  --muted:     #8b8fa8;
  --muted-2:   #5a5f72;
}
html.light body { color-scheme: light; }
html.light ::-webkit-scrollbar-track { background: #f0f0f0; }
html.light ::-webkit-scrollbar-thumb { background: #c8ccd4; }
html.light .navbar {
  background: rgba(255,255,255,0.94);
  border-bottom-color: var(--border);
}
html.light .card,
html.light .rant-card,
html.light .post-form-card,
html.light .sidebar-card,
html.light .demand-card,
html.light .manifesto-eligibility,
html.light .result-card,
html.light .origin-card,
html.light .manifesto-item {
  background: #fff;
  border-color: var(--border);
}
html.light .card:hover,
html.light .rant-card:hover { border-color: var(--border-2); }
html.light .latest-section,
html.light .story-section,
html.light .cta-section { background: var(--surface); }
html.light .story-highlight { background: rgba(34,136,145,0.06); border-color: rgba(34,136,145,0.2); }
html.light .hero-origin { background: #fff; border-color: var(--border); }
html.light .input,
html.light .textarea,
html.light .select { background: #fff; border-color: var(--border-2); color: var(--text); }
html.light .input:focus,
html.light .textarea:focus,
html.light .select:focus { border-color: var(--accent); }
html.light .btn-ghost { border-color: var(--border-2); }
html.light .sort-tab.active { background: rgba(34,136,145,0.1); border-color: rgba(34,136,145,0.3); color: #228891; }
html.light .cat-chip.active { border-color: #228891; color: #228891; background: rgba(34,136,145,0.08); }
html.light .cat-chip { background: #fff; }
html.light .live-banner { background: var(--surface); }

/* accent overrides for light mode readability */
html.light {
  --accent: #228891;
  --accent-dim: #1a6c74;
}
html.light .btn-primary { background: #228891; color: #fff; }
html.light .btn-primary:hover { background: #1d7880; }
html.light .btn-scurry { background: rgba(34,136,145,0.08); border-color: rgba(34,136,145,0.3); color: #228891; }
html.light .btn-scurry:hover, html.light .btn-scurry.active { background: rgba(34,136,145,0.15); border-color: #228891; }
html.light .meter-fill { background: #228891; }
html.light .label-scurry { color: #228891; }
html.light .hero-title {
  background: linear-gradient(135deg, #0f0f13 0%, #228891 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
html.light .section-label,
html.light .story-eyebrow,
html.light .manifesto-page-header .eyebrow,
html.light .origin-eyebrow,
html.light .demand-num { color: #228891; }
html.light .demand-card { border-left-color: #228891; }
html.light .manifesto-item .num { background: rgba(34,136,145,0.1); border-color: rgba(34,136,145,0.3); color: #228891; }
html.light .nav-live { color: #228891; }
html.light .badge-accent { background: rgba(34,136,145,0.1); border-color: rgba(34,136,145,0.3); color: #228891; }
html.light .footer { background: var(--surface); }
html.light .footer-brand span { color: #228891; }
html.light .quiz-option { background: #fff; }
html.light .quiz-option:hover { background: rgba(34,136,145,0.04); border-color: #228891; }
html.light .quiz-option.selected { background: rgba(34,136,145,0.1); border-color: #228891; color: #1a6c74; }

/* ─── LIVE COUNT (opentalk-style) ────────────────────────── */
.nav-live {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green);
  padding: 4px 10px;
  border-radius: 99px;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  white-space: nowrap;
  transition: opacity 0.3s;
}
.nav-live .live-dot {
  width: 6px; height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: blink 1.4s ease-in-out infinite;
  margin-right: 0;
  flex-shrink: 0;
}
html.light .nav-live { background: rgba(34,197,94,0.08); }

/* ─── THEME BUTTON ────────────────────────────────────────── */
.theme-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.theme-btn:hover {
  border-color: var(--accent);
  transform: rotate(20deg);
}
html.light .theme-btn { background: #fff; border-color: var(--border-2); }

html.light .nav-links .nav-cta { color: #fff; }
html.light .nav-links .nav-cta:hover { background: #1d7880; color: #fff; }
