/* ============================================================
   HASNAAT HUSSAIN — EDITORIAL
   Warm, minimal, portrait-first. Hand-coded. No frameworks.
   ============================================================ */

/* ---------- TOKENS ---------- */
:root {
  /* Typography */
  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  /* Metrics */
  --maxw: 1080px;
  --prose: 680px;
  --gut: clamp(1.25rem, 5vw, 3rem);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- LIGHT (default) ---- */
:root, [data-theme="light"] {
  --bg: #fbfaf6; --bg-soft: #f3f1ea; --bg-warm: #efece3;
  --ink: #1a1a1a; --ink-soft: #4b4b4b; --ink-mute: #8a877e;
  --line: rgba(0,0,0,0.10); --line-strong: rgba(0,0,0,0.18);
  --accent: #c0392b; --accent-soft: rgba(192,57,43,0.08);
  --header-bg: rgba(251,250,246,0.82);
  --body-grain: radial-gradient(100% 60% at 50% -10%, rgba(192,57,43,0.025), transparent 60%),
                radial-gradient(60% 50% at 100% 100%, rgba(0,0,0,0.02), transparent 70%);
  --cmd-bg: rgba(26,26,26,0.35);
  --badge-merged-bg: #def7ec; --badge-merged-fg: #03543f; --badge-merged-border: #a7f3d0; --badge-merged-icon: #047857;
  --badge-open-bg: #fef3cd; --badge-open-fg: #7a3e00; --badge-open-border: #fde68a; --badge-open-icon: #d97706;
  --cursor-dot: var(--ink); --cursor-ring: var(--accent);
  --shadow-sm: rgba(0,0,0,0.04); --shadow-md: rgba(0,0,0,0.08); --shadow-lg: rgba(0,0,0,0.18);
}

/* ---- DARK (immersive — inspired by cinematic dark portfolios) ---- */
[data-theme="dark"] {
  --bg: #0a0a0f; --bg-soft: #11111a; --bg-warm: #16161f;
  --ink: #f0ede5; --ink-soft: #a8a59e; --ink-mute: #5c5a55;
  --line: rgba(255,255,255,0.06); --line-strong: rgba(255,255,255,0.12);
  --accent: #ff6b4a; --accent-soft: rgba(255,107,74,0.12);
  --accent-glow: rgba(255,107,74,0.4);
  --header-bg: rgba(10,10,15,0.72);
  --body-grain: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255,107,74,0.06), transparent 70%),
                radial-gradient(ellipse 60% 40% at 100% 100%, rgba(100,80,255,0.04), transparent 70%),
                radial-gradient(ellipse 50% 30% at 0% 60%, rgba(255,107,74,0.03), transparent 70%);
  --cmd-bg: rgba(0,0,0,0.6);
  --badge-merged-bg: rgba(46,158,91,0.12); --badge-merged-fg: #6ee7b7; --badge-merged-border: rgba(46,158,91,0.25); --badge-merged-icon: #34d399;
  --badge-open-bg: rgba(251,191,36,0.1); --badge-open-fg: #fcd34d; --badge-open-border: rgba(251,191,36,0.25); --badge-open-icon: #fbbf24;
  --cursor-dot: #f0ede5; --cursor-ring: #ff6b4a;
  --shadow-sm: rgba(0,0,0,0.3); --shadow-md: rgba(0,0,0,0.4); --shadow-lg: rgba(0,0,0,0.6);
}

/* Smooth theme transitions */
body, .site-header, .masthead, .work-item, .oss-card, .cmd-panel,
.badge, .tag-list li, .contact__email, .stack-col__title {
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease),
              border-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

