/* =========================================================
   KOJIXAC · FILM CATALOGUE
   Vintage Soviet / Retro Dark Aesthetic
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Marck+Script&family=Playfair+Display:ital,wght@0,600;0,700;1,400;1,600&family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&family=Oswald:wght@400;500;600&display=swap');

:root {
  /* Dark (default) */
  --bg:          #0a0805;
  --bg-warm:     #130d08;
  --bg-board:    #0f0b07;
  --paper:       #c4a070;
  --paper-light: #d8ba8a;
  --paper-dark:  #a07848;
  --paper-fade:  rgba(196, 160, 112, 0.12);
  --rust:        #b8522a;
  --rust-light:  #d46a38;
  --gold:        #c8941e;
  --gold-light:  #dba830;
  --gold-glow:   rgba(200, 148, 30, 0.22);
  --sepia:       #7a5630;
  --ink:         #e8d4b4;
  --ink-muted:   rgba(220, 200, 160, 0.72);
  --ink-faint:   rgba(196, 172, 128, 0.48);
  --line:        rgba(196, 160, 112, 0.12);
  --line-strong: rgba(196, 160, 112, 0.22);
  --shadow-sm:   0 4px 20px rgba(0, 0, 0, 0.6);
  --shadow-md:   0 8px 36px rgba(0, 0, 0, 0.7);
  --shadow-lg:   0 20px 64px rgba(0, 0, 0, 0.8);
  --radius-card: 6px;
  --radius-pill: 999px;
  --transition:  200ms ease;
}

html[data-theme="light"] {
  --bg:          #1a1208;
  --bg-warm:     #231808;
  --bg-board:    #0f0b07;
  --paper:       #c4a070;
  --paper-light: #d8ba8a;
  --paper-dark:  #a07848;
  --paper-fade:  rgba(196, 160, 112, 0.14);
  --rust:        #b8522a;
  --gold:        #c8941e;
  --gold-light:  #dba830;
  --ink:         #e8d4b4;
  --ink-muted:   rgba(220, 200, 160, 0.72);
  --ink-faint:   rgba(196, 172, 128, 0.48);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }

/* ── Body ── */
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 100% 60% at 50% 0%, rgba(200, 148, 30, 0.06), transparent 50%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(184, 82, 42, 0.05), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
  background-size: auto, auto, 300px 300px;
  color: var(--ink);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 17px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ── Shell ── */
.page-shell {
  position: relative;
  width: min(1240px, calc(100% - 24px));
  margin: 0 auto;
  padding: 28px 0 60px;
}

/* ══════════════════════════════════════════
   HERO
══════════════════════════════════════════ */
.hero {
  position: relative;
  overflow: hidden;
  padding: 52px 44px 44px;
  border: 2px solid rgba(196, 160, 112, 0.2);
  border-radius: 8px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(200, 148, 30, 0.1), transparent 55%),
    radial-gradient(ellipse 40% 50% at 100% 100%, rgba(184, 82, 42, 0.08), transparent 50%),
    linear-gradient(180deg, #16100a 0%, #100c07 100%);
  box-shadow:
    0 0 0 1px rgba(196, 160, 112, 0.08) inset,
    var(--shadow-lg);
  margin-bottom: 28px;
}

/* Decorative top stripe like a film or old book binding */
.hero::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(90deg,
    var(--rust), var(--gold), var(--rust-light), var(--gold-light), var(--rust)
  );
  opacity: 0.8;
}

/* Aged corner vignette */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 100% 100% at 50% 50%,
    transparent 60%, rgba(0,0,0,0.4) 100%);
  pointer-events: none;
}

/* Controls */
.hero__controls {
  position: absolute;
  top: 18px; right: 20px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero__meta {
  color: var(--ink-faint);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 14px;
}

/* Film strip decoration */
.hero__film-strip {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 56px;
  overflow: hidden;
  opacity: 0.35;
  mask-image: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
  pointer-events: none;
  z-index: 0;
}

.film-strip__track {
  display: flex;
  gap: 4px;
  padding: 4px;
}

.film-strip__frame {
  flex-shrink: 0;
  width: 42px;
  height: 52px;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid rgba(196, 160, 112, 0.14);
  background: rgba(255,255,255,0.03);
}

.film-strip__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(80%) contrast(0.85);
}

/* Ribbon */
.hero__ribbon { position: relative; z-index: 1; }

.hero__eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 14px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  opacity: 0.82;
}

.hero__title {
  margin: 0;
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: clamp(56px, 11vw, 118px);
  line-height: 0.9;
  color: var(--paper-light);
  text-shadow:
    0 0 60px rgba(200, 148, 30, 0.18),
    2px 4px 0 rgba(0,0,0,0.4);
  letter-spacing: -0.01em;
}

.hero__tagline {
  max-width: 640px;
  margin: 18px 0 0;
  font-family: 'Marck Script', cursive;
  font-size: clamp(20px, 2.8vw, 30px);
  line-height: 1.4;
  color: var(--paper);
}

