/* ============================================================================
   Public site, login, student area, watch page.
   Depends on base.css. Nothing here has a square corner.
   ============================================================================ */

/* ----------------------------------------------------------------- header --- */

.site-header {
  position: sticky;
  /* Positioning context for the mobile nav sheet, which hangs below it. */
  inset-block-start: 0;
  z-index: 40;
  background: rgb(10 27 52 / 0.82);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  color: var(--on-night);
  border-block-end: 1px solid rgb(255 255 255 / 0.07);
}

.site-header__inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 4.75rem;
}

.site-header .brand { color: var(--on-night); margin-inline-end: auto; }
.site-header .brand__role { color: var(--cobalt-pale); opacity: 1; }

.site-nav { display: flex; align-items: center; gap: 0.35rem; }

.site-nav a,
.site-nav button {
  padding: 0.55rem 1.05rem;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--on-night-dim);
  font-size: var(--step--1);
  font-weight: 400;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
.site-nav a:hover,
.site-nav button:hover { background: rgb(255 255 255 / 0.09); color: var(--on-night); }
.site-nav a[aria-current='page'] { color: var(--chrome); }

/* `.site-nav a` is (0,1,1) and would otherwise beat `.btn--gold` at (0,1,0),
   silently stripping the fill off any button in the nav. Matched deliberately
   rather than reaching for !important. */
.site-nav a.btn,
.site-nav button.btn {
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1.5px solid var(--btn-border);
}
.site-nav a.btn:hover,
.site-nav button.btn:hover { color: var(--btn-fg); }

.site-nav button.lang-toggle {
  border: 1.5px solid rgb(255 255 255 / 0.25);
  color: var(--on-night);
  font-size: var(--step--1);
}
.site-nav button.lang-toggle:hover { background: rgb(255 255 255 / 0.12); border-color: var(--chrome); }

/* ---- Mobile header ---------------------------------------------------------
   At 390px the brand, its role line and four nav items collide, and items wrap
   onto two lines each. Below 48rem the role line goes and the nav becomes a
   sheet behind a button. */

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  inline-size: 2.75rem;
  block-size: 2.75rem;
  padding: 0;
  border: 1.5px solid rgb(255 255 255 / 0.25);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--on-night);
  cursor: pointer;
}
.nav-toggle:hover { background: rgb(255 255 255 / 0.12); }

@media (max-width: 48rem) {
  .site-header__inner { min-height: 4rem; gap: 0.75rem; }
  .site-header .brand__role { display: none; }
  .brand__name { font-size: 1.3rem; }

  .nav-toggle { display: inline-flex; }

  .site-nav {
    position: absolute;
    inset-inline: 0;
    inset-block-start: 100%;
    z-index: 39;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    padding: 1rem var(--gutter) 1.35rem;
    background: rgb(8 20 40 / 0.97);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-end-start-radius: var(--r-lg);
    border-end-end-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);

    /* Collapsed by default; opened by the toggle. Animating max-block-size keeps
       it working without JS measuring anything. */
    max-block-size: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    padding-block: 0;
    transition: max-block-size 0.35s var(--ease), opacity 0.25s var(--ease),
                padding-block 0.35s var(--ease), visibility 0.35s;
  }
  .site-nav.is-open {
    max-block-size: 24rem;
    opacity: 1;
    visibility: visible;
    padding-block: 1rem 1.35rem;
  }
  .site-nav a,
  .site-nav button {
    padding: 0.85rem 1.1rem;
    font-size: var(--step-0);
    text-align: start;
  }
  .site-nav a.btn,
  .site-nav button.btn { justify-content: center; }
  .site-nav button.lang-toggle { align-self: flex-start; padding-inline: 1.35rem; }
}

@media (min-width: 48.01rem) {
  /* Never let the collapsed state leak onto a wide screen. */
  .site-nav { max-block-size: none; opacity: 1; visibility: visible; overflow: visible; }
}

