/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #eef0e8;
  --surface: #ffffff;
  --surface-2: #e2e6da;
  --line: #cfd5c4;
  --text: #1d2633;
  --muted: #5a6577;
  --grass: #4f7d2c;
  --grass-dark: #3c6221;
  --dirt: #7a5236;
  --dirt-dark: #5c3d28;
  --stone: #b9bfb2;
  --lantern: #a8690c;
  --lantern-soft: #f6e2b8;
  --sky-far: #c9d3c0;

  --font-display: "Pixelify Sans", "Courier New", monospace;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;

  --sidebar-w: 248px;
  --radius: 4px;
  --bevel-hi: rgba(255,255,255,.7);
  --bevel-lo: rgba(0,0,0,.14);

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #172030;
    --surface: #1f2b3e;
    --surface-2: #283850;
    --line: #34465f;
    --text: #e9e4d4;
    --muted: #9aa6b8;
    --grass: #79a649;
    --grass-dark: #5b8434;
    --dirt: #8a6142;
    --dirt-dark: #6b4a32;
    --stone: #3a4a61;
    --lantern: #f2b84b;
    --lantern-soft: #3d3524;
    --sky-far: #24314a;
    --bevel-hi: rgba(255,255,255,.08);
    --bevel-lo: rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #172030; --surface: #1f2b3e; --surface-2: #283850; --line: #34465f;
  --text: #e9e4d4; --muted: #9aa6b8; --grass: #79a649; --grass-dark: #5b8434;
  --dirt: #8a6142; --dirt-dark: #6b4a32; --stone: #3a4a61; --lantern: #f2b84b;
  --lantern-soft: #3d3524; --sky-far: #24314a;
  --bevel-hi: rgba(255,255,255,.08); --bevel-lo: rgba(0,0,0,.35);
}

*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--lantern); outline-offset: 2px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 50;
  background: var(--surface); padding: .5rem 1rem; border-radius: var(--radius);
}
.skip:focus { top: calc(env(safe-area-inset-top, 0px) + 1rem); }

/* ---------- Pixel icon ---------- */
.px { width: 18px; height: 18px; flex: none; image-rendering: pixelated; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: var(--sidebar-w);
  padding: calc(env(safe-area-inset-top, 0px) + 1.5rem) 1rem calc(env(safe-area-inset-bottom, 0px) + 1.25rem);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 1.75rem;
  z-index: 30;
  overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: .75rem;
  text-decoration: none; padding: 0 .5rem;
}
.brand-mark {
  width: 34px; height: 34px; flex: none;
  background:
    linear-gradient(var(--grass) 0 0) 0 0 / 100% 35% no-repeat,
    linear-gradient(var(--grass) 0 0) 25% 35% / 12.5% 12.5% no-repeat,
    linear-gradient(var(--grass) 0 0) 75% 35% / 12.5% 25% no-repeat,
    var(--dirt);
  box-shadow: inset -3px -3px 0 var(--bevel-lo), inset 3px 3px 0 var(--bevel-hi);
}
.brand-name {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.3rem; line-height: 1.1;
}
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .75rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 1rem;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-2);
  box-shadow: inset 3px 3px 0 var(--bevel-lo), inset -2px -2px 0 var(--bevel-hi);
}
.nav a[aria-current="page"] .px { color: var(--lantern); }
.sidebar-foot { margin: auto 0 0; padding: 0 .5rem; color: var(--muted); font-size: .875rem; }

/* ---------- Mobile top bar ---------- */
.topbar { display: none; }
.scrim { display: none; }

/* ---------- Main ---------- */
main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 3rem clamp(1.25rem, 4vw, 3.5rem) 4rem;
  outline: none;
}
.page { max-width: 1080px; }
.page-head { margin-bottom: 2rem; max-width: 62ch; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(2rem, 4.5vw, 2.75rem); }
h2 { font-size: 1.5rem; margin-bottom: 1rem; }
h3 { font-size: 1.2rem; }
.page-head p { color: var(--muted); margin: .6rem 0 0; }
.section { margin-top: 3rem; }

