:root {
  color-scheme: dark;
  --ui-paper: #f3efe6;
  --ui-charcoal: #182019;
  --ui-timber: #8b4e2b;
  --ui-line: rgba(243, 239, 230, 0.18);
  --ui-sans: "Avenir Next", Avenir, "Helvetica Neue", Arial, sans-serif;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  position: fixed;
  inset: 0;
  background: #090b09;
  color: var(--ui-paper);
  font-family: var(--ui-sans);
  overscroll-behavior: none;
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--ui-timber);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  left: 1rem;
  top: 1rem;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.skip-link:focus {
  width: auto;
  height: auto;
  padding: 0.75rem 1rem;
  overflow: visible;
  clip-path: none;
  background: var(--ui-paper);
  color: var(--ui-charcoal);
}

.appbar {
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 68px;
  padding: 0.65rem clamp(0.85rem, 2vw, 2rem);
  border-bottom: 1px solid var(--ui-line);
  background: linear-gradient(180deg, rgba(9, 11, 9, 0.94), rgba(9, 11, 9, 0.72));
  backdrop-filter: blur(16px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  width: max-content;
  color: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.brand img {
  width: 32px;
  height: 32px;
}

.appbar__title {
  display: grid;
  justify-items: center;
  line-height: 1.2;
}

.appbar__title strong {
  font-size: 0.8rem;
  font-weight: 600;
}

.appbar__title span {
  margin-top: 0.2rem;
  color: rgba(243, 239, 230, 0.55);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.appbar__actions {
  justify-self: end;
  display: flex;
  gap: 0.45rem;
}

.appbar button,
.controls button,
.notes-panel button,
.download-panel__head button {
  min-width: 44px;
  min-height: 44px;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  background: rgba(243, 239, 230, 0.07);
  cursor: pointer;
}

.appbar button:hover,
.controls button:hover,
.notes-panel button:hover,
.download-panel__head button:hover {
  background: rgba(243, 239, 230, 0.14);
}

.appbar .present-button {
  border-color: var(--ui-timber);
  background: var(--ui-timber);
}

.deck {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #090b09;
}

.deck::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at center, rgba(95, 109, 85, 0.15), transparent 58%);
}

.deck .slide {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(var(--slide-scale, 0.5));
  transform-origin: center;
  transition: opacity 340ms ease;
  box-shadow: 0 32px 110px rgba(0, 0, 0, 0.42);
}

.deck .slide.is-active {
  z-index: 2;
  opacity: 1;
  pointer-events: auto;
}

.is-loading .deck .slide:first-child {
  opacity: 1;
}

.controls {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 1.35rem;
  display: grid;
  grid-template-columns: 48px auto 48px;
  align-items: center;
  gap: 0.7rem;
  transform: translateX(-50%);
  transition: opacity 220ms ease, transform 220ms ease;
}

.controls button {
  padding: 0;
  font-size: 1.15rem;
  backdrop-filter: blur(12px);
}

.slide-status {
  display: grid;
  grid-template-columns: auto 42px auto;
  align-items: center;
  gap: 0.55rem;
  min-width: 205px;
  min-height: 48px;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  background: rgba(9, 11, 9, 0.72);
  color: rgba(243, 239, 230, 0.72);
  font-size: 0.68rem;
  backdrop-filter: blur(12px);
}

.slide-status i {
  height: 1px;
  background: var(--ui-line);
}

.slide-status strong {
  grid-column: 1 / -1;
  max-width: 230px;
  overflow: hidden;
  color: var(--ui-paper);
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress {
  position: fixed;
  z-index: 31;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(243, 239, 230, 0.1);
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--ui-timber);
  transition: width 300ms ease;
}

.keyboard-hint {
  position: fixed;
  z-index: 24;
  right: 1.5rem;
  bottom: 1.25rem;
  margin: 0;
  color: rgba(243, 239, 230, 0.5);
  font-size: 0.65rem;
  letter-spacing: 0.03em;
  transition: opacity 500ms ease;
}

.keyboard-hint.is-hidden {
  opacity: 0;
}

.notes-panel {
  position: fixed;
  z-index: 45;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 92vw);
  padding: clamp(1.2rem, 3vw, 2.2rem);
  overflow-y: auto;
  border-left: 1px solid rgba(24, 32, 25, 0.14);
  background: var(--ui-paper);
  color: var(--ui-charcoal);
  box-shadow: -24px 0 80px rgba(0, 0, 0, 0.3);
  transform: translateX(102%);
  transition: transform 260ms ease;
}

