@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600&family=Inter:wght@400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ─────────────────────────────────────────────
   Professional theme: ink + navy, serif display
   ───────────────────────────────────────────── */
:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --border: #e4e6ea;
  --border-hover: #c8ccd3;
  --text: #121821;
  --text-muted: #4a5361;
  --text-light: #6b7280;
  --accent: #1f3a5f;
  --accent-light: #eef2f7;
  --accent-dark: #152a46;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'DM Mono', ui-monospace, Menlo, monospace;
  --nav-h: 68px;
  --radius: 6px;
  --radius-sm: 4px;
  --shadow-sm: 0 1px 2px rgba(18,24,33,0.04);
  --shadow: 0 1px 3px rgba(18,24,33,0.05), 0 6px 20px rgba(18,24,33,0.05);
  --shadow-hover: 0 2px 6px rgba(18,24,33,0.06), 0 14px 36px rgba(18,24,33,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }

body {
  font-family: var(--sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: #fff; }
strong { font-weight: 600; color: var(--text); }

/* ── SCROLL REVEAL (subtle) ── */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.revealed { opacity: 1; transform: none; }
.reveal-delay-1 { transition-delay: 0.06s; }
.reveal-delay-2 { transition-delay: 0.12s; }
.reveal-delay-3 { transition-delay: 0.18s; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ── NAV ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(251,251,250,0.92);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 2rem;
  height: 100%; display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-family: var(--serif);
  font-size: 1.2rem; font-weight: 600;
  letter-spacing: -0.01em; color: var(--text); text-decoration: none;
}

.nav-links { display: flex; gap: 2.25rem; list-style: none; }
.nav-links a {
  position: relative;
  font-size: 0.85rem; font-weight: 500; color: var(--text-muted);
  text-decoration: none; transition: color 0.2s;
}
.nav-links a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -6px;
  height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform 0.25s ease;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }

.nav-hamburger {
  display: none; flex-direction: column; gap: 5px;
  cursor: pointer; background: none; border: none; padding: 6px;
}
.nav-hamburger span {
  display: block; width: 20px; height: 1.5px;
  background: var(--text); border-radius: 1px;
}

/* ── LAYOUT ── */
.container { max-width: 1080px; margin: 0 auto; padding: 0 2rem; }

/* ── HERO ── */
#hero {
  padding-top: calc(var(--nav-h) + 6.5rem);
  padding-bottom: 6.5rem;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4.5rem;
}
.hero-text { min-width: 0; }
.hero-photo-wrap { position: relative; }
.hero-photo-wrap::after {
  content: ''; position: absolute; inset: 14px -14px -14px 14px;
  border: 1px solid var(--border-hover); border-radius: var(--radius);
  z-index: -1;
}
.hero-photo {
  display: block;
  width: 260px; height: 320px;
  border-radius: var(--radius);
  object-fit: cover; object-position: center top;
  background: var(--surface-2);
}
.hero-eyebrow {
  display: flex; align-items: center; gap: 0.75rem;
  font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 1.5rem;
}
.hero-eyebrow::before {
  content: ''; width: 28px; height: 1px; background: var(--accent);
}
.hero-name {
  font-family: var(--serif);
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.02;
  margin-bottom: 1rem;
  color: var(--text);
}
.cursor { display: none; }

.hero-role {
  font-family: var(--serif);
  font-size: 1.35rem; font-weight: 400; font-style: italic;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}
.hero-desc {
  font-size: 1.02rem; color: var(--text-muted);
  line-height: 1.75; max-width: 580px;
  margin-bottom: 1.75rem;
}
.hero-degree {
  display: block;
  font-size: 0.82rem; font-weight: 500;
  color: var(--text);
  padding: 0.9rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  max-width: 580px;
  margin-bottom: 2rem;
}

.hero-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.7rem 1.35rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 500;
  font-family: var(--sans);
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border-hover); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.contact-pill {
  font-size: 0.85rem; color: var(--text-muted);
  margin-left: 0.5rem;
}

/* ── DIVIDER ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 0; }

/* ── SECTION HEADERS ── */
.section-label {
  display: flex; align-items: center; gap: 0.75rem;
  font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 0.85rem;
}
.section-label::before {
  content: ''; width: 28px; height: 1px; background: var(--accent);
}

h2.section-title {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3.5vw, 2.5rem); font-weight: 500;
  letter-spacing: -0.02em; line-height: 1.15;
  margin-bottom: 3rem; color: var(--text);
}

section { padding: 6rem 0; }

/* ── ABOUT ── */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-sm); }

.card h3 {
  font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-light);
  padding-bottom: 0.9rem; margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
}
.card-icon { display: none; }

