/* ============================================================
   Tommaso Trotto — Portfolio
   Forest / remote-sensing themed, motion-driven, dark + light
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Dark theme (default) */
  --bg: #0a0f0d;
  --bg-grad-1: #0b1411;
  --bg-grad-2: #0a0f0d;
  --surface: #111a16;
  --surface-2: #16221d;
  --elevated: #1b2a23;
  --border: #243a30;
  --border-soft: #1d2e26;

  --text: #e9f1ea;
  --text-muted: #9db0a4;
  --text-faint: #6f8478;

  --primary: #5fcf80;        /* lichen / vegetation green */
  --primary-strong: #34b862;
  --primary-soft: rgba(95, 207, 128, 0.12);
  --lime: #b6e84f;           /* NDVI highlight */
  --accent: #e0a458;         /* warm earth / amber */
  --accent-soft: rgba(224, 164, 88, 0.14);
  --sky: #58c5d6;            /* satellite cyan */

  --ring: rgba(95, 207, 128, 0.55);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 36px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 0 1px rgba(95, 207, 128, 0.15), 0 18px 50px -12px rgba(52, 184, 98, 0.25);

  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;

  --maxw: 1120px;
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 68px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 180ms;
  --t-med: 320ms;

  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f5f8f2;
  --bg-grad-1: #eef4e9;
  --bg-grad-2: #f5f8f2;
  --surface: #ffffff;
  --surface-2: #f1f6ed;
  --elevated: #ffffff;
  --border: #d9e4d3;
  --border-soft: #e6eedf;

  --text: #11201a;
  --text-muted: #46584e;
  --text-faint: #6a7d72;

  --primary: #1f9b50;
  --primary-strong: #157a3d;
  --primary-soft: rgba(31, 155, 80, 0.10);
  --lime: #6fae12;
  --accent: #b5742a;
  --accent-soft: rgba(181, 116, 42, 0.12);
  --sky: #1f95a8;

  --ring: rgba(31, 155, 80, 0.45);
  --shadow-sm: 0 2px 8px rgba(16, 40, 28, 0.08);
  --shadow-md: 0 16px 40px rgba(16, 40, 28, 0.12);
  --shadow-glow: 0 0 0 1px rgba(31, 155, 80, 0.12), 0 18px 50px -16px rgba(31, 155, 80, 0.22);

  color-scheme: light;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background var(--t-med) var(--ease), color var(--t-med) var(--ease);
}

/* Ambient background gradient + grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(60% 50% at 80% -5%, var(--primary-soft), transparent 70%),
    radial-gradient(50% 45% at 0% 15%, var(--accent-soft), transparent 70%),
    linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2));
  transition: background var(--t-med) var(--ease);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.12; font-weight: 600; letter-spacing: -0.02em; }

::selection { background: var(--primary); color: #06140c; }

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
  border-radius: 6px;
}

/* ---------- Layout helpers ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 22px; }

.section { padding: clamp(64px, 9vw, 120px) 0; position: relative; }
.section-head { margin-bottom: 48px; max-width: 720px; }
.eyebrow {
  font-family: var(--font-display);
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--primary);
  display: inline-flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.eyebrow::before { content: ""; width: 26px; height: 2px; background: var(--primary); border-radius: 2px; display: inline-block; }
.section-title { font-size: clamp(1.9rem, 4vw, 2.9rem); }
.section-sub { color: var(--text-muted); margin-top: 14px; font-size: 1.04rem; }

/* ---------- Navbar ---------- */
.nav {
  position: fixed; top: 14px; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: center;
  pointer-events: none;
  transition: top var(--t-med) var(--ease);
}
.nav-inner {
  pointer-events: auto;
  display: flex; align-items: center; gap: 8px;
  width: calc(100% - 28px); max-width: var(--maxw);
  height: var(--nav-h);
  padding: 0 10px 0 20px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  box-shadow: var(--shadow-sm);
  transition: background var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease), border-color var(--t-med) var(--ease);
}
.nav.scrolled .nav-inner { box-shadow: var(--shadow-md); background: color-mix(in srgb, var(--surface) 88%, transparent); }

