/* 1. Register the CSS variables as animate-able colors */
@property --accent {
  syntax: '<color>';
  inherits: true;
  initial-value: #a8ff78;
}

@property --accent2 {
  syntax: '<color>';
  inherits: true;
  initial-value: #78ffd6;
}

/* 2. Apply a global transition to those variables */
html {
  transition: --accent 1s ease, --accent2 1s ease;
}

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

:root, [data-theme="dark"] {
  --bg: #080808; --bg2: #0f0f0f; --bg3: #161616;
  --border: #1f1f1f; --accent: #a8ff78; --accent2: #78ffd6;
  --accent-dark: #080808; --text: #e8e8e8;
  --muted: #555; --muted2: #888;
  --nav-bg: rgba(8,8,8,0.92); --photo-bg: #111;
  --mono: 'JetBrains Mono', monospace; --sans: 'Cabinet Grotesk', sans-serif;
}
[data-theme="light"] {
  --bg: #f7f7f5; --bg2: #eeeeed; --bg3: #e5e5e3;
  --border: #d0d0cc; --accent: #2a7d00; --accent2: #007a5e;
  --accent-dark: #ffffff; --text: #111111;
  --muted: #aaaaaa; --muted2: #666666;
  --nav-bg: rgba(247,247,245,0.92); --photo-bg: #e0e0de;
}

html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); overflow-x: hidden; transition: background 0.4s, color 0.4s; }

/* CUSTOM CURSOR (desktop only via JS) */
.cursor {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 10002;
  transition: opacity 0.2s;
}

.cursor-ring {
  width: 32px;
  height: 32px;
  border: 1px solid var(--accent);
  opacity: 0.4;
  border-radius: 50%;
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 10001;
  transition: opacity 0.2s;
}

/* Hide on touch by default (JS removes them, this is fallback) */
@media (pointer: coarse) {
  .cursor, .cursor-ring { display: none !important; }
  body { cursor: auto !important; }
}

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 2px; }

/* NAV */
nav { position: fixed; top: 0; left: 0; right: 0; z-index: 100; padding: 18px 48px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid transparent; transition: border-color 0.3s, background 0.3s; }
nav.scrolled { background: var(--nav-bg); backdrop-filter: blur(14px); border-color: var(--border); }
.nav-logo { font-family: var(--mono); font-size: 13px; color: var(--accent); letter-spacing: 0.05em; }
.nav-right { display: flex; align-items: center; gap: 28px; }
.nav-links { display: flex; gap: 24px; list-style: none; }
.nav-links a { font-family: var(--mono); font-size: 11px; color: var(--muted2); text-decoration: none; letter-spacing: 0.1em; text-transform: uppercase; transition: color 0.2s; }
.nav-links a:hover { color: var(--accent); }

.theme-toggle { width: 48px; height: 26px; background: var(--bg3); border: 1px solid var(--border); border-radius: 13px; cursor: none; position: relative; transition: background 0.3s, border-color 0.3s; flex-shrink: 0; }
.theme-toggle:hover { border-color: var(--accent); }
.toggle-knob { width: 18px; height: 18px; background: var(--accent); border-radius: 50%; position: absolute; top: 3px; left: 4px; transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1); }
[data-theme="light"] .toggle-knob { transform: translateX(22px); }
.toggle-icon-dark, .toggle-icon-light { position: absolute; font-size: 9px; top: 50%; }
.toggle-icon-dark { left: 6px; transform: translateY(-50%); }
.toggle-icon-light { right: 6px; transform: translateY(-50%); }

/* HERO */
#hero { 
  min-height: 100vh; 
  display: grid; 
  grid-template-columns: 1fr auto; 
  align-items: center; 
  gap: 60px; 
  padding: 120px 48px 80px; 
  position: relative; 
  overflow: hidden; 
}
/* 1. Force the grid background to sit firmly at the bottom-most layer */
.hero-grid-bg { 
  position: absolute; 
  inset: 0; 
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); 
  background-size: 60px 60px; 
  opacity: 0.5; 
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 20%, transparent 100%); 
  z-index: 1; /* Lowest structural layer */
}

