/* ─────────────────────────────────────────────────────────────────────────────
   Knights of the Old Republic · fan remake · consumer landing page
   Dark only. Self-hosted. Two faces: Cinzel (display), Source Sans 3 (text).
   ───────────────────────────────────────────────────────────────────────────── */

@font-face {
  font-family: "Cinzel";
  src: url("fonts/Cinzel.ttf") format("truetype");
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("fonts/SourceSans3.ttf") format("truetype");
  font-weight: 200 900;
  font-display: swap;
}

:root {
  --bg: #060708;
  --ink: #f2efe8;
  --ink-2: rgba(242, 239, 232, 0.74);
  --ink-3: rgba(242, 239, 232, 0.52);
  --gold: #c9a45c;
  --hair: rgba(242, 239, 232, 0.16);
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --text: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --pad: clamp(1.5rem, 5vw, 5.5rem);
  --ease-out: cubic-bezier(0.16, 0.7, 0.2, 1);
  --ease-film: cubic-bezier(0.55, 0.06, 0.3, 0.98);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; }
body {
  font: 400 1rem/1.5 var(--text);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; }
i { font-style: italic; }
::selection { background: rgba(201, 164, 92, 0.35); color: var(--ink); }

/* ── the mark (upper-left) and the technical link (upper-right) ────────────── */
.mark {
  position: fixed; top: 0; left: 0; z-index: 40;
  display: inline-flex; align-items: center; justify-content: center;
  padding: clamp(1rem, 2.4vw, 1.9rem) clamp(1.2rem, 3vw, 2.4rem);
  text-decoration: none;
  color: var(--ink);
}
.mark-a {
  display: inline-block;
  font: 600 1.55rem/1 var(--display);
  transform-origin: 50% 54%;
  transform: rotate(180deg);                 /* ∀ — the A, turned */
  transition: transform 1.1s var(--ease-film);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
}
.mark-a.small { font-size: 1em; text-shadow: none; margin-right: 0.15em; }
.js .mark:not(.turned) .mark-a { transform: rotate(0deg); }
.mark:focus-visible { outline: 1px solid var(--gold); outline-offset: -8px; }

.techlink {
  position: fixed; top: 0; right: 0; z-index: 40;
  padding: clamp(1.3rem, 2.9vw, 2.35rem) clamp(1.2rem, 3vw, 2.4rem);
  font: 500 0.7rem/1 var(--text);
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-3); text-decoration: none;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7);
  transition: color 0.4s;
}
.techlink:hover, .techlink:focus-visible { color: var(--ink); outline: none; }

/* ── the descent: scenes are scroll ranges, layers are fixed full-viewport stages ── */
.descent { position: relative; }
.js .scene { height: 230vh; }
.js .scene:first-of-type { height: 250vh; }
.js .tail { height: 100vh; }
.scene[hidden] { display: none; }

.layer {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
  isolation: isolate;
}
.js .layer {
  position: fixed; inset: 0;
  min-height: 0;
  visibility: hidden;
  opacity: 0;
  will-change: opacity;
}
.js .layer.live { visibility: visible; }

/* ── paintings: full-bleed, alive ─────────────────────────────────────────── */
.painting {
  background-color: var(--tone, var(--bg));
  background-size: cover; background-position: center;   /* background-image: the glow plate, inline */
}
.plate {
  position: absolute; inset: 0;
  transform-origin: 50% 50%;
  will-change: transform;
}
.plate img, video.plate {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%;
}
.painting::after {                          /* vignette */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 40%, rgba(0, 0, 0, 0.55) 100%);
}
.fx { position: absolute; inset: 0; pointer-events: none; will-change: transform, opacity; }
.flash {
  background: radial-gradient(ellipse 32% 38% at 36% 30%, rgba(170, 190, 255, 0.85), rgba(120, 140, 255, 0.25) 45%, transparent 70%);
  mix-blend-mode: screen; opacity: 0;
}
.ember {
  background: radial-gradient(ellipse 60% 45% at 50% 78%, rgba(255, 40, 30, 0.45), rgba(160, 20, 20, 0.18) 50%, transparent 75%);
  mix-blend-mode: screen; opacity: 0.4;
}
.ember.saber {
  background: radial-gradient(ellipse 22% 30% at 65% 82%, rgba(255, 60, 40, 0.55), rgba(200, 30, 20, 0.15) 50%, transparent 75%);
}
.haze {
  inset: -20%;
  background: radial-gradient(ellipse 35% 40% at 50% 55%, rgba(200, 225, 240, 0.22), transparent 70%);
  opacity: 0.5;
}
.haze-b { background: radial-gradient(ellipse 28% 32% at 30% 70%, rgba(200, 225, 240, 0.18), transparent 70%); }

