/* dark-color theme — cinematic dark palette inspired by "Dreamer" design canvas.
   Scoped via body.dc-theme (added only on tube pages when active_theme='dark-color'). */

body.dc-theme {
  --bg:           oklch(0.13 0.015 275);
  --bg-deep:      oklch(0.10 0.012 275);
  --surface:      oklch(0.175 0.016 275);
  --surface-2:    oklch(0.22 0.018 275);
  --border:       oklch(0.28 0.014 275);
  --border-soft:  oklch(0.22 0.012 275);
  --text:         oklch(0.97 0.005 275);
  --text-2:       oklch(0.82 0.008 275);
  --muted:        oklch(0.62 0.012 275);
  --muted-2:      oklch(0.48 0.012 275);

  --accent:       oklch(0.83 0.135 65);
  --accent-soft:  oklch(0.83 0.135 65 / 0.18);
  --accent-deep:  oklch(0.20 0.04 65);

  --font-display: "Instrument Serif", "Newsreader", Georgia, serif;
  --font-ui:      "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    18px;

  --top-h:        60px;
  --side-w:       232px;

  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.dc-theme *,
body.dc-theme *::before,
body.dc-theme *::after { box-sizing: border-box; }

body.dc-theme a { color: inherit; text-decoration: none; }
body.dc-theme img { display: block; max-width: 100%; }
body.dc-theme ::selection { background: var(--accent-soft); color: var(--text); }

body.dc-theme .dc-serif { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; }
body.dc-theme .dc-serif-it { font-family: var(--font-display); font-style: italic; letter-spacing: -0.005em; }
body.dc-theme .dc-mono { font-family: var(--font-mono); font-feature-settings: "ss02"; letter-spacing: 0; }
body.dc-theme .dc-upper { text-transform: uppercase; letter-spacing: 0.14em; font-size: 11px; }
body.dc-theme .dc-muted { color: var(--muted); }
body.dc-theme .dc-muted-2 { color: var(--muted-2); }

/* ---------- Shell layout ---------- */

body.dc-theme .dc-top {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

body.dc-theme .dc-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.01em;
  color: var(--text);
  flex: 0 0 auto;
}
body.dc-theme .dc-logo-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, oklch(0.55 0.16 35) 100%);
  color: var(--accent-deep);
  display: inline-grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  padding-bottom: 1px;
}
body.dc-theme .dc-logo-name {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
}
body.dc-theme .dc-logo-img { height: 32px; max-width: 200px; object-fit: contain; }

body.dc-theme .dc-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  max-width: 520px;
  margin-left: 8px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--text-2);
  transition: border-color .15s, background .15s, color .15s;
}
body.dc-theme .dc-search:focus-within {
  border-color: var(--accent);
  background: var(--bg-deep);
  color: var(--text);
}
body.dc-theme .dc-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: inherit;
  font: inherit;
}
body.dc-theme .dc-search input::placeholder { color: var(--muted-2); }
body.dc-theme .dc-search button {
  background: transparent;
  border: 0;
  color: var(--text-2);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
}
body.dc-theme .dc-search button:hover { color: var(--text); }

body.dc-theme .dc-icon {
  width: 18px; height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
body.dc-theme .dc-icon-sm { width: 14px; height: 14px; }

body.dc-theme .dc-burger {
  display: none;
  width: 38px; height: 38px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--text-2);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
body.dc-theme .dc-burger:hover { color: var(--text); background: var(--surface-2); }

body.dc-theme .dc-body {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  align-items: start;
}

body.dc-theme .dc-side {
  position: sticky;
  top: var(--top-h);
  height: calc(100vh - var(--top-h));
  overflow-y: auto;
  border-right: 1px solid var(--border-soft);
  padding: 14px 12px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
body.dc-theme .dc-side::-webkit-scrollbar { width: 8px; }
body.dc-theme .dc-side::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

body.dc-theme .dc-side-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  color: var(--muted);
  padding: 6px 12px 8px;
}

body.dc-theme .dc-navlink {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s, color .15s;
  font-size: 13.5px;
  text-decoration: none;
}
body.dc-theme .dc-navlink:hover { background: var(--surface); color: var(--text); }
body.dc-theme .dc-navlink.on { background: var(--surface-2); color: var(--text); }
body.dc-theme .dc-navlink-dot {
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--border);
  flex: 0 0 auto;
}
body.dc-theme .dc-navlink.on .dc-navlink-dot,
body.dc-theme .dc-navlink:hover .dc-navlink-dot { background: var(--accent); }
body.dc-theme .dc-navlink-cnt {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted-2);
}

body.dc-theme .dc-hr {
  height: 1px;
  background: var(--border-soft);
  border: 0;
  margin: 14px 4px;
}

