/* ============================================
   SAMPATI VIVARAN — Anti-Slop Editorial Design
   Zen White + Nepal Palette
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,800;0,900;1,700&family=Inter:wght@400;500;600;700;800&family=Noto+Sans+Devanagari:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  /* Nepal-Derived Palette (#17) */
  --paper: #FEFCF8;
  --paper-warm: #FAF7F2;
  --paper-mid: #F3EFE8;
  --paper-deep: #ECE8E0;
  --ink: #1A1A1A;
  --charcoal: #333;
  --slate: #5f6368;
  --muted: #999;
  --faint: #ccc;
  --terracotta: #C84B31;
  --temple-gold: #9A7B2E;
  --himalayan-slate: #475569;
  --prayer-blue: #2563EB;
  --nepal-red: #DC143C;
  --nepal-blue: #003893;
  --green: #059669;

  /* Typography */
  --serif: 'Playfair Display', 'Noto Sans Devanagari', Georgia, serif;
  --sans: 'Inter', 'Noto Sans Devanagari', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Menlo', monospace;

  --border: rgba(0,0,0,0.07);
  --border-strong: rgba(0,0,0,0.12);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.07);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* #16 — Paper grain overlay */
.grain-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px;
}

/* ---- Header ---- */
.header {
  position: sticky; top:0; z-index:100;
  background: rgba(254,252,248,0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s;
}
.back-link:hover { color: var(--nepal-red); }

/* #9 — Stamp seal */
.header-stamp { text-align: center; }
.stamp-ring {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--temple-gold);
  border: 2px solid var(--temple-gold);
  border-radius: 50px;
  padding: 4px 16px;
  opacity: 0.7;
}
.lang-toggle {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--slate);
  padding: 5px 14px;
  border-radius: 4px;
  cursor: pointer;
  font: 600 12px var(--sans);
  transition: all 0.2s;
}
.lang-toggle:hover { border-color: var(--nepal-red); color: var(--nepal-red); }

/* ---- Hero / Lede (#2, #7) ---- */
.hero {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 24px 32px;
}
.dateline {
  font-size: 12px;
  font-weight: 600;
  color: var(--nepal-red);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.headline {
  font-family: var(--serif);
  font-size: clamp(32px, 6vw, 52px);
  font-weight: 900;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 24px;
}
.headline-sub {
  display: block;
  font-size: clamp(18px, 3vw, 26px);
  font-weight: 700;
  color: var(--slate);
  margin-top: 6px;
  font-style: italic;
}
.lede {
  font-size: 17px;
  line-height: 1.8;
  color: var(--charcoal);
  border-left: 3px solid var(--nepal-red);
  padding-left: 20px;
  max-width: 640px;
}

/* ---- Stats strip ---- */
.stats-strip {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--paper-warm);
}
.strip-stat { text-align: center; }
.strip-num {
  display: block;
  font: 900 36px var(--serif);
  color: var(--ink);
  font-variant-numeric: tabular-nums; /* #10 */
}
.strip-num.gold-text { color: var(--temple-gold); }
.strip-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.strip-divider {
  width: 1px;
  height: 36px;
  background: var(--border-strong);
}