/* ---- DARK MODE IMMERSIVE ENHANCEMENTS ---- */
[data-theme="dark"] .masthead__name {
  background: linear-gradient(135deg, var(--ink) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 30px var(--accent-glow));
}
[data-theme="dark"] .section__title,
[data-theme="dark"] .gh-section__head h2,
[data-theme="dark"] .contact__title {
  text-shadow: 0 0 40px var(--accent-soft);
}
[data-theme="dark"] .masthead__portrait-wrap {
  box-shadow: 0 0 60px var(--accent-glow), 0 8px 30px rgba(0,0,0,0.5);
  border-color: var(--accent);
}
[data-theme="dark"] .status-dot {
  box-shadow: 0 0 8px #2e9e5b, 0 0 0 4px rgba(46,158,91,0.2);
}
[data-theme="dark"] .work-item:hover,
[data-theme="dark"] .oss-card:hover,
[data-theme="dark"] .gh-repo:hover {
  box-shadow: 0 8px 30px var(--accent-soft), 0 0 0 1px var(--accent);
  border-color: var(--accent);
}
[data-theme="dark"] .work-item__title,
[data-theme="dark"] .gh-repo__name {
  transition: color 0.2s;
}
[data-theme="dark"] .work-item:hover .work-item__title {
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
}
[data-theme="dark"] .site-header {
  border-bottom-color: rgba(255,255,255,0.04);
  box-shadow: 0 4px 30px rgba(0,0,0,0.3);
}
[data-theme="dark"] .scroll-progress {
  box-shadow: 0 0 10px var(--accent-glow);
}
[data-theme="dark"] .contact__email {
  text-shadow: 0 0 30px var(--accent-glow);
}
[data-theme="dark"] .ctrl-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 20px var(--accent-soft);
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
/* The `hidden` attribute must ALWAYS win over any `display` rule. */
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* Subtle paper grain so the white isn't clinical */
body::before {
  content: "";
  position: fixed; inset: 0;
  background: var(--body-grain);
  pointer-events: none; z-index: 0;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
ul { list-style: none; }
strong { font-weight: 600; }

/* ---------- UTILITIES ---------- */
.mono { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.02em; color: var(--ink-mute); }
.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;
}
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 200;
  background: var(--ink); color: var(--bg); font-weight: 500;
  padding: 0.6rem 1rem; border-radius: 6px; transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 1rem; }

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

/* ---------- SCROLL PROGRESS ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: var(--accent); z-index: 150;
  transition: width 0.1s linear;
}

/* ---------- HEADER ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem var(--gut);
  background: var(--header-bg);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--font-serif);
  font-size: 1.2rem; font-weight: 500; letter-spacing: -0.02em;
}
.site-nav ul { display: flex; gap: 2rem; margin-right: auto; margin-left: 2.5rem; }
.site-nav a { font-size: 0.92rem; color: var(--ink-soft); position: relative; padding: 0.2rem 0; transition: color 0.2s; }
.site-nav a::after { content: ""; position: absolute; left: 0; bottom: -1px; height: 1px; width: 0; background: var(--accent); transition: width 0.3s var(--ease); }
.site-nav a:hover, .site-nav a.active { color: var(--ink); }
.site-nav a:hover::after, .site-nav a.active::after { width: 100%; }
.header__actions { display: flex; align-items: center; gap: 0.6rem; }
.cmd-trigger {
  padding: 0.4rem 0.6rem; border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink-mute); transition: all 0.2s var(--ease);
}
.cmd-trigger:hover { border-color: var(--ink); color: var(--ink); }
.cmd-trigger__keys { font-size: 0.72rem; }
.header__cta {
  font-size: 0.88rem; font-weight: 500; color: var(--ink);
  padding: 0.45rem 0.9rem; border: 1px solid var(--line-strong); border-radius: 100px;
  transition: all 0.2s var(--ease);
}
.header__cta:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* nav toggle (mobile) */
.nav-toggle { display: none; flex-direction: column; gap: 5px; padding: 0.5rem; }
.nav-toggle span { width: 22px; height: 1.5px; background: var(--ink); transition: transform 0.3s var(--ease), opacity 0.3s; }
.nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-6.5px) rotate(-45deg); }
.mobile-nav {
  position: fixed; inset: 0; z-index: 99;
  background: var(--bg);
  display: grid; place-items: center;
}
.mobile-nav ul { display: flex; flex-direction: column; gap: 1.5rem; text-align: center; }
.mobile-nav a { font-family: var(--font-serif); font-size: 1.8rem; font-weight: 500; color: var(--ink-soft); }
.mobile-nav a:hover { color: var(--accent); }

