/* ==========================================================================
   THE PIPELINE 3D — Md Abdullah Al Mamun (@Mamuntheprogrammer)
   One-Page Spatial 3D Scroll-Reveal Portfolio
   Blueprint / Oscilloscope Dark Aesthetic
   ========================================================================== */

/* Self-hosted variable fonts (SIL Open Font License; licences in assets/fonts) */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../assets/fonts/space-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('../assets/fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg-primary: #070b10;
  --bg-surface: rgba(10, 15, 24, 0.96);
  --bg-surface-solid: #0d131d;
  --bg-surface-elevated: rgba(18, 26, 39, 0.96);
  --bg-header: rgba(7, 11, 16, 0.85);
  --border-subtle: color-mix(in srgb, var(--line-mint) 16%, transparent);
  --border-accent: color-mix(in srgb, var(--line-mint) 42%, transparent);
  --line-mint: #5eead4;
  --line-mint-dim: color-mix(in srgb, var(--line-mint) 22%, transparent);
  --line-mint-glow: color-mix(in srgb, var(--line-mint) 50%, transparent);
  --packet-amber: #fbbf24;
  --packet-amber-glow: color-mix(in srgb, var(--packet-amber) 55%, transparent);
  --accent-purple: #a78bfa;
  --accent-red: #f87171;
  --accent-youtube: #ff4e45;
  --text-primary: #ecf2f8;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --grid-line: color-mix(in srgb, var(--line-mint) 4%, transparent);
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, Consolas, monospace;
  --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="paper"] {
  --bg-primary: #f1f5f9;
  --bg-surface: rgba(255, 255, 255, 0.9);
  --bg-surface-solid: #ffffff;
  --bg-surface-elevated: rgba(241, 245, 249, 0.95);
  --bg-header: rgba(241, 245, 249, 0.9);
  --border-subtle: rgba(2, 132, 199, 0.2);
  --border-accent: rgba(2, 132, 199, 0.5);
  --line-mint: #0284c7;
  --line-mint-dim: rgba(2, 132, 199, 0.18);
  --line-mint-glow: rgba(2, 132, 199, 0.35);
  --packet-amber: #d97706;
  --packet-amber-glow: rgba(217, 119, 6, 0.4);
  --text-primary: #0f172a;
  --text-muted: #334155;
  --text-subtle: #64748b;
  --grid-line: rgba(2, 132, 199, 0.06);
}

/* Crimson theme: pure black canvas, #CB2957 signal accent, and light-gray type.
   Derived shades are only used for hover/readability; the four core palette
   colors stay #000000, #CB2957, #DDDDDD, and #EEEEEE. */
[data-theme="crimson"] {
  --bg-primary: #000000;
  --bg-surface: rgba(10, 10, 10, 0.96);
  --bg-surface-solid: #0a0a0a;
  --bg-surface-elevated: rgba(21, 18, 19, 0.96);
  --bg-header: rgba(0, 0, 0, 0.86);
  --border-subtle: rgba(203, 41, 87, 0.22);
  --border-accent: rgba(203, 41, 87, 0.56);
  --line-mint: #cb2957;
  --line-mint-dim: rgba(203, 41, 87, 0.26);
  --line-mint-glow: rgba(203, 41, 87, 0.58);
  --packet-amber: #dddddd;
  --packet-amber-glow: rgba(221, 221, 221, 0.42);
  --accent-purple: #e0527f;
  --accent-red: #ff6b8a;
  --text-primary: #eeeeee;
  --text-muted: #dddddd;
  --text-subtle: #9b9b9b;
  --grid-line: rgba(203, 41, 87, 0.055);
}

/* Crimson theme: swap the remaining fixed teal/amber artwork at the SVG
   presentation-attribute level so every hand-drawn diagram follows the theme. */
[data-theme="crimson"] [stroke="#5eead4"] {
  stroke: var(--line-mint);
}

[data-theme="crimson"] [fill="#5eead4"] {
  fill: var(--line-mint);
}

[data-theme="crimson"] [stroke="#fbbf24"] {
  stroke: var(--packet-amber);
}

[data-theme="crimson"] [fill="#fbbf24"] {
  fill: var(--packet-amber);
}

[data-theme="crimson"] [fill="rgba(94,234,212,0.06)"] {
  fill: rgba(203, 41, 87, 0.09);
}

[data-theme="crimson"] [fill="rgba(13,19,29,0.9)"] {
  fill: rgba(8, 5, 6, 0.92);
}

[data-theme="crimson"] [fill="rgba(251,191,36,0.15)"],
[data-theme="crimson"] [fill="rgba(251,191,36,0.2)"] {
  fill: rgba(221, 221, 221, 0.14);
}

[data-theme="crimson"] .refinery-interactive-card {
  background: rgba(8, 4, 5, 0.94);
}

[data-theme="crimson"] .refinery-visualizer-stage {
  background: radial-gradient(circle at center, rgba(42, 9, 19, 0.92), #050002);
}

[data-theme="crimson"] .modal-backdrop,
[data-theme="crimson"] .portrait-modal,
[data-theme="crimson"] .analysis-modal {
  background: rgba(0, 0, 0, 0.92);
}

[data-theme="crimson"] .btn-primary,
[data-theme="crimson"] .skip-link,
[data-theme="crimson"] .dock-step-btn.active,
[data-theme="crimson"] .dock-step-btn.active .dock-step-num {
  color: #eeeeee;
}

[data-theme="crimson"] .btn-primary:hover,
[data-theme="crimson"] .btn-copy:hover {
  background: #e0527f;
  color: #000000;
}

[data-theme="crimson"] .btn-youtube {
  color: #ff8ca1;
}

[data-theme="crimson"] .btn-youtube:hover {
  color: #eeeeee;
  background: rgba(203, 41, 87, 0.22);
}

[data-theme="crimson"] .lock-gate {
  --gate-overlay: rgba(0, 0, 0, 0.96);
  --gate-terminal-bg: #000000;
  --gate-terminal-bar: #0a0507;
  --gate-terminal-foot: #080405;
  --gate-terminal-text: #dddddd;
  --gate-terminal-bright: #eeeeee;
  --gate-terminal-dim: #c9c9c9;
  --gate-terminal-subtle: #9b9b9b;
  --gate-terminal-placeholder: #6d6d6d;
  --gate-info: #dddddd;
  --gate-error: #ff7d9a;
}

/* Paper theme: components with fixed dark backgrounds or pale accent text
   need explicit corrections so they stay legible on light surfaces. */
[data-theme="paper"] .porbobd-spotlight-card {
  background: linear-gradient(135deg, #ffffff 0%, #e0f2fe 100%);
}

[data-theme="paper"] .technical-tag-amber,
[data-theme="paper"] .brand-wordmark-accent {
  color: #b45309;
  background: rgba(217, 119, 6, 0.1);
  border-color: rgba(180, 83, 9, 0.4);
}

[data-theme="paper"] .brand-wordmark-accent {
  background: transparent;
}

[data-theme="paper"] .refinery-analysis-btn,
[data-theme="paper"] .inline-analysis-btn {
  color: #b45309;
  border-color: rgba(180, 83, 9, 0.45);
}

[data-theme="paper"] .refinery-analysis-btn:hover,
[data-theme="paper"] .inline-analysis-btn:hover {
  background: rgba(180, 83, 9, 0.1);
}

[data-theme="paper"] .btn-youtube {
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.45);
}

[data-theme="paper"] .btn-youtube:hover {
  color: #991b1b;
  border-color: #b91c1c;
  background: rgba(185, 28, 28, 0.1);
}

/* The refinery console intentionally keeps its dark instrument panel. */
[data-theme="paper"] .refinery-interactive-card .technical-tag-amber {
  color: #fbbf24;
  background: color-mix(in srgb, var(--packet-amber) 10%, transparent);
  border-color: color-mix(in srgb, var(--packet-amber) 40%, transparent);
}

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

[hidden] {
  display: none !important;
}

html {
  font-size: 16px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Keep portfolio copy selectable in both the classic document and the 3D deck. */
body,
.station-frame,
.spatial-station,
.refinery-domain-panel {
  -webkit-user-select: text;
  user-select: text;
}

body.modal-open {
  overflow: hidden;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  position: relative;
}

/* Virtual Scroll Driver Track for One-Page 3D Z-Axis Reveal */
#scroll-driver-track {
  width: 100%;
  height: 720vh;
  pointer-events: none;
}

/* Classic Mode Fallback (when 3D mode is toggled OFF or reduced motion) */
body.classic-mode #scroll-driver-track {
  display: none;
}

