/* Site chrome. Light/dark follows the system; episode pages force the dark theme (data-theme="dark"). */
:root {
  --bg: #f5f7fb; --surface: #ffffff; --line: #d9e0ee; --text: #131a2e; --dim: #56627f;
  --accent: #0b8f83; --accent-ink: #ffffff; --stage: #0e1320; --off: #e3e9f5; --amber: #d99a00;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f1a; --surface: #141b2d; --line: #26324d; --text: #e6ecff; --dim: #8b97b8;
    --accent: #4fd1c5; --accent-ink: #06201d; --off: #1d2740; --amber: #ffd166;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0f1a; --surface: #141b2d; --line: #26324d; --text: #e6ecff; --dim: #8b97b8;
  --accent: #4fd1c5; --accent-ink: #06201d; --off: #1d2740; --amber: #ffd166;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.6;
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif; }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 14px; cursor: pointer; min-height: 40px; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

.site-header { max-width: 1100px; margin: 0 auto; padding: 14px 16px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { color: var(--text); font-weight: 700; text-decoration: none; letter-spacing: .01em; }
.brand i { display: inline-block; width: .8em; height: .8em; background: var(--accent); border-radius: 3px; margin-right: .45em; }
.langs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.langs a, .langs span { padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-size: .92rem; display: inline-block; }
.langs a { color: var(--text); }
.langs a:hover { border-color: var(--accent); }
.langs span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

main { max-width: 1100px; margin: 0 auto; padding: 8px 16px 40px; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); line-height: 1.25; margin: .5em 0 .3em; }
h2 { font-size: 1.25rem; margin: 1.8em 0 .6em; }
.crumbs { color: var(--dim); font-size: .95rem; margin-top: 16px; }
.crumbs a { color: var(--dim); }
.hero { padding: 28px 0 8px; }
.hero p { font-size: clamp(1.05rem, 2.6vw, 1.3rem); color: var(--dim); margin: .2em 0 1em; max-width: 40em; }
.btn { display: inline-block; padding: 9px 16px; border: 1px solid var(--accent); border-radius: 8px; color: var(--accent); text-decoration: none; font-weight: 600; }
.btn:hover { background: var(--accent); color: var(--accent-ink); }

.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; height: 100%; display: flex; flex-direction: column; gap: 6px; color: var(--text); text-decoration: none; }
a.card:hover { border-color: var(--accent); }
.card h3 { margin: 0; font-size: 1.1rem; line-height: 1.35; }
.card p { margin: 0; color: var(--dim); font-size: .95rem; }
.card .tag { margin-top: auto; padding-top: 6px; font-size: .85rem; color: var(--accent); font-weight: 600; }
.card.soon { opacity: .62; border-style: dashed; }
.card.soon .tag { color: var(--dim); }
.card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: var(--stage); }

