/* ==========================================================================
   QUAGMIRE SPACE - DESIGN SYSTEM & STYLES
   Brand Identity, Accessibility AA, Responsive Layout & Flow Animations
   ========================================================================== */

/* --- Custom Properties & Palette --- */
:root {
  /* Brand Shades */
  --shade-primary: #E45300;     /* Intense Mid-Orange */
  --shade-secondary: #FF7E00;   /* Vivid Amber / Sun Orange */
  --shade-tertiary: #B93700;    /* Burnt Rust / Dark Vermilion */
  --shade-quaternary: #812000;  /* Deep Copper / Earthy Dark Rust */
  --shade-quinary: #FFC400;     /* Solar Gold / Yellow-Orange */

  /* Dark Charcoal Surface Scheme */
  --bg-deep: #070709;
  --bg-canvas: #0c0c10;
  --bg-surface: #14141a;
  --bg-card: #1c1c24;
  --bg-elevated: #262632;
  --bg-glass: rgba(20, 20, 26, 0.88);

  /* Borders & Accents */
  --border-subtle: rgba(228, 83, 0, 0.22);
  --border-mid: rgba(255, 126, 0, 0.4);
  --border-glow: rgba(255, 196, 0, 0.6);

  /* High Contrast Accessible Text */
  --text-primary: #F8F8FA;
  --text-secondary: #C8C8D4;
  --text-muted: #8E8E9F;
  --text-accent: #FFC400;

  /* Typography */
  --font-serif: 'SangBleuSunrise', 'Fraunces', Georgia, serif;
  --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Space Grotesk', monospace;

  /* Radii & Shadows */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.6), 0 0 24px rgba(228, 83, 0, 0.08);
  --shadow-glow: 0 0 25px rgba(255, 126, 0, 0.35);

  /* Transitions */
  --ease-slow: cubic-bezier(0.25, 1, 0.35, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Fallback local font registration */
@font-face {
  font-family: 'SangBleuSunrise';
  src: local('SangBleuSunrise'), local('SangBleu Sunrise');
  font-display: swap;
}

/* --- Global Reset & Box Sizing --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

/* Accessibility: Skip Link */
.skip-link {
  position: absolute;
  top: -60px;
  left: 20px;
  background: var(--shade-primary);
  color: #fff;
  padding: 10px 18px;
  z-index: 10000;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: top 0.3s;
}
.skip-link:focus {
  top: 20px;
}

/* --- Persistent Header --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 18px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 200;
  pointer-events: none;
  transition: opacity 1.2s var(--ease-slow), transform 1.2s var(--ease-slow), visibility 1.2s var(--ease-slow);
}

.site-header.hidden-header {
  opacity: 0;
  transform: translateY(-20px);
  visibility: hidden;
  pointer-events: none;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  pointer-events: auto;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  transition: transform 0.4s var(--ease-slow), filter 0.4s var(--ease-slow);
}

.brand-link:hover {
  transform: scale(1.03);
  filter: drop-shadow(0 0 10px rgba(255, 126, 0, 0.4));
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.header-sitemap-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(20, 20, 26, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: all 0.25s var(--ease-slow);
}

.header-sitemap-btn:hover {
  color: var(--shade-quinary);
  border-color: var(--shade-secondary);
  background: rgba(30, 30, 40, 0.85);
  transform: translateY(-1px);
}

.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.brand-wordmark {
  height: 24px;
  width: auto;
  object-fit: contain;
}

.status-pill {
  pointer-events: auto;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 12px;
  background: rgba(228, 83, 0, 0.12);
  color: var(--shade-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
}

/* --- Screen Container & View Management --- */
.screen-view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s var(--ease-slow), transform 0.8s var(--ease-slow);
  overflow-y: auto;
}

.screen-view.active {
  opacity: 1;
  visibility: visible;
  z-index: 10;
}

/* --- 1. INTRO SCREEN --- */
#screen-intro {
  height: 100vh;
  overflow: hidden;
}

.intro-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
}

