/* ════════════════════════════════════════════════════════════════════
   Portfólio acadêmico — folha de estilos
   "The Descent" — a macro → micro journey from satellite to genome.
   Palette evokes remote sensing / NDVI: deep-space blue → cyan → veg green,
   with a spectral (false-colour NIR) magenta accent.
   ════════════════════════════════════════════════════════════════════ */

:root {
  /* Surfaces — daylight field */
  --bg:        #f4f7f3;
  --bg-alt:    #eaf0ea;
  --surface:   #ffffff;
  --surface-2: #eef3ee;
  --text:      #101b16;
  --text-soft: #475a51;
  --muted:     #849089;
  --border:    #dde6df;

  /* Spectral / remote-sensing palette */
  --sat:       #1e6feb;   /* satellite blue  */
  --brand:     #0e8f6e;   /* vegetation / NDVI green (primary) */
  --brand-2:   #12b3a6;   /* cyan            */
  --veg:       #63c132;   /* healthy canopy  */
  --spectral:  #e6398a;   /* false-colour NIR magenta accent */
  --accent:    #16a34a;
  --gold:      #d99a1c;

  --shadow:    0 8px 30px rgba(16, 46, 34, 0.08);
  --shadow-lg: 0 24px 60px rgba(16, 46, 34, 0.16);
  --ring:      0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent);
  --radius:    18px;
  --radius-sm: 11px;
  --maxw:      1180px;

  /* Spectral gradient: water → cyan → vegetation */
  --grad:      linear-gradient(115deg, #1e6feb 0%, #12b3a6 48%, #63c132 100%);
  --grad-soft: linear-gradient(115deg, color-mix(in srgb, var(--sat) 14%, transparent), color-mix(in srgb, var(--veg) 14%, transparent));

  --ease:      cubic-bezier(.22, 1, .36, 1);
}

[data-theme="dark"] {
  /* Surfaces — orbital night */
  --bg:        #060b12;
  --bg-alt:    #0a111c;
  --surface:   #0f1826;
  --surface-2: #16202f;
  --text:      #e8f0ec;
  --text-soft: #a7bcb1;
  --muted:     #6f8479;
  --border:    #1d2a37;

  --sat:       #4f9bff;
  --brand:     #2fd499;
  --brand-2:   #22d3ee;
  --veg:       #7ee06a;
  --spectral:  #ff5fa8;

  --shadow:    0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
  --grad:      linear-gradient(115deg, #4f9bff 0%, #22d3ee 48%, #7ee06a 100%);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition: background .5s ease, color .5s ease;
  overflow-x: hidden;
}

h1, h2, h3 { line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: color-mix(in srgb, var(--brand) 28%, transparent); }
code {
  font-family: 'JetBrains Mono', monospace;
  background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: .82em;
}

/* ░░ Scroll progress ░░ */
#scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--grad); z-index: 1000; transition: width .1s linear;
  box-shadow: 0 0 12px color-mix(in srgb, var(--brand) 60%, transparent);
}

/* ════════════════════════════════════════════════════════════════════
   Scale rail — the storytelling spine.
   A fixed vertical altimeter that descends from satellite → genome as
   you scroll, so the whole page reads as one continuous zoom-in.
   ════════════════════════════════════════════════════════════════════ */