.info-row { display: flex; flex-direction: column; }
.info-item {
  font-size: 0.92rem; color: var(--text);
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--surface-2);
  line-height: 1.5;
}
.info-item:first-child { padding-top: 0; }
.info-item:last-child { border-bottom: none; padding-bottom: 0; }
.info-item .label {
  display: block;
  font-size: 0.7rem; font-weight: 500; color: var(--text-light);
  letter-spacing: 0.06em; text-transform: uppercase;
  margin-bottom: 0.15rem;
}
.info-item a { font-weight: 500; }
.info-item a:hover { text-decoration: underline !important; text-underline-offset: 3px; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tag {
  display: inline-block; padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 0.74rem; font-weight: 500;
  line-height: 1.5;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border);
}
/* one restrained accent for primary languages; everything else neutral */
.tag-blue { background: var(--accent-light); color: var(--accent); border-color: #d9e1ec; }
.tag-green, .tag-rose, .tag-neutral { background: var(--surface-2); color: var(--text-muted); }

/* ── PROJECTS GRID ── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column;
}
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-hover);
}

.project-thumb {
  width: 100%; height: 210px;
  object-fit: cover; object-position: top;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: block;
}

.project-body { padding: 1.75rem; flex: 1; display: flex; flex-direction: column; }

.project-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }

.project-body h3 {
  font-family: var(--serif);
  font-size: 1.28rem; font-weight: 500;
  line-height: 1.3; margin-bottom: 0.65rem;
  letter-spacing: -0.01em; color: var(--text);
}
.project-body p {
  font-size: 0.9rem; color: var(--text-muted);
  line-height: 1.7; flex: 1;
}
.project-footer {
  margin-top: 1.5rem; padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem; font-weight: 600;
  color: var(--accent);
  transition: letter-spacing 0.25s;
}
.project-card:hover .project-footer { color: var(--accent-dark); }

/* ── PROJECT HOVER: spotlight the hovered card, fade the rest ── */
.project-card { position: relative; }
.project-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent); z-index: 2;
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.4s ease;
}
.project-thumb { transition: transform 0.6s ease, filter 0.4s ease; }
.project-footer .arrow { display: inline-block; transition: transform 0.3s ease; }

@media (hover: hover) {
  .projects-grid .project-card {
    transition: transform 0.35s ease, box-shadow 0.35s ease,
                border-color 0.35s ease, opacity 0.35s ease, filter 0.35s ease;
  }
  .projects-grid:hover .project-card:not(:hover) {
    opacity: 0.45;
    filter: grayscale(0.6);
  }
  .projects-grid .project-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: 0 4px 10px rgba(31,58,95,0.08), 0 24px 56px rgba(31,58,95,0.16);
  }
  .project-card:hover::before { transform: scaleX(1); }
  .project-card:hover .project-thumb { transform: scale(1.04); }
  .project-card:hover .project-footer .arrow { transform: translateX(6px); }
}

/* ── LIVE TYPING ROLE + CARET ── */
.hero-role { min-height: 1.6em; }
.caret {
  display: inline-block;
  width: 2px; height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.12em;
  background: var(--accent);
  animation: caret-blink 1.05s step-end infinite;
}
@keyframes caret-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; }
  .projects-grid .project-card, .project-thumb { transition: none; }
}

/* ── CONTACT ── */
.contact-grid { display: grid; grid-template-columns: 1fr; }

/* ── PROJECT PAGES ── */
.page-header {
  padding-top: calc(var(--nav-h) + 3.5rem);
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--border);
}
.back-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.82rem; font-weight: 500;
  color: var(--text-muted); text-decoration: none;
  margin-bottom: 2rem; transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }

.page-header h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 500;
  letter-spacing: -0.02em; line-height: 1.15;
  margin-bottom: 0.9rem; color: var(--text);
  max-width: 820px;
}
.page-header .subtitle {
  color: var(--text-muted); font-size: 1.02rem;
  max-width: 700px; line-height: 1.7; margin-bottom: 1.75rem;
}
.header-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.project-content { padding: 3.5rem 0 4rem; max-width: 860px; }
.project-content section { padding: 0; margin-bottom: 4rem; }

.project-content h2 {
  font-family: var(--serif);
  font-size: 1.5rem; font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text); margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.project-content h3 {
  font-size: 1rem; font-weight: 600;
  margin-bottom: 0.75rem; margin-top: 2rem;
  color: var(--text);
}
.project-content h3:first-child { margin-top: 0; }

.project-content p {
  font-size: 0.97rem; color: var(--text-muted);
  line-height: 1.8; margin-bottom: 1rem;
}
.project-content ul { list-style: none; margin-bottom: 1rem; }
.project-content ul li {
  font-size: 0.97rem; color: var(--text-muted);
  padding: 0.3rem 0 0.3rem 1.25rem;
  position: relative; line-height: 1.7;
}
.project-content ul li::before {
  content: '';
  position: absolute; left: 0; top: 1.05em;
  width: 8px; height: 1px;
  background: var(--accent);
}

