:root {
  --ink: #050506;
  --paper: #f2ede5;
  --mint: #c58b5a;
  --red: #b51f2a;
  --muted: #9e9a95;
  --line: rgba(242, 239, 232, 0.2);
  --ui: "Helvetica Neue", Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--ui);
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% 28%, rgba(85, 122, 120, 0.13), transparent 34%),
    linear-gradient(180deg, #090b0d 0%, var(--ink) 72%);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--paper);
  transform: translateY(-160%);
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.deck {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  min-height: 100dvh;
  padding: 24px clamp(20px, 4vw, 64px) 22px;
  overflow: hidden;
}

.topbar,
.controls {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar {
  min-height: 42px;
}

.wordmark,
.text-control,
.icon-control,
.arrow-control {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.wordmark {
  padding: 0;
  color: var(--paper);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.wordmark span {
  color: var(--red);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.2vw, 30px);
}

.text-control {
  padding: 6px 0;
  color: var(--paper);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-decoration: none;
  text-transform: uppercase;
}

.text-control:hover {
  color: var(--mint);
}

.icon-control {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 3px;
}

.icon-control svg,
.arrow-control svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.stage-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: clamp(18px, 2.5vh, 34px) 0;
}

.stage {
  position: relative;
  width: min(100%, calc((100dvh - 184px) * 16 / 9));
  aspect-ratio: 16 / 9;
  margin: 0;
  overflow: hidden;
  background: #151515;
  box-shadow: 0 38px 120px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(197, 139, 90, 0.12);
  isolation: isolate;
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  transition: opacity 170ms ease, transform 320ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.hotspot-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.slide-hotspot {
  position: absolute;
  display: block;
  border: 0;
  border-radius: 2px;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.slide-hotspot:hover {
  background: rgba(185, 223, 208, 0.11);
  box-shadow: inset 0 -2px 0 rgba(238, 60, 47, 0.78);
}

.slide-hotspot:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 2px;
}

.stage.is-loading img {
  opacity: 0.32;
  transform: scale(0.995);
}

.loader {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  width: 34px;
  height: 34px;
  margin: -17px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--paper);
  border-radius: 50%;
  opacity: 0;
  animation: spin 700ms linear infinite;
  transition: opacity 120ms ease;
}

.stage.is-loading .loader {
  opacity: 1;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.edge-hit {
  position: absolute;
  top: 8%;
  bottom: 8%;
  z-index: 4;
  width: 13%;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.edge-hit--previous { left: 0; cursor: w-resize; }
.edge-hit--next { right: 0; cursor: e-resize; }

.controls {
  min-height: 42px;
  gap: 24px;
}

.counter {
  display: flex;
  align-items: center;
  min-width: 108px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.counter #currentNumber {
  color: var(--paper);
}

.counter-rule {
  width: 32px;
  height: 1px;
  margin: 0 9px;
  background: #4a4946;
}

.progress {
  position: relative;
  flex: 1;
  max-width: 480px;
  height: 1px;
  overflow: hidden;
  background: var(--line);
}

.progress span {
  display: block;
  width: calc(100% / 15);
  height: 100%;
  background: var(--red);
  transform-origin: left;
  transition: width 280ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.nav-controls {
  display: flex;
  gap: 22px;
}

.arrow-control {
  width: 34px;
  height: 28px;
  padding: 5px 0;
}

.arrow-control:disabled {
  opacity: 0.24;
  cursor: default;
}

.chapter-dialog {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--paper);
  background:
    linear-gradient(90deg, rgba(5, 5, 6, 0.98) 0%, rgba(5, 5, 6, 0.9) 58%, rgba(5, 5, 6, 0.62) 100%),
    url("assets/slides/slide-8.png") center / cover no-repeat;
}

.chapter-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}

.chapter-dialog[open] {
  animation: dialog-in 240ms ease-out;
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.dialog-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100%;
  min-height: 100%;
  padding: clamp(28px, 5vw, 72px);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.dialog-header h1 {
  max-width: 800px;
  margin: 0;
  font-size: clamp(42px, 7vw, 110px);
  font-weight: 900;
  letter-spacing: -0.075em;
  line-height: 0.86;
  text-transform: uppercase;
}

.icon-control--light {
  width: 42px;
  height: 42px;
  color: var(--paper);
}

.chapter-list {
  display: grid;
  align-content: center;
  width: min(100%, 1050px);
  margin-top: clamp(30px, 4vh, 60px);
}

.chapter-list button {
  display: grid;
  grid-template-columns: 54px minmax(180px, 1fr) minmax(140px, 0.55fr);
  align-items: baseline;
  width: 100%;
  padding: clamp(13px, 2vh, 24px) 0;
  border: 0;
  border-top: 1px solid rgba(242, 237, 229, 0.22);
  color: var(--paper);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: padding-left 160ms ease, color 160ms ease;
}

.chapter-list button:last-child {
  border-bottom: 1px solid rgba(242, 237, 229, 0.22);
}

.chapter-list button:hover,
.chapter-list button:focus-visible {
  padding-left: 12px;
  color: var(--mint);
}

.chapter-list span,
.chapter-list small {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.chapter-list strong {
  font-size: clamp(22px, 3vw, 48px);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 1;
  text-transform: uppercase;
}

.dialog-hint {
  margin: 28px 0 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 22px;
  z-index: 30;
  padding: 12px 16px;
  color: var(--ink);
  background: var(--paper);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.noscript {
  position: fixed;
  inset: auto 20px 20px;
  z-index: 50;
  padding: 16px;
  color: var(--ink);
  background: var(--paper);
}

.noscript a { color: inherit; }

@media (max-width: 720px) {
  .deck {
    padding: 16px 14px 14px;
  }

  .download-link,
  #shareButton {
    display: none;
  }

  .topbar-actions {
    gap: 16px;
  }

  .stage-wrap {
    padding: 12px 0;
  }

  .stage {
    width: 100%;
  }

  .progress {
    max-width: none;
  }

  .counter {
    min-width: 84px;
  }

  .counter-rule {
    width: 20px;
  }

  .nav-controls {
    gap: 14px;
  }

  .dialog-shell {
    padding: 24px 20px;
  }

  .chapter-list button {
    grid-template-columns: 38px 1fr;
  }

  .chapter-list small {
    display: none;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .deck {
    padding-top: 10px;
    padding-bottom: 8px;
  }

  .topbar,
  .controls {
    min-height: 30px;
  }

  .stage-wrap {
    padding: 5px 0;
  }

  .stage {
    width: min(100%, calc((100dvh - 90px) * 16 / 9));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