.scale-rail {
  position: fixed; right: 26px; top: 50%; transform: translateY(-50%);
  z-index: 850; display: flex; flex-direction: column; gap: 0;
  padding: 6px 0; pointer-events: none;
}
.scale-rail::before {
  content: ""; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 2px;
  background: var(--border); border-radius: 2px;
}
.scale-rail .rail-fill {
  position: absolute; left: 6px; top: 10px; width: 2px; height: 0;
  background: var(--grad); border-radius: 2px; transition: height .15s linear;
  box-shadow: 0 0 10px color-mix(in srgb, var(--brand) 55%, transparent);
}
.rail-stop {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 13px 0; pointer-events: auto; cursor: pointer;
}
.rail-node {
  width: 14px; height: 14px; border-radius: 50%; background: var(--surface);
  border: 2px solid var(--border); flex: 0 0 auto; z-index: 1;
  transition: transform .3s var(--ease), border-color .3s, background .3s, box-shadow .3s;
}
.rail-label {
  display: flex; flex-direction: column; line-height: 1.1;
  opacity: 0; transform: translateX(6px);
  transition: opacity .3s, transform .3s; white-space: nowrap;
}
.rail-scale { font-family: 'JetBrains Mono', monospace; font-size: .72rem; font-weight: 600; color: var(--text); }
.rail-name  { font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.scale-rail:hover .rail-label { opacity: 1; transform: none; }
.rail-stop.active .rail-node {
  border-color: transparent; background: var(--grad);
  transform: scale(1.45); box-shadow: var(--ring);
}
.rail-stop.active .rail-label { opacity: 1; transform: none; }
.rail-stop.active .rail-scale { color: var(--brand); }
@media (max-width: 1200px) { .scale-rail { display: none; } }

/* ░░ Navbar ░░ */
#navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s, box-shadow .3s;
}
#navbar.scrolled { border-color: var(--border); box-shadow: var(--shadow); }
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 22px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; background: var(--grad);
  color: #fff; display: grid; place-items: center; font-size: .95rem; font-weight: 800;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 40%, rgba(255,255,255,.45) 50%, transparent 60%);
  transform: translateX(-120%); animation: sheen 6s ease-in-out infinite;
}
@keyframes sheen { 0%, 70% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
.brand-name { font-size: 1.05rem; }
.nav-links { list-style: none; display: flex; align-items: center; gap: 4px; }
.nav-links a {
  padding: 8px 12px; border-radius: 9px; font-size: .9rem; font-weight: 500;
  color: var(--text-soft); transition: color .2s, background .2s; position: relative;
}
.nav-links a:hover, .nav-links a.active { color: var(--brand); background: var(--surface-2); }

#theme-toggle, #nav-toggle {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: .95rem;
  display: grid; place-items: center; transition: transform .3s var(--ease), background .2s;
}
#theme-toggle:hover { transform: rotate(-25deg) scale(1.05); }
#nav-toggle { display: none; }

/* ░░ Buttons ░░ */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 22px; border-radius: 12px; font-weight: 600; font-size: .95rem;
  cursor: pointer; border: 1px solid transparent;
  transition: transform .2s var(--ease), box-shadow .25s, background .25s, color .2s, border-color .2s;
}
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { transform: translateY(-3px); border-color: var(--brand); color: var(--brand); }

/* ════════════════════════════════════════════════════════════════════
   Hero — Orbital view. Deep-space fade at the top, a perspective field
   grid on the "ground", and a live satellite scan on the canvas.
   ════════════════════════════════════════════════════════════════════ */
