/* ============================================================
   Portal Belajar — Design System
   IT & Hukum Keluarga | statis, tanpa ketergantungan eksternal
   ============================================================ */
:root {
  --bg: #f8fafc;
  --bg2: #f1f5f9;
  --card: #ffffff;
  --line: #e2e8f0;
  --ink: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent2: #0ea5e9;
  --it: #2563eb;
  --it2: #0ea5e9;
  --hukum: #b45309;
  --hukum2: #f59e0b;
  --ok: #15803d;
  --bad: #b91c1c;
  --shadow: 0 8px 24px rgba(15, 23, 42, .08);
  --radius: 14px;
  --font: "Amiri", "Segoe UI", system-ui, Arial, sans-serif;
  --font-display: Georgia, "Times New Roman", "Cambria", serif;
  --mono: Consolas, "Courier New", monospace;
}

/* Mode gelap: kontras teks dipertahankan dengan menaikkan rasio.
   Kotak info (.analogi/.kunci/dsb.) tetap memakai latar terang + teks gelap
   sehingga kontrasnya terjaga di kedua mode. */
html[data-theme="dark"] {
  --bg: #0b1220;
  --bg2: #16202f;
  --card: #101a2a;
  --line: #2a3a52;
  --ink: #e2e8f0;
  --muted: #a5b4c8;
  --accent: #7aa2ff;
  --accent2: #38bdf8;
  --it: #7aa2ff;
  --it2: #38bdf8;
  --hukum: #fbbf24;
  --hukum2: #f59e0b;
  --ok: #4ade80;
  --bad: #f87171;
  --shadow: 0 8px 24px rgba(0, 0, 0, .45);
}

/* Amiri dipakai HANYA untuk blok karakter Arab (U+0600–U+06FF dll),
   sehingga semua teks Arab di situs otomatis memakai font ini,
   sedangkan teks Latin memakai Segoe UI/system-ui. */