body.dc-theme .dc-side-foot {
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted-2);
  line-height: 1.6;
}
body.dc-theme .dc-side-foot a {
  color: var(--muted);
  display: inline-block;
  margin-right: 8px;
}
body.dc-theme .dc-side-foot a:hover { color: var(--text-2); }

body.dc-theme .dc-main {
  min-width: 0;
  padding: 22px 28px 48px;
}

/* ---------- Backdrop for mobile sidebar drawer ---------- */
body.dc-theme .dc-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 25;
  -webkit-tap-highlight-color: transparent;
}
body.dc-theme.dc-side-open .dc-backdrop { display: block; }

/* ---------- Page title ribbon (above grid) ---------- */
body.dc-theme .dc-ribbon {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 4px 4px 18px;
  flex-wrap: wrap;
}
body.dc-theme .dc-ribbon h1 {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1;
  margin: 0;
  letter-spacing: -0.01em;
}
body.dc-theme .dc-ribbon-note {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--muted);
  font-size: 17px;
}
body.dc-theme .dc-ribbon-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-2);
  margin-left: auto;
}

/* ---------- Video grid (home) ---------- */
body.dc-theme .dc-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px 20px;
}

body.dc-theme .dc-card {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

body.dc-theme .dc-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  isolation: isolate;
}
body.dc-theme .dc-thumb-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s cubic-bezier(.2,.7,.2,1), filter .25s;
}
body.dc-theme .dc-card:hover .dc-thumb-bg {
  transform: scale(1.04);
  filter: brightness(1.08) saturate(1.1);
}
body.dc-theme .dc-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,0.55));
  opacity: 0.85;
  z-index: 1;
}
body.dc-theme .dc-thumb-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    radial-gradient(rgba(0,0,0,.05) 1px, transparent 1px);
  background-size: 3px 3px, 5px 5px;
  background-position: 0 0, 1px 1px;
  mix-blend-mode: overlay;
  opacity: 0.6;
  z-index: 2;
}
body.dc-theme .dc-thumb-dur {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 3;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
body.dc-theme .dc-thumb-q {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 3;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

body.dc-theme .dc-meta {
  padding: 12px 2px 0;
}
body.dc-theme .dc-meta-title {
  font-size: 14.5px;
  line-height: 1.35;
  font-weight: 500;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  text-wrap: pretty;
}
body.dc-theme .dc-meta-row {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
body.dc-theme .dc-meta-row .dc-dot {
  opacity: 0.5;
}
body.dc-theme .dc-meta-row a {
  color: var(--text-2);
}
body.dc-theme .dc-meta-row a:hover { color: var(--accent); }

/* ---------- Pagination ---------- */
body.dc-theme .dc-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: 32px 0 8px;
}
body.dc-theme .dc-pager a {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 12px;
  transition: background .15s, color .15s, border-color .15s;
}
body.dc-theme .dc-pager a:hover {
  background: var(--surface-2);
  color: var(--text);
}
body.dc-theme .dc-pager a.on {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ---------- Watch page ---------- */
body.dc-theme .dc-watch-title {
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 4px 0 12px;
  text-wrap: balance;
}
body.dc-theme .dc-watch-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}
body.dc-theme .dc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}
body.dc-theme .dc-chip-accent {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
  font-weight: 500;
}
body.dc-theme .dc-chip-mono {
  font-family: var(--font-mono);
  font-size: 11px;
}

body.dc-theme .dc-player {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-deep);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6), 0 0 0 1px var(--border-soft);
}
body.dc-theme .dc-player video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #000;
}

body.dc-theme .dc-action-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--text-2);
}
body.dc-theme .dc-action-bar .dc-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
}
body.dc-theme .dc-action-bar .dc-stat strong {
  color: var(--text);
  font-weight: 500;
}
body.dc-theme .dc-action-bar .dc-sep {
  width: 1px;
  height: 18px;
  background: var(--border-soft);
}
body.dc-theme .dc-action-bar a { color: var(--accent); }
body.dc-theme .dc-action-bar a:hover { color: var(--text); }

/* Related videos grid on watch — denser than home */
body.dc-theme .dc-related-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 32px 4px 16px;
}
body.dc-theme .dc-related-head h2 {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
  margin: 0;
}
body.dc-theme .dc-related-head-note {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--muted);
  font-size: 15px;
}
body.dc-theme .dc-related-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 20px 14px;
}
body.dc-theme .dc-related-grid .dc-meta-title {
  font-size: 13px;
  -webkit-line-clamp: 2;
}
body.dc-theme .dc-related-grid .dc-meta-row { font-size: 10.5px; }