/* ── STAT ROW ── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0; margin: 2rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.stat-item {
  padding: 1.4rem 1.25rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-right: -1px; margin-bottom: -1px;
}
.stat-value {
  font-family: var(--serif);
  font-size: 2.1rem; font-weight: 500;
  color: var(--accent); letter-spacing: -0.02em;
  line-height: 1; margin-bottom: 0.5rem;
}
.stat-label {
  font-size: 0.7rem; font-weight: 600;
  color: var(--text-light); text-transform: uppercase; letter-spacing: 0.1em;
}

/* ── CODE BLOCKS ── */
.code-block { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin: 1rem 0; background: var(--surface); }
.code-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 1.1rem;
  background: var(--surface); border: none; cursor: pointer;
  font-family: var(--sans); font-size: 0.8rem; font-weight: 500;
  color: var(--text-muted); transition: background 0.2s, color 0.2s; text-align: left;
}
.code-toggle:hover { background: var(--surface-2); color: var(--text); }
.code-toggle .chevron { transition: transform 0.25s; font-size: 0.6rem; color: var(--text-light); }
.code-toggle.open .chevron { transform: rotate(180deg); }
.code-body { display: none; overflow-x: auto; background: #111827; border-top: 1px solid var(--border); }
.code-body.open { display: block; }
.code-body pre {
  padding: 1.25rem 1.5rem; margin: 0;
  font-family: var(--mono); font-size: 0.78rem;
  line-height: 1.75; color: #e5e7eb; white-space: pre;
}
.code-body pre .kw  { color: #a5b4fc; }
.code-body pre .fn  { color: #93c5fd; }
.code-body pre .str { color: #a7d3b0; }
.code-body pre .cm  { color: #6b7280; font-style: italic; }
.code-body pre .op  { color: #cbd5e1; }

/* ── IMAGES ── */
.plot-img {
  width: 100%; border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  display: block; margin: 1rem 0;
}
.plot-img.subdued { filter: saturate(0.85); }
.plot-img.small { max-width: 340px; width: auto; }
.img-caption {
  font-size: 0.8rem; color: var(--text-light); font-style: italic;
  text-align: center; margin-bottom: 1.25rem; margin-top: -0.25rem;
}
.img-row, .img-row-sm { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin: 1rem 0; }
.img-row-sm .plot-img { max-width: 100%; }

/* ── TABS (EDA) ── */
.tab-bar {
  display: flex; gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}
.tab-btn {
  padding: 0.8rem 1.2rem;
  background: none; border: none;
  font-family: var(--sans); font-size: 0.88rem; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── NASA FLIPBOOK ── */
.flipbook {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.flipbook-img { width: 100%; display: none; }
.flipbook-img.active { display: block; }
.flipbook-controls {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.8rem 1.1rem;
  background: var(--surface); border-top: 1px solid var(--border);
}
.flip-btn {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-hover); border-radius: var(--radius-sm);
  padding: 0.45rem 1rem;
  font-family: var(--sans); font-size: 0.8rem; font-weight: 500;
  cursor: pointer; transition: border-color 0.2s, color 0.2s;
}
.flip-btn:hover { border-color: var(--accent); color: var(--accent); }
.flip-btn:disabled { color: var(--border-hover); border-color: var(--border); cursor: default; }
.flip-counter { font-size: 0.8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ── POSTER ── */
.poster-img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: block;
}

/* ── MINI SECTION DIVIDER ── */
.analysis-label {
  display: flex; align-items: baseline; gap: 1rem;
  padding: 1.2rem 1.5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius); margin-bottom: 2.5rem;
}
.analysis-num {
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent);
}
.analysis-title { font-family: var(--serif); font-size: 1.15rem; font-weight: 500; color: var(--text); }

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 2.25rem 2rem; text-align: center;
}
footer p { font-size: 0.8rem; color: var(--text-light); }
footer a { color: var(--text-muted); text-decoration: none; font-weight: 500; }
footer a:hover { color: var(--accent); }

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 3rem; }
  .hero-photo-wrap { order: -1; justify-self: start; }
  .hero-photo { width: 180px; height: 220px; }
}
@media (max-width: 768px) {
  .container, .nav-inner { padding: 0 1.25rem; }
  #hero { padding-top: calc(var(--nav-h) + 3rem); padding-bottom: 4rem; }
  .nav-links {
    display: none; position: absolute; top: var(--nav-h);
    left: 0; right: 0; background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column; padding: 1.25rem; gap: 1rem;
  }
  .nav-links.open { display: flex; }
  .nav-links a::after { display: none; }
  .nav-hamburger { display: flex; }
  .img-row, .img-row-sm { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr !important; }
  .about-grid .card { grid-column: auto !important; }
  .contact-pill { margin-left: 0; width: 100%; }
  section { padding: 4rem 0; }
  .tab-bar { overflow-x: auto; }
  .tab-btn { white-space: nowrap; }
}