.hero {
  position: relative; min-height: 100vh; display: flex; flex-direction: column;
  justify-content: center; padding: 128px 22px 70px; overflow: hidden;
  isolation: isolate;
}
.hero-bg {
  position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(120% 80% at 50% -20%, color-mix(in srgb, var(--sat) 30%, transparent), transparent 60%),
    radial-gradient(70% 55% at 88% 8%, color-mix(in srgb, var(--brand-2) 20%, transparent), transparent 70%),
    radial-gradient(60% 60% at 8% 90%, color-mix(in srgb, var(--veg) 18%, transparent), transparent 70%);
  filter: saturate(1.1);
}
/* Perspective "field plot" floor receding to the horizon */
.hero-bg::before {
  content: ""; position: absolute; left: -25%; right: -25%; bottom: -10%; height: 60%;
  background-image:
    linear-gradient(color-mix(in srgb, var(--brand) 30%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--brand) 30%, transparent) 1px, transparent 1px);
  background-size: 46px 46px;
  transform: perspective(520px) rotateX(66deg);
  transform-origin: bottom center;
  mask-image: linear-gradient(180deg, transparent, #000 70%);
  opacity: .5;
}
/* faint scanlines like a sensor readout */
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(180deg, transparent 0 3px, color-mix(in srgb, var(--text) 4%, transparent) 3px 4px);
  opacity: .5; mask-image: linear-gradient(180deg, #000, transparent 55%);
}
#hero-canvas {
  position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none;
}
/* Flying satellite + UAV that traverse the orbital view */
.hero-flyer {
  position: absolute; z-index: -1; pointer-events: none;
  color: color-mix(in srgb, var(--brand) 70%, var(--text-soft));
  opacity: .6; filter: drop-shadow(0 4px 10px color-mix(in srgb, var(--brand) 35%, transparent));
}
.flyer-sat { top: 12%; font-size: clamp(1.2rem, 2vw, 1.9rem); animation: fly-sat 22s linear infinite; }
.flyer-uav { top: 26%; font-size: clamp(1rem, 1.6vw, 1.5rem); color: var(--spectral); animation: fly-uav 16s ease-in-out infinite; }
@keyframes fly-sat {
  0%   { left: -8%;  transform: translateY(0)     rotate(-12deg); opacity: 0; }
  8%   { opacity: .6; }
  50%  { transform: translateY(26px) rotate(-12deg); }
  92%  { opacity: .6; }
  100% { left: 108%; transform: translateY(-10px) rotate(-12deg); opacity: 0; }
}
@keyframes fly-uav {
  0%   { right: -8%;  transform: translateY(0)    rotate(8deg) scaleX(-1); opacity: 0; }
  10%  { opacity: .55; }
  50%  { transform: translateY(-18px) rotate(8deg) scaleX(-1); }
  90%  { opacity: .55; }
  100% { right: 104%; transform: translateY(8px) rotate(8deg) scaleX(-1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .hero-flyer { display: none; } }
.hero-content {
  position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto; width: 100%;
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 52px; align-items: center;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 9px; font-size: .82rem; font-weight: 600;
  font-family: 'JetBrains Mono', monospace; letter-spacing: .02em;
  color: var(--text-soft); background: color-mix(in srgb, var(--surface) 80%, transparent);
  border: 1px solid var(--border);
  padding: 6px 15px; border-radius: 30px; box-shadow: var(--shadow); margin-bottom: 22px;
  backdrop-filter: blur(6px);
}
.hero-eyebrow .dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--veg);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--veg) 60%, transparent); animation: pulse 2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--veg) 55%, transparent); }
  70%  { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.hero h1 { font-size: clamp(2.1rem, 5.6vw, 4.1rem); font-weight: 800; margin-bottom: 16px; white-space: nowrap; }
.hero-typed {
  font-family: 'JetBrains Mono', monospace; font-size: clamp(1rem, 2vw, 1.28rem);
  font-weight: 600; color: var(--text-soft); margin-bottom: 14px; min-height: 1.6em;
}
.typed-role, .grad-text {
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; font-weight: 800;
}
.type-caret {
  display: inline-block; width: 2px; height: 1.05em; margin-left: 3px; vertical-align: -0.18em;
  background: var(--brand); animation: caretBlink 1s steps(1) infinite;
}
@keyframes caretBlink { 50% { opacity: 0; } }
.hero-tagline { font-size: clamp(1.05rem, 2vw, 1.28rem); color: var(--text-soft); max-width: 570px; }
.hero-tagline strong { color: var(--text); font-weight: 600; }
.hero-affil { margin-top: 14px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.hero-affil i { color: var(--brand); }
.hero-cta { display: flex; gap: 14px; margin: 30px 0 26px; flex-wrap: wrap; }
.hero-social { display: flex; gap: 12px; }
.hero-social a {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-soft);
  font-size: 1.15rem; box-shadow: var(--shadow); transition: transform .2s var(--ease), color .2s, border-color .2s;
}
.hero-social a:hover { transform: translateY(-4px); color: var(--brand); border-color: var(--brand); }

.hero-photo { position: relative; display: grid; place-items: center; }
/* Sensor-style reticle around the portrait */
.photo-ring {
  width: clamp(220px, 26vw, 330px); aspect-ratio: 1; border-radius: 50%;
  padding: 7px; background: var(--grad); box-shadow: var(--shadow-lg);
  animation: float 6s ease-in-out infinite; position: relative;
}
.photo-ring::before {
  content: ""; position: absolute; inset: -18px; border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--brand) 45%, transparent);
  animation: spin 26s linear infinite;
}
.photo-ring::after {
  content: ""; position: absolute; inset: -18px; border-radius: 50%;
  background:
    conic-gradient(from 0deg, color-mix(in srgb, var(--brand) 40%, transparent) 0deg, transparent 30deg 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  animation: spin 8s linear infinite; opacity: .8;
}
@keyframes spin { to { transform: rotate(360deg); } }
.photo-ring img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 5px solid var(--bg); position: relative; z-index: 1; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
.floating-chip {
  position: absolute; background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--border); backdrop-filter: blur(6px);
  padding: 9px 15px; border-radius: 30px; font-size: .84rem; font-weight: 600;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 7px; color: var(--text-soft);
}
.floating-chip i { color: var(--brand); }
.chip-1 { top: 6%;  left: -8%;  animation: float 5s   ease-in-out infinite; }
.chip-2 { bottom: 14%; right: -3%; animation: float 5.5s ease-in-out .6s infinite; }
.chip-3 { bottom: 0%; left: 4%;   animation: float 6.5s ease-in-out 1.1s infinite; }
.chip-4 { top: 20%; right: -5%;  animation: float 6s   ease-in-out 1.6s infinite; }