/* ---------- LAYOUT HELPERS ---------- */
.section { position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto; padding: clamp(3.5rem, 9vh, 6rem) var(--gut); border-top: 1px solid var(--line); }
.section__head { margin-bottom: 3rem; }
.section__title { font-family: var(--font-serif); font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
.section__sub { margin-top: 0.7rem; color: var(--ink-mute); font-size: 1rem; max-width: 48ch; }

.prose { position: relative; z-index: 1; max-width: var(--prose); margin: 0 auto; padding: clamp(3rem, 8vh, 5rem) var(--gut); }
.prose p { color: var(--ink-soft); font-size: 1.18rem; line-height: 1.65; }
.prose p + p { margin-top: 1.4rem; }
.prose strong { color: var(--ink); }

/* ---------- MASTHEAD ---------- */
.masthead {
  position: relative; z-index: 1;
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(4rem, 12vh, 7rem) var(--gut) clamp(2.5rem, 6vh, 4rem);
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.masthead__portrait-wrap {
  width: clamp(120px, 18vw, 168px); aspect-ratio: 1;
  border-radius: 50%; overflow: hidden;
  border: 1px solid var(--line-strong);
  box-shadow: 0 8px 30px rgba(0,0,0,0.06);
  margin-bottom: 2rem; background: var(--bg-soft);
}
.masthead__portrait { width: 100%; height: 100%; object-fit: cover; filter: grayscale(0.12) contrast(1.03); transition: filter 0.6s var(--ease), transform 0.6s var(--ease); }
.masthead__portrait:hover { filter: none; transform: scale(1.03); }
.masthead__name {
  font-family: var(--font-serif); font-weight: 500;
  font-size: clamp(2.6rem, 8vw, 5rem); line-height: 1;
  letter-spacing: -0.035em;
}
.masthead__role {
  margin-top: 0.7rem; color: var(--ink-soft);
  font-size: clamp(1rem, 2vw, 1.25rem); font-weight: 400;
}
.socials { display: flex; gap: 1.5rem; margin-top: 1.6rem; }
.socials a {
  font-size: 0.9rem; color: var(--ink-soft); position: relative; padding-bottom: 2px;
  border-bottom: 1px solid var(--line); transition: color 0.2s, border-color 0.2s;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); }
.masthead__status {
  margin-top: 2rem; display: inline-flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  justify-content: center; font-size: 0.85rem; color: var(--ink-mute);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #2e9e5b; box-shadow: 0 0 0 3px rgba(46,158,91,0.18); }
.status-sep { opacity: 0.5; }

/* ---------- WORK ---------- */
.work-list { display: flex; flex-direction: column; }
.work-item {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 1.5rem; align-items: start;
  padding: 2rem 0; border-top: 1px solid var(--line);
  transition: padding-left 0.3s var(--ease);
}
.work-item:last-child { border-bottom: 1px solid var(--line); }
.work-item:hover { padding-left: 0.8rem; }
.work-item__num { color: var(--ink-mute); font-size: 0.8rem; padding-top: 0.3rem; }
.work-item__title { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 500; letter-spacing: -0.02em; }
.work-item__tag { margin-top: 0.2rem; }
.work-item__desc { margin-top: 0.6rem; color: var(--ink-soft); font-size: 0.98rem; max-width: 60ch; }
.work-item__stack { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; }
.work-item__stack li { font-size: 0.7rem; padding: 0.2rem 0.5rem; border: 1px solid var(--line); border-radius: 4px; }
.work-item__link { font-size: 0.88rem; color: var(--accent); font-weight: 500; padding-top: 0.4rem; white-space: nowrap; }

/* ---------- STACK ---------- */
.stack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2.5rem; }
.stack-col__title { color: var(--accent); margin-bottom: 1rem; font-size: 0.75rem; }
.tag-list { display: flex; flex-direction: column; gap: 0.5rem; }
.tag-list li { font-size: 1.02rem; color: var(--ink-soft); transition: color 0.2s, transform 0.2s; }
.tag-list li:hover { color: var(--ink); transform: translateX(3px); }

/* ---------- OSS ---------- */
.oss-summary { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.2rem; align-items: center; font-size: 0.78rem; color: var(--ink-mute); }
.oss-summary strong { color: var(--ink); font-weight: 600; }
.oss-summary__sep { opacity: 0.4; }
.oss-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.oss-card {
  display: flex; flex-direction: column; gap: 0.6rem;
  padding: 1.25rem 1.35rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-soft);
  transition: border-color 0.25s var(--ease), transform 0.2s var(--ease), box-shadow 0.25s var(--ease);
}
.oss-card:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: 0 8px 24px var(--shadow-sm); }
.oss-card__head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.oss-card__project { font-family: var(--font-serif); font-size: 1.05rem; font-weight: 600; color: var(--ink); }
.oss-card__sub { font-family: var(--font-sans); font-size: 0.78rem; color: var(--ink-mute); font-weight: 400; }
.oss-card__desc { color: var(--ink-soft); font-size: 0.85rem; line-height: 1.5; flex-grow: 0; }
.oss-card__desc code { font-family: var(--font-mono); font-size: 0.82em; background: var(--bg-warm); padding: 0.1em 0.3em; border-radius: 3px; color: var(--ink); }
.oss-card__foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 0.5rem; border-top: 1px solid var(--line); }
.oss-card__kind { font-size: 0.7rem; color: var(--ink-mute); letter-spacing: 0.01em; }
.oss-card__link { font-size: 0.72rem; color: var(--ink-mute); transition: color 0.2s; }
.oss-card__link:hover { color: var(--accent); }