/* 2. Elevate the content layout to sit safely on top of the background grid layer */
.hero-content { 
  position: relative; 
  z-index: 5; 
}
.hero-tag { font-family: var(--mono); font-size: 12px; color: var(--accent); letter-spacing: 0.15em; margin-bottom: 28px; opacity: 0; animation: fadeUp 0.6s ease 0.2s forwards; }
.hero-name { font-size: clamp(44px, 6.5vw, 84px); font-weight: 800; line-height: 1; letter-spacing: -0.03em; margin-bottom: 16px; opacity: 0; animation: fadeUp 0.6s ease 0.4s forwards; }
.hero-name span { color: var(--accent); }
.hero-title { font-family: var(--mono); font-size: clamp(12px, 1.5vw, 16px); color: var(--muted2); margin-bottom: 36px; opacity: 0; animation: fadeUp 0.6s ease 0.6s forwards; }
.typed-cursor { color: var(--accent); animation: blink 1s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }
.hero-desc { max-width: 500px; font-size: 15px; color: var(--muted2); line-height: 1.8; margin-bottom: 44px; opacity: 0; animation: fadeUp 0.6s ease 0.8s forwards; }
.hero-ctas { display: flex; gap: 14px; flex-wrap: wrap; opacity: 0; animation: fadeUp 0.6s ease 1s forwards; }
.btn-primary { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; padding: 13px 26px; background: var(--accent); color: var(--accent-dark); border: none; text-decoration: none; font-weight: 700; transition: transform 0.2s, box-shadow 0.2s; cursor: none; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn-outline { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; padding: 13px 26px; background: transparent; color: var(--text); border: 1px solid var(--border); text-decoration: none; transition: border-color 0.2s, color 0.2s; cursor: none; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* PHOTO */
.hero-photo-wrap { 
  position: relative; 
  flex-shrink: 0; 
  opacity: 0; 
  animation: fadeUp 0.7s ease 0.5s forwards; 
  z-index: 5; /* Pushes the image frame wrapper completely above the grid line layer */
}
.hero-photo-frame { width: 270px; height: 330px; position: relative; }
.hero-photo-frame::before { content: ''; position: absolute; inset: -2px; background: linear-gradient(135deg, var(--accent), transparent 60%, var(--accent2)); z-index: 0; border-radius: 2px; }
.hero-photo-inner { position: absolute; inset: 2px; background: var(--photo-bg); overflow: hidden; z-index: 1; border-radius: 1px; }
.hero-photo-inner img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; filter: grayscale(15%); transition: filter 0.3s; }
.hero-photo-frame:hover img { filter: grayscale(0%); }
.photo-placeholder { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: var(--bg3); }
.photo-placeholder svg { width: 80px; height: 80px; opacity: 0.3; }
.photo-placeholder span { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: 0.1em; text-align: center; padding: 0 16px; }
.photo-badge { position: absolute; bottom: -14px; right: -14px; background: var(--accent); color: var(--accent-dark); font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; padding: 8px 14px; font-weight: 700; z-index: 2; }

.hero-scroll-hint { position: absolute; bottom: 40px; left: 48px; font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.1em; display: flex; align-items: center; gap: 12px; opacity: 0; animation: fadeUp 0.6s ease 1.4s forwards; }
.scroll-line { width: 40px; height: 1px; background: var(--muted); position: relative; overflow: hidden; }
.scroll-line::after { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: var(--accent); animation: scanline 2s ease 1.6s infinite; }
@keyframes scanline { to { left: 100%; } }

/* SECTIONS */
section { padding: 110px 48px; position: relative; }
.section-label { font-family: var(--mono); font-size: 11px; color: var(--accent); letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.section-label::before { content: attr(data-num); color: var(--muted); }
.section-title { font-size: clamp(30px, 4.5vw, 50px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 60px; }
.section-title span { color: var(--accent); }

.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ABOUT */
#about { background: var(--bg); }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 72px; align-items: start; }
.about-text p { font-size: 16px; color: var(--muted2); line-height: 1.85; margin-bottom: 18px; }
.about-text p strong { color: var(--text); font-weight: 600; }
.about-text .highlight { color: var(--accent); font-family: var(--mono); font-size: 14px; }
.about-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.stat-box { background: var(--bg3); border: 1px solid var(--border); padding: 26px 22px; transition: border-color 0.2s; }
.stat-box:hover { border-color: var(--accent); }
.stat-num { font-size: 32px; font-weight: 800; color: var(--accent); line-height: 1; margin-bottom: 6px; }
.stat-label { font-family: var(--mono); font-size: 10px; color: var(--muted2); letter-spacing: 0.1em; text-transform: uppercase; }

/* EDUCATION */
#education { background: var(--bg2); }
.edu-grid { display: flex; flex-direction: column; gap: 2px; }
.edu-card { background: var(--bg3); border: 1px solid var(--border); padding: 32px 36px; display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: start; transition: border-color 0.2s; }
.edu-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.edu-degree { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 6px; }
.edu-school { font-family: var(--mono); font-size: 12px; color: var(--accent); margin-bottom: 14px; letter-spacing: 0.05em; }
.edu-courses { font-size: 14px; color: var(--muted2); line-height: 1.7; }
.edu-courses strong { color: var(--muted2); font-weight: 500; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; display: block; margin-bottom: 6px; }
.edu-meta { text-align: right; }
.edu-year { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: 0.05em; white-space: nowrap; }
.edu-badge { display: inline-block; margin-top: 10px; font-family: var(--mono); font-size: 10px; padding: 5px 10px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); letter-spacing: 0.08em; }

/* SKILLS */
#skills { background: var(--bg); }
.skills-outer { display: flex; flex-direction: column; gap: 40px; }
.skill-group-title { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.skills-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-tag { font-family: var(--mono); font-size: 12px; padding: 7px 15px; border: 1px solid var(--border); color: var(--muted2); letter-spacing: 0.05em; transition: all 0.2s; cursor: default; }
.skill-tag:hover { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.skill-tag.accent { border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent); }

/* EXPERIENCE */
#experience { background: var(--bg2); }
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: grid; grid-template-columns: 200px 1fr; gap: 40px; padding: 32px 0; border-bottom: 1px solid var(--border); transition: border-color 0.2s; }
.timeline-item:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.timeline-left { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.05em; padding-top: 4px; }
.timeline-left .tl-year { color: var(--accent); font-size: 12px; margin-bottom: 4px; }
.timeline-right h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.01em; }
.timeline-right .company { font-family: var(--mono); font-size: 12px; color: var(--accent); margin-bottom: 16px; letter-spacing: 0.05em; }
.timeline-right ul { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.timeline-right ul li { font-size: 15px; color: var(--muted2); line-height: 1.7; padding-left: 18px; position: relative; }
.timeline-right ul li::before { content: '→'; position: absolute; left: 0; color: var(--accent); font-family: var(--mono); }
.tl-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tl-tag { font-family: var(--mono); font-size: 10px; padding: 4px 10px; border: 1px solid var(--border); color: var(--muted2); letter-spacing: 0.05em; }

/* PROJECTS */
#projects { background: var(--bg); }
.projects-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 2px; }
.project-card { background: var(--bg3); border: 1px solid var(--border); padding: 32px; transition: border-color 0.25s, transform 0.25s; position: relative; overflow: hidden; }
.project-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transform: scaleX(0); transform-origin: left; transition: transform 0.3s ease; }
.project-card:hover { border-color: color-mix(in srgb, var(--accent) 25%, transparent); transform: translateY(-4px); }
.project-card:hover::before { transform: scaleX(1); }
.project-num { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.1em; margin-bottom: 20px; }
.project-title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 10px; }
.project-desc { font-size: 15px; color: var(--muted2); line-height: 1.75; margin-bottom: 20px; }
.project-highlight { font-family: var(--mono); font-size: 11px; color: var(--accent); margin-bottom: 16px; letter-spacing: 0.04em; }
.project-stack { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.proj-tag { font-family: var(--mono); font-size: 10px; padding: 4px 10px; background: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--accent); letter-spacing: 0.05em; }
.project-links { display: flex; gap: 16px; }
.proj-link { font-family: var(--mono); font-size: 11px; color: var(--muted2); text-decoration: none; letter-spacing: 0.08em; text-transform: uppercase; display: flex; align-items: center; gap: 6px; transition: color 0.2s; }
.proj-link:hover { color: var(--accent); }
.proj-link svg { width: 12px; height: 12px; }

