/* ============================================================
   Mueed Ali Khan — Portfolio
   "Cyber-elegant": dual-accent, animated, glass, motion-rich
   ============================================================ */

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

/* ---------- Tokens ---------- */
:root{
  /* Light theme — luminous, not flat white */
  --bg: #eef1f9;
  --bg-elevated: #ffffff;
  --bg-glass: rgba(255,255,255,.70);
  --text: #12151c;
  --text-muted: #566072;
  --border: #e2e6f0;
  --border-strong: #cfd5e6;

  --accent: #6366f1;            /* indigo */
  --accent-hover: #4f46e5;
  --accent-2: #06b6d4;          /* cyan */
  --accent-soft: rgba(99,102,241,.10);
  --accent-2-soft: rgba(6,182,212,.10);
  --grad: linear-gradient(120deg, var(--accent), var(--accent-2));
  --grad-text: linear-gradient(120deg, var(--accent) 20%, var(--accent-2) 80%);

  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --content-width: 780px;
  --sidebar-width: 300px;
  --navbar-height: 68px;
  --transition: .25s ease;
  --ease-out: cubic-bezier(.16,1,.3,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);

  --font-heading: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, Monaco, monospace;

  --shadow: 0 2px 10px -3px rgba(70,70,140,.14);
  --shadow-hover: 0 26px 50px -22px rgba(80,70,190,.40);
  --page-bg:
    radial-gradient(60% 55% at 12% 8%, rgba(99,102,241,.12), transparent 60%),
    radial-gradient(55% 50% at 92% 20%, rgba(6,182,212,.12), transparent 60%),
    radial-gradient(65% 60% at 70% 100%, rgba(139,92,246,.10), transparent 60%),
    linear-gradient(180deg, #eef1fb 0%, #f4f2fb 45%, #eef6fb 100%);

  --aurora-opacity: .60;
  --grain-opacity: .03;
}

html[data-theme="dark"]{
  --bg: #080a0e;
  --bg-elevated: #12151b;
  --bg-glass: rgba(16,19,26,.66);
  --text: #e7eaef;
  --text-muted: #97a0ad;
  --border: #222831;
  --border-strong: #2f3742;

  --accent: #8b8bf6;
  --accent-hover: #a3a3ff;
  --accent-2: #2dd4bf;
  --accent-soft: rgba(139,139,246,.14);
  --accent-2-soft: rgba(45,212,191,.12);

  --shadow: 0 1px 3px 1px rgba(0,0,0,.35);
  --shadow-hover: 0 24px 55px -20px rgba(0,0,0,.75);
  --page-bg:
    radial-gradient(55% 50% at 15% 5%, rgba(99,102,241,.10), transparent 60%),
    radial-gradient(50% 45% at 90% 15%, rgba(45,212,191,.07), transparent 60%),
    #06070b;

  --aurora-opacity: .55;
  --grain-opacity: .05;
}

*, *::before, *::after{ box-sizing: border-box; }
html{
  scroll-behavior: smooth;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body{
  margin: 0;
  background: var(--page-bg) fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: color var(--transition);
}

h1,h2,h3,h4{
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 .5em;
}

p{ margin: 0 0 1em; color: var(--text); }
a{ color: inherit; text-decoration: none; }
ul{ list-style: none; margin: 0; padding: 0; }
::selection{ background: var(--accent); color: #fff; }

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

.container{
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 2rem;
}
.text-muted{ color: var(--text-muted); }

/* Custom scrollbar */
html{ scrollbar-color: var(--accent) transparent; scrollbar-width: thin; }
::-webkit-scrollbar{ width: 11px; height: 11px; }
::-webkit-scrollbar-track{ background: transparent; }
::-webkit-scrollbar-thumb{
  background: linear-gradient(var(--accent), var(--accent-2));
  border-radius: 99px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover{ background: var(--accent); }

/* ---------- Ambient background ---------- */
.bg-aurora{
  position: fixed;
  inset: -25%;
  z-index: -2;
  pointer-events: none;
  opacity: var(--aurora-opacity);
  background:
    radial-gradient(34% 40% at 18% 22%, var(--accent) 0%, transparent 60%),
    radial-gradient(30% 38% at 82% 18%, var(--accent-2) 0%, transparent 60%),
    radial-gradient(40% 44% at 68% 88%, var(--accent) 0%, transparent 62%),
    radial-gradient(38% 40% at 22% 82%, var(--accent-2) 0%, transparent 62%);
  filter: blur(70px) saturate(130%);
  animation: auroraDrift 24s ease-in-out infinite alternate;
}
@keyframes auroraDrift{
  0%   { transform: translate3d(0,0,0) scale(1) rotate(0deg); }
  50%  { transform: translate3d(3%, -4%, 0) scale(1.14) rotate(7deg); }
  100% { transform: translate3d(-4%, 3%, 0) scale(1.06) rotate(-6deg); }
}
.bg-grain{
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--grain-opacity);
  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.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Custom cursor ---------- */
.cursor-dot,.cursor-ring{
  position: fixed;
  top: 0; left: 0;
  z-index: 4000;
  pointer-events: none;
  border-radius: 50%;
  opacity: 0;
  will-change: transform;
}
.cursor-dot{
  width: 7px; height: 7px;
  background: var(--grad);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 85%, transparent);
  transition: width .25s var(--ease-spring), height .25s var(--ease-spring), opacity .3s;
}
/* Ring = a thin, slowly spinning gradient annulus with a soft glow */
.cursor-ring{
  width: 40px; height: 40px;
  background: conic-gradient(from var(--angle),
    var(--accent), var(--accent-2), var(--accent), var(--accent-2), var(--accent));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 55%, transparent));
  animation: spin 5s linear infinite;
  transition: width .3s var(--ease-spring), height .3s var(--ease-spring), opacity .3s;
}
.cursor-ring.is-hover{ width: 64px; height: 64px; }
.cursor-dot.is-hover{ width: 11px; height: 11px; }
.cursor-ring.is-down{ width: 30px; height: 30px; }
.cursor-dot.is-down{ width: 5px; height: 5px; }
body.custom-cursor{ cursor: none; }
body.custom-cursor a,
body.custom-cursor button,
body.custom-cursor [data-cursor]{ cursor: none; }
body.custom-cursor .cursor-dot,
body.custom-cursor .cursor-ring{ opacity: 1; }

/* ---------- Reveal on scroll ---------- */
.reveal{
  opacity: 0;
  transform: translateY(32px);
  filter: blur(8px);
  transition: opacity .8s var(--ease-out), transform .9s var(--ease-out), filter .8s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal[data-reveal="left"]{ transform: translateX(-44px); }
.reveal[data-reveal="right"]{ transform: translateX(44px); }
.reveal[data-reveal="scale"]{ transform: scale(.92); }
.reveal.is-visible{ opacity: 1; transform: none; filter: blur(0); }

/* ---------- Animated gradient border (mask trick) ---------- */
.glow-border{ position: relative; }
.glow-border::after{
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(from var(--angle),
    var(--accent), var(--accent-2), var(--accent), var(--accent-2), var(--accent));
  -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;
  animation: spin 6s linear infinite;
  pointer-events: none;
  opacity: .9;
}
@keyframes spin{ to{ --angle: 360deg; } }

/* ---------- Progress bar ---------- */
.progress-bar{
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: var(--grad);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 70%, transparent);
  z-index: 3100;
  transition: width .1s ease-out;
}

/* ---------- Nav ---------- */
.nav{
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition), backdrop-filter var(--transition);
}
.nav.scrolled{
  background: var(--bg-glass);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom-color: var(--border);
}
.nav-inner{
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
/* ---------- Brand / KhanLabs.dev logo ---------- */
.nav-brand{
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: -.02em;
}
.logo-mark{ width: 27px; height: 27px; flex: none; overflow: visible; }
.logo-mark .stop-a{ stop-color: var(--accent); }
.logo-mark .stop-b{ stop-color: var(--accent-2); }
.logo-mark .logo-node{ fill: var(--accent-2); animation: dotPulse 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.nav-brand:hover .logo-mark{ animation: logoTilt .6s var(--ease-spring); }
@keyframes logoTilt{ 40%{ transform: rotate(-8deg) scale(1.08); } }
@keyframes dotPulse{ 0%,100%{ opacity:1 } 50%{ opacity:.25 } }
.logo-word{ line-height: 1; white-space: nowrap; }
.logo-grad{
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo-tld{
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: .68em;
  color: var(--accent-2);
  margin-left: 1px;
  letter-spacing: 0;
}
/* Keep the gradient "Labs" visible even when nav text is forced white over hero */
.nav:not(.scrolled) .logo-tld{ color: #5eead4; }

/* Footer brand lockup */
.footer-brand{
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -.02em;
  margin-bottom: 1.4rem;
  color: var(--text);
}
.footer-brand .logo-mark{ width: 32px; height: 32px; }
.footer-brand:hover .logo-mark{ animation: logoTilt .6s var(--ease-spring); }

.nav-links{ display: flex; gap: 1.9rem; margin: 0 auto; }
.nav-links a{
  position: relative;
  font-size: .88rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: .25rem 0;
  transition: color var(--transition);
}
.nav-links a::after{
  content: "";
  position: absolute;
  left: 0; bottom: -3px;
  width: 100%; height: 2px;
  background: var(--grad);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease-out);
}
.nav-links a:hover, .nav-links a.active{ color: var(--text); }
.nav-links a.active::after, .nav-links a:hover::after{ transform: scaleX(1); }
.nav-actions{ display: flex; align-items: center; gap: .7rem; }

/* Nav over the dark hero when not scrolled → force light text */
.nav:not(.scrolled) .nav-brand,
.nav:not(.scrolled) .nav-links a:hover,
.nav:not(.scrolled) .nav-links a.active{ color: #fff; }
.nav:not(.scrolled) .nav-links a{ color: rgba(255,255,255,.72); }
.nav:not(.scrolled) .icon-btn{
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.22);
  color: #fff;
}
.nav:not(.scrolled) .btn-small{ border-color: rgba(255,255,255,.3); color: #fff; }
.nav:not(.scrolled) .btn-small:hover{ border-color:#fff; background: rgba(255,255,255,.1); }
.nav:not(.scrolled) .nav-burger span{ background: #fff; }

.icon-btn{
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition), transform .4s var(--ease-out), background var(--transition);
}
.icon-btn:hover{ border-color: var(--accent); transform: translateY(-2px); }
.icon-btn svg{ width: 17px; height: 17px; }
.theme-toggle:hover{ transform: rotate(25deg); }

.icon-sun,.icon-motion-play{ display: none; }
html[data-theme="dark"] .icon-sun{ display: block; }
html[data-theme="dark"] .icon-moon{ display: none; }
html[data-motion="reduced"] .icon-motion-pause{ display: none; }
html[data-motion="reduced"] .icon-motion-play{ display: block; }

.nav-burger{
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 34px; height: 34px; background: none; border: none; cursor: pointer;
}
.nav-burger span{ display: block; height: 2px; background: var(--text); border-radius: 2px; transition: transform .3s, opacity .3s; }

/* ---------- Buttons ---------- */
.btn{
  position: relative;
  overflow: hidden;
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .7rem 1.35rem;
  border-radius: 999px;
  font-size: .86rem; font-weight: 600;
  border: 1px solid transparent;
  transition: transform .3s var(--ease-out), background var(--transition), border-color var(--transition), box-shadow var(--transition), color var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.btn svg{ width: 16px; height: 16px; transition: transform .3s var(--ease-out); }
.btn-primary{ background: var(--accent); color: #fff; }
.btn-primary:hover{ background: var(--accent-hover); }
.btn-primary:hover svg{ transform: translateX(3px); }
.btn-glow{ box-shadow: 0 8px 30px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn-glow:hover{ box-shadow: 0 16px 44px -8px color-mix(in srgb, var(--accent) 85%, transparent); }
.btn-ghost{ background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover{ border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn-block{ display: flex; justify-content: center; width: 100%; margin-top: .75rem; }
.btn-small{ padding: .5rem 1.05rem; font-size: .8rem; border: 1px solid var(--border); }
.btn-small:hover{ border-color: var(--accent); color: var(--accent); }

.btn-glow::after{
  content:"";
  position:absolute; inset:0;
  border-radius:inherit;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.4) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .7s var(--ease-out);
  pointer-events:none;
}
.btn-glow:hover::after{ transform: translateX(120%); }

/* ============================================================
   HERO
   ============================================================ */
.hero{
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: calc(var(--navbar-height) + 2.5rem) 0 4rem;
  color: #fff;
  background:
    radial-gradient(60% 60% at 80% 8%, rgba(45,212,191,.18), transparent 60%),
    radial-gradient(65% 70% at 8% 30%, rgba(139,139,246,.24), transparent 60%),
    #06070b;
}
.hero-canvas{
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 0; display: block;
}
.hero-orb{
  position: absolute;
  border-radius: 50%;
  z-index: 0;
  filter: blur(50px);
  will-change: transform;
  animation: orbFloat 14s ease-in-out infinite alternate;
}
.hero-orb-1{
  width: 340px; height: 340px;
  top: -60px; right: 8%;
  background: radial-gradient(circle, rgba(45,212,191,.5), transparent 70%);
}
.hero-orb-2{
  width: 300px; height: 300px;
  bottom: -40px; left: 4%;
  background: radial-gradient(circle, rgba(124,90,246,.5), transparent 70%);
  animation-delay: -6s;
}
@keyframes orbFloat{
  0%{ transform: translate(0,0) scale(1); }
  100%{ transform: translate(20px,-24px) scale(1.12); }
}
.hero-grid{
  position: absolute; inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 42%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 50% 42%, #000 0%, transparent 72%);
}
.hero-fade{
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 34%;
  z-index: 1;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}
/* A meteor streaks across the hero every so often */
.shooting-star{
  position: absolute;
  top: 14%; left: 72%;
  width: 130px; height: 2px;
  z-index: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,.95), rgba(165,180,252,.5) 35%, transparent);
  transform: rotate(-28deg);
  opacity: 0;
  pointer-events: none;
  animation: shootingStar 8.5s ease-in 3.2s infinite;
}
@keyframes shootingStar{
  0%{ opacity: 0; translate: 0 0; }
  1.5%{ opacity: .9; }
  8%{ opacity: 0; translate: -340px 182px; }
  100%{ opacity: 0; translate: -340px 182px; }
}
.hero-content{
  position: relative;
  z-index: 2;
  width: 100%;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 3rem;
  align-items: center;
}
.hero-copy, .terminal{ will-change: transform; }

.hero-anim{
  opacity: 0;
  transform: translateY(28px);
  animation: heroIn 1s var(--ease-out) forwards;
  animation-delay: var(--d, 0ms);
}
@keyframes heroIn{ to{ opacity:1; transform: none; } }

.hero-status{
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-mono);
  font-size: .74rem;
  letter-spacing: .02em;
  color: rgba(255,255,255,.82);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  padding: .35rem .8rem;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  margin-bottom: 1.4rem;
}
.status-dot{
  width: 8px; height: 8px; border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 0 rgba(52,211,153,.7);
  animation: statusPulse 2s ease-out infinite;
}
@keyframes statusPulse{
  0%{ box-shadow: 0 0 0 0 rgba(52,211,153,.6); }
  70%{ box-shadow: 0 0 0 9px rgba(52,211,153,0); }
  100%{ box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}
.hero-greet{
  font-family: var(--font-mono);
  font-size: .95rem;
  color: rgba(255,255,255,.55);
  margin-bottom: .3rem;
}
.hero-title{
  font-size: clamp(2.6rem, 7vw, 4.8rem);
  font-weight: 700;
  line-height: 1.02;
  margin-bottom: .5rem;
  background: linear-gradient(100deg, #ffffff 8%, #c3c3ff 38%, #5eead4 68%, #ffffff 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  /* Entrance (opacity/transform) + shine (background-position) run together —
     both are needed because the shorthand would otherwise override .hero-anim. */
  animation: heroIn 1s var(--ease-out) var(--d, 0ms) forwards, titleShine 7s linear infinite;
}
@keyframes titleShine{ to{ background-position: 220% center; } }
.hero-role{
  font-family: var(--font-mono);
  font-size: clamp(1rem, 2.4vw, 1.4rem);
  color: #e7eaef;
  margin-bottom: 1.1rem;
  min-height: 1.5em;
}
.hero-role-prefix{ color: var(--accent-2); margin-right: .5rem; }
.type-caret{ color: var(--accent-2); animation: caretBlink 1s step-end infinite; }
@keyframes caretBlink{ 50%{ opacity: 0; } }
.hero-tag{
  font-size: 1.02rem;
  color: rgba(255,255,255,.7);
  max-width: 30rem;
  margin-bottom: 1.8rem;
}
.hero-tag strong{ color: #fff; font-weight: 600; }
.hero-cta{ display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: 1.6rem; }
.hero-cta .btn-ghost{ color:#fff; border-color: rgba(255,255,255,.28); }
.hero-cta .btn-ghost:hover{ border-color:#fff; background: rgba(255,255,255,.08); color:#fff; }
.hero-socials{ display: flex; gap: .6rem; }
.hero-social{
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.16);
  color: rgba(255,255,255,.75);
  transition: transform .3s var(--ease-spring), border-color .25s, color .25s, background .25s;
}
.hero-social:hover{
  transform: translateY(-5px);
  border-color: var(--accent-2);
  color: #fff;
  background: rgba(45,212,191,.14);
}
.hero-social svg{ width: 17px; height: 17px; }

/* Terminal */
.terminal{
  border-radius: 14px;
  overflow: hidden;
  background: rgba(10,12,17,.72);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 34px 90px -34px rgba(0,0,0,.85), 0 0 0 1px rgba(255,255,255,.04) inset;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: var(--font-mono);
}
.terminal-bar{
  display: flex; align-items: center; gap: .5rem;
  padding: .7rem .9rem;
  background: rgba(255,255,255,.04);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.tdot{ width: 11px; height: 11px; border-radius: 50%; }
.tdot-r{ background: #ff5f57; }
.tdot-y{ background: #febc2e; }
.tdot-g{ background: #28c840; }
.terminal-title{ margin-left: .6rem; font-size: .72rem; color: rgba(255,255,255,.4); }
.terminal-body{
  margin: 0;
  padding: 1.1rem 1.15rem 1.3rem;
  font-size: .82rem;
  line-height: 1.85;
  min-height: 262px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #cdd3dc;
}
.terminal-body .t-prompt{ color: #8b8bf6; }
.terminal-body .t-cmd{ color: #fff; }
.terminal-body .t-out{ color: #9aa4b2; }
.terminal-body .t-ok{ color: #34d399; }
.terminal-body .t-warn{ color: #fbbf24; }
.terminal-body .t-accent{ color: #2dd4bf; }
.term-cursor{
  display: inline-block;
  width: 8px;
  background: #2dd4bf;
  animation: caretBlink 1s step-end infinite;
}

/* Scroll cue */
.scroll-cue{
  position: absolute;
  left: 50%; bottom: 1.6rem;
  transform: translateX(-50%);
  z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
}
.scroll-mouse{
  width: 22px; height: 34px;
  border: 2px solid rgba(255,255,255,.35);
  border-radius: 12px;
  display: flex; justify-content: center;
  padding-top: 6px;
}
.scroll-wheel{
  width: 3px; height: 7px; border-radius: 2px;
  background: rgba(255,255,255,.7);
  animation: wheelMove 1.6s ease-in-out infinite;
}
@keyframes wheelMove{ 0%{ transform: translateY(0); opacity:1 } 70%{ transform: translateY(9px); opacity:0 } 100%{ opacity:0 } }

/* ============================================================
   PAGE BODY
   ============================================================ */
.page-wrapper{ padding: 3.5rem 0 1rem; position: relative; }
.blog-page-wrapper{ display: flex; align-items: flex-start; justify-content: center; }
.vp-blog-main{ flex: 1; width: 0; max-width: var(--content-width); }
.vp-blog-main section{ margin-bottom: 4rem; scroll-margin-top: calc(var(--navbar-height) + 1.5rem); }

.section-eyebrow{
  font-family: var(--font-mono);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--accent);
  margin-bottom: .5rem;
  display: flex; align-items: center; gap: .6rem;
}
.section-eyebrow::before{
  content:""; width: 26px; height: 2px;
  background: var(--grad); border-radius: 2px;
}
.section-title{
  font-size: clamp(1.6rem, 3.2vw, 2.1rem);
  margin-bottom: 1.5rem;
  letter-spacing: -.03em;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  width: fit-content;
}

/* ---------- Project cards ---------- */
.project-panel{
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.project-card{
  position: relative;
  padding: 1.4rem 1.4rem 1.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform .35s var(--ease-out), border-color .3s, box-shadow .35s;
  will-change: transform;
}
.project-card-wide{ grid-column: 1 / -1; }
.project-card::before{
  content:"";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: radial-gradient(240px circle at var(--mx,50%) var(--my,50%), var(--accent-soft), transparent 65%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.project-card::after{
  content:"";
  position:absolute; left:0; top:0; right:0; height: 2px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .4s var(--ease-out);
}
.project-card:hover{
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow-hover);
}
.project-card:hover::before{ opacity: 1; }
.project-card:hover::after{ transform: scaleX(1); }
.project-card > *{ position: relative; z-index: 1; }
.project-icon{
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 44px; height: 44px;
  margin-bottom: .85rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-2-soft));
  border: 1px solid var(--border);
  font-size: 1.3rem;
  transition: transform .4s var(--ease-spring);
}
.project-card:hover .project-icon{ transform: translateY(-2px) scale(1.1) rotate(-5deg); }
.project-name{ font-family: var(--font-heading); font-weight: 600; font-size: 1.04rem; margin-bottom: .45rem; }
.project-desc{ font-size: .85rem; color: var(--text-muted); line-height: 1.6; margin-bottom: .9rem; }
.project-tags{ display: flex; flex-wrap: wrap; gap: .4rem; }
.project-tags span{
  font-family: var(--font-mono);
  font-size: .66rem;
  padding: .2rem .55rem;
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  transition: color .25s, border-color .25s;
}
.project-card:hover .project-tags span{ color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }

/* ---------- Article list ---------- */
.subgroup-title{
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-muted);
  margin: 2rem 0 .9rem;
}
.subgroup-title:first-of-type{ margin-top: 0; }
.article-list{ display: flex; flex-direction: column; gap: .85rem; }
.article-item{
  position: relative;
  display: block;
  padding: 1.2rem 1.4rem 1.2rem 1.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .3s, border-color .3s, transform .35s var(--ease-out);
}
.article-item::before{
  content:"";
  position:absolute; left:0; top:0; bottom:0;
  width: 3px;
  background: var(--grad);
  transform: scaleY(.25);
  transform-origin: center;
  transition: transform .4s var(--ease-out);
}
.article-item:hover{
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  transform: translateX(5px);
}
.article-item:hover::before{ transform: scaleY(1); }
.article-item-highlight{
  background: linear-gradient(135deg, var(--accent-soft), var(--bg-elevated) 55%);
}
.article-item-highlight::before{ display: none; }
.article-item-highlight .article-item-title{ font-size: 1.1rem; }

.article-item-badges{ display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .65rem; }
.article-item-badge{
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: .18rem .55rem;
  border-radius: 999px;
}
.article-item-badge-honor{
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  color: #fff;
  background: var(--grad);
}
.article-item-head{
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: .4rem; margin-bottom: .25rem;
}
.article-item-title{ font-family: var(--font-heading); font-weight: 600; font-size: 1.02rem; }
.article-item-date{ font-family: var(--font-mono); font-size: .74rem; color: var(--text-muted); white-space: nowrap; }
.article-item-org{ font-weight: 500; color: var(--text); font-size: .92rem; }
.article-item p{ font-size: .88rem; }
.article-item p:last-child{ margin-bottom: 0; }

/* ---------- Skills ---------- */
.skill-groups{ display: flex; flex-direction: column; gap: 1rem; }
.skill-group{
  padding: 1.15rem 1.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  transition: border-color .3s, box-shadow .3s, transform .3s var(--ease-out);
}
.skill-group:hover{
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.skill-group h3{
  display: flex; align-items: center; gap: .5rem;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: .8rem;
}
.skill-dot{
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 60%, transparent);
}
.pill-list{ display: flex; flex-wrap: wrap; gap: .5rem; }
/* Pills pop in one-by-one once their group scrolls into view */
.skill-group .pill-list li{
  opacity: 0;
  translate: 0 10px;
  transition: opacity .5s var(--ease-out), translate .55s var(--ease-spring),
    transform .25s var(--ease-spring), background .25s, color .25s, border-color .25s, box-shadow .25s;
  transition-delay: calc(var(--i, 0) * 45ms + 120ms), calc(var(--i, 0) * 45ms + 120ms), 0ms, 0ms, 0ms, 0ms, 0ms;
}
.skill-group.is-visible .pill-list li{ opacity: 1; translate: 0 0; }
.pill-list li{
  font-family: var(--font-mono);
  font-size: .76rem;
  padding: .4rem .8rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
  cursor: default;
  transition: transform .25s var(--ease-spring), background .25s, color .25s, border-color .25s, box-shadow .25s;
}
.pill-list li:hover{
  transform: translateY(-4px);
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--accent) 70%, transparent);
}

/* ---------- Sidebar ---------- */
.vp-blog-info-wrapper{
  position: sticky;
  top: calc(var(--navbar-height) + 1rem);
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  margin-left: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.blogger-info{
  padding: 1.5rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.blogger-info::before{
  content:"";
  position: absolute; top: 0; left: 0; right: 0; height: 72px;
  background: var(--grad);
  opacity: .16;
}
.blogger{ padding: .5rem; text-align: center; position: relative; }
.blogger-avatar{
  position: relative;
  width: 9.6rem; height: 9.6rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  overflow: hidden;
  background: #0b0d1a;
  box-shadow: 0 14px 40px -12px color-mix(in srgb, var(--accent) 75%, transparent);
  border: 3px solid var(--bg-elevated);
  transition: transform .45s var(--ease-spring);
}
.blogger-avatar::before{
  content:"";
  position: absolute; inset: -6px;
  border-radius: 50%;
  z-index: -1;
  background: conic-gradient(from var(--angle), var(--accent), var(--accent-2), var(--accent));
  animation: spin 5s linear infinite;
}
.blogger-avatar:hover{ transform: scale(1.07) rotate(-4deg); }

/* Sleepless-dev avatar: breathes, blinks heavily, dozes off, startles awake */
.av-svg{ width: 100%; height: 100%; display: block; }
.av-figure{ animation: avBreathe 9s ease-in-out infinite; }
.av-head{ transform-box: fill-box; transform-origin: 50% 86%; animation: avNod 9s ease-in-out infinite; }
.av-shut{ opacity: 0; animation: avShut 9s linear infinite; }
.av-mouth{ animation: avMouthSwap 9s ease-in-out infinite; }
.av-yawn{ opacity: 0; animation: avYawn 9s ease-in-out infinite; }
.av-z{ opacity: 0; }
.av-z1{ animation: avZ1 9s ease-in-out infinite; }
.av-z2{ animation: avZ2 9s ease-in-out infinite; }
.av-z3{ animation: avZ3 9s ease-in-out infinite; }
.av-steam{ opacity: .45; transform-box: fill-box; transform-origin: 50% 100%;
  animation: avSteamRise 3.6s ease-in-out infinite; }
.av-steam-2{ animation-delay: -1.2s; }
.av-steam-3{ animation-delay: -2.4s; }
@keyframes avBreathe{
  0%,100%{ transform: translateY(0); }
  30%{ transform: translateY(-1.6px); }
  55%{ transform: translateY(-.4px); }
  74%{ transform: translateY(2.2px); }
  90%{ transform: translateY(0); }
}
/* Head slowly droops as he nods off, then jerks back awake */
@keyframes avNod{
  0%,54%{ transform: rotate(0); }
  64%{ transform: rotate(-3deg); }
  74%{ transform: rotate(-5deg); }
  82%{ transform: rotate(-4.4deg); }
  86.5%{ transform: rotate(1.8deg); }
  92%,100%{ transform: rotate(0); }
}
/* Two heavy blinks, then eyes stay shut for the doze */
@keyframes avShut{
  0%,21%{ opacity: 0; } 22.5%,24%{ opacity: 1; } 25.5%{ opacity: 0; }
  44%{ opacity: 0; } 45.5%,47%{ opacity: 1; } 48.5%{ opacity: 0; }
  58%{ opacity: 0; } 62%,84%{ opacity: 1; } 87.5%{ opacity: 0; } 100%{ opacity: 0; }
}
@keyframes avMouthSwap{ 0%,60%{ opacity: 1; } 62%,76%{ opacity: 0; } 79%,100%{ opacity: 1; } }
@keyframes avYawn{ 0%,60%{ opacity: 0; } 63%,72%{ opacity: .95; } 76%,100%{ opacity: 0; } }
@keyframes avZ1{
  0%,62%{ opacity: 0; transform: translateY(5px); }
  68%{ opacity: .85; } 82%{ opacity: .85; }
  88%,100%{ opacity: 0; transform: translateY(-7px); }
}
@keyframes avZ2{
  0%,66%{ opacity: 0; transform: translateY(5px); }
  72%{ opacity: .8; } 84%{ opacity: .8; }
  90%,100%{ opacity: 0; transform: translateY(-8px); }
}
@keyframes avZ3{
  0%,70%{ opacity: 0; transform: translateY(6px); }
  76%{ opacity: .75; } 86%{ opacity: .75; }
  92%,100%{ opacity: 0; transform: translateY(-9px); }
}
@keyframes avSteamRise{
  0%{ opacity: 0; transform: translateY(5px) scaleY(.72); }
  30%{ opacity: .55; }
  62%{ opacity: .4; }
  100%{ opacity: 0; transform: translateY(-11px) scaleY(1.12); }
}
/* Hover: he startles awake — eyes open, brows up, steam hurries */
.av-brows{ transform-box: fill-box; transition: transform .25s var(--ease-out); }
.av-pupil{ transition: transform .12s ease-out; }
.blogger-avatar:hover .av-shut,
.blogger-avatar:hover .av-yawn,
.blogger-avatar:hover .av-z{ animation: none; opacity: 0; }
.blogger-avatar:hover .av-mouth{ animation: none; opacity: 1; }
.blogger-avatar:hover .av-head{ animation: none; }
.blogger-avatar:hover .av-brows{ transform: translateY(-2.2px); }
.blogger-avatar:hover .av-steam{ animation-duration: 2.3s; }
.blogger-name{ font-family: var(--font-heading); font-weight: 700; font-size: 1.08rem; }
.blogger-desc{ font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }
.blogger-quip{
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .02em;
  color: var(--accent-2);
  margin-top: .55rem;
}
.blogger-quip span{ color: var(--text-muted); }

.blog-counts{
  display: flex; width: 100%;
  margin: 1.1rem auto 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}
.blog-count{ display: block; width: 25%; color: inherit; text-align: center; cursor: pointer; }
.blog-count .count{
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.blog-count > div:last-child{
  font-size: .6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: .2rem;
}

.social-medias{ display: flex; justify-content: center; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.social-media{
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: border-color .25s, color .25s, transform .3s var(--ease-spring), background .25s;
}
.social-media:hover{ border-color: var(--accent); color: var(--accent); transform: translateY(-4px); background: var(--accent-soft); }
.social-media svg{ width: 15px; height: 15px; }

.sidebar-block{
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  transition: border-color .3s, box-shadow .3s, transform .3s var(--ease-out);
  scroll-margin-top: calc(var(--navbar-height) + 1.5rem);
}
.sidebar-block:hover{ border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); transform: translateY(-2px); }
.sidebar-block h4{
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: .6rem;
}
.sidebar-block p{ font-size: .84rem; margin-bottom: .45rem; }
.sidebar-block p:last-child{ margin-bottom: 0; }
.sidebar-cta{ background: linear-gradient(160deg, var(--accent-soft), var(--bg-elevated) 60%); }

/* ---------- Footer ---------- */
.footer{
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  padding: 3rem 1rem;
  text-align: center;
}
.footer-quote{
  font-family: var(--font-heading);
  font-size: 1.05rem;
  color: var(--text);
  font-style: italic;
  margin-bottom: .6rem;
  max-width: 40rem;
  margin-inline: auto;
}
.footer-copyright{ font-size: .78rem; color: var(--text-muted); font-family: var(--font-mono); }

/* ---------- Back to top ---------- */
.to-top{
  position: fixed;
  right: 1.6rem; bottom: 1.6rem;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border: none;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--accent);
  box-shadow: var(--shadow-hover);
  cursor: pointer;
  z-index: 1200;
  opacity: 0;
  transform: translateY(20px) scale(.8);
  pointer-events: none;
  transition: opacity .4s var(--ease-out), transform .4s var(--ease-spring), color .25s;
}
.to-top.show{ opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover{ color: var(--accent-hover); }
.to-top-arrow{ width: 18px; height: 18px; position: relative; z-index: 1; }
.to-top-ring{ position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.tt-track{ stroke: var(--border); stroke-width: 3; fill: none; }
.tt-prog{
  stroke: url(#ttgrad);
  stroke: var(--accent);
  stroke-width: 3; fill: none;
  stroke-linecap: round;
  stroke-dasharray: 125.6;
  stroke-dashoffset: 125.6;
  transition: stroke-dashoffset .1s linear;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px){
  .hero-content{ grid-template-columns: 1fr; gap: 2.2rem; }
  .terminal{ max-width: 520px; }
}
@media (max-width: 900px){
  .blog-page-wrapper{ flex-direction: column; align-items: stretch; }
  .vp-blog-main{ width: 100%; max-width: 100%; }
  .vp-blog-info-wrapper{
    position: static; width: 100%; margin-left: 0; order: -1; margin-bottom: 2rem;
  }
}
@media (max-width: 680px){
  .container{ padding: 0 1.25rem; }
  .nav-inner{ padding: 0 1.25rem; }
  .hero{ min-height: auto; padding: calc(var(--navbar-height) + 2rem) 0 3rem; }
  .terminal{ display: none; }
  .hero-orb{ opacity: .5; }
  .project-panel{ grid-template-columns: 1fr; }
  .scroll-cue{ display: none; }
  .to-top{ right: 1rem; bottom: 1rem; }
  /* Mobile: no hamburger menu — the page is one continuous scroll.
     Keep only the (larger) logo and a Get in touch button. */
  .nav-links,
  .nav-burger,
  .motion-toggle,
  .theme-toggle{ display: none; }
  .btn-small{ display: inline-flex; }
  .nav-brand{ font-size: 1.3rem; gap: .6rem; }
  .logo-mark{ width: 34px; height: 34px; }
}

/* Small phones */
@media (max-width: 430px){
  body{ font-size: 14.5px; }
  .container, .nav-inner{ padding: 0 1rem; }
  .hero-title{ font-size: clamp(2.15rem, 11vw, 3rem); }
  .hero-tag{ font-size: .96rem; }
  .hero-cta{ gap: .6rem; }
  .hero-cta .btn{ flex: 1 1 auto; justify-content: center; }
  .vp-blog-main section{ margin-bottom: 3rem; }
  .section-title{ font-size: clamp(1.5rem, 7vw, 1.9rem); }
  .project-card{ padding: 1.2rem 1.15rem; }
  .footer{ padding: 2.5rem 1rem; }
  .footer-quote{ font-size: .98rem; }
}

/* Touch devices: larger, comfortable tap targets */
@media (hover: none){
  .social-media{ width: 42px; height: 42px; }
  .social-media svg{ width: 17px; height: 17px; }
  .hero-social{ width: 46px; height: 46px; }
  .icon-btn{ width: 42px; height: 42px; }
  .nav-links a{ padding: .5rem 0; }
  .pill-list li{ padding: .5rem .9rem; }
}

/* ============================================================
   VIEW-TRANSITION theme wipe (circular reveal from toggle)
   ============================================================ */
::view-transition-old(root),
::view-transition-new(root){ animation: none; mix-blend-mode: normal; }
::view-transition-old(root){ z-index: 1; }
::view-transition-new(root){ z-index: 2; }
html.vt-theme::view-transition-new(root){
  animation: vtReveal .55s var(--ease-out);
}
@keyframes vtReveal{
  from{ clip-path: circle(0% at var(--vt-x, 50%) var(--vt-y, 50%)); }
  to  { clip-path: circle(150% at var(--vt-x, 50%) var(--vt-y, 50%)); }
}

/* ============================================================
   REDUCED MOTION — driven by in-page toggle (data-motion),
   so the OS setting alone no longer disables the showcase.
   ============================================================ */
html[data-motion="reduced"] *,
html[data-motion="reduced"] *::before,
html[data-motion="reduced"] *::after{
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
}
html[data-motion="reduced"]{ scroll-behavior: auto; }
html[data-motion="reduced"] .reveal{ opacity: 1 !important; transform: none !important; filter: none !important; }
html[data-motion="reduced"] .hero-anim{ opacity: 1 !important; transform: none !important; }
html[data-motion="reduced"] .bg-aurora,
html[data-motion="reduced"] .hero-orb{ animation: none !important; }