/* PR status badges */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-family: var(--font-sans); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.22rem 0.6rem 0.22rem 0.5rem; border-radius: 100px; white-space: nowrap;
  border: 1px solid transparent; line-height: 1.4;
}
.badge svg { width: 13px; height: 13px; flex-shrink: 0; }
.badge--merged { background: var(--badge-merged-bg); color: var(--badge-merged-fg); border-color: var(--badge-merged-border); }
.badge--merged svg { color: var(--badge-merged-icon); }
.badge--open { background: var(--badge-open-bg); color: var(--badge-open-fg); border-color: var(--badge-open-border); }
.badge--open svg { color: var(--badge-open-icon); }
.badge--closed { background: var(--bg-warm); color: var(--ink-mute); border-color: var(--line); }

/* Merged cards get priority visual treatment */
.oss-card--merged { border-left: 3px solid #2ea35b; }
[data-theme="dark"] .oss-card--merged { border-left-color: #39d353; box-shadow: -1px 0 12px rgba(57,211,83,0.08); }
.oss-card--merged:hover { border-left-color: #2ea35b; }
[data-theme="dark"] .oss-card--merged:hover { box-shadow: -1px 0 20px rgba(57,211,83,0.15); }

/* ---------- ABOUT ---------- */
.about { display: grid; grid-template-columns: 1.4fr 1fr; gap: 4rem; align-items: start; }
.about__text p { color: var(--ink-soft); font-size: 1.12rem; }
.about__text p + p { margin-top: 1.3rem; }
.about__text strong { color: var(--ink); }
.about__timeline { display: flex; flex-direction: column; gap: 1.8rem; border-left: 1px solid var(--line); padding-left: 1.5rem; }
.tl-item { position: relative; }
.tl-item::before { content: ""; position: absolute; left: -1.5rem; top: 0.45rem; width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); transform: translateX(-3.5px); }
.tl-item__when { display: block; margin-bottom: 0.3rem; font-size: 0.72rem; color: var(--accent); }
.tl-item__body h4 { font-size: 1rem; font-weight: 600; margin-bottom: 0.3rem; }
.tl-item__body p { color: var(--ink-mute); font-size: 0.9rem; }
.about__stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.stat { display: flex; flex-direction: column; gap: 0.3rem; }
.stat__num { font-family: var(--font-serif); font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 500; letter-spacing: -0.02em; line-height: 1; }
.stat__label { font-size: 0.72rem; }

/* ---------- CONTACT ---------- */
.section--contact { text-align: center; }
.contact { max-width: var(--prose); margin: 0 auto; }
.contact__title { font-family: var(--font-serif); font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; }
.contact__sub { margin-top: 1rem; color: var(--ink-mute); font-size: 1.05rem; }
.contact__email {
  display: inline-block; margin-top: 2rem; font-family: var(--font-serif);
  font-size: clamp(1.2rem, 3vw, 1.8rem); color: var(--ink); font-weight: 500;
  border-bottom: 2px solid var(--accent); padding-bottom: 2px; transition: color 0.2s;
}
.contact__email:hover { color: var(--accent); }
.socials--contact { justify-content: center; margin-top: 2rem; }

/* ---------- FOOTER ---------- */
.site-footer {
  position: relative; z-index: 1;
  max-width: var(--maxw); margin: 0 auto;
  padding: 2rem var(--gut);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  font-size: 0.8rem;
}
.site-footer__top { color: var(--ink-soft); transition: color 0.2s; }
.site-footer__top:hover { color: var(--accent); }

/* ---------- COMMAND PALETTE ---------- */
.cmd-overlay { position: fixed; inset: 0; z-index: 300; display: grid; place-items: start center; padding-top: 14vh; }
.cmd-backdrop { position: absolute; inset: 0; background: var(--cmd-bg); backdrop-filter: blur(6px); animation: fade-in 0.2s ease; }
@keyframes fade-in { from { opacity: 0; } }
.cmd-panel {
  position: relative; width: min(560px, 92vw);
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 25px 60px var(--shadow-lg);
  overflow: hidden; animation: cmd-in 0.22s var(--ease);
}
@keyframes cmd-in { from { opacity: 0; transform: translateY(-10px); } }
.cmd-input-wrap { display: flex; align-items: center; gap: 0.7rem; padding: 1rem 1.1rem; border-bottom: 1px solid var(--line); }
.cmd-input-icon { color: var(--accent); }
.cmd-input { flex: 1; background: none; border: none; outline: none; color: var(--ink); font-size: 1rem; }
.cmd-input::placeholder { color: var(--ink-mute); }
.cmd-esc { font-size: 0.68rem; color: var(--ink-mute); border: 1px solid var(--line); padding: 0.1rem 0.4rem; border-radius: 4px; }
.cmd-list { max-height: 320px; overflow-y: auto; padding: 0.4rem; }
.cmd-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.65rem 0.7rem; border-radius: 7px; cursor: pointer; transition: background 0.12s; }
.cmd-item.active, .cmd-item:hover { background: var(--bg-warm); }
.cmd-item__label { display: flex; align-items: center; gap: 0.7rem; font-size: 0.92rem; color: var(--ink); }
.cmd-item__hint { font-size: 0.68rem; color: var(--ink-mute); }
.cmd-item.active .cmd-item__hint { color: var(--accent); }
.cmd-list::-webkit-scrollbar { width: 6px; }
.cmd-list::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

/* ---------- REVEAL ---------- */
.reveal-up { opacity: 0; transform: translateY(24px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal-up.is-in { opacity: 1; transform: translateY(0); }
/* Stagger children — set via JS or CSS nth-child */
.reveal-up:nth-child(2) { transition-delay: 0.08s; }
.reveal-up:nth-child(3) { transition-delay: 0.16s; }
.reveal-up:nth-child(4) { transition-delay: 0.24s; }
.reveal-up:nth-child(5) { transition-delay: 0.32s; }
.reveal-up:nth-child(6) { transition-delay: 0.4s; }
.reveal-up:nth-child(7) { transition-delay: 0.48s; }
.reveal-up:nth-child(8) { transition-delay: 0.56s; }

/* ---------- CUSTOM CURSOR ---------- */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0;
  pointer-events: none; z-index: 9999;
  border-radius: 50%;
  will-change: transform, opacity;
}
.cursor-dot {
  width: 10px; height: 10px;
  background: var(--cursor-dot);
  box-shadow: 0 0 10px var(--cursor-ring), 0 0 20px var(--cursor-ring);
  mix-blend-mode: difference;
  transition: opacity 0.3s var(--ease);
  transform: translate(-50%, -50%);
}
.cursor-ring {
  width: 36px; height: 36px;
  border: 1.5px dashed var(--cursor-ring);
  opacity: 0.6;
  transition: opacity 0.3s var(--ease), border-color 0.3s var(--ease);
  animation: cursor-spin 4s linear infinite;
}
@keyframes cursor-spin {
  from { rotate: 0deg; }
  to { rotate: 360deg; }
}
.cursor-ring.is-hovering {
  opacity: 0.9;
  border-width: 2px;
  border-style: solid;
  background: var(--accent-soft);
}
.cursor-ring.is-down {
  opacity: 1;
}
/* Trail canvas */
#cursor-canvas {
  position: fixed; top: 0; left: 0;
  pointer-events: none; z-index: 9998;
}
/* Hide default cursor on desktop when custom cursor active */
.has-custom-cursor, .has-custom-cursor * { cursor: none !important; }

/* ---------- HEADER CONTROLS (theme + audio) ---------- */
.header__controls { display: flex; align-items: center; gap: 0.45rem; }
.ctrl-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink-mute); font-size: 0.85rem;
  transition: all 0.25s var(--ease);
}
.ctrl-btn:hover { border-color: var(--line-strong); color: var(--ink); background: var(--bg-soft); }
.ctrl-btn.is-playing { color: var(--accent); border-color: var(--accent); }
.ctrl-btn svg { width: 16px; height: 16px; }