body.classic-mode #spatial-viewport {
  position: relative !important;
  width: 100% !important;
  height: auto !important;
  overflow: visible !important;
  perspective: none !important;
}

body.classic-mode #spatial-stage {
  position: relative !important;
  inset: auto !important;
  height: auto !important;
  transform-style: flat !important;
  padding: 5.5rem 1rem 6rem;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

body.classic-mode .spatial-station {
  position: relative !important;
  inset: auto !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: none !important;
  height: auto !important;
  padding: 0 !important;
  scroll-margin-top: 74px;
}

body.classic-mode .station-frame {
  max-height: none !important;
  overflow: visible !important;
}

body.classic-mode #tunnel-2d-fallback {
  display: none !important;
}

/* ==========================================================================
   Fixed Full-Screen 3D Spatial Viewport & Stage
   ========================================================================== */

#spatial-viewport {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  perspective: 1200px;
  perspective-origin: 50% 50%;
  z-index: 10;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* Full-Viewport 3D WebGL Pipeline Tunnel Canvas */
#tunnel-canvas-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

#tunnel-canvas-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* 2D SVG Tunnel Fallback Rings */
#tunnel-2d-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.45;
  transition: opacity 0.5s ease;
}

/* 3D Z-Axis Stage holding all 7 Stations */
#spatial-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  z-index: 5;
  pointer-events: none;
}

.spatial-station {
  position: absolute;
  inset: 60px 0 68px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  transform-style: preserve-3d;
  will-change: transform, opacity;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: visibility 0s linear;
}

.spatial-station.is-interactive {
  pointer-events: auto;
  visibility: visible;
}

.spatial-station.is-visible {
  visibility: visible;
}

/* The Holographic Deck Frame for each Station */
.station-frame {
  width: 100%;
  max-width: 1240px;
  max-height: calc(100vh - 144px);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1.65rem 2rem;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.65),
    0 0 0 1px color-mix(in srgb, var(--line-mint) 8%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--line-mint) transparent;
}

.station-frame::-webkit-scrollbar {
  width: 5px;
}

.station-frame::-webkit-scrollbar-thumb {
  background: var(--border-accent);
  border-radius: 3px;
}

/* Corner technical crosshairs on station frames */
.station-frame::before,
.station-frame::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--line-mint);
  border-style: solid;
  pointer-events: none;
  opacity: 0.65;
}

.station-frame::before {
  top: 8px;
  left: 8px;
  border-width: 2px 0 0 2px;
}

.station-frame::after {
  bottom: 8px;
  right: 8px;
  border-width: 0 2px 2px 0;
}

/* ==========================================================================
   Typography & Badges
   ========================================================================== */

h1, h2, h3, h4, .font-mono {
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

a {
  color: var(--line-mint);
  text-decoration: none;
  transition: all 0.15s ease;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--line-mint);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 600;
  transform: translateY(-160%);
  background: var(--line-mint);
  color: #070b10;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.5rem 0.85rem;
  border-radius: 4px;
  transition: transform 0.15s ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
  text-decoration: none;
}

/* 3D vs classic mode labels (swapped by the scene controller) */
.only-classic { display: none; }
body.classic-mode .only-3d { display: none; }
body.classic-mode .only-classic { display: inline; }

.technical-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--line-mint);
  background: color-mix(in srgb, var(--line-mint) 9%, transparent);
  border: 1px solid var(--border-accent);
  padding: 0.18rem 0.55rem;
  border-radius: 4px;
}

.technical-tag-amber {
  color: var(--packet-amber);
  background: color-mix(in srgb, var(--packet-amber) 10%, transparent);
  border-color: color-mix(in srgb, var(--packet-amber) 40%, transparent);
}

.technical-tag-purple {
  color: var(--accent-purple);
  background: color-mix(in srgb, var(--accent-purple) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent-purple) 45%, transparent);
}

/* ==========================================================================
   Top Sticky HUD Header & SAP Command Bar
   ========================================================================== */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 58px;
  z-index: 120;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
}

.header-container {
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none !important;
  cursor: pointer;
}

.brand-wordmark {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  white-space: nowrap;
}

.brand-wordmark-accent {
  color: var(--packet-amber);
  font-weight: 700;
}

.header-avatar-mini {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 55% 20%;
  border: 1.5px solid var(--line-mint);
  box-shadow: 0 0 8px var(--line-mint-dim);
}

.sap-command-bar {
  display: flex;
  align-items: center;
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 0.25rem 0.55rem;
  max-width: 340px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sap-command-bar:focus-within {
  border-color: var(--line-mint);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--line-mint) 15%, transparent);
}

.command-prefix {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--line-mint);
  margin-right: 0.4rem;
  user-select: none;
  white-space: nowrap;
}

.command-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  width: 100%;
  outline: none;
}

.command-input::placeholder {
  color: var(--text-subtle);
  font-size: 0.72rem;
}

