/* ─────────────────────────────────────────────────────
   RESET & TOKENS
───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --black:    #000000;
  --d1:       #0a0a0f;
  --d2:       #111118;
  --d3:       #1a1a24;
  --t1:       #f5f5f7;   /* Apple primary text  */
  --t2:       #86868b;   /* Apple secondary text */
  --t3:       #3a3a3d;
  --blue:     #0071e3;
  --cyan:     #00c7ff;
  --glow:     rgba(0,199,255,.14);
  --serif:    'Cormorant Garamond', Georgia, serif;
  --sans:     'DM Sans', sans-serif;
  --mono:     'JetBrains Mono', monospace;
}

html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--sans);
  background: var(--black);
  color: var(--t1);
  overflow-x: hidden;
}

/* ─────────────────────────────────────────────────────
   NAV
───────────────────────────────────────────────────── */
#nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: 3.25rem;
  padding: 0 5vw;
  display: flex; align-items: center; justify-content: space-between;
  transition: background .4s, backdrop-filter .4s;
}
#nav.scrolled {
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.nav-logo {
  font-family: var(--serif); font-size: 1rem; font-weight: 300;
  letter-spacing: .06em; color: var(--t1); text-decoration: none;
  opacity: 0; transition: opacity .3s;
  position: relative; z-index: 1;
}
#nav.scrolled .nav-logo { opacity: 1; }

/* Glow behind the "AT" logo, sized in em so it scales with the logo's
   own font-size at any breakpoint instead of a fixed px box. Sprite
   sheet is a 5x7 grid of 51x51 frames (32 real frames — the last 3
   grid cells are transparent padding, never indexed by JS), so
   background-size 500% 700% shows exactly one frame per container. */
.nav-logo-wrap {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
}
.nav-logo-sprite {
  position: absolute;
  /* container slightly larger than the glyph box, in em so it
     tracks the logo's font-size at any breakpoint. */
  width: 2.6em; height: 2.6em;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s;
  background-image: url('img/sprite.png');
  background-size: 500% 700%;
  background-repeat: no-repeat;
  background-position: 0% 0%;
  mix-blend-mode: screen;
  /* Circular shape with a soft feathered edge is baked into each
     frame's own alpha channel in img/sprite.png, rather than built
     here with mask-image/border-radius. */
}
#nav.scrolled .nav-logo-sprite { opacity: .38; }

.nav-links { display: flex; gap: 1.75rem; list-style: none; }
.nav-links a {
  font-size: .72rem; font-weight: 400; letter-spacing: .04em;
  color: rgba(245,245,247,.65); text-decoration: none; transition: color .2s;
}
.nav-links a:hover { color: var(--t1); }