/* ------------------------------------------------------------------- hero --- */

/* The whole night sky is a painting behind the words. */
.hero {
  position: relative;
  isolation: isolate;
  background: var(--night);
  color: var(--on-night);
  overflow: hidden;
  /* The bottom edge curves into the page. A straight join would be the one
     hard line on the page. */
  border-end-start-radius: clamp(2rem, 6vw, 5rem);
  border-end-end-radius: clamp(2rem, 6vw, 5rem);
}

.hero__sky {
  position: absolute;
  inset: -2%;
  z-index: -2;
}
.hero__sky svg { width: 100%; height: 100%; }

/* Softens the sky under the text so the words never fight the brushwork. */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(115% 85% at 22% 45%, rgb(10 27 52 / 0.94) 0%, rgb(10 27 52 / 0.62) 45%, transparent 78%),
    linear-gradient(to bottom, rgb(10 27 52 / 0.35), rgb(10 27 52 / 0.15) 40%, rgb(10 27 52 / 0.55));
}

.hero__inner {
  position: relative;
  padding-block: clamp(3.25rem, 13vw, 10rem);
  max-width: 42rem;
}

.hero h1 {
  color: var(--on-night);
  margin-block: 1rem 1.5rem;
}
.hero h1 em {
  display: block;
  font-style: italic;
  font-weight: 400;
  color: var(--chrome);
}
.hero p {
  color: var(--on-night-dim);
  font-size: var(--step-1);
  max-width: 34rem;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-block-start: 2.5rem;
}

/* Small facts under the hero buttons, so the first screen is never bare.
   A grid, not a flex row: three facts inside a 42rem column would otherwise
   wrap two-then-one and look like a mistake. On a phone they become two columns
   with the third beneath, which is deliberate and even. */
.hero__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 1.5rem 1.75rem;
  margin-block-start: clamp(2.25rem, 6vw, 3.5rem);
  padding-block-start: clamp(1.5rem, 4vw, 2rem);
  border-block-start: 1px solid rgb(255 255 255 / 0.12);
}
@media (max-width: 26rem) {
  .hero__facts { grid-template-columns: 1fr 1fr; }
  .hero__actions .btn { flex: 1 1 100%; }
}
.hero__fact strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 600;
  color: var(--chrome);
  line-height: 1;
}
:root[dir='rtl'] .hero__fact strong { font-family: var(--font-body); }
.hero__fact span {
  display: block;
  margin-block-start: 0.4rem;
  font-size: var(--step--1);
  color: var(--on-night-dim);
}

.scroll-hint {
  position: absolute;
  inset-block-end: 1.75rem;
  inset-inline-end: var(--gutter);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--step--1);
  color: var(--on-night-dim);
  animation: floatSlow 3.5s ease-in-out infinite;
}
@media (max-width: 48rem) { .scroll-hint { display: none; } }

/* --------------------------------------------------------------- sections --- */

.section-head { max-width: 46rem; margin-block-end: clamp(2rem, 5vw, 3.5rem); }
.section-head h2 { margin-block: 0.6rem 0.9rem; }
.section-head p { color: var(--ink-soft); }

.section-head__stroke { max-width: 9rem; margin-block-start: 1.25rem; opacity: 0.9; }

/* A warm band, for sections that need separating from the page without a rule. */
.band {
  background: var(--canvas-2);
  border-radius: clamp(2rem, 5vw, 4rem);
  margin-inline: var(--gutter);
  padding-inline: clamp(1.25rem, 4vw, 3.5rem);
}
@media (max-width: 40rem) { .band { margin-inline: 0.75rem; } }

/* -------------------------------------------------------------- how it works --- */