.hero__description {
  max-width: 580px;
  margin: 12px 0 0;
  color: var(--ink-faint);
  font-style: italic;
  font-size: 16px;
  line-height: 1.6;
}

/* Stats */
.hero__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 32px;
  position: relative; z-index: 1;
}

.stat-card {
  padding: 14px 16px;
  border: 1px solid rgba(196, 160, 112, 0.2);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

/* Old stamp/label look */
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    rgba(196, 160, 112, 0.06) 0%, transparent 50%);
}

.stat-card--skeleton .stat-card__value {
  opacity: 0.3;
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

.stat-card__value {
  display: block;
  font-family: 'Oswald', sans-serif;
  font-size: 30px;
  line-height: 1;
  color: var(--gold);
  letter-spacing: 0.04em;
  position: relative;
}

.stat-card__label {
  display: block;
  margin-top: 6px;
  color: var(--ink-faint);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.06em;
  position: relative;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  padding: 0;
  border: 1px solid rgba(196, 160, 112, 0.22);
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.4);
  color: var(--ink-muted);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  transition: transform var(--transition), color var(--transition), box-shadow var(--transition);
}

.theme-toggle:hover, .theme-toggle:focus-visible {
  transform: translateY(-1px);
  color: var(--gold);
  box-shadow: 0 0 20px var(--gold-glow);
  outline: none;
}

.theme-toggle__icon {
  display: inline-flex;
  width: 18px; height: 18px;
}

.theme-toggle__icon svg {
  width: 100%; height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle__icon--moon { display: inline-flex; }
.theme-toggle__icon--sun { display: none; }
html[data-theme="light"] .theme-toggle__icon--moon { display: none; }
html[data-theme="light"] .theme-toggle__icon--sun { display: inline-flex; }

/* ══════════════════════════════════════════
   CATALOG TOOLBAR
══════════════════════════════════════════ */
.catalog { display: grid; gap: 22px; }

.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
}

.catalog-toolbar__label {
  margin: 0;
  color: var(--ink-faint);
  font-style: italic;
  font-size: 15px;
}

.catalog-sort {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--line);
}

.sort-btn {
  padding: 7px 16px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-muted);
  font-family: 'Oswald', sans-serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  transition: background var(--transition), color var(--transition);
}

.sort-btn:hover { color: var(--ink); background: rgba(196, 160, 112, 0.08); }

.sort-btn.is-active {
  background: var(--rust);
  color: #f0d8b0;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(184, 82, 42, 0.3);
}

/* ══════════════════════════════════════════
   SECTION BANNER
══════════════════════════════════════════ */
.catalog-section { display: grid; gap: 20px; }

.section-banner {
  position: relative;
  overflow: hidden;
  padding: 28px 36px;
  border-radius: 6px;
  border: 1px solid rgba(196, 160, 112, 0.22);
  background:
    radial-gradient(ellipse 60% 100% at 20% 50%, rgba(184, 82, 42, 0.18), transparent),
    radial-gradient(ellipse 40% 80% at 90% 40%, rgba(200, 148, 30, 0.12), transparent),
    linear-gradient(135deg, #2a1608 0%, #1c1008 50%, #221408 100%);
  box-shadow: var(--shadow-md);
}

.section-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.6;
  mix-blend-mode: overlay;
}

.section-banner__kicker {
  margin: 0 0 6px;
  color: var(--gold);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  opacity: 0.8;
}

.section-banner__title {
  margin: 0;
  font-family: 'Playfair Display', serif;
  font-size: clamp(38px, 7vw, 72px);
  line-height: 0.95;
  color: var(--paper-light);
  text-shadow: 0 4px 20px rgba(0,0,0,0.5);
  position: relative; z-index: 1;
}

.section-banner__subtitle {
  max-width: 560px;
  margin: 10px 0 0;
  color: var(--ink-muted);
  font-style: italic;
  font-size: 16px;
  line-height: 1.45;
  position: relative; z-index: 1;
}

/* ══════════════════════════════════════════
   FILM GRID — POSTER CARDS
══════════════════════════════════════════ */
.film-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 22px;
}

/* Loading */
.loading-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 64px 24px;
}

.loading-spinner {
  width: 44px; height: 44px;
  border: 3px solid rgba(196, 160, 112, 0.12);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.loading-text {
  margin: 0;
  color: var(--ink-faint);
  font-style: italic;
  font-size: 15px;
}

.catalog-empty {
  grid-column: 1 / -1;
  padding: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0,0,0,0.3);
  color: var(--ink-faint);
  font-style: italic;
  text-align: center;
}

/* ── Film card (vertical poster style) ── */
.film-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 4px;
  border: 1px solid rgba(196, 160, 112, 0.16);
  background: #12100c;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.6),
    var(--shadow-md);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  cursor: pointer;
}

.film-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255,255,255,0.04);
  pointer-events: none;
}

.film-card:hover {
  transform: translateY(-5px) rotate(0.3deg);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.8),
    0 20px 50px rgba(0,0,0,0.8),
    0 0 30px rgba(200, 148, 30, 0.12);
  border-color: rgba(196, 160, 112, 0.32);
}

