/* Explainers — one stylesheet, no build step. Light and dark follow the system setting. */

:root {
  color-scheme: light dark;
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #17171a;
  --muted: #5d5e66;
  --line: #e3e1db;
  --accent: #b5451f;
  --shadow: 0 1px 2px rgba(20, 20, 25, .06), 0 14px 36px rgba(20, 20, 25, .08);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121214;
    --panel: #1a1a1e;
    --ink: #f1efea;
    --muted: #a3a4ad;
    --line: #2c2c33;
    --accent: #ff9166;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 18px 44px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.player-open { overflow: hidden; }

.wrap { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

a { color: inherit; }

/* Header */

.site-header { border-bottom: 1px solid var(--line); padding: 2.75rem 0 1.75rem; }

.brand { margin: 0; font-size: 1.5rem; font-weight: 650; letter-spacing: -.02em; }
.brand a { text-decoration: none; }

.tagline { margin: .4rem 0 0; color: var(--muted); }

/* Catalog */

main { padding: 2.5rem 0 4rem; }

.catalog-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1.25rem;
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
}

.count { font-weight: 500; letter-spacing: .04em; text-transform: none; }

.grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 296px), 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.card__button {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: inherit;
  font: inherit;
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.card__button:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }

.card__thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #000; }
.card__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

.card__play { position: absolute; inset: 0; display: grid; place-items: center; }
.card__play::before {
  content: "";
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(12, 12, 14, .55);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .8);
  transition: background .16s ease, transform .16s ease;
}
.card__play::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-38%, -50%);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent #fff;
}
.card__button:hover .card__play::before { background: rgba(12, 12, 14, .78); transform: scale(1.06); }

.card__time {
  position: absolute;
  right: .5rem;
  bottom: .5rem;
  padding: .1rem .4rem;
  border-radius: 5px;
  background: rgba(12, 12, 14, .8);
  color: #fff;
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
}

.card__body { display: block; padding: .95rem 1.05rem 1.15rem; }
.card__title { display: block; font-size: 1.05rem; font-weight: 620; letter-spacing: -.01em; }
.card__summary { display: block; margin-top: .35rem; color: var(--muted); font-size: .9rem; line-height: 1.5; }

.card__topics,
.topics { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }

.tag {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .12rem .5rem;
}

.empty { color: var(--muted); }

/* Player */

.player {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: clamp(.5rem, 2.5vw, 2rem);
}
.player[hidden] { display: none; }

.player__backdrop { position: absolute; inset: 0; background: rgba(12, 12, 14, .74); }

.player__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1000px, 100%);
  max-height: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}

.player__stage { background: #000; }
.player__stage video { display: block; width: 100%; max-height: 62vh; background: #000; }

.player__close {
  position: absolute;
  top: .6rem;
  right: .6rem;
  z-index: 2;
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: rgba(12, 12, 14, .6);
  color: #fff;
  font-size: .95rem;
  line-height: 1;
}
.player__close:hover { background: rgba(12, 12, 14, .85); }

.player__info { padding: 1.1rem 1.3rem 1.3rem; overflow: auto; }
.player__info h2 { margin: 0; font-size: 1.2rem; letter-spacing: -.01em; }
.player__summary { margin: .4rem 0 0; color: var(--muted); }

.sections { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.sections[hidden] { display: none; }
.sections summary { cursor: pointer; color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; }

.chapters { display: grid; gap: .1rem; margin: .55rem 0 0; padding: 0; list-style: none; }

.chapter {
  display: flex;
  gap: .7rem;
  align-items: baseline;
  width: 100%;
  padding: .3rem .45rem;
  border: 0;
  border-radius: 7px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.chapter:hover { background: var(--line); }
.chapter__time { min-width: 3rem; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.chapter__title { font-size: .95rem; }

.chapter.is-current { background: var(--line); }
.chapter.is-current .chapter__title { font-weight: 600; }
.chapter.is-current .chapter__time { color: var(--accent); }

.player__actions { margin: 1.1rem 0 0; }

.download {
  display: inline-block;
  padding: .45rem .8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .85rem;
  text-decoration: none;
}
.download:hover { border-color: var(--accent); color: var(--accent); }

/* Footer */

.site-footer { border-top: 1px solid var(--line); padding: 1.6rem 0 2.5rem; color: var(--muted); font-size: .88rem; }
.site-footer p { margin: 0; }

/* Not found */

.notfound { padding: 4rem 0 6rem; }
.notfound h2 { margin: 0 0 .5rem; }

@media (max-width: 560px) {
  .wrap { width: calc(100% - 2rem); }
  .site-header { padding: 2rem 0 1.4rem; }
  main { padding: 1.75rem 0 3rem; }
  .grid { gap: 1.15rem; }
  .player { padding: 0; }
  .player__panel { width: 100%; max-height: 100%; border: 0; border-radius: 0; }
  .player__stage video { max-height: 46vh; }
  .player__info { padding: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