.steps {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  counter-reset: step;
}
.step { counter-increment: step; }
.step__n {
  display: grid;
  place-items: center;
  inline-size: 3.25rem;
  block-size: 3.25rem;
  margin-block-end: 1.1rem;
  border-radius: var(--r-pill);
  background: var(--night);
  color: var(--chrome);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
}
:root[dir='rtl'] .step__n { font-family: var(--font-body); }
.step__n::before { content: counter(step); }
.step h3 { font-size: var(--step-1); margin-block-end: 0.5rem; }
.step p { color: var(--ink-soft); font-size: var(--step--1); }

/* ------------------------------------------------------------ course grid --- */

.course-grid {
  display: grid;
  gap: clamp(1.25rem, 3vw, 2.25rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
}

.course-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease);
}
.course-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  color: inherit;
}

.course-card__art {
  position: relative;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  background: var(--night-2);
}
.course-card__art svg,
.course-card__art img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease);
}
.course-card:hover .course-card__art svg,
.course-card:hover .course-card__art img { transform: scale(1.06); }

.course-card__badge {
  position: absolute;
  inset-block-start: 0.9rem;
  inset-inline-start: 0.9rem;
  padding: 0.3em 0.9em;
  border-radius: var(--r-pill);
  background: rgb(10 27 52 / 0.72);
  backdrop-filter: blur(8px);
  color: var(--chrome);
  font-size: 0.76rem;
}

.course-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.6rem;
  padding: 1.4rem 1.55rem 1.6rem;
}
.course-card__body h3 { font-size: var(--step-1); }
.course-card__desc {
  color: var(--ink-soft);
  font-size: var(--step--1);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.course-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-block-start: auto;
  padding-block-start: 1rem;
  font-size: var(--step--1);
  color: var(--ink-faint);
}
.price {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 600;
  color: var(--night-3);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
:root[dir='rtl'] .price { font-family: var(--font-body); font-weight: 500; }
.price span { font-family: var(--font-body); font-size: 0.5em; font-weight: 300; color: var(--ink-faint); }

/* ------------------------------------------------------------ empty state --- */

/* The site ships with nothing in it, so this is the first thing anyone sees.
   It is a painting with an instruction on it, not a dashed grey box. */
.empty {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--night);
  color: var(--on-night);
  padding: clamp(3rem, 8vw, 6rem) clamp(1.5rem, 5vw, 4rem);
  text-align: center;
}
.empty__sky { position: absolute; inset: 0; opacity: 0.55; }
.empty__sky svg { width: 100%; height: 100%; }
.empty__inner { position: relative; max-width: 34rem; margin-inline: auto; }
.empty h3 { color: var(--on-night); margin-block-end: 0.75rem; }
.empty p { color: var(--on-night-dim); }
.empty .btn { margin-block-start: 1.75rem; }

/* ------------------------------------------------------------ course page --- */

.course-hero {
  position: relative;
  isolation: isolate;
  background: var(--night);
  color: var(--on-night);
  padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(3rem, 7vw, 5rem);
  border-end-start-radius: clamp(2rem, 6vw, 5rem);
  border-end-end-radius: clamp(2rem, 6vw, 5rem);
  overflow: hidden;
}
.course-hero__sky { position: absolute; inset: 0; z-index: -2; opacity: 0.85; }
.course-hero__sky svg { width: 100%; height: 100%; }
.course-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to bottom, rgb(10 27 52 / 0.72), rgb(10 27 52 / 0.9));
}
.course-hero h1 { color: var(--on-night); font-size: var(--step-3); margin-block: 0.75rem 1rem; }
.course-hero p { color: var(--on-night-dim); max-width: 52ch; }

.course-hero__grid {
  display: grid;
  gap: clamp(1.75rem, 4vw, 3.5rem);
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 56rem) {
  .course-hero__grid { grid-template-columns: 1fr 21rem; }
}
@media (max-width: 55.99rem) {
  /* Stacked: the price and the request button come FIRST, above the artwork,
     so the thing a visitor came to do is not below a picture. */
  .course-hero__grid > .buy-card { order: -1; }
}