.eplist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.eplist li { display: flex; gap: 12px; align-items: baseline; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.eplist .n { color: var(--dim); font-variant-numeric: tabular-nums; min-width: 2em; }
.eplist .tag { margin-left: auto; font-size: .85rem; color: var(--accent); white-space: nowrap; }
.eplist li.soon { opacity: .62; border-style: dashed; }
.eplist li.soon .tag { color: var(--dim); }
.eplist a { color: var(--text); text-decoration: none; font-weight: 600; }
.eplist a:hover { color: var(--accent); }

.ep-text { max-width: 46em; }
.ep-text p { margin: .6em 0; }
.yt { position: relative; max-width: 720px; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden; }
.yt iframe, .yt-play { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-play { padding: 0; background: #000; cursor: pointer; }
.yt-play img { width: 100%; height: 100%; object-fit: cover; opacity: .85; display: block; }
.yt-btn { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 68px; height: 48px; border-radius: 12px; background: var(--accent); color: #062a27; font-size: 24px; display: flex; align-items: center; justify-content: center; }
.yt-play:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.pn { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.pn a { flex: 1 1 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; color: var(--text); text-decoration: none; }
.pn a:hover { border-color: var(--accent); }
.pn small { display: block; color: var(--dim); }
.pn .next { text-align: right; }

.site-footer { max-width: 1100px; margin: 0 auto; padding: 18px 16px 36px; border-top: 1px solid var(--line); color: var(--dim); font-size: .92rem; display: flex; gap: 8px 18px; flex-wrap: wrap; justify-content: space-between; }
.site-footer a { color: var(--dim); }
.center { text-align: center; padding: 60px 0; }

.topnav { margin-left: auto; margin-right: 6px; }
.topnav a { color: var(--text); text-decoration: none; padding: 5px 4px; border-bottom: 2px solid transparent; }
.topnav a:hover { border-color: var(--accent); }
.dim { color: var(--dim); }
.rel { margin: .4em 0; padding-left: 1.2em; }
.rel li { margin: .35em 0; }
.rel.used { list-style: none; padding-left: 0; }
.rel.used li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.rel.used strong { display: block; }
.rel li.soon { color: var(--dim); }
.rel .tag { font-size: .8rem; border: 1px dashed var(--line); border-radius: 999px; padding: 1px 8px; margin-left: 6px; }
h3 { font-size: 1.05rem; margin: 1.4em 0 .5em; }


/* ---- brand, in the style of the videos: dark stage, teal, the lit-cell grid and the flame (shared/brand-data.js, scripts/brand.js) ---- */
.brand { display: inline-flex; align-items: center; gap: .55em; font-size: 1.1rem; }
.brand .mark { width: 1.7em; height: 1.7em; }
.brand .bn b { color: var(--text); }
.brand .bn em { color: var(--accent); font-style: normal; }
.mark .c { fill: var(--off); }
.mark .c.on { fill: var(--accent); }

.hero-stage { margin-top: 16px; padding: clamp(24px, 5vw, 56px); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  background: radial-gradient(circle at 80% 70%, rgba(79, 209, 197, .16), transparent 55%), #0e1320;
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, .7fr); gap: 16px; align-items: center; }
.hero-copy h1 { font-size: clamp(2.6rem, 8.5vw, 4.8rem); font-weight: 800; line-height: 1.05; letter-spacing: -.01em; margin: 0 0 .25em; }
.hero-copy .w1 { color: var(--text); }
.hero-copy .w2 { color: var(--accent); }
.hero-copy .tagline { font-size: clamp(1.15rem, 3vw, 1.6rem); color: var(--text); margin: .2em 0 .35em; max-width: 24em; }
.hero-copy .subline { font-size: clamp(1rem, 2.4vw, 1.15rem); color: var(--dim); margin: 0 0 1.3em; max-width: 30em; }
.hero-copy .actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }
a.btn.primary { background: var(--accent); color: var(--accent-ink); }
a.btn.primary:hover { filter: brightness(1.1); }
.hero-art { display: flex; justify-content: center; }
.flame { width: min(100%, 230px); height: auto; overflow: visible; }
.fl { transform-origin: 50% 97%; transform-box: fill-box; }
.center.root { padding: 48px 0 24px; }
.center.root .flame { width: 150px; margin-bottom: 8px; }
.center.root h1 { font-size: clamp(2.4rem, 8vw, 4rem); font-weight: 800; margin: 0 0 .3em; }
.center.root .w1 { color: var(--text); }
.center.root .w2 { color: var(--accent); }

h2.sec { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; margin: 2em 0 .8em; }
h2.sec::before { content: ""; width: 12px; height: 12px; border-radius: 4px; background: var(--accent); flex: none; }

/* cards: the series colour (--sc) on the border when hovered, the picture is a small grid of cells */
.card { transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--sc, var(--accent)); transform: translateY(-2px); }
.card .tag { color: var(--sc, var(--accent)); }
.card.soon .tag { color: var(--dim); }
.card .art { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; align-content: center; aspect-ratio: 16 / 9; padding: 14px; border-radius: 8px; background: #0e1320; }
.card .art i { aspect-ratio: 1; border-radius: 3px; background: var(--off); }
.card .art i.on { background: var(--sc, var(--accent)); }
.prog { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.prog i { width: 13px; height: 13px; border-radius: 4px; background: var(--off); }
.prog i.on { background: var(--sc, var(--accent)); }

@media (max-width: 720px) {
  .hero-stage { grid-template-columns: 1fr; }
  .hero-art { order: -1; justify-content: flex-start; }
  .flame { width: 110px; }
}

/* motion: the grid ripples in and its cells light up, the flame catches and flickers (like the opening); none of it with reduced motion */
@media (prefers-reduced-motion: no-preference) {
  .mark .c { transform-box: fill-box; transform-origin: center; animation: cell-in .5s ease-out both; animation-delay: var(--d, 0s); }
  .mark .c.on { animation: cell-in .5s ease-out both, cell-lit .3s ease-out both; animation-delay: var(--d, 0s), var(--k, 0s); }
  .flame { animation: flame-in 1s ease-out both; transform-origin: 50% 100%; }
  .fl { animation: flicker 3.2s ease-in-out 1s infinite; }
}
@keyframes cell-in { from { opacity: 0; transform: scale(.55); } }
@keyframes cell-lit { from { fill: var(--off); } }
@keyframes flame-in { from { opacity: 0; transform: scale(.25); } }
@keyframes flicker {
  0%, 100% { transform: scale(1, 1) skewX(0); }
  30% { transform: scale(1.02, 1.045) skewX(1.4deg); }
  60% { transform: scale(.99, .965) skewX(-1.1deg); }
}
