/* ============================================================
   Ashwin Raj — Resume / Portfolio
   Plain CSS. No frameworks, no build step.
   ============================================================ */

/* ---------- Custom properties ---------- */
@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

:root {
  --bg: #05060f;
  --bg-soft: #0a0c1d;
  --text: #e8ecf8;
  --muted: #9aa3c0;
  --cyan: #00e5ff;
  --violet: #8b5cf6;
  --magenta: #ff3d81;
  --gold: #ffc857;
  --card: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.09);
  --grad: linear-gradient(100deg, var(--cyan), var(--violet) 50%, var(--magenta));
  --font-display: 'Syne', 'Avenir Next', system-ui, sans-serif;
  --font-body: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;
  --nav-h: 76px;
  --radius: 18px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.is-loading { overflow: hidden; }

html.custom-cursor,
html.custom-cursor a,
html.custom-cursor button { cursor: none; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
strong { color: var(--text); font-weight: 600; }

.mono { font-family: var(--font-mono); font-size: 0.85em; letter-spacing: 0.02em; }
.dim { color: var(--muted); }
.container { width: min(1120px, 92%); margin-inline: auto; }

/* Visually hidden, available to screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

::selection { background: var(--cyan); color: #03131a; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--cyan), var(--violet), var(--magenta));
  border-radius: 8px;
  border: 2px solid var(--bg);
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Gradient text */
.grad {
  background: var(--grad);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: grad-shift 6s ease-in-out infinite alternate;
}

@keyframes grad-shift {
  from { background-position: 0% center; }
  to   { background-position: 100% center; }
}

/* ============================================================
   Ambient background — aurora blobs + film grain
   ============================================================ */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  filter: blur(90px) saturate(130%);
}

.aurora-blob {
  position: absolute;
  width: 55vw;
  height: 55vw;
  min-width: 480px;
  min-height: 480px;
  border-radius: 50%;
  opacity: 0.16;
  will-change: transform;
}

.aurora-1 {
  background: radial-gradient(circle, var(--cyan), transparent 65%);
  top: -18%; left: -12%;
  animation: drift-1 26s ease-in-out infinite alternate;
}
.aurora-2 {
  background: radial-gradient(circle, var(--violet), transparent 65%);
  top: 28%; right: -18%;
  animation: drift-2 32s ease-in-out infinite alternate;
}
.aurora-3 {
  background: radial-gradient(circle, var(--magenta), transparent 65%);
  bottom: -22%; left: 22%;
  animation: drift-3 38s ease-in-out infinite alternate;
}

@keyframes drift-1 { to { transform: translate(12vw, 14vh) scale(1.15); } }
@keyframes drift-2 { to { transform: translate(-10vw, -10vh) scale(0.9); } }
@keyframes drift-3 { to { transform: translate(-8vw, -12vh) scale(1.2); } }

.noise {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

/* Site-wide animated 3D particle network — sits above the aurora glow,
   behind all page content. Transparent so the aurora shows through. */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ============================================================
   Preloader
   ============================================================ */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.preloader.done { opacity: 0; visibility: hidden; }

.preloader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
}

.preloader-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 3rem;
  letter-spacing: -0.02em;
}

.preloader-logo .dot,
.nav-logo .dot { color: var(--magenta); }

.preloader-bar {
  width: 220px;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.preloader-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--grad);
  transition: width 0.1s linear;
}

.preloader-count { color: var(--muted); }

/* ============================================================
   Custom cursor
   ============================================================ */
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  z-index: 1001;
  pointer-events: none;
  border-radius: 50%;
  translate: -50% -50%;
  opacity: 0;
}

html.custom-cursor .cursor-dot,
html.custom-cursor .cursor-ring { opacity: 1; }

.cursor-dot {
  width: 6px; height: 6px;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

.cursor-ring {
  width: 38px; height: 38px;
  border: 1.5px solid rgba(0, 229, 255, 0.55);
  transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out),
              border-color 0.25s, background-color 0.25s;
}

.cursor-ring.is-hover {
  width: 58px; height: 58px;
  border-color: rgba(255, 61, 129, 0.8);
  background: rgba(255, 61, 129, 0.08);
}

/* ============================================================
   Scroll progress
   ============================================================ */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  z-index: 200;
  background: var(--grad);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.6);
}

/* ============================================================
   Navigation
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  transition: background-color 0.35s ease, border-color 0.35s ease, backdrop-filter 0.35s ease;
  border-bottom: 1px solid transparent;
}

.nav.scrolled {
  background: rgba(5, 6, 15, 0.65);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}

/* While the mobile menu is open the blur must come off the header:
   backdrop-filter makes the header the containing block for the
   fixed-position .nav-links overlay, collapsing it into the 76px bar.
   The overlay carries its own background + blur. */
