/*
 * stdsquare² — reveal.js theme
 * Slide deck theme for academic presentations.
 * Canvas: 1280×720 (16:9) — matches Reveal config.
 * All colors use CSS variables from main site.
 */

@import "../reset.css";
@import "../reveal.css";

/* ── Global ── */
.reveal-viewport {
  background: #eef0f4;
}

.reveal {
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: clamp(18px, 2vw, 24px);
  color: var(--text, #1c1d24);
}

/* ── Headings ── */
.reveal h1, .reveal h2, .reveal h3, .reveal h4 {
  font-family: var(--font-ui, system-ui, sans-serif);
  font-weight: 700;
  color: var(--text, #1c1d24);
  text-transform: none;
  letter-spacing: -0.01em;
  line-height: 1.2;
  text-shadow: none;
}
.reveal h1 { font-size: 1.8em; margin-bottom: 0.2em; }
.reveal h2 { font-size: 1.35em; color: var(--accent, #00c853); margin-bottom: 0.4em; }
.reveal h3 { font-size: 1.1em; color: var(--text-muted, #3a3d48); }
.reveal h4 { font-size: 0.95em; }

/* ── Links ── */
.reveal a {
  color: var(--accent, #00c853);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.reveal a:hover { color: var(--accent-pop, #00e676); }

/* ══════════════════════════════════════════════════
   SLIDE SECTION — PPT Card Look
   Each <section> is a white card floating on grey
   ══════════════════════════════════════════════════ */
.reveal .slide-background { background: transparent; }
.reveal .slides section {
  /* Full-canvas card: every slide fills the 1280×720 stage so content is
     framed consistently (no grey dead-space below short slides). Content
     flows from the top; use .cover / .vc to centre vertically. Hard budget:
     content must fit within 720px (overflow is clipped — verify per slide). */
  height: 720px;
  box-sizing: border-box;
  overflow: hidden;
  text-align: left;
  background: #ffffff;
  border-radius: 12px;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.10),
    0 2px 8px rgba(0,0,0,0.06);
  padding: 40px 52px;
  border: 1px solid rgba(0,0,0,0.06);
}
/* Reveal sets display:block inline on the live slide — override it to flex on
   the VISIBLE slide only (never global, or hidden slides would reappear). */
/* Centre the WHOLE slide content (title + body + footer) as one group so the
   breathing room is split evenly top & bottom — no void pooled at the bottom or
   middle, and boxes keep their natural size (no empty stretched containers). */
.reveal .slides section.present { display: flex !important; flex-direction: column; justify-content: center; gap: 4px; }
.reveal .num-box .desc { font-size: 0.95rem; }
/* Vertical-centre utility (covers, section dividers, single-focus slides) */
.reveal .slides section.vc { justify-content: center; }
.reveal .slides section h2:first-child,
.reveal .slides section h1:first-child { margin-top: 0; }

/* ── Lists ── */
.reveal ul, .reveal ol {
  display: block;
  text-align: left;
  margin-left: 1.2em;
}
.reveal li { margin-bottom: 0.35em; }

/* ── Code ── */
.reveal code {
  font-family: var(--font-mono, 'Courier New', monospace);
  background: #f1f5f9;
  color: var(--accent-deep, #006b2d);
  padding: 0.1em 0.3em;
  border-radius: 3px;
  font-size: 0.85em;
}
.reveal pre code {
  display: block;
  padding: 0.8em 1em;
  overflow: auto;
  max-height: 55vh;
  background: #f1f5f9;
  color: var(--text, #1c1d24);
  border-left: 3px solid var(--accent, #00c853);
  border-radius: 4px;
  font-size: 0.78em;
}

/* ── Block quotes ── */
.reveal blockquote {
  background: #f8fafc;
  border-left: 4px solid var(--accent, #00c853);
  padding: 0.6em 1em;
  border-radius: 0 6px 6px 0;
  box-shadow: none;
  font-style: normal;
  color: var(--text, #1c1d24);
  width: auto;
}

/* ── Tables (base) ── */
.reveal table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88em;
}
.reveal table th {
  background: var(--accent, #00c853);
  color: #fff;
  padding: 0.4em 0.7em;
  font-weight: 600;
  text-align: left;
}
.reveal table td {
  padding: 0.35em 0.7em;
  border-bottom: 1px solid #e2e8f0;
  color: var(--text, #1c1d24);
}
.reveal table tr:nth-child(even) td {
  background: #f8fafc;
}
/* table.plain (15 Agu 2026, laporan Boss "font hitam bg biru aneh"): tabel
   bertipe 'plain' memakai header NETRAL — teks gelap + garis bawah aksen,
   tanpa blok warna. Semantik 'plain' dihormati; tabel non-plain tetap gaya lama. */
.reveal table.plain th {
  background: transparent;
  color: var(--text, #1c1d24);
  border-bottom: 2px solid var(--accent, #00c853);
  border-radius: 0;
}

/* ── Controls + progress ── */
.reveal .controls { color: var(--accent, #00c853); }
.reveal .progress { background: #cbd5e1; }
.reveal .progress span { background: var(--accent, #00c853); }

/* ── Slide number ── */
.reveal .slide-number {
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.75em;
  font-family: var(--font-mono, monospace);
  border-radius: 4px;
  padding: 2px 6px;
}

/* ── Divider sub-bab (W2.1, 2026-07-15; DIREVISI 2026-07-15 — lihat catatan bug) ──
   Akar masalah alignment: .vc hanya center VERTIKAL; center horizontal dulu
   bergantung inline style yang cuma ada di ~43% file → divider tampil
   kiri-campur-tengah di ~794 deck. Fix terpusat di sini, NOL sentuhan file deck.

   ⚠️ BUG (ditemukan Boss via screenshot, sama hari): draf pertama pakai selector
   `:has()` untuk merata-tengahkan SELURUH section.vc ber-divider (termasuk h2/p.lead
   di ~78 deck varian title-only yang bukan class .divider-*). `:has()` TIDAK didukung
   Firefox <121 dan sejumlah browser lama — di sana rule itu senyap tak pernah berlaku,
   bug lama (kiri-campur-tengah) muncul lagi. Diperbaiki jadi 2 lapis TANPA :has() sama
   sekali:
   1) Class .divider-kicker/-title/-sub langsung dirata-tengah (kerja di SEMUA browser,
      classnya eksklusif dipakai divider — diverifikasi grep, aman disentuh langsung).
   2) Section pembungkusnya ditandai `.divider-slide` oleh JS (layouts/slides/deck.html,
      guard file — dijalankan sebelum Reveal.initialize, sama seperti fragmentHygiene)
      supaya elemen SIBLING non-class (h2/p.lead di deck varian title-only) ikut
      ter-rata-tengah — deteksi via querySelector biasa, bukan :has(). */
.reveal .slides section.vc.divider-slide { text-align: center; }
.divider-kicker { text-align: center; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent2); }
.divider-title { text-align: center; font-size: 2.2rem; font-weight: 700; color: var(--text, #1a1a1a); line-height: 1.15; margin: 8px 0 14px; }
.divider-sub { text-align: center; font-size: 1.05rem; color: var(--text-soft, #586072); max-width: 80%; margin: 0 auto; line-height: 1.6; }

/* Entrance divider (W2.2, 2026-07-15) — penanda ganti bab: kicker/judul/sub
   naik-halus berurutan + garis aksen wipe di bawah judul. Berjalan saat slide
   divider menjadi .present (mode baca & mengajar), ±0,5 dtk, sekali per kedatangan. */
@media (prefers-reduced-motion: no-preference) {
  .reveal .slides section.vc.present .divider-kicker { animation: sq-divider-in 0.4s ease both; }
  .reveal .slides section.vc.present .divider-title  { animation: sq-divider-in 0.4s ease 0.08s both; }
  .reveal .slides section.vc.present .divider-sub    { animation: sq-divider-in 0.4s ease 0.16s both; }
  .reveal .slides section.vc.present .divider-title::after {
    content: ""; display: block; width: 64px; height: 3px;
    background: var(--accent, #00c853); margin: 14px auto 0;
    animation: sq-divider-line 0.45s ease 0.28s both;
  }
}
@keyframes sq-divider-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes sq-divider-line { from { transform: scaleX(0); } to { transform: scaleX(1); } }
/* Aksesibilitas (W2.2): OS minta gerak minimal → matikan transisi/animasi deck */
@media (prefers-reduced-motion: reduce) {
  .reveal .slides section, .reveal .slides section * { animation: none !important; transition: none !important; }
  .reveal .fragment { visibility: visible !important; opacity: 1 !important; transform: none !important; }
}

/* ── Cover slide ── */
.reveal .slides section.cover { text-align: center; justify-content: center; align-items: center; }
.reveal .slides section.cover > * { max-width: 90%; }
.reveal .slides section.cover h1 { font-size: 2em; color: var(--accent, #00c853); margin-bottom: 0.3em; }
.reveal .slides section.cover .subtitle { font-size: 1em; color: #64748b; margin-bottom: 0.8em; }
.reveal .slides section.cover .meta { font-size: 0.8em; color: #94a3b8; }

/* ── Badge pill ── */
.reveal .badge {
  display: inline-block;
  background: #f0fdf4;
  color: #15803d;
  border-radius: 100px;
  padding: 0.15em 0.7em;
  font-size: 0.75em;
  font-weight: 600;
  margin: 0.1em;
}

/* ── Widget iframe ── */
.reveal .widget-wrap {
  width: 100%;
  max-height: 55vh;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.reveal .widget-wrap iframe {
  width: 100%;
  height: 55vh;
  border: none;
  display: block;
}

/* ── SVG figures ── */
.reveal .v2fig, .reveal figure svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* ── MathJax ── */
.reveal .MathJax { font-size: 1.1em !important; }

/* ── Fragment highlight ── */
.reveal .fragment.highlight-current { color: var(--accent-pop, #00e676); }

/* ════════════════════════════════════════════════════════════════
   TIPOGRAFI KONSISTEN — safety net (audit 2026-07-25)
   2310/2394 deck menyalin template deck-design-system.css verbatim,
   yang punya KONTRADIKSI internal (.big 2.3rem vs 2.8rem, .divider-
   title 2.2rem vs 2.6rem, .lead 1em vs 1.05em) + 812 deck menambah
   inline h2=1.5em + 15.533 instance .big di-override inline ke nilai
   acak (4.363 tertekan ke 1rem = sama dgn body, hierarki lenyap).

   Blok ini MEMAKSA hierarki konsisten via !important supaya override
   inline non-!important di tiap deck. Skala: modular Major Third
   (ratio 1.25) di atas body 18px — kontras jelas tanpa rakus ruang,
   aman untuk deck padat (tabel/formula) agar tidak overflow 720px.

   !important di sini bisa DITUMPU lagi dgn inline !important di deck
   tertentu kalau memang perlu pengecualian (jarang). Setiap deck juga
   dibersihkan dari inline font-size heading/.big oleh script
   scripts/normalize_deck_typography.py — tapi safety net ini tetap
   dipertahankan sbg jaring pengaman utk deck varian & masa depan.
   ════════════════════════════════════════════════════════════════ */
.reveal h2 { font-size: 1.8em !important; }              /* judul slide 32px */
.reveal h3 { font-size: 1.3em !important; }              /* sub-heading 23px */
.reveal h4 { font-size: 1.1em !important; }              /* minor heading 20px */
.reveal .lead { font-size: 1.15em !important; }          /* intro paragraf 21px */
/* AUDIT 2026-07-25 (Boss lapor "font biru kebesaran, merah terlalu kecil,
   informasi sama pentingnya" + lanjutan "beberapa terkesan dibesarkan
   terlalu memaksa jadi tidak rapi"):
   - .big (biru accent) asli 2.5rem=40px didesain utk ANGKA kunci. TAPI 89%
     pemakaian .big di deck adalah TEKS/konsep ("PLURALITAS DIAKUI NEGARA",
     "MEMBACA CIPTAAN"), bukan angka. Teks panjang di 35-40px = terpaksa,
     pecah proporsi kartu, overflow. Draf pertama fix 40→35 masih memaksa
     krn .big dipakai utk 2 hal berbeda (angka vs label teks).
   - Fix definitif: .big turun ke 1.8rem (29px) — cukup dominan utk angka
     pendek ("2,5%", "Rp 400 M"), TIDAK rakus utk teks label 3-4 kata
     (wrap 2 baris rapi dgn line-height ketat). word-break supaya teks
     sangat panjang tidak overflow kotak.
   - .label (merah) naik 11→13px supaya terbaca (informasi sama pentingnya).
   - Hierarki baru SEIMBANG: label 13px → sub 13px → desc 14px → big 29px
     (rasio big:label 1:2.2 — tidak ada lagi dominasi memaksa). */
.reveal .num-box .big {
  font-size: 1.8rem !important;        /* 29px — angka cukup besar, teks tidak memaksa */
  line-height: 1.15 !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
}
.reveal .num-box .label { font-size: 0.8rem !important; } /* label angka 13px (naik dari 11px) */
.reveal .num-box .sub { font-size: 0.82rem !important; }  /* satuan/sub 13px (naik dari 12.8px) */
.reveal .card-header { font-size: 0.78rem !important; }   /* header kartu 12.5px (naik dari 11px) */
.reveal .divider-title { font-size: 2.4rem !important; } /* judul divider 38px */
.reveal .divider-kicker { font-size: 0.85rem !important; } /* label divider 14px */

/* ════════════════════════════════════════════════════════════════
   ILUSTRASI SVG — safety net ukuran (audit 2026-07-25)
   1781/2394 deck punya inline <svg> (total 3765 instance). Masalah:
   - 1941 SVG pakai inline max-height:190-260px yang MEMAKSA ilustrasi
     pendek → hanya 30-40% area slide, ruang mati besar (keluhan Boss).
   - 280 SVG pakai fixed pixel (width=760 height=150) → tidak responsive.
   - 4827 <text> font-size ≤9 viewBox-unit → tidak terbaca saat render kecil.
   - 0 dari 3765 SVG dibungkus <figure> → rule existing (.reveal figure svg)
     TIDAK berlaku sama sekali.

   Strategi: fill LEBAR penuh, TINGGI mengikuti rasio aspek natural (height:
   auto). Karena viewBox SVG tetap, memperbesar render width OTOMATIS
   menaikkan readable font (font 11 viewBox-unit di SVG 800px render = 11px
   literal, tapi di SVG 1176px render = ~16px). Ini solve masalah font kecil
   TANPA harus edit tiap elemen <text>.

   TIDAK pakai :has() (lihat catatan bug Firefox <121 di baris 162-173) —
   pendekatan 2-lapis: selector langsung + !important utk bungkam inline.
   ════════════════════════════════════════════════════════════════ */
/* SVG raw di slide: STRATEGI BARU (fix 15 Agu 2026, laporan Boss "ukuran SVG
   terlalu besar"): fit-within-BOTH — lebar maksimum container DAN tinggi
   maksimum anggaran slide. SVG ber-viewBox punya intrinsic aspect ratio,
   maka width/height auto + kedua max-*) = perilaku "contain": diagram sebesar
   mungkin TANPA meluber dari slide. (Strategi lama "fill lebar penuh, tinggi
   natural" membuat SVG rasio-tinggi (160×170, 200×220 dsb) melebar 1140px
   → tinggi 760–1254px = meluber 2× layar — itulah "sangat tidak rapi".) */
.reveal .slides section svg {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  max-height: 420px; /* anggaran aman: 660px area konten − judul ±90 − caption ±60 */
}
/* Cap TINGGI per-slide buatan author DIHORMATI kembali (revisi audit 2026-07-25:
   inline max-height 190-260px itu niat layout, bukan bug — mematikannya justru
   menciptakan masalah meluber di atas). Tidak ada lagi bungkam !important. */
/* Fixed-width SVG (width=760 dgn/ tanpa height) → tetap responsif ala 2026-07-27:
   max-width:100% (SVG kecil tetap natural size, SVG besar constrain ke container). */
.reveal .slides section svg[width][height]:not([width="100%"]):not([class]) {
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
}
/* Wrapper kontainer SVG (chart-svg dlsb) jangan batasi tinggi — batas ada di SVG dalamnya */
.reveal .chart-svg, .reveal .v2fig-wrap, .reveal .svg-wrap {
  max-height: none !important;
}
/* ── fig-lg (15 Agu 2026, laporan Boss "masih sampah"): diagram rasio-tinggi.
   Ukuran final ditetapkan INLINE per-SVG (width+height px = rasio viewBox persis,
   gambar memenuhi elemen 100%, TANPA letterbox). Kelas ini hanya penanda —
   TIDAK boleh set width/height apa pun (termasuk !important) agar inline menang. */
.reveal .slides section svg.fig-lg {
  max-width: 100%;
}

/* ── Print / PDF ── */
@media print {
  .reveal-viewport { background: #fff !important; }
  .reveal { font-size: 18px; color: #000; }
  .reveal h2 { color: #000; }
  .reveal a { color: #000; text-decoration: underline; }
  .reveal .controls, .reveal .progress, .reveal .slide-number { display: none; }
}
