:root{
  --bg:#08080A;
  --panel:#0F0F12;
  --text:#F0F0F0;
  --dim:#5C5C66;
  --red:#FF3D5A;
  --blue:#08D9D6;
  --border: rgba(255, 255, 255, 0.05);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*{box-sizing:border-box; margin:0; padding:0;}
html, body { height: 100%; }
body{
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Mono', monospace;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { -webkit-user-drag: none; user-select: none; }

/* CRT SCANLINES */
.crt-overlay {
  position: fixed; inset: 0; z-index: 999; pointer-events: none;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.15) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.03));
  background-size: 100% 3px, 3px 100%;
  opacity: 0.4;
}

/* MASTHEAD */
.masthead {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 48px;
  padding-top: max(20px, var(--safe-top));
  background: linear-gradient(to bottom, rgba(8,8,10,1), transparent);
  gap: 24px;
}
.masthead-row {
  display: flex; align-items: center; gap: 16px;
}
.brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px; letter-spacing: 0.1em;
  color: var(--red);
  text-shadow: 0 0 10px rgba(255, 61, 90, 0.6);
  flex-shrink: 0;
}
.nav-links { display: flex; gap: 32px; }
.nav-links a {
  font-size: 12px; letter-spacing: 0.1em; color: var(--dim);
  transition: color 0.2s; text-transform: uppercase;
  white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active { color: var(--blue); text-shadow: 0 0 8px var(--blue); }
.search-wrap { flex: 0 1 auto; display: flex; justify-content: flex-end; }
.search-wrap input {
  background: transparent; border: none; border-bottom: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 12px; letter-spacing: 0.1em;
  padding: 8px 0; outline: none; text-align: right; width: 220px; text-transform: uppercase;
}
.search-wrap input:focus { border-color: var(--blue); }
.search-wrap input::placeholder { color: var(--dim); }

/* MENU TOGGLE (hidden on desktop) */
.menu-toggle {
  display: none; flex-direction: column; justify-content: space-between;
  width: 28px; height: 22px; cursor: pointer; padding: 0;
}
.menu-toggle span {
  display: block; height: 2px; width: 100%; background: var(--blue);
  transition: all 0.3s; box-shadow: 0 0 6px var(--blue);
}
.menu-toggle.open span:nth-child(1) { transform: translateY(10px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-10px) rotate(-45deg); }

/* HERO */
.hero {
  position: relative; height: 100vh; min-height: 700px;
  display: flex; align-items: flex-end; padding: 0 48px 100px;
}
.hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background-size: cover; background-position: center;
  transform: scale(1.1);
  filter: contrast(1.2) saturate(0.8);
}
.hero-bg::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg) 0%, rgba(8,8,10,0.4) 50%, rgba(8,8,10,0.8) 100%);
}
.hero-content { max-width: 800px; }
.hero-meta-mono {
  font-size: 11px; letter-spacing: 0.2em; color: var(--blue); margin-bottom: 16px;
  text-shadow: 0 0 8px var(--blue);
}
.hero-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(56px, 10vw, 140px); line-height: 0.9;
  letter-spacing: 0.02em; margin-bottom: 16px;
  text-shadow: 4px 4px 0px rgba(255, 61, 90, 0.3);
}
.hero-sub { font-size: 13px; color: var(--dim); margin-bottom: 24px; display: flex; gap: 16px; text-transform: uppercase; flex-wrap: wrap; }
.hero-overview {
  font-family: 'Space Mono', monospace; font-size: 14px; line-height: 1.7;
  color: #C0C0C0; max-width: 600px; margin-bottom: 40px;
}
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }

.btn {
  font-family: 'Space Mono', monospace; font-size: 12px; font-weight: 700;
  letter-spacing: 0.15em; padding: 14px 32px; text-transform: uppercase;
  transition: all 0.2s;
}
.btn-primary { background: var(--red); color: #000; }
.btn-primary:hover { background: #fff; box-shadow: 0 0 20px var(--red); }
.btn-ghost { border: 1px solid var(--blue); color: var(--blue); }
.btn-ghost:hover { background: var(--blue); color: #000; box-shadow: 0 0 15px var(--blue); }

/* ARCHIVE GRID */
main { padding: 80px 48px; }
.section { margin-bottom: 80px; }
.section-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  border-bottom: 2px solid var(--blue); padding-bottom: 8px; margin-bottom: 32px;
  gap: 16px;
}
.section-title {
  font-family: 'Bebas Neue', sans-serif; font-size: 42px; letter-spacing: 0.02em;
  line-height: 1;
}
.section-sub { font-size: 11px; color: var(--dim); letter-spacing: 0.1em; text-transform: uppercase; text-align: right; }

/* THE PUSH-BACK GRID */
.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 4px;
}
.archive-item {
  position: relative; aspect-ratio: 2/3; overflow: hidden;
  cursor: pointer; background: #000;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s, filter 0.4s;
}
.archive-item img {
  width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(80%) brightness(0.6) contrast(1.1);
  transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.archive-item .overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, transparent 60%);
  opacity: 0; transition: opacity 0.3s;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 16px;
  border: 2px solid transparent;
}
.archive-item .item-title {
  font-family: 'Bebas Neue', sans-serif; font-size: 24px; letter-spacing: 0.02em;
  transform: translateY(10px); transition: transform 0.3s;
}
.archive-item .item-meta {
  font-size: 10px; color: var(--blue); margin-top: 4px; text-transform: uppercase;
  transform: translateY(10px); transition: transform 0.3s 0.05s;
}

/* Always show overlay info on touch devices */
@media (hover: none) {
  .archive-item .overlay { opacity: 1; background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, transparent 70%); }
  .archive-item .item-title,
  .archive-item .item-meta { transform: translateY(0); }
  .archive-item img { filter: grayscale(40%) brightness(0.8) contrast(1.1); }
}

/* The Magic Hover Effect */
@media (hover: hover) {
  .archive-grid:hover .archive-item:not(:hover) {
    transform: scale(0.98);
    opacity: 0.3;
    filter: blur(2px);
  }
  .archive-item:hover img {
    filter: grayscale(0%) brightness(1.1) contrast(1.2);
    transform: scale(1.08);
  }
  .archive-item:hover .overlay {
    opacity: 1;
    border-color: var(--red);
    box-shadow: inset 0 0 20px rgba(255, 61, 90, 0.3);
  }
  .archive-item:hover .item-title,
  .archive-item:hover .item-meta { transform: translateY(0); }
}