.command-hotkey-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
  margin-left: 0.35rem;
  user-select: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.btn-icon {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.32rem 0.6rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  color: var(--line-mint);
  border-color: var(--line-mint);
}

/* ==========================================================================
   Bottom 3D Pipeline Scrubber & Navigation HUD Dock
   ========================================================================== */

.pipeline-bottom-dock {
  position: fixed;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-accent);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  max-width: calc(100vw - 16px);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.pipeline-bottom-dock::-webkit-scrollbar {
  display: none;
}

.dock-step-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.3rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.dock-step-btn:hover {
  color: var(--text-primary);
  background: color-mix(in srgb, var(--line-mint) 8%, transparent);
}

.dock-step-btn.active {
  color: #070b10;
  background: var(--line-mint);
  font-weight: 700;
  border-color: var(--line-mint);
  box-shadow: 0 0 12px var(--line-mint-dim);
}

.dock-step-num {
  color: var(--packet-amber);
  font-weight: 700;
}

.dock-step-btn.active .dock-step-num {
  color: #070b10;
}

.dock-nav-arrow {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-subtle);
  color: var(--line-mint);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.28rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dock-nav-arrow:hover {
  border-color: var(--line-mint);
  background: color-mix(in srgb, var(--line-mint) 12%, transparent);
}

.depth-meter-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--packet-amber);
  padding: 0 0.45rem;
  border-left: 1px solid var(--border-subtle);
  white-space: nowrap;
}

/* ==========================================================================
   Station Header Common Layout
   ========================================================================== */

.station-top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed var(--border-subtle);
}

.station-node-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--line-mint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.station-node-number {
  color: var(--packet-amber);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding-right: 0.5rem;
  border-right: 1px solid var(--border-subtle);
}

.station-title {
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 800;
  color: var(--text-primary);
}

.station-subtitle {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 0.25rem;
  max-width: 56ch;
}

/* ==========================================================================
   STATION 00: SOURCE (Hero + Round Portrait + Live 3D Data Refinery)
   ========================================================================== */

.hero-spatial-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  align-items: center;
}

@media (min-width: 960px) {
  .hero-spatial-grid {
    grid-template-columns: 1.2fr 0.8fr;
  }
}

.hero-identity-row {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 600px) {
  .hero-identity-row {
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
  }
}