/* ---------- TEXT HOVER ANIMATIONS ---------- */
.hover-underline {
  position: relative;
}
.hover-underline::after {
  content: "";
  position: absolute; left: 0; bottom: -1px; height: 1px;
  width: 0; background: var(--accent);
  transition: width 0.35s var(--ease);
}
.hover-underline:hover::after { width: 100%; }

/* Magnetic text lift on hover */
.hover-lift {
  display: inline-block;
  transition: transform 0.3s var(--ease), color 0.2s;
}
.hover-lift:hover { transform: translateY(-2px); }

/* ---------- GITHUB SECTION ---------- */
.gh-section { position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto;
  padding: clamp(3.5rem, 9vh, 6rem) var(--gut); border-top: 1px solid var(--line); }
.gh-section__head { margin-bottom: 2.5rem; }
.gh-section__head h2 { font-family: var(--font-serif); font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
.gh-section__head p { margin-top: 0.7rem; color: var(--ink-mute); font-size: 1rem; max-width: 48ch; }
.gh-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2.5rem; }
.gh-stat { display: flex; flex-direction: column; gap: 0.3rem;
  padding: 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft); }
.gh-stat__num { font-family: var(--font-serif); font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 500; letter-spacing: -0.02em; line-height: 1; }
.gh-stat__label { font-size: 0.72rem; }
.gh-repos { margin-top: 2.5rem; }
.gh-section-title { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 500;
  margin-bottom: 1rem; color: var(--ink); }
