/* ============================================
   CSS Variables & Theme System
   ============================================ */

:root {
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* Layout */
  --container-max: 1120px;
  --nav-height: 64px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-theme: 400ms ease;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

/* Dark theme (default) */
[data-theme="dark"] {
  --bg-primary: #09090b;
  --bg-surface: #111113;
  --bg-surface-2: #18181b;
  --bg-surface-3: #27272a;

  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;

  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-gradient: linear-gradient(135deg, #38bdf8, #818cf8);
  --accent-dim: rgba(56, 189, 248, 0.1);
  --accent-border: rgba(56, 189, 248, 0.2);

  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.1);

  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);

  --nav-bg: rgba(9, 9, 11, 0.6);
  --nav-bg-scroll: rgba(9, 9, 11, 0.85);

  --terminal-bg: #0c0c0e;
  --terminal-header: #1a1a1e;

  --card-glow: rgba(56, 189, 248, 0.06);
  --cursor-glow-color: rgba(56, 189, 248, 0.04);

  --canvas-particle: rgba(56, 189, 248, 0.6);
  --canvas-line: rgba(56, 189, 248, 0.1);
}

/* Light theme */
[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-surface: #f9fafb;
  --bg-surface-2: #f3f4f6;
  --bg-surface-3: #e5e7eb;

  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #9ca3af;

  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-gradient: linear-gradient(135deg, #0284c7, #6366f1);
  --accent-dim: rgba(2, 132, 199, 0.08);
  --accent-border: rgba(2, 132, 199, 0.2);

  --amber: #d97706;
  --amber-dim: rgba(217, 119, 6, 0.08);

  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);

  --nav-bg: rgba(255, 255, 255, 0.6);
  --nav-bg-scroll: rgba(255, 255, 255, 0.85);

  --terminal-bg: #f9fafb;
  --terminal-header: #e5e7eb;

  --card-glow: rgba(2, 132, 199, 0.04);
  --cursor-glow-color: rgba(2, 132, 199, 0.03);

  --canvas-particle: rgba(2, 132, 199, 0.5);
  --canvas-line: rgba(2, 132, 199, 0.08);
}

/* ============================================
   Reset & Base
   ============================================ */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-theme), color var(--transition-theme);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

::selection {
  background: var(--accent);
  color: var(--bg-primary);
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================
   Skip Link
   ============================================ */

.skip-link {
  position: fixed;
  top: -100%;
  left: 16px;
  z-index: 10000;
  padding: 8px 16px;
  background: var(--accent);
  color: var(--bg-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: top 200ms ease;
}

.skip-link:focus {
  top: 16px;
}

/* ============================================
   Scroll Progress Bar
   ============================================ */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--accent-gradient);
  z-index: 10001;
  transition: none;
}

/* ============================================
   Cursor Glow
   ============================================ */

.cursor-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(circle, var(--cursor-glow-color) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.6s ease;
}

.cursor-glow.visible {
  opacity: 1;
}

/* ============================================
   Navigation
   ============================================ */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 1000;
  background: var(--nav-bg);
  transition: background-color var(--transition-base), backdrop-filter var(--transition-base);
}

.navbar.scrolled {
  background: var(--nav-bg-scroll);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.logo-text {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.logo-cursor {
  color: var(--accent);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  padding: 4px 0;
  position: relative;
  transition: color var(--transition-fast);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
}

.nav-link.active::after {
  opacity: 1;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Theme toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.theme-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-surface-2);
}

[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 1px;
  transition: transform var(--transition-base), opacity var(--transition-base);
}

.nav-hamburger.open .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-hamburger.open .hamburger-line:nth-child(2) {
  opacity: 0;
}

.nav-hamburger.open .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile menu */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.mobile-menu.open {
  opacity: 1;
  visibility: visible;
}

.mobile-menu-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl);
}

.mobile-link {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 500;
  color: var(--text-primary);
  transition: color var(--transition-fast);
}

.mobile-link:hover {
  color: var(--accent);
}

.mobile-theme-toggle {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-tertiary);
  margin-top: var(--space-lg);
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.mobile-theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent-border);
}

/* ============================================
   Container & Section
   ============================================ */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.section {
  padding: var(--space-4xl) 0;
}

.section-label {
  display: block;
  margin-bottom: var(--space-md);
}

.section-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: var(--space-lg);
}

