/* Accessible Slides Styles (WCAG AA) */
:root {
  --bg-start: #0d1b2a;
  --bg-end: #1b263b;
  --text: #ffffff;
  --muted: #e6eef7;
  --accent: #ffd166; /* AA on dark background */
  --accent-on-light: #b87700; /* WCAG AA compliant on white background (6.1:1 contrast) */
  --focus: #94d2bd; /* visible focus */
  --panel: rgba(255,255,255,0.12);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
  color: var(--text);
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Accessible focus */
:focus { outline: 3px solid var(--focus); outline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.presentation { position: relative; width: 100vw; height: 100vh; }
.slide {
  display: none; position: absolute; inset: 0; padding: 3.5rem 4.5rem;
  /* Display set when aria-hidden="false" */
  flex-direction: column; justify-content: center; align-items: center; text-align: center;
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
}
.slide[aria-hidden="false"] { display: flex; }

h1 { font-size: clamp(2rem, 5vw, 4rem); font-weight: 800; margin: 0 0 1rem; line-height: 1.2; text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 4vw, 3rem); font-weight: 700; margin: 0 0 0.8rem; color: var(--accent); line-height: 1.3; }
h3 { font-size: clamp(1.4rem, 3.5vw, 2.4rem); font-weight: 700; margin: 0 0 0.6rem; }
.subtitle { font-size: clamp(1.1rem, 2.3vw, 1.6rem); color: var(--muted); margin-bottom: 0.5rem; }

.panel { background: var(--panel); border-left: 6px solid var(--accent); padding: 1.25rem; margin: 1rem 0; border-radius: 10px; max-width: 62rem; text-align: left; }
.panel p { margin: 0.4rem 0; font-size: clamp(1.1rem, 2.5vw, 1.5rem); }
.panel .ref { text-align: right; color: var(--accent); font-weight: 700; font-size: 0.95rem; }

.list { text-align: left; max-width: 60rem; margin: 0.4rem auto; }
.list ul { margin: 0.5rem 0; padding-left: 1.25rem; }
.list li { margin: 0.4rem 0; font-size: clamp(1.1rem, 2.4vw, 1.5rem); }

.callout { background: linear-gradient(135deg, #118ab2, #06d6a0); color: #001219; padding: 1.25rem; border-radius: 12px; margin: 1rem 0; max-width: 60rem; }
.callout h3 { margin-bottom: 0.6rem; color: #001219; }

/* Navigation */
.nav {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  display: flex; gap: 0.75rem; z-index: 1000;
}
.btn {
  background: #22324a; /* solid dark for contrast */
  border: 2px solid #415777;
  color: #ffffff;
  padding: 0.6rem 1rem; border-radius: 999px; cursor: pointer; font-weight: 700;
}
.btn:hover { background: #2b3e59; border-color: var(--accent); color: var(--accent); }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* Sidebar Navigation */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 280px;
  height: 100vh;
  background: rgba(20, 33, 61, 0.95);
  backdrop-filter: blur(10px);
  overflow-y: auto;
  z-index: 1500;
  border-right: 2px solid var(--accent);
}
.sidebar-header {
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 209, 102, 0.3);
}
.sidebar-header h3 {
  color: var(--accent);
  font-size: 1.3rem;
  margin: 0;
}
.sidebar-nav {
  padding: 1rem 0;
}
.sidebar-item {
  padding: 0.8rem 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sidebar-item:hover {
  background: rgba(255, 209, 102, 0.1);
  border-left-color: var(--accent);
}
.sidebar-item.active {
  background: rgba(255, 209, 102, 0.2);
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.sidebar-item.section {
  background: rgba(255, 209, 102, 0.1);
  font-weight: 600;
  color: var(--accent);
  margin-top: 0.5rem;
}
.slide-num {
  display: inline-block;
  width: 25px;
  color: rgba(255, 255, 255, 0.6);
}
.sidebar-item.active .slide-num {
  color: var(--accent);
}

/* Adjust presentation for sidebar */
.presentation.with-sidebar .slide {
  padding-left: 320px;
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 2000;
  background: rgba(255, 209, 102, 0.9);
  color: #14213d;
  border: none;
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
}
.menu-toggle:hover {
  background: var(--accent);
}

/* Home Button */
.home-btn {
  position: fixed;
  top: 1rem;
  left: 300px;
  background: rgba(255, 209, 102, 0.9);
  color: #14213d;
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.home-btn:hover {
  background: #ffd166;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 209, 102, 0.4);
  text-decoration: none;
}

/* Mobile & Tablet adjustments */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
  }
  .menu-toggle {
    display: block;
  }
  .presentation.with-sidebar .slide {
    padding-left: 4.5rem;
  }
  .home-btn {
    left: auto;
    right: 1rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  .home-btn span:last-child {
    display: none;
  }
}

.counter {
  position: fixed; top: 1rem; right: 1rem; background: rgba(0,0,0,0.5); padding: 0.4rem 0.8rem; border-radius: 999px;
}

/* Light background class - can be added to body for light theme (e.g. markdown viewers) */
body.light-mode {
  background: #ffffff;
  color: #212529;
}
body.light-mode h2 {
  color: var(--accent-on-light);
}
body.light-mode .panel {
  background: #f8f9fa;
  border-left-color: var(--accent-on-light);
  color: #212529;
}
body.light-mode .panel .ref {
  color: var(--accent-on-light);
}

/* Print styles */
@media print {
  body { color: #111; background: #fff; }
  .slide { position: static; display: block !important; page-break-after: always; background: #fff; color: #111; }
  .nav, .counter { display: none !important; }
  .panel, .callout { background: #f7f7f7; border: 1px solid #ddd; }
  h2, .ref { color: var(--accent-on-light); }
}
