/* ============================================
   UNWRITTEN TV — Theme tokens & shared styles
   Discover-style viral magazine theme
   ============================================ */

:root {
  /* Type */
  --font-display: 'Anton', 'Bebas Neue', Impact, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --font-serif: 'Playfair Display', Georgia, serif;

  /* Light theme (default) */
  --bg: #FAF8F5;
  --bg-elev: #FFFFFF;
  --bg-sunk: #F1EEE8;
  --fg: #0E0E10;
  --fg-muted: #5C5C66;
  --fg-faint: #9A9AA3;
  --border: #E5E1D8;
  --border-strong: #0E0E10;

  /* Accent */
  --accent: oklch(0.62 0.24 25);          /* hot magenta-red */
  --accent-fg: #FFFFFF;
  --accent-soft: oklch(0.95 0.04 25);

  /* Category palette */
  --cat-music: oklch(0.65 0.20 280);      /* purple */
  --cat-hiphop: oklch(0.62 0.24 25);      /* red-magenta */
  --cat-celeb: oklch(0.70 0.18 60);       /* gold */
  --cat-culture: oklch(0.62 0.18 200);    /* cyan-blue */
  --cat-news: oklch(0.55 0.22 145);       /* green */
  --cat-style: oklch(0.62 0.18 330);      /* pink */

  /* Spacing */
  --gap: 16px;
  --gap-lg: 24px;
  --gap-xl: 40px;
  --radius: 4px;
  --radius-lg: 8px;

  /* Density */
  --density-pad: 16px;
  --density-text: 1;
}

[data-theme="dark"] {
  --bg: #0B0B0D;
  --bg-elev: #16161A;
  --bg-sunk: #050507;
  --fg: #FAF8F5;
  --fg-muted: #9A9AA3;
  --fg-faint: #5C5C66;
  --border: #232328;
  --border-strong: #FAF8F5;
  --accent-soft: oklch(0.25 0.10 25);
}

[data-density="compact"] {
  --density-pad: 10px;
  --density-text: 0.92;
}

[data-density="spacious"] {
  --density-pad: 24px;
  --density-text: 1.08;
}

/* ============================================
   Reset + base
   ============================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: calc(15px * var(--density-text));
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ============================================
   Image placeholders — striped SVG-style
   ============================================ */
.img-ph {
  position: relative;
  background: var(--bg-sunk);
  background-image:
    repeating-linear-gradient(
      135deg,
      transparent 0,
      transparent 12px,
      rgba(14, 14, 16, 0.05) 12px,
      rgba(14, 14, 16, 0.05) 13px
    );
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  padding: 8px;
}
[data-theme="dark"] .img-ph {
  background-image:
    repeating-linear-gradient(
      135deg,
      transparent 0,
      transparent 12px,
      rgba(250, 248, 245, 0.04) 12px,
      rgba(250, 248, 245, 0.04) 13px
    );
}
.img-ph::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px dashed var(--fg-faint);
  opacity: 0.4;
  pointer-events: none;
}
.img-ph > span { position: relative; z-index: 1; }

/* Subject-tinted placeholders for editorial richness */
.img-ph[data-tint="warm"] {
  background-color: oklch(0.72 0.12 50);
  color: rgba(255,255,255,0.85);
}
.img-ph[data-tint="cool"] {
  background-color: oklch(0.40 0.10 250);
  color: rgba(255,255,255,0.85);
}
.img-ph[data-tint="dark"] {
  background-color: oklch(0.25 0.04 30);
  color: rgba(255,255,255,0.85);
}
.img-ph[data-tint="purple"] {
  background-color: oklch(0.45 0.14 300);
  color: rgba(255,255,255,0.85);
}
.img-ph[data-tint="rose"] {
  background-color: oklch(0.62 0.18 15);
  color: rgba(255,255,255,0.9);
}
.img-ph[data-tint="gold"] {
  background-color: oklch(0.70 0.14 75);
  color: rgba(0,0,0,0.7);
}
.img-ph[data-tint="green"] {
  background-color: oklch(0.50 0.16 145);
  color: rgba(255,255,255,0.85);
}
.img-ph[data-tint="cyan"] {
  background-color: oklch(0.55 0.14 210);
  color: rgba(255,255,255,0.9);
}

