/* Reset & Base */
:root {
  --bg-color: #050505;
  --bg-card: #111111;
  --text-primary: #f5f5f7;
  --text-secondary: #86868b;
  --accent-color: #2997ff;
  --highlight-color: #ffffff; /* Bright white for highlighting concepts */
  --border-color: #333;
  --border-light: rgba(255, 255, 255, 0.1);
  
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "Menlo", "Monaco", "Courier New", monospace;
  --max-width: 1200px;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-main);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-color);
}

/* Layout Utilities */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 120px 0;
  opacity: 0;
  transform: scale(0.98) translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.section.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* Progress Bar */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--accent-color);
  z-index: 1002; /* Above nav */
  transition: width 0.1s ease;
}

/* Navigation */
.sticky-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 20px 0;
  background: rgba(5, 5, 5, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  border-bottom: 1px solid var(--border-light);
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.nav-links a {
  margin-left: 24px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text-primary);
}

/* Active Indicator */
.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: var(--accent-color);
  box-shadow: 0 0 8px var(--accent-color);
}

/* Hero Section */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center; /* Centered */
  text-align: center; /* Centered */
  position: relative;
  padding-top: 60px;
}

.hero h1 {
  font-size: 4.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 1.5rem;
  color: #777;
}

.highlight-hero {
  background: linear-gradient(90deg, #fff, #ccc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-id {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.highlight-accent {
  color: var(--accent-color);
  font-weight: 700;
}

.hero-manifesto {
  font-size: 1.5rem;
  color: var(--text-secondary);
  max-width: 720px;
  font-weight: 400;
  line-height: 1.6;
  margin: 0 auto; /* Ensure centered block */
}

/* Editorial Sections */
.text-section {
  background-color: var(--bg-color);
}

/* The Grid Layout for Arc 2 */
.editorial-grid {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Default to 2 columns */
  gap: 60px;
  align-items: center;
  direction: rtl; /* Trick to put Image (HTML First) on Right visually */
}

.editorial-grid > * {
  direction: ltr; /* Reset direction for content */
}

.editorial-content {
  text-align: left;
  /* Ensure vertical balance */
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Portrait Styles */
.editorial-visual {
  width: 100%;
  display: flex;
  justify-content: center;
}

.portrait-container {
  width: 100%;
  max-width: 400px;
  /* aspect-ratio removed to allow full image */
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  border: 1px solid var(--border-color);
}

.portrait-img {
  width: 100%;
  height: auto; /* Let height adapt to image ratio */
  display: block; /* Remove bottom whitespace */
  transition: transform 0.5s ease;
}

.portrait-img:hover {
  transform: scale(1.02);
}

.img-caption {
  position: absolute;
  bottom: 16px;
  left: 0;
  width: 100%;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  pointer-events: none;
}

/* Text Styling */
.center-block {
  max-width: 800px;
  margin: 0 auto;
  text-align: left; /* Keep left align for readability even in center block */
}

.section-label {
  font-size: 0.85rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-color);
  margin-bottom: 24px;
  display: block;
}

/* New Subsection Header Style */
.subsection-header {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 40px;
  margin-bottom: 24px;
  padding-left: 16px;
  border-left: 4px solid var(--accent-color);
}

.editorial-title {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 2.5rem;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.editorial-text {
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* Highlighting */
.highlight {
  color: var(--highlight-color);
  font-weight: 600;
}

/* Feature Sections (Case Studies) */
.feature-section {
  background: #080808;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.feature-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
}

.feature-layout.reverse {
  direction: rtl;
}

.feature-layout.reverse > * {
  direction: ltr;
}

.feature-text {
  text-align: left;
}

.feature-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin: 1rem 0;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.feature-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.feature-actions {
  display: flex;
  gap: 16px;
  margin-top: 2rem;
}

/* Buttons */
.btn {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primary-btn {
  background: #fff;
  color: #000;
  border: 1px solid #fff;
}

.primary-btn:hover {
  background: #ddd;
  border-color: #ddd;
}

.secondary-btn {
  background: transparent;
  color: #fff;
  border: 1px solid var(--border-color);
}

.secondary-btn:hover {
  border-color: #fff;
}

.ghost-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px dashed var(--border-color);
}

.ghost-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

/* Reader (blog-viewer.html) */
.reader-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 40px;
}

.reader-topbar-back {
  margin-bottom: 0;
}

.reader-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.pill-action {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 8px 14px;
  text-transform: uppercase;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, transform 0.05s ease;
  user-select: none;
}

.pill-action[hidden] {
  display: none;
}

.pill-action:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

.pill-action:active {
  transform: translateY(1px);
}

.pill-action:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.pill-action[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.pill-action--accent {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.pill-action--accent:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #000;
}

/* Visuals & Diagrams */
.feature-visual { width: 100%; }

.tfn-diagram-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  background: #0f0f0f;
  padding: 30px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
}

.tfn-diagram-container svg {
  width: 100%;
  height: auto;
  max-height: 400px;
}

.architecture-diagram {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #0f0f0f;
  padding: 30px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
}

.layer {
  background: #1a1a1a;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
}

.layer-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 4px;
}

.layer-detail {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.time-layer { border-left: 3px solid #00ff88; }
.freq-layer { border-left: 3px solid #00ccff; }
.fusion-layer {
  border-left: 3px solid #aa00ff;
  background: linear-gradient(90deg, #1a1a1a 0%, #251525 100%);
}

.code-window {
  background: #151515;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.code-window.highlight {
  border-color: rgba(191, 90, 242, 0.5);
}

.window-header {
  background: #222;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #333;
}

.dot { width: 10px; height: 10px; border-radius: 50%; }
.red { background: #ff5f56; }
.yellow { background: #ffbd2e; }
.green { background: #27c93f; }

.window-title {
  margin-left: 10px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #888;
}

.code-window pre {
  padding: 24px;
  overflow-x: auto;
}

.code-window code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #d4d4d4;
  line-height: 1.6;
}

/* ROC Visualization */
.roc-visual-container {
  background: #151515;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

.roc-curve-svg {
  width: 100%;
  max-width: 300px;
  height: auto;
  overflow: visible;
}

.roc-curve-svg .axis {
  stroke: var(--text-secondary);
  stroke-width: 1;
}

.roc-curve-svg .diagonal {
  stroke: var(--border-color);
  stroke-width: 1;
  stroke-dasharray: 4;
}

.roc-curve-svg .confidence-band {
  fill: rgba(191, 90, 242, 0.2); /* Badge Purple with opacity */
  stroke: none;
}

.roc-curve-svg .mean-curve {
  fill: none;
  stroke: #bf5af2; /* Badge Purple */
  stroke-width: 1.2;
  stroke-linecap: round;
}

.roc-curve-svg .axis-label {
  fill: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 4px;
  text-anchor: middle;
}

.roc-curve-svg .axis-label.rotate {
  transform: rotate(-90deg);
  transform-origin: 0 0;
}

.roc-curve-svg .tick-label {
  fill: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 3px;
  text-anchor: middle;
}

.visual-caption {
  margin-top: 12px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* Resource List */
.resource-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.list-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.2s;
}

.list-card:hover {
  border-color: var(--text-secondary);
}

.list-card .meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.list-card h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.list-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.resource-links a {
  font-size: 0.9rem;
  color: var(--accent-color);
  margin-right: 16px;
}

/* Specs Grid */
.specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 40px;
}

.spec-item {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.spec-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}

.spec-value {
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.4;
}

/* Scroll Indicator */
.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-secondary);
  font-size: 0.85rem;
  opacity: 0.7;
  animation: bounce 2s infinite;
  font-family: var(--font-mono);
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
  40% { transform: translateX(-50%) translateY(-10px); }
  60% { transform: translateX(-50%) translateY(-5px); }
}

/* Nav Branding & Email */
.nav-branding {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-email,
.nav-github,
.nav-resume {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: color 0.2s ease;
  font-weight: 500;
}

.nav-resume-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.resume-preview {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  width: 300px;
  height: 390px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: #111;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 30;
}

.resume-preview iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.nav-resume:hover + .resume-preview,
.nav-resume:focus-visible + .resume-preview {
  display: block;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.nav-email:hover,
.nav-github:hover,
.nav-resume:hover {
  color: var(--accent-color);
}

.nav-email svg,
.nav-github svg,
.nav-resume svg {
  opacity: 0.8;
}

/* Footer */
.site-footer {
  padding: 60px 0;
  text-align: center;
  border-top: 1px solid var(--border-color);
  margin-top: 80px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Mobile & Tablet */
@media (max-width: 768px) {
  .hero h1 { font-size: 2.8rem; }
  .hero-manifesto { font-size: 1.2rem; }
  
  /* Arc 2: Stack Image ON TOP */
  .editorial-grid {
    grid-template-columns: 1fr;
    gap: 40px;
    direction: ltr; /* Reset direction for vertical stacking */
  }
  
  /* Since Image is first in HTML, it will be top. Perfect. */
  
  .editorial-title { font-size: 2rem; }
  .editorial-text { font-size: 1.15rem; }
  
  /* Feature Sections */
  .feature-layout {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  
  .feature-layout.reverse { direction: ltr; }
  .feature-visual { order: -1; }
  
  .nav-links, .nav-email, .nav-github, .nav-resume-wrap { display: none; }
}
