/* =========================================================
   Jerry Huang :: Portfolio
   Design system: cool near-black surfaces, electric-blue accent,
   amber stat highlight. Space Grotesk / IBM Plex Sans / IBM Plex Mono.
   ========================================================= */

:root {
  /* type */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  /* dark theme (default) */
  --bg: oklch(0.18 0.012 255);
  --bg-2: oklch(0.215 0.014 255);
  --surface: oklch(0.235 0.015 255);
  --surface-2: oklch(0.275 0.016 255);
  --border: oklch(1 0 0 / 0.09);
  --border-strong: oklch(1 0 0 / 0.16);
  --ink: oklch(0.97 0.005 255);
  --ink-soft: oklch(0.80 0.012 255);
  --ink-muted: oklch(0.64 0.014 255);
  --accent: oklch(0.80 0.13 232);
  --accent-2: oklch(0.83 0.13 75);
  --accent-ink: oklch(0.20 0.04 255);
  --glow: oklch(0.80 0.13 232 / 0.18);
  --shadow: 0 30px 70px -30px oklch(0.10 0.02 255 / 0.9);
  --shadow-card: 0 20px 50px -28px oklch(0.05 0.02 255 / 0.85);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: oklch(0.975 0.006 255);
  --bg-2: oklch(0.955 0.008 255);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.975 0.006 255);
  --border: oklch(0.20 0.02 255 / 0.10);
  --border-strong: oklch(0.20 0.02 255 / 0.18);
  --ink: oklch(0.24 0.02 255);
  --ink-soft: oklch(0.40 0.02 255);
  --ink-muted: oklch(0.54 0.02 255);
  --accent: oklch(0.58 0.16 250);
  --accent-2: oklch(0.66 0.15 55);
  --accent-ink: oklch(0.99 0.01 255);
  --glow: oklch(0.58 0.16 250 / 0.12);
  --shadow: 0 30px 70px -34px oklch(0.40 0.05 255 / 0.30);
  --shadow-card: 0 18px 44px -28px oklch(0.40 0.05 255 / 0.28);
  color-scheme: light;
}

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

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background 0.5s ease, color 0.5s ease;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ambient background mesh */
.aurora {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(48vw 48vw at 12% -8%, var(--glow), transparent 60%),
    radial-gradient(42vw 42vw at 95% 8%, oklch(0.83 0.13 75 / 0.10), transparent 60%),
    radial-gradient(50vw 50vw at 60% 110%, oklch(0.80 0.13 232 / 0.10), transparent 60%);
  opacity: 0.9;
}
.grid-noise {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 30%, black, transparent 80%);
  opacity: 0.5;
}

/* ===== scroll progress bar ===== */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 100; transition: width 0.1s linear;
}

/* ===== top nav ===== */
header {
  position: fixed; inset: 0 0 auto 0; z-index: 90;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem clamp(1.25rem, 4vw, 3rem);
  background: color-mix(in oklab, var(--bg) 72%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s ease, background 0.4s ease, padding 0.4s ease;
}
header.scrolled { border-bottom-color: var(--border); }
.brand {
  display: flex; align-items: center; gap: 0.7rem;
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  letter-spacing: 0.02em;
}
.brand .mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); font-weight: 700; font-size: 0.95rem;
  box-shadow: 0 8px 24px -8px var(--accent);
}
.top-actions { display: flex; align-items: center; gap: 0.5rem; }
.top-links { display: flex; gap: 0.3rem; }
.top-links a {
  font-size: 0.85rem; color: var(--ink-soft); font-weight: 500;
  padding: 0.5rem 0.85rem; border-radius: 999px;
  transition: color 0.2s, background 0.2s;
}
.top-links a:hover { color: var(--ink); background: var(--surface); }