/* ============================================
   Reusable components
   ============================================ */

/* Category badge */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg);
  background: var(--bg-elev);
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--cat);
}
.cat-badge.solid {
  background: var(--cat);
  color: white;
  border: none;
  padding: 5px 10px;
}
.cat-badge[data-cat="music"] { --cat: var(--cat-music); }
.cat-badge[data-cat="hiphop"] { --cat: var(--cat-hiphop); }
.cat-badge[data-cat="celeb"] { --cat: var(--cat-celeb); }
.cat-badge[data-cat="culture"] { --cat: var(--cat-culture); }
.cat-badge[data-cat="news"] { --cat: var(--cat-news); }
.cat-badge[data-cat="style"] { --cat: var(--cat-style); }

/* Meta row — Discover-style author/date row */
.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-muted);
  font-family: var(--font-body);
}
.meta-row .dot { width: 3px; height: 3px; background: currentColor; border-radius: 50%; opacity: 0.5; }
.meta-row .source {
  font-weight: 600;
  color: var(--fg);
}
.meta-row .source-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 10px;
  margin-right: 4px;
}

/* Discover-style card — image top, bold headline, meta row */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
[data-theme="dark"] .card:hover { box-shadow: 0 4px 24px rgba(0,0,0,0.4); }

.card .img-ph { aspect-ratio: 16 / 10; }
.card .body {
  padding: var(--density-pad);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.card h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--fg);
  text-wrap: balance;
}
.card .dek {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card style: minimal — no border, big headline focus */
[data-card-style="minimal"] .card {
  border: none;
  background: transparent;
}
[data-card-style="minimal"] .card .body { padding: 12px 0 0; }

/* Card style: bold — solid heavy borders */
[data-card-style="bold"] .card {
  border: 2px solid var(--border-strong);
  border-radius: 0;
}
[data-card-style="bold"] .card h3 { font-size: 26px; }

/* Card style: editorial — refined */
[data-card-style="editorial"] .card {
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding-bottom: 12px;
}
[data-card-style="editorial"] .card .img-ph { aspect-ratio: 4 / 3; }
[data-card-style="editorial"] .card h3 { font-family: var(--font-serif); font-weight: 700; text-transform: none; font-size: 20px; }

/* ============================================
   Typography style variants
   ============================================ */
[data-type="condensed"] {
  --font-display: 'Bebas Neue', 'Anton', Impact, sans-serif;
}
[data-type="serif"] {
  --font-display: 'Playfair Display', Georgia, serif;
}
[data-type="serif"] .card h3 { text-transform: none; font-weight: 700; }
[data-type="serif"] .hero-title { text-transform: none !important; }

[data-type="mono"] {
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
}
[data-type="mono"] .card h3 { font-weight: 700; }

/* ============================================
   AdSense placeholder slots
   ============================================ */
.ad-slot {
  background:
    repeating-linear-gradient(
      45deg,
      var(--bg-sunk) 0,
      var(--bg-sunk) 8px,
      var(--bg) 8px,
      var(--bg) 9px
    );
  border: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--fg-faint);
  padding: 16px;
  text-align: center;
}
.ad-slot .label {
  font-weight: 700;
  color: var(--fg-muted);
}
.ad-slot .size { font-size: 9px; opacity: 0.7; }
.ad-slot.banner-728 { aspect-ratio: 728 / 90; min-height: 90px; max-height: 120px; }
.ad-slot.box-300 { aspect-ratio: 300 / 250; }
.ad-slot.skyscraper { aspect-ratio: 300 / 600; }
.ad-slot.in-feed {
  min-height: 120px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  flex-direction: row;
  gap: 12px;
  justify-content: flex-start;
  padding: 12px;
}

