/* ==========================================================================
   Cards, rails, panels, detail page, transcript, learn page
   ========================================================================== */

/* -------------------------------------------------------------------------- */
/* Card                                                                        */
/* -------------------------------------------------------------------------- */

.card { position: relative; }

.card__link { display: block; }
.card__link:hover { color: inherit; }

.card__art {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow-2);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
.card__art img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s var(--ease), filter .22s var(--ease);
}
.card__link:hover .card__art { transform: translateY(-4px); box-shadow: var(--shadow-3); }
.card__link:hover .card__art img { transform: scale(1.06); filter: brightness(.72); }
.card__link:focus-visible .card__art { outline: 2px solid var(--brand); outline-offset: 3px; }

.card__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity .22s var(--ease);
}
.card__play::before {
  content: '';
  position: absolute;
  width: 54px; height: 54px;
  border-radius: 50%;
  background: rgb(255 255 255 / .16);
  border: 2px solid rgb(255 255 255 / .85);
  backdrop-filter: blur(4px);
}
.card__play svg { position: relative; color: #fff; margin-left: 3px; }
.card__link:hover .card__play { opacity: 1; }

.card__tag,
.card__rating {
  position: absolute;
  top: 8px;
  padding: .16rem .45rem;
  border-radius: 5px;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .03em;
  backdrop-filter: blur(6px);
}
.card__tag  { left: 8px;  background: rgb(0 0 0 / .7); color: #fff; }
.card__rating { right: 8px; background: rgb(0 0 0 / .7); color: var(--brand); }

.card__progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgb(255 255 255 / .22);
}
.card__progress i {
  display: block;
  height: 100%;
  background: var(--brand);
}

.card__body { padding: .6rem .15rem 0; }
.card__title {
  font-size: .93rem;
  font-weight: 650;
  margin: 0 0 .2rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__meta {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
  margin: 0;
  font-size: .78rem;
  color: var(--text-3);
}

.card__save {
  position: absolute;
  top: 8px; right: 8px;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgb(0 0 0 / .68);
  color: #fff;
  opacity: 0;
  transform: scale(.85);
  transition: all .18s var(--ease);
}
.card:hover .card__save,
.card__save:focus-visible { opacity: 1; transform: none; }
.card__save[aria-pressed='true'] {
  opacity: 1;
  background: var(--brand);
  color: var(--brand-ink);
  transform: rotate(45deg);
}
.card:has(.card__rating) .card__save { top: 38px; }

.card--skeleton {
  aspect-ratio: 2 / 3;
  border-radius: var(--r-lg);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s infinite linear;
  min-width: 170px;
}
@keyframes shimmer { to { background-position: -220% 0; } }

/* -------------------------------------------------------------------------- */
/* Rail                                                                        */
/* -------------------------------------------------------------------------- */

.rail__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .9rem;
}
.rail__head h2 { margin: 0; }
.rail__mm { margin: .1rem 0 0; color: var(--brand); font-size: .88rem; }
.rail__desc { margin: .3rem 0 0; color: var(--text-3); font-size: .875rem; max-width: 60ch; }

.rail__controls { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.rail__all {
  font-size: .85rem;
  font-weight: 650;
  color: var(--text-2);
  padding: .3rem .6rem;
  border-radius: var(--r-sm);
}
.rail__all:hover { color: var(--brand); background: var(--surface-2); }

.rail__nav {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  font-size: 1.3rem;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: all .16s var(--ease);
}
.rail__nav:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.rail__nav:disabled { opacity: .3; cursor: default; }

.rail__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(165px, 1fr);
  gap: 1.15rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: .5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.rail__track > * { scroll-snap-align: start; }
.rail__track::-webkit-scrollbar { height: 6px; }
.rail__track::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.rail__track::-webkit-scrollbar-track { background: transparent; }

@media (min-width: 1100px) { .rail__track { grid-auto-columns: minmax(185px, 1fr); } }
@media (max-width: 480px)  { .rail__track { grid-auto-columns: minmax(142px, 1fr); gap: .8rem; } }

/* -------------------------------------------------------------------------- */
/* Panels                                                                      */
/* -------------------------------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.panel > h2 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: baseline;
  gap: .6rem;
  flex-wrap: wrap;
}
.panel > h2 span { font-size: .85rem; color: var(--brand); font-weight: 600; }

.panel--shortcuts .keys {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: .55rem;
  font-size: .875rem;
  color: var(--text-2);
}

/* -------------------------------------------------------------------------- */
/* Detail page                                                                 */
/* -------------------------------------------------------------------------- */

.detail { position: relative; }
.detail__bg {
  position: absolute;
  inset: 0 0 auto;
  height: 62vh;
  background-size: cover;
  background-position: center 25%;
  z-index: 0;
}
.detail__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgb(10 12 15 / .78) 0%, rgb(10 12 15 / .88) 55%, var(--bg) 100%);
}