/* PUBLICATIONS */
#publications { background: var(--bg2); }
.pub-list { display: flex; flex-direction: column; gap: 2px; }
.pub-card { background: var(--bg3); border: 1px solid var(--border); padding: 28px 32px; display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; transition: border-color 0.2s, transform 0.2s; }
.pub-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); transform: translateX(6px); }
.pub-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.01em; line-height: 1.4; }
.pub-venue { font-family: var(--mono); font-size: 12px; color: var(--muted2); letter-spacing: 0.06em; }
.pub-venue span { color: var(--accent); }
.pub-year { font-family: var(--mono); font-size: 13px; color: var(--accent); font-weight: 700; white-space: nowrap; }
.pub-num { font-family: var(--mono); font-size: 28px; font-weight: 800; color: var(--border); line-height: 1; }

/* CONTACT */
#contact { background: var(--bg); border-top: 1px solid var(--border); }
.contact-big { font-size: clamp(36px, 6vw, 80px); font-weight: 800; letter-spacing: -0.03em; line-height: 1; margin-bottom: 28px; }
.contact-big span { color: var(--accent); }
.contact-sub { font-size: 15px; color: var(--muted2); line-height: 1.75; max-width: 460px; margin-bottom: 44px; }
.contact-links { display: flex; gap: 22px; flex-wrap: wrap; }
.contact-link { font-family: var(--mono); font-size: 12px; color: var(--text); text-decoration: none; letter-spacing: 0.08em; text-transform: uppercase; padding-bottom: 4px; border-bottom: 1px solid var(--border); transition: color 0.2s, border-color 0.2s; }
.contact-link:hover { color: var(--accent); border-color: var(--accent); }


