:root {
  /* Katalog perpustakaan: kertas sejuk, tinta hijau tua, stempel mustard */
  --surface-page: #f1f3ec;
  --surface-card: #fffdf8;
  --surface-tint: #e7ebe0;
  --border: #dbe1d1;
  --text-primary: #1c2430;
  --text-secondary: #52594e;
  --text-muted: #8b9186;
  --accent: #2f5233;
  --accent-hover: #22401f;
  --stamp: #c9791a;
  --stamp-soft: #f8e9d2;
  --radius: 10px;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Warna "spine" katalog - dipilih otomatis per Kategori, lihat spineClassFor() di common.js */
  --spine-1: #2f5233;
  --spine-2: #2b3a67;
  --spine-3: #8a3b2e;
  --spine-4: #5b4b8a;
  --spine-5: #1f6f78;
  --spine-6: #8a6d1f;
}

/* Tema gelap - "katalog perpustakaan" versi malam hari, palet sama, cuma
   nada terang/gelap dibalik. Dipicu atribut data-theme di <html> lewat
   tombol toggle di navbar (lihat _theme_init.html + .theme-toggle). */
:root[data-theme="dark"] {
  --surface-page: #1b1f18;
  --surface-card: #252b21;
  --surface-tint: #2e352a;
  --border: #3b4334;
  --text-primary: #ece9dc;
  --text-secondary: #b5bba9;
  --text-muted: #7c8272;
  --accent: #6fae74;
  --accent-hover: #8bc78f;
  --stamp: #e0a545;
  --stamp-soft: #3a2f1a;
}

[data-theme="dark"] .wordmark-indo { color: var(--text-primary); }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface-page);
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px);
  background-size: 100% 42px;
  background-attachment: local;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
}

.page {
  margin: 0 auto;
  padding: 32px 40px 60px;
  position: relative;
}

/* --- Iklan samping (kiri/kanan beranda) --- */
/* Cuma muncul kalau layar cukup lebar supaya ada ruang tanpa nutupin konten;
   di layar sempit selalu disembunyikan (JS juga tidak akan menampilkannya). */

.side-rail {
  position: fixed;
  top: 110px;
  width: 180px;
  max-height: 70vh;
  overflow: hidden;
  border-radius: var(--radius);
  z-index: 5;
}

.side-rail-left { left: 16px; }
.side-rail-right { right: 16px; }

@media (min-width: 1500px) {
  .page { padding-left: 220px; padding-right: 220px; }
}

@media (max-width: 560px) {
  .page { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 1499px) {
  .side-rail { display: none !important; }
}

/* Kertas bergaris cuma di area konten, bukan seluruh viewport */
.page, .watch-page, .legal-page {
  background: var(--surface-page);
}

h1, h2, h3 { font-family: var(--font-display); color: var(--text-primary); }

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

.wordmark-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 16px;
}
.wordmark-link:hover { opacity: 0.85; }

.wordmark-icon {
  display: block;
  height: 64px;
  width: auto;
}

.wordmark-icon-lg { height: 96px; }

.wordmark-text {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.wordmark-indo { color: #10131a; }
.wordmark-seru { color: #dc2626; }

/* Varian logo kecil, sejajar di baris menu (bukan masthead besar terpisah) */
.wordmark-link-sm { gap: 8px; }
.wordmark-icon-sm { height: 24px; }
.wordmark-text-sm { font-size: 16px; }

/* --- Nav utilitas (Home, Kategori, Terbaru, Populer, Iklan, Masuk/Daftar) --- */

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.top-nav-left { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }

.top-nav-links { display: flex; gap: 18px; flex-wrap: wrap; }

.top-nav a {
  color: var(--text-secondary);
  text-decoration: none;
}
.top-nav a:hover { color: var(--accent); text-decoration: underline; }

.top-nav-auth {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  color: var(--text-primary) !important;
}
.top-nav-auth:hover { border-color: var(--accent); text-decoration: none !important; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-card);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1;
}
.theme-toggle:hover { background: var(--surface-tint); border-color: var(--accent); }

.theme-toggle-icon.icon-to-light { display: none; }
[data-theme="dark"] .theme-toggle-icon.icon-to-dark { display: none; }
[data-theme="dark"] .theme-toggle-icon.icon-to-light { display: inline; }

/* --- Masthead --- */

header.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 2px solid var(--text-primary);
}

header.top-centered {
  justify-content: center;
  align-items: center;
  padding-top: 8px;
  padding-bottom: 24px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stamp);
  margin: 0 0 2px;
}