.intro-content {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

/* Question: Bottom Left Slide-in */
.intro-question-box {
  position: absolute;
  bottom: 160px;
  left: 60px;
  max-width: 460px;
  transform: translateX(-120%);
  opacity: 0;
  transition: transform 1.4s var(--ease-slow), opacity 1.4s var(--ease-slow);
}

.intro-question-box.visible {
  transform: translateX(0);
  opacity: 1;
}

.intro-question-text {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 2.5vw, 2.1rem);
  font-weight: 400;
  line-height: 1.35;
  color: var(--text-primary);
  text-shadow: 0 4px 16px rgba(0,0,0,0.8);
}

/* Center Statement & Explore CTA */
.intro-center-group {
  text-align: center;
  max-width: 720px;
  padding: 30px;
  opacity: 0;
  transform: translateY(30px) scale(0.96);
  transition: opacity 1.3s var(--ease-slow), transform 1.3s var(--ease-slow);
}

.intro-center-group.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.intro-statement-text {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3.2vw, 2.6rem);
  font-weight: 400;
  line-height: 1.4;
  color: var(--shade-secondary);
  margin-bottom: 34px;
  text-shadow: 0 4px 24px rgba(0,0,0,0.9);
}

/* Primary Button */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--shade-primary) 0%, var(--shade-secondary) 100%);
  color: #fff;
  border: none;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 14px 34px;
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(228, 83, 0, 0.4);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 1s var(--ease-slow), transform 0.4s var(--ease-slow), box-shadow 0.4s;
}

.btn-primary.visible {
  opacity: 1;
  transform: scale(1);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 12px 30px rgba(255, 126, 0, 0.55);
}

/* "Just dive in" CTA (Bottom Right, Immediate) */
.btn-dive-in {
  position: absolute;
  bottom: 74px;
  right: 28px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(20, 20, 26, 0.7);
  backdrop-filter: blur(8px);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.35s var(--ease-slow);
  z-index: 20;
}

.btn-dive-in:hover {
  color: var(--shade-quinary);
  border-color: var(--border-mid);
  background: rgba(30, 30, 40, 0.9);
  transform: translateX(4px);
}

/* --- 2. HOME SCREEN & FLOATING TEXT BACKGROUND --- */
#main-content {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 100px 20px 40px;
  background: radial-gradient(circle at center, #15151c 0%, var(--bg-deep) 75%);
}

/* Floating phrases container behind foreground */
.floating-text-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
}

.floating-phrase {
  position: absolute;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 400;
  color: rgba(220, 225, 240, 0.55);
  white-space: nowrap;
  user-select: none;
  animation: floatDrift var(--anim-duration, 3.75s) ease-in-out forwards;
}

@keyframes floatDrift {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(var(--base-scale, 1));
  }
  20% {
    opacity: 0.85;
  }
  75% {
    opacity: 0.75;
  }
  100% {
    opacity: 0;
    transform: translate(var(--drift-x, 30px), var(--drift-y, -40px)) scale(calc(var(--base-scale, 1) * 1.05));
  }
}

/* Foreground Centerpiece & Bloch Sphere */
.home-layout {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 900px;
  min-height: 620px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.bloch-centerpiece {
  position: absolute;
  width: 420px;
  height: 420px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.bloch-container {
  width: 100%;
  height: 100%;
  position: absolute;
}

.bloch-pole {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--shade-quinary);
  text-shadow: 0 0 8px rgba(255, 196, 0, 0.5);
  pointer-events: none;
}

.pole-zero {
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
}

.pole-one {
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
}

/* Circular / Orbital Navigation Menu */
.home-menu-nav {
  position: relative;
  width: 100%;
  height: 600px;
}

.menu-list {
  list-style: none;
  width: 100%;
  height: 100%;
  position: relative;
}

/* Radial positioning on desktop widescreen */
@media (min-width: 820px) {
  .menu-item-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(var(--item-angle, 0deg)) translate(320px) rotate(calc(-1 * var(--item-angle, 0deg)));
    transition: transform 0.6s var(--ease-slow);
  }
}

/* Fallback list on smaller mobile / tablet */
@media (max-width: 819px) {
  .home-layout {
    flex-direction: column;
    min-height: auto;
  }
  .bloch-centerpiece {
    position: relative;
    width: 280px;
    height: 280px;
    margin-bottom: 24px;
  }
  .home-menu-nav {
    height: auto;
  }
  .menu-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }
  .menu-item-wrapper {
    position: static;
    width: 100%;
    max-width: 380px;
  }
}

