/* ======================
   RESET & GLOBAL
====================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #000; /* background behind 3D */
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ======================
   CSS VARIABLES
====================== */
:root {
  --hud-bottom: 92px; /* distance above bottom (tune) */
  --hud-width: 780px; /* max HUD width */
  --hud-pad: 10px 12px; /* HUD padding */
  --accent: white; /* link + UI accent */
}

/* ======================
   LAYERS (Z-INDEX STACK)
   z=0  : Three.js canvas
   z=2  : main deck container (Reveal layer)
   z=3  : header/footer
   z=4  : HUD (text overlay)
====================== */

/* Three canvas behind everything */
#three-root {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: auto; /* allow orbit/drag on the canvas */
}

#three-root canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Header + footer above */
header,
footer {
  position: relative;
  z-index: 3;
}

/* Main container above canvas (but below HUD) */
main.deck {
  flex: 1;
  min-height: 0;
  position: relative;
  z-index: 2;

  /* let pointer events pass through to the canvas */
  pointer-events: none;
}

/* ======================
   REVEAL.JS LAYER
  Reveal for navigation, not for text rendering.
====================== */
.reveal {
  background: transparent !important; /* Reveal themes set a background */
  height: 100%;

  /* Dont wanna Reveal to capture drag events (orbit) */
  pointer-events: none;
}

/* use Reveal only for navigation: hide slide text in Reveal */
.reveal .slides section .panel {
  display: none;
  pointer-events: auto;
}

.reveal .controls,
.reveal .progress {
  pointer-events: auto;
}

/* show panels in Reveal, keep links readable */
.reveal .panel a {
  color: var(--accent);
  text-decoration: underline;
}
.reveal .panel a:hover,
.reveal .panel a:focus {
  text-decoration: none;
}

.reveal a,
.reveal button,
.reveal [role="button"] {
  pointer-events: auto;
}

.reveal,
.reveal .slides,
.reveal .slides section {
  pointer-events: none;
}

.panel,
.panel * {
  pointer-events: auto;
}

/* ======================
   HUD (fixed bottom text)
====================== */
#hud {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: var(--hud-bottom);
  width: min(var(--hud-width), 94vw);
  z-index: 4;

  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif !important;
  padding: var(--hud-pad);

  background: rgba(0, 0, 0, 0.5);
  border-radius: 16px;
  backdrop-filter: blur(2px);

  color: whitesmoke;
  max-height: 34vh;
  overflow: auto;

  /* HUD not to block orbit except inside the panel */
  pointer-events: none;
}

/* Allow interaction ONLY inside the HUD panel */
#hud .panel,
#hud .panel * {
  pointer-events: auto;
}

/* Header/nav clickable */
header,
header * {
  pointer-events: auto;
}

/* Footer clickable */
footer,
footer * {
  pointer-events: auto;
}

/* ----- HUD typography ----- */
#hud h2 {
  font-size: 1.2rem;
  line-height: 1.15;
  margin: 0 0 6px 0;
}

#hud h3 {
  font-size: 1.1rem;
  margin: 6px 0 4px 0;
  opacity: 0.95;
}

#hud p,
#hud li,
#hud ol {
  font-size: 0.9rem;
  line-height: 1.35;
}

#hud p {
  margin: 4px 0;
}

#hud ul,
#hud ol {
  margin: 6px 0 0 18px;
}

#hud li {
  margin: 2px 0;
}

#hud .lead {
  opacity: 0.95;
}

#hud .slide-note {
  opacity: 0.95;
  font-size: 0.7rem;
  line-height: 1.1;
  margin-top: 8px;
}

#hud .muted {
  opacity: 0.75;
  font-size: 0.75rem;
}

#hud .card p {
  margin: 4px 0;
  font-size: 0.9rem;
}

/* HUD links */
#hud a {
  color: var(--accent);
  text-decoration: underline;
}
#hud a:hover,
#hud a:focus {
  text-decoration: none;
}

/* ----- Cards / grid inside HUD ----- */
#hud .grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

#hud .card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 8px 10px;
}

/* Keyboard hint */
#hud kbd {
  display: inline-block;
  padding: 0.18em 0.55em;
  margin: 0 0.08em;
  font-size: 0.95em;
  font-weight: 700;
  letter-spacing: 0.02em;

  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-bottom: 3px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;

  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

/* --- Semi-transparent grey background behind text (for the last slide) --- */
.reveal section.credits-slide {
  position: relative;
}

/* grey panel behind  content */
.reveal section.credits-slide::before {
  content: "";
  position: absolute;
  inset: 0.1rem;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 14px;
  z-index: 0;
}

.reveal section.credits-slide > * {
  position: relative;
  padding: 2rem !important;
  z-index: 1;
}

.reveal section.credits-slide ul {
  margin: 0.8rem auto 0;
  max-width: 900px;
}

.reveal section.credits-slide li {
  line-height: 1.1;
}

.reveal section.credits-slide a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ======================
   NAVIGATION
====================== */
nav ul.menu {
  list-style: none;
  display: flex;
  justify-content: center;
  align-items: stretch;
  background: #ca36045c;
}

nav ul.menu li {
  position: relative;
}

nav a,
.submenu-toggle {
  display: block;
  padding: 14px 16px;
  color: var(--accent);
  cursor: pointer;
  transition: background-color 0.25s ease;
}

nav a:hover,
.submenu-toggle:hover {
  background-color: #d39a1c;
}

/* Icon + text only for the Accueil link */
nav a.nav-home {
  display: inline-flex; /* overrides nav a { display: block }  */
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
}

nav a.nav-home .nav-icon {
  width: 1em;
  height: 1em;
  fill: currentColor; /* monochrome, matches link color */
  opacity: 0.95;
  transform: translateY(-1px); /* tiny optical alignment */
}

/* Submenu */
.submenu {
  list-style: none;
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  z-index: 10;
  background: rgba(202, 54, 4, 0.5);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.submenu a {
  padding: 10px 16px;
  white-space: nowrap;
}

.has-submenu:hover .submenu {
  display: flex;
  flex-direction: column;
}

#toggle-submenu:checked + .submenu {
  display: flex;
  flex-direction: column;
}

/* ======================
   FOOTER
====================== */
footer {
  margin-top: auto;
  padding: 16px 14px;
  text-align: center;
  font:
    12px/1.4 system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  opacity: 0.95;
  color: var(--accent);
  background: #c5ba9a(0, 0, 0, 0.55);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer a {
  text-decoration: underline;
}

/* ======================
   RESPONSIVE
====================== */
@media (max-width: 900px) {
  #hud .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  nav ul.menu {
    flex-direction: column;
    text-align: center;
  }

  nav ul.menu li {
    width: 100%;
  }

  :root {
    --hud-bottom: 110px;
  }
}

@media (max-width: 600px) {
  .submenu {
    position: static;
    width: 100%;
    border-radius: 0;
    text-align: center;
  }

  .submenu a {
    padding: 16px;
    font-size: 1.02em;
  }

  .has-submenu > .submenu-toggle::after {
    content: " ▾";
    font-size: 1.1em;
  }

  :root {
    --hud-bottom: 125px;
    --hud-width: 92vw;
  }
}