.icon-btn {
  width: 40px; height: 40px; flex: none; border-radius: 11px;
  display: grid; place-items: center; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--ink-soft); transition: all 0.25s ease;
}
.icon-btn:hover { color: var(--ink); border-color: var(--border-strong); transform: translateY(-2px); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
[data-theme="light"] .theme-toggle .sun { display: block; }
[data-theme="light"] .theme-toggle .moon { display: none; }

/* ===== mobile menu toggle (hidden on desktop) ===== */
.menu-toggle { display: none; }
.menu-toggle .ex { display: none; }
body.menu-open .menu-toggle .bars { display: none; }
body.menu-open .menu-toggle .ex { display: block; }

/* ===== mobile menu overlay ===== */
.mobile-menu {
  position: fixed; inset: 0; z-index: 88;
  background: color-mix(in oklab, var(--bg) 94%, transparent);
  backdrop-filter: blur(24px) saturate(1.2);
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(5rem, 14vh, 7rem) clamp(1.5rem, 8vw, 3rem) 3rem;
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s;
}
body.menu-open .mobile-menu { opacity: 1; visibility: visible; transform: none; }
.mobile-menu-nav { display: flex; flex-direction: column; gap: 0.3rem; }
.mobile-menu-nav a {
  display: flex; align-items: baseline; gap: 1rem;
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.8rem, 8vw, 2.6rem); letter-spacing: -0.02em;
  color: var(--ink); padding: 0.5rem 0; min-height: 56px;
  border-bottom: 1px solid var(--border);
  opacity: 0; transform: translateX(-14px);
  transition: color 0.2s ease;
}
body.menu-open .mobile-menu-nav a { animation: mm-in 0.5s cubic-bezier(.2,.7,.2,1) forwards; }
body.menu-open .mobile-menu-nav a:nth-child(1) { animation-delay: 0.06s; }
body.menu-open .mobile-menu-nav a:nth-child(2) { animation-delay: 0.10s; }
body.menu-open .mobile-menu-nav a:nth-child(3) { animation-delay: 0.14s; }
body.menu-open .mobile-menu-nav a:nth-child(4) { animation-delay: 0.18s; }
body.menu-open .mobile-menu-nav a:nth-child(5) { animation-delay: 0.22s; }
body.menu-open .mobile-menu-nav a:nth-child(6) { animation-delay: 0.26s; }
body.menu-open .mobile-menu-nav a:nth-child(7) { animation-delay: 0.30s; }
@keyframes mm-in { to { opacity: 1; transform: none; } }
.mobile-menu-nav a:active { color: var(--accent); }
.mobile-menu-nav .mm-num { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 500; color: var(--accent); }
.mobile-menu-foot { margin-top: 2rem; }
.mobile-menu-foot .btn { width: 100%; justify-content: center; }

/* ===== dot rail nav ===== */
.rail {
  position: fixed; right: clamp(0.9rem, 2vw, 1.8rem); top: 50%;
  transform: translateY(-50%); z-index: 80;
  display: flex; flex-direction: column; gap: 0.85rem; align-items: flex-end;
}
.rail a {
  display: flex; align-items: center; gap: 0.6rem;
  color: var(--ink-muted); font-size: 0.72rem; font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.rail .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--border-strong); transition: all 0.3s ease;
}
.rail .label {
  opacity: 0; transform: translateX(8px);
  transition: all 0.3s ease; white-space: nowrap;
}
.rail a:hover .label { opacity: 1; transform: translateX(0); }
.rail a:hover .dot { background: var(--ink-soft); }
.rail a.active .dot {
  background: var(--accent); box-shadow: 0 0 0 4px var(--glow); transform: scale(1.15);
}
.rail a.active .label { opacity: 1; transform: translateX(0); color: var(--ink); }

/* ===== layout ===== */
.section {
  max-width: 1120px; margin: 0 auto;
  padding: clamp(4rem, 9vw, 7rem) clamp(1.25rem, 5vw, 3rem);
}
.section-head { margin-bottom: clamp(2rem, 4vw, 3rem); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 0.9rem;
}
.eyebrow::before {
  content: ""; width: 22px; height: 1px; background: var(--accent);
}
.section h2 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.9rem, 4.5vw, 3rem); letter-spacing: -0.02em; line-height: 1.05;
}
.section-head p { color: var(--ink-muted); margin-top: 0.7rem; max-width: 52ch; }

/* ===== reveal ===== */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s cubic-bezier(.2,.7,.2,1), transform 0.7s cubic-bezier(.2,.7,.2,1); }
.reveal.in-view { 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; }

