/* ==========================================================================
   Rogue Science - Main Stylesheet
   Strict Flexbox Architecture
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Lock the viewport to exactly the screen size and prevent global scrolling */
html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background-color: #ffffff;
  color: #000000;
}

body {
  font-family: 'IBM Plex Sans', sans-serif;
  display: flex;
  flex-direction: column;
}

/* Accessibility Utility for Screen Readers & SEO */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border-width: 0 !important;
}

/* 1. Header: Rigid Flex Item */
.site-header {
  flex: 0 0 60px; /* Exactly 60px tall, never grows, never shrinks */
  width: 100%;
  border-bottom: 1px solid #000000;
  display: flex;
  align-items: center;
  background-color: #ffffff;
  z-index: 100;
}

.nav-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-right {
  display: flex;
  align-items: center;
}

.nav-link {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: #000000;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link:hover {
  opacity: 0.7;
}

.nav-link.active {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nav-link[data-page="home"] {
  position: relative;
}

.nav-link[data-page="home"].active .icon {
  stroke-width: 2.75;
}

.nav-link[data-page="home"].active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 2px;
  background-color: currentColor;
}

.nav-link:focus-visible, .privacy-link:focus-visible {
  outline: 2px solid #000000;
  outline-offset: 4px;
}

/* Reserved top slot for sub-navigation to lock h2 vertical baseline */
.sub-nav {
  height: 12px; /* Fixed height slot */
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  /* border-bottom: 1px dashed #000000; */
  box-sizing: border-border;
}

/* When hidden, reserve space so the content area underneath does not shift */
.sub-nav[hidden] {
  display: block !important; /* Keep block layout to maintain height */
  visibility: hidden;        /* Hide contents and border visually */
  border-bottom: none !important;
}

.sub-nav-link {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #000000;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.sub-nav-link:hover {
  opacity: 0.7;
}

.sub-nav-link.active {
  font-weight: 700;
  text-decoration: underline !important;
  text-underline-offset: 4px;
}

/* Section root "grave" marker (Nat Geo style vertical rectangle) */
.sub-nav-link:first-child {
  font-size: 0;
  position: relative;
}

.sub-nav-link:first-child::before {
  content: "";
  display: block;
  width: 8px;
  height: 12px;
  border: 1.5px solid currentColor;
  box-sizing: border-box;
}

/* Emphasize the grave marker (bold border + underline) when on the section root page */
.sub-nav:not(:has(.sub-nav-link.active)) .sub-nav-link:first-child::before,
.sub-nav-link:first-child.active::before {
  border-width: 2.25px;
}

.sub-nav:not(:has(.sub-nav-link.active)) .sub-nav-link:first-child::after,
.sub-nav-link:first-child.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  background-color: currentColor;
}

.icon {
  display: inline-block;
  vertical-align: middle;
}

/* 2. Body / Layout Container: Flexible Space Absorber */
.layout-container {
  flex: 1 1 auto; /* Absorbs all vertical space between header and footer */
  min-height: 0; /* Prevents flex blowout */
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px;
  display: flex;
  gap: 60px;
  overflow: hidden; /* Desktop: container stays static, right-column scrolls internally */
}

/* Left Column: Splash */
.left-column {
  flex: 1;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.wordmark-container {
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
  position: relative;
  background-color: transparent;
  overflow: hidden;
}

#wordmarkCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.wordmark {
  font-family: 'Hanalei', cursive;
  font-size: 100px;
  line-height: 100px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 40px;
}

.subtitle {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 24px;
  line-height: 32px;
  font-weight: 400;
}

/* Right Column: Scrollable Content */
.right-column {
  flex: 1;
  min-height: 0;
  overflow-y: auto; /* Scrollbar appears only inside this column */
  padding-right: 20px;
  padding-bottom: 20px; /* Small internal bumper */
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px;
  line-height: 24px;
}

.content-heading, .right-column h1 {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 24px;
  line-height: 32px;
  font-weight: 500;
  margin-bottom: 24px;
}

.right-column h2, .right-column h3 {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 18px;
  line-height: 26px;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 16px;
}

.right-column p {
  margin-bottom: 20px;
}

.right-column ul, .right-column ol {
  margin-left: 20px;
  margin-bottom: 20px;
}

.right-column li {
  margin-bottom: 12px;
}

.right-column a {
  color: #000000;
  text-decoration: underline;
}

/* 3. Footer: Rigid Flex Item */
.site-footer {
  flex: 0 0 60px;
  width: 100%;
  background-color: #ffffff;
  border-top: 1px solid #000000;
  padding: 20px 0;
  z-index: 1000;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  line-height: 20px;
}

