/* The Logical Computer — page chrome for the HyperFrames film */

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/fonts/space-grotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/fonts/plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0b0e17;
  --panel: #121722;
  --panel-2: #171d2a;
  --ink: #f4efe4;
  --muted: #9aa3b5;
  --faint: #6d7688;
  --line: rgba(244, 239, 228, 0.14);
  --line-soft: rgba(244, 239, 228, 0.07);
  --orange: #e85d2a;
  --orange-soft: #f4a17e;
  --indigo: #6a6fd6;
  --paper: #dfe2de;
  --sans: "Space Grotesk", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: none;
  border: 0;
}
a { color: inherit; text-decoration: none; }
::selection { background: rgba(232, 93, 42, 0.35); color: #fff; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }

.skip {
  position: fixed;
  z-index: 200;
  left: 16px;
  top: -70px;
  padding: 10px 15px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  transition: top 0.2s;
}
.skip:focus { top: 16px; }

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(80% 60% at 50% 0%, #1b2033 0%, #0d111b 55%, #070a11 100%);
}
.wall-grid {
  position: absolute;
  inset: -20%;
  background-image:
    linear-gradient(rgba(244, 239, 228, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 239, 228, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  transform: perspective(900px) rotateX(62deg) translateY(28%);
  transform-origin: 50% 100%;
  mask-image: linear-gradient(transparent 10%, #000 60%, transparent 95%);
}
.wall-light {
  position: absolute;
  left: 50%;
  top: -20%;
  width: 70%;
  height: 60%;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(106, 111, 214, 0.16), transparent 70%);
}

/* -------------------------------------------------------------------- chrome */
.topbar {
  position: relative;
  z-index: 20;
  flex: 0 0 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 2.4vw, 32px);
  background: linear-gradient(180deg, rgba(7, 10, 17, 0.92), rgba(7, 10, 17, 0));
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px; border-radius: 10px; }
.brand:hover { background: rgba(244, 239, 228, 0.05); }
.brand-mark {
  width: 28px;
  height: 28px;
  fill: rgba(232, 93, 42, 0.08);
  stroke: var(--orange);
  stroke-width: 1.2;
  stroke-linejoin: round;
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-size: 12px; font-weight: 700; letter-spacing: 2.4px; }
.brand-sub {
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
}
.top-links { display: flex; align-items: center; gap: 4px; font-size: 11px; }
.top-links a,
.top-button {
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.top-links a:hover,
.top-button:hover { border-color: var(--line); background: rgba(18, 23, 34, 0.7); color: var(--ink); }
.top-button {
  border-color: var(--line);
  background: rgba(18, 23, 34, 0.5);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------- stage */
.stage {
  position: relative;
  z-index: 5;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 6px clamp(12px, 2vw, 24px) 0;
}
.player-wrap {
  position: relative;
  width: min(1500px, calc(100vw - 48px), calc((100dvh - 190px) * 16 / 9));
  aspect-ratio: 16 / 9;
  background: #05070d;
  border: 1px solid rgba(244, 239, 228, 0.18);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
hyperframes-player { display: block; width: 100%; height: 100%; }

/* -------------------------------------------------------------------- poster */
.poster {
  position: absolute;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  background: #0b0e17;
  transition: opacity 0.7s ease, visibility 0.7s;
}
.poster.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.poster-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% top;
  filter: saturate(0.92) contrast(1.02);
}
.poster-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 10, 18, 0.97) 0%, rgba(8, 10, 18, 0.92) 40%, rgba(8, 10, 18, 0.55) 62%, rgba(8, 10, 18, 0.18) 80%, rgba(8, 10, 18, 0.5) 100%);
}
.poster::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 140px;
  background: linear-gradient(0deg, #080a12 0%, rgba(8, 10, 18, 0.95) 40%, transparent 100%);
  z-index: 1;
  pointer-events: none;
}
.poster-copy, .poster-foot { z-index: 2; }
.poster-copy {
  position: absolute;
  left: clamp(26px, 5vw, 76px);
  top: 50%;
  transform: translateY(-50%);
  width: min(560px, 54%);
}
.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--orange-soft);
}
.poster h1 {
  margin: 18px 0 0;
  font-size: clamp(52px, 6.6vw, 106px);
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: -0.065em;
  color: var(--ink);
}
.poster h1 em { font-style: normal; color: var(--orange); }
.poster-sub {
  margin: 24px 0 0;
  max-width: 420px;
  font-size: 18px;
  line-height: 1.45;
  color: #d7d2c7;
}
.poster-actions { margin-top: 30px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.play-film {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px 14px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-size: 14px;
  transition: background 0.2s, transform 0.2s;
}
.play-film:hover { background: var(--orange); color: #fff; transform: translateY(-1px); }
.play-film svg { width: 17px; height: 17px; fill: currentColor; }
.text-button {
  padding: 8px 0;
  border-bottom: 1px solid rgba(244, 239, 228, 0.35);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink);
}
.text-button:hover { border-color: var(--orange); color: var(--orange-soft); }
.poster-meta {
  margin-top: 30px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--faint);
}
.poster-foot {
  position: absolute;
  left: clamp(26px, 5vw, 76px);
  bottom: 18px;
  margin: 0;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: rgba(244, 239, 228, 0.45);
}