/* ===== HERO ===== */
.hero {
  position: relative; min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  max-width: 1120px; margin: 0 auto;
  padding: clamp(7rem, 14vh, 9rem) clamp(1.25rem, 5vw, 3rem) clamp(3rem, 8vh, 5rem);
}
.hero-spotlight {
  position: absolute; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, var(--glow), transparent 65%);
  pointer-events: none; left: 0; top: 0; opacity: 0;
  transition: opacity 0.4s ease; mix-blend-mode: screen; z-index: 0;
}
.hero > * { position: relative; z-index: 1; }
.hero-bg {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 100vw; transform: translateX(-50%);
  pointer-events: none;
  background: url('../images/bg_berkeley.png') center right / cover no-repeat;
  opacity: 0.22; filter: saturate(0.92);
  -webkit-mask-image: linear-gradient(90deg, transparent 18%, rgba(0,0,0,0.3) 52%, #000 92%);
  mask-image: linear-gradient(90deg, transparent 18%, rgba(0,0,0,0.3) 52%, #000 92%);
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 35%, var(--bg) 96%);
}
[data-theme="light"] .hero-bg { opacity: 0.26; }
.hero-status {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-soft);
  padding: 0.45rem 0.9rem; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); width: max-content;
  margin-bottom: 1.6rem;
}
.hero-status .pulse {
  width: 8px; height: 8px; border-radius: 50%; background: oklch(0.78 0.16 150);
  box-shadow: 0 0 0 0 oklch(0.78 0.16 150 / 0.6); animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 oklch(0.78 0.16 150 / 0.5); }
  70% { box-shadow: 0 0 0 9px oklch(0.78 0.16 150 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(0.78 0.16 150 / 0); }
}
.hero h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.8rem, 9vw, 6.5rem); line-height: 0.95;
  letter-spacing: -0.035em; margin-bottom: 0.4rem;
}
.hero h1 .accent { color: var(--accent); }
.roles {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.15rem, 3.4vw, 2rem); letter-spacing: -0.01em;
  height: 1.4em; margin: 0.6rem 0 0;
  display: flex; align-items: center; gap: 0.7rem;
}
.roles .prefix { color: var(--ink-muted); }
.roles .rotator { color: var(--ink); position: relative; }
.roles .rotator::after {
  content: ""; display: inline-block; width: 2px; height: 1.05em;
  background: var(--accent); margin-left: 4px; vertical-align: -0.18em;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0; } }
.hero-lead {
  color: var(--ink-soft); font-size: clamp(1rem, 2.2vw, 1.2rem);
  max-width: 56ch; margin: 1.6rem 0 2rem;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-weight: 600; font-size: 0.95rem; padding: 0.85rem 1.5rem;
  border-radius: 12px; cursor: pointer; border: 1px solid transparent;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease, border-color 0.22s ease;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); box-shadow: 0 18px 40px -18px var(--accent); }
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 24px 50px -16px var(--accent); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { transform: translateY(-3px); border-color: var(--border-strong); background: var(--surface-2); }

/* hero stat strip */
.hero-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.6rem, 2vw, 1.5rem); margin-top: clamp(2.5rem, 6vw, 4rem);
  border-top: 1px solid var(--border); padding-top: 2rem;
}
.stat .num {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.7rem, 4.5vw, 2.8rem); line-height: 1;
  letter-spacing: -0.02em; color: var(--ink);
}
.stat .num .suffix { color: var(--accent); }
.stat .lbl { font-size: 0.82rem; color: var(--ink-muted); margin-top: 0.45rem; }

/* ===== ABOUT ===== */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.about-lead { font-size: clamp(1.15rem, 2.6vw, 1.55rem); font-family: var(--font-display); font-weight: 400; line-height: 1.4; letter-spacing: -0.01em; }
.about-lead b { color: var(--accent); font-weight: 600; }
.about-body p { color: var(--ink-soft); margin-top: 1rem; }
.photo-card {
  position: relative; border-radius: 18px; overflow: hidden;
  border: 1px solid var(--border); background: var(--surface);
  box-shadow: var(--shadow-card); aspect-ratio: 4/5;
}
.photo-card img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(0.2) contrast(1.02); }