.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #06140c; font-weight: 700; flex: none;
}
.brand .mark svg { width: 18px; height: 18px; }

.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links a {
  font-size: 0.92rem; font-weight: 500; color: var(--text-muted);
  padding: 9px 13px; border-radius: 999px;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.nav-links a:hover { color: var(--text); background: var(--primary-soft); }
.nav-links a.active { color: var(--primary); }

.nav-actions { display: flex; align-items: center; gap: 8px; margin-left: 8px; }

.icon-btn {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center;
  border-radius: 999px; border: 1px solid var(--border-soft);
  background: transparent; color: var(--text-muted);
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.icon-btn:hover { color: var(--primary); border-color: var(--border); background: var(--primary-soft); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 19px; height: 19px; }
.theme-toggle .moon { display: none; }
[data-theme="light"] .theme-toggle .sun { display: none; }
[data-theme="light"] .theme-toggle .moon { display: block; }

.nav-toggle { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 22px; border-radius: 999px; font-weight: 600; font-size: 0.96rem;
  border: 1px solid transparent; white-space: nowrap;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-strong)); color: #05130b; box-shadow: var(--shadow-glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--primary), 0 22px 50px -14px var(--primary-strong); }
.btn-ghost { border-color: var(--border); color: var(--text); background: color-mix(in srgb, var(--surface) 50%, transparent); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.98); }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: 100svh; display: flex; align-items: center; padding-top: calc(var(--nav-h) + 30px); overflow: hidden; }
#point-cloud { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.hero::after { /* fade canvas into page */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 220px; z-index: 1;
  background: linear-gradient(180deg, transparent, var(--bg-grad-2));
  pointer-events: none;
}
.hero .container { position: relative; z-index: 2; }
.hero-grid { display: grid; grid-template-columns: 1.35fr 0.85fr; gap: 56px; align-items: center; }

.hero-status {
  display: inline-flex; align-items: center; gap: 9px; padding: 7px 15px;
  border: 1px solid var(--border); border-radius: 999px; background: color-mix(in srgb, var(--surface) 60%, transparent);
  font-size: 0.85rem; color: var(--text-muted); font-weight: 500; margin-bottom: 26px;
}
.hero-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 0 var(--primary); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(95,207,128,0.5);} 70%{box-shadow:0 0 0 9px rgba(95,207,128,0);} 100%{box-shadow:0 0 0 0 rgba(95,207,128,0);} }

