/* ---------------------------------------------------------
   Design tokens — single source of truth for colors, type,
   and spacing. Change values here, not at call sites.
--------------------------------------------------------- */
:root {
  --bg: #0a0b0f;
  --bg-elevated: #13151c;
  --bg-elevated-hover: #191c25;
  --border: #22262f;
  --text: #e9ebf1;
  --text-muted: #9aa0ae;
  --text-faint: #676d7a;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --accent-border: rgba(59, 130, 246, 0.35);
  --nav-bg: rgba(10, 11, 15, 0.75);

  --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --nav-height: 72px;
  --content-max-width: 1240px;
  --transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);

  color-scheme: dark;
}

/* Light theme — applied via [data-theme="light"] on <html>, set by the
   inline script in <head> (before paint, to avoid a flash) and toggled
   by .theme-toggle in script.js. Absence of the attribute means dark,
   so dark stays the default for anyone without JS. */
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-elevated: #f3f4f7;
  --bg-elevated-hover: #e9ebf0;
  --border: #dfe1e6;
  --text: #14161c;
  --text-muted: #565b66;
  --text-faint: #8a8f99;
  --accent: #1d4ed8;
  --accent-soft: rgba(29, 78, 216, 0.10);
  --accent-border: rgba(29, 78, 216, 0.30);
  --nav-bg: rgba(255, 255, 255, 0.75);

  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Faint ambient glow + grain — decorative, sits behind all content */
body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(600px 500px at 85% 0%, var(--accent-soft), transparent 60%),
    radial-gradient(500px 400px at 0% 100%, rgba(59, 130, 246, 0.08), transparent 60%);
}

body::after {
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------
   Scroll-reveal (hero, project categories)
--------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

.category.reveal:nth-of-type(1) { transition-delay: 0ms; }
.category.reveal:nth-of-type(2) { transition-delay: 80ms; }
.category.reveal:nth-of-type(3) { transition-delay: 160ms; }

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

ul { list-style: none; margin: 0; padding: 0; }

/* ---------------------------------------------------------
   Nav — fixed top bar, present on every page
--------------------------------------------------------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-7);
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-wordmark {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: var(--space-6);
}

.nav-link {
  position: relative;
  padding: 4px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--transition);
}

.nav-link:hover {
  color: var(--text);
}

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

.nav-link.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.theme-toggle {
  position: relative;
  flex-shrink: 0;
  width: 52px;
  height: 28px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  cursor: pointer;
  transition: border-color var(--transition);
}

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

.theme-toggle-icon {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.theme-toggle-icon-sun {
  left: 6px;
}

.theme-toggle-icon-moon {
  right: 6px;
}

.theme-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 29px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: left var(--transition);
}

/* Thumb position is driven directly by the root theme attribute (not the
   button's own state), since that attribute is already set synchronously
   before paint by the inline head script — this avoids any flash/jump on
   page load that driving it off aria-checked + JS would risk. */
:root[data-theme="light"] .theme-toggle-thumb {
  left: 3px;
}

/* ---------------------------------------------------------
   Reusable section heading (Experience / Education / etc.)
--------------------------------------------------------- */
.section-heading {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--space-4);
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

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

.timeline-logo {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.timeline-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.timeline-item:hover .timeline-logo {
  transform: translateY(-5px);
  border-color: var(--accent-border);
  box-shadow: 0 16px 26px -10px rgba(59, 130, 246, 0.5);
}

.timeline-text {
  min-width: 0;
}

.timeline-org {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
}

.timeline-title {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

/* ---------------------------------------------------------
   Main / hero
--------------------------------------------------------- */
.main {
  flex: 1 0 auto;
  padding: calc(var(--nav-height) + var(--space-7)) var(--space-7) var(--space-8);
  max-width: var(--content-max-width);
  width: 100%;
  margin: 0 auto;
}

.hero {
  margin-bottom: var(--space-6);
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--space-3);
}

.name {
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 var(--space-4);
}

.headline {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--text);
  max-width: 44ch;
  margin: 0;
  padding-left: var(--space-4);
  border-left: 2px solid var(--accent);
}

.role-highlight {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  margin-top: var(--space-5);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
}

.role-highlight-line {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.role-highlight-line.is-secondary {
  font-weight: 500;
  color: var(--text-muted);
}

/* ---------------------------------------------------------
   Buttons
--------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 13px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-sans);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

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

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -12px rgba(59, 130, 246, 0.5);
}

/* ---------------------------------------------------------
   Projects — accordion categories
--------------------------------------------------------- */
.projects {
  margin-top: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.projects-heading {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

.category {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  overflow: hidden;
}

.category-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5);
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.category-toggle:hover {
  background: var(--bg-elevated-hover);
}

.category-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.category-icon {
  position: relative;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.category-icon::before,
.category-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
  transition: transform var(--transition);
}

.category-icon::before {
  width: 12px;
  height: 2px;
}

.category-icon::after {
  width: 2px;
  height: 12px;
}

.category-toggle[aria-expanded="true"] .category-icon::after {
  transform: translate(-50%, -50%) rotate(90deg) scale(0);
}

.category-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
  padding: 0 var(--space-5) var(--space-5);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height var(--transition), opacity var(--transition), padding var(--transition);
}

.category-panel.is-open {
  max-height: 2000px;
  opacity: 1;
}

.category-panel[hidden] {
  display: none;
}

/* Project card */
.project-card {
  /* Caps how wide a single grid item can stretch when auto-fit collapses
     unused tracks (e.g. a category with only one project) — without this,
     a lone card would stretch to fill the entire row instead of matching
     the card width seen when a row has enough cards to fill it on their
     own (2-4 cards, e.g. Worldline/ESSEC & GrowthX). Below this cap,
     multi-card rows are unaffected since their natural stretched width
     already comes in under it. */
  max-width: 360px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  background: var(--bg);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-border);
  box-shadow: 0 12px 24px -12px rgba(59, 130, 246, 0.35);
}

.category-panel.is-open .project-card {
  animation: card-in 420ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.category-panel.is-open .project-card:nth-child(1) { animation-delay: 60ms; }
.category-panel.is-open .project-card:nth-child(2) { animation-delay: 120ms; }
.category-panel.is-open .project-card:nth-child(3) { animation-delay: 180ms; }
.category-panel.is-open .project-card:nth-child(4) { animation-delay: 240ms; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.project-thumb {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: var(--space-3);
}

.project-thumb iframe {
  width: 100%;
  height: 100%;
  border: none;
  /* The PDF preview is a separate document, so clicks inside it wouldn't
     otherwise reach the enclosing card-link. Since the toolbar is already
     hidden, there's no interactive PDF chrome to preserve here anyway. */
  pointer-events: none;
}

.project-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at center, var(--accent-soft) 0%, transparent 70%),
    var(--bg-elevated);
}

.project-thumb-glyph {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.45;
}

.project-thumb-icon {
  width: 42px;
  height: 42px;
  color: var(--accent);
  opacity: 0.65;
}

.project-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 var(--space-2);
}