/* photo strip (user-fillable image slots) */
.photo-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: clamp(1.5rem, 4vw, 2.5rem); }
.photo-strip figure { margin: 0; }
.photo-strip image-slot {
  display: block; width: 100%; aspect-ratio: 4 / 3;
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-card);
  background: repeating-linear-gradient(135deg, var(--surface) 0 14px, var(--surface-2) 14px 28px);
}
.photo-strip figcaption {
  font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.04em;
  color: var(--ink-muted); margin-top: 0.6rem; text-align: center;
}
.photo-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.8rem; text-align: center;
  padding: 1.5rem; color: var(--ink-muted); font-family: var(--font-mono); font-size: 0.8rem;
  background:
    repeating-linear-gradient(135deg, var(--surface) 0 14px, var(--surface-2) 14px 28px);
}
.photo-placeholder .ph-icon { width: 46px; height: 46px; opacity: 0.6; }
.facts { margin-top: 1.4rem; display: flex; flex-direction: column; gap: 0.1rem; }
.fact { display: flex; justify-content: space-between; gap: 1rem; padding: 0.7rem 0; border-top: 1px solid var(--border); font-size: 0.9rem; }
.fact:last-child { border-bottom: 1px solid var(--border); }
.fact .k { color: var(--ink-muted); font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.03em; }
.fact .v { color: var(--ink); font-weight: 500; text-align: right; }

/* ===== TIMELINE / EXPERIENCE ===== */
.timeline { position: relative; display: flex; flex-direction: column; gap: 1rem; }
.timeline::before {
  content: ""; position: absolute; left: 27px; top: 8px; bottom: 8px; width: 2px;
  background: var(--border-strong); opacity: 0.6; border-radius: 2px;
}
.timeline-fill {
  position: absolute; left: 27px; top: 8px; width: 2px; height: 0; border-radius: 2px;
  background: linear-gradient(var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--glow); z-index: 0; transition: height 0.12s linear;
}
.tl-item.active .tl-logo {
  box-shadow: 0 0 0 4px var(--glow), var(--shadow-card);
  transform: scale(1.08) rotate(-4deg);
}
.tl-item.active .tl-card { border-color: var(--border-strong); }

/* ===== AMBIENT CARD / SECTION IMAGERY ===== */
.card-media {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: var(--img); background-size: cover; background-position: center;
  opacity: 0.24; transition: opacity 0.45s ease;
  -webkit-mask-image: linear-gradient(90deg, transparent 18%, #000 110%);
  mask-image: linear-gradient(90deg, transparent 18%, #000 110%);
}
.card-media--photo { background-position: 50% 28%; opacity: 0.16; }
.has-media > *:not(.card-media) { position: relative; z-index: 1; }
.tl-item:hover .card-media { opacity: 0.36; }
[data-theme="light"] .card-media { opacity: 0.26; }
[data-theme="light"] .tl-item:hover .card-media { opacity: 0.38; }

.section-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: var(--img); background-size: cover; background-position: center;
  opacity: 0.14;
  -webkit-mask-image: radial-gradient(135% 115% at 50% 0%, #000, transparent 70%);
  mask-image: radial-gradient(135% 115% at 50% 0%, #000, transparent 70%);
}
[data-theme="light"] .section-bg { opacity: 0.17; }
.section-bg ~ * { position: relative; z-index: 1; }
.tl-item {
  position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 1.1rem;
}
.tl-logo {
  width: 56px; height: 56px; border-radius: 14px; flex: none; z-index: 1;
  background: oklch(1 0 0 / 0.95); border: 1px solid var(--border-strong);
  display: grid; place-items: center; padding: 8px; box-shadow: var(--shadow-card);
}
.tl-logo img { width: 100%; height: 100%; object-fit: contain; }
.tl-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 1.3rem 1.4rem; box-shadow: var(--shadow-card); position: relative; overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.tl-card:hover { transform: translateX(6px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.tl-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.tl-role { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; letter-spacing: -0.01em; }
.tl-org { color: var(--accent); font-weight: 600; }
.tl-meta { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-muted); letter-spacing: 0.02em; white-space: nowrap; }
.tl-bullets { list-style: none; margin-top: 0.85rem; display: flex; flex-direction: column; gap: 0.45rem; }
.tl-bullets li { position: relative; padding-left: 1.1rem; color: var(--ink-soft); font-size: 0.94rem; }
.tl-bullets li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.95rem; }
.tag { font-family: var(--font-mono); font-size: 0.72rem; padding: 0.28rem 0.6rem; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-muted); white-space: nowrap; }

/* ===== CARD LINKS (sleek external-link pills) ===== */
.card-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.card-links a {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.01em;
  padding: 0.42rem 0.72rem; border-radius: 8px; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-soft);
  transition: color 0.22s ease, background 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}
.card-links a svg { width: 13px; height: 13px; opacity: 0.65; transition: transform 0.22s ease, opacity 0.22s ease; }
.card-links a:hover { color: var(--accent-ink); background: var(--accent); border-color: transparent; transform: translateY(-2px); }
.card-links a:hover svg { transform: translate(2px, -2px); opacity: 1; }

/* logo micro-interaction */
.tl-logo, .mini-logo { transition: transform 0.35s cubic-bezier(.2,.7,.2,1); }
.tl-item:hover .tl-logo { transform: scale(1.08) rotate(-4deg); }
.mini:hover .mini-logo { transform: scale(1.08) rotate(-4deg); }

/* tilt context for project cards */
.proj-grid { perspective: 1100px; }
.proj { transform-style: preserve-3d; will-change: transform; }

/* back to top */
.to-top {
  position: fixed; right: clamp(1rem, 3vw, 2rem); bottom: clamp(1rem, 3vw, 2rem); z-index: 85;
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); border: none; cursor: pointer;
  box-shadow: 0 14px 34px -12px var(--accent);
  opacity: 0; transform: translateY(16px) scale(0.9); pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(.2,.7,.2,1);
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top.show:hover { transform: translateY(-3px); }
.to-top svg { width: 20px; height: 20px; }

/* copy-email button */
.copy-email {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer;
  background: none; border: none; font-family: inherit; font-size: inherit;
  color: var(--accent); font-weight: 600; padding: 0;
}
.copy-email svg { width: 14px; height: 14px; }
.copy-email .copied { color: oklch(0.78 0.16 150); }

/* ===== PROJECTS ===== */
.proj-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem; }
.proj {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 1.6rem; overflow: hidden;
  box-shadow: var(--shadow-card); transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}