.hero h1 { font-size: clamp(2.6rem, 6.4vw, 4.7rem); font-weight: 700; line-height: 1.02; }
.hero h1 .greet { display: block; font-size: clamp(1rem, 2.2vw, 1.25rem); font-weight: 500; color: var(--text-muted); letter-spacing: 0.01em; margin-bottom: 12px; font-family: var(--font-body); }
.hero h1 .name { background: linear-gradient(120deg, var(--text) 30%, var(--primary) 75%, var(--lime)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-role { font-family: var(--font-display); font-size: clamp(1.05rem, 2.4vw, 1.45rem); color: var(--text); margin-top: 20px; font-weight: 500; }
.hero-role .hl { color: var(--primary); }
.hero-tagline { color: var(--text-muted); margin-top: 18px; max-width: 540px; font-size: 1.06rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }
.hero-socials { display: flex; gap: 10px; margin-top: 30px; }

.hero-figure { position: relative; display: grid; place-items: center; }
.hero-portrait {
  position: relative; width: min(330px, 78%); aspect-ratio: 1; border-radius: 50%; overflow: hidden;
  box-shadow: var(--shadow-md);
}
.hero-portrait img { width: 100%; height: 100%; object-fit: cover; }
.hero-orbit { position: absolute; inset: -8% ; border: 1px dashed var(--border); border-radius: 50%; animation: spin 40s linear infinite; }
.hero-orbit.two { inset: 4%; animation-duration: 28s; animation-direction: reverse; border-style: dotted; opacity: 0.6; }
@keyframes spin { to { transform: rotate(360deg); } }
.hero-chip {
  position: absolute; z-index: 3; display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 12px; font-size: 0.82rem; font-weight: 600;
  background: color-mix(in srgb, var(--elevated) 92%, transparent); border: 1px solid var(--border);
  box-shadow: var(--shadow-md); backdrop-filter: blur(6px);
}
.hero-chip svg { width: 15px; height: 15px; color: var(--primary); }
.hero-chip.c1 { top: 6%; left: -6%; animation: float 6s ease-in-out infinite; }
.hero-chip.c2 { bottom: 12%; right: -10%; animation: float 7s ease-in-out infinite 0.6s; }
.hero-chip.c3 { bottom: -2%; left: 8%; animation: float 5.5s ease-in-out infinite 1.2s; }
@keyframes float { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(-12px);} }

.scroll-cue { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-faint); font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase; }
.scroll-cue .mouse { width: 22px; height: 36px; border: 2px solid var(--text-faint); border-radius: 12px; position: relative; }
.scroll-cue .mouse::after { content:""; position:absolute; left:50%; top:7px; width:3px; height:7px; background: var(--text-faint); border-radius: 2px; transform: translateX(-50%); animation: wheel 1.6s infinite; }
@keyframes wheel { 0%{opacity:0; transform: translate(-50%,0);} 40%{opacity:1;} 100%{opacity:0; transform: translate(-50%,10px);} }

