:root {
  color-scheme: dark;
  --ink: #f6f3eb;
  --muted: #aaa99f;
  --canvas: #11130f;
  --panel: #191b16;
  --panel-strong: #21231d;
  --line: rgba(255, 255, 255, 0.12);
  --gold: #c79a3c;
  --gold-bright: #e0bd6e;
  --teal: #2b8174;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

html {
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 84% 12%, rgba(199, 154, 60, 0.12), transparent 28rem),
    linear-gradient(145deg, #10120e 0%, #151711 45%, #0d0f0c 100%);
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold-bright);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 0.75rem;
  z-index: 100;
  padding: 0.65rem 0.9rem;
  border-radius: 0.45rem;
  color: #11130f;
  background: var(--gold-bright);
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

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

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100dvh;
}

.topbar {
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem clamp(1rem, 2.3vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(17, 19, 15, 0.88);
  backdrop-filter: blur(18px);
  z-index: 20;
}

.brand,
.topbar-actions,
.icon-button,
.index-heading,
.page-meta,
.compact-controls {
  display: flex;
  align-items: center;
}

.brand {
  gap: 0.8rem;
  min-width: 0;
}

.brand-mark {
  display: block;
  width: 3rem;
  height: 3rem;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 0.3rem 0.45rem rgba(0, 0, 0, 0.28));
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 0.17rem;
  color: var(--gold-bright);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.site-title {
  margin: 0;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  gap: 0.55rem;
}

.icon-button,
.text-button,
.close-index,
.nav-button {
  border: 1px solid var(--line);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.045);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.icon-button:hover,
.text-button:hover,
.close-index:hover,
.nav-button:hover {
  border-color: rgba(224, 189, 110, 0.72);
  background: rgba(199, 154, 60, 0.12);
}

.icon-button:active,
.text-button:active,
.close-index:active,
.nav-button:active {
  transform: scale(0.97);
}

.icon-button {
  gap: 0.48rem;
  min-height: 2.55rem;
  padding: 0.55rem 0.8rem;
  border-radius: 0.55rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.icon-button svg,
.close-index svg,
.nav-button svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 18.5rem minmax(0, 1fr);
  transition: grid-template-columns 220ms ease;
}

.workspace.index-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.index-panel {
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: rgba(25, 27, 22, 0.78);
}

.workspace.index-collapsed .index-panel {
  visibility: hidden;
}

.index-heading {
  justify-content: space-between;
  height: 4.4rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}

.index-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.close-index {
  display: none;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 50%;
}

.thumbnail-list {
  height: calc(100dvh - 8.9rem);
  overflow-y: auto;
  padding: 0.85rem;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}

.thumbnail-item {
  display: grid;
  grid-template-columns: 5.75rem minmax(0, 1fr);
  width: 100%;
  gap: 0.75rem;
  align-items: center;
  margin: 0 0 0.65rem;
  padding: 0.45rem;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  color: inherit;
  text-align: left;
  cursor: pointer;
  background: transparent;
  transition: background 150ms ease, border-color 150ms ease;
}

.thumbnail-item:hover {
  background: rgba(255, 255, 255, 0.045);
}

.thumbnail-item[aria-current="page"] {
  border-color: rgba(199, 154, 60, 0.6);
  background: rgba(199, 154, 60, 0.11);
}

.thumbnail-item img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 0.3rem;
  object-fit: cover;
  background: #efefed;
}

.thumbnail-copy {
  min-width: 0;
}

.thumbnail-number {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--gold-bright);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.thumbnail-title {
  display: -webkit-box;
  overflow: hidden;
  color: #e7e5df;
  font-size: 0.79rem;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.stage-column {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: clamp(0.75rem, 2vw, 1.6rem) clamp(0.75rem, 2.6vw, 2.5rem) 0;
}

.stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0 3.8rem;
  touch-action: pan-y;
}

.slide-frame {
  position: relative;
  width: min(100%, calc((100dvh - 11.9rem) * 16 / 9));
  margin: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 0.45rem;
  background: #ededeb;
  box-shadow: var(--shadow);
}

.slide-frame::after {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
  content: "";
  pointer-events: none;
}

.slide-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.slide-frame img.is-changing {
  animation: slide-in 240ms ease-out;
}

@keyframes slide-in {
  from {
    opacity: 0.35;
    transform: scale(0.992);
  }
}

.nav-button {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 4.6rem;
  padding: 0;
  border-radius: 0.6rem;
  transform: translateY(-50%);
}

.nav-button:active {
  transform: translateY(-50%) scale(0.97);
}

.nav-button:disabled {
  opacity: 0.25;
  cursor: default;
}