.nav.open {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.nav-inner {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  position: relative;
  z-index: 102;
  /* gentler, slower glitch on the small logo */
  --gx: 0.45;
  --glitch-dur: 5s;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.9rem;
}

.nav-links a:not(.btn) {
  font-size: 0.95rem;
  color: var(--muted);
  transition: color 0.25s;
  position: relative;
}

.nav-links a:not(.btn):hover,
.nav-links a.active { color: var(--text); }

.nav-links a:not(.btn)::after {
  content: '';
  position: absolute;
  left: 0; bottom: -6px;
  width: 100%;
  height: 1.5px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease-out);
}

.nav-links a:not(.btn):hover::after,
.nav-links a.active::after { transform: scaleX(1); }

.nav-idx { color: var(--cyan); margin-right: 0.4rem; font-size: 0.78em; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px; height: 42px;
  background: none;
  border: 0;
  z-index: 102;
  align-items: center;
}

.nav-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease-out), opacity 0.3s;
}

.nav.open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav.open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav.open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.7rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.98rem;
  border: 1px solid transparent;
  transition: transform 0.35s var(--ease-out), box-shadow 0.3s, border-color 0.3s,
              background-color 0.3s, color 0.3s;
}

/* Light sweep across the primary button */
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, 0.45) 50%, transparent 68%);
  transform: translateX(-120%);
  animation: btn-shimmer 3.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes btn-shimmer {
  0%, 55% { transform: translateX(-120%); }
  90%, 100% { transform: translateX(120%); }
}

/* Click ripple (spawned by JS) */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: translate(-50%, -50%) scale(0);
  animation: ripple 0.65s var(--ease-out) forwards;
  pointer-events: none;
}

@keyframes ripple {
  to { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

.btn svg { width: 18px; height: 18px; flex: none; }

.btn-primary {
  background: var(--grad);
  background-size: 160% auto;
  color: #060312;
  box-shadow: 0 6px 28px rgba(139, 92, 246, 0.4);
}

.btn-primary:hover {
  background-position: 90% center;
  box-shadow: 0 8px 38px rgba(0, 229, 255, 0.45);
}

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}

.btn-ghost:hover {
  border-color: rgba(0, 229, 255, 0.6);
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.18);
}

.btn-sm { padding: 0.5rem 1.1rem; font-size: 0.85rem; }

.btn-ghost.copied {
  border-color: rgba(0, 229, 255, 0.8);
  color: var(--cyan);
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 30%, transparent 75%);
}

.hero-content {
  position: relative;
  z-index: 1;
  padding-top: var(--nav-h);
}

.hero-eyebrow { color: var(--cyan); margin-bottom: 1.4rem; }

.hero-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.2rem, 11vw, 8rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin-bottom: 1.6rem;
  position: relative;
  width: fit-content;
  perspective: 700px;
}

/* Per-letter 3D entrance (spans created by JS, fired once the preloader lifts) */
.ltr {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.55em) rotateX(-75deg);
  transform-origin: bottom center;
}

/* `:not(.done)` so the forwards-filling entrance stops overriding the
   hover transform once a letter has finished animating in */
body.loaded .ltr:not(.done) {
  animation: ltr-in 0.7s var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 48ms + 0.12s);
}

@keyframes ltr-in {
  to { opacity: 1; transform: none; }
}

.ltr.done {
  animation: none;
  opacity: 1;
  transform: none;
  transition: transform 0.3s var(--ease-out);
}

.ltr.done:hover {
  transform: translateY(-0.08em) rotate(-5deg) scale(1.06);
}

/* Glitch slices.
   The alt-text syntax (`/ ''`) keeps the duplicated name out of the
   accessibility tree; older browsers fall back to the plain declaration. */
.glitch::before,
.glitch::after {
  content: attr(data-text);
  content: attr(data-text) / '';
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  -webkit-text-fill-color: currentColor;
}

/* --glitch-dur controls cadence (shorter = more frequent); --gx scales the
   slice offset so smaller elements glitch less violently. Two bursts/cycle. */
.glitch::before {
  color: var(--cyan);
  animation: glitch-a var(--glitch-dur, 3s) infinite steps(1);
}

.glitch::after {
  color: var(--magenta);
  animation: glitch-b var(--glitch-dur, 3s) infinite steps(1);
}

@keyframes glitch-a {
  0%, 17.9%, 24%, 64%, 71%, 100% { opacity: 0; transform: none; clip-path: inset(0 0 0 0); }
  /* burst 1 */
  18%   { opacity: 0.85; transform: translate(calc(-7px * var(--gx, 1)), calc(3px * var(--gx, 1)));  clip-path: inset(12% 0 58% 0); }
  20%   { opacity: 0.85; transform: translate(calc(5px * var(--gx, 1)),  calc(-2px * var(--gx, 1))); clip-path: inset(62% 0 8% 0); }
  22%   { opacity: 0.85; transform: translate(calc(-4px * var(--gx, 1)), calc(1px * var(--gx, 1)));  clip-path: inset(35% 0 38% 0); }
  /* burst 2 */
  65%   { opacity: 0.85; transform: translate(calc(6px * var(--gx, 1)),  calc(-3px * var(--gx, 1))); clip-path: inset(20% 0 50% 0); }
  67.5% { opacity: 0.85; transform: translate(calc(-5px * var(--gx, 1)), calc(2px * var(--gx, 1)));  clip-path: inset(55% 0 18% 0); }
  69.5% { opacity: 0.85; transform: translate(calc(3px * var(--gx, 1)),  calc(1px * var(--gx, 1)));  clip-path: inset(42% 0 30% 0); }
}