/* ------------------------------------------------------------------ controls */
.controls {
  position: relative;
  z-index: 15;
  flex: 0 0 84px;
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.4vw, 16px);
  width: min(1500px, calc(100% - 24px));
  margin: 0 auto;
  padding: 0 4px;
  color: var(--ink);
}
.ctrl-left, .ctrl-right { display: flex; align-items: center; gap: 2px; }
.ctrl {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.ctrl:hover { background: rgba(244, 239, 228, 0.08); color: var(--ink); }
.ctrl svg { width: 16px; height: 16px; fill: currentColor; }
.ctrl.play { width: 42px; height: 42px; background: var(--ink); color: var(--bg); }
.ctrl.play:hover { background: var(--orange); color: #fff; }
.ctrl.play svg { width: 18px; height: 18px; }
.icon-pause { display: none; }
body.is-playing .icon-play { display: none; }
body.is-playing .icon-pause { display: block; }

.chapter-now {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 300px;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: left;
  color: var(--ink);
}
.chapter-now:hover { background: rgba(244, 239, 228, 0.06); }
.chapter-now #chapter-index {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--orange);
}
.chapter-now #chapter-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.chapter-now svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; flex: none; }

.scrub-wrap { flex: 1 1 auto; min-width: 80px; }
.scrub {
  position: relative;
  height: 20px;
  cursor: pointer;
  touch-action: none;
}
.scrub::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 9px;
  height: 2px;
  background: rgba(244, 239, 228, 0.28);
}
.scrub-fill {
  position: absolute;
  left: 0;
  top: 9px;
  height: 2px;
  width: 0;
  background: var(--orange);
}
.scrub-head {
  position: absolute;
  left: 0;
  top: 5px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--orange);
  box-shadow: 0 0 0 3px rgba(232, 93, 42, 0.15);
}
.time-row {
  display: flex;
  justify-content: space-between;
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.8px;
  color: var(--muted);
}

/* ----------------------------------------------------------------- chapters */
.chapter-menu[hidden] { display: none; }
.chapter-menu {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 7, 12, 0.78);
  backdrop-filter: blur(14px);
}
.chapter-box {
  width: min(1080px, 100%);
  max-height: min(86dvh, 860px);
  overflow: auto;
  padding: clamp(20px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(160deg, #151b28, #0e131d);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
}
.chapter-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.chapter-head h2 { margin: 8px 0 0; font-size: 34px; letter-spacing: -0.04em; font-weight: 500; }
.close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
}
.close:hover { border-color: var(--orange); color: var(--ink); }
.chapter-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.chapter-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 16px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(244, 239, 228, 0.025);
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
}
.chapter-card:hover { border-color: rgba(232, 93, 42, 0.5); background: rgba(232, 93, 42, 0.06); }
.chapter-card.is-current { border-color: var(--orange); }
.chapter-card .ch-no { font-family: var(--mono); font-size: 10px; color: var(--orange); }
.chapter-card .ch-title { font-size: 15px; line-height: 1.3; }
.chapter-card .ch-time { font-family: var(--mono); font-size: 9px; color: var(--faint); }