.section-intro {
  color: var(--text-secondary);
  max-width: 680px;
  margin-bottom: var(--space-3xl);
  font-size: 17px;
  line-height: 1.8;
}

.mono-label {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-tertiary);
  letter-spacing: 0.5px;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #09090b;
}

.btn-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.btn-outline {
  border: 1px solid var(--border);
  color: var(--text-primary);
  background: transparent;
}

.btn-outline:hover {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ============================================
   Hero
   ============================================ */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: var(--nav-height) var(--space-lg) var(--space-3xl);
  overflow: hidden;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: var(--container-max);
  margin: 0 auto;
  width: 100%;
}

.hero-name {
  font-size: clamp(2.75rem, 5vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: var(--space-md);
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dali-quip-text {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}

.pronounce-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  margin: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
  color: inherit;
  font: inherit;
}

.pronounce-btn:hover {
  background: var(--accent-dim);
}

.pronounce-btn svg {
  color: var(--accent);
  opacity: 0.6;
  transition: opacity 0.2s;
}

.pronounce-btn:hover svg {
  opacity: 1;
}

.hero-role {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.hero-affiliation {
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.hero-tagline {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.7;
  margin-bottom: var(--space-xl);
}

.hero-buttons {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.hero-social {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.social-icon:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-tertiary);
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* ============================================
   About
   ============================================ */

.about-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-3xl);
  align-items: start;
  margin-bottom: var(--space-3xl);
}

.about-photo img {
  width: 240px;
  height: 240px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  transition: border-color var(--transition-base);
}

.about-photo:hover img {
  border-color: var(--accent-border);
}

.about-text p {
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.8;
}

.about-text p:last-child {
  margin-bottom: 0;
}

/* CV Grid */
.cv-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-3xl);
}

@media (min-width: 768px) {
  .cv-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
    align-items: start; /* Allows asymmetrical heights */
  }
}

/* Shared Card Style for CV */
.timeline, .experience {
  padding: var(--space-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
}

/* Timeline */
.timeline-heading {
  margin-bottom: var(--space-xl);
}

.timeline-items {
  position: relative;
  padding-left: var(--space-xl);
}

.timeline-items::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--space-xl);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: calc(-1 * var(--space-xl) + 1px);
  top: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-primary);
}

.timeline-content h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.timeline-content p {
  color: var(--text-secondary);
  font-size: 15px;
}

.timeline-date {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 0.5px;
  margin-bottom: var(--space-xs);
}

/* Experience Overrides */
.experience .mono-label {
  display: block;
  margin-bottom: 0; /* Heading handled by timeline-heading */
}

/* ============================================
   Research Bento Grid
   ============================================ */