.scroll-hint {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  color: var(--muted); font-size: .74rem; z-index: 1; text-align: center;
  font-family: 'JetBrains Mono', monospace; letter-spacing: .1em; text-transform: uppercase;
}
.scroll-hint i { display: block; font-size: 1.1rem; margin-top: 6px; animation: bob 1.8s infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(7px); } }

/* ░░ Stats strip ░░ */
.stats-strip {
  max-width: var(--maxw); margin: -34px auto 0; position: relative; z-index: 2;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 28px 10px; margin-inline: 22px; overflow: hidden;
}
.stats-strip::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--grad);
}
@media (min-width: 1200px) { .stats-strip { margin-inline: auto; } }
.stat { text-align: center; border-right: 1px solid var(--border); }
.stat:last-child { border-right: none; }
.stat-num { display: block; font-size: clamp(1.9rem, 3vw, 2.7rem); font-weight: 800;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-label { font-size: .82rem; color: var(--muted); font-weight: 500; letter-spacing: .01em; }

/* ░░ Latest post ░░ */
.latest-post {
  max-width: var(--maxw); margin: 56px auto 0; padding: 0 22px;
  display: grid; grid-template-columns: minmax(240px, .72fr) minmax(0, 1.28fr);
  gap: 42px; align-items: center;
}
.latest-post-visual {
  background: var(--surface); border: 1px solid var(--border); padding: 20px;
  box-shadow: var(--shadow); transform: rotate(-1.5deg); border-radius: 6px; transition: transform .3s var(--ease);
}
.latest-post-visual:hover { transform: rotate(0deg) scale(1.02); }
.latest-post-visual img { width: 100%; aspect-ratio: 461 / 295; object-fit: contain; }
.latest-post-copy h2 { font-size: clamp(1.7rem, 3vw, 2.55rem); margin: 8px 0 14px; max-width: 780px; }
.latest-post-copy > p:not(.section-kicker) { color: var(--text-soft); font-size: 1.05rem; max-width: 700px; }
.latest-post-footer { display: flex; align-items: center; gap: 22px; margin-top: 24px; flex-wrap: wrap; }
.latest-post-meta { color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: .8rem; }

/* ░░ Sections ░░ */
.section { max-width: var(--maxw); margin: 0 auto; padding: 100px 22px; }
.section-alt { background: var(--bg-alt); max-width: 100%; position: relative; }
.section-alt > * { max-width: var(--maxw); margin-inline: auto; }
.section-head { text-align: center; margin-bottom: 54px; }
/* Altitude / scale kicker — ties each section to the descent */
.section-kicker {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: 'JetBrains Mono', monospace; font-size: .74rem; font-weight: 600;
  color: var(--brand); letter-spacing: .16em; text-transform: uppercase;
}
.section-kicker::before {
  content: ""; width: 26px; height: 1px; background: var(--grad);
}
.section-head .section-kicker::after {
  content: ""; width: 26px; height: 1px; background: var(--grad);
}
.section-head h2 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); margin-top: 14px; }
.section-sub { color: var(--text-soft); margin-top: 12px; max-width: 640px; margin-inline: auto; }
.section-sub em { color: var(--muted); font-size: .9em; }
.section-sub a { color: var(--brand); font-weight: 600; }
.section-sub a:hover { text-decoration: underline; }