@keyframes glitch-b {
  0%, 18.4%, 24.5%, 64.5%, 71.5%, 100% { opacity: 0; transform: none; clip-path: inset(0 0 0 0); }
  /* burst 1 */
  18.5% { opacity: 0.85; transform: translate(calc(6px * var(--gx, 1)),  calc(-3px * var(--gx, 1))); clip-path: inset(48% 0 22% 0); }
  20.5% { opacity: 0.85; transform: translate(calc(-6px * var(--gx, 1)), calc(2px * var(--gx, 1)));  clip-path: inset(8% 0 75% 0); }
  22.5% { opacity: 0.85; transform: translate(calc(4px * var(--gx, 1)),  calc(2px * var(--gx, 1)));  clip-path: inset(72% 0 4% 0); }
  /* burst 2 */
  65.5% { opacity: 0.85; transform: translate(calc(-5px * var(--gx, 1)), calc(3px * var(--gx, 1)));  clip-path: inset(30% 0 44% 0); }
  68%   { opacity: 0.85; transform: translate(calc(5px * var(--gx, 1)),  calc(-2px * var(--gx, 1))); clip-path: inset(60% 0 12% 0); }
  70%   { opacity: 0.85; transform: translate(calc(-3px * var(--gx, 1)), calc(1px * var(--gx, 1)));  clip-path: inset(15% 0 60% 0); }
}

.hero-role {
  font-family: var(--font-mono);
  font-size: clamp(1.05rem, 2.4vw, 1.45rem);
  color: var(--text);
  min-height: 2.2em;
  margin-bottom: 1.4rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.caret {
  display: inline-block;
  width: 0.55em;
  height: 1.15em;
  background: var(--cyan);
  translate: 2px 0.18em;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.hero-summary {
  max-width: 620px;
  color: var(--muted);
  margin-bottom: 2.6rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
}

.scroll-cue {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  translate: -50% 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.scroll-line {
  width: 1px;
  height: 56px;
  background: rgba(255, 255, 255, 0.14);
  position: relative;
  overflow: hidden;
}

.scroll-line::after {
  content: '';
  position: absolute;
  top: -40%;
  left: 0;
  width: 100%;
  height: 40%;
  background: var(--grad);
  animation: scroll-drop 2.2s var(--ease-out) infinite;
}

@keyframes scroll-drop {
  to { top: 110%; }
}

/* ============================================================
   Marquee
   ============================================================ */
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  padding: 1.05rem 0;
  position: relative;
}

.marquee::before,
.marquee::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 120px;
  z-index: 1;
  pointer-events: none;
}

.marquee::before { left: 0; background: linear-gradient(90deg, var(--bg), transparent); }
.marquee::after { right: 0; background: linear-gradient(-90deg, var(--bg), transparent); }

.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 36s linear infinite;
}

.marquee:hover .marquee-track { animation-play-state: paused; }

.marquee-group {
  display: flex;
  align-items: center;
  flex: none;
}

.marquee-group span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 1.6rem;
  white-space: nowrap;
  transition: color 0.3s;
}

.marquee-group span:hover { color: var(--cyan); }

.marquee-group i { color: var(--violet); font-style: normal; }

@keyframes marquee {
  to { transform: translateX(-50%); }
}

/* Outlined variant scrolling the opposite way */
.marquee-alt .marquee-track {
  animation-direction: reverse;
  animation-duration: 30s;
}

.marquee-alt .marquee-group span {
  font-size: 1.2rem;
  color: transparent;
  -webkit-text-stroke: 1px rgba(0, 229, 255, 0.4);
  transition: color 0.3s;
}

.marquee-alt .marquee-group span:hover { color: var(--cyan); }

.marquee-alt .marquee-group i { color: var(--magenta); }

/* ============================================================
   Sections — shared
   ============================================================ */
.section { padding: clamp(5rem, 11vw, 8.5rem) 0; position: relative; }

.section-head {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: clamp(2.6rem, 6vw, 4rem);
}

.section-idx { color: var(--cyan); font-size: 1.05rem; }

.section-head h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.section-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.35), var(--border) 40%, transparent);
}

/* The line draws itself when the heading reveals (JS-only pre-state) */
html.js .section-head.reveal .section-line {
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.2s var(--ease-out) 0.25s;
}