.scrim { position: absolute; inset: 0; pointer-events: none; }
.scrim-left {
  background:
    linear-gradient(to right, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.45) 32%, transparent 62%),
    linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.25) 30%, transparent 55%);
}
.scrim-bottom {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.86) 0%, rgba(0, 0, 0, 0.55) 28%, rgba(0, 0, 0, 0.1) 52%, transparent 70%);
}

/* ── copy ─────────────────────────────────────────────────────────────────── */
.copy {
  position: absolute; z-index: 2;
  left: var(--pad); bottom: calc(var(--pad) + 3.2rem);
  max-width: 40rem;
  padding-right: var(--pad);
}
.copy-hero { max-width: 66rem; }
.copy-bottom {
  left: 50%; transform: translateX(-50%);
  text-align: center; padding: 0 1rem; max-width: 44rem; width: calc(100% - 2rem);
}
.eyebrow {
  font: 600 0.74rem/1.2 var(--text);
  letter-spacing: 0.34em; text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.2rem;
}
.title {
  font: 500 clamp(2.1rem, 4.1vw, 4.3rem)/1.08 var(--display);
  letter-spacing: 0.035em;
  color: var(--ink);
  text-wrap: balance;
  margin-bottom: 1.25rem;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}
.copy-hero .title { font-size: clamp(2.5rem, 4.9vw, 5.1rem); font-weight: 500; }
.title.quote { font-size: clamp(1.7rem, 2.9vw, 3.05rem); line-height: 1.2; letter-spacing: 0.02em; }
.lede {
  font: 400 clamp(1.05rem, 1.2vw, 1.3rem)/1.55 var(--text);
  color: var(--ink-2);
  max-width: 33rem;
}
.copy-bottom .lede { margin: 0 auto; }
.copy-hero .lede { font-size: clamp(1.15rem, 1.35vw, 1.45rem); color: var(--ink); opacity: 0.86; }

.label {
  position: absolute; z-index: 2;
  left: var(--pad); bottom: var(--pad);
  font: 500 0.68rem/1.4 var(--text);
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-3);
  display: flex; align-items: center; gap: 0.9rem;
  max-width: 60vw;
}
.label::before { content: ""; display: inline-block; width: 1.5rem; height: 1px; background: var(--gold); flex: none; }

/* entrances — time-based, once a scene is entered */
.js .copy > *, .js .layer > .label, .js .frame {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 1.2s ease, transform 1.5s var(--ease-out), letter-spacing 1.9s var(--ease-out);
}
.js .copy > .title { letter-spacing: 0.14em; }
.js .copy-hero > .title { letter-spacing: 0.2em; }
.js .title.quote { letter-spacing: 0.08em; }
.js .layer.in .copy > *, .js .layer.in > .label { opacity: 1; transform: none; }
.js .layer.in .copy > .title { letter-spacing: 0.035em; }
.js .layer.in .copy > .title.quote { letter-spacing: 0.02em; }
.js .copy > :nth-child(2) { transition-delay: 0.22s; }
.js .copy > :nth-child(3) { transition-delay: 0.62s; }
.js .copy > :nth-child(4) { transition-delay: 0.9s; }
.js .layer > .label { transition-delay: 1.1s; }
.js .layer.settle * { transition-duration: 0s !important; transition-delay: 0s !important; }