/* ---------- Hero (About) ---------- */
.hero {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  padding: clamp(2rem, 5vw, 3.5rem) clamp(1.5rem, 4vw, 3rem) 0;
}
.hero h1 {
  font-size: clamp(2.6rem, 8vw, 5rem);
  letter-spacing: .01em;
  text-shadow: 4px 4px 0 var(--bevel-lo);
}
.hero .tagline { font-size: 1.2rem; max-width: 46ch; margin: 1rem 0 0; color: var(--muted); }
.terrain { display: block; width: calc(100% + 2 * clamp(1.5rem, 4vw, 3rem)); margin: 2.5rem calc(-1 * clamp(1.5rem, 4vw, 3rem)) 0; height: auto; }
@media (prefers-reduced-motion: no-preference) {
  .terrain .near { animation: rise .7s steps(6) both; }
  .terrain .far { animation: rise .7s .15s steps(6) both; }
  @keyframes rise { from { transform: translateY(6px); } to { transform: none; } }
}

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 2.5rem;
  margin-top: 2.5rem;
}
.prose p { margin: 0 0 1rem; max-width: 62ch; }
.facts { margin: 0; display: grid; gap: .75rem; align-content: start; }
.facts div {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .7rem 0; border-bottom: 1px dashed var(--line);
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; text-align: right; }

.roster { display: flex; flex-wrap: wrap; gap: 1.25rem; list-style: none; padding: 0; margin: 0; }
.roster a {
  display: grid; justify-items: center; gap: .5rem; width: 92px;
  text-decoration: none; text-align: center; font-weight: 700; font-size: .95rem;
}
.roster a:hover .head { transform: translateY(-3px); }

/* ---------- Heads ---------- */
.head {
  width: 64px; height: 64px;
  image-rendering: pixelated;
  background: var(--surface-2);
  box-shadow: 4px 4px 0 var(--bevel-lo);
  transition: transform .12s steps(3);
  font-family: var(--font-display); font-size: 1.6rem;
  display: grid; place-items: center; color: var(--muted);
}
.head.lg { width: 80px; height: 80px; }

/* ---------- Channel cards ---------- */
.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.member {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: grid; gap: 1rem; align-content: start;
}
.member-top { display: flex; gap: 1rem; align-items: center; }
.member p { margin: 0; color: var(--muted); }
.socials { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; margin: 0; padding: 0; }
.social {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .4rem .7rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 0;
  color: var(--text);
  font: inherit; font-size: .9rem; font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.social:hover { box-shadow: inset 0 -3px 0 var(--dot, var(--grass)); }
.social .dot { width: 8px; height: 8px; background: var(--dot, var(--grass)); flex: none; }
.social .sub { font-weight: 400; color: var(--muted); }

/* ---------- Videos ---------- */
.videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.5rem 1.25rem; }
.video { display: grid; gap: .6rem; align-content: start; }
.video.featured { grid-column: 1 / -1; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 1.5rem; align-items: center; }
.frame {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  border-radius: var(--radius); overflow: hidden;
  background: var(--surface-2);
  border: 0; padding: 0; cursor: pointer;
}
.frame img { width: 100%; height: 100%; object-fit: cover; }
.frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.frame .play {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  width: 56px; height: 40px; background: rgba(23,32,48,.82);
  display: grid; place-items: center; color: #fff;
  box-shadow: inset -3px -3px 0 rgba(0,0,0,.35), inset 3px 3px 0 rgba(255,255,255,.12);
}
.frame:hover .play { background: var(--grass-dark); }
.video h3 { font-family: var(--font-body); font-size: 1.02rem; line-height: 1.35; }
.video.featured h3 { font-family: var(--font-display); font-size: 1.6rem; }
.byline { color: var(--muted); font-size: .9rem; margin: 0; }
.byline strong { color: var(--text); }
.playlists { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }

/* ---------- Schedule ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day {
  min-height: 150px; padding: .75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.day h3 { font-size: 1rem; }
.day .date { color: var(--muted); font-size: .85rem; }
.day.today { border-color: var(--lantern); box-shadow: inset 0 3px 0 var(--lantern); }
.slot-empty { margin-top: 1rem; height: 10px; background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 10px); opacity: .7; }

/* ---------- Seasons ---------- */
.seasons { display: grid; gap: 1rem; }
.season {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1.25rem; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}
.season-num {
  font-family: var(--font-display); font-weight: 700; font-size: 2rem;
  width: 64px; height: 64px; display: grid; place-items: center;
  background: var(--dirt); color: #f3ead2;
  box-shadow: inset -4px -4px 0 var(--dirt-dark), inset 4px 4px 0 rgba(255,255,255,.12);
}
.season p { margin: .25rem 0 0; color: var(--muted); }
.badge {
  display: inline-block; padding: .15rem .55rem; border-radius: var(--radius);
  font-size: .85rem; font-weight: 700; background: var(--surface-2); color: var(--muted);
}
.badge.live { background: var(--lantern-soft); color: var(--lantern); }

/* ---------- Buttons, empty states ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.1rem;
  background: var(--grass); color: #fff;
  border: 0; border-radius: var(--radius);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  box-shadow: inset -3px -3px 0 var(--grass-dark), inset 3px 3px 0 rgba(255,255,255,.18);
}
.btn:hover { filter: brightness(1.07); }
.btn[aria-disabled="true"] { background: var(--surface-2); color: var(--muted); box-shadow: none; cursor: default; }
.empty {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.25rem; align-items: start;
  padding: 1.5rem;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  max-width: 720px;
}
.empty .px { width: 40px; height: 40px; color: var(--stone); }
.empty h2 { font-size: 1.25rem; margin: 0 0 .35rem; }
.empty p { margin: 0; color: var(--muted); }
.note { color: var(--muted); font-size: .95rem; margin-top: 1.5rem; max-width: 62ch; }
.loading { color: var(--muted); }

/* ---------- Mobile ---------- */
@media (max-width: 880px) {
  .topbar {
    display: flex; align-items: center; gap: .75rem;
    position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
    padding: .6rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }
  body::before {
    content: ""; position: fixed; inset: 0 0 auto;
    height: env(safe-area-inset-top, 0px); z-index: 21; background: var(--surface);
  }
  .topbar-name { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; text-decoration: none; }
  .menu-btn {
    width: 44px; height: 44px; display: grid; place-items: center;
    background: var(--surface-2); border: 0; border-radius: var(--radius); cursor: pointer; color: var(--text);
  }
  .menu-icon, .menu-icon::before, .menu-icon::after {
    display: block; width: 20px; height: 3px; background: currentColor; content: "";
  }
  .menu-icon { position: relative; }
  .menu-icon::before { position: absolute; top: -7px; }
  .menu-icon::after { position: absolute; top: 7px; }

  .sidebar {
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 8px 0 0 var(--bevel-lo);
    width: min(82vw, 300px);
  }
  body.nav-open .sidebar { transform: none; }
  .scrim {
    display: block; position: fixed; inset: 0; z-index: 25;
    background: rgba(10, 14, 22, .55);
  }
  .scrim[hidden] { display: none; }
  body.nav-open { overflow: hidden; }

  main { margin-left: 0; padding-top: 2rem; }
  .about-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .video.featured { grid-template-columns: 1fr; gap: .75rem; }
  .video.featured h3 { font-size: 1.3rem; }
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; display: flex; justify-content: space-between; align-items: center; }
  .slot-empty { display: none; }
  .season { grid-template-columns: auto minmax(0, 1fr); }
  .season .btn { grid-column: 1 / -1; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .head { transition: none; }
}