html.js .section-head.reveal.in .section-line { transform: scaleX(1); }

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.1rem;
}

.chips li {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  color: var(--cyan);
  background: rgba(0, 229, 255, 0.07);
  border: 1px solid rgba(0, 229, 255, 0.18);
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  transition: background-color 0.25s, transform 0.25s;
}

.chips li:hover {
  background: rgba(0, 229, 255, 0.16);
  transform: translateY(-2px);
}

/* Staggered chip pop-in when the parent card reveals (JS sets --ci per chip) */
html.js .reveal .chips li {
  opacity: 0;
  translate: 0 10px;
}

html.js .reveal.in .chips li {
  animation: chip-in 0.5s var(--ease-out) forwards;
  animation-delay: calc(var(--ci, 0) * 45ms + 0.25s);
}

@keyframes chip-in {
  to { opacity: 1; translate: none; }
}

/* Glow card — rotating conic border */
.glow-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.glow-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(
    from var(--angle),
    transparent 0%,
    transparent 55%,
    rgba(0, 229, 255, 0.7) 72%,
    rgba(139, 92, 246, 0.7) 80%,
    transparent 95%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s;
  animation: border-spin 5s linear infinite;
  pointer-events: none;
}

.glow-card:hover::before { opacity: 1; }

.spin-border::before { opacity: 1; }

@keyframes border-spin {
  to { --angle: 360deg; }
}

/* Reveal-on-scroll.
   Uses the `translate` property (not `transform`) so it composes with the
   3D tilt transform on [data-tilt] cards instead of clashing in the cascade. */
.reveal {
  opacity: 0;
  translate: 0 30px;
  transition: opacity 0.8s var(--ease-out), translate 0.8s var(--ease-out);
  transition-delay: var(--d, 0s);
}

.reveal.in {
  opacity: 1;
  translate: none;
}

/* ============================================================
   About
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}

.about-text p { color: var(--muted); margin-bottom: 1.3rem; }

.now-card {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 1.2rem 1.5rem;
  margin-top: 1.8rem;
}

.now-card p { color: var(--text); margin: 0; }

.pulse-dot {
  flex: none;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #2dd4a7;
  box-shadow: 0 0 0 0 rgba(45, 212, 167, 0.55);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 14px rgba(45, 212, 167, 0); }
  100% { box-shadow: 0 0 0 0 rgba(45, 212, 167, 0); }
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: transform 0.35s var(--ease-out), border-color 0.35s;
}

.stat:hover {
  transform: translateY(-5px);
  border-color: rgba(0, 229, 255, 0.35);
}

.stat-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 4.5vw, 2.9rem);
  line-height: 1.1;
}

/* Odometer reels (built by JS): each digit rolls through a full spin */
.stat-num.odo-wrap {
  display: inline-flex;
  align-items: flex-start;
  line-height: 1;
  /* gradient is painted per-glyph below — disable the parent clip */
  background: none;
  -webkit-text-fill-color: currentColor;
  animation: none;
}

.odo {
  display: block;
  height: 1em;
  overflow: hidden;
}

.odo-reel {
  display: block;
  transition: transform 1.9s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.odo-d,
.odo-suffix {
  display: block;
  height: 1em;
  line-height: 1;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label { color: var(--muted); font-size: 0.88rem; line-height: 1.45; }

/* ============================================================
   Skills
   ============================================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}

.skill-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem 1.6rem;
  position: relative;
}

/* Icons draw themselves in when the card reveals (paths carry pathLength="1") */
html.js .skill-icon svg * {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

html.js .reveal.in .skill-icon svg * {
  animation: icon-draw 1.4s var(--ease-out) forwards 0.25s;
}

@keyframes icon-draw {
  to { stroke-dashoffset: 0; }
}

.skill-card h3,
.edu-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  margin-top: 1.1rem;
}

.skill-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--cyan);
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.2);
}

.skill-icon.gold {
  color: var(--gold);
  background: rgba(255, 200, 87, 0.08);
  border-color: rgba(255, 200, 87, 0.25);
}

.skill-icon svg { width: 24px; height: 24px; }

/* 3D tilt + glare (driven by JS custom props).
   The transition list repeats the reveal's opacity/translate (with the --d
   stagger delay) because this shorthand would otherwise override it. */
[data-tilt] {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform 0.18s ease-out, border-color 0.3s,
              opacity 0.8s var(--ease-out) var(--d, 0s),
              translate 0.8s var(--ease-out) var(--d, 0s);
  will-change: transform;
}

/* Card innards float at different depths while tilting */
[data-tilt] h3,
[data-tilt] .skill-icon,
[data-tilt] .project-top,
[data-tilt] .chips {
  transition: transform 0.35s var(--ease-out);
}