.menu-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  transition: all 0.35s var(--ease-slow);
}

.menu-btn:hover, .menu-btn:focus-visible {
  border-color: var(--shade-secondary);
  color: var(--shade-quinary);
  background: var(--bg-card);
  box-shadow: 0 0 20px rgba(255, 126, 0, 0.3);
  transform: scale(1.05);
}

.menu-index {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--shade-secondary);
  font-weight: 700;
}

.menu-label-group {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.menu-subtext {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.menu-btn-inactive {
  cursor: not-allowed;
  opacity: 0.85;
  border-style: dashed;
}

.badge-lock {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(255, 196, 0, 0.15);
  color: var(--shade-quinary);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  margin-left: 6px;
}

/* --- 3. POPUP MODALS (Story, Hardware, Gaming) --- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 8, 0.82);
  backdrop-filter: blur(14px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s var(--ease-slow), visibility 0.45s;
}

.modal-backdrop:not([hidden]) {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transform: translateY(40px) scale(0.97);
  transition: transform 0.45s var(--ease-slow);
}

.modal-backdrop:not([hidden]) .modal-card {
  transform: translateY(0) scale(1);
}

.modal-card-header {
  padding: 24px 28px 18px;
  border-bottom: 1px solid rgba(228, 83, 0, 0.15);
  display: flex;
  flex-direction: column;
  position: relative;
}

.modal-tag {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--shade-secondary);
  margin-bottom: 4px;
}

.modal-heading {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 400;
  color: var(--text-primary);
}

.btn-close-modal {
  position: absolute;
  top: 22px;
  right: 22px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.25s, transform 0.25s;
}

.btn-close-modal:hover {
  color: var(--shade-quinary);
  transform: scale(1.1);
}

.modal-card-body {
  padding: 28px;
  overflow-y: auto;
  font-size: 1.02rem;
  color: var(--text-secondary);
}

/* Prose formatting */
.prose p {
  margin-bottom: 1.25rem;
}

.prose strong {
  color: var(--text-primary);
}

.prose a, .inline-screen-link {
  color: var(--shade-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  background: transparent;
  border: none;
  font: inherit;
  padding: 0;
  transition: color 0.2s;
}

.prose a:hover, .inline-screen-link:hover {
  color: var(--shade-quinary);
}

/* Hardware Modal Modalities Box */
.modal-highlight-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin: 20px 0 24px;
}

.box-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--shade-quinary);
  margin-bottom: 10px;
}

.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modality-tag {
  background: rgba(228, 83, 0, 0.12);
  border: 1px solid rgba(228, 83, 0, 0.3);
  color: var(--text-primary);
  font-size: 0.82rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.hardware-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.hardware-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  text-decoration: none;
  color: inherit;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: all 0.35s var(--ease-slow);
}

.hardware-card:hover {
  border-color: var(--shade-secondary);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.hw-card-icon {
  color: var(--shade-secondary);
  flex-shrink: 0;
  margin-top: 4px;
}

.hw-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.hw-card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 10px;
}

.hw-card-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--shade-secondary);
}

/* Gaming Modal Spotlights */
.gaming-spotlights-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 24px;
}

.game-spotlight-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: border-color 0.3s;
}

.game-spotlight-card:hover {
  border-color: var(--border-mid);
}

.game-card-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--shade-quinary);
  margin-bottom: 6px;
}

.game-title {
  font-size: 1.2rem;
  font-family: var(--font-serif);
  color: var(--text-primary);
  margin-bottom: 8px;
}

.game-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
}

.game-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--shade-secondary);
  text-decoration: none;
}

.game-link:hover {
  color: var(--shade-quinary);
}

/* --- 4. SUB-SCREENS (Resources, Communities, Careers) --- */
.sub-screen {
  background: var(--bg-deep);
  z-index: 100;
  min-height: 100vh;
  padding: 90px 24px 60px;
}

.subscreen-container {
  max-width: 1180px;
  margin: 0 auto;
}

.subscreen-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.subscreen-badge {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--shade-secondary);
  display: block;
  margin-bottom: 6px;
}

.subscreen-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 8px;
}

.subscreen-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 780px;
  line-height: 1.5;
}

.btn-back-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s;
}

.btn-back-home:hover {
  border-color: var(--shade-secondary);
  color: var(--shade-quinary);
  background: var(--bg-card);
  transform: translateX(-3px);
}