.lang-pill {
  position: relative;
  display: flex; gap: .1rem; align-items: center;
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 2rem; padding: .18rem .28rem;
}
/* glass capsule that glides between EN/DE, position set via JS */
.lang-droplet {
  position: absolute;
  top: .18rem; bottom: .18rem; left: .28rem;
  width: 2.2rem;  /* overridden by JS */
  border-radius: 1rem;
  background: linear-gradient(155deg, rgba(255,255,255,.16), rgba(255,255,255,.06));
  border: 1px solid rgba(255,255,255,.2);
  box-shadow:
    0 1px 1px rgba(255,255,255,.16) inset,
    0 -1px 1px rgba(0,0,0,.2) inset,
    0 2px 6px rgba(0,0,0,.2);
  pointer-events: none;
  /* Liquid easing — slight overshoot for a "droplet settling" feel */
  transition: left .42s cubic-bezier(.34,1.56,.5,1),
              width .42s cubic-bezier(.34,1.56,.5,1);
}
.lang-btn {
  position: relative; z-index: 1;
  /* resets native iOS button chrome, which otherwise shows through */
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  font-size: .68rem; font-weight: 500; letter-spacing: .06em;
  padding: .2rem .52rem; border-radius: 1rem;
  border: none; background: transparent; box-shadow: none;
  color: rgba(245,245,247,.45); cursor: pointer;
  font-family: var(--sans);
  transition: color .25s ease;
  white-space: nowrap;
}
.lang-btn.on { color: #fff; }

/* ─────────────────────────────────────────────────────
   HERO
───────────────────────────────────────────────────── */
#hero {
  position: relative; width: 100%; height: 100vh; min-height: 36rem;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  overflow: hidden;
  /* Initial background — JS updates this gradient every frame for surge animation */
  background: linear-gradient(to bottom, #000000 0%, #000a18 45%, #001530 100%);
}

#wave-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }

.hero-body { position: relative; z-index: 3; text-align: center; padding: 0 5vw; }

.hero-eyebrow {
  font-size: .72rem; font-weight: 400; letter-spacing: .2em;
  text-transform: uppercase; color: var(--cyan);
  margin-bottom: 1.4rem;
  opacity: 0; transform: translateY(1.5em);
  animation: up .8s ease .25s forwards;
  text-shadow:
    0 0 0.4em rgba(0,0,0,.98),
    0 0 1.2em rgba(0,0,0,.80),
    0 0 2.5em rgba(0,0,0,.50);
}
.hero-name {
  font-family: var(--serif);
  font-size: clamp(3.2rem, 8.5vw, 7.5rem);
  font-weight: 300; letter-spacing: -.02em; line-height: 1;
  color: var(--t1); margin-bottom: .85rem;
  opacity: 0; transform: translateY(0.35em);
  animation: up .9s ease .45s forwards;
  text-shadow:
    0 0 0.08em rgba(0,0,0,.95),
    0 0 0.18em rgba(0,0,0,.85),
    0 0 0.35em rgba(0,0,0,.75),
    0 0 0.62em rgba(0,0,0,.55),
    0 0 1.00em rgba(0,0,0,.30);
}
.hero-sub {
  font-size: clamp(.85rem, 1.8vw, 1.1rem);
  font-weight: 300; letter-spacing: .07em; color: var(--t2);
  margin-bottom: 2.5rem;
  opacity: 0; transform: translateY(1.5em);
  animation: up .8s ease .75s forwards;
  text-shadow:
    0 0 0.4em rgba(0,0,0,.98),
    0 0 1.0em rgba(0,0,0,.85),
    0 0 2.0em rgba(0,0,0,.65),
    0 0 3.7em rgba(0,0,0,.40);
}
.hero-btns {
  display: flex; align-items: center; justify-content: center; gap: .85rem;
  flex-wrap: wrap;
  opacity: 0; animation: up .8s ease 1.05s forwards;
}

.btn-solid {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .68rem 1.5rem;
  background: linear-gradient(155deg, rgba(70,160,255,.4), rgba(0,100,230,.24));
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  color: #fff;
  border: 1px solid rgba(140,200,255,.42);
  border-radius: 2rem; font-size: .8rem; font-weight: 500;
  letter-spacing: .02em; text-decoration: none;
  box-shadow:
    0 1px 1px rgba(220,240,255,.3) inset,
    0 -1px 6px rgba(0,40,100,.35) inset,
    0 3px 9px rgba(0,90,220,.26),
    0 1px 2px rgba(0,0,0,.25);
  transition: transform .2s ease, box-shadow .25s ease, background .25s ease, border-color .2s;
}
.btn-solid:hover {
  background: linear-gradient(155deg, rgba(90,175,255,.5), rgba(0,110,240,.32));
  border-color: rgba(160,210,255,.55);
  transform: translateY(-1px);
  box-shadow:
    0 1px 1px rgba(220,240,255,.4) inset,
    0 -1px 6px rgba(0,40,100,.35) inset,
    0 5px 14px rgba(0,100,230,.34),
    0 2px 4px rgba(0,0,0,.25);
}
.btn-solid:active { transform: translateY(0); }

.btn-outline {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .68rem 1.5rem;
  background: linear-gradient(155deg, rgba(200,225,255,.14), rgba(200,225,255,.04));
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(210,230,255,.26); color: #eaf2fb;
  border-radius: 2rem; font-size: .8rem; font-weight: 400;
  letter-spacing: .02em; text-decoration: none;
  box-shadow:
    0 1px 1px rgba(255,255,255,.1) inset,
    0 3px 8px rgba(0,10,30,.26);
  transition: transform .2s ease, box-shadow .25s ease, background .2s, border-color .2s;
}
.btn-outline:hover {
  background: linear-gradient(155deg, rgba(210,230,255,.2), rgba(210,230,255,.07));
  border-color: rgba(220,235,255,.42);
  transform: translateY(-1px);
  box-shadow:
    0 1px 1px rgba(255,255,255,.16) inset,
    0 5px 13px rgba(0,15,40,.32);
}
.btn-outline:active { transform: translateY(0); }

.scroll-hint {
  position: absolute; bottom: 2.25rem; left: 0; right: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: .45rem;
  opacity: 0; animation: up .8s ease 1.5s forwards;
}
.scroll-hint span {
  font-size: .6rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--cyan); text-shadow: 0 0 10px rgba(0,199,255,.45);
}
.scroll-line {
  width: 1px; height: 2.5rem;
  background: linear-gradient(to bottom, var(--cyan), transparent);
  animation: pulse 2s ease infinite;
}



/* ─────────────────────────────────────────────────────
   SECTION COMMON
───────────────────────────────────────────────────── */
section { padding: clamp(5rem,10vw,9rem) 5vw; }

.s-label {
  font-size: .68rem; font-weight: 400; letter-spacing: .2em;
  text-transform: uppercase; color: var(--cyan); margin-bottom: .9rem;
}
.s-title {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  font-weight: 300; letter-spacing: -.02em; line-height: 1.1;
  color: var(--t1); margin-bottom: 1.25rem;
}

.reveal { opacity: 0; transform: translateY(2rem); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }
.d1 { transition-delay: .1s; }
.d2 { transition-delay: .2s; }
.d3 { transition-delay: .3s; }
.d4 { transition-delay: .4s; }

/* ─────────────────────────────────────────────────────
   ABOUT
───────────────────────────────────────────────────── */
#about { background: var(--d1); }
.about-wrap { max-width: 860px; margin: 0 auto; }

.about-quote {
  font-family: var(--serif);
  font-size: clamp(1.45rem, 3.2vw, 2.6rem);
  font-weight: 300; line-height: 1.45;
  color: var(--t1); font-style: italic; margin-bottom: 2rem;
}
.about-quote em { color: var(--cyan); font-style: normal; }

.about-text {
  font-size: 1rem; font-weight: 300; line-height: 1.85;
  color: var(--t2); max-width: 660px; margin-bottom: 2rem;
}