[data-tilt]:hover .skill-icon { transform: translateZ(36px); }
[data-tilt]:hover h3 { transform: translateZ(28px); }
[data-tilt]:hover .project-top { transform: translateZ(22px); }
[data-tilt]:hover .chips { transform: translateZ(16px); }

[data-tilt]:hover { border-color: rgba(139, 92, 246, 0.45); }

[data-tilt]::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    480px circle at var(--gx, 50%) var(--gy, 50%),
    rgba(0, 229, 255, 0.1),
    transparent 55%
  );
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}

[data-tilt]:hover::after { opacity: 1; }

/* ============================================================
   Experience — timeline
   ============================================================ */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2.6rem;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 8px; bottom: 8px;
  left: 218px;
  width: 1.5px;
  background: linear-gradient(
    180deg,
    var(--cyan),
    var(--violet) 50%,
    var(--magenta)
  );
  opacity: 0.45;
  /* JS drives --tl (0..1) so the line draws as you scroll; defaults to drawn */
  transform: scaleY(var(--tl, 1));
  transform-origin: top;
}

/* When JS animates the timeline, dots start dim and light up as the line passes */
.timeline.tl-animate .t-dot {
  border-color: rgba(255, 255, 255, 0.22);
  animation: none;
  box-shadow: none;
  transition: border-color 0.5s, transform 0.5s var(--ease-out);
  transform: scale(0.8);
}

.timeline.tl-animate .t-item.lit .t-dot {
  border-color: var(--cyan);
  transform: scale(1);
  animation: pulse-cyan 2.6s infinite;
}

.t-item {
  display: grid;
  grid-template-columns: 190px 56px 1fr;
  align-items: start;
}

.t-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 1.6rem;
  text-align: right;
}

.t-date { color: var(--cyan); font-size: 0.8rem; }
.t-loc { color: var(--muted); font-size: 0.82rem; }

.t-dot {
  justify-self: center;
  margin-top: 1.85rem;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--bg);
  border: 2.5px solid var(--cyan);
  box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.4);
  animation: pulse-cyan 2.6s infinite;
}

@keyframes pulse-cyan {
  70% { box-shadow: 0 0 0 12px rgba(0, 229, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0); }
}

.t-card { padding: 1.7rem 1.9rem; }

.t-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

.t-company { color: var(--cyan); font-size: 0.95rem; margin: 0.2rem 0 1rem; }

.t-points { display: flex; flex-direction: column; gap: 0.65rem; }

.t-points li {
  color: var(--muted);
  font-size: 0.97rem;
  padding-left: 1.4rem;
  position: relative;
}

.t-points li::before {
  content: '▹';
  position: absolute;
  left: 0;
  color: var(--magenta);
}

/* ============================================================
   Projects
   ============================================================ */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
}

.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.9rem;
  position: relative;
  display: flex;
  flex-direction: column;
}

.project-card.featured {
  border-color: rgba(255, 200, 87, 0.3);
  background: linear-gradient(160deg, rgba(255, 200, 87, 0.05), var(--card) 45%);
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}

.project-tag { color: var(--violet); font-size: 0.78rem; letter-spacing: 0.06em; }

.badge-patent {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--gold);
  border: 1px solid rgba(255, 200, 87, 0.4);
  background: rgba(255, 200, 87, 0.08);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
}

.badge-patent svg { width: 13px; height: 13px; }

.project-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.8rem;
}

.project-card h3 .dim {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  margin-top: 0.3rem;
}

.project-card p { color: var(--muted); font-size: 0.97rem; flex: 1; }

/* ============================================================
   Education & achievements
   ============================================================ */
.edu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
}

.edu-card {
  padding: 2rem 1.9rem;
}

.edu-card .t-company { margin-bottom: 0.4rem; }
.edu-card .dim { font-size: 0.92rem; }

.patent-card { border-color: rgba(255, 200, 87, 0.3); }

.patent-card::before {
  background: conic-gradient(
    from var(--angle),
    transparent 0%,
    transparent 55%,
    rgba(255, 200, 87, 0.8) 72%,
    rgba(255, 61, 129, 0.6) 80%,
    transparent 95%
  );
}

/* ============================================================
   Contact
   ============================================================ */
.contact {
  text-align: center;
  position: relative;
  overflow: hidden;
}

.contact .container { position: relative; z-index: 1; }

/* Giant outlined watermark that slides with scroll (JS drives the X offset) */
.giant-name {
  position: absolute;
  top: 50%;
  left: 0;
  z-index: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(7rem, 20vw, 15rem);
  line-height: 1;
  white-space: nowrap;
  letter-spacing: 0.02em;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.05);
  pointer-events: none;
  user-select: none;
  transform: translate3d(0, -50%, 0);
}

.contact-eyebrow { color: var(--cyan); margin-bottom: 1.2rem; }

.contact-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.2rem, 6.5vw, 4.2rem);
  letter-spacing: -0.025em;
  line-height: 1.08;
  margin-bottom: 1.4rem;
  position: relative;        /* positioning context for the glitch slices */
  --glitch-dur: 3.6s;        /* offset cadence so it desyncs from the hero name */
}