/* ---------- Stats strip ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.stat { padding: 26px 22px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); transition: transform var(--t-med) var(--ease), border-color var(--t-med) var(--ease); }
.stat:hover { transform: translateY(-4px); border-color: var(--border); }
.stat .num { font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 700; color: var(--primary); line-height: 1; }
.stat .num .plus { color: var(--lime); }
.stat .lbl { color: var(--text-muted); margin-top: 10px; font-size: 0.94rem; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 52px; align-items: start; }
.about-lead { font-size: 1.22rem; line-height: 1.7; }
.about-lead strong { color: var(--primary); font-weight: 600; }
.about-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; }
.about-points li { display: flex; gap: 14px; align-items: flex-start; color: var(--text-muted); }
.about-points li svg { width: 22px; height: 22px; flex: none; color: var(--primary); margin-top: 2px; }
.about-card { padding: 28px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.about-card h3 { font-size: 1.05rem; margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
.about-card h3 svg { width: 20px; height: 20px; color: var(--accent); }
.traits { display: flex; flex-wrap: wrap; gap: 9px; }
.trait { padding: 8px 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-soft); font-size: 0.86rem; font-weight: 500; color: var(--text); transition: transform var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.trait:hover { color: var(--primary); border-color: var(--primary); transform: translateY(-2px); }
.affil { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--border-soft); }
.affil .role { font-family: var(--font-display); font-weight: 600; color: var(--text); }
.affil .org { color: var(--primary); font-size: 0.95rem; }
.affil a:hover { text-decoration: underline; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 36px; }
.filter-btn {
  padding: 9px 18px; border-radius: 999px; border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); font-size: 0.9rem; font-weight: 500;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.filter-btn:hover { color: var(--text); border-color: var(--primary); }
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: #05130b; }

/* ---------- Skills grid ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 18px; }
.skill-card {
  display: flex; gap: 16px; padding: 22px; border-radius: var(--radius);
  border: 1px solid var(--border-soft); background: var(--surface);
  transition: transform var(--t-med) var(--ease), border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease), opacity var(--t-med) var(--ease);
}
.skill-card:hover { transform: translateY(-5px); border-color: var(--border); box-shadow: var(--shadow-md); }
.skill-icon { width: 50px; height: 50px; flex: none; border-radius: 13px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border-soft); padding: 9px; }
.skill-icon img { width: 100%; height: 100%; object-fit: contain; }
.skill-card h3 { font-size: 1.02rem; margin-bottom: 6px; }
.skill-card a.skill-link { color: var(--primary); }
.skill-card p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.55; }
.skill-card .repo-tag { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 0.8rem; font-weight: 600; color: var(--primary); }
.skill-card .repo-tag svg { width: 14px; height: 14px; }
.is-hidden { display: none !important; }

/* ---------- Timeline (experience) ---------- */
.timeline { position: relative; padding-left: 34px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--primary), var(--border)); border-radius: 2px; }
.tl-item { position: relative; padding-bottom: 14px; }
.tl-item::before { content: ""; position: absolute; left: -33px; top: 6px; width: 18px; height: 18px; border-radius: 50%; background: var(--bg); border: 3px solid var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.exp-card { border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); padding: 28px; box-shadow: var(--shadow-sm); }
.exp-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.exp-logo { width: 56px; height: 56px; border-radius: 13px; background: #fff; padding: 8px; flex: none; display: grid; place-items: center; border: 1px solid var(--border-soft); }
.exp-logo img { object-fit: contain; }
.exp-titles h3 { font-size: 1.22rem; }
.exp-titles .meta { color: var(--text-muted); font-size: 0.92rem; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.exp-titles .meta a { color: var(--primary); }
.exp-titles .meta a:hover { text-decoration: underline; }
.badge-time { margin-left: auto; align-self: flex-start; padding: 6px 13px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.exp-overview { color: var(--text-muted); margin-top: 16px; font-size: 0.98rem; font-style: italic; padding-left: 14px; border-left: 2px solid var(--border); }
.exp-list { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 11px; }
.exp-list li { display: flex; gap: 12px; color: var(--text-muted); font-size: 0.96rem; }
.exp-list li svg { width: 18px; height: 18px; flex: none; color: var(--primary); margin-top: 4px; }

/* ---------- Education ---------- */
.edu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.edu-card { border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); padding: 24px; transition: transform var(--t-med) var(--ease), border-color var(--t-med) var(--ease); }
.edu-card:hover { transform: translateY(-4px); border-color: var(--border); }
.edu-top { display: flex; gap: 15px; align-items: center; }
.edu-logo { width: 52px; height: 52px; border-radius: 12px; background: #fff; padding: 7px; flex: none; display: grid; place-items: center; border: 1px solid var(--border-soft); }
.edu-logo img { object-fit: contain; }
.edu-card h3 { font-size: 1.06rem; line-height: 1.25; }
.edu-inst { color: var(--text-muted); font-size: 0.9rem; margin-top: 3px; }
.edu-inst a:hover { color: var(--primary); }
.edu-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.edu-time { padding: 5px 12px; border-radius: 999px; background: var(--surface-2); color: var(--primary); font-size: 0.8rem; font-weight: 600; }
.edu-grade { color: var(--accent); font-size: 0.83rem; font-weight: 600; }
.edu-note { margin-top: 16px; font-size: 0.92rem; color: var(--text-muted); }
.edu-note .k { color: var(--text); font-weight: 600; }
.edu-card details { margin-top: 14px; }
.edu-card summary { cursor: pointer; color: var(--primary); font-size: 0.86rem; font-weight: 600; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.edu-card summary::-webkit-details-marker { display: none; }
.edu-card summary svg { width: 14px; height: 14px; transition: transform var(--t-fast) var(--ease); }
.edu-card details[open] summary svg { transform: rotate(180deg); }
.edu-courses { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.edu-courses span { font-size: 0.78rem; padding: 5px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--text-muted); }
.edu-pubs { margin-top: 12px; display: grid; gap: 8px; }
.edu-pubs a { font-size: 0.82rem; color: var(--text-muted); display: flex; gap: 8px; line-height: 1.4; }
.edu-pubs a svg { width: 14px; height: 14px; flex: none; color: var(--primary); margin-top: 3px; }
.edu-pubs a:hover { color: var(--primary); }

/* ---------- Projects ---------- */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.proj-card {
  position: relative; display: flex; flex-direction: column; padding: 26px;
  border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface);
  overflow: hidden; transition: transform var(--t-med) var(--ease), border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease), opacity var(--t-med) var(--ease);
}
.proj-card::before { content:""; position:absolute; inset:0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--primary), var(--lime)); transform: scaleX(0); transform-origin: left; transition: transform var(--t-med) var(--ease); }
.proj-card:hover { transform: translateY(-6px); border-color: var(--border); box-shadow: var(--shadow-md); }
.proj-card:hover::before { transform: scaleX(1); }
.proj-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.proj-logo { width: 48px; height: 48px; border-radius: 12px; background: var(--surface-2); padding: 8px; flex: none; display: grid; place-items: center; border: 1px solid var(--border-soft); }
.proj-role { margin-left: auto; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 5px 11px; border-radius: 999px; }
.proj-role.author { background: var(--primary-soft); color: var(--primary); }
.proj-role.contributor { background: var(--accent-soft); color: var(--accent); }
.proj-card h3 { font-size: 1.18rem; }
.proj-card .timeline-txt { color: var(--text-faint); font-size: 0.82rem; margin-top: 4px; }
.proj-card p { color: var(--text-muted); font-size: 0.95rem; margin-top: 12px; flex: 1; }
.proj-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; font-weight: 600; font-size: 0.9rem; color: var(--primary); transition: gap var(--t-fast) var(--ease); }
.proj-card:hover .proj-link { gap: 12px; }
.proj-link svg { width: 16px; height: 16px; }