h1 {
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
p.subtitle { color: var(--text-secondary); margin: 0; font-size: 13px; }

button {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface-card);
  padding: 8px 14px;
  color: var(--text-primary);
}

button:hover { background: var(--surface-tint); border-color: var(--text-secondary); }
button:disabled { opacity: 0.6; cursor: default; }

/* --- Filter / search desk --- */

.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

.filter-bar select,
.filter-bar input[type="search"] {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-card);
  color: var(--text-primary);
}

.filter-bar select {
  font-size: 15px;
  padding: 10px 14px;
  min-width: 160px;
}

.filter-bar input[type="search"] {
  flex: 1;
  min-width: 160px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.filter-bar input[type="search"]::placeholder { color: var(--text-muted); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* --- Hero / video pilihan --- */

.hero-section { margin-bottom: 28px; }

.hero-section .eyebrow { margin-bottom: 8px; }

#hero-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.hero-card {
  display: flex;
  flex-direction: column;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.hero-ad-slot {
  align-items: center;
  justify-content: center;
  min-height: 180px;
  background: var(--surface-tint);
}
.hero-ad-slot:hover { transform: none; box-shadow: none; }

.hero-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -12px rgba(28, 36, 48, 0.4);
}

.hero-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-tint);
  overflow: hidden;
}
.hero-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.hero-card:hover .hero-thumb img { transform: scale(1.04); }

.hero-play {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  background: rgba(28, 36, 48, 0.15);
}

.hero-play::after {
  content: "";
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(28, 36, 48, 0.55);
  backdrop-filter: blur(2px);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  transition: transform 0.2s ease, background 0.2s ease;
}
.hero-card:hover .hero-play::after {
  transform: translate(-50%, -50%) scale(1.1);
  background: var(--accent);
}
@media (prefers-reduced-motion: reduce) {
  .hero-thumb img, .hero-card, .hero-play::after { transition: none; }
  .hero-card:hover .hero-thumb img { transform: none; }
}

.hero-info {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  margin: 0;
}

/* --- Search beranda --- */

.home-search {
  display: flex;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto 32px;
}

.home-search input {
  flex: 1;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-card);
}

.home-search button {
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0 22px;
  font-weight: 700;
}
.home-search button:hover { background: var(--accent-hover); }

/* --- Chip kategori --- */

.chips-section { margin-bottom: 32px; }

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  font-family: var(--font-mono);
  font-size: 12px;
  text-decoration: none;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--card-spine, var(--border));
  color: var(--card-spine, var(--text-secondary));
  background: color-mix(in srgb, var(--card-spine, var(--text-muted)) 8%, white);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  display: inline-block;
}
.chip:hover {
  background: color-mix(in srgb, var(--card-spine, var(--text-muted)) 16%, white);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px -6px rgba(28, 36, 48, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  .chip { transition: none; }
  .chip:hover { transform: none; }
}
.chip.spine-1 { --card-spine: var(--spine-1); }
.chip.spine-2 { --card-spine: var(--spine-2); }
.chip.spine-3 { --card-spine: var(--spine-3); }
.chip.spine-4 { --card-spine: var(--spine-4); }
.chip.spine-5 { --card-spine: var(--spine-5); }
.chip.spine-6 { --card-spine: var(--spine-6); }

/* --- Baris video horizontal --- */

.video-row-section { margin-bottom: 32px; }

.row-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.row-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  position: relative;
  padding-left: 14px;
}
.row-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 4px;
  border-radius: 2px;
  background: var(--stamp);
}

.row-header a {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
}
.row-header a:hover { color: var(--accent); }

.video-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
}

.video-row .card {
  flex: 0 0 220px;
  scroll-snap-align: start;
}

