/* ──────────────────────────────────────────────────────────────────────────────
   WhereVOD — Design System
   Aesthetic: Deep cinema editorial — coal dark, warm amber gold, Bebas Neue
   ────────────────────────────────────────────────────────────────────────────── */

/* ── TOKENS (light) ──────────────────────────────────────────────────────────── */
:root {
  --bg:              #f4f1ea;
  --surface:         #ffffff;
  --surface-2:       #eeeae0;
  --border:          #ddd8cc;
  --border-hi:       #bfb8a8;
  --text:            #1a1712;
  --text-2:          #605a4e;
  --accent:          #b87318;
  --accent-faint:    rgba(184, 115, 24, 0.1);
  --accent-glow:     rgba(184, 115, 24, 0.22);
  --badge-movie:     #1d4ed8;
  --badge-series:    #7c3aed;

  --notice-warn-bg:     rgba(146, 85, 0, 0.08);
  --notice-warn-text:   #7a4400;
  --notice-warn-border: rgba(146, 85, 0, 0.22);
  --notice-err-bg:      rgba(185, 28, 28, 0.07);
  --notice-err-text:    #991b1b;
  --notice-err-border:  rgba(185, 28, 28, 0.22);
}

/* ── TOKENS (dark) ───────────────────────────────────────────────────────────── */
.dark {
  --bg:              #080810;
  --surface:         #0f0f1c;
  --surface-2:       #171727;
  --border:          #222238;
  --border-hi:       #36364e;
  --text:            #eaeaf5;
  --text-2:          #7070a8;
  --accent:          #e8b446;
  --accent-faint:    rgba(232, 180, 70, 0.08);
  --accent-glow:     rgba(232, 180, 70, 0.18);
  --badge-movie:     #2563eb;
  --badge-series:    #9333ea;

  --notice-warn-bg:     rgba(180, 110, 0, 0.12);
  --notice-warn-text:   #f5c145;
  --notice-warn-border: rgba(232, 180, 70, 0.22);
  --notice-err-bg:      rgba(220, 38, 38, 0.1);
  --notice-err-text:    #f87171;
  --notice-err-border:  rgba(248, 113, 113, 0.22);
}

/* ── RESET ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[x-cloak] { display: none !important; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── PAGE SHELL ──────────────────────────────────────────────────────────────── */
.page-wrapper {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

.content {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 7rem;
}

/* ── AMBIENT BACKGROUND ──────────────────────────────────────────────────────── */
.bg-scene {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0;
  transition: opacity 0.3s;
}

.dark .orb { opacity: 0.07; }
.orb:not(.dark .orb) { opacity: 0.05; }

.orb-a {
  width: 700px; height: 700px;
  top: -180px; left: -200px;
  background: var(--accent);
}

.orb-b {
  width: 550px; height: 550px;
  bottom: 5%; right: -140px;
  background: var(--badge-series);
}

/* ── HEADER ──────────────────────────────────────────────────────────────────── */
.site-header {
  text-align: center;
  margin-bottom: 3rem;
  animation: slideDown 0.55s ease both;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2em;
  font-family: 'Bebas Neue', cursive;
  font-size: clamp(3.25rem, 9vw, 6rem);
  line-height: 1;
  letter-spacing: 0.12em;
  margin-bottom: 0.6rem;
}

.brand-where { color: var(--text-2); }
.brand-vod   { color: var(--accent); }

.tagline {
  font-size: 0.8125rem;
  color: var(--text-2);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── SEARCH SECTION ──────────────────────────────────────────────────────────── */
.search-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  animation: slideUp 0.55s 0.08s ease both;
  box-shadow: 0 2px 32px rgba(0,0,0,0.05);
}

.dark .search-section {
  box-shadow: 0 2px 48px rgba(0,0,0,0.35);
}

/* Search field */
.search-field-wrap {
  position: relative;
  margin-bottom: 1.25rem;
}

.search-field {
  width: 100%;
  padding: 1rem 3rem 1rem 1.25rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 1.2rem;
  font-weight: 400;
  background: var(--surface-2);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 0.75rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.search-field::placeholder { color: var(--text-2); }

.search-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.search-field::-webkit-search-cancel-button { display: none; }

.search-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-2);
  pointer-events: none;
  display: flex;
}

/* ── FILTERS ─────────────────────────────────────────────────────────────────── */
.filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Platform chips */
.chips {
  display: flex;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 1px;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 0.3rem 0.8rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  line-height: 1.4;
}