.gh-repo-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; }
.gh-repo {
  padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-soft);
  transition: border-color 0.25s var(--ease), transform 0.2s var(--ease), box-shadow 0.25s var(--ease);
}
.gh-repo:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: 0 6px 20px var(--shadow-sm); }
.gh-repo__head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.gh-repo__name { font-family: var(--font-serif); font-weight: 600; font-size: 0.95rem; color: var(--ink); }
.gh-repo__lang { font-size: 0.7rem; }
.gh-repo__desc { margin-top: 0.4rem; font-size: 0.82rem; color: var(--ink-mute); line-height: 1.45; }
.gh-repo__meta { display: flex; gap: 0.8rem; margin-top: 0.6rem; font-size: 0.68rem; color: var(--ink-mute); }
.gh-events { margin-top: 2.5rem; }
.gh-event-list { display: flex; flex-direction: column; gap: 0.5rem; }
.gh-event { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0;
  font-size: 0.85rem; border-bottom: 1px solid var(--line); }
.gh-event:last-child { border-bottom: none; }
.gh-event__icon { font-size: 1rem; flex-shrink: 0; width: 1.5rem; text-align: center; }
.gh-event__text { flex: 1; color: var(--ink-soft); }
.gh-event__text strong { color: var(--ink); }
.gh-event__time { font-size: 0.7rem; color: var(--ink-mute); flex-shrink: 0; }
.gh-cta {
  display: inline-block; margin-top: 2rem; font-weight: 500; font-size: 0.9rem;
  color: var(--accent); border-bottom: 1px solid var(--accent); padding-bottom: 1px;
  transition: opacity 0.2s;
}
.gh-cta:hover { opacity: 0.7; }
.gh-loading { text-align: center; padding: 3rem; color: var(--ink-mute); font-size: 0.9rem; }

