:root {
  --ink: #1e2433;
  --muted: #667085;
  --border: #e4e7ec;
  --bg: #ffffff;
  --bg-soft: #f8f9fb;
  --accent: #2f5fa8;
  --accent-dark: #234a87;
  --accent-soft: #eaf0fa;
  --banner-bg: #fef3c7;
  --banner-ink: #78350f;
  --success: #1a9c6d;
  --header-h: 60px;
  --sidebar-w: 300px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
}

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

/* Banner rujukan krisis */
.krisis-banner {
  background: var(--banner-bg);
  color: var(--banner-ink);
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  text-align: center;
}
.krisis-banner a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Header */
.site-header {
  height: var(--header-h);
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 20;
}

.sidebar-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.sidebar-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  text-decoration: none;
  min-width: 0;
}
.brand-name {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.brand-sub {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-switch {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  white-space: nowrap;
}
.lang-switch:hover { background: var(--accent-soft); color: var(--accent-dark); }

/* Layout: sidebar + main */
.layout {
  display: flex;
  align-items: flex-start;
  max-width: 78rem;
  margin: 0 auto;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 1rem 0 2rem;
}

.sidebar-progress {
  padding: 0 1.1rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.sidebar-progress-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--success);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.reset-progress-btn {
  margin-top: 0.6rem;
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  font-size: 0.76rem;
  text-decoration: underline;
  cursor: pointer;
}
.reset-progress-btn:hover { color: var(--accent-dark); }

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-link {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.55rem 1.1rem;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.88rem;
  border-left: 3px solid transparent;
}
.sidebar-link:hover { background: var(--accent-soft); }
.sidebar-link.is-active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 600;
  color: var(--accent-dark);
}
.sidebar-link.is-disabled {
  color: var(--muted);
  cursor: default;
}

.sidebar-status {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 0.15rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  position: relative;
}
.sidebar-status.is-read {
  border-color: var(--success);
  background: var(--success);
}
.sidebar-status.is-read::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.sidebar-status--locked {
  border-style: dashed;
}

.sidebar-link.is-locked-seq,
a.materi-card-title.is-locked-seq {
  color: var(--muted);
  cursor: not-allowed;
}
.sidebar-link.is-locked-seq:hover { background: transparent; }
.sidebar-link.is-locked-seq .sidebar-status {
  border-style: dashed;
}
.materi-card.is-locked-seq-card { opacity: 0.65; }

.sidebar-overlay {
  display: none;
}

/* Main content */
.site-main {
  flex: 1;
  min-width: 0;
  padding: 2rem 1.5rem 4rem;
  max-width: 46rem;
}

/* Hero (halaman depan) */
.hero { padding: 1rem 0 2rem; border-bottom: 1px solid var(--border); margin-bottom: 2rem; }
.hero h1 { font-size: 1.7rem; margin: 0 0 0.75rem; }
.hero-lead { color: var(--muted); font-size: 1.02rem; margin: 0 0 1.25rem; }

.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.btn-primary:hover { background: var(--accent-dark); color: #fff; }

/* Grid kartu materi (halaman depan) */
.materi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.materi-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--bg);
}
.materi-card.is-disabled { opacity: 0.6; }
.materi-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.materi-card-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 700;
}
.materi-card-status {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
}
.materi-card-status.is-read {
  border-color: var(--success);
  background: var(--success);
}
.materi-card-title {
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.98rem;
  line-height: 1.4;
}
a.materi-card-title:hover { color: var(--accent); }
.materi-card-ringkasan { color: var(--muted); font-size: 0.85rem; margin: 0; }
.materi-card-badge {
  align-self: flex-start;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--bg-soft);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

/* Artikel materi */
.materi-eyebrow {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.35rem;
}
.materi-article h1 { font-size: 1.55rem; margin: 0 0 1.5rem; }
.materi-konten h2 { font-size: 1.2rem; margin: 2rem 0 0.75rem; }
.materi-konten h3 { font-size: 1.05rem; margin: 1.5rem 0 0.6rem; }
.materi-konten h4 { font-size: 0.95rem; margin: 1.25rem 0 0.5rem; }
.materi-konten p { margin: 0 0 1rem; }
.materi-konten ul, .materi-konten ol { margin: 0 0 1rem; padding-left: 1.4rem; }
.materi-konten li { margin-bottom: 0.4rem; }
.materi-konten blockquote {
  margin: 1.25rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  color: var(--ink);
  font-size: 0.95rem;
}
.materi-konten blockquote p:last-child { margin-bottom: 0; }
.materi-konten dt { font-weight: 700; margin-top: 0.75rem; }
.materi-konten dd { margin: 0.15rem 0 0; color: var(--ink); }
.materi-konten em { color: var(--muted); }
.materi-konten sup { font-size: 0.7em; }

.materi-end-sentinel { height: 1px; }
.materi-selesai-tanda {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--success);
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
}

.materi-belum-terbit { color: var(--muted); }

.materi-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin: 0 0 1.25rem;
}
.materi-status-badge--draft { background: var(--banner-bg); color: var(--banner-ink); }
.materi-status-badge--ok { background: #e3f6ee; color: var(--success); }

/* Prev/next pager */
.materi-pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.materi-pager-link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-decoration: none;
  max-width: 48%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.materi-pager-link:hover { border-color: var(--accent); }
.materi-pager-next { margin-left: auto; text-align: right; align-items: flex-end; }
.materi-pager-dir { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.materi-pager-title { font-size: 0.9rem; color: var(--ink); font-weight: 600; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1rem;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

/* Mobile */
@media (max-width: 860px) {
  .sidebar-toggle { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    padding-top: calc(var(--header-h) + 0.5rem);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 40;
    box-shadow: 2px 0 12px rgba(0,0,0,0.08);
  }
  .sidebar.is-open { transform: translateX(0); }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 30;
  }
  .sidebar-overlay.is-open { opacity: 1; pointer-events: auto; }

  .site-main { padding: 1.5rem 1rem 3rem; max-width: 100%; }
  .brand-sub { display: none; }
  .materi-pager { flex-direction: column; }
  .materi-pager-link, .materi-pager-next { max-width: 100%; text-align: left; align-items: flex-start; }
}

/* Notice materi terkunci (baca berurutan) */
.materi-locked-notice {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 2rem 1.5rem;
  text-align: center;
  background: var(--bg-soft);
}
.materi-locked-title { font-weight: 700; font-size: 1.05rem; margin: 0 0 0.5rem; }
.materi-locked-desc { color: var(--muted); margin: 0 0 1.25rem; }