/* ── captures: shown whole, as proof ─────────────────────────────────────── */
.capture {
  background-color: var(--tone, var(--bg));
  display: grid;
  grid-template-columns: minmax(17rem, 26%) minmax(0, 1fr);
  column-gap: clamp(2rem, 3.5vw, 4.5rem);
  align-items: center;
  padding: var(--pad);
  padding-top: clamp(4rem, 8vh, 6rem);
}
.capture .glow { position: absolute; inset: 0; z-index: 0; background-size: cover; background-position: center; }
.capture .glow::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 62% 50%, rgba(6, 7, 8, 0.82), rgba(6, 7, 8, 0.985) 78%); }
.capture .copy, .capture .frame { position: relative; z-index: 1; }
.capture .copy { position: static; transform: none; max-width: 30rem; padding: 0; }
.capture .title { font-size: clamp(1.9rem, 3.1vw, 3.3rem); }
.capture .title.quote { font-size: clamp(1.5rem, 2.25vw, 2.45rem); }
.frame {
  position: relative;
  width: 100%;
  max-width: calc((100vh - 2 * var(--pad) - 3.5rem) * 16 / 9);
  justify-self: end;
  transform: translateX(36px) scale(0.975);
  transform-origin: 60% 50%;
  transition: opacity 1.4s ease, transform 1.8s var(--ease-out);
}
.js .layer.in .frame { opacity: 1; transform: none; }
.frame picture, .frame > video.shot { position: relative; display: block; overflow: hidden; aspect-ratio: 16 / 9; transform-origin: 50% 50%; will-change: transform;
  background: #000; box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.09); }
.frame picture img { width: 100%; height: 100%; object-fit: contain; }
/* a clip sits in the frame exactly where the still used to; the poster is its own first frame,
   so there is no jump between the placeholder and the moving picture */
.frame > video.shot { width: 100%; height: auto; object-fit: cover; }
.frame .sweep {
  position: absolute; inset: 0; z-index: 1; margin: 0;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, 0.09) 50%, transparent 58%);
  transform: translateX(-100%); opacity: 0;
}
.frame .label { position: static; margin-top: 1.1rem; max-width: none; }
.frame .label::before { display: none; }

/* optional 2003 reference for a side-by-side — drops into the corner of the frame */
.frame .ref {
  position: absolute; right: 1rem; bottom: 3.4rem; width: 26%; max-width: 320px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.frame .ref img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.frame .ref figcaption {
  position: absolute; left: 0; bottom: 0; padding: 0.25rem 0.55rem;
  font: 600 0.62rem/1.2 var(--text); letter-spacing: 0.2em; color: var(--ink);
  background: rgba(0, 0, 0, 0.6);
}
.frame .ref[hidden] { display: none; }

/* optional illustration strip (difficulty select) */
.strip { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.6rem; margin-top: 1rem; }
.strip img { aspect-ratio: 3 / 4; object-fit: cover; width: 100%; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.09); }
.strip span { display: block; margin-top: 0.45rem; font: 500 0.64rem/1.3 var(--text); letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); }

/* ── plain screens: system colours are welcome here ──────────────────────── */
.plain { background: var(--bg); display: grid; place-items: center; padding: var(--pad); }
.plain .copy { position: static; transform: none; text-align: center; max-width: 46rem; padding: 0; }
.plain .title { font-size: clamp(2rem, 3.6vw, 3.6rem); margin-bottom: 2.6rem; text-shadow: none; }
.axes { display: grid; gap: 1.5rem; text-align: left; max-width: 40rem; margin: 0 auto; }
.axes > div { display: grid; grid-template-columns: 9.5rem 1fr; gap: 1.5rem; align-items: baseline; padding-top: 1.4rem; border-top: 1px solid var(--hair); }
.axes dt { font: 500 0.95rem/1.3 var(--display); letter-spacing: 0.08em; color: var(--gold); }
.axes dd { font-size: clamp(1.05rem, 1.2vw, 1.25rem); color: var(--ink-2); }
.js .axes > div { opacity: 0; transform: translateY(14px); transition: opacity 1s ease, transform 1.3s var(--ease-out); }
.js .layer.in .axes > div { opacity: 1; transform: none; }
.js .axes > div:nth-child(1) { transition-delay: 0.7s; }
.js .axes > div:nth-child(2) { transition-delay: 1.1s; }
.js .axes > div:nth-child(3) { transition-delay: 1.5s; }