/* ---------- Publications ---------- */
.pub-list { display: grid; gap: 20px; }
.pub-card { position: relative; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); padding: 30px; transition: transform var(--t-med) var(--ease), border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease); }
.pub-card:hover { transform: translateY(-4px); border-color: var(--border); box-shadow: var(--shadow-md); }
.pub-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 14px; }
.pub-journal { font-family: var(--font-display); font-weight: 600; color: var(--primary); font-size: 0.92rem; }
.pub-date { color: var(--text-faint); font-size: 0.85rem; }
.pub-status { padding: 4px 11px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; background: var(--accent-soft); color: var(--accent); }
.pub-card h3 { font-size: 1.28rem; line-height: 1.28; }
.pub-authors { color: var(--text-muted); font-size: 0.9rem; margin-top: 12px; }
.pub-authors .me { color: var(--text); font-weight: 600; }
.pub-abstract { color: var(--text-muted); font-size: 0.96rem; margin-top: 14px; line-height: 1.65; }
.pub-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pub-tags span { font-size: 0.78rem; padding: 5px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--text-muted); }
.pub-doi { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; font-weight: 600; font-size: 0.9rem; color: var(--primary); }
.pub-doi svg { width: 16px; height: 16px; }
.pub-doi:hover { text-decoration: underline; }

/* ---------- Accomplishments ---------- */
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.acc-card { border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); padding: 24px; position: relative; transition: transform var(--t-med) var(--ease), border-color var(--t-med) var(--ease); }
.acc-card:hover { transform: translateY(-4px); border-color: var(--border); }
.acc-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 16px; }
.acc-icon svg { width: 22px; height: 22px; }
.acc-card h3 { font-size: 1.05rem; line-height: 1.3; }
.acc-time { color: var(--primary); font-size: 0.82rem; font-weight: 600; margin-top: 6px; }
.acc-org { color: var(--text-faint); font-size: 0.85rem; margin-top: 2px; }
.acc-card p { color: var(--text-muted); font-size: 0.92rem; margin-top: 12px; }
.acc-card a.acc-out { color: var(--primary); font-weight: 600; }
.acc-card a.acc-out:hover { text-decoration: underline; }

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact-card { max-width: 760px; margin: 0 auto; padding: clamp(36px, 6vw, 64px); border: 1px solid var(--border); border-radius: 26px; background: linear-gradient(160deg, var(--surface), var(--surface-2)); box-shadow: var(--shadow-glow); position: relative; overflow: hidden; }
.contact-card::before { content:""; position:absolute; width: 260px; height: 260px; border-radius: 50%; background: var(--primary-soft); filter: blur(60px); top: -80px; right: -60px; }
.contact-card h2 { font-size: clamp(1.8rem, 4.4vw, 2.8rem); position: relative; }
.contact-card p { color: var(--text-muted); margin-top: 16px; max-width: 480px; margin-inline: auto; position: relative; }
.contact-cta { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 30px; position: relative; }
.contact-socials { display: flex; gap: 12px; justify-content: center; margin-top: 30px; position: relative; }