.course-hero__art {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
.course-hero__art svg,
.course-hero__art img { width: 100%; height: 100%; object-fit: cover; }

.buy-card {
  padding: 1.75rem;
  background: var(--surface);
  border-radius: var(--r-lg);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.buy-card .price { display: block; margin-block-end: 0.35rem; }
.buy-card__note { font-size: var(--step--1); color: var(--ink-faint); margin-block-start: 1rem; }

/* ----------------------------------------------------------- lesson list --- */

/* Lessons are a sequence, so the numbering carries real information: it is the
   order they are taught in. */
.lesson-list { list-style: none; padding: 0; display: grid; gap: 0.75rem; }

.lesson {
  display: grid;
  grid-template-columns: 2.75rem 1fr auto;
  align-items: start;
  gap: 0.5rem 1.15rem;
  padding: 1.15rem 1.5rem;
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.lesson--playable { cursor: pointer; text-decoration: none; color: inherit; }
.lesson--playable:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow);
  color: inherit;
}
:root[dir='rtl'] .lesson--playable:hover { transform: translateX(-4px); }

.lesson__n {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 600;
  color: var(--chrome-deep);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
:root[dir='rtl'] .lesson__n { font-family: var(--font-body); }

.lesson__title { display: block; font-weight: 400; color: var(--ink); }
.lesson__desc { display: block; font-size: var(--step--1); color: var(--ink-soft); margin-block-start: 0.25rem; }
.lesson__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  margin-block-start: 0.5rem;
  font-size: var(--step--1);
  color: var(--ink-faint);
}
.lesson__side { display: flex; align-items: center; gap: 0.5rem; grid-column: 3; }

/* On a phone the badge cannot share a row with the title without squeezing it
   to two words, so it drops beneath and the row becomes two columns. */
@media (max-width: 40rem) {
  .lesson {
    grid-template-columns: 2rem 1fr;
    padding: 1rem 1.15rem;
    gap: 0.35rem 0.85rem;
  }
  .lesson__n { font-size: var(--step-1); }
  .lesson__side { grid-column: 2; margin-block-start: 0.5rem; }
}

.lock {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--step--1);
  color: var(--ink-faint);
}

/* ------------------------------------------------------------------ login --- */

.login-page {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: var(--night);
  overflow: hidden;
}
.login-page__sky { position: absolute; inset: 0; opacity: 0.75; }
.login-page__sky svg { width: 100%; height: 100%; }

.login-card {
  position: relative;
  width: min(100%, 28rem);
  padding: clamp(2rem, 5vw, 3rem);
  background: rgb(248 241 227 / 0.97);
  backdrop-filter: blur(20px);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
}
.login-card__mark { display: block; width: 60px; margin-inline: auto; margin-block-end: 1.25rem; }
.login-card h1 { font-size: var(--step-2); text-align: center; }
.login-card__sub {
  text-align: center;
  color: var(--ink-faint);
  font-size: var(--step--1);
  margin-block: 0.5rem 2rem;
}
.login-card__foot {
  margin-block-start: 1.5rem;
  text-align: center;
  font-size: var(--step--1);
  color: var(--ink-faint);
}

@keyframes shake {
  0%, 100% { translate: 0 0; }
  20%, 60% { translate: -7px 0; }
  40%, 80% { translate: 7px 0; }
}
.shake { animation: shake 0.45s var(--ease); }

/* -------------------------------------------------------------- dashboard --- */

.resume-bar {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem 1.85rem;
  background: var(--night);
  color: var(--on-night);
  border-radius: var(--r-lg);
  margin-block-end: 2.5rem;
}
.resume-bar__sky { position: absolute; inset: 0; opacity: 0.5; }
.resume-bar__sky svg { width: 100%; height: 100%; }
.resume-bar__text { position: relative; flex: 1 1 16rem; }
.resume-bar__text strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 600;
  color: var(--on-night);
}
:root[dir='rtl'] .resume-bar__text strong { font-family: var(--font-body); }
.resume-bar__text span { color: var(--on-night-dim); font-size: var(--step--1); }
.resume-bar .btn { position: relative; }