/* Circular / Round Portrait with Rotating Oscilloscope HUD Ring */
.portrait-round-shell {
  position: relative;
  width: 148px;
  height: 148px;
  flex-shrink: 0;
  border-radius: 50%;
  padding: 6px;
  background: radial-gradient(circle at center, color-mix(in srgb, var(--line-mint) 20%, transparent), transparent 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 28px color-mix(in srgb, var(--line-mint) 22%, transparent);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.portrait-round-shell:hover {
  transform: scale(1.04) rotate(2deg);
}

.portrait-hud-ring {
  position: absolute;
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  pointer-events: none;
  animation: slowSpin 24s linear infinite;
}

@keyframes slowSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.portrait-zoom-trigger {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: zoom-in;
  display: block;
  overflow: hidden;
}

.portrait-zoom-trigger:focus-visible {
  outline: 2px solid var(--packet-amber);
  outline-offset: 3px;
}

.portrait-zoom-hint {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(7, 11, 16, 0.72);
  border: 1px solid var(--line-mint);
  color: var(--line-mint);
  font-size: 0.8rem;
  line-height: 1;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.portrait-zoom-trigger:hover .portrait-zoom-hint,
.portrait-zoom-trigger:focus-visible .portrait-zoom-hint {
  opacity: 1;
  transform: translateY(0);
}

.portrait-round-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: 55% 20%;
  border: 2.5px solid var(--line-mint);
  display: block;
  background-color: var(--bg-surface-solid);
}

.portrait-status-pill {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: var(--bg-surface-solid);
  border: 1px solid var(--line-mint);
  color: var(--line-mint);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.hero-name {
  font-size: clamp(1.6rem, 4.2vw, 2.55rem);
  line-height: 1.12;
  font-weight: 800;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.hero-tagline {
  font-size: clamp(1.08rem, 2.5vw, 1.35rem);
  color: var(--line-mint);
  font-weight: 600;
  border-left: 3px solid var(--packet-amber);
  padding-left: 0.85rem;
  margin: 0.6rem 0;
}

.hero-bio {
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

/* Featured Venture Teaser Pill in Hero (porbobd.com) */
.porbobd-hero-banner {
  background: linear-gradient(90deg, color-mix(in srgb, var(--packet-amber) 12%, transparent), color-mix(in srgb, var(--line-mint) 8%, transparent));
  border: 1px solid color-mix(in srgb, var(--packet-amber) 45%, transparent);
  border-radius: 6px;
  padding: 0.65rem 0.95rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.hero-cta-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1rem;
}

.btn-primary {
  background: var(--line-mint);
  color: #070b10;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.55rem 1.05rem;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background: #7ef5e2;
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-secondary {
  background: var(--bg-surface-solid);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.55rem 0.95rem;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  border-color: var(--line-mint);
  color: var(--line-mint);
  text-decoration: none;
}

.btn-youtube {
  border-color: rgba(255, 78, 69, 0.45);
  color: #fca5a5;
}

.btn-youtube:hover {
  border-color: var(--accent-youtube);
  color: #ffffff;
  background: rgba(255, 78, 69, 0.15);
}

/* Interactive Messy-to-Meaningful Refinery Console on Right of Hero */
.refinery-interactive-card {
  background: rgba(9, 14, 22, 0.92);
  border: 1px solid var(--border-accent);
  border-radius: 8px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.7);
}

.refinery-visualizer-stage {
  position: relative;
  height: 220px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: radial-gradient(circle at center, rgba(16, 26, 40, 0.9), #06090e);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.refinery-svg-diagram {
  width: 100%;
  height: 100%;
}

.refinery-svg-diagram.surge-active {
  animation: refinerySurge 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes refinerySurge {
  0% { transform: scale(1); filter: brightness(1); }
  35% { transform: scale(1.035); filter: brightness(1.45) drop-shadow(0 0 14px color-mix(in srgb, var(--line-mint) 35%, transparent)); }
  100% { transform: scale(1); filter: brightness(1); }
}

.refinery-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.refinery-domain-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.refinery-domain-panel {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.8rem 0.9rem;
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
}

.refinery-domain-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.refinery-domain-title {
  font-size: 0.98rem;
  line-height: 1.25;
  color: var(--text-primary);
}

.refinery-domain-desc {
  font-size: 0.79rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.refinery-domain-points {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem 0.75rem;
}

.refinery-domain-points li {
  display: flex;
  align-items: flex-start;
  gap: 0.32rem;
  font-size: 0.73rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.refinery-domain-points li::before {
  content: '▸';
  flex-shrink: 0;
  color: var(--line-mint);
  font-family: var(--font-mono);
}

.refinery-analysis-btn,
.inline-analysis-btn {
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--packet-amber);
  color: var(--packet-amber);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.refinery-analysis-btn:hover,
.inline-analysis-btn:hover {
  background: color-mix(in srgb, var(--packet-amber) 12%, transparent);
}

.inline-analysis-btn {
  margin-top: 0.15rem;
  width: fit-content;
}

.refinery-telemetry {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 0.45rem 0.65rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.3rem 0.55rem;
}

/* ==========================================================================
   STATION 01: EXTRACT (6 Domain Stations)
   ========================================================================== */

.stations-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .stations-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .stations-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.station-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.station-card:hover {
  border-color: var(--line-mint);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.station-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.station-icon-wrapper {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--line-mint) 6%, transparent);
  border: 1px solid var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--line-mint);
}

.station-icon-svg {
  width: 30px;
  height: 30px;
}

.station-title-group {
  flex: 1;
}

.station-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.station-category {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.station-items-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
}

.station-item {
  position: relative;
  padding-left: 0.95rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.station-item::before {
  content: '▸';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--line-mint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

/* ==========================================================================
   STATION 02: SAP TECHNO-FUNCTIONAL BRIDGE & PORBOBD.COM VENTURE
   ========================================================================== */

.sap-venture-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.sap-split-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 1.25rem;
}

@media (min-width: 840px) {
  .sap-split-container {
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }
}

.sap-wing {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sap-wing-badge {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--line-mint);
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sap-bridge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem;
}

.sap-bridge-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--packet-amber);
  background: color-mix(in srgb, var(--packet-amber) 12%, transparent);
  border: 1px solid var(--packet-amber);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
}

.porbobd-spotlight-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(22, 78, 99, 0.28));
  border: 1px solid var(--packet-amber);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ==========================================================================
   STATION 03: TRANSFORM (Toolbelt Styled DataFrame)
   ========================================================================== */

.dataframe-wrapper {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
}

.dataframe-header-bar {
  background: var(--bg-surface-solid);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.5rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dataframe-table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--line-mint) transparent;
}

.dataframe-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.dataframe-table th {
  background: var(--bg-surface-solid);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--line-mint);
  text-transform: uppercase;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
}

.dataframe-table td {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.dataframe-table tr:hover td {
  background: color-mix(in srgb, var(--line-mint) 4%, transparent);
  color: var(--text-primary);
}

/* ==========================================================================
   STATION 04: LOAD (Projects Live GitHub Records)
   ========================================================================== */

.projects-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
  align-items: center;
}

.filter-btn {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.28rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
}

.filter-btn:hover, .filter-btn.active {
  border-color: var(--line-mint);
  color: var(--line-mint);
  background: color-mix(in srgb, var(--line-mint) 10%, transparent);
}

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

@media (min-width: 680px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1040px) {
  .projects-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.project-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  transition: all 0.18s ease;
}

.project-card:hover {
  border-color: var(--line-mint);
  transform: translateY(-2px);
}

.project-record-id {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-name {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  word-break: break-word;
}

.project-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.project-tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-muted);
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-subtle);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

/* ==========================================================================
   STATION 05: AUTOMATE & JOURNEY (Before ➔ After + Milestones)
   ========================================================================== */

.automate-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .automate-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.automate-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.automate-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.before-after-flow {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.flow-box {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 0.65rem 0.8rem;
}

.flow-box.before {
  border-left: 3px solid var(--accent-red);
}

.flow-box.after {
  border-left: 3px solid var(--line-mint);
}

.flow-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  display: block;
  margin-bottom: 0.2rem;
}

.flow-box.before .flow-label { color: var(--accent-red); }
.flow-box.after .flow-label { color: var(--line-mint); }

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

/* ==========================================================================
   STATION 06: REPORT (Contact SQL Terminal + YouTube + Email Copy)
   ========================================================================== */

.contact-sql-terminal {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
}

.terminal-titlebar {
  background: var(--bg-surface-solid);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.5rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-body {
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sql-query-line {
  color: var(--line-mint);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.65rem;
}

.sql-keyword {
  color: var(--packet-amber);
  font-weight: 700;
}

.contact-channels-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

@media (min-width: 640px) {
  .contact-channels-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

.contact-card-item {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.45rem;
}

.contact-card-item:hover {
  border-color: var(--line-mint);
}

.contact-card-label {
  font-size: 0.68rem;
  color: var(--text-subtle);
  text-transform: uppercase;
}

.contact-card-val {
  font-size: 0.86rem;
  color: var(--text-primary);
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.btn-copy {
  background: color-mix(in srgb, var(--line-mint) 8%, transparent);
  border: 1px solid var(--border-accent);
  color: var(--line-mint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  text-decoration: none;
}

.btn-copy:hover {
  background: var(--line-mint);
  color: #070b10;
  text-decoration: none;
}

.resume-summary {
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.resume-download-btn {
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ==========================================================================
   Command Feedback & Modals & Intro
   ========================================================================== */

.command-feedback {
  position: fixed;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  background: var(--bg-surface-solid);
  border: 1px solid var(--line-mint);
  color: var(--line-mint);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  display: none;
}

.command-feedback.visible {
  display: flex;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 11, 16, 0.88);
  z-index: 250;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-backdrop.active {
  display: flex;
}

.modal-window {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-accent);
  border-radius: 6px;
  max-width: 620px;
  width: 100%;
  overflow: hidden;
}

.modal-header {
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.6rem 1rem;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--line-mint);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  cursor: pointer;
  white-space: nowrap;
}

.modal-content {
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-primary);
  max-height: 70vh;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ==========================================================================
   PORTRAIT LIGHTBOX & EMBEDDED ANALYSIS DASHBOARD
   ========================================================================== */

.portrait-modal,
.analysis-modal {
  z-index: 500;
}

.portrait-modal {
  background: rgba(4, 8, 14, 0.9);
  backdrop-filter: blur(8px);
}

.portrait-modal-window {
  position: relative;
  width: min(92vw, 620px);
  max-height: 92vh;
  padding: 0.7rem;
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-accent);
  border-radius: 12px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65);
  overflow: auto;
}

.portrait-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  padding: 0.3rem 0.55rem;
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
}

.portrait-modal-img {
  display: block;
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 8px;
  background: var(--bg-primary);
}

.portrait-modal-caption {
  padding: 0.55rem 0.25rem 0.1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.portrait-modal-caption span {
  color: var(--packet-amber);
}

.analysis-modal-window {
  display: flex;
  flex-direction: column;
  width: min(1240px, 96vw);
  height: min(92vh, 920px);
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-accent);
  border-radius: 10px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.analysis-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

.analysis-modal-header > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.analysis-modal-title {
  font-size: 1rem;
  line-height: 1.25;
  color: var(--text-primary);
}

.analysis-modal-body {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #ffffff;
}

.analysis-modal-body iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.analysis-loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #334155;
  background: #f1f5f9;
  pointer-events: none;
}

.analysis-modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  padding: 0.45rem 1rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-muted);
}

.analysis-modal-footer a {
  color: var(--line-mint);
}

@media (max-width: 700px) {
  .portrait-modal {
    padding: 0.75rem;
  }
  .portrait-modal-window {
    width: 100%;
    padding: 0.5rem;
  }
  .portrait-modal-img {
    max-height: 70vh;
  }
  .analysis-modal {
    padding: 0;
  }
  .analysis-modal-window {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }
  .analysis-modal-header {
    padding: 0.65rem 0.75rem;
    flex-wrap: wrap;
  }
  .analysis-modal-title {
    font-size: 0.85rem;
  }
  .analysis-modal-header .modal-close-btn {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
  }
  .analysis-modal-footer {
    display: none;
  }
  .refinery-domain-points {
    grid-template-columns: 1fr;
  }
}

#intro-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#intro-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-stage {
  max-width: 860px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.intro-name-svg {
  width: 100%;
  max-width: 740px;
  height: auto;
}

.intro-skip-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
}

/* ==========================================================================
   LOCK GATE — post-intro expertise challenge
   ========================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.gate-open {
  overflow: hidden;
}

.lock-gate[hidden] {
  display: none !important;
}

.lock-gate {
  --gate-accent: var(--line-mint);
  --gate-secondary: var(--packet-amber);
  --gate-overlay: rgba(3, 7, 12, 0.94);
  --gate-terminal-bg: #050a0f;
  --gate-terminal-bar: #0a121b;
  --gate-terminal-foot: #08111a;
  --gate-terminal-text: #b9c7d6;
  --gate-terminal-bright: #e2e8f0;
  --gate-terminal-dim: #93a4b8;
  --gate-terminal-subtle: #6b7c8f;
  --gate-terminal-placeholder: #526172;
  --gate-info: #93c5fd;
  --gate-error: #fca5a5;
  position: fixed;
  inset: 0;
  z-index: 480;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--gate-overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.lock-gate.is-active {
  opacity: 1;
  visibility: visible;
}

.lock-gate.is-closing {
  opacity: 0;
  visibility: hidden;
}

.lock-gate::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 16%, color-mix(in srgb, var(--gate-accent) 12%, transparent), transparent 36%),
    radial-gradient(circle at 88% 82%, color-mix(in srgb, var(--gate-secondary) 10%, transparent), transparent 34%),
    linear-gradient(180deg, rgba(7, 11, 16, 0.08), rgba(7, 11, 16, 0.82));
  pointer-events: none;
}

.lock-gate-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.lock-gate-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--gate-accent) 5.5%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--gate-accent) 5.5%, transparent) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(circle at 50% 45%, #000 25%, transparent 76%);
  mask-image: radial-gradient(circle at 50% 45%, #000 25%, transparent 76%);
}

.lock-gate-scan {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 180px;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--gate-accent) 7%, transparent) 72%, color-mix(in srgb, var(--gate-accent) 16%, transparent) 100%);
  opacity: 0.55;
  animation: gate-scan 8s linear infinite;
}

.lock-gate-shell {
  position: relative;
  z-index: 1;
  width: min(1080px, 100%);
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--bg-surface-solid), var(--bg-primary));
  border: 1px solid var(--border-accent);
  border-radius: 12px;
  box-shadow:
    0 34px 100px rgba(0, 0, 0, 0.72),
    0 0 0 1px color-mix(in srgb, var(--gate-accent) 5%, transparent) inset,
    0 0 70px color-mix(in srgb, var(--gate-accent) 5%, transparent);
  overflow: hidden;
  transform: translateY(14px) scale(0.985);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.lock-gate.is-active .lock-gate-shell {
  transform: none;
}

.lock-gate-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0.62rem 1rem;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

.lock-gate-path {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
}

.lock-gate-path::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-mint);
  box-shadow: 0 0 10px var(--line-mint-glow);
  animation: gate-pulse 2.4s ease-in-out infinite;
}

.lock-gate-status {
  margin-left: auto;
  color: var(--packet-amber);
  border: 1px solid color-mix(in srgb, var(--gate-secondary) 34%, transparent);
  border-radius: 3px;
  padding: 0.18rem 0.45rem;
  white-space: nowrap;
}

.lock-gate.is-unlocked .lock-gate-status {
  color: var(--line-mint);
  border-color: var(--border-accent);
  background: color-mix(in srgb, var(--gate-accent) 6%, transparent);
}

.lock-gate-skip {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  padding: 0.28rem 0.6rem;
  cursor: pointer;
  white-space: nowrap;
}

.lock-gate-skip:hover {
  color: var(--line-mint);
  border-color: var(--line-mint);
  background: color-mix(in srgb, var(--gate-accent) 7%, transparent);
}

.lock-gate-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-accent) transparent;
}

.lock-gate-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.15rem;
  padding: 1.6rem 1.4rem;
  border-right: 1px solid var(--border-subtle);
  background:
    radial-gradient(circle at 50% 32%, color-mix(in srgb, var(--gate-secondary) 7%, transparent), transparent 62%),
    linear-gradient(180deg, color-mix(in srgb, var(--gate-accent) 2%, transparent), transparent);
}

.gate-lock-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.gate-lock-svg {
  width: min(228px, 100%);
  height: auto;
  overflow: visible;
  color: var(--packet-amber);
  filter: drop-shadow(0 0 24px color-mix(in srgb, var(--gate-secondary) 16%, transparent));
  transition: color 0.45s ease, filter 0.45s ease;
}

.gate-ring {
  transform-box: view-box;
  transform-origin: 110px 138px;
}

.gate-ring circle {
  fill: none;
  stroke: color-mix(in srgb, var(--gate-accent) 18%, transparent);
  stroke-width: 1;
  stroke-dasharray: 3 10;
}

.gate-ring-a {
  animation: gate-rotate 34s linear infinite;
}

.gate-ring-b {
  animation: gate-rotate-reverse 26s linear infinite;
}

.gate-ring-b circle {
  stroke: color-mix(in srgb, var(--gate-secondary) 22%, transparent);
  stroke-dasharray: 1 14;
}

.gate-sparks circle {
  fill: var(--line-mint);
  opacity: 0.35;
  animation: gate-pulse 3.4s ease-in-out infinite;
}

.gate-sparks circle:nth-child(2) {
  animation-delay: 0.7s;
}

.gate-sparks circle:nth-child(3) {
  animation-delay: 1.3s;
}

.gate-sparks circle:nth-child(4) {
  animation-delay: 2.1s;
}

.gate-shackle {
  fill: none;
  stroke: currentColor;
  stroke-width: 9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-box: view-box;
  transform-origin: 110px 122px;
  transition: transform 0.65s cubic-bezier(0.2, 0.9, 0.2, 1), stroke 0.45s ease;
}

.gate-lock-body {
  fill: color-mix(in srgb, var(--gate-secondary) 5.5%, transparent);
  stroke: currentColor;
  stroke-width: 2.5;
  transition: fill 0.45s ease, stroke 0.45s ease;
}

.gate-keyhole {
  fill: currentColor;
  transform-box: fill-box;
  transform-origin: center;
  animation: gate-pulse 2.2s ease-in-out infinite;
  transition: fill 0.45s ease;
}

.gate-keyhole-stem {
  stroke: currentColor;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke 0.45s ease;
}

.gate-bolt {
  fill: var(--text-subtle);
  transition: fill 0.45s ease;
}

.gate-led {
  fill: var(--accent-red);
  animation: gate-blink 1.7s steps(1) infinite;
}

.gate-led-2 {
  fill: var(--packet-amber);
  animation-delay: 0.85s;
}

.gate-lock-state {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  color: var(--packet-amber);
  border: 1px solid color-mix(in srgb, var(--gate-secondary) 32%, transparent);
  border-radius: 999px;
  padding: 0.26rem 0.7rem;
  transition: color 0.35s ease, border-color 0.35s ease, background 0.35s ease;
}

.gate-lock-svg.is-unlocked {
  color: var(--line-mint);
  filter: drop-shadow(0 0 30px color-mix(in srgb, var(--gate-accent) 34%, transparent));
}

.gate-lock-svg.is-unlocked .gate-shackle {
  transform: translateY(-16px) rotate(-4deg);
}

.gate-lock-svg.is-unlocked .gate-lock-body {
  fill: color-mix(in srgb, var(--gate-accent) 7%, transparent);
}

.gate-lock-svg.is-unlocked .gate-keyhole {
  animation: none;
}

.gate-lock-svg.is-unlocked .gate-bolt {
  fill: var(--line-mint);
}

.gate-lock-svg.is-unlocked + .gate-lock-state,
.lock-gate.is-unlocked .gate-lock-state {
  color: var(--line-mint);
  border-color: var(--border-accent);
  background: color-mix(in srgb, var(--gate-accent) 8%, transparent);
}

.gate-readout {
  width: 100%;
  display: grid;
  gap: 0.42rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.03em;
}

.gate-readout-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.gate-readout-row span {
  color: var(--text-subtle);
  letter-spacing: 0.13em;
}

.gate-readout-row strong {
  color: var(--text-muted);
  font-weight: 500;
  text-align: right;
}

.lock-gate-content {
  min-width: 0;
  padding: 1.55rem 1.75rem 2rem;
}

.gate-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  color: var(--packet-amber);
  text-transform: uppercase;
}

.gate-title {
  margin: 0.45rem 0 0.65rem;
  font-family: var(--font-sans);
  font-size: clamp(1.7rem, 3.5vw, 2.7rem);
  line-height: 1.03;
  letter-spacing: -0.045em;
  color: var(--text-primary);
}

.gate-title span {
  color: var(--line-mint);
}

.gate-desc {
  max-width: 62ch;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.62;
}

.gate-skill-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 1.35rem;
}

.gate-skill {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.16rem;
  padding: 0.62rem 0.7rem 0.58rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.gate-skill::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: linear-gradient(90deg, var(--line-mint), var(--packet-amber));
  opacity: 0;
  transition: opacity 0.15s ease;
}

.gate-skill:hover,
.gate-skill:focus-visible {
  transform: translateY(-2px);
  border-color: var(--border-accent);
  background: color-mix(in srgb, var(--gate-accent) 6%, transparent);
}

.gate-skill:hover::after,
.gate-skill:focus-visible::after {
  opacity: 1;
}

.gate-skill-glyph {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--packet-amber);
}

.gate-skill-name {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.gate-skill-meta {
  font-family: var(--font-mono);
  font-size: 0.53rem;
  letter-spacing: 0.09em;
  color: var(--text-subtle);
  text-transform: uppercase;
}

.gate-footnote {
  margin: 0.9rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-subtle);
}

.gate-footnote button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--line-mint);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.gate-challenge {
  animation: gate-fade-up 0.35s ease both;
}

.gate-challenge-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.gate-challenge-title {
  margin: 0.22rem 0 0;
  font-family: var(--font-sans);
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
  color: var(--text-primary);
}

.gate-back-btn {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  padding: 0.32rem 0.55rem;
  cursor: pointer;
}

.gate-back-btn:hover {
  color: var(--line-mint);
  border-color: var(--line-mint);
}

.gate-terminal {
  border: 1px solid color-mix(in srgb, var(--gate-accent) 24%, transparent);
  border-radius: 8px;
  background: var(--gate-terminal-bg);
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  font-family: var(--font-mono);
}

.gate-terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.48rem 0.7rem;
  background: var(--gate-terminal-bar);
  border-bottom: 1px solid color-mix(in srgb, var(--gate-accent) 14%, transparent);
  font-size: 0.62rem;
  color: var(--gate-terminal-subtle);
}

.gate-terminal-dots {
  display: inline-flex;
  flex-shrink: 0;
  gap: 0.3rem;
}

.gate-terminal-dots i {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-red);
}

.gate-terminal-dots i:nth-child(2) {
  background: var(--gate-secondary);
}

.gate-terminal-dots i:nth-child(3) {
  background: var(--gate-accent);
}

.gate-terminal-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gate-terminal-live {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  flex-shrink: 0;
  color: var(--gate-accent);
  letter-spacing: 0.14em;
  font-size: 0.58rem;
}

.gate-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gate-accent);
  box-shadow: 0 0 9px color-mix(in srgb, var(--gate-accent) 80%, transparent);
  animation: gate-blink 1.5s ease-in-out infinite;
}

.gate-terminal-body {
  padding: 0.8rem 0.9rem 0.6rem;
}

.gate-terminal-output {
  min-height: 8.4rem;
  max-height: 12rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: 0.76rem;
  line-height: 1.55;
  color: var(--gate-terminal-text);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--gate-accent) 30%, transparent) transparent;
}

.gate-line {
  min-height: 1.55em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.gate-line-cmd {
  color: var(--gate-accent);
}

.gate-line-tag {
  color: var(--gate-secondary);
  letter-spacing: 0.05em;
}

.gate-line-question {
  color: var(--gate-terminal-bright);
}

.gate-line-hint {
  color: var(--gate-terminal-dim);
}

.gate-line-info {
  color: var(--gate-info);
}

.gate-line-error {
  color: var(--gate-error);
}

.gate-line-success {
  color: var(--gate-accent);
}

.gate-caret {
  display: inline-block;
  width: 0.55ch;
  height: 1em;
  margin-left: 1px;
  vertical-align: -0.12em;
  background: var(--gate-accent);
  animation: gate-caret 1s steps(1) infinite;
}

.gate-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px dashed color-mix(in srgb, var(--gate-accent) 14%, transparent);
}

.gate-prompt {
  flex-shrink: 0;
  font-size: 0.7rem;
  color: var(--gate-accent);
  white-space: nowrap;
}

.gate-answer {
  flex: 1;
  min-width: 0;
  padding: 0.26rem 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--gate-terminal-bright);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  caret-color: var(--gate-accent);
}

.gate-answer::placeholder {
  color: var(--gate-terminal-placeholder);
}

.gate-execute {
  flex-shrink: 0;
  background: color-mix(in srgb, var(--gate-accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--gate-accent) 35%, transparent);
  border-radius: 4px;
  color: var(--gate-accent);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
}

.gate-execute:hover {
  background: var(--gate-accent);
  color: var(--gate-terminal-bg);
}

.gate-feedback {
  min-height: 1.15rem;
  margin: 0.5rem 0 0;
  font-size: 0.66rem;
  line-height: 1.45;
  color: var(--gate-terminal-subtle);
}

.gate-feedback.is-error {
  color: var(--gate-error);
}

.gate-feedback.is-success {
  color: var(--gate-accent);
}

.gate-feedback.is-warn {
  color: var(--gate-secondary);
}

.gate-terminal-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.48rem 0.9rem;
  background: var(--gate-terminal-foot);
  border-top: 1px solid color-mix(in srgb, var(--gate-accent) 10%, transparent);
  font-size: 0.6rem;
  color: var(--gate-terminal-subtle);
}

.gate-terminal-foot button {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--gate-accent) 18%, transparent);
  border-radius: 3px;
  color: var(--gate-terminal-dim);
  font-family: inherit;
  font-size: inherit;
  padding: 0.22rem 0.5rem;
  cursor: pointer;
}

.gate-terminal-foot button:hover:not(:disabled) {
  color: var(--gate-accent);
  border-color: color-mix(in srgb, var(--gate-accent) 50%, transparent);
}

.gate-terminal-foot button:disabled {
  opacity: 0.35;
  cursor: default;
}

#gate-attempts {
  margin-left: auto;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.gate-puzzle {
  margin-top: 0.8rem;
  padding: 0.78rem 0.9rem;
  border: 1px solid color-mix(in srgb, var(--gate-secondary) 22%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--gate-secondary) 3.5%, transparent);
  transition: border-color 0.3s ease, background 0.3s ease;
}

.gate-puzzle.is-solved {
  border-color: var(--border-accent);
  background: color-mix(in srgb, var(--gate-accent) 5.5%, transparent);
}

.gate-puzzle.is-wrong {
  animation: gate-shake 0.38s ease;
}

.gate-puzzle-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.gate-puzzle-head .gate-eyebrow {
  font-size: 0.6rem;
}

#gate-puzzle-progress {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-subtle);
  white-space: nowrap;
}

.gate-puzzle-clue {
  margin: 0.4rem 0 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.gate-puzzle-slots,
.gate-puzzle-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.34rem;
}

.gate-puzzle-slots {
  min-height: 2.1rem;
}

.gate-puzzle-tiles {
  margin-top: 0.5rem;
}

.gate-slot {
  width: 2rem;
  height: 2.1rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 11, 16, 0.32);
  border: 1px solid color-mix(in srgb, var(--gate-secondary) 30%, transparent);
  border-radius: 4px;
  color: var(--packet-amber);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.gate-slot:disabled {
  background: transparent;
  border-style: dashed;
  border-color: color-mix(in srgb, var(--gate-secondary) 16%, transparent);
  color: transparent;
  cursor: default;
}

.gate-puzzle.is-solved .gate-slot {
  border-color: var(--border-accent);
  border-style: solid;
  background: color-mix(in srgb, var(--gate-accent) 8%, transparent);
  color: var(--line-mint);
}

.gate-tile {
  min-width: 2rem;
  height: 2.1rem;
  padding: 0 0.4rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}

.gate-tile:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--line-mint);
  color: var(--line-mint);
}

.gate-tile:disabled {
  opacity: 0.28;
  cursor: default;
}

.gate-puzzle-note {
  margin: 0.55rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  line-height: 1.45;
  color: var(--text-subtle);
}

.gate-success {
  padding: 1.1rem 0 0.4rem;
  text-align: center;
  animation: gate-fade-up 0.4s ease both;
}

.gate-success-mark {
  width: 70px;
  height: 70px;
  margin: 0 auto 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-mint);
  border-radius: 50%;
  color: var(--line-mint);
  font-family: var(--font-mono);
  font-size: 1.5rem;
  box-shadow:
    0 0 30px color-mix(in srgb, var(--gate-accent) 18%, transparent),
    0 0 18px color-mix(in srgb, var(--gate-accent) 8%, transparent) inset;
  animation: gate-pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.4) both;
}

.gate-success h2 {
  margin: 0.5rem 0 0.65rem;
  font-family: var(--font-sans);
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  line-height: 1.03;
  letter-spacing: -0.045em;
  color: var(--text-primary);
}

.gate-success p {
  max-width: 54ch;
  margin: 0 auto 1.2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.62;
}

.gate-countdown {
  max-width: 380px;
  margin: 0 auto;
}

.gate-countdown-track {
  height: 4px;
  border-radius: 999px;
  background: var(--border-subtle);
  overflow: hidden;
}

.gate-countdown-bar {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, var(--line-mint), var(--packet-amber));
  transition: transform 3s linear;
}

.gate-countdown-label {
  display: block;
  margin-top: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.gate-enter-btn {
  margin-top: 1.1rem;
  padding: 0.48rem 0.85rem;
  background: color-mix(in srgb, var(--gate-accent) 8%, transparent);
  border: 1px solid var(--border-accent);
  border-radius: 4px;
  color: var(--line-mint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.gate-enter-btn:hover {
  background: var(--line-mint);
  color: var(--gate-terminal-bg);
}

.lock-gate-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.5rem 1rem;
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
}

.lock-gate.is-denied .gate-lock-svg {
  animation: gate-shake 0.42s ease;
}

@keyframes gate-scan {
  from { transform: translateY(-200px); }
  to { transform: translateY(110vh); }
}

@keyframes gate-rotate {
  to { transform: rotate(360deg); }
}

@keyframes gate-rotate-reverse {
  to { transform: rotate(-360deg); }
}

@keyframes gate-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@keyframes gate-blink {
  0%, 45% { opacity: 1; }
  50%, 100% { opacity: 0.18; }
}

@keyframes gate-caret {
  50% { opacity: 0; }
}

@keyframes gate-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

@keyframes gate-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes gate-pop {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 900px) {
  .lock-gate-main {
    grid-template-columns: 1fr;
  }

  .lock-gate-visual {
    flex-direction: row;
    justify-content: center;
    gap: 1.25rem;
    padding: 1rem 1.25rem;
    border-right: 0;
    border-bottom: 1px solid var(--border-subtle);
  }

  .gate-lock-svg {
    width: 150px;
  }

  .gate-readout {
    width: auto;
    max-width: 280px;
    flex: 1;
    padding: 0 0 0 1rem;
    border-top: 0;
    border-left: 1px dashed var(--border-subtle);
  }
}

@media (max-width: 620px) {
  .lock-gate {
    padding: 0;
  }

  .lock-gate-shell {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .lock-gate-bar {
    padding: 0.55rem 0.75rem;
    gap: 0.4rem;
  }

  .lock-gate-path {
    font-size: 0.62rem;
  }

  .lock-gate-status {
    display: none;
  }

  .lock-gate-skip {
    margin-left: auto;
    font-size: 0.62rem;
  }

  .lock-gate-main {
    display: block;
  }

  .lock-gate-visual {
    padding: 0.75rem 1rem 0.35rem;
    border-bottom: 0;
  }

  .gate-lock-svg {
    width: 108px;
  }

  .gate-readout {
    display: none;
  }

  .lock-gate-content {
    padding: 0 1rem 1.5rem;
  }

  .gate-title {
    font-size: clamp(1.6rem, 8.5vw, 2.2rem);
  }

  .gate-desc {
    font-size: 0.84rem;
  }

  .gate-skill-grid {
    gap: 0.4rem;
    margin-top: 1.1rem;
  }

  .gate-skill {
    padding: 0.52rem 0.55rem 0.48rem;
  }

  .gate-skill-name {
    font-size: 0.82rem;
  }

  .gate-skill-meta {
    display: none;
  }

  .gate-challenge-head {
    flex-direction: column;
    gap: 0.5rem;
  }

  .gate-back-btn {
    align-self: flex-start;
  }

  .gate-terminal-output {
    min-height: 7.4rem;
    max-height: 12rem;
    font-size: 0.72rem;
  }

  .gate-prompt {
    display: none;
  }

  .gate-success h2 {
    font-size: clamp(1.8rem, 9vw, 2.4rem);
  }
}

@media (max-width: 380px) {
  .lock-gate-skip {
    font-size: 0.56rem;
    padding: 0.24rem 0.4rem;
  }

  .gate-lock-svg {
    width: 94px;
  }

  .gate-skill-name {
    font-size: 0.76rem;
  }

  .gate-skill-glyph {
    font-size: 0.56rem;
  }

  .gate-slot,
  .gate-tile {
    min-width: 1.8rem;
    height: 1.95rem;
  }

  .gate-slot {
    width: 1.8rem;
  }

  .lock-gate-footer {
    font-size: 0.5rem;
  }
}

/* ==========================================================================
   Responsive Refinements
   ========================================================================== */

/* The 3D scroll stage needs room for the scrubber HUD; on smaller screens
   the page switches to the classic flowing layout (see scene3d.js). */
@media (max-width: 1100px) {
  #depth-meter-badge {
    display: none;
  }
}