/* ░░ About ░░ */
.about-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 40px; align-items: start; }
.about-text p { color: var(--text-soft); margin-bottom: 18px; font-size: 1.06rem; }
.about-text strong { color: var(--text); font-weight: 600; }
.about-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.about-tags span {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-soft);
  padding: 7px 14px; border-radius: 30px; font-size: .85rem; font-weight: 500;
  transition: transform .2s var(--ease), color .2s, border-color .2s;
}
.about-tags span:hover { transform: translateY(-2px); color: var(--brand); border-color: var(--brand); }
.about-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.about-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--grad); }
.about-card h3 { font-size: 1.1rem; display: flex; align-items: center; gap: 9px; margin-bottom: 18px; }
.about-card h3 i { color: var(--brand); }
.about-card ul { list-style: none; }
.about-card li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border); font-size: .92rem; }
.about-card li:last-of-type { border-bottom: none; }
.about-card li span { color: var(--muted); font-weight: 500; }
.about-resume { display: inline-flex; align-items: center; gap: 9px; margin-top: 20px; font-weight: 600; color: var(--brand); }
.about-resume:hover { text-decoration: underline; }

/* ░░ Timeline — a descending flight transect ░░ */
.timeline { position: relative; max-width: 840px; margin: 0 auto; }
.timeline::before { content: ""; position: absolute; left: 20px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--brand), var(--border)); }
.tl-item { position: relative; padding: 0 0 38px 62px; }
.tl-item::before {
  content: ""; position: absolute; left: 12px; top: 4px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--surface); border: 3px solid var(--brand); box-shadow: 0 0 0 4px var(--bg-alt);
  transition: transform .25s var(--ease);
}
.tl-item:hover::before { transform: scale(1.2); }
.tl-item[data-type="education"]::before { border-color: var(--sat); }
.tl-item[data-type="research"]::before  { border-color: var(--brand); }
.tl-item[data-type="work"]::before      { border-color: var(--gold); }
.tl-date { font-family: 'JetBrains Mono', monospace; font-size: .8rem; color: var(--brand); font-weight: 600; }
.tl-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 20px 22px; margin-top: 8px; box-shadow: var(--shadow); transition: transform .25s var(--ease), box-shadow .25s; }
.tl-card:hover { transform: translateX(8px); box-shadow: var(--shadow-lg); }
.tl-head { display: flex; align-items: center; gap: 14px; }
.tl-logo {
  flex: 0 0 auto; width: 52px; height: 52px; border-radius: 12px; background: #fff;
  border: 1px solid var(--border); box-shadow: var(--shadow); display: flex;
  align-items: center; justify-content: center; padding: 8px; overflow: hidden;
}
.tl-logo img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.tl-head-text { min-width: 0; }
.tl-card h3 { font-size: 1.12rem; }
.tl-org { color: var(--text-soft); font-weight: 500; font-size: .92rem; margin: 2px 0 0; }
.tl-card > p { color: var(--text-soft); font-size: .92rem; margin-top: 12px; }

/* ░░ Filter bar ░░ */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 36px; }
.filter-btn {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-soft);
  padding: 8px 18px; border-radius: 30px; font-weight: 500; font-size: .88rem; cursor: pointer;
  transition: all .2s var(--ease);
}
.filter-btn:hover { color: var(--brand); border-color: var(--brand); transform: translateY(-2px); }
.filter-btn.active { background: var(--grad); color: #fff; border-color: transparent; }

/* ░░ Projects ░░ */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 24px; }
.project-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow); transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
  display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.project-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--grad); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease); }
