/* ===== Tokens ===== */
:root {
  --bg: #f3f9f5;
  --text: #10231c;
  --muted: #4b6158;
  --line: rgba(16, 35, 28, .12);
  --accent: #0e7a5f;
  --accent2: #138ba3;
  --sun: #f5b83d;
  --glass: rgba(255, 255, 255, .55);
  --glass-strong: rgba(255, 255, 255, .78);
  --glass-line: rgba(16, 35, 28, .08);
  --shadow: 0 20px 60px -20px rgba(14, 80, 60, .28);

  --sky1: #a6d9ee; --sky2: #def2f2; --sky3: #f8f1d8; --stars: 0;
  --far: #a9cfc6; --far-snow: #eef6f3;
  --mid: #7cc39f; --near: #4fa97b; --fore: #2e7f5b; --fore-pine: #1f6347;
  --tower: #f7fbf9; --tower-edge: #6f8f84;
  --panel: #1d4b74; --panel-line: #8cc4e8;
  --pine: #2d7651; --plant: #dfe8e4; --bubble: rgba(255, 255, 255, .85);
  --shell: #8a5a35; --shell-in: #f2e6d3; --carbon: #1d2522;
  --deep: #0d4d3d;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07120e;
    --text: #e3f1ea;
    --muted: #97b1a6;
    --line: rgba(255, 255, 255, .1);
    --accent: #3fd19b;
    --accent2: #4cc7de;
    --sun: #f3ead0;
    --glass: rgba(18, 38, 31, .5);
    --glass-strong: rgba(24, 48, 40, .85);
    --glass-line: rgba(255, 255, 255, .09);
    --shadow: 0 20px 60px -20px rgba(0, 0, 0, .7);

    --sky1: #040b17; --sky2: #0c2433; --sky3: #183c3a; --stars: .9;
    --far: #142c35; --far-snow: #2b4750;
    --mid: #153a2c; --near: #184833; --fore: #10321f; --fore-pine: #0a2416;
    --tower: #c5d6cf; --tower-edge: #3d564d;
    --panel: #1c4062; --panel-line: #5d93ba;
    --pine: #0f3a26; --plant: #3a5049; --bubble: rgba(200, 230, 220, .5);
    --shell: #b58358; --shell-in: #3a2c20; --carbon: #0b0f0e;
    --deep: #0b241d;
  }
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.15; margin: 0; }

/* Drifting colour glow behind the content */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora i {
  position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%;
  filter: blur(90px); opacity: .22; animation: drift 34s ease-in-out infinite alternate;
}
.aurora i:nth-child(1) { background: var(--accent); left: -12vmax; top: 30vh; }
.aurora i:nth-child(2) { background: var(--accent2); right: -14vmax; top: 80vh; animation-duration: 42s; }
.aurora i:nth-child(3) { background: var(--sun); left: 30vw; top: 140vh; opacity: .14; animation-duration: 50s; }
@keyframes drift { to { transform: translate(8vmax, -14vmax) scale(1.15); } }

/* ===== Nav ===== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px max(16px, calc((100vw - 1100px) / 2));
  transition: background .3s, box-shadow .3s, padding .3s;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 1px 0 var(--line); padding-top: 11px; padding-bottom: 11px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; }
.nav nav { display: flex; gap: 26px; }
.nav nav a { color: var(--text); opacity: .75; text-decoration: none; font-size: 15px; font-weight: 500; }
.nav nav a:hover { opacity: 1; color: var(--accent); }

/* ===== Hero / scene ===== */
.hero {
  position: relative; overflow: hidden;
  min-height: max(100svh, 640px);
  padding-bottom: calc(max(31vw, 36vh) * .55);
  display: flex; align-items: flex-start;
}
.scene { position: absolute; inset: 0; }
.sky { position: absolute; inset: 0; background: linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 55%, var(--sky3) 100%); }
.stars { position: absolute; left: 0; top: 0; width: 100%; height: 65%; opacity: var(--stars); }
.stars circle { animation: twinkle 4s ease-in-out infinite; }
.stars circle:nth-child(3n) { animation-delay: -1.3s; }
.stars circle:nth-child(3n+1) { animation-delay: -2.6s; }
@keyframes twinkle { 50% { opacity: .3; } }

.sun { position: absolute; right: 13%; top: 15%; width: 120px; height: 120px; will-change: transform; }
.sun span {
  display: block; width: 100%; height: 100%; border-radius: 50%;
  background: radial-gradient(circle, var(--sun) 0 40%, color-mix(in srgb, var(--sun) 40%, transparent) 48%, transparent 70%);
  box-shadow: 0 0 140px 50px color-mix(in srgb, var(--sun) 30%, transparent);
  animation: breathe 6s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(1.07); } }