/* ---------- CONTRIBUTION GRAPH ---------- */
.contrib-loading { text-align: center; padding: 2rem; color: var(--ink-mute); }
.contrib-container { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem; }
.contrib-header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.contrib-title { font-family: var(--font-serif); font-size: 0.95rem; font-weight: 500; color: var(--ink); }
.contrib-stats { display: flex; gap: 0.8rem; font-size: 0.72rem; color: var(--ink-mute); }
.contrib-scroll { position: relative; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; padding-bottom: 0.25rem; }
.contrib-scroll::-webkit-scrollbar { height: 5px; }
.contrib-scroll::-webkit-scrollbar-track { background: transparent; }
.contrib-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.contrib-svg { display: block; }
.contrib-cell {
  stroke: transparent; stroke-width: 0;
  transition: stroke 0.15s, stroke-width 0.15s;
  cursor: pointer;
}
.contrib-cell:hover { stroke: var(--ink); stroke-width: 1.5; }
.contrib-tooltip {
  position: absolute; pointer-events: none; z-index: 10;
  background: var(--ink); color: var(--bg); font-size: 0.68rem;
  padding: 0.35rem 0.55rem; border-radius: 5px; white-space: nowrap;
  opacity: 0; transform: translate(-50%, -100%); transition: opacity 0.15s;
  max-width: 200px;
}
.contrib-tooltip.is-visible { opacity: 1; }
.contrib-legend { display: flex; align-items: center; gap: 0.35rem; justify-content: flex-end; margin-top: 0.5rem; font-size: 0.68rem; color: var(--ink-mute); }
.contrib-legend-swatch { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.contrib-legend-swatch[data-empty="true"] { opacity: 0.4; }
.contrib-fallback { text-align: center; padding: 2rem; }
.contrib-cta { color: var(--accent); border-bottom: 1px solid var(--accent); padding-bottom: 1px; }
@media (max-width: 600px) {
  .contrib-container { padding: 0.85rem; }
  .contrib-title { font-size: 0.85rem; }
  .contrib-stats { font-size: 0.65rem; gap: 0.5rem; }
}

/* ---------- ANALYTICS BAR ---------- */
.analytics-bar {
  position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto;
  padding: 1.5rem var(--gut); display: flex; justify-content: center; gap: 3rem;
  flex-wrap: wrap; font-size: 0.8rem;
}
.analytics-item { display: flex; align-items: center; gap: 0.5rem; color: var(--ink-mute); }
.analytics-item__val { color: var(--ink); font-weight: 600; font-family: var(--font-serif); font-size: 1rem; }
.analytics-item__icon { font-size: 0.9rem; }

/* ---------- RESUME LINK ---------- */
.resume-link {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 0.55rem 1.3rem; border: 1px solid var(--line-strong); border-radius: 100px;
  font-size: 0.88rem; font-weight: 500; color: var(--ink);
  transition: all 0.25s var(--ease);
  background: var(--bg-soft);
}
.resume-link:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); transform: translateY(-1px); }
.resume-link svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 760px) {
  .site-nav { display: none; }
  .header__cta { display: none; }
  .nav-toggle { display: flex; }
  .header__controls { gap: 0.3rem; }
  .ctrl-btn { width: 32px; height: 32px; }
  .cmd-trigger { padding: 0.3rem 0.5rem; }
  .cmd-trigger__keys { font-size: 0.65rem; }
  .brand { font-size: 1.05rem; }
  .work-item { grid-template-columns: 32px 1fr; }
  .work-item__link { grid-column: 2; }
  .about { grid-template-columns: 1fr; gap: 2.5rem; }
  .about__stats { grid-template-columns: 1fr 1fr; }
  .gh-stats { grid-template-columns: repeat(2, 1fr); }
  .cursor-dot, .cursor-ring, #cursor-canvas { display: none !important; }
  .has-custom-cursor, .has-custom-cursor * { cursor: auto !important; }
  .masthead { padding-top: clamp(2.5rem, 8vh, 4rem); }
  .masthead__name { font-size: clamp(2rem, 10vw, 3.5rem); }
  .masthead__portrait-wrap { width: clamp(100px, 28vw, 130px); margin-bottom: 1.5rem; }
  .socials { gap: 1rem; flex-wrap: wrap; justify-content: center; }
  .socials a { font-size: 0.82rem; }
  .resume-link { font-size: 0.82rem; padding: 0.45rem 1rem; margin-top: 1.2rem; }
  .section { padding: clamp(2.5rem, 7vh, 4rem) var(--gut); }
  .section__title { font-size: clamp(1.5rem, 6vw, 2.2rem); }
  .section__head { margin-bottom: 2rem; }
  .gh-section { padding: clamp(2.5rem, 7vh, 4rem) var(--gut); }
  .gh-section__head h2 { font-size: clamp(1.5rem, 6vw, 2.2rem); }
  .contact__title { font-size: clamp(1.6rem, 6vw, 2.5rem); }
  .analytics-bar { gap: 1.5rem; padding: 1rem var(--gut); font-size: 0.72rem; }
  .analytics-item__val { font-size: 0.9rem; }
  .site-footer { padding: 1.5rem var(--gut); flex-direction: column; text-align: center; gap: 0.5rem; }
  .gh-event { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .work-item { grid-template-columns: 1fr; }
  .work-item__num { display: none; }
  .oss-list { grid-template-columns: 1fr; }
  .stack-grid { gap: 1.5rem; }
  .gh-stats { grid-template-columns: 1fr 1fr; }
  .analytics-bar { gap: 1rem; flex-direction: column; }
  .analytics-item { font-size: 0.68rem; }
  .masthead__role { font-size: 0.95rem; }
  .prose p { font-size: 1.05rem; }
  .header__controls { gap: 0.25rem; }
  .ctrl-btn { width: 30px; height: 30px; }
  .ctrl-btn svg { width: 14px; height: 14px; }
  .cmd-trigger { display: none; }
  .brand { font-size: 0.95rem; letter-spacing: -0.01em; }
}