.project-card:hover { box-shadow: var(--shadow-lg); border-color: transparent; }
.project-card:hover::before { transform: scaleX(1); }
.pc-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--grad-soft); display: grid; place-items: center; font-size: 1.4rem; color: var(--brand); margin-bottom: 16px; }
.pc-title { font-size: 1.2rem; margin-bottom: 8px; }
.pc-desc { color: var(--text-soft); font-size: .92rem; flex: 1; margin-bottom: 16px; }
.pc-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.pc-tags span { font-family: 'JetBrains Mono', monospace; font-size: .72rem; color: var(--brand); background: var(--surface-2); padding: 3px 9px; border-radius: 6px; }
.pc-links { display: flex; gap: 16px; }
.pc-links a { font-size: .88rem; font-weight: 600; color: var(--brand); display: inline-flex; align-items: center; gap: 6px; }
.pc-links a:hover { text-decoration: underline; }

/* ░░ Publications ░░ */
.pub-list { display: flex; flex-direction: column; gap: 18px; }
.pub-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 22px 24px; box-shadow: var(--shadow); display: flex; gap: 20px; align-items: flex-start;
  transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
}
.pub-item:hover { transform: translateX(8px); border-color: var(--brand); box-shadow: var(--shadow-lg); }
.pub-year { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: #fff; background: var(--grad); padding: 6px 12px; border-radius: 8px; font-size: .85rem; white-space: nowrap; }
.pub-body h3 { font-size: 1.1rem; font-family: 'Inter', system-ui, sans-serif; font-weight: 700; color: var(--text); margin-bottom: 7px; line-height: 1.4; letter-spacing: -0.01em; }
.pub-authors { color: var(--text-soft); font-size: .92rem; line-height: 1.55; }
.pub-authors b { color: var(--brand); font-weight: 700; }
.pub-venue { color: var(--text-soft); font-size: .88rem; font-style: italic; margin-top: 4px; opacity: .9; }
.pub-links { margin-top: 10px; display: flex; gap: 14px; flex-wrap: wrap; }
.pub-links a { font-size: .82rem; font-weight: 600; color: var(--brand); }
.pub-links a:hover { text-decoration: underline; }

/* ░░ Visualizations ░░ */
.viz-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.viz-card { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 24px; box-shadow: var(--shadow); }
.viz-card h3 { font-size: 1.05rem; margin-bottom: 4px; text-align: center; }
.viz-note { color: var(--muted); font-size: .8rem; text-align: center; margin-bottom: 18px; }
.viz-wide { grid-column: 1 / -1; }
.chart-frame { position: relative; height: 300px; min-width: 0; }
.viz-wide .chart-frame { height: 260px; }

/* ░░ Blog ░░ */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.blog-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); cursor: pointer; transition: transform .25s var(--ease), box-shadow .25s;
  display: flex; flex-direction: column;
}
.blog-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.blog-cover { height: 8px; background: var(--grad); }
.blog-inner { padding: 26px; display: flex; flex-direction: column; flex: 1; }
.blog-meta { display: flex; gap: 12px; font-size: .8rem; color: var(--muted); margin-bottom: 12px; font-family: 'JetBrains Mono', monospace; }
.blog-card h3 { font-size: 1.18rem; margin-bottom: 10px; }
.blog-excerpt { color: var(--text-soft); font-size: .92rem; flex: 1; }
.blog-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.blog-tags span { font-size: .72rem; background: var(--surface-2); color: var(--brand); padding: 3px 9px; border-radius: 6px; }
.blog-read { margin-top: 16px; font-weight: 600; color: var(--brand); font-size: .88rem; }