.film-card--liked {
  border-color: rgba(184, 82, 42, 0.3);
}

/* Poster area */
.film-card__poster {
  position: relative;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  background: #0a0806;
  flex-shrink: 0;
}

.film-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(25%) contrast(1.05) brightness(0.92);
  transition: filter var(--transition), transform 300ms ease;
}

.film-card:hover .film-card__img {
  filter: sepia(10%) contrast(1.08) brightness(1.0);
  transform: scale(1.03);
}

.film-card__poster-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-family: 'Playfair Display', serif;
  font-size: 40px;
  color: rgba(196, 160, 112, 0.4);
  background:
    radial-gradient(ellipse at 40% 40%, hsl(calc(var(--hue-a, 30)) 25% 14%), transparent 60%),
    radial-gradient(ellipse at 70% 70%, hsl(calc(var(--hue-b, 15)) 20% 10%), transparent 50%),
    linear-gradient(160deg, #1a120a, #0f0906);
}

/* Liked badge */
.film-card__liked-badge {
  position: absolute;
  top: 10px; right: 10px;
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(184, 82, 42, 0.88);
  color: #f0d8b0;
  font-size: 13px;
  box-shadow: 0 2px 12px rgba(184, 82, 42, 0.4);
  z-index: 2;
}

/* Rating overlay at bottom of poster */
.film-card__rating-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 24px 12px 10px;
  background: linear-gradient(to top,
    rgba(10, 8, 5, 0.9) 40%, transparent);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  z-index: 1;
}

.film-card__stars {
  display: flex;
  gap: 1px;
}

.star {
  font-size: 12px;
  line-height: 1;
  color: rgba(200, 148, 30, 0.22);
}
.star.is-full { color: var(--gold); }
.star.is-half {
  position: relative;
  color: rgba(200, 148, 30, 0.22);
}
.star.is-half::after {
  content: "★";
  position: absolute;
  left: 0; top: 0;
  width: 50%;
  overflow: hidden;
  color: var(--gold);
}

.film-card__rating-num {
  font-family: 'Oswald', sans-serif;
  font-size: 16px;
  letter-spacing: 0.06em;
  color: var(--gold);
}

/* Rewatch badge on poster */
.film-card__rewatch-badge {
  position: absolute;
  top: 10px; left: 10px;
  padding: 3px 8px;
  border: 1px solid rgba(92, 180, 160, 0.6);
  border-radius: 2px;
  font-family: 'Oswald', sans-serif;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(92, 180, 160, 0.9);
  background: rgba(0, 0, 0, 0.6);
  z-index: 2;
}

/* Card body */
.film-card__body {
  display: flex;
  flex-direction: column;
  padding: 14px 14px 12px;
  background: linear-gradient(to bottom, #16110d, #120f0a);
  border-top: 1px solid rgba(196, 160, 112, 0.1);
  flex: 1;
}

.film-card__year {
  margin: 0 0 4px;
  color: var(--ink-faint);
  font-family: 'Oswald', sans-serif;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.film-card__title {
  margin: 0;
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  line-height: 1.2;
  color: var(--paper-light);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.film-card__review {
  margin: 8px 0 0;
  color: var(--ink-muted);
  font-style: italic;
  font-size: 13px;
  line-height: 1.55;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.film-card__date {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(196, 160, 112, 0.08);
  color: var(--ink-faint);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 12px;
}

/* ══════════════════════════════════════════
   LOAD MORE
══════════════════════════════════════════ */
.load-more-wrap {
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.load-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 32px;
  border: 1px solid rgba(196, 160, 112, 0.28);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--paper);
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  letter-spacing: 0.14em;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.load-more-btn:hover {
  background: rgba(184, 82, 42, 0.12);
  border-color: rgba(184, 82, 42, 0.5);
  box-shadow: 0 0 24px rgba(184, 82, 42, 0.15);
  transform: translateY(-2px);
}

.load-more-btn__icon { transition: transform 200ms ease; }
.load-more-btn:hover .load-more-btn__icon { transform: translateY(3px); }

/* ══════════════════════════════════════════
   FOOTER
══════════════════════════════════════════ */
.site-footer {
  margin-top: 44px;
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.site-footer__credit {
  margin: 0;
  color: var(--ink-faint);
  font-style: italic;
  font-size: 14px;
}

.site-footer__link {
  color: var(--ink-muted);
  text-decoration: none;
  border-bottom: 1px solid rgba(196, 160, 112, 0.22);
  transition: color var(--transition), border-color var(--transition);
}

.site-footer__link:hover {
  color: var(--gold);
  border-color: var(--gold);
}

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 900px) {
  .hero__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .film-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 14px, 1240px);
    padding-top: 14px;
  }
  .hero {
    padding: 48px 18px 28px;
  }
  .hero__controls { top: 12px; right: 14px; }
  .catalog-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .catalog-sort {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .film-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .section-banner { padding: 22px 20px; }
}

@media (max-width: 380px) {
  .film-grid { grid-template-columns: 1fr; }
}