.detail__inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2.5rem;
  padding-top: calc(var(--header-h) * .6 + 2.5rem);
  padding-bottom: 2.5rem;
}
.detail__poster {
  width: 100%;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  aspect-ratio: 2 / 3;
  object-fit: cover;
}
.detail__body h1 { margin-bottom: .1em; }
.detail__year { color: var(--text-3); font-weight: 400; }
.detail__mm { color: var(--brand); margin-bottom: .6rem; }
.detail__meta {
  display: flex;
  align-items: center;
  gap: .8rem;
  flex-wrap: wrap;
  color: var(--text-2);
  font-size: .92rem;
  font-weight: 600;
  margin-bottom: .7rem;
}
.detail__meta .rating { color: var(--brand); font-weight: 800; }
.detail__badges { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.detail__actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.detail__overview { color: var(--text-2); max-width: 68ch; }
.detail__overview--mm { color: var(--text-3); font-size: .95rem; }

.factlist { margin: 1.5rem 0 0; display: grid; gap: .6rem; }
.factlist > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--line-soft);
  font-size: .9rem;
}
.factlist dt { color: var(--text-3); font-weight: 650; }
.factlist dd { margin: 0; color: var(--text-2); }
.factlist em { color: var(--text-3); font-style: normal; font-size: .85em; }

.detail__sections { position: relative; z-index: 1; padding-bottom: 2rem; }

@media (max-width: 900px) {
  .detail__inner { grid-template-columns: 1fr; gap: 1.5rem; }
  .detail__poster { width: 190px; }
  .factlist > div { grid-template-columns: 92px 1fr; gap: .7rem; }
}

/* Learning profile --------------------------------------------------------- */

.learngrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.learngrid__item {
  background: var(--surface-2);
  border-radius: var(--r);
  padding: .9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.learngrid__item--wide { grid-column: 1 / -1; }
.learngrid__k {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-3);
  font-weight: 700;
}
.learngrid__v {
  font-size: .95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.learngrid__v em { color: var(--text-3); font-style: normal; font-size: .82rem; font-weight: 500; }

/* Episodes ----------------------------------------------------------------- */

.season { margin-bottom: 1.5rem; }
.season:last-child { margin-bottom: 0; }
.season h3, .season__label {
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-3);
  margin-bottom: .8rem;
}