/* ░░ Modal ░░ */
.modal { position: fixed; inset: 0; z-index: 1100; display: none; }
.modal.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(6, 12, 10, .6); backdrop-filter: blur(5px); }
.modal-panel {
  position: relative; max-width: 760px; margin: 6vh auto; max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 46px; animation: rise .35s var(--ease);
}
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-close {
  position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); cursor: pointer; font-size: 1.1rem;
}
.modal-close:hover { color: var(--brand); }
.modal-body { font-size: 1.02rem; color: var(--text-soft); }
.modal-body h1 { font-size: 1.9rem; color: var(--text); margin-bottom: 6px; }
.modal-body h2 { font-size: 1.4rem; color: var(--text); margin: 26px 0 10px; }
.modal-body h3 { font-size: 1.15rem; color: var(--text); margin: 20px 0 8px; }
.modal-body p { margin-bottom: 16px; }
.modal-body ul, .modal-body ol { margin: 0 0 16px 22px; }
.modal-body li { margin-bottom: 6px; }
.modal-body a { color: var(--brand); text-decoration: underline; }
.modal-body blockquote { border-left: 3px solid var(--brand); padding-left: 16px; color: var(--muted); font-style: italic; margin: 0 0 16px; }
.modal-body pre { background: var(--surface-2); padding: 16px; border-radius: 10px; overflow-x: auto; margin-bottom: 16px; }
.modal-body img { border-radius: 10px; margin: 10px 0; }
.post-head-meta { font-family: 'JetBrains Mono', monospace; font-size: .82rem; color: var(--muted); margin-bottom: 22px; }

/* ░░ Awards ░░ */
.awards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.award-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 30px; box-shadow: var(--shadow); position: relative; transition: transform .25s var(--ease), box-shadow .25s;
}
.award-card:hover { box-shadow: var(--shadow-lg); }
.award-medal { width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center; font-size: 1.5rem; color: #fff; background: linear-gradient(135deg, var(--gold), #f4c542); margin-bottom: 16px; box-shadow: var(--shadow); }
.award-card h3 { font-size: 1.15rem; margin-bottom: 4px; }
.award-org { color: var(--brand); font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
.award-year { font-family: 'JetBrains Mono', monospace; font-size: .8rem; color: var(--muted); }
.award-story { color: var(--text-soft); font-size: .92rem; margin-top: 12px; }

/* ░░ Mentorship — seedlings, the next generation ░░ */
.mentor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px; }
.mentor-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; text-align: center; box-shadow: var(--shadow); transition: transform .25s var(--ease), box-shadow .25s;
}
.mentor-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.mentor-photo {
  width: 104px; height: 104px; border-radius: 50%; margin: 0 auto 16px; padding: 4px;
  background: var(--grad); box-shadow: var(--shadow);
}
.mentor-photo img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface); }
.mentor-card h3 { font-size: 1.08rem; margin-bottom: 4px; }
.mentor-role { color: var(--brand); font-weight: 600; font-size: .85rem; margin-bottom: 2px; }
.mentor-univ { color: var(--text-soft); font-size: .85rem; }
.mentor-links { margin-top: 12px; display: flex; gap: 14px; justify-content: center; }
.mentor-links a { color: var(--muted); font-size: 1rem; transition: color .2s; }
.mentor-links a:hover { color: var(--brand); }

/* ░░ Gallery ░░ */
.gallery-grid { columns: 3; column-gap: 18px; }
@media (max-width: 900px) { .gallery-grid { columns: 2; } }
@media (max-width: 560px) { .gallery-grid { columns: 1; } }
.gallery-item {
  break-inside: avoid; margin-bottom: 18px; position: relative; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); cursor: pointer; border: 1px solid var(--border);
  transition: transform .25s var(--ease), box-shadow .25s;
}
.gallery-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.gallery-item img { width: 100%; display: block; transition: transform .4s var(--ease); }
.gallery-item:hover img { transform: scale(1.05); }
.gallery-cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 14px 12px;
  background: linear-gradient(transparent, rgba(6, 12, 10, .85));
  color: #fff; opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s;
}
.gallery-item:hover .gallery-cap { opacity: 1; transform: none; }
.gallery-cap .g-text { font-size: .9rem; font-weight: 500; }
.gallery-cap .g-date { font-family: 'JetBrains Mono', monospace; font-size: .72rem; opacity: .85; margin-top: 3px; display: block; }