/* Mobile-only mini related rows (between ad slots on watch). 2 cols. */
body.dc-theme .dc-mini-related {
  display: none;
  margin: 14px 0;
}
@media (max-width: 820px) {
  body.dc-theme .dc-mini-related {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  body.dc-theme .dc-mini-related .dc-meta-title { font-size: 13px; }
}

/* ---------- Mimic blocks (image popunder bait) ---------- */
body.dc-theme .mimic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 14px 0;
}
body.dc-theme .mimic-grid .mimic-cell {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
body.dc-theme .mimic-cell-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  isolation: isolate;
}
body.dc-theme .mimic-cell-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .6s cubic-bezier(.2,.7,.2,1);
}
body.dc-theme .mimic-cell:hover .mimic-cell-thumb img { transform: scale(1.04); }
body.dc-theme .mimic-cell-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,0.55));
  opacity: 0.8;
  pointer-events: none;
}
body.dc-theme .mimic-cell-dur {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  backdrop-filter: blur(4px);
}
body.dc-theme .mimic-cell-title {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
  text-align: left;
  min-height: 0;
}

/* ---------- Ad slot wrapper (centering / empty hide handled in PHP layer) ---------- */
body.dc-theme .ad-slot {
  margin: 14px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
}
body.dc-theme .ad-slot:empty { display: none; }

/* ---------- Legal article ---------- */
body.dc-theme .dc-article {
  max-width: 720px;
  margin: 28px auto 0;
  padding: 36px 38px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--text-2);
  line-height: 1.7;
  font-size: 15px;
}
body.dc-theme .dc-article h1 {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1.1;
  margin: 0 0 18px;
  color: var(--text);
  letter-spacing: -0.01em;
}
body.dc-theme .dc-article h2 {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.2;
  margin: 28px 0 10px;
  color: var(--text);
}
body.dc-theme .dc-article p { margin: 0 0 14px; }
body.dc-theme .dc-article a { color: var(--accent); }
body.dc-theme .dc-article a:hover { color: var(--text); }

body.dc-theme .dc-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
body.dc-theme .dc-back:hover { color: var(--text); }

/* ---------- Footer ---------- */
body.dc-theme .dc-foot {
  margin-top: 48px;
  padding: 24px 28px 32px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-deep);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  line-height: 1.7;
}
body.dc-theme .dc-foot a {
  color: var(--text-2);
  padding: 0 6px;
}
body.dc-theme .dc-foot a:hover { color: var(--accent); }
body.dc-theme .dc-foot-sep { color: var(--muted-2); }

/* ---------- Overlay modal (watch page, money-only) — match dark vibe ---------- */
body.dc-theme .tube-overlay {
  border-radius: var(--radius);
  box-shadow: 0 20px 60px -10px rgba(0,0,0,0.7);
}
body.dc-theme .tube-overlay .overlay-close {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}
body.dc-theme .tube-overlay .overlay-close:hover { background: var(--accent); color: var(--accent-deep); border-color: var(--accent); }

/* ---------- Responsive ---------- */

/* tablet: drop to 3 cols on home, 4 cols on watch-related */
@media (max-width: 1180px) {
  body.dc-theme .dc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.dc-theme .dc-related-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* small tablet: sidebar collapses to drawer, content goes full-width */
@media (max-width: 900px) {
  body.dc-theme { --top-h: 56px; }
  body.dc-theme .dc-burger { display: inline-flex; }
  body.dc-theme .dc-body { grid-template-columns: 1fr; }
  body.dc-theme .dc-side {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    height: 100vh;
    z-index: 35;
    background: var(--bg-deep);
    border-right: 1px solid var(--border);
    transform: translateX(-105%);
    transition: transform .25s ease;
    padding-top: 18px;
  }
  body.dc-theme.dc-side-open .dc-side { transform: translateX(0); }
  body.dc-theme .dc-main { padding: 18px 18px 40px; }
  body.dc-theme .dc-ribbon h1 { font-size: 26px; }
  body.dc-theme .dc-watch-title { font-size: 26px; }
  body.dc-theme .dc-related-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.dc-theme .dc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; }
}

@media (max-width: 640px) {
  body.dc-theme .dc-grid { grid-template-columns: 1fr; }
  body.dc-theme .dc-related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.dc-theme .dc-main { padding: 14px 14px 36px; }
  body.dc-theme .dc-top { padding: 0 14px; gap: 10px; }
  body.dc-theme .dc-logo-name { font-size: 18px; }
  body.dc-theme .dc-logo-mark { width: 26px; height: 26px; font-size: 17px; }
  body.dc-theme .dc-search { height: 36px; max-width: none; }
  body.dc-theme .dc-watch-title { font-size: 22px; }
  body.dc-theme .dc-article {
    margin-top: 14px;
    padding: 24px 18px;
    border-radius: var(--radius);
  }
  body.dc-theme .dc-article h1 { font-size: 26px; }
  body.dc-theme .dc-article h2 { font-size: 18px; }
}