/* GO TO TOP */
.go-top {
  position: fixed; bottom: 32px; right: 32px; z-index: 500;
  width: 44px; height: 44px;
  background: var(--bg3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: none; opacity: 0; pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s, border-color 0.2s, background 0.2s;
}
.go-top.visible { opacity: 1; pointer-events: all; transform: none; }
.go-top:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg3)); }
.go-top svg { width: 16px; height: 16px; stroke: var(--accent); transition: stroke 0.2s; }

body::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 9000; opacity: 0.02; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); background-size: 180px; }

/* PUBLICATIONS — updated cards */
.pub-authors { font-size: 12px; color: var(--muted2); margin-bottom: 10px; line-height: 1.5; }
.pub-authors strong { color: var(--accent); font-style: normal; }
.pub-view-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 14px; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding: 7px 14px; background: transparent;
  cursor: none; transition: background 0.2s, color 0.2s;
}
.pub-view-btn:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.pub-view-btn svg { width: 12px; height: 12px; }

/* PDF MODAL */
.pdf-modal-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.pdf-modal-overlay.open { opacity: 1; pointer-events: all; }
.pdf-modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  width: min(860px, 94vw);
  height: min(88vh, 700px);
  display: flex; flex-direction: column;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s ease;
}
.pdf-modal-overlay.open .pdf-modal { transform: none; }
.pdf-modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
}
.pdf-modal-title { font-family: var(--mono); font-size: 11px; color: var(--muted2); letter-spacing: 0.06em; line-height: 1.5; }
.pdf-modal-title span { color: var(--accent); display: block; margin-bottom: 2px; font-size: 10px; }
.pdf-modal-actions { display: flex; gap: 8px; flex-shrink: 0; }
.pdf-action-btn {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 6px 12px;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted2); text-decoration: none;
  cursor: none; transition: border-color 0.2s, color 0.2s;
  display: inline-flex; align-items: center; gap: 5px;
}
.pdf-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.pdf-close-btn {
  font-family: var(--mono); font-size: 18px; line-height: 1;
  background: none; border: none; color: var(--muted2);
  cursor: none; padding: 2px 6px; transition: color 0.2s;
}
.pdf-close-btn:hover { color: var(--accent); }
.pdf-modal-body { flex: 1; position: relative; background: #1a1a1a; }
.pdf-modal-body iframe { width: 100%; height: 100%; border: none; display: block; }
.pdf-loading {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  letter-spacing: 0.1em;
}
.pdf-loading-bar {
  width: 120px; height: 2px; background: var(--border); overflow: hidden;
}
.pdf-loading-bar::after {
  content: ''; display: block; height: 100%;
  background: var(--accent); width: 40%;
  animation: loading-slide 1.2s ease infinite;
}
@keyframes loading-slide { 0%{transform:translateX(-100%)} 100%{transform:translateX(350%)} }
.pdf-fallback {
  display: none; position: absolute; inset: 0;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 32px; text-align: center;
  background: var(--bg2);
}
.pdf-fallback.show { display: flex; }
.pdf-fallback-icon { font-size: 40px; opacity: 0.5; }
.pdf-fallback-msg { font-family: var(--mono); font-size: 12px; color: var(--muted2); line-height: 1.8; letter-spacing: 0.04em; max-width: 340px; }
.pdf-fallback-msg span { color: var(--accent); display: block; margin-bottom: 4px; }
.pdf-fallback-btn {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 12px 24px;
  background: var(--accent); color: var(--accent-dark);
  text-decoration: none; font-weight: 700;
  transition: opacity 0.2s; cursor: none; display: inline-flex; align-items: center; gap: 8px;
}
.pdf-fallback-btn:hover { opacity: 0.85; }

@keyframes fadeUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:none; } }