.eplist { display: flex; flex-direction: column; gap: .5rem; }
.ep__link {
  display: grid;
  grid-template-columns: 34px 168px 1fr;
  gap: 1rem;
  align-items: center;
  padding: .7rem;
  border-radius: var(--r);
  border: 1px solid transparent;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.ep__link:hover { background: var(--surface-2); border-color: var(--line); color: inherit; }
.ep.is-current .ep__link {
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  border-color: color-mix(in srgb, var(--brand) 40%, transparent);
}
.ep__num { font-size: 1.15rem; font-weight: 800; color: var(--text-3); text-align: center; }
.ep.is-current .ep__num { color: var(--brand); }
.ep__still { width: 100%; border-radius: var(--r-sm); aspect-ratio: 16 / 9; object-fit: cover; }
.ep__body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.ep__body strong { font-size: .95rem; }
.ep__mm { font-size: .82rem; color: var(--brand); font-family: var(--font-mm); }
.ep__desc {
  font-size: .85rem;
  color: var(--text-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ep__meta { font-size: .78rem; color: var(--text-3); }
.ep__progress {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: var(--surface-3);
  margin-top: .35rem;
  max-width: 220px;
}
.ep__progress i { display: block; height: 100%; border-radius: 2px; background: var(--brand); }

.eplist--compact .ep__link { grid-template-columns: 30px 1fr; padding: .55rem; gap: .7rem; }
.eplist--compact .ep__still { display: none; }

@media (max-width: 700px) {
  .ep__link { grid-template-columns: 28px 110px 1fr; gap: .7rem; }
  .ep__desc { display: none; }
}

/* Downloads ---------------------------------------------------------------- */

.dl { display: flex; flex-direction: column; gap: .5rem; }
.dl__group {
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  margin: 1.2rem 0 .6rem;
}
.dl__item {
  display: grid;
  grid-template-columns: 68px 1fr auto 24px;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1rem;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  transition: all .16s var(--ease);
}
.dl__item:hover {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, var(--surface-2));
  color: inherit;
}
.dl__q {
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 15%, transparent);
  padding: .2rem .4rem;
  border-radius: 4px;
  text-align: center;
}
.dl__label { font-weight: 600; font-size: .92rem; }
.dl__size { color: var(--text-3); font-size: .85rem; }
.dl__icon { color: var(--brand); font-size: 1.1rem; text-align: center; }

@media (max-width: 560px) {
  .dl__item { grid-template-columns: 58px 1fr 20px; }
  .dl__size { display: none; }
}

/* -------------------------------------------------------------------------- */
/* Watch page                                                                  */
/* -------------------------------------------------------------------------- */

.watch { padding-top: calc(var(--header-h) * .4 + 1.25rem); }
.watch__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 1.75rem;
  align-items: start;
}
.watch__main { min-width: 0; }
.watch__side { position: sticky; top: calc(var(--header-h) + 12px); }

.watch__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin: 1.5rem 0 .5rem;
  flex-wrap: wrap;
}
.watch__head h1 { font-size: clamp(1.4rem, 2.6vw, 2rem); margin-bottom: .15em; }
.watch__ep { color: var(--text-3); font-size: .92rem; margin: 0; }
.watch__head-actions { display: flex; gap: .5rem; }
.watch__overview { color: var(--text-2); max-width: 75ch; margin-bottom: 1.5rem; }

@media (max-width: 1080px) {
  .watch__grid { grid-template-columns: 1fr; }
  .watch__side { position: static; }
}

/* Transcript --------------------------------------------------------------- */

.panel--transcript { padding: 1.1rem; }
.transcript__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .8rem;
}
.transcript__head h2 { margin: 0; font-size: 1.05rem; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  color: var(--text-3);
  cursor: pointer;
}
.switch input { accent-color: var(--brand); width: 15px; height: 15px; }

.transcript {
  max-height: 460px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.transcript::-webkit-scrollbar { width: 6px; }
.transcript::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.tr {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: .6rem;
  text-align: left;
  padding: .5rem .55rem;
  border-radius: var(--r-sm);
  border-left: 2px solid transparent;
  transition: background .14s var(--ease);
}
.tr:hover { background: var(--surface-2); }
.tr.is-active {
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  border-left-color: var(--brand);
}
.tr__t {
  font-variant-numeric: tabular-nums;
  font-size: .74rem;
  color: var(--text-3);
  padding-top: .15rem;
}
.tr__body { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.tr__en { font-size: .88rem; color: var(--text); }
.tr__my { font-size: .85rem; color: var(--text-2); font-family: var(--font-mm); line-height: 1.8; }

.transcript[data-mode='en'] .tr__my,
.transcript[data-mode='mm'] .tr__en { display: none; }

/* Up next ------------------------------------------------------------------ */

.upnext {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(6 8 11 / .88);
  backdrop-filter: blur(6px);
  border-radius: var(--r-lg);
  z-index: 20;
}
.upnext__card { text-align: center; padding: 2rem; }
.upnext__card p {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--text-3);
  margin-bottom: .3rem;
}
.upnext__card strong { display: block; font-size: 1.5rem; margin-bottom: 1rem; }
.upnext__actions { display: flex; gap: .6rem; justify-content: center; }
.upnext__bar {
  margin-top: 1.2rem;
  height: 3px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}
.upnext__bar i {
  display: block;
  height: 100%;
  background: var(--brand);
  animation: upnext 10s linear forwards;
}
@keyframes upnext { from { width: 0; } to { width: 100%; } }

/* -------------------------------------------------------------------------- */
/* Filters                                                                     */
/* -------------------------------------------------------------------------- */

.filters {
  display: flex;
  gap: .8rem;
  flex-wrap: wrap;
  align-items: flex-end;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  margin-bottom: 1.25rem;
}
.filters__field { display: flex; flex-direction: column; gap: .3rem; min-width: 140px; }
.filters__field--grow { flex: 1 1 220px; }
.filters__field label {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-3);
  font-weight: 700;
}
.filters input,
.filters select {
  padding: .5rem .7rem;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: .9rem;
}
.filters input:focus,
.filters select:focus { border-color: var(--brand); outline: none; }