.contact-sub {
  max-width: 560px;
  margin: 0 auto 2.8rem;
  color: var(--muted);
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.1rem;
  margin-bottom: 2.6rem;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2.2rem;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.92rem;
  transition: color 0.25s;
}

.contact-link:hover { color: var(--cyan); }

.contact-link svg { width: 16px; height: 16px; }

/* ============================================================
   Footer
   ============================================================ */
.footer {
  position: relative;
  overflow: hidden;
  border-top: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, var(--cyan), var(--violet), var(--magenta), transparent) 1;
  padding: clamp(3rem, 6vw, 4.5rem) 0 2.2rem;
}

/* Huge faint name bleeding off the bottom edge */
.footer-wm {
  position: absolute;
  left: 50%;
  bottom: -3rem;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(4rem, 15vw, 12rem);
  line-height: 1;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.04);
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.footer-top,
.footer-bottom { position: relative; z-index: 1; }

.footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2.4rem;
  padding-bottom: 2.6rem;
}

.footer-brand { max-width: 360px; }

.footer-mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2rem;
  display: inline-block;
  position: relative;
}

.footer-brand p { margin-top: 0.6rem; font-size: 0.92rem; }

.footer-nav { display: flex; flex-direction: column; gap: 0.55rem; }

.footer-nav a {
  position: relative;
  width: fit-content;
  color: var(--muted);
  font-size: 0.95rem;
  padding-left: 0;
  transition: color 0.25s, padding-left 0.25s var(--ease-out);
}

.footer-nav a::before {
  content: '→';
  position: absolute;
  left: -4px;
  opacity: 0;
  transition: opacity 0.25s, left 0.25s var(--ease-out);
}

.footer-nav a:hover { color: var(--cyan); padding-left: 18px; }
.footer-nav a:hover::before { opacity: 1; left: 0; }

.footer-social { display: flex; gap: 0.8rem; align-items: flex-start; }

.footer-social a {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  transition: color 0.3s, border-color 0.3s, transform 0.35s var(--ease-out), box-shadow 0.3s;
}

.footer-social a svg { width: 18px; height: 18px; }

.footer-social a:hover {
  color: var(--cyan);
  border-color: rgba(0, 229, 255, 0.5);
  transform: translateY(-5px);
  box-shadow: 0 10px 26px rgba(0, 229, 255, 0.2);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.6rem;
  padding-top: 1.7rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
}

/* ============================================================
   Hero ambience — starfield, 3D shapes, shooting stars
   ============================================================ */
.hero-stars {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.hero-stars::before,
.hero-stars::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 25px 35px, rgba(255, 255, 255, 0.9), transparent 100%),
    radial-gradient(1px 1px at 130px 90px, rgba(0, 229, 255, 0.8), transparent 100%),
    radial-gradient(1.5px 1.5px at 210px 160px, rgba(255, 255, 255, 0.7), transparent 100%),
    radial-gradient(1px 1px at 60px 200px, rgba(139, 92, 246, 0.9), transparent 100%),
    radial-gradient(1px 1px at 180px 240px, rgba(255, 255, 255, 0.6), transparent 100%),
    radial-gradient(1.5px 1.5px at 90px 130px, rgba(255, 61, 129, 0.7), transparent 100%);
  background-size: 260px 260px;
  animation: twinkle 4s ease-in-out infinite alternate;
}

.hero-stars::after {
  background-size: 420px 420px;
  opacity: 0.5;
  animation-duration: 6s;
  animation-delay: 2s;
}

@keyframes twinkle {
  from { opacity: 0.3; }
  to { opacity: 0.95; }
}

.hero-shapes {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.shape {
  position: absolute;
  opacity: 0.55;
  will-change: transform;
}

.s-cube { top: 17%; right: 9%; }
.s-ring { bottom: 22%; left: 5%; }
.s-ring2 { top: 20%; left: 13%; }
.s-tri { bottom: 32%; right: 18%; }
.s-orb { top: 56%; right: 7%; }
.s-orb2 { top: 12%; left: 34%; }

/* Wireframe cube */
.cube {
  position: relative;
  width: 64px;
  height: 64px;
  transform-style: preserve-3d;
  animation: cube-spin 26s linear infinite;
}

.cube i {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(0, 229, 255, 0.5);
  background: rgba(0, 229, 255, 0.04);
}

.cube i:nth-child(1) { transform: translateZ(32px); }
.cube i:nth-child(2) { transform: rotateY(90deg) translateZ(32px); }
.cube i:nth-child(3) { transform: rotateY(180deg) translateZ(32px); }
.cube i:nth-child(4) { transform: rotateY(270deg) translateZ(32px); }
.cube i:nth-child(5) { transform: rotateX(90deg) translateZ(32px); }
.cube i:nth-child(6) { transform: rotateX(-90deg) translateZ(32px); }

@keyframes cube-spin {
  to { transform: rotateX(360deg) rotateY(-360deg); }
}

/* Tilted spinning rings */
.fx-ring {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 1.5px dashed rgba(139, 92, 246, 0.55);
  animation: ring-spin 18s linear infinite;
}

.fx-ring--small {
  width: 110px;
  height: 110px;
  border: 1px solid rgba(0, 229, 255, 0.4);
  animation-duration: 12s;
  animation-direction: reverse;
}

@keyframes ring-spin {
  from { transform: rotateX(62deg) rotateZ(0deg); }
  to { transform: rotateX(62deg) rotateZ(360deg); }
}

/* Floating triangle */
.fx-tri {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, rgba(255, 61, 129, 0.5), rgba(139, 92, 246, 0.15));
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  animation: tri-float 17s ease-in-out infinite;
}