@font-face {
  font-family: "Amiri";
  font-style: normal;
  font-weight: 400;
  src: url("fonts/amiri-400.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Amiri";
  font-style: normal;
  font-weight: 700;
  src: url("fonts/amiri-700.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
}
a { color: var(--accent); }
code {
  font-family: var(--mono);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: .92em;
  word-break: break-word;
}
pre {
  font-family: var(--mono);
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  margin: 12px 0;
}
pre .cm { color: #84cc16; }
pre .k { color: #93c5fd; }

/* ---------- layout ---------- */
.wrap { max-width: 1000px; margin: 0 auto; padding: 24px 20px 80px; }

/* ---------- tipografi ---------- */
h1, h2, h3, .brand, .pillar h2, .card h2, h2.mod, h2.sec { font-family: var(--font-display); letter-spacing: -.01em; }
article.art p, article.art li, .layout main p, .layout main li { max-width: 70ch; }

/* ---------- nav situs ---------- */
.site-nav {
  display: flex; gap: 4px; align-items: center; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 6px; margin-bottom: 22px;
}
.site-nav a {
  padding: 8px 14px; border-radius: 9px; color: var(--muted);
  font-weight: 600; font-size: 13px; text-decoration: none; white-space: nowrap;
}
.site-nav a:hover { color: var(--accent); background: var(--bg); }
.site-nav a[aria-current] { background: var(--accent); color: #fff; }
.site-nav .spacer { flex: 1; }
.site-nav .pill {
  font-size: 11px; color: var(--muted); padding: 0 6px; white-space: nowrap;
}
.site-nav .pill b.it { color: var(--it); }
.site-nav .pill b.law { color: var(--hukum); }

/* ---------- hero ---------- */
.hero {
  background: linear-gradient(135deg, #1e3a8a, #0ea5e9);
  color: #fff; border-radius: 16px; padding: 40px 32px; margin-bottom: 28px;
}
.hero.law { background: linear-gradient(135deg, #78350f, #f59e0b); }
.hero h1 { font-size: 30px; margin-bottom: 10px; }
.hero p { font-size: 15px; opacity: .95; max-width: 720px; }
.hero .meta { margin-top: 16px; font-size: 13px; display: flex; gap: 18px; flex-wrap: wrap; }
.hero .meta b { color: #fde68a; }

/* ---------- breadcrumb ---------- */
.crumb {
  font-size: 12.5px; color: var(--muted); margin-bottom: 14px;
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.crumb span { opacity: .5; }

/* ---------- cards / grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; text-decoration: none; color: inherit;
  display: block; transition: transform .08s ease, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card .ico { font-size: 26px; }
.card h2 { font-size: 18px; margin: 10px 0 6px; color: var(--accent); }
.card.it h2 { color: var(--it); }
.card.law h2 { color: var(--hukum); }
.card p { font-size: 13.5px; color: var(--muted); }
.card .tag {
  display: inline-block; margin-top: 12px; font-size: 11.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px; color: var(--ok);
  background: #dcfce7; border: 1px solid #bbf7d0;
}
.card .tag.it { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.card .tag.law { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.card .subs { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; }
.card .subs a {
  color: var(--accent); text-decoration: none; font-size: 13.5px;
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  padding-bottom: 6px; border-bottom: 1px dashed var(--line);
}
.card.law .subs a { color: var(--hukum); }
.card .subs a:hover { text-decoration: underline; }
.card .subs .st { font-size: 11px; color: var(--muted); white-space: nowrap; }
.card .go { display: inline-block; margin-top: 14px; font-size: 13px; font-weight: 700; color: var(--ok); }
.card.law .go { color: var(--hukum); }

/* ---------- konten artikel ---------- */
article.art h1 { font-size: 26px; margin: 6px 0 4px; }
article.art > .lead { font-size: 15px; color: var(--muted); margin-bottom: 22px; }
article.art h2 {
  font-size: 20px; margin: 30px 0 10px; padding-top: 8px;
  border-bottom: 2px solid var(--line);
}
article.art h3 { font-size: 17px; margin: 22px 0 8px; }
article.art p { margin: 10px 0; }
article.art ul, article.art ol { margin: 10px 0 10px 24px; }
article.art li { margin: 5px 0; }

/* box pendukung */
.analogi, .kunci, .perhatian, .tip, .ringkas, .contoh {
  border-radius: 10px; padding: 12px 16px; margin: 14px 0; font-size: 14px;
  border: 1px solid;
}
.analogi { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.kunci   { background: #fefce8; border-color: #fde68a; color: #713f12; }
.perhatian { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.tip     { background: #f0fdf4; border-color: #bbf7d0; color: #14532d; }
.ringkas { background: #f1f5f9; border-color: var(--line); color: #334155; }
.contoh  { background: #fdf4ff; border-color: #e9d5ff; color: #6b21a8; }
.ayat    { background: #f8fafc; border-color: var(--line); color: #334155; border-left: 4px solid #0f766e; }
.ayat .arab { display: block; direction: rtl; text-align: right; font-size: 22px; line-height: 2.1; margin-bottom: 6px;
  font-family: "Amiri", "Scheherazade New", "Traditional Arabic", "Noto Naskh Arabic", "Segoe UI", serif;
  font-weight: 400; }
.ringkas p[lang="ar"] {
  direction: rtl; text-align: right; font-size: 23px; line-height: 2.2; margin: 8px 0 2px;
  font-family: "Amiri", "Scheherazade New", "Traditional Arabic", "Noto Naskh Arabic", "Segoe UI", serif;
  font-weight: 400;
}
/* Teks Arab inline (di dalam paragraf/tabel) — perbesar & beri ruang agar harakat terbaca */
b[lang="ar"], i[lang="ar"], span[lang="ar"], td[lang="ar"], li[lang="ar"], p[lang="ar"] {
  font-family: "Amiri", "Scheherazade New", "Traditional Arabic", "Noto Naskh Arabic", "Segoe UI", serif;
  font-size: 1.25em;
  line-height: 1.9;
  direction: rtl;
  unicode-bidi: isolate;
}
span.arab, .arab { font-family: "Amiri", "Scheherazade New", "Traditional Arabic", "Noto Naskh Arabic", "Segoe UI", serif; }
.analogi b, .kunci b, .perhatian b, .tip b, .contoh b { font-weight: 700; }

/* tabel */
.tbl-wrap { overflow-x: auto; margin: 12px 0; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--card); }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: var(--bg2); font-weight: 700; }

/* soal/cek pemahaman */
.check {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin: 24px 0;
}
.check h3 { margin-top: 0; }
.check ol { margin-left: 22px; }
.check details { margin: 8px 0; padding: 8px 12px; background: var(--bg); border-radius: 8px; }
.check summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.check details p { margin: 8px 0 0; font-size: 13.5px; }

/* ---------- kuis ---------- */
.quiz {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin: 20px 0;
}
.quiz .stat { font-size: 13.5px; color: var(--muted); margin: 4px 0; }
.mode-btn {
  flex: 1; min-width: 240px; text-align: left; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.mode-btn h3 { font-size: 15px; margin-bottom: 4px; color: var(--accent); }
.mode-btn p { font-size: 12.5px; color: var(--muted); }
.mode-btn:hover { box-shadow: var(--shadow); }
.mode-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 16px 0; }
.btn {
  display: inline-block; border: none; border-radius: 9px; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 13.5px; padding: 10px 18px;
  background: var(--accent); color: #fff; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.big { display: block; width: 100%; margin-top: 14px; padding: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.progress { height: 10px; background: var(--bg2); border-radius: 20px; overflow: hidden; margin: 10px 0; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.qnav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 6px; margin: 10px 0; }
.qnav-grid button {
  border: 1px solid var(--line); background: var(--card); border-radius: 7px;
  padding: 6px 0; cursor: pointer; font: inherit; font-size: 12.5px;
}
.qnav-grid button.done { background: #dcfce7; border-color: #86efac; }
.qnav-grid button.cur { outline: 2px solid var(--accent); }
.qnav-grid button.flag { background: #fef3c7; border-color: #fcd34d; }
.opt {
  display: block; width: 100%; text-align: left; margin-bottom: 8px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--card);
  font: inherit; font-size: 13.5px; cursor: pointer;
}
.opt:hover { border-color: var(--accent); }
.opt.correct { background: #dcfce7; border-color: #86efac; }
.opt.wrong { background: #fee2e2; border-color: #fca5a5; }
.opt.disabled { cursor: default; }
.feedback { padding: 10px 12px; border-radius: 9px; font-weight: 600; font-size: 13.5px; margin: 10px 0; display: none; }
.feedback.ok { background: #dcfce7; color: #14532d; display: block; }
.feedback.bad { background: #fee2e2; color: #7f1d1d; display: block; }
.explain { background: var(--bg2); border-radius: 9px; padding: 12px; font-size: 13.5px; display: none; }
.explain.show { display: block; }
.legend { font-size: 12px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid var(--line); }
.score-big { font-size: 40px; font-weight: 800; color: var(--accent); }
.score-big.pass { color: var(--ok); }
.score-big.fail { color: var(--bad); }

/* ---------- misc ---------- */
.note {
  margin-top: 26px; font-size: 12.5px; color: var(--muted);
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; line-height: 1.7;
}
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-top: 8px; }
.pillar {
  border-radius: 16px; padding: 26px; color: #fff; text-decoration: none; display: block;
  transition: transform .08s ease, box-shadow .15s;
}
.pillar.it { background: linear-gradient(135deg, #1e3a8a, #0ea5e9); }
.pillar.law { background: linear-gradient(135deg, #78350f, #f59e0b); }
.pillar:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pillar .ico { font-size: 32px; }
.pillar h2 { font-size: 22px; margin: 10px 0 6px; }
.pillar p { font-size: 13.5px; opacity: .95; }
.pillar ul { margin: 12px 0 0 18px; font-size: 13px; opacity: .95; }
.pillar li { margin: 4px 0; }
.pillar .go { display: inline-block; margin-top: 14px; font-weight: 700; font-size: 13px;
  background: rgba(255,255,255,.18); padding: 7px 16px; border-radius: 20px; }

/* Dashboard progres */
.prog-dash { margin-top: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; }
.prog-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.prog-total span { font-weight: 800; color: var(--accent); font-size: 18px; }
.prog-track { height: 8px; background: var(--bg2); border-radius: 20px; overflow: hidden; margin: 8px 0; }
.prog-track.big { height: 12px; margin: 10px 0 16px; }
.prog-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 20px; transition: width .3s; }
.prog-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(90px,1.4fr) auto; align-items: center; gap: 12px; padding: 7px 0; border-top: 1px dashed var(--line); }
.prog-label { text-decoration: none; font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog-label:hover { color: var(--accent); }
.prog-num { font-size: 12.5px; color: var(--muted); min-width: 42px; text-align: right; }
@media (max-width: 640px) { .prog-row { grid-template-columns: 1fr; gap: 4px; } .prog-num { text-align: left; } }

.to-top {
  position: fixed; right: 20px; bottom: 20px; width: 44px; height: 44px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--card);
  color: var(--accent); font-size: 18px; cursor: pointer; display: none;
  box-shadow: var(--shadow); z-index: 50;
}
.to-top.show { display: block; }

/* Tombol mode gelap/terang */
.theme-toggle {
  position: fixed; right: 20px; bottom: 74px; width: 44px; height: 44px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--card);
  font-size: 18px; cursor: pointer; box-shadow: var(--shadow); z-index: 50;
}

/* Pencarian global */
.search { position: relative; margin-top: 22px; max-width: 560px; }
.search input {
  width: 100%; padding: 13px 18px; border-radius: 30px; border: 1px solid var(--line);
  background: rgba(255,255,255,.94); font-size: 14px; color: var(--ink); outline: none;
  box-shadow: var(--shadow);
}
.search input:focus { border-color: var(--accent); }
#searchResults {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 40;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden; display: none;
}
.search input:focus ~ #searchResults, #searchResults:not(:empty) { display: block; }
.search-item { display: block; padding: 11px 16px; text-decoration: none; border-bottom: 1px solid var(--line); }
.search-item:hover { background: var(--bg2); }
.search-item b { display: block; font-size: 13.5px; color: var(--accent); margin-bottom: 2px; }
.search-item span { display: block; font-size: 12px; color: var(--muted); line-height: 1.5; }
.search-none, .search-more { padding: 11px 16px; font-size: 12.5px; color: var(--muted); }

@media (max-width: 640px) {
  .hero { padding: 26px 20px; }
  .hero h1 { font-size: 23px; }
  article.art h1 { font-size: 22px; }
  .pillars { grid-template-columns: 1fr; }
}