.proj::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; opacity: 0;
  background: radial-gradient(420px 200px at var(--mx,80%) -10%, var(--glow), transparent 70%);
  transition: opacity 0.4s ease; pointer-events: none;
}
.proj:hover { transform: translateY(-6px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.proj:hover::after { opacity: 1; }
.proj-num { font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent); }
.proj h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; letter-spacing: -0.01em; margin: 0.5rem 0 0.2rem; }
.proj .when { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-muted); }
.proj p { color: var(--ink-soft); font-size: 0.94rem; margin-top: 0.8rem; }
.proj .tag-row { margin-top: 1rem; }

/* ===== EDUCATION + CREDENTIALS columns ===== */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); }
.mini { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.1rem 1.2rem; display: flex; gap: 1rem; align-items: center; box-shadow: var(--shadow-card); transition: border-color 0.25s, transform 0.25s; }
.mini:hover { border-color: var(--border-strong); transform: translateX(4px); }
.mini + .mini { margin-top: 0.8rem; }
.mini-logo { width: 46px; height: 46px; border-radius: 11px; flex: none; background: oklch(1 0 0 / 0.95); border: 1px solid var(--border); padding: 6px; display: grid; place-items: center; }
.mini-logo img { width: 100%; height: 100%; object-fit: contain; }
.mini h4 { font-size: 1rem; font-weight: 600; }
.mini p { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-muted); margin-top: 0.15rem; }
.mini .badge { margin-left: auto; font-family: var(--font-mono); font-size: 0.72rem; color: var(--accent-2); font-weight: 600; white-space: nowrap; }

.col-title { font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-muted); margin-bottom: 1.1rem; }

/* ===== AWARDS ===== */
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.6rem; }
.chip {
  font-family: var(--font-mono); font-size: 0.78rem; padding: 0.45rem 0.95rem;
  border-radius: 999px; cursor: pointer; background: var(--surface);
  border: 1px solid var(--border); color: var(--ink-soft); transition: all 0.2s ease;
}
.chip:hover { color: var(--ink); border-color: var(--border-strong); }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.award-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.award {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 1.2rem 1.25rem; box-shadow: var(--shadow-card);
  transition: transform 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;
}
.award:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.award.hide { display: none; }
.award .a-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.6rem; }
.award .a-cat { font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); }
.award .a-date { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-muted); }
.award h4 { font-size: 1.02rem; font-weight: 600; line-height: 1.25; letter-spacing: -0.005em; }
.award p { color: var(--ink-muted); font-size: 0.85rem; margin-top: 0.4rem; }