.bento-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.bento-card {
  position: relative;
  padding: var(--space-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}

.bento-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.bento-card[data-accent="cyan"]::before { background: #38bdf8; }
.bento-card[data-accent="indigo"]::before { background: #818cf8; }
.bento-card[data-accent="amber"]::before { background: #f59e0b; }
.bento-card[data-accent="emerald"]::before { background: #34d399; }
.bento-card[data-accent="rose"]::before { background: #fb7185; }

.bento-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: 0 8px 32px var(--card-glow);
}

.bento-wide {
  grid-column: span 2;
}

.bento-label {
  display: block;
  margin-bottom: var(--space-sm);
  color: var(--text-tertiary);
}

.bento-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.bento-desc {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: var(--space-md);
}

.bento-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 100px;
  letter-spacing: 0.3px;
}

/* ============================================
   Dalí Easter Egg
   ============================================ */

.dali-quip {
  margin-bottom: var(--space-md);
}

.dali-quip-text {
  font-family: var(--font-mono);
  font-size: 13px;
  font-style: italic;
  color: var(--text-tertiary);
  letter-spacing: 0.3px;
}

.dali-quip-text em {
  font-style: normal;
  font-weight: 600;
  color: var(--accent);
}

/* ============================================
   Earth Observation Showcase
   ============================================ */

.eo-section {
  overflow: hidden;
}

.eo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: var(--space-md);
}

.eo-tile {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.eo-tile:hover {
  border-color: var(--accent-border);
  box-shadow: 0 8px 32px var(--card-glow);
}

.eo-tile-tall {
  grid-row: span 2;
}

.eo-tile-wide {
  grid-column: span 2;
}

.eo-canvas {
  position: relative;
  width: 100%;
  min-height: 200px;
  overflow: hidden;
}

.eo-tile-tall .eo-canvas {
  min-height: 100%;
  position: absolute;
  inset: 0;
}

.eo-tile-tall {
  min-height: 420px;
}

.eo-tile-info {
  position: relative;
  z-index: 2;
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(to top, var(--bg-surface) 60%, transparent);
}

.eo-tile-tall .eo-tile-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.eo-tile-info .mono-label {
  display: block;
  margin-bottom: var(--space-xs);
  color: var(--accent);
}

.eo-tile-info p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

/* --- NDVI Vegetation Tile --- */
.eo-ndvi {
  background: url('../img/eo-ndvi.jpg') 52% 58% / 350% auto no-repeat;
}

[data-theme="light"] .eo-ndvi {
  background: url('../img/eo-ndvi.jpg') 52% 58% / 350% auto no-repeat;
}

/* --- Auto-scan Before/After Tiles --- */
.eo-autoscan {
  user-select: none;
  -webkit-user-select: none;
}

.eo-auto-after,
.eo-auto-before {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.eo-auto-after {
  z-index: 1;
}

.eo-auto-before {
  z-index: 2;
}

.eo-scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(56, 189, 248, 0.8);
  box-shadow: 0 0 18px 4px rgba(56, 189, 248, 0.28);
  z-index: 3;
  pointer-events: none;
}

.eo-sweep-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(56, 189, 248, 0.8);
  box-shadow: 0 0 18px 4px rgba(56, 189, 248, 0.28);
  z-index: 3;
  pointer-events: none;
}

.eo-autoscan-vertical .eo-auto-before {
  clip-path: inset(0 0 50% 0);
  animation: eo-sweep-v 3s ease-in-out infinite alternate;
}

.eo-autoscan-vertical .eo-scan-line {
  top: 50%;
  animation: eo-line-v 3s ease-in-out infinite alternate;
}

.eo-autoscan-horizontal .eo-auto-before {
  clip-path: inset(0 50% 0 0);
  animation: eo-sweep-h 4.5s ease-in-out infinite alternate;
}

.eo-autoscan-horizontal .eo-sweep-line {
  left: 50%;
  animation: eo-line-h 4.5s ease-in-out infinite alternate;
}

@keyframes eo-sweep-v {
  0% { clip-path: inset(0 0 100% 0); }
  100% { clip-path: inset(0 0 0% 0); }
}

@keyframes eo-line-v {
  0% { top: 0%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

@keyframes eo-sweep-h {
  0% { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0% 0 0); }
}

@keyframes eo-line-h {
  0% { left: 0%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}

.eo-autoscan:hover .eo-auto-before,
.eo-autoscan:hover .eo-scan-line,
.eo-autoscan:hover .eo-sweep-line {
  animation-play-state: paused;
}

.eo-attribution {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 10;
  font-size: 9px;
  letter-spacing: 0.5px;
  color: #fafafa;
  opacity: 0.6;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: auto;
  text-transform: uppercase;
  text-decoration: none;
  transition: opacity 0.2s, background 0.2s;
  backdrop-filter: blur(2px);
}

.eo-attribution:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.7);
  text-decoration: underline;
}

[data-theme="light"] .eo-attribution {
  color: #111827;
  background: rgba(255, 255, 255, 0.5);
}

[data-theme="light"] .eo-attribution:hover {
  background: rgba(255, 255, 255, 0.8);
}

.eo-label-left {
  left: var(--space-md);
}

.eo-label-right {
  right: var(--space-md);
}

.eo-label-bottom {
  top: auto;
  bottom: var(--space-md);
}

/* Gaza: Sentinel-2 (local exports) */
.eo-autoscan-gaza .eo-auto-before {
  background-image: url('../img/eo-gaza-before.jpg');
  background-position: 55% 45%;
}

.eo-autoscan-gaza .eo-auto-after {
  background-image: url('../img/eo-gaza-after.jpg');
  background-position: 55% 45%;
}

/* Syria: VIIRS night lights */
.eo-autoscan-syria .eo-auto-before {
  background-image: url('../img/eo-mideast-2012.jpg');
  background-position: 56% 42%;
}

.eo-autoscan-syria .eo-auto-after {
  background-image: url('../img/eo-mideast-2016.jpg');
  background-position: 56% 42%;
}

/* --- Nightlights Tile --- */
.eo-nightlights {
  background: url('../img/eo-nightlights.jpg') center/cover no-repeat;
  min-height: 200px;
}

[data-theme="light"] .eo-nightlights {
  background: url('../img/eo-nightlights.jpg') center/cover no-repeat;
}

.eo-light-cluster {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(250, 204, 21, 0.8) 0%, rgba(250, 204, 21, 0.3) 30%, rgba(250, 204, 21, 0) 70%);
  animation: eo-flicker 3s ease-in-out infinite alternate;
}

.eo-light-sm {
  width: 24px;
  height: 24px;
  animation-delay: -1s;
}

.eo-light-xs {
  width: 12px;
  height: 12px;
  background: radial-gradient(circle, rgba(250, 204, 21, 0.6) 0%, rgba(250, 204, 21, 0) 70%);
  animation-delay: -2s;
}

@keyframes eo-flicker {
  0% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0.7; transform: scale(1); }
}

/* --- Conflict Heatmap Tile --- */
.eo-conflict {
  background: url('../img/eo-conflict.jpg') center/cover no-repeat;
  min-height: 200px;
}

[data-theme="light"] .eo-conflict {
  background: url('../img/eo-conflict.jpg') center/cover no-repeat;
}

.eo-heat-pulse {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.7) 0%, rgba(239, 68, 68, 0.2) 40%, transparent 70%);
  animation: eo-pulse 2.5s ease-out infinite;
}

