/* =========================================================
   Rwanda Field Notes Presentation
   Full-screen Reveal.js-style presentation CSS
   Hard-reset version to prevent vertical slide offset
   ========================================================= */

:root {
  --bg: #f7f1e8;
  --ink: #2d241c;
  --muted: #6e6257;
  --accent: #8a5a2f;
  --accent-dark: #4a2f1f;
  --cream: #fffaf2;
  --overlay: rgba(18, 14, 10, 0.9);
  --shadow: rgba(0, 0, 0, 0.24);
}

/* =========================================================
   Base page setup
   ========================================================= */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}

body {
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top left, rgba(138, 90, 47, 0.14), transparent 32%),
    radial-gradient(circle at bottom right, rgba(74, 47, 31, 0.12), transparent 34%),
    var(--bg);
}

/* =========================================================
   Reveal.js hard layout reset
   This prevents Reveal's internal canvas from pushing slides down.
   ========================================================= */

.reveal {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: transparent !important;
}

/* Force the Reveal slide container to occupy the browser viewport. */
.reveal .slides {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  text-align: center !important;
  transform: none !important;
  inset-inline-start: 0 !important;
  inset-block-start: 0 !important;
}

/* Reset all slide sections. */
.reveal .slides > section,
.reveal .slides > section > section {
  position: absolute !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  transform: none !important;
  top: 0 !important;
  left: 0 !important;
}

/* Hide every slide unless Reveal marks it as present. */
.reveal .slides section {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Show only the active Reveal slide. */
.reveal .slides section.present {
  display: grid !important;
  place-items: center !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  z-index: 10 !important;
}

/* Explicitly keep previous and future slides hidden. */
.reveal .slides section.past,
.reveal .slides section.future {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

/* =========================================================
   Main slide images
   ========================================================= */

.reveal .slides section img.slide-image {
  display: block !important;
  position: relative !important;
  width: auto !important;
  height: auto !important;
  max-width: min(96vw, 1600px) !important;
  max-height: calc(100vh - 130px) !important;
  object-fit: contain !important;
  margin: 0 auto !important;
  border: 0 !important;
  border-radius: 16px !important;
  background: #ffffff !important;
  box-shadow: 0 26px 70px var(--shadow) !important;
  transform: none !important;
}

/* Prevent Reveal's image defaults from interfering. */
.reveal section img {
  margin: 0 !important;
  border: 0 !important;
  box-shadow: none;
}

/* Restore shadow only for the actual slide image. */
.reveal .slides section img.slide-image {
  box-shadow: 0 26px 70px var(--shadow) !important;
}

/* =========================================================
   Reveal controls and progress bar
   ========================================================= */

.reveal .controls {
  color: var(--accent-dark) !important;
  z-index: 80 !important;
}

.reveal .progress {
  color: var(--accent) !important;
  height: 5px !important;
  z-index: 85 !important;
}

/* =========================================================
   Slide counter
   ========================================================= */

.slide-counter {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 90;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.82);
  color: var(--accent-dark);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  line-height: 1;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* =========================================================
   Bottom toolbar
   ========================================================= */

.presentation-toolbar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(45, 36, 28, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
}

.presentation-toolbar a,
.presentation-toolbar button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--cream);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.presentation-toolbar a:hover,
.presentation-toolbar button:hover,
.presentation-toolbar a:focus,
.presentation-toolbar button:focus {
  background: rgba(255, 250, 242, 0.18);
  outline: none;
}

/* =========================================================
   Video button on selected slides
   ========================================================= */

.video-button {
  position: absolute;
  right: 8vw;
  bottom: 13vh;
  z-index: 100;
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  background: rgba(74, 47, 31, 0.92);
  color: var(--cream);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
}

.video-button:hover,
.video-button:focus {
  background: rgba(138, 90, 47, 0.96);
  outline: none;
}

.video-button::before {
  content: "▶";
  display: inline-block;
  margin-right: 8px;
  font-size: 13px;
}

/* Hide video buttons unless their slide is active. */
.reveal .slides section:not(.present) .video-button {
  display: none !important;
}

/* =========================================================
   Hidden slide overview
   ========================================================= */

.slide-overview {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  background: var(--overlay);
  padding: 34px;
  overflow-y: auto;
}

.slide-overview.open {
  display: block;
}

.overview-panel {
  max-width: 1280px;
  margin: 0 auto;
}

.overview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  color: var(--cream);
}