@media (max-width: 960px) {
  #hero { grid-template-columns: 1fr; padding: 100px 24px 60px; gap: 40px; }
  .hero-photo-wrap { display: flex; justify-content: center; order: -1; }
  .hero-photo-frame { width: 200px; height: 240px; }
  nav { padding: 18px 24px; }
  .nav-links { display: none; }
  section { padding: 80px 24px; }
  .about-grid, .edu-card, .pub-card { grid-template-columns: 1fr; }
  .edu-meta { text-align: left; }
  .timeline-item { grid-template-columns: 1fr; gap: 6px; }
  .projects-grid { grid-template-columns: 1fr; }
  .hero-scroll-hint { left: 24px; }
  footer { flex-direction: column; gap: 8px; text-align: center; }
}


/* ===== LOADER SCREEN ===== */
.loader-screen {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: var(--bg); /* Changed from #0a0a0a */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader-screen.done {
  opacity: 0;
  visibility: hidden;
}

/* Subtle grid */
.loader-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(99, 102, 241, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.015) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: min(90vw, 600px);
  position: relative;
}

/* ===== TRACK ===== */
.track-area {
  width: 100%;
  height: 120px;
  position: relative;
  display: flex;
  align-items: flex-end;
}

.track-surface {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border); /* Changed from #161625 */
  border-radius: 50px;
  overflow: hidden;
}