.about-links { display: flex; flex-wrap: wrap; gap: .7rem; }

/* ─────────────────────────────────────────────────────
   STATS
───────────────────────────────────────────────────── */
#stats { background: var(--black); padding: clamp(3.5rem,7vw,6rem) 5vw; }

.stats-grid {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 1px; background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 1.1rem; overflow: hidden;
}
.stat {
  background: var(--d1);
  padding: 2.75rem 1.75rem; text-align: center;
}
.stat-n {
  font-family: var(--serif);
  font-size: clamp(2.4rem,3.8vw,3.8rem);
  font-weight: 300; line-height: 1; color: var(--t1);
  margin-bottom: .45rem; white-space: nowrap;
}
.stat-n .c { color: var(--cyan); }
.stat-l {
  font-size: .72rem; font-weight: 300; letter-spacing: .03em;
  color: var(--t2); line-height: 1.45;
}

/* ─────────────────────────────────────────────────────
   EXPERIENCE
───────────────────────────────────────────────────── */
#experience { background: var(--d1); }
.exp-wrap { max-width: 880px; margin: 0 auto; }

.exp-card {
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 1.25rem; padding: 2.5rem;
  background: rgba(255,255,255,.018);
}
.exp-head {
  display: flex; align-items: flex-start;
  justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  padding-bottom: 1.5rem; margin-bottom: 1.75rem;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.exp-org-name { font-size: .7rem; font-weight: 400; letter-spacing: .1em; text-transform: uppercase; color: var(--cyan); margin-bottom: .35rem; }
.exp-role { font-family: var(--serif); font-size: 1.75rem; font-weight: 300; color: var(--t1); }
.exp-period { font-family: var(--mono); font-size: .7rem; color: var(--t2); white-space: nowrap; }

.exp-list { list-style: none; display: flex; flex-direction: column; gap: .85rem; }
.exp-list li {
  display: flex; align-items: flex-start; gap: .7rem;
  font-size: .88rem; font-weight: 300; line-height: 1.65; color: var(--t2);
}
.exp-list li::before {
  content: ''; width: 4px; height: 4px; border-radius: 50%;
  background: var(--cyan); flex-shrink: 0; margin-top: .58rem;
}
.exp-list strong { color: var(--t1); font-weight: 500; }

/* ─────────────────────────────────────────────────────
   PUBLICATIONS
───────────────────────────────────────────────────── */
#publications { background: var(--black); }
.pub-list { display: flex; flex-direction: column; gap: 1.5rem; margin-top: 3rem; }

.pub-card {
  display: grid; grid-template-columns: 1fr 1fr;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 1.25rem; overflow: hidden;
  background: var(--d2); min-height: 22.5rem;
  text-decoration: none; color: inherit;
  transition: background .25s, border-color .25s, transform .25s;
}
.pub-card:hover { background: rgba(255,255,255,.022); border-color: rgba(0,199,255,.18); transform: translateY(-2px); }
.pub-card.flip { direction: rtl; }
.pub-card.flip > * { direction: ltr; }

.pub-info { padding: 2.75rem; display: flex; flex-direction: column; }
.pub-journal { font-size: .68rem; font-weight: 400; letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); margin-bottom: .9rem; }
.pub-title { font-family: var(--serif); font-size: 1.4rem; font-weight: 300; line-height: 1.3; color: var(--t1); margin-bottom: 1rem; }
.pub-abstract { font-size: .83rem; font-weight: 300; line-height: 1.72; color: var(--t2); }

.pub-viz { position: relative; overflow: hidden; }
.pub-viz canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ─────────────────────────────────────────────────────
   PROJECTS
───────────────────────────────────────────────────── */
#projects { background: var(--d1); }
.proj-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 1.25rem; margin-top: 3rem; }

.proj-card {
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 1.25rem; padding: 1.85rem;
  background: rgba(255,255,255,.012);
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: .9rem;
  position: relative; overflow: hidden;
  transition: background .25s, border-color .25s, transform .25s;
}
.proj-card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 60%, var(--glow), transparent 70%);
  opacity: 0; transition: opacity .35s;
}
.proj-card:hover { background: rgba(255,255,255,.025); border-color: rgba(0,199,255,.18); transform: translateY(-2px); }
.proj-card:hover::before { opacity: 1; }

.proj-top { display: flex; align-items: center; justify-content: space-between; }
.proj-icon {
  width: 2.4rem; height: 2.4rem; border-radius: .55rem;
  background: rgba(0,199,255,.1); border: 1px solid rgba(0,199,255,.18);
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.proj-gh { color: var(--t3); transition: color .2s; }
.proj-card:hover .proj-gh { color: var(--t2); }

.proj-name { font-family: var(--serif); font-size: 1.1rem; font-weight: 400; color: var(--t1); }
.proj-desc { font-size: .8rem; font-weight: 300; line-height: 1.65; color: var(--t2); flex: 1; }
.proj-tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.tag {
  display: inline-flex; align-items: center; gap: .35rem;
  font-family: var(--mono); font-size: .62rem; color: var(--t2);
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07);
  border-radius: .25rem; padding: .18rem .5rem .18rem .42rem;
}
.tag-ico { width: 12px; height: 12px; flex-shrink: 0; color: var(--cyan); opacity: .85; }