.social-btn { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.social-btn:hover { color: var(--primary); border-color: var(--primary); transform: translateY(-3px); background: var(--primary-soft); }
.social-btn svg { width: 20px; height: 20px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border-soft); padding: 38px 0; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; color: var(--text-faint); font-size: 0.88rem; }
.footer .brand { font-size: 1rem; }
.footer-links { display: flex; gap: 18px; }
.footer-links a:hover { color: var(--primary); }
.to-top { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); }
.to-top:hover { color: var(--primary); }
.to-top svg { width: 16px; height: 16px; }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); will-change: opacity, transform; }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }
.reveal[data-delay="4"] { transition-delay: 0.32s; }
.reveal[data-delay="5"] { transition-delay: 0.40s; }

/* Scroll progress bar */
.progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 60; background: linear-gradient(90deg, var(--primary), var(--lime)); transition: width 90ms linear; }

/* ---------- Mobile menu ---------- */
@media (max-width: 880px) {
  .nav-links {
    position: fixed; top: calc(var(--nav-h) + 22px); left: 14px; right: 14px;
    flex-direction: column; align-items: stretch; gap: 4px; padding: 12px;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-md);
    backdrop-filter: blur(16px);
    transform: translateY(-12px) scale(0.98); opacity: 0; pointer-events: none;
    transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  }
  .nav-links.open { opacity: 1; transform: none; pointer-events: auto; }
  .nav-links a { padding: 12px 16px; border-radius: 12px; }
  .nav-toggle { display: grid; }
}

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .hero-figure { order: -1; }
  .hero-portrait { width: min(260px, 60%); }
  .about-grid { grid-template-columns: 1fr; gap: 36px; }
}

@media (max-width: 680px) {
  body { font-size: 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .hero-chip.c1 { left: 0; } .hero-chip.c2 { right: 0; }
  .exp-card, .pub-card { padding: 22px; }
  .timeline { padding-left: 26px; }
  .tl-item::before { left: -25px; }
}

/* ============================================================
   v2 — modern polish, lidar/time-series visuals, more motion
   ============================================================ */

/* Animated ambient mesh + film grain */
body::before { animation: meshDrift 26s ease-in-out infinite; will-change: transform; }
@keyframes meshDrift { 0%, 100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(-2.5%, 2%, 0) scale(1.06); } }
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="light"] body::after { opacity: 0.05; }

/* Animated gradient name */
.hero h1 .name {
  background: linear-gradient(110deg, var(--text) 18%, var(--primary) 50%, var(--lime) 70%, var(--text) 92%);
  background-size: 220% auto; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: nameShine 7s linear infinite;
}
@keyframes nameShine { to { background-position: 220% center; } }

/* Hero word rotator */
.role-br { display: none; }
.rotator {
  display: inline-block; font-weight: 600;
  background: linear-gradient(120deg, var(--primary), var(--lime)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  transition: opacity 0.36s var(--ease), transform 0.36s var(--ease);
}
.rotator.out { opacity: 0; transform: translateY(-10px); }

/* ---------- Marquee ---------- */
.marquee {
  overflow: hidden; padding: 16px 0; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--surface) 45%, transparent);
  -webkit-mask: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.marquee-track { display: inline-flex; align-items: center; white-space: nowrap; animation: marquee 42s linear infinite; will-change: transform; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.m-item { font-family: var(--font-display); font-weight: 500; font-size: 1.02rem; color: var(--text-muted); padding: 0 2px; }
.m-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); margin: 0 26px; opacity: 0.65; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Bento (focus) ---------- */
.bento { display: grid; grid-template-columns: 0.86fr 1.14fr; gap: 20px; }
.bento-card {
  position: relative; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface);
  padding: 30px; overflow: hidden; transform-style: preserve-3d; will-change: transform;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.bento-card:hover { border-color: var(--border); box-shadow: var(--shadow-md); }