.eo-heat-sm {
  width: 36px;
  height: 36px;
}

.eo-heat-delay-1 { animation-delay: -0.8s; }
.eo-heat-delay-2 { animation-delay: -1.6s; }

@keyframes eo-pulse {
  0% { transform: scale(0.5); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 0.4; }
  100% { transform: scale(0.5); opacity: 0.8; }
}

/* --- Timelapse / Before-After Tile --- */
.eo-timelapse {
  position: relative;
  min-height: 280px;
  user-select: none;
  -webkit-user-select: none;
  cursor: ew-resize;
  overflow: hidden;
}

.eo-time-after,
.eo-time-before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.eo-time-after {
  z-index: 1;
}

.eo-time-before {
  z-index: 2;
  clip-path: inset(0 50% 0 0);
}

/* Brazil: Cerrado land use change */
.eo-timelapse-brazil .eo-time-before {
  background-image: url('../img/eo-brazil-2000.jpg');
}

.eo-timelapse-brazil .eo-time-after {
  background-image: url('../img/eo-brazil-2024.jpg');
}

.eo-stage {
  min-height: 280px;
}

.eo-stage .eo-timelapse,
.eo-stage .eo-globe {
  position: absolute;
  inset: 0;
  transition: opacity 250ms ease, transform 250ms ease;
}

.eo-stage[data-eo-view="swipe"] .eo-globe {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
}

.eo-stage[data-eo-view="globe"] .eo-timelapse {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
}

.eo-globe {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(900px 400px at 50% 90%, rgba(56, 189, 248, 0.08), transparent 55%),
    radial-gradient(900px 420px at 20% 10%, rgba(244, 63, 94, 0.05), transparent 60%),
    radial-gradient(800px 420px at 80% 20%, rgba(16, 185, 129, 0.04), transparent 60%),
    linear-gradient(180deg, rgba(2, 6, 23, 0.85), rgba(2, 6, 23, 0.55));
}

.eo-globe-sphere {
  width: min(360px, 72vw);
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  background-image: url('../img/eo-nightlights.jpg');
  background-repeat: repeat-x;
  background-size: auto 100%;
  background-position: 0% 50%;
  animation: eo-globe-spin 18s linear infinite;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.45),
    inset -32px 0 44px rgba(0, 0, 0, 0.75);
}

.eo-globe-sphere::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 28% 32%, rgba(255, 255, 255, 0.10), rgba(0, 0, 0, 0.78) 68%),
    radial-gradient(circle at 70% 70%, rgba(56, 189, 248, 0.10), transparent 55%);
  pointer-events: none;
}

.eo-globe-sphere::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  box-shadow:
    0 0 0 1px rgba(148, 163, 184, 0.22),
    0 0 40px rgba(56, 189, 248, 0.22);
  pointer-events: none;
}

@keyframes eo-globe-spin {
  from { background-position: 0% 50%; }
  to { background-position: -200% 50%; }
}

.eo-tile-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-xs);
}