/* --- Grid / kartu katalog --- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.grid-ad-slot {
  grid-column: 1 / -1;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.footer-ad-slot {
  min-height: 100px;
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.footer-ad-slot[hidden] { display: none; }

.card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--card-spine, var(--border));
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--card-spine, var(--border));
  box-shadow: 0 10px 22px -10px rgba(28, 36, 48, 0.4);
}

.card.spine-1 { --card-spine: var(--spine-1); }
.card.spine-2 { --card-spine: var(--spine-2); }
.card.spine-3 { --card-spine: var(--spine-3); }
.card.spine-4 { --card-spine: var(--spine-4); }
.card.spine-5 { --card-spine: var(--spine-5); }
.card.spine-6 { --card-spine: var(--spine-6); }

.thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-tint);
  overflow: hidden;
}

.thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.card:hover .thumb-wrap img { transform: scale(1.06); }

@media (prefers-reduced-motion: reduce) {
  .thumb-wrap img { transition: none; }
  .card:hover .thumb-wrap img { transform: none; }
}

.duration-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(28, 36, 48, 0.82);
  color: #fbf8f1;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: 3px;
  transform: rotate(-2deg);
}

.card-body { padding: 12px; }

.category-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  margin-bottom: 6px;
  color: var(--card-spine, var(--text-secondary));
  background: color-mix(in srgb, var(--card-spine, var(--text-muted)) 12%, white);
}
.category-chip.spine-1 { --card-spine: var(--spine-1); }
.category-chip.spine-2 { --card-spine: var(--spine-2); }
.category-chip.spine-3 { --card-spine: var(--spine-3); }
.category-chip.spine-4 { --card-spine: var(--spine-4); }
.category-chip.spine-5 { --card-spine: var(--spine-5); }
.category-chip.spine-6 { --card-spine: var(--spine-6); }

.card-title {
  font-size: 13.5px;
  font-weight: 500;
  margin: 0 0 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  margin: 0;
}

.empty-state, .loading-state {
  text-align: center;
  color: var(--text-secondary);
  padding: 60px 0;
  grid-column: 1 / -1;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 28px;
}

.page-btn {
  min-width: 34px;
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface-card);
  color: var(--text-primary);
  font: inherit;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
}

.page-btn:hover:not(:disabled) { background: var(--surface-tint); }
.page-btn:disabled { color: var(--text-muted); cursor: default; opacity: 0.6; }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.site-footer {
  margin: 40px auto 0;
  padding: 20px 40px 32px;
  border-top: 1px solid var(--border);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: 10px;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12.5px;
}
.footer-links a:hover { color: var(--text-primary); text-decoration: underline; }

.footer-copyright {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

/* --- Overlay pembuka (tampil sekali per sesi saat masuk beranda) --- */

.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(28, 36, 48, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
/* [hidden] harus menang atas "display: flex" di atas - kalau tidak, atribut
   hidden dari JS/HTML tidak akan benar-benar menyembunyikan elemen ini. */
.welcome-overlay[hidden] { display: none; }

.welcome-panel {
  position: relative;
  width: min(560px, 100%);
  max-height: 85vh;
  background: var(--surface-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.45);
}

.welcome-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: rgba(28, 36, 48, 0.75);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.welcome-close:hover { background: rgba(28, 36, 48, 0.92); }

.welcome-slot {
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-tint);
}

/* --- Notifikasi iklan setelah beberapa menit (muncul di semua halaman) --- */

.timed-ad-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 900;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  max-width: 300px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: 0 16px 32px -10px rgba(28, 36, 48, 0.4);
  animation: timed-ad-in 0.25s ease;
}

@keyframes timed-ad-in {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.timed-ad-message {
  flex: 1;
  text-align: left;
  background: none;
  border: none;
  font: inherit;
  font-size: 13px;
  color: var(--text-primary);
  padding: 8px 6px;
  cursor: pointer;
  border-radius: 6px;
}
.timed-ad-message:hover { background: var(--surface-tint); }

.timed-ad-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 6px;
}
.timed-ad-dismiss:hover { color: var(--text-primary); background: var(--surface-tint); }

@media (prefers-reduced-motion: reduce) {
  .timed-ad-toast { animation: none; }
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  .card:hover { transform: none; }
}

/* --- Toast deteksi AdBlock (kiri-bawah, biar tidak tabrakan dengan notifikasi iklan timer di kanan-bawah) --- */

.adblock-toast {
  left: 20px;
  right: auto;
  border-color: var(--stamp);
}

.adblock-toast-message {
  flex: 1;
  margin: 0;
  padding: 8px 6px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary);
}
