/* ==========================================================================
   LAYOUT DASAR — NihongoDo
   ========================================================================== */

.page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-4) var(--space-3) var(--space-6);
}

main {
  min-height: 60vh;
}

/* ---- Hub sederhana (fallback tanpa kartu) ---- */
.page-hub .hub-links {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-3);
}
.page-hub .hub-links a {
  display: block;
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-align: center;
}

/* ---- Panel gulungan (hero utama, mis. beranda) ---- */
.scroll-panel {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: var(--space-6) var(--space-4) var(--space-5);
  margin-bottom: var(--space-4);
  background: linear-gradient(180deg, var(--ink-3), var(--ink-1));
  border: 1px solid var(--border);
  border-top: 3px solid var(--shu);
  border-bottom: 3px solid var(--shu);
  border-radius: var(--radius-lg);
}
.scroll-panel::before {
  content: attr(data-watermark);
  position: absolute;
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 140px;
  color: rgba(245, 240, 228, 0.025);
  letter-spacing: 0.1em;
  pointer-events: none;
  white-space: nowrap;
}
.scroll-panel .kanji-big {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(40px, 8vw, 68px);
  line-height: 1;
  letter-spacing: 0.06em;
  /* Shimmer gradasi berjalan halus — lihat kfShimmerText, css/animation.css */
  background: linear-gradient(
    100deg,
    var(--indigo-light) 15%,
    var(--gold-light) 40%,
    var(--shu-light) 55%,
    var(--indigo-light) 80%
  );
  background-size: 250% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: kfShimmerText 7s linear infinite;
}
.scroll-panel .tagline {
  font-size: var(--fs-sm);
  color: var(--text-soft);
  margin-top: var(--space-3);
  max-width: 460px;
  margin-inline: auto;
  line-height: 1.7;
}
.scroll-panel .hero-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--space-4);
}

/* ---- Entrance bertahap untuk anak-anak hero saat halaman dimuat ---- */
.scroll-panel > * {
  opacity: 0;
  animation: kfFadeInUp 0.6s var(--ease) both;
}
.scroll-panel > *:nth-child(1) {
  animation-delay: 0.04s;
}
.scroll-panel > *:nth-child(2) {
  animation-delay: 0.11s;
}
.scroll-panel > *:nth-child(3) {
  animation-delay: 0.18s;
}
.scroll-panel > *:nth-child(4) {
  animation-delay: 0.26s;
}
.scroll-panel > *:nth-child(5) {
  animation-delay: 0.34s;
}
.scroll-panel > *:nth-child(6) {
  animation-delay: 0.42s;
}

@media (prefers-reduced-motion: reduce) {
  .scroll-panel .kanji-big {
    animation: none;
    background: none;
    -webkit-background-clip: initial;
    background-clip: initial;
    color: var(--text);
  }
}

/* ---- Baris statistik ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-4);
  max-width: 480px;
  margin-inline: auto;
}
.stats-row .stat {
  text-align: center;
  padding: 12px 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--ink-2);
  border: 1px solid var(--border-light);
  border-top: 2px solid var(--indigo);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}
.stats-row .stat:nth-child(1) {
  border-top-color: var(--indigo);
}
.stats-row .stat:nth-child(2) {
  border-top-color: var(--jade);
}
.stats-row .stat:nth-child(3) {
  border-top-color: var(--shu);
}
.stats-row .stat:nth-child(4) {
  border-top-color: var(--gold);
}
.stats-row .stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stats-row .stat .num {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1.2;
}
.stats-row .stat .lbl {
  display: block;
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
  line-height: 1.3;
}

/* ---- Kepala seksi ---- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
  gap: var(--space-2);
}
.section-head h2 {
  font-size: var(--fs-xl);
  margin: 0;
}
.section-head .sub {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  margin-top: 2px;
}

section {
  margin-bottom: var(--space-5);
}

/* ---- Grid generik ---- */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--space-3);
}
.grid-cards-lg {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
}
.grid-chars {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: var(--space-2);
}
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-2);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

/* ==========================================================================
   SHARED MODULE TEMPLATE — 4.1
   Dipakai bersama oleh Vocabulary / Kanji / Grammar / JLPT / Dictionary
   supaya visual tetap konsisten tanpa mengulang CSS di tiap halaman.
   ========================================================================== */

/* ─── GRID KONTEN MODUL ──────────────────────────────────── */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}
.content-grid.dense {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-2);
}
.content-grid.wide {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
}
.content-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ─── FILTER / SORT BAR ──────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: var(--space-2) 0;
  margin-bottom: var(--space-3);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--ink-3);
  color: var(--text-soft);
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
  white-space: nowrap;
  user-select: none;
}
.filter-chip:hover {
  border-color: var(--indigo-light);
  color: var(--text);
}
.filter-chip.active {
  background: var(--indigo-ghost);
  border-color: var(--indigo);
  color: var(--indigo-light);
}
.filter-chip.active.n5 {
  background: var(--indigo-ghost);
  border-color: var(--indigo);
  color: var(--indigo-light);
}
.filter-chip.active.n4 {
  background: var(--jade-ghost);
  border-color: var(--jade);
  color: var(--jade-light);
}
.filter-chip.active.n3 {
  background: var(--gold-ghost);
  border-color: var(--gold);
  color: var(--gold-light);
}
.filter-chip.active.n2 {
  background: rgba(123, 95, 192, 0.14);
  border-color: var(--amethyst);
  color: var(--amethyst-light);
}
.filter-chip.active.n1 {
  background: var(--shu-ghost);
  border-color: var(--shu);
  color: var(--shu-light);
}

.filter-sort {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.filter-sort select {
  background: var(--ink-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  padding: 5px 10px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease);
}
.filter-sort select:focus {
  outline: none;
  border-color: var(--indigo-light);
}

.filter-count {
  font-size: var(--fs-xs);
  color: var(--text-ghost);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ─── PROGRESS INDICATOR PER KATEGORI ───────────────────── */
.module-progress-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}
.mph-icon {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1;
  color: var(--indigo-light);
  flex-shrink: 0;
}
.mph-info {
  flex: 1;
  min-width: 140px;
}
.mph-title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 2px;
}
.mph-sub {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  font-family: var(--font-mono);
}
.mph-bar-wrap {
  flex: 2;
  min-width: 120px;
}
.mph-bar-track {
  height: 6px;
  background: var(--ink-4);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 4px;
}
.mph-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--indigo);
  transition: width var(--dur-slow) var(--ease);
}
.mph-pct {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--gold-light);
  font-weight: 700;
}

.mph-bar-fill.n5 {
  background: var(--indigo);
}
.mph-bar-fill.n4 {
  background: var(--jade);
}
.mph-bar-fill.n3 {
  background: var(--gold);
}
.mph-bar-fill.n2 {
  background: var(--amethyst);
}
.mph-bar-fill.n1 {
  background: var(--shu);
}