.searchpage { margin-bottom: 1.25rem; }
.searchpage input {
  width: 100%;
  padding: .9rem 1.2rem;
  font-size: 1.05rem;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}
.searchpage input:focus { border-color: var(--brand); outline: none; }

/* -------------------------------------------------------------------------- */
/* Home pitch band                                                             */
/* -------------------------------------------------------------------------- */

.pitch {
  border-block: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  padding: 3rem 0;
}
.pitch__grid {
  display: grid;
  grid-template-columns: minmax(240px, .8fr) 1.2fr;
  gap: 2.5rem;
  align-items: start;
}
.pitch__grid h2 { font-size: clamp(1.4rem, 2.6vw, 2rem); }
.pitch__grid > div > p { color: var(--brand); }
.pitch__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
}
.pitch__list li { display: flex; flex-direction: column; gap: .25rem; }
.pitch__list strong { font-size: .98rem; }
.pitch__list span { color: var(--text-3); font-size: .88rem; }

@media (max-width: 800px) { .pitch__grid { grid-template-columns: 1fr; gap: 1.5rem; } }

/* -------------------------------------------------------------------------- */
/* Learn page                                                                  */
/* -------------------------------------------------------------------------- */

.learnhero {
  padding: calc(var(--header-h) * .5 + 3rem) 0 2.5rem;
  background:
    radial-gradient(1000px 400px at 15% -10%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%),
    var(--bg);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 2rem;
}
.learnhero h1 { max-width: 20ch; }
.learnhero__mm { color: var(--brand); font-size: 1.05rem; }
.learnhero__lede { color: var(--text-2); max-width: 65ch; }

.method { display: grid; gap: 1.2rem; }
.method__item { display: grid; grid-template-columns: 44px 1fr; gap: 1rem; align-items: start; }
.method__num {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent);
  color: var(--brand);
  font-weight: 800;
}
.method__item h3 { margin-bottom: .1rem; }
.method__mm { color: var(--brand); font-size: .88rem; margin-bottom: .35rem; }
.method__item p:last-child { color: var(--text-2); font-size: .93rem; margin: 0; }

.toolgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.1rem;
}
.toolgrid > div {
  background: var(--surface-2);
  border-radius: var(--r);
  padding: 1rem;
}
.toolgrid strong { display: block; margin-bottom: .25rem; }
.toolgrid p { color: var(--text-3); font-size: .88rem; margin: 0; }

.levelrow { display: flex; gap: .8rem; flex-wrap: wrap; }
.levelcard {
  --chip: var(--brand);
  flex: 1 1 130px;
  padding: 1rem;
  border-radius: var(--r);
  background: color-mix(in srgb, var(--chip) 10%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--chip) 30%, transparent);
  display: flex;
  flex-direction: column;
  gap: .2rem;
  transition: transform .16s var(--ease);
}
.levelcard:hover { transform: translateY(-3px); color: inherit; }
.levelcard strong { font-size: 1.3rem; color: var(--chip); }
.levelcard span { font-size: .82rem; color: var(--text-3); }

/* -------------------------------------------------------------------------- */
/* Static content pages (about, dmca)                                          */
/* -------------------------------------------------------------------------- */

.prose {
  max-width: 70ch;
  padding: calc(var(--header-h) * .5 + 2rem) 0 4rem;
}
.prose h2 { margin-top: 2rem; }
.prose p, .prose li { color: var(--text-2); }
.prose ul { list-style: disc; padding-left: 1.3rem; display: grid; gap: .4rem; margin-bottom: 1rem; }
.prose a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