@keyframes tri-float {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-26px) rotate(180deg); }
  100% { transform: translateY(0) rotate(360deg); }
}

/* Glowing orbs */
.fx-orb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 20px 5px rgba(0, 229, 255, 0.45);
  animation: orb-bob 6s ease-in-out infinite alternate;
}

.fx-orb--magenta {
  background: var(--magenta);
  box-shadow: 0 0 20px 5px rgba(255, 61, 129, 0.45);
  animation-duration: 8s;
}

@keyframes orb-bob {
  to { transform: translateY(-32px); }
}

/* Shooting stars (spawned by JS) */
.shooting-stars {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.shooting-stars .star {
  position: absolute;
  width: 150px;
  height: 1.5px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(0, 229, 255, 0.4), transparent);
  border-radius: 2px;
  opacity: 0;
  animation: shoot var(--dur, 1.2s) ease-out forwards;
}

@keyframes shoot {
  0% { transform: translate(0, 0) rotate(160deg); opacity: 0; }
  8% { opacity: 1; }
  100% { transform: translate(var(--dx, -420px), var(--dy, 160px)) rotate(160deg); opacity: 0; }
}

/* ============================================================
   Pointer ambience — spotlight + spark trail
   ============================================================ */
/* A fixed-size gradient disc moved with transform (compositor-only) instead
   of a viewport-sized layer whose gradient center repaints every frame. */
.spotlight {
  position: fixed;
  top: 0;
  left: 0;
  width: 1240px;
  height: 1240px;
  margin: -620px 0 0 -620px;
  z-index: 3;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(0, 229, 255, 0.09),
    rgba(139, 92, 246, 0.05) 42%,
    transparent 66%
  );
  transform: translate3d(-2000px, -2000px, 0);
  will-change: transform;
}

.sparks {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
}

.spark {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--spark-c, var(--cyan));
  box-shadow: 0 0 8px var(--spark-c, var(--cyan));
  animation: spark-fade 0.7s ease-out forwards;
}

@keyframes spark-fade {
  to {
    transform: translate(var(--dx, 0), var(--dy, -26px)) scale(0);
    opacity: 0;
  }
}

/* ============================================================
   Section number watermarks
   ============================================================ */
/* Keep section content above its watermark */
.section > .container { position: relative; z-index: 1; }

.section-wm {
  position: absolute;
  top: 50%;
  z-index: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(8rem, 24vw, 22rem);
  line-height: 0.8;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.035);
  pointer-events: none;
  user-select: none;
  transform: translate3d(0, -50%, 0);
}

.section-wm.wm-right { right: -1.5%; }
.section-wm.wm-left { left: -1.5%; }

/* ============================================================
   Side section rail
   ============================================================ */
.rail {
  position: fixed;
  right: 26px;
  top: 50%;
  z-index: 90;
  transform: translateY(-50%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s, visibility 0.4s;
}

.rail.show { opacity: 1; visibility: visible; }

.rail ul {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 15px;
}

.rail a {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 10px;
}

.rail-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  transition: transform 0.3s var(--ease-out), border-color 0.3s, background-color 0.3s, box-shadow 0.3s;
}

.rail a:hover .rail-dot { border-color: var(--cyan); transform: scale(1.2); }

.rail a.active .rail-dot {
  border-color: var(--cyan);
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
  transform: scale(1.3);
}

.rail a::after {
  content: attr(data-label);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.25s, transform 0.25s var(--ease-out), color 0.25s;
  pointer-events: none;
}

.rail a:hover::after { opacity: 1; transform: none; color: var(--text); }
.rail a.active::after { opacity: 1; transform: none; color: var(--cyan); }

/* ============================================================
   Back-to-top button (circular scroll-progress ring)
   ============================================================ */
.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(10, 12, 29, 0.7);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--text);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.9);
  transition: opacity 0.35s, visibility 0.35s, transform 0.35s var(--ease-out), border-color 0.3s;
}

.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { border-color: rgba(0, 229, 255, 0.55); }