.eo-view-toggle {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-base), border-color var(--transition-base), color var(--transition-base);
}

[data-theme="light"] .eo-view-toggle {
  background: rgba(255, 255, 255, 0.7);
  color: #111827;
}

.eo-view-toggle:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent-border);
  color: var(--text);
}

.eo-view-toggle[aria-pressed="true"] {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--accent-border);
  color: var(--text);
}

.eo-time-before .eo-time-label {
  left: var(--space-md);
}

.eo-time-after .eo-time-label {
  right: var(--space-md);
}

.eo-time-label {
  position: absolute;
  top: var(--space-md);
  z-index: 4;
  background: rgba(0, 0, 0, 0.6);
  color: #fafafa;
  padding: 3px 12px;
  border-radius: 100px;
  font-size: 11px;
  pointer-events: none;
}

[data-theme="light"] .eo-time-label {
  background: rgba(255, 255, 255, 0.8);
  color: #111827;
}

.eo-time-slider {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  margin-left: -1px;
  background: var(--accent);
  z-index: 3;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
  pointer-events: none;
}

.eo-time-slider::after {
  content: '⟨  ⟩';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--accent);
  color: #09090b;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0px;
  padding: 8px 6px;
  border-radius: 100px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.eo-approach {
  margin-top: var(--space-2xl);
  max-width: 760px;
}

.eo-approach p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.75;
  border-left: 3px solid var(--accent);
  padding-left: var(--space-lg);
}

/* EO responsive */
@media (max-width: 768px) {
  .eo-grid {
    grid-template-columns: 1fr;
  }

  .eo-tile-tall {
    grid-row: span 1;
    min-height: 380px; /* Even more height for tall images on mobile */
  }

  .eo-tile-tall .eo-canvas {
    position: relative;
    height: 300px; /* Fixed height for the image area on mobile */
    min-height: auto;
  }

  .eo-tile-tall .eo-tile-info {
    position: relative;
    background: var(--bg-surface);
    padding: var(--space-md) var(--space-lg);
  }

  .eo-tile-wide {
    grid-column: span 1;
  }
  
  .eo-timelapse {
    touch-action: pan-y; /* Prevent vertical scroll blocking horizontal swipe */
  }
  
  .eo-attribution {
    font-size: 8px;
    padding: 2px 4px;
    bottom: 6px;
    right: 6px;
  }
  
  .eo-time-label {
    font-size: 10px;
    padding: 2px 8px;
  }
}

/* ============================================
   Papers / Selected Works
   ============================================ */

.papers-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

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

.paper-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  height: 100%;
}

.paper-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--card-glow);
}

.paper-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.paper-type {
  color: var(--accent);
}

.paper-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.paper-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.paper-authors {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
  display: block;
}

.paper-authors em {
  font-style: normal;
  color: var(--text-secondary);
  font-weight: 500;
}

.papers-footer {
  text-align: center;
}

/* Old WIP styles (can be removed or kept for legacy) */
.papers-wip {
  max-width: 680px;
}

.papers-wip-inner {
  padding: var(--space-xl);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
}

.papers-comment {
  display: block;
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
}

.papers-wip-inner p {
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  font-size: 15px;
  line-height: 1.7;
}

.papers-wip-inner .btn {
  margin-top: var(--space-sm);
}

/* ============================================
   Terminal / CV
   ============================================ */

.terminal {
  max-width: 720px;
  background: var(--terminal-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-xl);
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 12px var(--space-md);
  background: var(--terminal-header);
  border-bottom: 1px solid var(--border);
}

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

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

.dot-red { background: #ef4444; }
.dot-yellow { background: #eab308; }
.dot-green { background: #22c55e; }

.terminal-title {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
}

.terminal-body {
  padding: var(--space-lg);
  overflow-x: auto;
}

.terminal-body pre {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-secondary);
  white-space: pre;
}

.terminal-body code {
  font-family: inherit;
}

.t-prompt { color: var(--accent); font-weight: 500; }
.t-cmd { color: var(--text-primary); font-weight: 500; }
.t-date { color: var(--amber); }
.t-org { color: var(--text-tertiary); }
.t-degree { color: var(--accent); font-weight: 500; }
.t-tool { color: var(--text-primary); }

.t-cursor {
  color: var(--accent);
  animation: blink 1s step-end infinite;
}

.cv-download {
  text-align: center;
}

/* ============================================
   Contact
   ============================================ */

.contact-content {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.contact-intro {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto var(--space-xl);
}

.contact-email {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: clamp(1.2rem, 3vw, 1.75rem);
  font-weight: 500;
  color: var(--accent);
  margin-bottom: var(--space-xl);
  transition: opacity var(--transition-fast);
}

.contact-email:hover {
  opacity: 0.8;
}

.contact-address {
  margin-bottom: var(--space-xl);
}

.contact-address p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-secondary);
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.contact-link:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

.contact-social {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.contact-social-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-tertiary);
  border-radius: var(--radius-md);
  transition: color var(--transition-fast), background-color var(--transition-fast);
  min-width: 72px;
}

.contact-social-link span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3px;
}