.notes-panel.is-open {
  transform: translateX(0);
}

.notes-panel__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(24, 32, 25, 0.16);
}

.notes-panel__head div {
  display: grid;
  gap: 0.4rem;
}

.notes-panel__head span,
.download-panel__head span {
  color: #657067;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.notes-panel__head strong {
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 400;
}

.notes-panel__head button {
  align-self: start;
  border-color: rgba(24, 32, 25, 0.18);
  background: transparent;
}

.notes-panel > p {
  margin: 2rem 0 0;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  line-height: 1.46;
}

.download-panel {
  width: min(980px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: clamp(1.25rem, 4vw, 3rem);
  overflow-y: auto;
  border: 0;
  background: var(--ui-paper);
  color: var(--ui-charcoal);
  box-shadow: 0 32px 120px rgba(0, 0, 0, 0.5);
}

.download-panel::backdrop {
  background: rgba(9, 11, 9, 0.8);
  backdrop-filter: blur(8px);
}

.download-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.download-panel__head h2 {
  max-width: 680px;
  margin: 0.5rem 0 0;
  font-size: clamp(2.7rem, 7vw, 5.4rem);
  line-height: 0.9;
}

.download-panel__head button {
  border-color: rgba(24, 32, 25, 0.18);
  background: transparent;
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 2.5rem;
  border-top: 1px solid rgba(24, 32, 25, 0.18);
  border-left: 1px solid rgba(24, 32, 25, 0.18);
}

.download-grid a,
.download-grid button {
  min-height: 220px;
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 0;
  border-right: 1px solid rgba(24, 32, 25, 0.18);
  border-bottom: 1px solid rgba(24, 32, 25, 0.18);
  background: transparent;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.download-grid a:hover,
.download-grid button:hover {
  background: rgba(139, 78, 43, 0.08);
}

.download-grid strong {
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 400;
  line-height: 1.05;
}

.download-grid span {
  margin-top: 0.8rem;
  color: #657067;
  font-size: 0.82rem;
  line-height: 1.5;
}

.download-grid small {
  margin-top: auto;
  color: var(--ui-timber);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.download-note {
  margin: 1.25rem 0 0;
  color: #657067;
  font-size: 0.78rem;
}

body.is-presenting .appbar,
body.is-presenting .controls,
body.is-presenting .keyboard-hint {
  opacity: 0;
  pointer-events: none;
}

body.has-focus-ui .appbar,
body.has-focus-ui .controls {
  opacity: 1;
  pointer-events: auto;
}

body.is-presenting .appbar {
  transform: translateY(-105%);
}

body.has-focus-ui .appbar {
  transform: translateY(0);
}

@media (max-width: 760px) {
  .appbar {
    grid-template-columns: 1fr auto;
    min-height: 60px;
  }

  .appbar__title,
  .appbar__actions button:not(.present-button) {
    display: none;
  }

  .controls {
    bottom: max(0.85rem, env(safe-area-inset-bottom));
  }

  .slide-status {
    min-width: 150px;
  }

  .keyboard-hint {
    display: none;
  }

  .download-grid {
    grid-template-columns: 1fr;
  }

  .download-grid a,
  .download-grid button {
    min-height: 155px;
  }
}

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

@page {
  size: 13.333in 7.5in;
  margin: 0;
}

@media print {
  html,
  body {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    background: white;
  }

  .appbar,
  .controls,
  .progress,
  .keyboard-hint,
  .notes-panel,
  .download-panel,
  .skip-link {
    display: none !important;
  }

  .deck {
    position: static;
    display: block;
    overflow: visible;
    background: white;
  }

  .deck .slide,
  .deck .slide.is-active {
    position: relative;
    top: auto;
    left: auto;
    display: block;
    width: 13.333in;
    height: 7.5in;
    margin: 0;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
    zoom: 0.66665;
  }
}