/* ─────────────────────────────────────────────────────
   EDUCATION
───────────────────────────────────────────────────── */
#education { background: var(--black); }
.edu-list { max-width: 660px; margin: 2.5rem auto 0; display: flex; flex-direction: column; gap: 0; }

.edu-item { display: grid; grid-template-columns: 1rem 1fr; gap: 0 1.75rem; padding-bottom: 2.25rem; position: relative; }
.edu-item::after { content: ''; position: absolute; left: .44rem; top: 1.3rem; bottom: 0; width: 1px; background: rgba(255,255,255,.07); }
.edu-item:last-child::after { display: none; }
/* Forces its own compositing layer ahead of the .reveal opacity/transform
   transition, so the diploma button's backdrop-filter blur renders the
   same way throughout the animation instead of only "settling" fully
   once the parent's transition ends (a known backdrop-filter + ancestor
   transform/opacity compositing quirk). */
.edu-item.reveal { will-change: opacity, transform; }

.edu-dot { width: .9rem; height: .9rem; border-radius: 50%; border: 2px solid var(--cyan); background: var(--black); margin-top: .3rem; position: relative; z-index: 1; }
.edu-deg { font-family: var(--serif); font-size: 1.15rem; font-weight: 400; color: var(--t1); margin-bottom: .22rem; }
.edu-school { font-size: .8rem; color: var(--t2); margin-bottom: .22rem; }
.edu-meta { font-family: var(--mono); font-size: .68rem; color: var(--t1); }
.edu-gpa  { font-weight: 700; color: var(--cyan); }

/* ─────────────────────────────────────────────────────
   CONTACT
───────────────────────────────────────────────────── */
#contact { background: var(--d1); text-align: center; position: relative; overflow: hidden; }
.contact-wrap { max-width: 560px; margin: 0 auto; }

.contact-body { font-size: .92rem; font-weight: 300; line-height: 1.75; color: var(--t2); margin-top: .5rem; }
.contact-email {
  font-family: var(--serif); font-size: clamp(1.3rem,2.8vw,2.2rem);
  font-weight: 300; color: var(--t1); text-decoration: none;
  display: inline-block; margin: 1.75rem 0;
  border-bottom: 1px solid rgba(255,255,255,.18); padding-bottom: .15rem;
  transition: color .2s, border-color .2s;
}
.contact-email:hover { color: var(--cyan); border-color: var(--cyan); }
.social-row { display: flex; align-items: center; justify-content: center; gap: .9rem; margin-top: 1.5rem; flex-wrap: wrap; }

.slink {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 2.85rem; height: 2.85rem;
  border-radius: 50%;
  background: linear-gradient(155deg, rgba(0,199,255,.22), rgba(0,140,200,.08));
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(120,225,255,.34);
  color: #cdf3ff;
  text-decoration: none;
  box-shadow:
    0 1px 1px rgba(220,250,255,.2) inset,
    0 -1px 1px rgba(0,40,55,.25) inset,
    0 2px 7px rgba(0,120,170,.22),
    0 1px 2px rgba(0,0,0,.2);
  transition: transform .2s ease, box-shadow .25s ease, background .25s ease, border-color .25s ease, color .2s ease;
}
.slink svg { width: 1.15rem; height: 1.15rem; }
.slink span {
  position: absolute; top: -2.1rem; left: 50%; translate: -50% 0;
  font-family: var(--mono); font-size: .62rem; letter-spacing: .04em;
  color: var(--t2); white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  transform: translateY(.2rem);
}
.slink:hover {
  background: linear-gradient(155deg, rgba(0,199,255,.34), rgba(0,140,200,.14));
  border-color: rgba(140,230,255,.5);
  color: #fff;
  transform: translateY(-2px);
  box-shadow:
    0 1px 1px rgba(220,250,255,.26) inset,
    0 -1px 1px rgba(0,40,55,.25) inset,
    0 5px 13px rgba(0,150,190,.3),
    0 2px 4px rgba(0,0,0,.2);
}
.slink:hover span { opacity: 1; transform: translateY(0); color: var(--t1); }
.slink:active { transform: translateY(-1px); }

/* ─────────────────────────────────────────────────────
   FOOTER
───────────────────────────────────────────────────── */
footer {
  background: var(--black);
  padding: 1.75rem 5vw;
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid rgba(255,255,255,.05);
}
footer p { font-size: .7rem; color: var(--t2); }

/* ─────────────────────────────────────────────────────
   HERO PHOTO
───────────────────────────────────────────────────── */
.hero-photo-wrap {
  position: absolute;
  /* bottom edge lands at the lowest wave trough */
  bottom: 24vh;
  right: 5vw;
  z-index: 1;            /* behind canvas, above background */
  height: 76vh;
  width: auto;
  pointer-events: none;
  user-select: none;
  /* Gives the photo's rotateX/rotateY (idle float + mouse parallax,
     driven from Main.js) an actual sense of depth instead of a flat skew */
  perspective: 1000px;
  /* Bottom fades into waves, top fades into dark sky */
  -webkit-mask-image: linear-gradient(to top,
    transparent  0%,
    rgba(0,0,0,.3) 8%,
    black        22%,
    black        80%,
    transparent 100%);
  mask-image: linear-gradient(to top,
    transparent  0%,
    rgba(0,0,0,.3) 8%,
    black        22%,
    black        80%,
    transparent 100%);
}
.hero-photo {
  height: 100%;
  width: auto;
  display: block;
  filter: brightness(0.9) contrast(1.05);
  /* Transform itself is set every frame from Main.js (idle float +
     smoothed mouse parallax) — will-change keeps it off the main paint path */
  will-change: transform;
}