.progress {
  block-size: 6px;
  background: var(--canvas-3);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress__bar {
  block-size: 100%;
  background: linear-gradient(90deg, var(--chrome-deep), var(--chrome));
  border-radius: var(--r-pill);
  inline-size: var(--pct, 0%);
  transition: inline-size 0.8s var(--ease);
}

/* ------------------------------------------------------------- watch page --- */

body[data-page='watch'] { background: var(--night); color: var(--on-night); }

.watch {
  display: grid;
  gap: 1.75rem;
  grid-template-columns: 1fr;
  padding-block: 1.75rem 4rem;
}
@media (min-width: 66rem) {
  .watch { grid-template-columns: 1fr 22rem; align-items: start; }
}
@media (max-width: 40rem) {
  .watch { padding-block: 1rem 2.5rem; }
  .player-shell { border-radius: var(--r); }
  .watch-side { padding: 1rem; }
}

.player-shell {
  position: relative;
  background: #000;
  border-radius: var(--r-lg);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  box-shadow: var(--shadow-lg);
}
/* :not([hidden]): showMessage() in watch.js sets video.hidden = true on a
   playback error. Same override risk as .player-message and .btn above. */
.player-shell video:not([hidden]) { width: 100%; height: 100%; display: block; }

/* The forensic watermark. Values come from the SERVER, from the session; drawn
   on a canvas over the video rather than a positioned div. */
#watermark { position: absolute; inset: 0; pointer-events: none; width: 100%; height: 100%; }

.watch h1 { font-size: var(--step-2); color: var(--on-night); margin-block: 1.5rem 0.6rem; }
.watch__meta { color: var(--on-night-dim); font-size: var(--step--1); display: flex; gap: 1.25rem; flex-wrap: wrap; }
.watch__desc { color: var(--on-night-dim); margin-block-start: 1.25rem; max-width: var(--measure); }

.watch-side {
  background: rgb(255 255 255 / 0.055);
  border: 1px solid rgb(255 255 255 / 0.1);
  border-radius: var(--r-lg);
  padding: 1.4rem;
}
.watch-side h2 { font-size: var(--step-1); color: var(--on-night); margin-block-end: 1rem; }
.watch-side ol { list-style: none; padding: 0; display: grid; gap: 0.3rem; }
.watch-side a {
  display: grid;
  grid-template-columns: 1.9rem 1fr;
  gap: 0.7rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--r);
  color: var(--on-night-dim);
  text-decoration: none;
  font-size: var(--step--1);
  transition: background-color 0.3s var(--ease);
}
.watch-side a:hover { background: rgb(255 255 255 / 0.08); color: var(--on-night); }
.watch-side a[aria-current='true'] { background: var(--night-3); color: var(--on-night); }
.watch-side .n { color: var(--chrome); font-variant-numeric: tabular-nums; }

/* :not([hidden]) matters: any unconditional `display` on this selector beats
   the browser's built-in `[hidden] { display: none }` regardless of
   specificity, since normal author rules always win over the UA stylesheet.
   Without this guard the message stays in the layout — absolutely
   positioned over the whole player shell via `inset: 0` — and intercepts
   clicks/paint even while the `hidden` attribute is set. */
.player-message:not([hidden]) {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.75rem;
  text-align: center;
  padding: 2rem;
  background: var(--night);
  color: var(--on-night);
}

/* ------------------------------------------------------------ custom player --- */

/* The shell is the fullscreen target — never the <video> alone. The watermark
   canvas and the control bar are siblings of the video inside this element;
   requesting fullscreen on the video would leave both of them behind, which is
   exactly the bug this player fixes (a fullscreen recording with no watermark
   at all). Vendor-prefixed :fullscreen selectors cover older Safari. */