.track-progress {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0d9488, #14b8a6);
  border-radius: 50px;
  box-shadow: 0 0 12px rgba(13, 148, 136, 0.4);
  transition: none;
}

/* Finish marker */
.finish-marker {
  position: absolute;
  right: 0;
  bottom: -12px;
  width: 3px;
  height: 26px;
  background: repeating-linear-gradient(
    180deg,
    rgba(255,255,255,0.6) 0px,
    rgba(255,255,255,0.6) 3px,
    rgba(50,50,50,0.6) 3px,
    rgba(50,50,50,0.6) 6px
  );
  border-radius: 1px;
}

/* ===== RACE GROUP (car + driver move together) ===== */
.race-group {
  position: absolute;
  bottom: 5px;
  left: 0%;
  display: flex;
  align-items: flex-end;
  /* Front of car leads at the progress point */
  transform: translateX(-100%);
}

/* ===== F1 CAR ===== */
.f1-car {
  height: 50px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
  display: block;
}

/* ===== DRIVER ===== */
.driver {
  height: 62px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
  display: block;
  opacity: 0;
  transition: opacity 0.4s ease;
  margin-right: -10px; /* slight overlap so hands touch car */
}

.driver.visible {
  opacity: 1;
}

/* ===== CAR STALL ===== */
@keyframes car-stall {
  0%   { transform: translateX(-100%) rotate(0deg); }
  10%  { transform: translateX(-98%) rotate(0.3deg); }
  20%  { transform: translateX(-102%) rotate(-0.3deg); }
  30%  { transform: translateX(-99%) rotate(0.2deg); }
  40%  { transform: translateX(-101%) rotate(-0.2deg); }
  50%  { transform: translateX(-100%) rotate(0.1deg); }
  60%  { transform: translateX(-99.5%) rotate(-0.1deg); }
  80%  { transform: translateX(-100%) rotate(0deg); }
  100% { transform: translateX(-100%) rotate(0deg); }
}

.race-group.stuck {
  animation: car-stall 0.7s ease-out;
}

/* ===== DRIVER PUSH ===== */
@keyframes push-cycle {
  0%, 100% { margin-right: -10px; }
  40% { margin-right: -6px; }
  60% { margin-right: -10px; }
}

.driver.pushing {
  animation: push-cycle 0.4s ease-in-out infinite;
}

/* ===== SMOKE PARTICLES ===== */
.particle {
  position: absolute;
  bottom: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(100,100,100,0.5), transparent);
  opacity: 0;
  pointer-events: none;
}

@keyframes particle-rise {
  0% { opacity: 0.6; transform: scale(1) translate(0, 0); }
  50% { opacity: 0.3; transform: scale(1.8) translate(-8px, -12px); }
  100% { opacity: 0; transform: scale(2.5) translate(-16px, -20px); }
}

.particle.active {
  animation: particle-rise 0.8s ease-out forwards;
}

/* ===== STATUS BAR ===== */
.status-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px;
}

.status-text {
  font-family: 'JetBrains Mono', monospace;
  color: #0d9488;
  font-size: 11px;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity 0.3s ease;
  min-height: 16px;
}

.status-text.visible {
  opacity: 0.8;
}

.percent-text {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text); /* Changed from #fff */
  font-size: 12px;
  font-weight: 600;
  opacity: 0.4;
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
}

/* ===== SKIP HINT ===== */
.skip-hint {
  position: absolute;
  bottom: -50px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text); /* Changed from #fff */
  opacity: 0;
  letter-spacing: 1px;
  cursor: pointer;
  transition: opacity 0.3s;
}

.skip-hint.visible {
  opacity: 0.2;
}

.skip-hint:hover {
  opacity: 0.5;
}

/* ===== RESPONSIVE LOADER ===== */
@media (max-width: 480px) {
  .f1-car { height: 35px; }
  .driver { height: 45px; }
  .track-area { height: 80px; }
}