.chip:hover {
  border-color: var(--border-hi);
  color: var(--text);
}

.chip--on {
  border-color: var(--accent);
  background: var(--accent-faint);
  color: var(--accent);
}

/* Type segmented */
.type-seg {
  display: flex;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
}

.seg-btn {
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  background: transparent;
  color: var(--text-2);
  border: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
  line-height: 1.4;
}

.seg-btn:not(:last-child) {
  border-right: 1.5px solid var(--border);
}

.seg-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.seg-btn--on {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.dark .seg-btn--on { color: #0a0a14; }

/* ── NOTICES ─────────────────────────────────────────────────────────────────── */
/* Clear visual separation from the search section above */
.notices {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 2rem;
}

.notice {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.8rem 1.125rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  animation: slideUp 0.25s ease both;
}

/* Hint */
.notice--hint {
  justify-content: center;
  background: var(--surface-2);
  border: 1.5px dashed var(--border-hi);
  color: var(--text-2);
  animation: slideUp 0.25s ease both, hintPulse 2.8s 0.5s ease-in-out infinite;
}

.notice--hint kbd {
  font-family: 'DM Sans', monospace;
  font-weight: 700;
  font-size: 0.8em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: 3px;
  padding: 0.1em 0.4em;
}

/* Loading */
.notice--loading {
  justify-content: center;
  background: transparent;
  color: var(--text-2);
  font-size: 0.8125rem;
}

/* Warning (quota) */
.notice--warn {
  background: var(--notice-warn-bg);
  border: 1px solid var(--notice-warn-border);
  color: var(--notice-warn-text);
}

/* Error (502) */
.notice--error {
  background: var(--notice-err-bg);
  border: 1px solid var(--notice-err-border);
  color: var(--notice-err-text);
}

/* Stale */
.notice--stale {
  background: var(--notice-warn-bg);
  border: 1px solid var(--notice-warn-border);
  color: var(--notice-warn-text);
}

.notice-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.85;
}

.notice-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0.5;
  padding: 0 0.125rem;
  transition: opacity 0.12s;
}

.notice-close:hover { opacity: 1; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-hi);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}

/* ── EMPTY STATE ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 5rem 1rem;
  animation: slideUp 0.35s ease both;
}

.empty-glyph {
  font-family: 'Bebas Neue', cursive;
  font-size: 5rem;
  color: var(--border-hi);
  letter-spacing: 0.2em;
  line-height: 1;
  margin-bottom: 1.25rem;
}

.empty-title {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.empty-sub {
  font-size: 0.875rem;
  color: var(--text-2);
}

/* ── RESULTS GRID ────────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.125rem;
  animation: slideUp 0.4s 0.05s ease both;
}

@media (min-width: 560px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 820px) { .grid { grid-template-columns: repeat(3, 1fr); } }

/* ── CARD ────────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hi);
}

.dark .card:hover { box-shadow: 0 14px 40px rgba(0,0,0,0.45); }
.card:not(.dark .card):hover { box-shadow: 0 10px 30px rgba(0,0,0,0.1); }

/* Poster */
.card-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--surface-2);
  overflow: hidden;
}

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

.poster-blank {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.poster-initials {
  font-family: 'Bebas Neue', cursive;
  font-size: 3.5rem;
  color: var(--border-hi);
  letter-spacing: 0.1em;
  user-select: none;
}

.type-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.175rem 0.45rem;
  border-radius: 4px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #fff;
}

.type-badge--movie  { background: var(--badge-movie); }
.type-badge--series { background: var(--badge-series); }

/* Card body */
.card-body {
  padding: 0.875rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  flex: 1;
}

.card-year {
  font-size: 0.7rem;
  color: var(--text-2);
  flex-shrink: 0;
}

/* Rating */
.rating {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rating-track {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.rating-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.45s ease;
}

.rating-val {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  min-width: 2.75rem;
  text-align: right;
}

/* Overview */
.card-overview {
  font-size: 0.8125rem;
  color: var(--text-2);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

/* Platforms */
.platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.625rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.platform-logo-wrap {
  display: block;
  opacity: 0.55;
  transition: opacity 0.18s;
}

.platform-logo-wrap:hover { opacity: 1; }

.platform-logo {
  height: 20px;
  width: auto;
}

.platform-name {
  font-size: 0.7rem;
  padding: 0.2rem 0.45rem;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}

/* ── ANIMATIONS ──────────────────────────────────────────────────────────────── */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes hintPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ── SCROLLBAR ───────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 3px; }