/* ---- Section base ---- */
.section {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px;
}
.section-warm {
  background: var(--paper-warm);
  max-width: 100%;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.section-warm .section-head,
.section-warm .section-desc,
.section-warm .ingot-chart {
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}
/* #8 — No emoji in headers */
.section-head {
  font: 800 24px var(--serif);
  color: var(--ink);
  margin-bottom: 4px;
}
.section-desc {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
  line-height: 1.6;
}

/* ---- Lollipop Chart (#14, #15, #10) ---- */
.lollipop-chart {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.lollipop-row {
  display: grid;
  grid-template-columns: 200px 1fr 120px;
  align-items: center;
  gap: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  padding: 4px 8px;
  border-radius: 6px;
}
.lollipop-row:hover { background: rgba(0,0,0,0.02); }
.lollipop-row[data-active="true"] { background: rgba(220,20,60,0.04); }

.lollipop-who {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* #6 — Initials avatar instead of emoji */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font: 700 13px var(--sans);
  color: white;
  flex-shrink: 0;
}
.lollipop-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--charcoal);
  line-height: 1.2;
}
.lollipop-role {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

.lollipop-track {
  position: relative;
  height: 24px;
  display: flex;
  align-items: center;
}
.lollipop-line {
  height: 2px;
  background: var(--paper-deep);
  border-radius: 1px;
  position: absolute;
  left: 0;
  width: 100%;
}
.lollipop-fill {
  height: 3px;
  border-radius: 2px;
  position: absolute;
  left: 0;
  transition: width 1.2s cubic-bezier(0.22,1,0.36,1);
  width: 0;
}
.lollipop-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  position: absolute;
  transition: left 1.2s cubic-bezier(0.22,1,0.36,1);
  left: 0;
  transform: translateX(-50%);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* #15 — Micro annotations */
.lollipop-annotation {
  position: absolute;
  top: -16px;
  font-size: 10px;
  font-weight: 600;
  color: var(--terracotta);
  white-space: nowrap;
  font-style: italic;
  pointer-events: none;
}

.lollipop-amount {
  font: 700 14px var(--mono); /* #10 */
  color: var(--charcoal);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* #13 — Context */
.lollipop-context {
  font-size: 10px;
  color: var(--muted);
  text-align: right;
  font-weight: 400;
  font-family: var(--sans);
}

.methodology-inline {
  margin-top: 16px;
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* ---- Gold Ingot Chart (#11) ---- */
.ingot-chart {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 32px;
  min-height: 280px;
  padding: 32px 0 8px;
  flex-wrap: wrap;
}
.ingot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.ingot-wrap:hover .ingot { transform: translateY(-4px); }

.ingot {
  width: 52px;
  border-radius: 4px 4px 2px 2px;
  position: relative;
  transition: height 1.2s cubic-bezier(0.22,1,0.36,1), transform 0.3s;
  min-height: 4px;
  /* Metallic gold gradient */
  background:
    linear-gradient(135deg, #d4a017 0%, #f0d060 15%, #b8860b 40%, #d4a017 60%, #f0d060 80%, #9a7b2e 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.4),
    inset 0 -2px 0 rgba(0,0,0,0.15),
    0 4px 12px rgba(154,123,46,0.3);
}
.ingot::before {
  content: '';
  position: absolute;
  top: 3px; left: 4px; right: 4px;
  height: 2px;
  background: rgba(255,255,255,0.3);
  border-radius: 1px;
}
.ingot-tola {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  font: 700 13px var(--mono);
  color: var(--temple-gold);
  white-space: nowrap;
}
.ingot-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  max-width: 80px;
}

/* ---- Minister Cards — Asymmetric (#1) ---- */
.minister-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
.featured-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  background: var(--paper-warm);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 32px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s;
}
.featured-card:hover { box-shadow: var(--shadow-md); }

.secondary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.minister-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}
.minister-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.minister-card[data-highlight="true"] {
  border-color: var(--nepal-red);
  box-shadow: 0 0 0 1px var(--nepal-red), var(--shadow-md);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.card-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font: 700 15px var(--sans);
  color: white;
  flex-shrink: 0;
}
.card-avatar.large { width: 56px; height: 56px; font-size: 18px; }
.card-title {
  font: 800 16px var(--serif);
  color: var(--ink);
  line-height: 1.2;
}
.card-subtitle {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.card-total-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.card-total-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.card-total-value {
  font: 900 20px var(--serif);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.card-line {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px dashed rgba(0,0,0,0.04);
}
.card-line:last-child { border-bottom: none; }
.card-line-key { color: var(--slate); font-weight: 500; }
.card-line-val {
  font: 600 13px var(--mono);
  color: var(--charcoal);
  font-variant-numeric: tabular-nums;
}

/* #18 — Inline source citation */
.source-cite {
  font-size: 10px;
  color: var(--muted);
  vertical-align: super;
  text-decoration: none;
  margin-left: 2px;
  font-weight: 600;
}
.source-cite:hover { color: var(--nepal-red); }

.card-observation {
  margin-top: 12px;
  font-size: 12px;
  color: var(--himalayan-slate);
  font-style: italic;
  line-height: 1.5;
  padding: 10px 12px;
  background: rgba(0,56,147,0.03);
  border-left: 2px solid var(--prayer-blue);
  border-radius: 0 6px 6px 0;
}

/* ---- Editorial (#3, #5) ---- */
.editorial {
  border-top: 2px solid var(--ink);
  padding-top: 32px;
}
.editorial-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.editorial-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.editorial-item:last-child { border-bottom: none; }
.editorial-kicker {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--nepal-red);
  margin-bottom: 6px;
}
.editorial-text {
  font: 400 15px/1.7 var(--sans);
  color: var(--charcoal);
}

/* ---- Methodology (#20) ---- */
.methodology-section {
  border-top: 1px solid var(--border);
}
.meth-text {
  font-size: 13px;
  line-height: 1.8;
  color: var(--slate);
  max-width: 680px;
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 40px 24px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--paper-warm);
}
.footer a { color: var(--nepal-red); text-decoration: none; font-weight: 600; }
.footer a:hover { text-decoration: underline; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .featured-card { grid-template-columns: 1fr; }
  .lollipop-row { grid-template-columns: 120px 1fr 90px; gap: 8px; }
  .lollipop-name { font-size: 12px; }
  .lollipop-amount { font-size: 12px; }
  .ingot-chart { gap: 18px; }
  .ingot { width: 40px; }
  .stats-strip { gap: 16px; }
  .strip-num { font-size: 28px; }
  .headline { font-size: 28px; }
  .secondary-grid { grid-template-columns: 1fr; }
  .avatar { width: 30px; height: 30px; font-size: 11px; }
}