.skeleton {
  background: linear-gradient(90deg, #111 25%, #1a1a1a 50%, #111 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  width: 100%; height: 100%;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.empty-state { grid-column: 1 / -1; padding: 100px 20px; text-align: center; color: var(--dim); font-family: 'Bebas Neue'; font-size: 32px; letter-spacing: 0.05em; }

/* F1 LIVE CONTAINER */
.live-container {
  margin-top: 20px;
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 80vh;
  border: 2px solid var(--red);
  box-shadow: 0 0 40px rgba(255, 61, 90, 0.3), 0 0 80px rgba(8, 217, 214, 0.1);
  position: relative;
}
.live-container::before {
  content: ''; position: absolute; top: -2px; left: -2px; right: -2px; bottom: -2px;
  border: 1px solid var(--blue); pointer-events: none;
  box-shadow: 0 0 15px var(--blue);
}
.live-container iframe { width: 100%; height: 100%; border: none; display: block; }

/* DOSSIER MODAL */
.dossier {
  position: fixed; inset: 0; z-index: 200; display: flex;
  background: rgba(0,0,0,0.9); opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.dossier.open { opacity: 1; pointer-events: auto; }
.dossier-left {
  flex: 1.4; background-size: cover; background-position: center;
  transform: scale(1.1); transition: transform 0.5s;
  border-right: 3px solid var(--blue);
}
.dossier.open .dossier-left { transform: scale(1); }
.dossier-right {
  flex: 1; background: var(--bg); padding: 60px 40px;
  overflow-y: auto; transform: translateX(40px); opacity: 0;
  transition: transform 0.4s 0.1s, opacity 0.4s 0.1s;
  position: relative;
  -webkit-overflow-scrolling: touch;
}
.dossier.open .dossier-right { transform: translateX(0); opacity: 1; }
.dossier-close {
  position: absolute; top: 24px; right: 24px; font-size: 12px;
  color: var(--dim); transition: color 0.2s; z-index: 5;
  padding: 8px;
}
.dossier-close:hover { color: var(--red); }
.dossier-kicker { font-size: 11px; color: var(--blue); letter-spacing: 0.2em; margin-bottom: 12px; text-shadow: 0 0 8px var(--blue); }
.dossier-title { font-family: 'Bebas Neue', sans-serif; font-size: 64px; line-height: 0.9; margin-bottom: 20px; }
.dossier-meta { display: flex; gap: 16px; font-size: 12px; color: var(--dim); margin-bottom: 24px; text-transform: uppercase; flex-wrap: wrap; }
.dossier-genres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 32px; }
.genre-chip { font-size: 10px; border: 1px solid var(--border); padding: 6px 12px; color: var(--text); text-transform: uppercase; }
.dossier-section { font-size: 11px; color: var(--red); letter-spacing: 0.2em; margin-bottom: 12px; text-shadow: 0 0 8px var(--red); }
.dossier-overview { font-family: 'Space Mono', monospace; font-size: 14px; line-height: 1.7; color: #C0C0C0; margin-bottom: 32px; }
.cast-rail { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; margin-bottom: 32px; -webkit-overflow-scrolling: touch; }
.cast-card { flex: 0 0 80px; }
.cast-photo { width: 80px; height: 80px; border-radius: 50%; background-size: cover; margin-bottom: 8px; filter: grayscale(50%); border: 1px solid var(--border); }
.cast-name { font-size: 11px; text-align: center; }
.cast-role { font-size: 10px; color: var(--dim); text-align: center; }
.dossier-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ADBLOCK POPUP */
.adblock-scrim {
  position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,0.95);
  display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
  padding: 20px;
}
.adblock-scrim.open { opacity: 1; pointer-events: auto; }
.adblock-card {
  width: 100%; max-width: 400px; background: var(--panel); padding: 40px;
  text-align: center; border: 1px solid var(--blue); box-shadow: 0 0 30px rgba(8, 217, 214, 0.2);
  position: relative; max-height: 90vh; overflow-y: auto;
}
.adblock-close { position: absolute; top: 16px; right: 16px; color: var(--dim); padding: 8px; }
.adblock-icon { width: 48px; height: 48px; margin: 0 auto 20px; color: var(--red); }
.adblock-title { font-family: 'Bebas Neue', sans-serif; font-size: 32px; margin-bottom: 12px; letter-spacing: 0.02em; }
.adblock-body { font-size: 13px; line-height: 1.6; color: var(--dim); margin-bottom: 24px; }
.adblock-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.adblock-link { padding: 12px; border: 1px solid var(--border); text-align: left; transition: border-color 0.2s; }
.adblock-link:hover { border-color: var(--red); }
.adblock-link-name { font-size: 13px; font-weight: 700; }
.adblock-link-sub { font-size: 11px; color: var(--dim); }

/* FOOTER */
.site-footer {
  padding: 48px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); text-transform: uppercase;
  gap: 16px;
}

/* ============================================================
   MOBILE / TABLET RESPONSIVE
   ============================================================ */

/* TABLET */
@media (max-width: 1024px) {
  .masthead { padding: 16px 24px; padding-top: max(16px, var(--safe-top)); }
  .nav-links { gap: 20px; }
  .search-wrap input { width: 160px; }
  main { padding: 60px 24px; }
  .hero { padding: 0 24px 80px; }
  .section-title { font-size: 36px; }
  .dossier-right { padding: 48px 28px; }
  .dossier-title { font-size: 52px; }
}

/* MOBILE */
@media (max-width: 768px) {
  .masthead {
    padding: 12px 16px;
    padding-top: max(12px, var(--safe-top));
    flex-wrap: wrap;
    align-items: center;
    background: rgba(8,8,10,0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    gap: 12px;
  }
  .masthead-row { flex: 1; }
  .brand { font-size: 26px; }

  /* Hamburger menu */
  .menu-toggle { display: flex; }

  /* Collapsible nav */
  .nav-links {
    display: none;
    flex-direction: column;
    gap: 0;
    width: 100%;
    order: 3;
    background: var(--panel);
    border: 1px solid var(--border);
    margin-top: 4px;
    overflow: hidden;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
  }
  .nav-links a:last-child { border-bottom: none; }
  .nav-links a.active { background: rgba(8, 217, 214, 0.1); }

  /* Search becomes full-width below */
  .search-wrap {
    order: 2;
    width: 100%;
    display: none;
  }
  .search-wrap.open { display: flex; }
  .search-wrap input {
    width: 100%; text-align: left; padding: 10px 0;
    font-size: 13px;
  }

  /* HERO */
  .hero {
    padding: 0 16px 48px;
    height: auto;
    min-height: 100vh;
    padding-top: 120px;
    align-items: flex-end;
  }
  .hero-title { font-size: clamp(40px, 14vw, 72px); }
  .hero-overview {
    font-size: 13px; line-height: 1.6; margin-bottom: 28px;
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .hero-meta-mono { font-size: 10px; margin-bottom: 12px; }
  .hero-sub { font-size: 11px; gap: 12px; margin-bottom: 20px; }
  .btn { padding: 12px 24px; font-size: 11px; }
  .hero-actions { gap: 12px; }

  /* MAIN GRID */
  main { padding: 40px 16px; }
  .section { margin-bottom: 48px; }
  .section-head { margin-bottom: 20px; padding-bottom: 6px; }
  .section-title { font-size: 28px; }
  .section-sub { font-size: 10px; }
  .archive-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 6px;
  }
  .archive-item .item-title { font-size: 16px; }
  .archive-item .item-meta { font-size: 9px; }
  .archive-item .overlay { padding: 10px; }

  /* DOSSIER MODAL */
  .dossier { flex-direction: column; }
  .dossier-left {
    flex: none; height: 35vh; min-height: 220px;
    border-right: none; border-bottom: 3px solid var(--blue);
  }
  .dossier-right { padding: 32px 20px; padding-bottom: 60px; }
  .dossier-title { font-size: 40px; margin-bottom: 16px; }
  .dossier-meta { font-size: 11px; gap: 12px; margin-bottom: 20px; }
  .dossier-genres { margin-bottom: 24px; }
  .dossier-overview { font-size: 13px; margin-bottom: 24px; }
  .dossier-close { top: 12px; right: 12px; font-size: 11px; }
  .cast-photo { width: 64px; height: 64px; }
  .cast-card { flex: 0 0 64px; }

  /* ADBLOCK POPUP */
  .adblock-card { padding: 32px 24px; }
  .adblock-title { font-size: 26px; }
  .adblock-body { font-size: 12px; }

  /* FOOTER */
  .site-footer {
    flex-direction: column;
    gap: 8px;
    padding: 32px 16px;
    padding-bottom: max(32px, var(--safe-bottom));
    text-align: center;
    font-size: 10px;
  }

  /* F1 LIVE on mobile */
  .live-container { max-height: 60vh; }
}

/* SMALL PHONES */
@media (max-width: 380px) {
  .archive-grid { grid-template-columns: repeat(auto-fill, minmax(95px, 1fr)); gap: 4px; }
  .archive-item .item-title { font-size: 14px; }
  .hero-title { font-size: clamp(34px, 15vw, 56px); }
  .btn { padding: 10px 18px; font-size: 10px; }
}

/* LANDSCAPE PHONE */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .hero { min-height: 100vh; padding-top: 100px; }
  .hero-title { font-size: 48px; }
  .hero-overview { -webkit-line-clamp: 2; }
}