svg.layer { position: absolute; left: -4%; width: 108%; bottom: 0; height: max(31vw, 36vh); will-change: transform; }
.turbine .tower { fill: var(--tower); stroke: var(--tower-edge); stroke-width: .8; }
.turbine .blades { fill: var(--tower); stroke: var(--tower-edge); stroke-width: .6; animation: spin 6s linear infinite; }
.turbine .hub { fill: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.bubbles circle { animation: rise 3.6s ease-in infinite; }
.bubbles circle:nth-child(2) { animation-delay: 1.2s; }
.bubbles circle:nth-child(3) { animation-delay: 2.4s; }
@keyframes rise { 0% { transform: translateY(0); opacity: .9; } 100% { transform: translateY(-46px); opacity: 0; } }
.glint { animation: glint 7s ease-in-out infinite; }
@keyframes glint { 0%, 60% { transform: translateX(0); opacity: 0; } 70% { opacity: 1; } 100% { transform: translateX(260px); opacity: 0; } }

.motes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fade { position: absolute; left: 0; right: 0; bottom: 0; height: 14vh; background: linear-gradient(transparent, var(--bg)); }

.hero-text {
  position: relative; z-index: 2; max-width: 660px;
  margin: clamp(110px, 17vh, 190px) 16px 0 max(16px, calc((100vw - 1100px) / 2));
  will-change: transform, opacity;
}
.eyebrow { color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 14px; }
.hero h1 { font-size: clamp(46px, 7.4vw, 92px); letter-spacing: -.035em; font-weight: 800; }
.tagline { font-size: clamp(20px, 2.4vw, 28px); font-weight: 600; margin: 10px 0 0; letter-spacing: -.01em; }
.hl { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { color: var(--muted); font-size: 17px; margin: 18px 0 28px; max-width: 54ch; }

.scroll-cue {
  position: absolute; left: 50%; bottom: 26px; z-index: 3; translate: -50% 0;
  width: 28px; height: 44px; border-radius: 16px; border: 2px solid rgba(255, 255, 255, .85);
}
.scroll-cue span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: #fff; animation: cue 1.8s ease-in-out infinite; }
@keyframes cue { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(16px); opacity: 0; } }

/* ===== Buttons ===== */
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-block; padding: 13px 22px; border-radius: 999px; font-weight: 600;
  text-decoration: none; border: 1.5px solid transparent; overflow-wrap: anywhere;
  transition: transform .2s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; box-shadow: 0 10px 30px -10px var(--accent); }