/* ─────────────────────────────────────────────────────
   HANDSHAKE ANIMATION
───────────────────────────────────────────────────── */
.handshake {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px;   /* matches contact-wrap */
  height: 16vh;
  pointer-events: none;
  overflow: hidden;
  /* Fade all four edges into background — no hard rectangular cutoff */
  -webkit-mask-image: linear-gradient(to right,
    transparent  0%,
    black        18%,
    black        82%,
    transparent 100%),
  linear-gradient(to bottom,
    transparent  0%,
    black        20%,
    black        80%,
    transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right,
    transparent  0%,
    black        18%,
    black        82%,
    transparent 100%),
  linear-gradient(to bottom,
    transparent  0%,
    black        20%,
    black        80%,
    transparent 100%);
  mask-composite: intersect;
}
.hand {
  position: absolute;
  top: 0;
  /* Each hand occupies exactly its own half — never overlaps */
  width: 50%; height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: transform 1.1s cubic-bezier(.4,0,.2,1),
              opacity   1.1s ease;
}
.hand-left {
  left: 0;
  object-position: right center;  /* show the hand side (right of image) */
  transform: translateX(-40%);
}
.hand-right {
  right: 0;
  object-position: left center;   /* show the hand side (left of image) */
  transform: translateX(40%);
}
/* Triggered by IntersectionObserver — class added via JS */
.handshake.shake-in .hand-left,
.handshake.shake-in .hand-right {
  transform: translateX(0);
  opacity: 0.13;                  /* very subtle behind text */
}

/* ─────────────────────────────────────────────────────
   HAMBURGER BUTTON
───────────────────────────────────────────────────── */
.ham-btn {
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; width: 2.2rem; height: 2.2rem;
  background: none; border: none; cursor: pointer; padding: .2rem;
  flex-shrink: 0;
}
.ham-btn span {
  display: block; width: 1.2rem; height: 1px;
  background: var(--t2); border-radius: 1px;
  transition: transform .3s cubic-bezier(.4,0,.2,1),
              opacity   .25s ease,
              background .2s;
}
.ham-btn:hover span { background: var(--t1); }
/* Morphs to × when open */
.ham-btn.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); background: var(--t1); }
.ham-btn.open span:nth-child(2) { opacity: 0; }
.ham-btn.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); background: var(--t1); }

@media (max-width: 900px) {
  .ham-btn { display: flex; }
}

/* ─────────────────────────────────────────────────────
   MOBILE MENU OVERLAY
───────────────────────────────────────────────────── */
#mob-menu {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.94);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
}
#mob-menu.open { opacity: 1; pointer-events: auto; }

.mob-eyebrow {
  position: absolute; top: calc(3.25rem + 1.5rem); left: 5vw;
  font-size: .62rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--cyan); font-family: var(--sans);
}

.mob-close-btn {
  position: absolute; top: .7rem; right: 5vw;
  width: 2.2rem; height: 2.2rem; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: var(--t2); cursor: pointer; font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s, border-color .2s;
}
.mob-close-btn:hover { background: rgba(255,255,255,.12); color: var(--t1); border-color: rgba(255,255,255,.24); }

.mob-nav ul { list-style: none; text-align: center; display: flex; flex-direction: column; gap: 2rem; }
.mob-nav a {
  font-family: var(--serif);
  font-size: clamp(2rem, 9vw, 3.2rem);
  font-weight: 300; letter-spacing: -.01em;
  color: var(--t2); text-decoration: none; display: block;
  opacity: 0; transform: translateY(1.4rem);
  transition: color .2s;
}
.mob-nav a:hover { color: var(--t1); }

/* Stagger in on open — each link slides up with delay */
#mob-menu.open .mob-nav li:nth-child(1) a { opacity: 1; transform: none; transition: opacity .5s .05s ease, transform .5s .05s ease, color .2s; }
#mob-menu.open .mob-nav li:nth-child(2) a { opacity: 1; transform: none; transition: opacity .5s .13s ease, transform .5s .13s ease, color .2s; }
#mob-menu.open .mob-nav li:nth-child(3) a { opacity: 1; transform: none; transition: opacity .5s .21s ease, transform .5s .21s ease, color .2s; }
#mob-menu.open .mob-nav li:nth-child(4) a { opacity: 1; transform: none; transition: opacity .5s .29s ease, transform .5s .29s ease, color .2s; }
#mob-menu.open .mob-nav li:nth-child(5) a { opacity: 1; transform: none; transition: opacity .5s .37s ease, transform .5s .37s ease, color .2s; }

.mob-lang-pill {
  position: absolute; bottom: 2.5rem;
  display: flex; gap: .1rem; align-items: center;
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 2rem; padding: .18rem .28rem;
}