.project-blurb {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 var(--space-3);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.project-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.project-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.project-download-btn {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: var(--space-3);
  padding: 8px 16px;
  font-size: 12px;
  background: transparent;
  border-color: var(--accent-border);
  color: var(--accent);
}

.project-download-btn:hover {
  background: var(--accent-soft);
  transform: translateY(-2px);
}

.category-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: var(--space-6) 0;
}

/* ---------------------------------------------------------
   About page
--------------------------------------------------------- */
.about-intro {
  display: flex;
  align-items: flex-start;
  gap: var(--space-7);
  margin-bottom: var(--space-8);
}

.about-photo {
  flex-shrink: 0;
  width: 220px;
  height: 220px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.about-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.about-intro-text p {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-muted);
  max-width: 60ch;
  margin: var(--space-4) 0 0;
}

.text-accent {
  color: var(--accent);
  font-weight: 600;
}

.about-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-7);
  margin-bottom: var(--space-8);
}

.hobbies-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.hobby {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.hobby-icon {
  width: 26px;
  height: 26px;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.hobby-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-1);
}

.hobby-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ---------------------------------------------------------
   Contact page
--------------------------------------------------------- */
.contact-headline {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 600;
  line-height: 1.4;
  max-width: 32ch;
  margin: 0 0 var(--space-7);
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 460px;
}

.contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  transition: transform var(--transition), border-color var(--transition);
}

.contact-row:hover {
  transform: translateY(-2px);
  border-color: var(--accent-border);
}

.contact-row-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.contact-row-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

/* ---------------------------------------------------------
   Footer
--------------------------------------------------------- */
.site-footer {
  flex-shrink: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-6);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.site-footer a {
  position: relative;
  transition: color var(--transition);
}

.site-footer a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

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

.site-footer a:hover::after {
  transform: scaleX(1);
}

.footer-sep {
  color: var(--text-faint);
}

/* ---------------------------------------------------------
   Responsive
--------------------------------------------------------- */
@media (max-width: 800px) {
  .nav {
    padding: 0 var(--space-4);
  }

  .nav-links {
    gap: var(--space-4);
  }

  .main {
    padding: calc(var(--nav-height) + var(--space-5)) var(--space-4) var(--space-6);
  }

  .about-intro {
    flex-direction: column-reverse;
    gap: var(--space-5);
  }

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

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

  .hobbies-list {
    grid-template-columns: 1fr;
  }
}