.to-top-ring {
  position: absolute;
  inset: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  transform: rotate(-90deg);
}

.to-top-ring .ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 2; }

.to-top-ring .ring-fg {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 2;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.6));
}

.to-top-arrow { width: 20px; height: 20px; }
.to-top:hover .to-top-arrow { animation: bob 0.8s ease-in-out infinite; }

@keyframes bob { 50% { transform: translateY(-3px); } }

/* ============================================================
   Card corner brackets (hover) for tilt cards
   ============================================================ */
[data-tilt] { --accent: var(--cyan); }
.project-card.featured { --accent: var(--gold); }

[data-tilt]::before {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s var(--ease-out), inset 0.35s var(--ease-out);
  background:
    linear-gradient(var(--accent), var(--accent)) top left,
    linear-gradient(var(--accent), var(--accent)) top left,
    linear-gradient(var(--accent), var(--accent)) top right,
    linear-gradient(var(--accent), var(--accent)) top right,
    linear-gradient(var(--accent), var(--accent)) bottom left,
    linear-gradient(var(--accent), var(--accent)) bottom left,
    linear-gradient(var(--accent), var(--accent)) bottom right,
    linear-gradient(var(--accent), var(--accent)) bottom right;
  background-repeat: no-repeat;
  background-size: 16px 2px, 2px 16px, 16px 2px, 2px 16px, 16px 2px, 2px 16px, 16px 2px, 2px 16px;
}

[data-tilt]:hover::before { opacity: 0.9; inset: 8px; }

/* ============================================================
   Responsive
   ============================================================ */
/* Not enough side gutter for the rail on narrower viewports */
@media (max-width: 1180px) {
  .rail { display: none; }
}

/* Below ~1400px the side gutter is narrower than a label, so the dots stay
   (they sit inside the ~26px gutter) but the labels would spill onto content. */
@media (max-width: 1399px) {
  .rail a::after { display: none; }
}

/* Six nav links + CTA get tight just above the hamburger breakpoint */
@media (max-width: 1080px) and (min-width: 821px) {
  .nav-links { gap: 1.1rem; }
  .nav-links a:not(.btn) { font-size: 0.86rem; }
}

@media (max-width: 980px) {
  .about-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr 1fr; }

  .timeline::before { left: 15px; }
  .t-item { grid-template-columns: 32px 1fr; }
  .t-meta {
    grid-column: 2;
    grid-row: 1;
    text-align: left;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.9rem;
    padding-top: 0;
    margin-bottom: 0.8rem;
  }
  .t-dot { grid-column: 1; grid-row: 1; margin-top: 0.3rem; }
  .t-card { grid-column: 2; }
}

@media (max-width: 820px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: fixed;
    inset: 0;
    z-index: 101;
    flex-direction: column;
    justify-content: center;
    gap: 2.2rem;
    background: rgba(5, 6, 15, 0.92);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
  }

  .nav.open .nav-links { opacity: 1; visibility: visible; }

  .nav-links a:not(.btn) { font-size: 1.25rem; }
}

@media (max-width: 640px) {
  .skills-grid,
  .projects-grid,
  .edu-grid,
  .stats { grid-template-columns: 1fr; }

  .hero-actions .btn { width: 100%; justify-content: center; }
  .contact-actions { flex-direction: column; align-items: center; }
  .contact-actions .btn { width: min(100%, 340px); justify-content: center; }
  .scroll-cue { display: none; }

  /* Footer stacks and centers on small screens */
  .footer-top { flex-direction: column; align-items: center; text-align: center; gap: 1.8rem; }
  .footer-brand { max-width: none; }
  .footer-nav { align-items: center; }
  .footer-bottom { justify-content: center; text-align: center; }
  .to-top { width: 46px; height: 46px; right: 16px; bottom: 16px; }

  /* Declutter the hero on small screens */
  .s-tri, .s-ring2, .s-orb2 { display: none; }
  .shape { opacity: 0.35; }
}

/* ============================================================
   Reduced motion — calm everything down
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html { scroll-behavior: auto; }

  .reveal { opacity: 1; translate: none; }
  .marquee-track { animation: none; }
  .glitch::before, .glitch::after { display: none; }
  .caret { animation: none; }

  /* New FX layers: show content, kill the theatrics */
  .hero-shapes, .shooting-stars, .hero-stars, .spotlight, .sparks, .bg-canvas { display: none; }
  .ltr { opacity: 1; transform: none; animation: none; }
  html.js .reveal .chips li { opacity: 1; translate: none; animation: none; }
  html.js .skill-icon svg * { stroke-dasharray: none; stroke-dashoffset: 0; animation: none; }
  html.js .section-head.reveal .section-line { transform: none; transition: none; }
  .timeline::before { transform: none; }
  .btn-primary::after { animation: none; }
  .giant-name { transform: translate3d(0, -50%, 0); }
}