/* ░░ Lightbox ░░ */
.lightbox { position: fixed; inset: 0; z-index: 1150; display: none; }
.lightbox.open { display: block; }
.lightbox-backdrop { position: absolute; inset: 0; background: rgba(4, 8, 6, .92); backdrop-filter: blur(5px); }
.lightbox-figure {
  position: relative; max-width: 90vw; max-height: 88vh; margin: 6vh auto 0;
  display: flex; flex-direction: column; align-items: center; animation: rise .3s var(--ease);
}
.lightbox-figure img { max-width: 90vw; max-height: 78vh; border-radius: 12px; box-shadow: var(--shadow-lg); }
.lightbox-figure figcaption { color: #fff; margin-top: 14px; text-align: center; font-size: .95rem; max-width: 640px; }
.lightbox-close { position: fixed; top: 22px; right: 22px; z-index: 2; }

/* ░░ Contact — ground station ░░ */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.contact-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 30px 16px; min-width: 0; text-align: center; box-shadow: var(--shadow);
  transition: transform .25s var(--ease), border-color .25s, box-shadow .25s;
}
.contact-card:hover { transform: translateY(-6px); border-color: var(--brand); box-shadow: var(--shadow-lg); }
.contact-card i { font-size: 1.7rem; color: var(--brand); margin-bottom: 14px; }
.c-label { display: block; font-weight: 700; margin-bottom: 4px; }
.c-val { display: block; color: var(--text-soft); font-size: .88rem; word-break: break-word; }
.contact-card[href^="mailto:"] .c-val { white-space: nowrap; word-break: normal; font-size: .82rem; }

/* ░░ Footer ░░ */
.footer { text-align: center; padding: 48px 22px; border-top: 1px solid var(--border); color: var(--text-soft); }
.footer-sub { font-size: .85rem; color: var(--muted); margin-top: 6px; }

/* ░░ Back to top ░░ */
#back-to-top {
  position: fixed; bottom: 26px; right: 26px; width: 48px; height: 48px; border-radius: 14px;
  background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transform: translateY(14px); transition: all .3s var(--ease); z-index: 800;
}
#back-to-top.show { opacity: 1; pointer-events: auto; transform: none; }
@media (max-width: 1200px) { #back-to-top { bottom: 20px; right: 20px; } }

/* ░░ Reveal animation — a subtle zoom-in, reinforcing the descent ░░ */
.reveal { opacity: 0; transform: translateY(30px) scale(.985); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.visible { opacity: 1; transform: none; }

/* ░░ Loading state ░░ */
.loading { text-align: center; color: var(--muted); padding: 40px; font-size: .92rem; grid-column: 1 / -1; }

/* ░░ Reduced motion ░░ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ░░ Responsive ░░ */
@media (max-width: 900px) {
  .hero-content { grid-template-columns: 1fr; text-align: center; }
  .hero-photo { order: -1; margin-bottom: 20px; }
  .hero-cta, .hero-social { justify-content: center; }
  .hero-affil { justify-content: center; }
  .floating-chip { display: none; }
  .about-grid { grid-template-columns: 1fr; }
  .viz-grid { grid-template-columns: 1fr; }
  .latest-post { grid-template-columns: 1fr; gap: 28px; }
  .latest-post-visual { max-width: 520px; }
}
@media (max-width: 760px) {
  #nav-toggle { display: grid; }
  .nav-links {
    position: absolute; top: 66px; right: 22px; left: 22px; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px; box-shadow: var(--shadow-lg); align-items: stretch; gap: 4px;
    transform: scale(.96); opacity: 0; pointer-events: none; transition: all .22s var(--ease);
  }
  .nav-links.open { transform: none; opacity: 1; pointer-events: auto; }
  .nav-links a { display: block; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); gap: 20px 0; }
  .stat:nth-child(2) { border-right: none; }
  .modal-panel { padding: 30px 22px; margin: 4vh 14px; }
  .section { padding: 80px 22px; }
}
@media (max-width: 460px) {
  .contact-card[href^="mailto:"] .c-val { font-size: .76rem; }
  .viz-card { padding: 18px 12px; }
  .stats-strip { grid-template-columns: 1fr 1fr; }
  .brand-name { display: none; }
  .latest-post { margin-top: 40px; }
  .latest-post-visual { padding: 12px; transform: none; }
  .latest-post-footer .btn { width: 100%; justify-content: center; }
}
