/*
 * One stylesheet, ~9 KB.
 *
 * It replaces Bootstrap 4 (~190 KB), Font Awesome (~13 MB of fonts and CSS on
 * disk), jQuery Easing, and the leftover "Resume" template stylesheet — none of
 * which the tour used for more than a handful of utility classes and a nav bar.
 */

/* ─────────────────────────────── tokens ─────────────────────────────── */

:root {
  --bg: #12101a;
  --bg-raised: #1c1927;
  --surface: #262233;
  --line: #3a3448;
  --text: #ece9f2;
  --text-dim: #a49cb8;
  --accent: #85739c;
  --accent-bright: #b9a6d4;
  --brand: #1d8643;
  --highlight: #ffab3f;
  --highlight-bright: gold;
  --sidebar-w: 17rem;
  --radius: 0.6rem;
  --shadow: 0 0.75rem 2rem rgb(0 0 0 / 45%);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.6 var(--font);
  overflow: hidden;
}

body.is-modal { overflow: hidden; }

a { color: var(--accent-bright); }

.skip-link {
  position: absolute;
  left: -100vw;
  z-index: 100;
}
.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-radius: var(--radius);
}

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

/* ─────────────────────────────── layout ─────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100%;
}

.main {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  display: grid;
}
.view[hidden] { display: none; }

/* ────────────────────────────── sidebar ─────────────────────────────── */

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar__brand {
  display: block;
  padding: 1.25rem 1rem;
}
.sidebar__brand img {
  width: 100%;
  height: auto;
}

.sidebar__toggle { display: none; }

.nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0.75rem 1rem;
}

.nav__link {
  display: block;
  padding: 0.6rem 1rem;
  color: var(--text-dim);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav__link:hover,
.nav__link.is-linked {
  background: var(--surface);
  color: var(--text);
}
.nav__link[aria-current="page"] {
  color: var(--text);
  background: var(--surface);
  border-left-color: var(--highlight);
}

.help {
  margin: auto 1rem 1rem;
  padding-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.help summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}
.help ul { padding-left: 1.1rem; }

/* ──────────────────────────── document views ────────────────────────── */

.view--doc {
  place-items: center;
  overflow-y: auto;
  padding: 2rem 1.5rem;
}

.doc {
  width: 100%;
  max-width: 46rem;
  text-align: center;
}
.doc__title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  line-height: 1.2;
}
.doc__body {
  margin: 0 auto 2rem;
  max-width: 38rem;
  color: var(--text-dim);
}

.doc__video {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow);
}
.doc__video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.doc__cta { margin-top: 2rem; }

