/* ---------- Fonts: same Archivo variable files as the deck ---------- */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("assets/archivo-variable-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("assets/archivo-variable-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens: lifted from the deck / redesign system ---------- */
:root {
  --c-cream-100: #fdf8f2;
  --c-white: #ffffff;
  --c-ink-900: #0c0b0a;
  --c-grey-600: #656c6c;
  --c-grey-400: #706a60;
  --c-grey-200: #e4e2df;
  --c-grey-100: #f2f1ef;
  --c-green-900: #154618;
  --c-lime-400: #adee68;
  --c-lime-300: #cef5a4;

  --f-sans: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --shadow-rest: 0 1px 2px rgb(12 11 10 / 0.04), 0 4px 16px rgb(12 11 10 / 0.05);
  --shadow-hover: 0 2px 4px rgb(12 11 10 / 0.05), 0 14px 36px rgb(12 11 10 / 0.1);
  --ease: cubic-bezier(0.33, 1, 0.68, 1);

  /* semantic theme tokens — light */
  color-scheme: light;
  --bg: var(--c-white);
  --text: var(--c-ink-900);
  --text-muted: var(--c-grey-600);
  --heading: var(--c-green-900);
  --border: var(--c-grey-200);
  --surface: var(--c-grey-100);
  --icon-hover-bg: var(--c-lime-300);
  --icon-hover-fg: var(--c-green-900);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #100f0e;
  --text: var(--c-cream-100);
  --text-muted: #9b968f;
  --heading: var(--c-lime-400);
  --border: rgb(253 248 242 / 0.16);
  --surface: #1c1a18;
  --icon-hover-bg: var(--c-lime-400);
  --icon-hover-fg: var(--c-green-900);
  --shadow-rest: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.35);
  --shadow-hover: 0 2px 4px rgb(0 0 0 / 0.35), 0 14px 36px rgb(0 0 0 / 0.5);
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-sans);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--heading);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 50;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 240ms var(--ease), color 240ms var(--ease);
}

.theme-toggle:hover {
  background: var(--surface);
  color: var(--text);
}

.theme-toggle svg {
  width: 1.125rem;
  height: 1.125rem;
}

.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* Theme switch: a plain cross-fade. js/theme.js sets data-theme-fade for the
   duration of the flip, and only then do colour properties transition — the
   rest of the time, hover effects keep their own narrower transitions. */
:root[data-theme-fade],
:root[data-theme-fade] *,
:root[data-theme-fade] *::before,
:root[data-theme-fade] *::after {
  transition: background-color 120ms ease, color 120ms ease,
    border-color 120ms ease, box-shadow 120ms ease, fill 120ms ease !important;
}

/* ---------- Splash: intro left, artifacts right ---------- */
.page {
  max-width: 78rem;
  margin: 0 auto;
  min-height: 100svh;
  display: grid;
  align-content: center;
  padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1.25rem, 5vw, 3.5rem);
}

.splash {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: center;
}

.intro__eyebrow {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--heading);
}

.intro__title {
  margin: 0.875rem 0 0;
  font-weight: 740;
  font-stretch: 82%;
  font-size: clamp(2.25rem, 4.5vw, 4rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  color: var(--heading);
  text-wrap: balance;
}

.intro__byline {
  margin: 1rem 0 0;
  font-size: 1rem;
  font-weight: 480;
  color: var(--text-muted);
}

.intro__social {
  display: flex;
  gap: 0.25rem;
  margin: 0.625rem 0 0 -0.75rem;
}

.intro__social a {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  color: var(--text-muted);
  transition: color 240ms var(--ease), background 240ms var(--ease);
}

.intro__social a:hover {
  color: var(--icon-hover-fg);
  background: var(--icon-hover-bg);
}

.intro__social svg {
  width: 1.125rem;
  height: 1.125rem;
}

/* ---------- Artifact rows ---------- */
.artifacts {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.25rem);
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(1rem, 2.5vw, 1.75rem);
  align-items: start;
}

.row__media {
  appearance: none;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  overflow: hidden;
  background: var(--surface);
  aspect-ratio: 16 / 10;
  cursor: pointer;
  box-shadow: var(--shadow-rest);
  transition: transform 240ms var(--ease), box-shadow 240ms var(--ease);
}

.row__media:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.row__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 300ms var(--ease);
}

.row__media:hover img,
.row__media:focus-visible img {
  transform: scale(1.02);
}

.row__title {
  margin: 0;
  font-size: 1.3125rem;
  font-weight: 680;
  font-stretch: 92%;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--heading);
}

.row__desc {
  margin: 0.625rem 0 0;
  font-size: 0.9375rem;
  color: var(--text);
  max-width: 24rem;
}

.row__link {
  color: var(--text);
  font-weight: 700;
  text-underline-offset: 3px;
  transition: color 200ms var(--ease);
}

.row__link:hover {
  color: var(--heading);
}

/* the recording link opens a dialog, so it is a button wearing link clothes */
.row__link--btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