.contact-social-link:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

/* ============================================
   Footer
   ============================================ */

.footer {
  padding: var(--space-3xl) 0 var(--space-xl);
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  text-align: center;
}

.footer-logo .logo-text {
  font-size: 16px;
}

.footer-tagline {
  color: var(--text-tertiary);
  font-size: 14px;
}

.footer-copy {
  color: var(--text-tertiary);
  font-size: 13px;
  font-family: var(--font-mono);
}

/* ============================================
   Teaching Page
   ============================================ */

.teaching-content {
  max-width: 720px;
}

.teaching-block {
  margin-bottom: var(--space-3xl);
}

.teaching-heading {
  margin-bottom: var(--space-lg);
}

.teaching-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: border-color var(--transition-base);
}

.teaching-card:hover {
  border-color: var(--accent);
}

.teaching-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.teaching-role {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
}

.teaching-course {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.teaching-institution {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: var(--space-md);
}

.teaching-desc {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

.teaching-card-upcoming {
  border-style: dashed;
}

/* ============================================
   Scroll Reveal
   ============================================ */

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Stagger delays for grid items */
.bento-card.reveal:nth-child(1) { transition-delay: 0ms; }
.bento-card.reveal:nth-child(2) { transition-delay: 80ms; }
.bento-card.reveal:nth-child(3) { transition-delay: 160ms; }
.bento-card.reveal:nth-child(4) { transition-delay: 240ms; }
.bento-card.reveal:nth-child(5) { transition-delay: 320ms; }

.timeline-item.reveal:nth-child(1) { transition-delay: 0ms; }
.timeline-item.reveal:nth-child(2) { transition-delay: 100ms; }
.timeline-item.reveal:nth-child(3) { transition-delay: 200ms; }
.timeline-item.reveal:nth-child(4) { transition-delay: 300ms; }

.contact-social-link { transition-delay: calc(var(--i, 0) * 60ms); }

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

@media (max-width: 768px) {
  :root {
    --nav-height: 56px;
  }

  .nav-links {
    display: none;
  }

  .nav-hamburger {
    display: flex;
  }

  .hero {
    padding-top: calc(var(--nav-height) + var(--space-3xl));
  }

  .hero-content {
    text-align: left;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .about-photo {
    display: flex;
    justify-content: center;
  }

  .about-photo img {
    width: 180px;
    height: 180px;
  }

  .bento-grid {
    grid-template-columns: 1fr;
  }

  .bento-wide {
    grid-column: span 1;
  }

  .section {
    padding: var(--space-3xl) 0;
  }

  .terminal-body pre {
    font-size: 11px;
  }


  .hero-buttons {
    flex-direction: column;
    align-items: flex-start;
  }

  .contact-links {
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 16px;
  }

  .container {
    padding: 0 var(--space-md);
  }

  .about-photo img {
    width: 140px;
    height: 140px;
  }

  .hero-social {
    gap: var(--space-sm);
  }

  .social-icon {
    width: 36px;
    height: 36px;
  }

  .terminal-body {
    padding: var(--space-md);
  }

  .terminal-body pre {
    font-size: 10px;
  }
}

/* ============================================
   Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .logo-cursor,
  .t-cursor {
    animation: none;
    opacity: 1;
  }

  .scroll-indicator {
    animation: none;
  }

  .cursor-glow {
    display: none;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ============================================
   Print
   ============================================ */

@media print {
  .navbar,
  .scroll-progress,
  .cursor-glow,
  .hero-canvas,
  .scroll-indicator,
  .mobile-menu {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .hero {
    min-height: auto;
    padding: 2rem 0;
  }

  .section {
    padding: 2rem 0;
    break-inside: avoid;
  }
}