.player-shell:fullscreen,
.player-shell:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  aspect-ratio: unset;
}
.player-shell:focus-visible {
  outline: 2px solid var(--chrome);
  outline-offset: 3px;
}

/* --------------------------------------------------------- desktop rotate --- */

/* Video + watermark as one rotating unit (see watch.html). Base state: an
   absolutely positioned box filling the shell exactly like the bare <video>
   did before this wrapper existed — mobile and any landscape source get this
   and nothing else, unconditionally, regardless of what player-controls.js
   computes.
 *
 * margin: auto matters even here, where it has no visible effect (inset: 0
 * alone already fills the box): it is what makes the ROTATED state below
 * center correctly. An absolutely positioned box with all four inset offsets
 * AND an explicit width/height is over-constrained per spec, and auto
 * margins are the defined way to resolve that by centering rather than
 * pinning to a corner — removing this rule would only break the rotated
 * case, silently, while doing nothing visible to the common case. */
.player-rotate {
  position: absolute;
  inset: 0;
  margin: auto;
}

/* Portrait video on a fixed-landscape screen would otherwise sit in a narrow
   column with large black bars either side — rotating the DEVICE fixes this
   on a phone, but a monitor cannot rotate. --player-rotate-w/-h/-deg are set
   by player-controls.js, only ever for a portrait source, only ever once the
   viewport genuinely matches this query. [data-rotate] is a second, explicit
   gate: player-controls.js removes the attribute (not just the variables)
   whenever rotation should not apply, so there is no state where a stale
   custom property could combine with a change in this media query to rotate
   something that should not be. */
@media (orientation: landscape) and (hover: hover) and (pointer: fine) {
  .player-rotate[data-rotate] {
    width: var(--player-rotate-w);
    height: var(--player-rotate-h);
    transform: rotate(var(--player-rotate-deg));
    transform-origin: center center;
  }
}

/* -------------------------------------------------------------- spinner --- */

@keyframes playerSpin { to { transform: rotate(360deg); } }
/* :not([hidden]): the spinner is toggled via .hidden in player-controls.js.
   Same rule as everywhere else on this page — display must live only in the
   guarded form or it silently wins over the browser's [hidden] default. */
.player-spinner:not([hidden]) {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  color: var(--chrome);
  pointer-events: none;
}
.player-spinner svg { animation: playerSpin 0.9s linear infinite; }

/* -------------------------------------------------------------- controls --- */

.player-controls {
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 4;
  padding: 2.5rem 0.9rem 0.75rem;
  background: linear-gradient(to top, rgb(5 12 24 / 0.88) 0%, rgb(5 12 24 / 0.55) 55%, transparent 100%);
  opacity: 1;
  transition: opacity 0.25s var(--ease);
  /* The bar's own empty space (the gradient above the seek/button row) must
     let clicks fall through to the <video> beneath for click-to-toggle-play —
     only the actual controls should be clickable. */
  pointer-events: none;
}
.player-controls > * { pointer-events: auto; }
/* Auto-hide toggled by player-controls.js: on while paused/scrubbing/hovering,
   off after ~2.5s of inactivity during playback. pointer-events is dropped
   together with opacity so a hidden bar cannot eat clicks meant for the video
   underneath — the same class of bug the [hidden] fix addressed elsewhere on
   this page, guarded against here from the start rather than after the fact. */
.player-controls.is-hidden { opacity: 0; pointer-events: none; }
.player-shell:focus-visible .player-controls.is-hidden { opacity: 1; pointer-events: auto; }

.player-controls__row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-block-start: 0.6rem;
}
.player-spacer { flex: 1; }

/* :not([hidden]): btnQuality starts hidden (no hls.js levels known yet) and is
   un-hidden once the quality menu is built. Same rule as everywhere else on
   this page. */