/* the prototype's heading is its own call to action — no separate button */
.row__title-link {
  color: inherit;
  text-decoration: none;
}

.row__title-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.row__title-arrow {
  width: 0.75em;
  height: 0.75em;
  margin-left: 0.375rem;
  vertical-align: baseline;
  transition: transform 200ms var(--ease);
}

.row__title-link:hover .row__title-arrow {
  transform: translate(2px, -2px);
}

/* ---------- Responsive ---------- */
@media (max-width: 56rem) {
  .splash {
    grid-template-columns: 1fr;
    gap: clamp(2rem, 6vw, 3rem);
    align-items: start;
    min-height: 0;
  }
}

@media (max-width: 36rem) {
  .row {
    grid-template-columns: 1fr;
    gap: 0.875rem;
  }
  .row__desc {
    max-width: none;
  }
  /* clear the fixed theme toggle, which sits over the intro up here */
  .page {
    padding-top: 4.75rem;
  }
}

/* ---------- Load reveal ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    animation: rise 640ms var(--ease) both;
  }
  .reveal--1 { animation-delay: 60ms; }
  .reveal--2 { animation-delay: 140ms; }
  .reveal--3 { animation-delay: 220ms; }
  .reveal--4 { animation-delay: 300ms; }
  .reveal--5 { animation-delay: 420ms; }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(14px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}

/* ---------- PDF viewer modal ---------- */
.viewer {
  width: min(96vw, 96rem);
  height: 94vh;
  padding: 0;
  border: 0;
  border-radius: 1rem;
  background: var(--c-ink-900);
  color: var(--c-cream-100);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.viewer[open] {
  display: flex;
}

.viewer::backdrop {
  background: rgb(12 11 10 / 0.82);
}

@media (prefers-reduced-motion: no-preference) {
  .viewer[open] {
    animation: viewer-in 240ms var(--ease);
  }
  @keyframes viewer-in {
    from {
      opacity: 0;
      transform: translateY(10px) scale(0.985);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}

.viewer__bar {
  display: flex;
  justify-content: flex-end;
  padding: 0.75rem 0.875rem 0;
}

.viewer__close {
  appearance: none;
  background: none;
  border: 1px solid rgb(253 248 242 / 0.25);
  border-radius: 999px;
  padding: 0.4375rem 1rem;
  font-size: 0.875rem;
  font-weight: 560;
  cursor: pointer;
  transition: background 200ms var(--ease), border-color 200ms var(--ease);
}

.viewer__close:hover {
  background: rgb(253 248 242 / 0.12);
}

.viewer :focus-visible {
  outline-color: var(--c-lime-400);
}

.viewer__stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0.875rem clamp(0.875rem, 3vw, 2rem);
  position: relative;
}

#viewer-canvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: 0.375rem;
  box-shadow: 0 8px 40px rgb(0 0 0 / 0.5);
  opacity: 0;
  transition: opacity 200ms var(--ease);
}

#viewer-canvas.is-ready {
  opacity: 1;
}

.viewer__status {
  position: absolute;
  margin: 0;
  font-size: 0.9375rem;
  color: rgb(253 248 242 / 0.65);
}

.viewer__status[hidden] {
  display: none;
}

.viewer__nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0 clamp(0.875rem, 3vw, 2rem) 1rem;
}

.viewer__navbtn {
  appearance: none;
  background: none;
  border: 0;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 560;
  color: var(--c-cream-100);
  cursor: pointer;
  transition: background 200ms var(--ease), opacity 200ms var(--ease);
  justify-self: start;
}

.viewer__navbtn:last-child {
  justify-self: end;
}

.viewer__navbtn:hover:not(:disabled) {
  background: rgb(253 248 242 / 0.12);
}

.viewer__navbtn:disabled {
  opacity: 0.35;
  cursor: default;
}

.viewer__count {
  font-size: 0.875rem;
  color: rgb(253 248 242 / 0.65);
  font-variant-numeric: tabular-nums;
}

/* The video dialog reuses the viewer shell, minus the slide navigation.
   `fit-content`, not `auto`: a modal <dialog> is absolutely positioned with
   both top and bottom set, so `auto` stretches it to the full viewport. */
.viewer--video {
  height: fit-content;
  max-height: 94vh;
}

/* Size to the video rather than filling the viewport: the shared stage grows
   (flex: 1) and the recording's 4K intrinsic height would otherwise push the
   dialog to its 94vh cap, leaving a tall black surround. */
.viewer--video .viewer__stage {
  flex: 0 0 auto;
  padding-bottom: 1rem;
}

#video-player {
  max-width: 100%;
  max-height: calc(94vh - 5rem);
  border-radius: 0.375rem;
  display: block;
}

@media (max-width: 40rem) {
  .viewer {
    width: 96vw;
    height: 92vh;
  }
  .viewer--video {
    height: fit-content;
  }
  .viewer__navbtn {
    font-size: 0.875rem;
  }
}