/* ─────────────────────────────────────────────────────
   GLASS BUTTON — Apple-style frosted glass
   Triad: elevation shadow (below) + inner top highlight
   (specular edge) + translateY lift on hover

   Color logic: the neutral variant sits on a near-black
   background (#000 / #0a0a0f). Pure white-tinted glass at
   low opacity reads as "disabled" next to the saturated
   --blue variant in the same row (e.g. LinkedIn/GitHub/
   ORCID/CV). Giving it a cyan tint — already the site's
   secondary accent color (see --cyan, used on .edu-dot) —
   gives it its own identity instead of looking like a
   washed-out copy of the blue button.
───────────────────────────────────────────────────── */
.btn-glass {
  position: relative;
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .44rem 1.05rem;
  background: linear-gradient(155deg, rgba(0,199,255,.2), rgba(0,160,220,.07));
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(120,225,255,.34);
  border-radius: 2rem;
  font-size: .74rem; font-weight: 400; font-family: var(--sans); letter-spacing: .02em;
  color: #d8f7ff; cursor: pointer; text-decoration: none;
  box-shadow:
    0 1px 1px rgba(220,250,255,.18) inset,   /* inner top highlight */
    0 -1px 1px rgba(0,40,55,.25) inset,      /* inner bottom edge, grounds the glass */
    0 2px 7px rgba(0,130,180,.18),           /* tight elevation shadow */
    0 1px 2px rgba(0,0,0,.2);                /* contact shadow */
  transition: transform .2s ease, box-shadow .25s ease, background .25s ease, border-color .25s ease;
}
.btn-glass:hover {
  background: linear-gradient(155deg, rgba(0,199,255,.3), rgba(0,160,220,.12));
  border-color: rgba(140,230,255,.5);
  color: #fff;
  transform: translateY(-1px);
  box-shadow:
    0 1px 1px rgba(220,250,255,.24) inset,
    0 -1px 1px rgba(0,40,55,.25) inset,
    0 4px 11px rgba(0,160,200,.26),
    0 2px 4px rgba(0,0,0,.2);
}
.btn-glass:active {
  transform: translateY(0);
  box-shadow:
    0 1px 1px rgba(220,250,255,.18) inset,
    0 -1px 1px rgba(0,40,55,.3) inset,
    0 1px 4px rgba(0,140,180,.18);
}
.btn-glass--blue {
  background: linear-gradient(155deg, rgba(40,140,255,.32), rgba(0,90,220,.18));
  border-color: rgba(110,180,255,.4);
  color: #eaf4ff;
  box-shadow:
    0 1px 1px rgba(200,230,255,.22) inset,
    0 -1px 1px rgba(0,40,100,.25) inset,
    0 2px 7px rgba(0,70,180,.22),
    0 1px 2px rgba(0,0,0,.2);
}
.btn-glass--blue:hover {
  background: linear-gradient(155deg, rgba(60,155,255,.42), rgba(0,100,230,.26));
  border-color: rgba(130,190,255,.58);
  color: #fff;
  transform: translateY(-1px);
  box-shadow:
    0 1px 1px rgba(210,235,255,.28) inset,
    0 -1px 1px rgba(0,40,100,.25) inset,
    0 4px 11px rgba(0,90,210,.3),
    0 2px 4px rgba(0,0,0,.2);
}
.btn-glass--red {
  background: linear-gradient(155deg, rgba(255,80,100,.26), rgba(190,30,50,.14));
  border-color: rgba(255,110,125,.36);
  color: #ffd9dc;
  box-shadow:
    0 1px 1px rgba(255,200,205,.2) inset,
    0 -1px 1px rgba(90,0,10,.25) inset,
    0 2px 7px rgba(150,0,20,.2),
    0 1px 2px rgba(0,0,0,.2);
}
.btn-glass--red:hover {
  background: linear-gradient(155deg, rgba(255,95,115,.36), rgba(190,30,50,.22));
  border-color: rgba(255,130,145,.55);
  color: #fff0f1;
  transform: translateY(-1px);
  box-shadow:
    0 1px 1px rgba(255,210,215,.26) inset,
    0 -1px 1px rgba(90,0,10,.25) inset,
    0 4px 11px rgba(170,0,25,.3),
    0 2px 4px rgba(0,0,0,.2);
}
/* Violet — denser, more opaque "stays on page" glass (View CV, View diploma, etc.) */
.btn-glass--violet {
  background: linear-gradient(155deg, rgba(170,130,255,.46), rgba(120,80,220,.32));
  border-color: rgba(195,165,255,.5);
  color: #f5efff;
  box-shadow:
    0 1px 1px rgba(230,215,255,.3) inset,
    0 -1px 1px rgba(50,20,100,.25) inset,
    0 2px 7px rgba(100,40,200,.2),
    0 1px 2px rgba(0,0,0,.2);
}
.btn-glass--violet:hover {
  background: linear-gradient(155deg, rgba(185,150,255,.56), rgba(130,90,230,.4));
  border-color: rgba(210,180,255,.65);
  color: #fff;
  transform: translateY(-1px);
  box-shadow:
    0 1px 1px rgba(235,222,255,.36) inset,
    0 -1px 1px rgba(50,20,100,.25) inset,
    0 4px 11px rgba(120,50,220,.3),
    0 2px 4px rgba(0,0,0,.2);
}
.btn-glass:active.btn-glass--blue,
.btn-glass:active.btn-glass--red,
.btn-glass:active.btn-glass--violet { transform: translateY(0); }