.subscreen-footer {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.subscreen-footer a {
  color: var(--shade-secondary);
}

/* --- TREEMAP WORKSPACE STYLES --- */
.treemap-workspace {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  min-height: 580px;
}

@media (max-width: 900px) {
  .treemap-workspace {
    grid-template-columns: 1fr;
  }
}

.treemap-viewport-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  overflow: hidden;
}

.treemap-canvas {
  position: relative;
  width: 100%;
  height: 560px;
}

.treemap-node {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid rgba(228, 83, 0, 0.28);
  border-radius: 6px;
  padding: 8px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s var(--ease-slow), border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.treemap-node::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--node-accent, var(--shade-primary));
}

.treemap-node:hover, .treemap-node:focus-visible, .treemap-node.is-selected {
  z-index: 15;
  transform: scale(1.02);
  border-color: var(--shade-secondary);
  box-shadow: 0 0 16px rgba(255, 126, 0, 0.45);
}

.treemap-node.is-selected {
  border-color: #FFC400;
  box-shadow: 0 0 20px rgba(255, 196, 0, 0.6);
}

.node-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.node-title-compact {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-count {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--shade-quinary);
  margin-top: 4px;
}

.node-count small {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Treemap Detail Drawer */
.treemap-drawer {
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drawer-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-category {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--shade-secondary);
}

.drawer-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--text-primary);
  line-height: 1.25;
}

.drawer-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--shade-primary);
  color: #fff;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 0.25s;
}

.drawer-link-btn:hover {
  background: var(--shade-secondary);
}

.detail-stat-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.detail-stat-box.uncounted {
  justify-content: center;
}

.badge-uncounted {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-num {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--shade-quinary);
}

.stat-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
}

.stat-divider {
  width: 1px;
  height: 28px;
  background: var(--border-subtle);
}

.drawer-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.9rem;
}

.detail-row {
  line-height: 1.45;
}

.detail-heading {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.detail-heading.pros {
  color: #4ade80;
}

.detail-heading.cons {
  color: #f87171;
}

/* --- COMMUNITIES SCREEN STYLES --- */
.quagmire-discord-hero {
  background: linear-gradient(135deg, rgba(228, 83, 0, 0.16) 0%, var(--bg-surface) 65%);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 20px rgba(228, 83, 0, 0.12);
  transition: border-color 0.3s, transform 0.3s;
}

.quagmire-discord-hero:hover {
  border-color: var(--shade-secondary);
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .quagmire-discord-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 22px;
  }
}

.qd-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--shade-quinary);
  margin-bottom: 6px;
}

.qd-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 8px;
}

.qd-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 680px;
  line-height: 1.5;
}

.btn-discord-join {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #5865F2 0%, #4752C4 100%);
  color: #fff;
  padding: 13px 26px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(88, 101, 242, 0.35);
  transition: all 0.3s var(--ease-slow);
  flex-shrink: 0;
}

.btn-discord-join:hover {
  background: linear-gradient(135deg, #6775f5 0%, #5865F2 100%);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 24px rgba(88, 101, 242, 0.55);
}

.communities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.comm-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.35s var(--ease-slow);
}

.comm-card:hover {
  border-color: var(--shade-secondary);
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.5);
}

.comm-card.highlight {
  border-color: rgba(255, 126, 0, 0.45);
  background: linear-gradient(180deg, rgba(228, 83, 0, 0.08) 0%, var(--bg-surface) 60%);
}

.comm-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.comm-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.comm-badge.high {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}

.comm-badge.broad {
  background: rgba(255, 196, 0, 0.15);
  color: var(--shade-quinary);
}

.comm-badge.mid {
  background: rgba(228, 83, 0, 0.15);
  color: var(--shade-secondary);
}

.comm-format {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.comm-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--text-primary);
  line-height: 1.25;
}

.comm-summary {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.comm-fit {
  font-size: 0.88rem;
  background: var(--bg-card);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--shade-secondary);
}

.comm-caveat {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.comm-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--shade-secondary);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  margin-top: auto;
  transition: all 0.25s;
}

.comm-link-btn:hover {
  background: var(--shade-primary);
  color: #fff;
  border-color: var(--shade-primary);
}

