/* Adip Cinema. Satu tema gelap, latar hitam murni, aksen putih.
   Warna hanya untuk status: hijau bisa ditonton, kuning masih di HP, merah error.
   Tanpa gradasi dekoratif. Mobile-first, 360px ke atas. */

:root {
  --bg: #000000;
  --surface: #0d0d0d;
  --surface-2: #141414;
  --surface-3: #1f1f1f;
  --border: #262626;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --green: #4ade80;
  --yellow: #facc15;
  --red: #f87171;
  --radius: 8px;
  --radius-sm: 4px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

.wrap.narrow {
  max-width: 720px;
}

/* Header */

.site-header {
  padding-top: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.brand-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  margin-bottom: 16px;
}

.brand {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.count {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.search-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--muted);
}

.search {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.search::placeholder {
  color: var(--muted);
  opacity: 1;
}

.search:focus {
  outline: none;
  border-color: #ffffff;
}

/* Katalog: toolbar menempel di atas saat menggulir, supaya saring dan urut
   tetap terjangkau di daftar 123 judul. */

.catalog {
  padding-top: 20px;
  padding-bottom: 48px;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding-top: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-btn {
  min-height: 44px;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
}

.filter-btn:hover {
  color: var(--text);
  border-color: var(--muted);
}

.filter-btn.is-active {
  background: #ffffff;
  border-color: #ffffff;
  color: #000000;
}

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

.sort {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.result-count {
  margin: 16px 0;
  color: var(--muted);
  font-size: 14px;
}

.state {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
}

.state p {
  margin: 0 0 16px;
}

.state-error p {
  color: var(--red);
}

/* Grid poster: 3 kolom di HP, 6 kolom di desktop. */

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.card {
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
}

.card:active {
  transform: scale(0.98);
}

.poster {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px;
}

.poster-fallback-initial {
  margin: 0;
  font-size: 56px;
  line-height: 1;
  font-weight: 700;
  color: var(--text);
}

.poster-fallback-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.card-body {
  padding: 8px 2px 0;
}

.card-title {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.badge::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.badge-watchable {
  color: var(--green);
  border-color: #14532d;
}

.badge-hp {
  color: var(--yellow);
  border-color: #713f12;
}

/* Tombol */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: #ffffff;
  color: #000000;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-block {
  width: 100%;
}

.btn-link {
  min-height: 48px;
  padding: 12px 4px;
  background: transparent;
  border: 0;
  color: var(--yellow);
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Panduan */

.guide {
  padding-top: 40px;
  padding-bottom: 40px;
  border-top: 1px solid var(--border);
}

.guide h2 {
  margin: 0 0 16px;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.guide h3 {
  margin: 32px 0 12px;
  font-size: 17px;
  line-height: 1.3;
}

.guide p {
  margin: 0 0 12px;
  color: var(--muted);
  max-width: 65ch;
}

.guide ol {
  margin: 0;
  padding-left: 24px;
  color: var(--muted);
}

.guide ol li {
  margin-bottom: 12px;
  padding-left: 4px;
  max-width: 65ch;
}

.guide ol li::marker {
  color: var(--text);
  font-weight: 600;
}

/* Footer */

.site-footer {
  padding-top: 40px;
  padding-bottom: 48px;
  border-top: 1px solid var(--border);
}

.site-footer h2 {
  margin: 0 0 16px;
  font-size: 22px;
  line-height: 1.25;
}

.site-footer p {
  margin: 0 0 12px;
  color: var(--muted);
  max-width: 65ch;
}

.footer-brand {
  margin-top: 24px;
  color: var(--text);
  font-weight: 700;
}

/* Panel detail */

.detail-dialog,
.player-dialog {
  width: calc(100% - 24px);
  max-width: 560px;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden auto;
  box-shadow: 0 24px 64px rgb(0 0 0 / 0.8);
}

.detail-dialog::backdrop,
.player-dialog::backdrop {
  background: rgb(0 0 0 / 0.8);
}

.detail {
  padding: 16px 16px 24px;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.detail-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.detail-poster {
  margin-bottom: 16px;
  max-width: 240px;
}

.detail-poster .poster {
  background: var(--surface-3);
}

.detail-poster .poster-fallback-initial {
  font-size: 72px;
}

.detail-synopsis {
  margin: 12px 0 20px;
  color: var(--muted);
}

.detail-facts {
  margin: 0 0 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.detail-facts dt {
  color: var(--muted);
  font-size: 13px;
}

.detail-facts dd {
  margin: 2px 0 0;
}

.detail-locations {
  margin: 0 0 20px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.detail-locations h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.location {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.location:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.location + .location {
  margin-top: 12px;
}

.location p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.location .location-path {
  color: var(--text);
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.play-source {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.detail-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* Pemutar */

.player {
  padding: 16px;
}

.player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.player-title {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.player-frame {
  aspect-ratio: 16 / 9;
  background: #000000;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.player-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.btn-close {
  min-height: 44px;
  flex: none;
}

.noscript {
  padding: 16px;
  color: var(--yellow);
  text-align: center;
}

/* Tablet ke atas */

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }

  .toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .sort {
    width: auto;
    min-width: 180px;
  }

  .card-title {
    font-size: 15px;
  }

  .detail-facts {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none;
  }
}