.studios { list-style: none; display: grid; max-width: 44rem; margin: 0 auto 3rem; text-align: left; }
.studios li { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: baseline; padding: 1.3rem 0; border-top: 1px solid var(--hair); }
.studios li:last-child { border-bottom: 1px solid var(--hair); }
.studios strong { font: 500 clamp(1.2rem, 1.7vw, 1.65rem)/1.2 var(--display); letter-spacing: 0.04em; color: var(--ink); }
.studios span { font-size: 0.98rem; color: var(--ink-2); }
.js .studios li { opacity: 0; transform: translateY(12px); transition: opacity 1s ease, transform 1.3s var(--ease-out); }
.js .layer.in .studios li { opacity: 1; transform: none; }
.js .studios li:nth-child(1) { transition-delay: 0.5s; }
.js .studios li:nth-child(2) { transition-delay: 0.9s; }
.js .studios li:nth-child(3) { transition-delay: 1.3s; }
.js .studios li:nth-child(4) { transition-delay: 1.7s; }
.legal { font-size: 0.9rem; line-height: 1.6; color: var(--ink-3); max-width: 40rem; margin: 0 auto 2.2rem; }
.js .credits .copy > .legal { transition-delay: 2.4s; }
.colophon { font: 500 0.72rem/1 var(--text); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-3);
  display: flex; justify-content: center; align-items: center; gap: 1.2rem; }
.js .credits .copy > .colophon { transition-delay: 2.8s; }
.colophon a { text-decoration: none; color: var(--ink-2); padding-bottom: 2px; border-bottom: 1px solid var(--hair); transition: color 0.4s, border-color 0.4s; }
.colophon a:hover, .colophon a:focus-visible { color: var(--ink); border-color: var(--gold); outline: none; }
.colophon .dot { color: var(--gold); }
.colophon .turneda { display: inline-flex; align-items: center; gap: 0.2rem; }

/* ── veil, grain ───────────────────────────────────────────────────────────── */
.veil { position: fixed; inset: 0; z-index: 50; background: #000; pointer-events: none; opacity: 1; transition: opacity 1.8s ease; }
.no-js .veil, .veil.off { opacity: 0; }
.grain {
  position: fixed; inset: -50%; z-index: 30; pointer-events: none;
  background: url("img/grain.png") repeat; background-size: 160px 160px;
  opacity: 0.055;
  animation: grain 0.9s steps(7) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 15% { transform: translate(-3%, -5%); } 30% { transform: translate(4%, 2%); }
  45% { transform: translate(-2%, 6%); } 60% { transform: translate(6%, -3%); } 75% { transform: translate(-5%, 4%); } 100% { transform: translate(2%, -2%); }
}

/* ── HUD ───────────────────────────────────────────────────────────────────── */
.hud {
  position: fixed; right: var(--pad); bottom: var(--pad); z-index: 40;
  display: flex; align-items: center; gap: 1.4rem;
  transform: translateY(calc(0.1rem));
}
.no-js .hud { display: none; }
.ticks { list-style: none; display: flex; gap: 0.45rem; align-items: center; margin-right: 0.6rem; }
.ticks li a {
  display: block; width: 0.95rem; height: 1.2rem; position: relative; opacity: 0.42; transition: opacity 0.4s, width 0.6s var(--ease-out);
}
.ticks li a::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--ink); }
.ticks li a:hover, .ticks li a:focus-visible { opacity: 0.9; outline: none; }
.ticks li.on a { opacity: 1; width: 1.6rem; }
.ticks li.on a::after { background: var(--gold); }
.ctl {
  appearance: none; background: none; border: 0; cursor: pointer;
  font: 500 0.68rem/1 var(--text); letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-3); padding: 0.5rem 0;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7);
  transition: color 0.4s;
  min-width: 5.4em; text-align: right;
}
.ctl:hover, .ctl:focus-visible { color: var(--ink); outline: none; }
.ctl[data-sound][aria-pressed="true"] { color: var(--gold); }
.ctl[data-sound][aria-pressed="true"]:hover { color: var(--ink); }