.infobox-takeaway {
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  padding: 22px 26px;
}

.takeaway-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--shade-quinary);
  margin-bottom: 6px;
}

/* --- CAREERS SCREEN STYLES --- */
.section-heading {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.section-lead {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.careers-infographic-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 30px;
  margin-bottom: 30px;
}

.phd-split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .phd-split-grid {
    grid-template-columns: 1fr;
  }
}

.phd-column {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.phd-column.strict {
  border-top: 4px solid var(--shade-quaternary);
}

.phd-column.open {
  border-top: 4px solid var(--shade-secondary);
}

.column-header {
  margin-bottom: 16px;
}

.col-status {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #f87171;
  display: block;
  margin-bottom: 4px;
}

.col-status.open-status {
  color: #4ade80;
}

.column-header h4 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--text-primary);
}

.role-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 18px;
}

.column-footer {
  margin-top: auto;
  font-size: 0.82rem;
  color: var(--shade-quinary);
}

.hired-signals-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

@media (max-width: 768px) {
  .hired-signals-grid {
    grid-template-columns: 1fr;
  }
}

.signal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
}

.signal-card.high-value {
  border-left: 4px solid #4ade80;
}

.signal-card.low-value {
  border-left: 4px solid #f87171;
}

.signal-card h4 {
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.signal-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.roles-directory-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 30px;
}

.roles-table-wrapper {
  overflow-x: auto;
}

.roles-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.roles-table th, .roles-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.roles-table th {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

.roles-table td strong {
  color: var(--text-primary);
}

.mention-tag {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--shade-quinary);
  background: var(--bg-card);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

/* =========================================================================
   Site Legal Footer (Fixed Bottom-Left, Always English)
   ========================================================================= */
.site-footer-legal {
  position: fixed;
  bottom: 20px;
  left: 24px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  color: #FFFFFF;
  line-height: 1.4;
  pointer-events: auto;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

.site-footer-legal a {
  color: #FFFFFF;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(255, 255, 255, 0.45);
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.site-footer-legal a:hover {
  color: var(--shade-quinary);
  text-decoration-color: var(--shade-quinary);
}

.site-footer-legal a:focus-visible {
  outline: 2px solid var(--shade-quinary);
  outline-offset: 3px;
  border-radius: 2px;
}

.legal-sep {
  color: rgba(255, 255, 255, 0.6);
}

@media (max-width: 768px) {
  .site-footer-legal {
    bottom: 14px;
    left: 14px;
    font-size: 0.72rem;
    gap: 6px;
    max-width: calc(100vw - 160px);
  }
}

/* =========================================================================
   Language Selector Widget (Bottom-Right Dropdown)
   ========================================================================= */
.lang-selector-widget {
  position: fixed;
  bottom: 20px;
  right: 24px;
  z-index: 1200;
  display: flex;
  align-items: center;
}

.lang-select-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: rgba(14, 14, 18, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 126, 0, 0.35);
  border-radius: var(--radius-full);
  padding: 0 10px 0 14px;
  transition: all 0.25s var(--ease-slow);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

.lang-select-wrapper:hover,
.lang-select-wrapper:focus-within {
  border-color: var(--shade-secondary);
  box-shadow: 0 6px 24px rgba(228, 83, 0, 0.35);
  transform: translateY(-1px);
}

.lang-globe-icon {
  color: var(--shade-secondary);
  flex-shrink: 0;
  pointer-events: none;
  margin-right: 6px;
}

.lang-arrow-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  pointer-events: none;
  margin-left: 2px;
  transition: transform 0.2s ease;
}

.lang-select-wrapper:focus-within .lang-arrow-icon {
  color: var(--shade-quinary);
  transform: rotate(180deg);
}

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 8px 18px 8px 4px;
  cursor: pointer;
  outline: none;
}

.lang-select option {
  background: #121217;
  color: #F0F2F8;
  font-family: var(--font-sans);
  padding: 8px;
}

.lang-select:focus-visible {
  outline: 2px solid var(--shade-quinary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

@media (max-width: 768px) {
  .lang-selector-widget {
    bottom: 14px;
    right: 14px;
  }
  .btn-dive-in {
    bottom: 64px;
    right: 14px;
    padding: 8px 16px;
    font-size: 0.88rem;
  }
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