/* ===== SKILLS / LANGUAGES ===== */
.skills-wrap { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(1.5rem,4vw,3rem); }
.skill-cloud { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.skill-cloud span {
  font-size: 0.92rem; font-weight: 500; padding: 0.55rem 1.1rem; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); color: var(--ink-soft);
  transition: all 0.25s ease; cursor: default;
}
.skill-cloud span:hover { color: var(--accent-ink); background: var(--accent); border-color: transparent; transform: translateY(-3px); }
.lang-list { display: flex; flex-direction: column; gap: 0.9rem; }
.lang { }
.lang-top { display: flex; justify-content: space-between; font-size: 0.92rem; margin-bottom: 0.35rem; }
.lang-top .lvl { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-muted); }
.lang-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.lang-bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 1s cubic-bezier(.2,.7,.2,1); }

/* ===== CONTACT ===== */
.contact { text-align: center; }
.contact-card {
  max-width: 720px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: 22px; padding: clamp(1.8rem, 5vw, 3rem);
  box-shadow: var(--shadow); text-align: left;
}
.contact form { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.contact .full { grid-column: 1 / -1; }
.contact label { display: flex; flex-direction: column; gap: 0.4rem; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }
.contact input, .contact textarea {
  font-family: var(--font-body); font-size: 0.98rem; color: var(--ink);
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 0.8rem 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.contact textarea { min-height: 130px; resize: vertical; }
.contact input:focus, .contact textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); }
.contact .btn-primary { justify-content: center; }
.contact .status { grid-column: 1/-1; font-family: var(--font-mono); font-size: 0.85rem; text-align: center; min-height: 1.2em; }
.contact-alt { margin-top: 1.4rem; color: var(--ink-muted); font-size: 0.9rem; }
.contact-alt a { color: var(--accent); font-weight: 600; }

footer {
  text-align: center; padding: 2.5rem 1.5rem 3rem; color: var(--ink-muted);
  font-family: var(--font-mono); font-size: 0.78rem; border-top: 1px solid var(--border);
}
footer .socials { display: flex; gap: 0.6rem; justify-content: center; margin-bottom: 1.2rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 940px) {
  .rail { display: none; }
  .about-grid, .skills-wrap { grid-template-columns: 1fr; }
  .photo-card { max-width: 340px; }
  .proj-grid, .split, .award-grid { grid-template-columns: 1fr; }
  .award-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .top-links { display: none; }
  .menu-toggle { display: grid; }
  .hero-stats { grid-template-columns: 1fr 1fr; gap: 1.2rem 1rem; }
  .award-grid { grid-template-columns: 1fr; }
  .photo-strip { grid-template-columns: 1fr; max-width: 340px; }
  .contact form { grid-template-columns: 1fr; }
  .tl-item { grid-template-columns: 44px 1fr; gap: 0.8rem; }
  .tl-logo { width: 44px; height: 44px; }
  .timeline::before, .timeline-fill { left: 21px; }

  /* hero flows from top so nothing hides under the header */
  .hero { min-height: auto; justify-content: flex-start; padding-top: 7rem; padding-bottom: 3rem; }
  .hero-status { max-width: 100%; width: auto; align-items: flex-start; line-height: 1.45; }
  .hero-status .pulse { flex: none; margin-top: 0.4em; }
  .hero-cta { gap: 0.7rem; }
  .hero-cta .btn { flex: 1 1 100%; justify-content: center; }
  .hero-stats { margin-top: 2.2rem; }

  /* comfier section rhythm + readable cards */
  .section { padding-top: 3.5rem; padding-bottom: 3.5rem; }
  .tl-card { padding: 1.1rem 1.15rem; }
  .tl-top { gap: 0.25rem; }
  .tl-meta { width: 100%; }
  .card-links a, .chip { min-height: 38px; }
  .mini { padding: 0.95rem 1rem; }

  /* keep the floating button clear of mobile browser chrome */
  .to-top { bottom: calc(1rem + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .brand span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