/* ============================================
   Header / nav
   ============================================ */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .top-bar {
  background: var(--fg);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 6px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.site-header .top-bar .ticker {
  display: flex;
  gap: 16px;
  overflow: hidden;
  white-space: nowrap;
  flex: 1;
}
.site-header .top-bar .ticker span {
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-header .top-bar .ticker .live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.site-header .main-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 16px 24px;
  gap: 24px;
}
.site-header .logo {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 400;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  line-height: 1;
  text-align: center;
}
.site-header .logo .tv {
  color: var(--accent);
}

.site-header nav.primary {
  display: flex;
  gap: 4px;
  align-items: center;
}
.site-header nav.primary a {
  font-family: var(--font-display);
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 12px;
  position: relative;
}
.site-header nav.primary a.active::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 3px;
  background: var(--accent);
}
.site-header nav.primary a:hover { color: var(--accent); }

.site-header .actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.icon-btn {
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 14px;
}
.icon-btn:hover { background: var(--bg-sunk); }

.subscribe-btn {
  background: var(--fg);
  color: var(--bg);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 9px 16px;
  font-size: 14px;
  border-radius: 0;
}
.subscribe-btn:hover { background: var(--accent); color: white; }

/* Sub-nav strip — categories */
.site-header .sub-nav {
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0;
  padding: 0 24px;
  overflow-x: auto;
}
.site-header .sub-nav a {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 12px 14px;
  white-space: nowrap;
  border-right: 1px solid var(--border);
  color: var(--fg-muted);
}
.site-header .sub-nav a:first-child { border-left: 1px solid var(--border); }
.site-header .sub-nav a:hover { color: var(--fg); background: var(--bg-sunk); }
.site-header .sub-nav a.live { color: var(--accent); font-weight: 700; }

/* ============================================
   Footer
   ============================================ */
.site-footer {
  background: var(--fg);
  color: var(--bg);
  padding: 60px 24px 24px;
  margin-top: 60px;
}
.site-footer .inner {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}
.site-footer h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 16px;
  opacity: 0.6;
}
.site-footer .big-logo {
  font-family: var(--font-display);
  font-size: 64px;
  letter-spacing: -0.02em;
  line-height: 0.9;
  margin-bottom: 16px;
}
.site-footer .big-logo .tv { color: var(--accent); }
.site-footer ul { list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.site-footer ul a { opacity: 0.8; }
.site-footer ul a:hover { color: var(--accent); opacity: 1; }
.site-footer .legal {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.5;
  max-width: 1400px;
  margin: 0 auto;
}

/* ============================================
   Layout helpers
   ============================================ */
.shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}
.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--fg);
  margin-bottom: 24px;
}
.section-label::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--accent);
  display: inline-block;
}
.section-label .more {
  margin-left: auto;
  color: var(--fg);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

/* Newsletter strip */
.newsletter {
  background: var(--fg);
  color: var(--bg);
  padding: 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
}
.newsletter h3 {
  font-family: var(--font-display);
  font-size: 44px;
  line-height: 0.95;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.newsletter h3 .accent { color: var(--accent); }
.newsletter form {
  display: flex;
  gap: 0;
  border: 2px solid var(--bg);
  background: var(--fg);
}
.newsletter input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 14px 16px;
  color: var(--bg);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
}
.newsletter input::placeholder { color: rgba(255,255,255,0.5); }
.newsletter button {
  background: var(--accent);
  color: white;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 28px;
  font-size: 16px;
}
.newsletter .small {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.5;
  margin-top: 12px;
}

/* Trending list */
.trending-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.trending-list li {
  list-style: none;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.trending-list li:last-child { border-bottom: none; }
.trending-list .num {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 0.85;
  color: var(--accent);
}
.trending-list .title {
  font-family: var(--font-display);
  font-size: 16px;
  text-transform: uppercase;
  line-height: 1.1;
  letter-spacing: -0.005em;
}
.trending-list .meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 6px;
}

/* Tag cloud */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-cloud a {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  border-radius: 999px;
}
.tag-cloud a:hover { background: var(--accent); color: white; border-color: var(--accent); }

/* Share bar */
.share-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}
.share-bar .label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
}
.share-bar button {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.share-bar button:hover { background: var(--accent); color: white; border-color: var(--accent); }

/* Hide scrollbars on horizontal nav */
.sub-nav::-webkit-scrollbar { display: none; }