@media (max-width: 900px) {
  body.compact-mode #toggle-3d-btn {
    display: none;
  }

  body.classic-mode #spatial-stage {
    padding: 4.6rem 0.65rem 5.6rem;
    gap: 1.4rem;
  }

  body.classic-mode .spatial-station {
    scroll-margin-top: 62px;
  }

  .station-frame {
    max-height: calc(100vh - 112px);
  }
}

@media (max-width: 768px) {
  .site-header {
    padding: 0 0.5rem;
    height: 50px;
  }
  .header-container {
    gap: 0.35rem;
  }
  .header-brand {
    font-size: 0.78rem;
    gap: 0.4rem;
  }
  .brand-wordmark {
    font-size: 0.82rem;
    letter-spacing: -0.03em;
  }
  .header-avatar-mini {
    width: 26px;
    height: 26px;
  }
  .header-actions {
    gap: 0.3rem;
    flex-shrink: 0;
  }
  .sap-command-bar {
    max-width: 220px;
    padding: 0.18rem 0.4rem;
  }
  .command-hotkey-badge {
    display: none;
  }
  .btn-icon {
    padding: 0.22rem 0.42rem;
    font-size: 0.64rem;
  }
  .spatial-station {
    inset: 52px 0 56px 0;
    padding: 0.35rem 0.5rem;
  }
  .station-frame {
    padding: 0.95rem 0.9rem;
    max-height: calc(100vh - 112px);
  }
  .portrait-round-shell {
    width: 112px;
    height: 112px;
  }
  .dock-step-label,
  .depth-meter-badge {
    display: none;
  }
  .pipeline-bottom-dock {
    padding: 0.25rem 0.4rem;
    gap: 0.2rem;
    bottom: max(6px, env(safe-area-inset-bottom));
  }
  .dock-step-btn {
    padding: 0.24rem 0.42rem;
    font-size: 0.68rem;
  }
  .station-node-badge {
    font-size: 0.72rem;
    gap: 0.35rem;
    flex-wrap: wrap;
  }
  .station-top-bar {
    gap: 0.5rem;
    margin-bottom: 1rem;
  }
  .porbobd-spotlight-card {
    padding: 1rem;
  }
  .refinery-interactive-card {
    padding: 0.85rem;
  }
  .refinery-visualizer-stage {
    height: 190px;
  }
}

@media (max-width: 600px) {
  .sap-command-bar {
    display: none;
  }
  .hero-cta-group > a {
    flex: 1 1 auto;
    justify-content: center;
  }
  .porbobd-hero-banner {
    padding: 0.55rem 0.75rem;
  }
  .terminal-body {
    padding: 1rem;
  }
  .sql-query-line {
    font-size: 0.76rem;
    line-height: 1.7;
  }
  body.classic-mode #spatial-stage {
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }
}

@media (max-width: 400px) {
  .header-brand {
    font-size: 0.72rem;
  }
  .brand-wordmark {
    font-size: 0.7rem;
  }
  .hero-tagline {
    font-size: 1rem;
    padding-left: 0.65rem;
  }
  .hero-bio {
    font-size: 0.88rem;
  }
  .btn-primary,
  .btn-secondary {
    font-size: 0.74rem;
    padding: 0.5rem 0.75rem;
  }
  .station-frame {
    padding: 0.85rem 0.75rem;
  }
  .contact-card-val {
    font-size: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  #intro-overlay {
    display: none !important;
  }
  .portrait-hud-ring {
    animation: none;
  }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