/* ── portrait / small screens ─────────────────────────────────────────────── */
@media (max-width: 999px) {
  :root { --pad: clamp(1.25rem, 5vw, 2.5rem); }
  .capture { grid-template-columns: 1fr; row-gap: 1.5rem; align-content: center; padding-top: 5rem; padding-bottom: 5.5rem; }
  .capture .copy { order: 1; }
  .frame { order: 2; max-width: none; justify-self: stretch; }
  .frame .label { font-size: 0.62rem; }
  .copy { bottom: calc(var(--pad) + 3.6rem); max-width: none; padding-right: 1rem; }
  .label { max-width: 80vw; }
  .axes > div { grid-template-columns: 1fr; gap: 0.4rem; }
  .studios li { grid-template-columns: 1fr; gap: 0.3rem; }
  .hud { gap: 1.1rem; right: var(--pad); bottom: auto; top: clamp(1rem, 2.4vw, 1.9rem); transform: none; }
  .hud .ctl { min-width: 0; }
  .ticks { display: none; }
  .techlink { display: none; }
}
@media (max-width: 999px) and (orientation: portrait) {
  .plate img, video.plate { object-position: 46% 45%; }
}
@media (max-height: 560px) {
  .copy { bottom: calc(var(--pad) + 2.4rem); }
  .lede { display: none; }
}

/* ── reduced motion: no camera moves; dissolves and entrances stay short ──── */
@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .js .copy > *, .js .layer > .label, .js .frame, .js .axes > div, .js .studios li { transform: none; transition-duration: 0.7s; }
  .js .copy > .title, .js .copy-hero > .title, .js .title.quote { letter-spacing: 0.035em; }
  .mark-a { transition-duration: 0.5s; }
}

/* ── forced colours (Windows contrast themes) ─────────────────────────────── */
@media (forced-colors: active) {
  .layer.painting, .layer.capture { forced-color-adjust: none; }   /* own scrim, own white text */
  .layer.plain { forced-color-adjust: auto; }                      /* follow the system colours */
  .layer.painting .copy, .layer.capture .copy { color: #fff; }
  .layer.painting .lede, .layer.capture .lede, .layer.painting .label, .layer.capture .label { color: #fff; }
  .layer.painting .eyebrow, .layer.capture .eyebrow { color: #ffd98a; }
  .scrim-left {
    background:
      linear-gradient(to right, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 38%, transparent 66%),
      linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.45) 36%, transparent 60%);
  }
  .scrim-bottom { background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.8) 34%, rgba(0, 0, 0, 0.2) 58%, transparent 72%); }
  .capture .glow { display: none; }
  .capture { background-color: #000; }
  .grain { display: none; }
  .axes > div, .studios li { border-color: CanvasText; }
  .axes dt, .eyebrow, .colophon .dot { color: CanvasText; }
  .ticks li a::after { background: ButtonText; }
  .ticks li.on a::after { background: Highlight; }
  .ctl { border: 1px solid ButtonText; padding: 0.5rem 0.7rem; color: ButtonText; background: ButtonFace; text-align: center; }
  .ctl[data-sound][aria-pressed="true"] { color: Highlight; }
  .mark, .techlink { forced-color-adjust: none; color: #fff; }
  .mark .mark-a, .techlink { text-shadow: 0 0 2px #000, 0 0 6px #000, 0 1px 14px #000; }
  .colophon a { color: LinkText; border-color: LinkText; }
}