.edu-doc-btn {
  margin-top: .75rem;
  /* Roughly half the base .btn-glass alpha — matches how translucent it
     read mid-way through the .reveal fade-in, kept as the resting state
     instead of only appearing during the animation. */
  background: linear-gradient(155deg, rgba(0,199,255,.1), rgba(0,160,220,.035));
  border-color: rgba(120,225,255,.17);
  will-change: backdrop-filter;
}

.exp-doc-row {
  margin-top: 1.5rem; padding-top: 1.2rem;
  border-top: 1px solid rgba(255,255,255,.05);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.exp-doc-note {
  margin: 0;
  font-size: .74rem; color: var(--t2); font-weight: 300;
}

.exp-card--gap {
  margin-top: 1.25rem;
  padding: 1.75rem 2.5rem;
  background: rgba(255,255,255,.01);
}
.exp-card--gap .exp-head {
  padding-bottom: 0; margin-bottom: 1rem; border-bottom: none;
}
.exp-card--gap .exp-role { font-size: 1.3rem; }

.exp-gap-text {
  font-size: .85rem; font-weight: 300; line-height: 1.75;
  color: var(--t2); margin: 0;
}
.exp-gap-text strong { color: var(--t1); font-weight: 500; }
.exp-gap-link {
  color: var(--cyan); text-decoration: underline;
  text-underline-offset: 2px; cursor: pointer;
  transition: color .2s;
}
.exp-gap-link:hover { color: var(--t1); }

.about-link {
  color: var(--cyan); text-decoration: underline;
  text-underline-offset: 2px; cursor: pointer;
  transition: color .2s;
}
.about-link:hover { color: var(--t1); }

/* ─────────────────────────────────────────────────────
   LIGHTBOX
───────────────────────────────────────────────────── */
#lb-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,.82);
  backdrop-filter: blur(10px) saturate(150%);
  -webkit-backdrop-filter: blur(10px) saturate(150%);
  display: flex; align-items: center; justify-content: center; padding: 2vh 2vw;
  opacity: 0; pointer-events: none;
  transition: opacity .28s ease;
}
#lb-overlay.open { opacity: 1; pointer-events: auto; }

.lb-modal {
  background: var(--d1); border: 1px solid rgba(255,255,255,.1);
  border-radius: 1.1rem;
  /* Explicit dimensions in viewport units — works on all screen sizes */
  width: 90vw; height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(1.4rem) scale(.97);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 32px 80px rgba(0,0,0,.65);
}
#lb-overlay.open .lb-modal { transform: translateY(0) scale(1); }

.lb-header {
  padding: 1.1rem 1.5rem; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
}
.lb-header-info { min-width: 0; }
.lb-doc-type {
  font-family: var(--mono); font-size: .6rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--cyan); margin-bottom: .28rem;
}
.lb-doc-title {
  font-family: var(--serif); font-size: 1.1rem; font-weight: 300;
  color: var(--t1); line-height: 1.3; overflow-wrap: break-word;
}
.lb-close-btn {
  width: 1.85rem; height: 1.85rem; border-radius: 50%; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.05);
  color: var(--t2); cursor: pointer; font-size: .9rem; font-family: var(--sans);
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s, border-color .2s; margin-top: .1rem;
}
.lb-close-btn:hover { background: rgba(255,255,255,.13); color: var(--t1); border-color: rgba(255,255,255,.24); }

/* lb-body fills remaining modal space */
.lb-body {
  flex: 1 1 0; min-height: 0; height: 0;
  display: flex; flex-direction: column;
  position: relative; background: var(--d2);
}

/* Loading spinner overlay */
#lb-pdf-loading {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1.2rem; background: var(--d2);
  transition: opacity .3s;
}
#lb-pdf-loading.hidden { opacity: 0; pointer-events: none; }

/* Animated spinner ring */
.lb-spinner {
  width: 2.2rem; height: 2.2rem; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.06);
  border-top-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0,199,255,.25);
  animation: lb-spin .8s linear infinite;
}
.lb-loading-text {
  font-family: var(--mono); font-size: .6rem;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--t3);
  animation: lb-pulse 1.6s ease-in-out infinite;
}
@keyframes lb-pulse { 0%,100% { opacity:.35; } 50% { opacity:1; } }

/* Scrollable viewer — vertical + horizontal for zoomed docs */
#lb-pdf-viewer {
  flex: 1 1 0; min-height: 0;
  overflow-y: auto; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--d2);
}

/* Custom scrollbar — site palette */
#lb-pdf-viewer::-webkit-scrollbar { width: .35rem; height: .35rem; }
#lb-pdf-viewer::-webkit-scrollbar-track { background: transparent; }
#lb-pdf-viewer::-webkit-scrollbar-thumb {
  background: rgba(0,199,255,.22);
  border-radius: 1rem;
}
#lb-pdf-viewer::-webkit-scrollbar-thumb:hover {
  background: rgba(0,199,255,.45);
}
/* Firefox */
#lb-pdf-viewer { scrollbar-width: thin; scrollbar-color: rgba(0,199,255,.25) transparent; }

/* Pages stacked vertically, centred */
.lb-pdf-pages {
  display: flex; flex-direction: column;
  align-items: center;
  gap: .75rem; padding: 1.25rem;
}

/* Each page — white card */
.lb-page-wrap {
  background: #fff; border-radius: .2rem;
  overflow: hidden; line-height: 0; flex-shrink: 0;
  box-shadow: 0 4px 24px rgba(0,0,0,.55);
}
.lb-page-wrap canvas { display: block; }

