/* --- Theme Variables --- */
:root {
  /* Default is now dynamic, but fallback is Postcard */
  --bg-primary: #0a0a0a;
  --text-primary: #fff8e1;
  --brand-color: #ffd700;
  --page-overlay: rgba(10, 10, 10, 0.5);
  --nav-bg: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.0));
  --btn-hover: rgba(255, 215, 0, 0.2);
}

/* Theme 1: Vintage Postcard */
body.postcard {
  /* Dark Mode (Default) */
  --bg-primary: #152222;
  --text-primary: #FDFBF0;
  --brand-color: #FF7F50;
  --bg-secondary: #2F4F4F;
  --page-overlay: rgba(21, 34, 34, 0.8);
}

body.postcard.light-mode {
  /* Light Mode */
  --bg-primary: #FDFBF0;
  --text-primary: #2F4F4F;
  --brand-color: #008B8B;
  --bg-secondary: #DAA520;
  --page-overlay: rgba(253, 251, 240, 0.6);
}

/* Theme 2: Alpine Fresh */
body.alpine {
  /* Dark Mode (Default) */
  --bg-primary: #081521;
  --text-primary: #F7FBFC;
  --brand-color: #AEEEEE;
  --bg-secondary: #2C5F84;
  --page-overlay: rgba(8, 21, 33, 0.8);
}

body.alpine.light-mode {
  /* Light Mode */
  --bg-primary: #F7FBFC;
  --text-primary: #102A43;
  --brand-color: #2C5F84;
  --bg-secondary: #829AB1;
  --page-overlay: rgba(247, 251, 252, 0.6);
}

/* Theme 3: Night Mode Digital */
body.digital {
  /* Dark Mode (Default) */
  --bg-primary: #121212;
  --text-primary: #E0E0E0;
  --brand-color: #00E5FF;
  --bg-secondary: #2D2D2D;
  --page-overlay: rgba(0, 0, 0, 0.8);
}

body.digital.light-mode {
  /* Light Mode (Inverted High Contrast) */
  --bg-primary: #FFFFFF;
  --text-primary: #121212;
  --brand-color: #00838F;
  /* Darker Cyan for readability on light BG */
  --bg-secondary: #E0E0E0;
  --page-overlay: rgba(255, 255, 255, 0.6);
}

/* --- Base Styles & Font Setup --- */
html,
body {
  width: 100%;
  height: 100%;
}

body {
  font-family: 'Raleway', sans-serif;
  color: var(--text-primary);
  overscroll-behavior-y: contain;
  background-color: var(--bg-primary);
  overflow: hidden;
  margin: 0;
  transition: background-color 0.3s, color 0.3s;
}

/* Consolas for code/input if needed later, applied to specific elements or globally if requested */
code,
kbd,
samp,
pre,
input,
textarea {
  font-family: 'Consolas', monospace;
}

.font-orbitron {
  font-family: 'Orbitron', sans-serif;
}

/* --- Main Scroll Container --- */
#deck-container {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

/* --- Individual Page Styling (Global) --- */
.page {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6rem 1rem 2rem;
  scroll-snap-align: start;
  isolation: isolate;
  /* Creates a new stacking context so z-index -1 doesn't go behind body */
}

.page-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  /* Uses theme background color */
  background-size: cover;
  background-position: center;
  z-index: -1;
  /* Now works relative to .page only */
}

/* --- Page Content Styling --- */
.page-content-wrapper {
  width: 100%;
  width: 100%;
  max-width: 95vw;
  text-align: center;
  background-color: var(--page-overlay);
  backdrop-filter: blur(4px);
  padding: 1.5rem;
  border-radius: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  transition: background-color 0.3s;
  z-index: 2;
  /* Ensure content stays on top */
}

.page-title {
  font-family: 'Raleway', sans-serif;
  font-weight: 700;
  font-size: 2.4rem;
  color: var(--brand-color);
  margin-bottom: 0;
  margin-top: 0;
}

.page-paragraph {
  font-size: 1.2rem;
  max-width: 60ch;
  margin: 0;
}

@media (min-width: 768px) {
  .page-content-wrapper {
    padding: 2.5rem;
  }

  .page-title {
    font-size: 4.5rem;
  }

  .page-paragraph {
    font-size: 1.875rem;
  }
}

@media (min-width: 1024px) {
  .page-content-wrapper {
    max-width: 70vw;
  }
}

/* --- Navbar / Navigation Styles --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 64px;
  background-color: transparent;
  z-index: 50;
  /* Ensure on top */
}

.nav-btn {
  padding: 0.5rem;
  border-radius: 9999px;
  transition: background-color 0.2s;
  color: var(--text-primary);
  background: transparent;
  border: none;
  cursor: pointer;
}

.nav-btn:hover {
  background-color: var(--btn-hover);
}

/* Hamburger Navigation Menu */
.nav-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background-color: rgba(30, 30, 30, 0.9);
  /* Keep dark for consistency */
  backdrop-filter: blur(5px);
  border-radius: 0.5rem;
  padding: 0.5rem;
  width: 250px;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 30;
}

body.light-mode .nav-menu {
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-mode .nav-menu button {
  color: #121212;
}

body.light-mode .nav-menu button:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.nav-menu-item {
  display: block;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 0.2s;
}

.nav-menu-item:hover {
  background-color: var(--btn-hover);
}

.nav-menu-item.active {
  background-color: var(--brand-color);
  color: var(--bg-primary);
  font-weight: 700;
}

/* Utility */
.hidden {
  display: none;
}

/* Fullscreen Overrides */
:fullscreen,
::backdrop,
.fullscreen-active {
  background-color: var(--bg-primary);
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Ensure no scrollbars on root when fullscreen */
.fullscreen-active,
.fullscreen-active body {
  overflow: hidden;
}

/* Navbar stays visible in fullscreen as requested */
/* Modal Styles (Light Mode Override) */
body.light-mode #help-modal .bg-white {
  background-color: #ffffff;
  color: #121212;
}

body.light-mode #help-modal h2 {
  color: #111;
}

body.light-mode #help-modal #help-content {
  color: #333;
}