.overview-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 4vw, 42px);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.overview-header button {
  appearance: none;
  border: 1px solid rgba(255, 250, 242, 0.42);
  background: rgba(255, 250, 242, 0.12);
  color: var(--cream);
  border-radius: 999px;
  padding: 10px 16px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  cursor: pointer;
}

.overview-header button:hover,
.overview-header button:focus {
  background: rgba(255, 250, 242, 0.22);
  outline: none;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  padding-bottom: 40px;
}

.overview-card {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.overview-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.34);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.overview-card:hover img,
.overview-card:focus img {
  transform: translateY(-3px);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.42);
  outline: 3px solid rgba(255, 250, 242, 0.5);
}

.overview-card span {
  display: block;
  margin-top: 8px;
  color: var(--cream);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  opacity: 0.88;
}

/* =========================================================
   Video overlay modal
   ========================================================= */

.video-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(12, 9, 7, 0.92);
  padding: 28px;
}

.video-modal.open {
  display: flex;
}

.video-frame-wrap {
  position: relative;
  width: min(1120px, 92vw);
  aspect-ratio: 16 / 9;
  background: #000000;
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
}

.video-frame-wrap iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 18px;
}

.close-video {
  position: absolute;
  right: 0;
  top: -50px;
  appearance: none;
  border: 1px solid rgba(255, 250, 242, 0.4);
  background: rgba(255, 250, 242, 0.12);
  color: var(--cream);
  border-radius: 999px;
  padding: 9px 14px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  cursor: pointer;
}

.close-video:hover,
.close-video:focus {
  background: rgba(255, 250, 242, 0.22);
  outline: none;
}

.open-youtube-link {
  position: absolute;
  left: 0;
  top: -48px;
  color: var(--cream);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  text-decoration: none;
  opacity: 0.86;
}

.open-youtube-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/* =========================================================
   Accessibility utility
   ========================================================= */

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

/* =========================================================
   Mobile adjustments
   ========================================================= */

@media (max-width: 800px) {
  .reveal .slides section img.slide-image {
    max-width: 100vw !important;
    max-height: calc(100vh - 145px) !important;
    border-radius: 8px !important;
  }

  .presentation-toolbar {
    width: calc(100vw - 24px);
    bottom: 12px;
    flex-wrap: wrap;
    border-radius: 18px;
    padding: 8px;
  }

  .presentation-toolbar a,
  .presentation-toolbar button {
    font-size: 13px;
    padding: 8px;
  }

  .slide-counter {
    top: 12px;
    right: 12px;
    font-size: 12px;
  }

  .video-button {
    right: 50%;
    bottom: 11vh;
    transform: translateX(50%);
    font-size: 14px;
    padding: 12px 18px;
  }

  .slide-overview {
    padding: 22px;
  }

  .overview-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .overview-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
  }

  .close-video {
    top: -46px;
  }

  .open-youtube-link {
    display: none;
  }
}

/* =========================================================
   Very small screens
   ========================================================= */

@media (max-width: 480px) {
  .reveal .slides section img.slide-image {
    max-height: calc(100vh - 165px) !important;
  }

  .presentation-toolbar {
    gap: 4px;
  }

  .presentation-toolbar a,
  .presentation-toolbar button {
    font-size: 12px;
    padding: 7px;
  }

  .video-button {
    bottom: 9vh;
    font-size: 13px;
  }

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

/* =========================================================
   Reduced motion preference
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .overview-card img {
    transition: none;
  }
}