@keyframes lb-spin { to { transform: rotate(360deg); } }

.lb-footer {
  padding: .85rem 1.5rem; flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center;
  justify-content: space-between; gap: .55rem;
}
.lb-zoom-controls {
  display: flex; align-items: center; gap: .4rem;
}
.lb-zoom-btn {
  width: 2rem; height: 2rem; border-radius: .5rem;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  color: var(--t2); font-size: 1.1rem; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s;
}
.lb-zoom-btn:hover { background: rgba(255,255,255,.12); color: var(--t1); }
.lb-zoom-level {
  font-family: var(--mono); font-size: .62rem;
  color: var(--t3); letter-spacing: .08em;
  min-width: 2.8rem; text-align: center;
}
.lb-footer-actions { display: flex; align-items: center; gap: .55rem; }

@media (max-width: 600px) {
  #lb-overlay { padding: 0; align-items: flex-end; }
  .lb-modal { max-height: 100dvh; height: 100dvh; width: 100%; border-radius: 0; border-left: none; border-right: none; }
  .lb-header { padding: .9rem 1rem; }
  .lb-footer { padding: .7rem 1rem; }
}

/* ─────────────────────────────────────────────────────
   KEYFRAMES
───────────────────────────────────────────────────── */

/* ─────────────────────────────────────────────────────
   ABOUT — FRACTAL CANVAS
───────────────────────────────────────────────────── */
#about { position: relative; }
#fractal-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}
#about .about-wrap { position: relative; z-index: 1; }

/* ─────────────────────────────────────────────────────
   EDUCATION — SVG MATH BACKGROUND (scroll parallax)
───────────────────────────────────────────────────── */
#education { position: relative; overflow: hidden; }
.edu-bg-math {
  position: absolute;
  /* Extend 40% beyond top/bottom so parallax translateY never leaves a gap */
  top: -40%; bottom: -40%; left: 0; right: 0;
  background: url('img/math.png') 0 0 / 900px auto repeat;
  opacity: .09;
  filter: invert(1) sepia(1) saturate(2) hue-rotate(185deg);
  pointer-events: none; z-index: 0;
  will-change: transform;
}
#education .s-label,
#education .s-title,
#education .edu-list { position: relative; z-index: 1; }

@keyframes up   { to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }

/* ─────────────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .pub-card { grid-template-columns: 1fr; }
  .pub-card.flip { direction: ltr; }
  .pub-viz { min-height: 12.5rem; }
  .proj-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  /* On tablet: shorter */
  .hero-photo-wrap { height: 65vh; right: 2vw; }
}
@media (max-width: 480px) {
  footer { flex-direction: column; gap: .4rem; text-align: center; }

  /* On mobile: photo narrow strip on right, very subtle — text stays readable */
  .hero-photo-wrap {
    height: 52vh;
    bottom: 20vh;
    right: 0;
    opacity: 0.5;
  }

  /* Reduced cell padding so numbers don't overflow in the 2-col layout */
  .stat { padding: 1.85rem 1.1rem; }

  /* Tighter padding on small screens */
  .exp-card { padding: 1.5rem; }
  .exp-role { font-size: 1.4rem; }

  /* Reduced padding — card is already 1-col at ≤900px */
  .pub-info { padding: 1.75rem; }
}

/* Lightbox on very narrow phones */
@media (max-width: 380px) {
  .lb-doc-title { font-size: .95rem; }
}

/* ─────────────────────────────────────────────────────
   ART DIRECTION — PORTRAIT (phone & tablet vertical)
   Completely different photo composition:
   top edge = language switcher level (nav height)
   bottom edge = midpoint between eyebrow and h1
───────────────────────────────────────────────────── */
@media (max-width: 900px) and (orientation: portrait) {
  .hero-photo-wrap {
    top: 3.25rem;
    bottom: auto;
    height: calc(46vh - 3.25rem);
    right: 0;
    width: auto;
    opacity: 1;
    -webkit-mask-image: linear-gradient(to bottom,
      transparent  0%,
      black        12%,
      black        72%,
      transparent 100%);
    mask-image: linear-gradient(to bottom,
      transparent  0%,
      black        12%,
      black        72%,
      transparent 100%);
  }

  .hero-photo {
    height: 100%;
    width: auto;
  }
}

/* ─────────────────────────────────────────────────────
   ART DIRECTION — LANDSCAPE PHONE
   Phones in landscape are always ≤500px tall (tablets are not).
   Same top-anchor logic as portrait, but photo is wider
   relative to the short viewport and sits right of the text.
───────────────────────────────────────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-photo-wrap {
    top: 3.25rem;
    bottom: auto;
    /* Width-based sizing for landscape:
       right edge ≈ right end of "Tregubov" (~86% from left = 14vw from right)
       width ≈ span from right end of "München, Germany" to right end of "Tregubov" (~26vw) */
    right: 14vw;
    width: 26vw;
    height: auto;
    opacity: 0.85;
    -webkit-mask-image: linear-gradient(to bottom,
      transparent  0%,
      black        14%,
      black        68%,
      transparent 100%);
    mask-image: linear-gradient(to bottom,
      transparent  0%,
      black        14%,
      black        68%,
      transparent 100%);
  }

  .hero-photo {
    width: 100%;
    height: auto;
    display: block;
  }
}