.bento-glow { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.3s var(--ease);
  background: radial-gradient(240px circle at var(--mx,50%) var(--my,50%), var(--primary-soft), transparent 65%); }
.bento-card:hover .bento-glow { opacity: 1; }
.bento-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.bento-icon { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.bento-icon svg { width: 25px; height: 25px; }
.landsat-card .bento-icon { background: color-mix(in srgb, var(--sky) 18%, transparent); color: var(--sky); }
.bento-head h3 { font-size: 1.3rem; }
.bento-tag { color: var(--text-faint); font-size: 0.86rem; font-weight: 500; margin-top: 2px; }
.bento-body { color: var(--text-muted); font-size: 0.98rem; line-height: 1.65; }
.bento-body em { color: var(--primary); font-style: normal; font-weight: 600; }

/* Single-tree point cloud + extracted attributes */
.tree-viz { display: flex; gap: 18px; margin-top: 24px; align-items: center; }
.tree-canvas { width: 142px; height: 200px; flex: none; }
.tree-attrs { flex: 1; list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 14px; }
.tree-attr { display: flex; flex-direction: column; gap: 4px; }
.tree-attr .val { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--primary); line-height: 1; font-variant-numeric: tabular-nums; }
.tree-attr .lbl { font-size: 0.72rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; }
.ramp-legend { display: flex; align-items: center; gap: 12px; margin-top: 20px; font-size: 0.74rem; color: var(--text-faint); }
@media (max-width: 440px) {
  .tree-viz { flex-direction: column; align-items: stretch; }
  .tree-canvas { width: 100%; height: 180px; }
}
.ramp-bar { flex: 1; height: 8px; border-radius: 5px; background: linear-gradient(90deg, rgb(42,125,140), rgb(52,184,98), rgb(182,232,79), rgb(224,164,88)); }

/* Time series */
.ts-wrap { margin-top: 22px; }
.ts-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.ts-grid { stroke: var(--border-soft); stroke-width: 1; }
.ts-line { filter: drop-shadow(0 2px 7px rgba(52,184,98,0.32)); }
.ts-area { transition: opacity 0.6s var(--ease); }
.ts-dist-line { stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 3 4; opacity: 0.7; }
.ts-dist-dot { fill: var(--accent); }
.ts-anno { fill: var(--accent); font-size: 11px; font-family: var(--font-display); font-weight: 600; }
.ts-anno.rec { fill: var(--primary); }
.ts-cursor { fill: var(--lime); filter: drop-shadow(0 0 6px var(--lime)); }
.ts-tick { fill: var(--text-faint); font-size: 11px; font-family: var(--font-body); }
.ts-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 0.78rem; color: var(--text-faint); }
.ts-axis-y { color: var(--primary); font-weight: 600; }

/* ---------- Cursor glow ---------- */
.cursor-glow {
  position: fixed; top: 0; left: 0; width: 420px; height: 420px; margin: -210px 0 0 -210px; border-radius: 50%;
  pointer-events: none; z-index: -1; opacity: 0.6;   /* behind content so it never covers/tints text */
  background: radial-gradient(circle, var(--primary-soft), transparent 60%);
  will-change: transform;
}
[data-theme="light"] .cursor-glow { opacity: 0.8; }

@media (max-width: 880px) {
  .bento { grid-template-columns: 1fr; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
  .hero-orbit, .hero-chip, .scroll-cue .mouse::after, .hero-status .dot,
  .marquee-track, .hero h1 .name, body::before { animation: none !important; }
  .hero h1 .name { -webkit-text-fill-color: transparent; }
  .cursor-glow { display: none; }
}