.button {
  display: inline-block;
  padding: 0.7rem 1.6rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius);
  text-decoration: none;
}
.button:hover { background: var(--accent-bright); color: #1a1622; }

/* ───────────────────────────── floor plan ───────────────────────────── */

.view--map {
  grid-template: 1fr / 1fr;
  padding: 1rem;
  overflow: hidden;
}

/*
 * `object-fit` does nothing to an inline <svg> — it only applies to replaced
 * elements. The SVG's own viewBox plus the default preserveAspectRatio
 * ("xMidYMid meet") already letterboxes it correctly, but only if the element
 * is actually constrained: a grid item defaults to `min-height: auto`, which
 * lets `height: 100%` plus content push past the track and overflow.
 */
.floorplan {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.zone { cursor: pointer; }
.zone > * {
  fill: var(--highlight);
  stroke: var(--highlight);
  stroke-width: 2;
  transition: fill 0.15s, stroke 0.15s;
}
.zone--accent > * { fill: color-mix(in srgb, var(--highlight) 55%, transparent); }

.zone:hover > *,
.zone:focus-visible > *,
.zone.is-linked > * {
  fill: var(--highlight-bright);
  stroke: var(--highlight-bright);
}
.zone:focus-visible { outline: none; }
.zone:focus-visible > * { stroke-width: 5; }

/* ──────────────────────────────── stage ─────────────────────────────── */

.view--tour { background: #4b4b4b; }

.canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

.overlays {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.overlays > * { pointer-events: auto; }

/* Captions ------------------------------------------------------------- */

.cc {
  position: absolute;
  left: 50%;
  bottom: 6.5rem;
  transform: translateX(-50%);
  max-width: min(46rem, 88%);
  padding: 0.4rem 0.9rem;
  background: rgb(0 0 0 / 78%);
  border-radius: 0.3rem;
  color: #fff;
  font-size: clamp(0.95rem, 1.7vw, 1.25rem);
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  text-wrap: balance;
  white-space: pre-line;
}
.cc[hidden] { display: none; }

/* Loader --------------------------------------------------------------- */

.loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.5rem;
  background: rgb(0 0 0 / 70%);
  z-index: 5;
}
.loader[hidden] { display: none; }

.loader__spinner {
  width: 2.75rem;
  height: 2.75rem;
  border: 3px solid var(--accent);
  border-top-color: var(--highlight);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.loader__text { margin: 0; color: var(--text-dim); }

@keyframes spin { to { transform: rotate(1turn); } }

.stage-status {
  position: absolute;
  top: 1rem;
  left: 1rem;
  padding: 0.35rem 0.8rem;
  background: rgb(0 0 0 / 55%);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  pointer-events: none;
}
.stage-status:empty { display: none; }

/* Hotspot list --------------------------------------------------------- */

.hotspots {
  position: absolute;
  top: 1rem;
  right: 1rem;
  max-width: 14rem;
  padding: 0.75rem;
  background: rgb(18 16 26 / 82%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
}
.hotspots[hidden] { display: none; }
.hotspots__title {
  margin: 0 0 0.4rem;
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.hotspots__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}
.hotspots__list button {
  width: 100%;
  padding: 0.4rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}
.hotspots__list button:hover { background: var(--accent); }

/* Stage controls ------------------------------------------------------- */

.stage-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.4rem;
  z-index: 4;
}
.hotspots:not([hidden]) ~ .stage-controls { top: auto; bottom: 5.5rem; }

.icon-button {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  background: rgb(18 16 26 / 82%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.icon-button:hover { background: var(--accent); color: #fff; }
.icon-button[hidden] { display: none; }

/* Narration transport -------------------------------------------------- */

.transport {
  position: absolute;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: min(34rem, calc(100% - 2rem));
  padding: 0.5rem 0.9rem;
  background: rgb(18 16 26 / 88%);
  border: 1px solid var(--line);
  border-radius: 2rem;
  backdrop-filter: blur(8px);
  z-index: 4;
}
.transport[hidden] { display: none; }

.transport__play,
.transport__cc {
  flex: none;
  background: none;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 0.3rem;
}
.transport__cc {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border: 1px solid var(--line);
}
.transport__cc[aria-pressed="false"] { color: var(--text-dim); opacity: 0.5; }

.transport__seek {
  flex: 1;
  accent-color: var(--highlight);
  min-width: 0;
}

.transport__time {
  flex: none;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ─────────────────────────── video overlay ──────────────────────────── */

.video-panel {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  z-index: 50;
}
.video-panel[hidden] { display: none; }

.video-panel__backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 82%);
}

.video-panel__frame {
  position: relative;
  margin: 0;
  width: min(64rem, 100%);
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.video-panel__video[hidden] { display: none; }

.video-panel__video {
  display: block;
  width: 100%;
  max-height: 74vh;
  background: #000;
}

.video-panel__bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  background: var(--bg-raised);
  font-size: 0.9rem;
}
.video-panel__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.video-panel__count {
  flex: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.video-panel__nav,
.video-panel__close {
  flex: none;
  padding: 0.35rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.video-panel__nav[hidden] { display: none; }
.video-panel__close:hover,
.video-panel__nav:hover { background: var(--accent); }

/* ───────────────────────────── responsive ───────────────────────────── */

@media (max-width: 56rem) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }

  .sidebar__brand { padding: 0.6rem 0.9rem; }
  .sidebar__brand img { width: 9rem; }

  .sidebar__toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 0.9rem;
    padding: 0.45rem 0.8rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
  }
  .sidebar__toggle-bar {
    width: 1rem;
    height: 2px;
    background: currentColor;
    box-shadow: 0 5px currentColor, 0 -5px currentColor;
  }

  .nav {
    grid-column: 1 / -1;
    display: none;
    max-height: 65vh;
    overflow-y: auto;
    border-top: 1px solid var(--line);
  }
  .nav.is-open { display: block; }

  .help { margin: 1rem; }

  .hotspots {
    top: auto;
    bottom: 5.25rem;
    right: 0.75rem;
    max-width: 11rem;
  }
  .hotspots:not([hidden]) ~ .stage-controls { top: 0.75rem; bottom: auto; }
  .stage-controls { top: 0.75rem; right: 0.75rem; }
  .transport { bottom: 0.75rem; gap: 0.5rem; }
  .cc { bottom: 5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Video failure notice ───────────────────────────────────────────────────
   The Kaltura CDN redirects its https URLs to http, which browsers drop on a
   secure page. The failure is silent — no error event, readyState stays 0 —
   so VideoPanel watches for metadata and reveals this instead of leaving a
   black rectangle and a 0:00 clock on screen. */
.video-panel__fallback[hidden] { display: none; }

.video-panel__fallback {
  display: grid;
  gap: .5rem;
  padding: 2.4rem 2rem;
  background: #14121b;
  color: #d7d3e0;
  text-align: center;
  align-content: center;
  min-height: 260px;
}
.video-panel__fallback-head {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
}
.video-panel__fallback-body {
  margin: 0 auto;
  max-width: 46ch;
  font-size: .9rem;
  line-height: 1.5;
  color: #a49fb3;
}
.video-panel__fallback code {
  background: rgba(255, 255, 255, .09);
  padding: .1em .35em;
  border-radius: 3px;
}
.video-panel__fallback-link {
  color: #c9b6f0;
  font-size: .9rem;
}