.player-btn:not([hidden]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 2.25rem;
  block-size: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--on-night);
  cursor: pointer;
  transition: background-color 0.2s var(--ease);
}
.player-btn:hover { background: rgb(255 255 255 / 0.14); }
.player-btn:focus-visible { outline: 2px solid var(--chrome); outline-offset: 2px; }
.player-btn svg { width: 1.15rem; height: 1.15rem; }

.player-btn--text {
  width: auto;
  padding-inline: 0.65rem;
  font-size: var(--step--1);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* The manual rotate button is desktop-only, same gate as the rotation effect
   itself (see "desktop rotate" above) — both rules here match
   .player-btn--rotate:not([hidden]) so neither can lose a specificity tie to
   the general .player-btn:not([hidden]) rule regardless of source order; the
   media-query version is declared second so it wins when active. On a phone,
   or a desktop window without a fine pointer, the button never appears at
   all — there is nothing here for it to rotate correctly. */
.player-btn--rotate:not([hidden]) { display: none; }
@media (orientation: landscape) and (hover: hover) and (pointer: fine) {
  .player-btn--rotate:not([hidden]) { display: inline-flex; }
}

.player-time {
  color: var(--on-night-dim);
  font-size: 0.8rem;
  padding-inline: 0.3rem;
  white-space: nowrap;
}

/* ----------------------------------------------------------------- seek --- */

.player-seek {
  position: relative;
  padding-block: 0.5rem;
  cursor: pointer;
  touch-action: none;
}
.player-seek__track {
  position: relative;
  block-size: 4px;
  border-radius: var(--r-pill);
  background: rgb(255 255 255 / 0.22);
  overflow: visible;
}
.player-seek:hover .player-seek__track,
.player-seek:focus-visible .player-seek__track { block-size: 6px; }
.player-seek__buffered {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  inline-size: 0%;
  border-radius: var(--r-pill);
  background: rgb(255 255 255 / 0.4);
}
.player-seek__fill {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  inline-size: 0%;
  border-radius: var(--r-pill);
  background: var(--chrome);
}
.player-seek__handle {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 0%;
  inline-size: 12px;
  block-size: 12px;
  border-radius: var(--r-pill);
  background: var(--chrome);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.4);
  translate: -50% -50%;
  scale: 0;
  transition: scale 0.15s var(--ease);
}
.player-seek:hover .player-seek__handle,
.player-seek:focus-visible .player-seek__handle { scale: 1; }
.player-seek:focus-visible { outline: none; }
.player-seek:focus-visible .player-seek__track { outline: 2px solid var(--chrome); outline-offset: 4px; border-radius: var(--r-pill); }

.player-seek__tooltip {
  position: absolute;
  inset-block-end: 100%;
  translate: -50% -0.4rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--r-sm);
  background: rgb(5 12 24 / 0.92);
  color: var(--on-night);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}

/* --------------------------------------------------------------- volume --- */

.player-volume {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.player-volume__slider {
  inline-size: 0;
  opacity: 0;
  transition: inline-size 0.2s var(--ease), opacity 0.2s var(--ease), margin-inline-start 0.2s var(--ease);
  accent-color: var(--chrome);
  cursor: pointer;
}
/* Tap-to-reveal on touch (a JS-added .is-open class) as well as hover, since
   hover does not exist on touch devices at all. */
.player-volume:hover .player-volume__slider,
.player-volume.is-open .player-volume__slider {
  inline-size: 4.5rem;
  opacity: 1;
  margin-inline-start: 0.15rem;
}
.player-volume__slider:focus-visible { outline: 2px solid var(--chrome); outline-offset: 2px; }

/* ------------------------------------------------------------------ menu --- */

.player-menu-wrap { position: relative; }
.player-menu {
  position: absolute;
  inset-block-end: calc(100% + 0.5rem);
  inset-inline-end: 0;
  z-index: 5;
  min-inline-size: 6rem;
  padding: 0.35rem;
  border-radius: var(--r);
  background: rgb(10 20 38 / 0.97);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-lg);
}
.player-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  inline-size: 100%;
  padding: 0.45rem 0.7rem;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--on-night-dim);
  font-size: 0.8rem;
  text-align: start;
  cursor: pointer;
}
.player-menu button:hover { background: rgb(255 255 255 / 0.1); color: var(--on-night); }
.player-menu button:focus-visible { outline: 2px solid var(--chrome); outline-offset: -2px; }
.player-menu button[aria-checked='true'] { color: var(--chrome); font-weight: 600; }