/* Gentle pulse animation to draw attention to the color toggle */
@keyframes colorDotPulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* We will apply this class using JS so it fires exactly when we want */
.hint-pulse {
  animation: colorDotPulse 1.5s ease-out 3; /* Pulses exactly 3 times, then stops forever */
}

/* ============================================================
   F1 TELEMETRY THEME OVERRIDES
   ============================================================ */

/* 1. Carbon Fiber Background & Base Colors */
[data-theme="f1"] {
  --bg: #111111;
  --bg2: #0a0a0a;
  --bg3: #1a1a1a;
  --text: #ffffff;
  --muted2: #aaaaaa;
}

[data-theme="f1"] body {
  background-image: 
    repeating-linear-gradient(45deg, #111 25%, transparent 25%, transparent 75%, #111 75%, #111),
    repeating-linear-gradient(45deg, #111 25%, #0a0a0a 25%, #0a0a0a 75%, #111 75%, #111);
  background-position: 0 0, 4px 4px;
  background-size: 8px 8px;
}

/* 2. Force Monospace "Data" Font Everywhere */
[data-theme="f1"] * {
  font-family: var(--mono) !important;
  letter-spacing: 0.02em;
}

/* 3. The Sector Gradient Scrollbar */
[data-theme="f1"] ::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #B144FF, #4444FF, #44FF44); /* Purple -> Blue -> Green */
  border-radius: 0;
}

/* 4. Live Recording Indicator (Hidden by default) */
.live-indicator {
  display: none;
  width: 6px; 
  height: 6px; 
  background: #ff4444; 
  border-radius: 50%;
  margin-left: 10px; 
  box-shadow: 0 0 8px #ff4444;
  vertical-align: middle;
}

/* Make it blink only when F1 theme is active */
[data-theme="f1"] .live-indicator {
  display: inline-block;
  animation: telemetryBlink 1s infinite;
}

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

/* 5. Telemetry Data Readout */
.telemetry-data {
  display: none; 
  position: fixed; 
  bottom: 24px; 
  left: 48px;
  font-family: var(--mono); 
  font-size: 10px; 
  color: var(--accent);
  pointer-events: none; 
  z-index: 9999;
  line-height: 1.5;
}

[data-theme="f1"] .telemetry-data {
  display: block;
}

/* Hide the normal scroll hint to make room for data */
[data-theme="f1"] .hero-scroll-hint {
  display: none;
}

/* ============================================================
   SPACE THEME OVERRIDES
   ============================================================ */

[data-theme="space"] {
  --bg: #060b19;
  --bg2: transparent; /* Allows the orbital path to show behind sections */
  --bg3: rgba(10, 16, 35, 0.7);
  --text: #e2e8f0;
  --border: rgba(0, 210, 255, 0.15);
  --accent: #00d2ff; /* SpaceX Cyan */
  --accent2: #ffb000; /* Apollo Amber */
  --muted2: #64748b;
}

[data-theme="space"] body {
  background-image: 
    linear-gradient(rgba(0, 210, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 210, 255, 0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  background-color: #060b19;
  background-attachment: fixed;
}

[data-theme="space"] * {
  font-family: var(--mono) !important;
}

/* Frosted glass effect so text remains readable over the glowing line */
[data-theme="space"] .project-card,
[data-theme="space"] .edu-card,
[data-theme="space"] .pub-card,
[data-theme="space"] .stat-box {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* SVG Solar System Container */
#spaceSvg {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0; 
  opacity: 0.8; /* Keeps it from overpowering your text */
}

[data-theme="space"] #spaceSvg {
  display: block;
}

.solar-system-grid circle {
  transform-origin: center;
}

.space-path {
  fill: none;
  stroke: url(#orbitGradient); 
  stroke-width: 1.5px;
}

.space-path-glow {
  fill: none;
  stroke: url(#orbitGradient);
  stroke-width: 6px;
  opacity: 0.2;
  filter: blur(3px);
}