.nav-previous {
  left: 0;
}

.nav-next {
  right: 0;
}

.swipe-hint {
  position: absolute;
  bottom: 0.15rem;
  left: 50%;
  color: rgba(255, 255, 255, 0.44);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  transform: translateX(-50%);
}

.control-deck {
  min-height: 5.1rem;
  display: grid;
  grid-template-columns: minmax(13rem, 1fr) minmax(12rem, 1.35fr) auto;
  gap: 1.5rem;
  align-items: center;
  border-top: 1px solid var(--line);
}

.page-meta {
  min-width: 0;
  gap: 0.85rem;
}

.page-number {
  flex: 0 0 auto;
  color: var(--gold-bright);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.page-title {
  overflow: hidden;
  color: #d7d5cf;
  font-size: 0.9rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-control {
  display: block;
}

.progress-control input {
  width: 100%;
  height: 1.35rem;
  cursor: pointer;
  accent-color: var(--gold);
}

.compact-controls {
  gap: 0.45rem;
}

.text-button {
  min-height: 2.4rem;
  padding: 0.45rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.mobile-backdrop {
  display: none;
}

noscript {
  position: fixed;
  inset: auto 1rem 1rem;
  z-index: 200;
  padding: 1rem;
  color: #161810;
  background: var(--gold-bright);
}

body.presentation-fullscreen .topbar,
body.presentation-fullscreen .index-panel,
body.presentation-fullscreen .control-deck,
body.presentation-fullscreen .swipe-hint {
  display: none;
}

body.presentation-fullscreen .app-shell {
  grid-template-rows: 1fr;
}

body.presentation-fullscreen .workspace {
  grid-template-columns: 1fr;
}

body.presentation-fullscreen .stage-column {
  display: block;
  height: 100dvh;
  padding: 0;
}

body.presentation-fullscreen .stage {
  height: 100%;
  padding: 0 4rem;
  background: #000;
}

body.presentation-fullscreen .slide-frame {
  width: min(100%, calc(100dvh * 16 / 9));
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

@media (max-width: 900px) {
  .workspace,
  .workspace.index-collapsed {
    grid-template-columns: 1fr;
  }

  .index-panel {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(21rem, 88vw);
    visibility: visible;
    transform: translateX(0);
    transition: transform 220ms ease;
  }

  .workspace.index-collapsed .index-panel {
    visibility: visible;
    transform: translateX(-105%);
  }

  .close-index {
    display: grid;
  }

  .thumbnail-list {
    height: calc(100dvh - 4.4rem);
  }

  .mobile-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: block;
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(3px);
  }

  .mobile-backdrop[hidden] {
    display: none;
  }

  .control-deck {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .progress-control {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .page-meta,
  .compact-controls {
    grid-row: 2;
    padding-bottom: 0.85rem;
  }
}

@media (max-width: 620px) {
  .topbar {
    min-height: 4rem;
    padding: 0.6rem 0.8rem;
  }

  .brand-mark {
    width: 2.65rem;
    height: 2.65rem;
  }

  .eyebrow {
    font-size: 0.63rem;
  }

  .site-title {
    max-width: 10.5rem;
    font-size: 0.88rem;
  }

  .icon-button {
    width: 2.55rem;
    padding: 0;
    justify-content: center;
  }

  .icon-button span {
    display: none;
  }

  .topbar-actions {
    gap: 0.35rem;
  }

  .stage-column {
    padding: 0.6rem 0.5rem 0;
  }

  .stage {
    padding: 0 0 2rem;
  }

  .slide-frame {
    width: 100%;
    border-radius: 0.3rem;
  }

  .nav-button {
    top: auto;
    bottom: 0;
    width: 3rem;
    height: 2.2rem;
    border-radius: 999px;
    transform: none;
  }

  .nav-button:active {
    transform: scale(0.97);
  }

  .nav-previous {
    left: calc(50% - 3.35rem);
  }

  .nav-next {
    right: calc(50% - 3.35rem);
  }

  .swipe-hint {
    display: none;
  }

  .control-deck {
    min-height: 6.2rem;
    gap: 0.4rem 0.75rem;
    padding-top: 0.55rem;
  }

  .page-title {
    max-width: 9.5rem;
    font-size: 0.78rem;
  }

  .page-number {
    font-size: 0.74rem;
  }

  .text-button {
    min-height: 2.2rem;
  }

  body.presentation-fullscreen .stage {
    padding: 0;
  }

  body.presentation-fullscreen .nav-button {
    bottom: max(1rem, env(safe-area-inset-bottom));
    background: rgba(0, 0, 0, 0.58);
  }
}

@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;
  }
}