@media (max-width: 30rem) {
  .player-controls { padding-inline: 0.6rem; }
  .player-btn { inline-size: 2rem; block-size: 2rem; }
  .player-time { display: none; } /* the seek bar carries this on a phone */
}

/* ------------------------------------------------------------------ about --- */

/* ---------------------------------------------------------------- teacher --- */

.about {
  display: grid;
  gap: clamp(1.75rem, 5vw, 4rem);
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 54rem) {
  .about { grid-template-columns: 0.8fr 1.2fr; }
  /* The painting stays alongside the text as it scrolls, which stops a long
     biography leaving a tall empty column beside it. */
  .about__art { position: sticky; top: 6.5rem; }
}

.about__art {
  aspect-ratio: 4 / 5;
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  max-height: 32rem;
}
.about__art svg { width: 100%; height: 100%; object-fit: cover; }

.about__name {
  font-size: var(--step-3);
  margin-block: 0.7rem 0.3rem;
}
.about__role {
  font-size: var(--step-1);
  color: var(--chrome-deep);
  margin-block-end: 1.25rem;
}
/* The standfirst carries the "since childhood, still building in 2026" line,
   which otherwise repeats what the first paragraph already says. */
.about__standfirst {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-style: italic;
  font-weight: 400;
  line-height: 1.35;
  color: var(--ink);
  padding-inline-start: 1.15rem;
  border-inline-start: 3px solid var(--chrome);
  margin-block-end: 1.75rem;
}
:root[dir='rtl'] .about__standfirst {
  font-family: var(--font-body);
  font-style: normal;
  font-size: var(--step-1);
}

.about__body { display: grid; gap: 1.15rem; color: var(--ink-soft); max-width: 60ch; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  list-style: none;
  padding: 0;
  margin-block-start: 1.75rem;
}
.tags li {
  padding: 0.42em 1.05em;
  border-radius: var(--r-pill);
  background: var(--canvas-2);
  color: var(--ink-soft);
  font-size: var(--step--1);
}

.about__cta { margin-block-start: 1.75rem; }

/* ----------------------------------------------------------------- footer --- */

.site-footer {
  position: relative;
  overflow: hidden;
  background: var(--night);
  color: var(--on-night-dim);
  padding-block: clamp(2.5rem, 6vw, 4rem);
  font-size: var(--step--1);
  border-start-start-radius: clamp(2rem, 6vw, 5rem);
  border-start-end-radius: clamp(2rem, 6vw, 5rem);
  margin-block-start: clamp(2rem, 5vw, 4rem);
}
.site-footer__sky { position: absolute; inset: 0; opacity: 0.4; }
.site-footer__sky svg { width: 100%; height: 100%; }
.site-footer__inner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2.5rem;
  align-items: center;
  justify-content: space-between;
}
@media (max-width: 40rem) {
  .site-footer__inner { flex-direction: column; align-items: flex-start; text-align: start; }
}
.site-footer a { color: var(--on-night); }
.site-footer a:hover { color: var(--chrome); }

/* ------------------------------------------------------------------ notice --- */

.notice {
  padding: 1rem 1.35rem;
  border-radius: var(--r);
  background: var(--warn-soft);
  color: #6E5410;
  font-size: var(--step--1);
  margin-block-end: 1.35rem;
}
.notice--danger { background: var(--danger-soft); color: var(--danger); }