.btn.ghost { color: var(--text); background: var(--glass); border-color: var(--glass-line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.btn.light { background: #fff; color: #0d4d3d; }
.btn.outline { color: #fff; border-color: rgba(255, 255, 255, .55); }
.btn.outline:hover { background: rgba(255, 255, 255, .1); }

/* ===== Sections ===== */
main { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.block { padding: 80px 0 40px; }
.block h2 {
  font-size: clamp(34px, 4.6vw, 52px); font-weight: 800; letter-spacing: -.03em;
  display: flex; align-items: baseline; gap: 16px; margin-bottom: 44px;
}
.num { font-size: 14px; font-weight: 700; color: var(--accent); letter-spacing: .1em; font-variant-numeric: tabular-nums; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; padding: 30px 0 20px; }
.stat { border-left: 2px solid var(--line); padding-left: 20px; }
.stat b {
  display: block; font-size: clamp(30px, 3.8vw, 46px); font-weight: 800; letter-spacing: -.03em; line-height: 1.1;
  background: linear-gradient(120deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums;
}
.stat > span { color: var(--muted); font-size: 14px; display: block; margin-top: 6px; }
.stat:nth-child(2) { transition-delay: .1s; }
.stat:nth-child(3) { transition-delay: .2s; }
.stat:nth-child(4) { transition-delay: .3s; }

/* Timeline */
.timeline { position: relative; }
.timeline::before, .timeline::after {
  content: ""; position: absolute; left: 219px; top: 10px; bottom: 30px; width: 2px; border-radius: 2px;
}
.timeline::before { background: var(--line); }
.timeline::after {
  background: linear-gradient(var(--accent), var(--accent2), var(--sun));
  transform-origin: top; transform: scaleY(var(--p, 1)); box-shadow: 0 0 14px var(--accent);
}
.entry { position: relative; display: grid; grid-template-columns: 200px 1fr; gap: 40px; padding-bottom: 56px; }
.entry::before {
  content: ""; position: absolute; left: 213px; top: 8px; z-index: 1; width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 18%, transparent), 0 0 20px var(--accent);
}
.meta { text-align: right; padding-top: 2px; }
.when { display: block; font-weight: 700; color: var(--accent); font-size: 14px; }
.where { display: block; color: var(--muted); font-size: 14px; }
.body h3 { font-size: 26px; letter-spacing: -.02em; }
.role { color: var(--muted); margin: 4px 0 0; font-style: italic; }
.body ul, .tilt-text ul { margin: 16px 0 0; padding-left: 20px; }
.body li, .tilt-text li { margin-bottom: 8px; }
li::marker { color: var(--accent); }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tags span {
  font-size: 13px; padding: 5px 13px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-line); color: var(--text);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.float span { animation: bob 6s ease-in-out infinite; }
.float span:nth-child(3n) { animation-delay: -2s; }
.float span:nth-child(3n+1) { animation-delay: -4s; }
.float span:nth-child(2n) { animation-duration: 7.5s; }
@keyframes bob { 50% { transform: translateY(-4px); } }

/* 3D tilt card */
.tilt { perspective: 1200px; }
.tilt-inner {
  position: relative; display: grid; grid-template-columns: minmax(280px, .9fr) 1.1fr; gap: 40px; align-items: center;
  padding: 40px; border-radius: 30px;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
.tilt-inner::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--shadow);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.tilt.active .tilt-inner { transition: transform .1s linear; }
.glare {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, .35), transparent 55%);
  transform: translateZ(1px);
}
.tilt.active .glare { opacity: 1; }
.depth-art { position: relative; height: 290px; transform-style: preserve-3d; }
.plane {
  position: absolute; width: 150px; padding: 16px 14px 12px; border-radius: 22px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--glass-strong); border: 1px solid var(--glass-line); box-shadow: var(--shadow);
  animation: hover 7s ease-in-out infinite;
}
.plane svg { width: 92px; height: 92px; }
.plane small { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.p1 { left: 0; top: 0; transform: translateZ(20px) rotate(-6deg); }
.p2 { left: calc(50% - 75px); top: 60px; transform: translateZ(70px); animation-delay: -2.3s; }
.p3 { right: 0; top: 120px; transform: translateZ(120px) rotate(5deg); animation-delay: -4.6s; }
@keyframes hover { 50% { translate: 0 -8px; } }
.tilt-text { position: relative; transform: translateZ(50px); }
.kicker { color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 8px; }
.tilt-text h3 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -.02em; }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.skill-group:nth-child(2) { transition-delay: .12s; }
.skill-group:nth-child(3) { transition-delay: .24s; }
.skill-group h3 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }

/* Education */
.edu h3 { font-size: 24px; letter-spacing: -.02em; margin-bottom: 12px; }
.edu h3 .where { display: inline; margin-left: 10px; font-weight: 400; }
.degree { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 17px; }
.degree .when { display: inline; }
.courses { color: var(--muted); margin: 16px 0 0; }

/* Contact */
.contact { position: relative; margin-top: 150px; background: var(--deep); color: #e6f4ee; }
.wave { position: absolute; left: 0; bottom: 100%; width: 100%; height: 120px; display: block; }
.contact-inner { max-width: 820px; margin: 0 auto; padding: 10px 16px 40px; text-align: center; }
.contact h2 { font-size: clamp(30px, 4.4vw, 48px); letter-spacing: -.03em; font-weight: 800; }
.contact p { color: rgba(230, 244, 238, .75); margin: 12px 0 26px; }
.contact .cta { justify-content: center; }
.contact .foot { font-size: 13px; margin: 60px 0 0; color: rgba(230, 244, 238, .5); }

/* CO2 molecule (CSS 3D) */
.mol-wrap { position: relative; height: 150px; perspective: 700px; display: grid; place-items: center; margin-bottom: 10px; }
.mol { position: relative; width: 0; height: 0; transform-style: preserve-3d; animation: molspin 12s linear infinite; }
@keyframes molspin { from { transform: rotateX(-16deg) rotateY(0deg); } to { transform: rotateX(-16deg) rotateY(360deg); } }
.atom {
  position: absolute; width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  border-radius: 50%; translate: var(--x) 0 0; animation: face 12s linear infinite;
}
@keyframes face { from { transform: rotateY(0deg); } to { transform: rotateY(-360deg); } }
.atom.o { --s: 46px; background: radial-gradient(circle at 34% 30%, #ffb3a4, #d9493c 55%, #6e1a14); box-shadow: 0 0 26px rgba(255, 110, 90, .35); }
.atom.c { --s: 40px; background: radial-gradient(circle at 34% 30%, #a9b8b2, #33433d 60%, #0e1513); box-shadow: 0 0 22px rgba(120, 220, 180, .3); }
.bond { position: absolute; top: -6px; width: 62px; height: 3px; border-radius: 2px; background: rgba(230, 244, 238, .75); box-shadow: 0 9px 0 rgba(230, 244, 238, .75); }
.b1 { left: -62px; }
.b2 { left: 0; }
.mol-label { position: absolute; bottom: 0; font-size: 13px; letter-spacing: .14em; color: rgba(230, 244, 238, .6); }

/* Scroll reveal (only when JS runs) */
html.js .reveal {
  opacity: 0; transform: perspective(900px) translateY(40px) rotateX(10deg);
  transition: opacity .9s ease, transform 1s cubic-bezier(.2, .7, .2, 1);
}
html.js .reveal.in { opacity: 1; transform: none; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); row-gap: 32px; }
  .skills { grid-template-columns: 1fr; gap: 28px; }
  .tilt-inner { grid-template-columns: 1fr; padding: 28px; }
  .depth-art { height: 250px; max-width: 420px; width: 100%; margin: 0 auto; }
}
@media (max-width: 760px) {
  .timeline::before, .timeline::after { left: 6px; }
  .entry { grid-template-columns: 1fr; gap: 4px; padding-left: 36px; padding-bottom: 44px; }
  .entry::before { left: 0; top: 4px; }
  .meta { text-align: left; display: flex; gap: 12px; flex-wrap: wrap; }
  .body h3 { font-size: 22px; }
}
@media (max-width: 600px) {
  .nav nav { display: none; }
  .lede { font-size: 16px; }
  .sun { width: 80px; height: 80px; top: 11%; right: 8%; }
  .stats { gap: 22px 16px; }
  .stat { padding-left: 14px; }
  .tilt-inner { padding: 22px 18px; }
  .plane { width: 120px; }
  .plane svg { width: 70px; height: 70px; }
  .p2 { left: calc(50% - 60px); }
  .edu h3 .where { display: block; margin: 4px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  html.js .reveal { opacity: 1; transform: none; }
}

/* About + "What I bring" */
.about { display: grid; grid-template-columns: 1.5fr 1fr; gap: 48px; align-items: start; }
.about-text p { margin: 0 0 16px; color: var(--muted); font-size: 17px; }
.about-text .about-lead { color: var(--text); font-size: clamp(19px, 2vw, 22px); font-weight: 600; line-height: 1.5; letter-spacing: -.01em; }
.about-text strong { color: var(--accent); }
.bring {
  position: relative; padding: 28px; border-radius: 26px;
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--shadow);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.bring h3 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.bring-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.bring-item:last-child { border-bottom: 0; padding-bottom: 0; }
.bring-item b { display: block; font-size: 16px; }
.bring-item span { color: var(--muted); font-size: 14px; }
.context { color: var(--muted); margin: 10px 0 0; max-width: 70ch; }
.body li strong, .tilt-text li strong { color: var(--text); }
@media (max-width: 900px) { .about { grid-template-columns: 1fr; gap: 28px; } }

/* Email menu in the contact section */
.email-menu { position: relative; display: inline-block; }
.email-menu .caret { font-size: .8em; margin-left: 2px; display: inline-block; transition: transform .2s; }
.email-menu.open .caret { transform: rotate(180deg); }
.email-options {
  position: absolute; left: 50%; top: calc(100% + 10px); z-index: 30; min-width: 230px;
  translate: -50% 0; padding: 6px; border-radius: 16px; text-align: left;
  background: #ffffff; box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .45);
  animation: menu-in .18s ease-out;
}
.email-options[hidden] { display: none; }
.email-options a, .email-options button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 14px; border: 0; border-radius: 11px;
  background: none; color: #10231c; font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.email-options a:hover, .email-options button:hover, .email-options a:focus-visible, .email-options button:focus-visible {
  background: #e1f3ec; color: #0d4d3d; outline: none;
}
.email-options .copied { color: #0e7a5f; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-color-scheme: dark) {
  .email-options { background: #13241e; box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .8); border: 1px solid rgba(255, 255, 255, .08); }
  .email-options a, .email-options button { color: #e3f1ea; }
  .email-options a:hover, .email-options button:hover, .email-options a:focus-visible, .email-options button:focus-visible { background: #1d3d32; color: #fff; }
  .email-options .copied { color: #3fd19b; }
}

/* Company / university links: look like headings, reveal they're links on hover */
.co-link { color: inherit; text-decoration: none; background-image: linear-gradient(var(--accent), var(--accent)); background-size: 0 2px; background-position: 0 100%; background-repeat: no-repeat; transition: background-size .25s, color .2s; }
.co-link:hover, .co-link:focus-visible { color: var(--accent); background-size: 100% 2px; outline: none; }
.co-link .ext { font-size: .6em; margin-left: 4px; vertical-align: super; color: var(--accent); opacity: .7; }
.degree .co-link { font-weight: inherit; }