/* ---------------------------------------------------------------- transcript */
.transcript {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 110;
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, #151b28, #0b1019);
  border-left: 1px solid var(--line);
  box-shadow: -40px 0 100px rgba(0, 0, 0, 0.45);
  transform: translateX(103%);
  visibility: hidden;
  transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1), visibility 0s linear 0.45s;
}
.transcript.is-open { transform: none; visibility: visible; transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1), visibility 0s; }
.transcript-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--line);
}
.transcript-head h2 { margin: 8px 0 0; font-size: 34px; letter-spacing: -0.04em; font-weight: 500; }
.transcript-body { flex: 1; overflow: auto; padding: 8px 24px 40px; scrollbar-width: thin; }
.tr-chapter { padding: 22px 0 16px; border-bottom: 1px solid var(--line-soft); }
.tr-chapter:last-child { border-bottom: 0; }
.tr-chapter h3 {
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.2px;
  color: var(--orange);
  font-weight: 400;
}
.tr-chapter h4 { margin: 7px 0 12px; font-size: 18px; letter-spacing: -0.02em; font-weight: 500; }
.tr-chapter p { margin: 0 0 10px; font-size: 14px; line-height: 1.6; color: #cdd1d8; }
.tr-chapter p::before { content: "—"; margin-right: 8px; color: var(--orange); }

.mobile-caption { display: none; }

/* ------------------------------------------------------------------- small */
.noscript {
  display: none;
  position: fixed;
  inset: auto 20px 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  font-size: 13px;
  z-index: 150;
}
body.no-js .noscript { display: block; }

@media (max-width: 980px) {
  .chapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .poster-copy { width: min(520px, 62%); }
}

@media (max-width: 720px) {
  .topbar { flex-basis: 58px; padding: 0 12px; }
  .brand-sub { display: none; }
  .top-links { gap: 0; }
  .top-links a { padding: 7px 8px; font-size: 10px; }
  .top-links a:nth-child(2) { display: none; }
  .top-button { padding: 7px 9px; font-size: 8px; }
  .stage { padding: 4px 0 0; place-items: start center; align-content: start; }
  .mobile-caption {
    display: block;
    width: 100%;
    padding: 14px 18px 16px;
    background: var(--panel);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  .mobile-caption .eyebrow { display: block; margin-bottom: 6px; font-size: 8px; }
  .mobile-caption p { margin: 0; font-size: 15px; line-height: 1.45; color: var(--ink); }
  body:not(.started) .mobile-caption { display: none; }
  .player-wrap {
    width: 100vw;
    border-left: 0;
    border-right: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  }
  .poster { position: fixed; top: 58px; right: 0; bottom: 64px; left: 0; z-index: 12; }
  .poster-bg { object-position: 70% top; }
  .poster-scrim {
    background:
      linear-gradient(90deg, rgba(8, 10, 18, 0.96) 0%, rgba(8, 10, 18, 0.82) 58%, rgba(8, 10, 18, 0.46) 100%),
      linear-gradient(0deg, rgba(8, 10, 18, 0.98) 0%, transparent 58%);
  }
  .poster-copy { left: 22px; right: 22px; width: auto; top: 50%; transform: translateY(-50%); }
  .poster h1 { font-size: clamp(42px, 12vw, 62px); }
  .poster-sub { margin-top: 16px; max-width: 300px; font-size: 14px; }
  .poster-actions { margin-top: 20px; flex-direction: column; align-items: flex-start; gap: 12px; }
  .play-film { padding: 11px 15px 11px 18px; font-size: 12px; }
  .poster-meta { margin-top: 18px; gap: 10px; font-size: 8px; }
  .poster-foot { bottom: 12px; left: 22px; font-size: 7px; }
  .controls { flex-basis: 64px; gap: 4px; width: 100%; padding: 0 8px; }
  .ctrl-left .ctrl:not(.play) { display: none; }
  .ctrl.play { width: 38px; height: 38px; }
  .chapter-now { max-width: 120px; padding: 6px; gap: 6px; }
  .chapter-now #chapter-name { font-size: 10px; }
  .chapter-now svg { display: none; }
  .ctrl-right .ctrl { width: 30px; height: 30px; }
  .time-row { font-size: 7px; }
  .chapter-menu { padding: 12px; }
  .chapter-box { padding: 18px; max-height: 88dvh; }
  .chapter-grid { grid-template-columns: 1fr; gap: 7px; }
  .chapter-head h2, .transcript-head h2 { font-size: 28px; }
  .transcript { width: 100%; }
  .transcript-body { padding: 8px 18px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}