.privacy-link {
  color: #000000;
  text-decoration: underline;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  .site-header {
    height: 60px;
    padding: 0;
  }

  .nav-container {
    flex-direction: row;
    align-items: center;
    padding: 0 24px;
  }

  .main-nav {
    flex-wrap: nowrap;
    gap: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 10px 0;
  }

  .main-nav::-webkit-scrollbar {
    display: none;
  }

  .newsletter-text {
    display: none;
  }

  .layout-container {
    flex-direction: column;
    overflow-y: auto; /* On mobile, the entire body container scrolls so the splash moves up */
    padding: 20px 24px;
    gap: 20px;
  }

  .left-column {
    flex: none;
    height: auto;
    max-width: 100%;
  }

  .wordmark-container {
    flex: none;
    height: 160px;
    min-height: 140px;
    max-height: 25vh;
    margin-bottom: 8px;
  }

  .wordmark {
    font-size: 72px;
    line-height: 72px;
    margin-bottom: 16px;
  }

  .right-column {
    flex: none;
    overflow-y: visible; /* Let the parent layout-container handle scrolling */
    padding-right: 0;
    padding-bottom: 20px;
  }
}

@media (max-width: 480px) {
  .wordmark-container {
    height: 130px;
    min-height: 120px;
  }

  .wordmark {
    font-size: 54px;
    line-height: 54px;
  }
}

/* --------------------------------------------------------------------------
   Splash Simulation Controls
   -------------------------------------------------------------------------- */
.splash-ctrl-btn {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 25;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.7);
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.3;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.splash-ctrl-btn:hover, .splash-ctrl-btn.active {
  opacity: 1;
  background: #0f172a;
  border-color: #0f172a;
  color: #00ffcc;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.splash-ctrl-panel {
  position: absolute;
  bottom: 42px;
  left: 10px;
  z-index: 30;
  width: 320px;
  max-width: calc(100% - 20px);
  max-height: min(85vh, 580px);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 14px;
  color: #e2e8f0;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 11px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
  display: none;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.splash-ctrl-panel::-webkit-scrollbar {
  width: 6px;
}
.splash-ctrl-panel::-webkit-scrollbar-track {
  background: rgba(31, 41, 55, 0.5);
  border-radius: 4px;
}
.splash-ctrl-panel::-webkit-scrollbar-thumb {
  background: rgba(75, 85, 99, 0.8);
  border-radius: 4px;
}
.splash-ctrl-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 114, 128, 1);
}

.splash-ctrl-panel.open {
  display: flex;
}

.splash-ctrl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 600;
  font-size: 12px;
  color: #f8fafc;
}

.splash-ctrl-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s ease;
}

.splash-ctrl-close:hover {
  color: #ffffff;
}

.splash-ctrl-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #38bdf8;
  margin-top: 6px;
  margin-bottom: -4px;
}

.splash-ctrl-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.splash-ctrl-row.inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  background: rgba(30, 41, 59, 0.5);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.splash-ctrl-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 500;
}

.splash-ctrl-desc {
  font-size: 10px;
  color: #64748b;
  margin-top: 1px;
  line-height: 1.25;
}

.splash-ctrl-desc span {
  color: #38bdf8;
  font-weight: 600;
}

.splash-ctrl-val {
  font-family: 'IBM Plex Mono', monospace;
  color: #00ffcc;
  font-size: 11px;
}

.splash-ctrl-select, .splash-ctrl-input {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  color: #f8fafc;
  padding: 5px 8px;
  font-size: 11px;
  font-family: inherit;
  outline: none;
}

.splash-ctrl-select:focus, .splash-ctrl-input:focus {
  border-color: #00ffcc;
}

.splash-ctrl-slider {
  width: 100%;
  accent-color: #00ffcc;
  cursor: pointer;
  height: 4px;
  margin-top: 3px;
}

.splash-ctrl-btn-action {
  background: rgba(0, 255, 204, 0.12);
  border: 1px solid rgba(0, 255, 204, 0.3);
  color: #00ffcc;
  padding: 6px 10px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.splash-ctrl-btn-action:hover {
  background: rgba(0, 255, 204, 0.25);
}

.splash-ctrl-btn-action.active {
  background: rgba(0, 255, 204, 0.4);
  border-color: #00ffcc;
  box-shadow: 0 0 8px rgba(0, 255, 204, 0.4);
  color: #ffffff;
}

/* Windows 3.x Style Buffering Hourglass */
.splash-buffering-overlay {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 25;
}

.splash-buffering-overlay.active {
  opacity: 0.1;
  visibility: visible;
}

/* Force-hide the original spinner and text */
.splash-buffering-overlay .splash-buffering-spinner,
.splash-buffering-overlay span,
.splash-buffering-overlay .splash-buffering-hourglass {
  display: none !important;
}

/* Draw a geometric hourglass using CSS borders */
.splash-buffering-overlay::after {
  content: "";
  display: block;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 14px solid #000000;
  border-bottom: 14px solid #000000;
  animation: splash-hourglass-spin 2s steps(4) infinite;
}

@keyframes splash-hourglass-spin {
  0% { transform: rotate(0deg); }
  50% { transform: rotate(180deg); }
  100% { transform: rotate(360deg); }
}