/* ==========================================================================
   Portfolio Base — vanilla recreation of the reference portfolio design.
   --------------------------------------------------------------------------
   THEME: change colors in :root / [data-theme="dark"] below.
   Original reference: near-monochrome theme driven by CSS variables,
   Space Grotesk headings, Inter body.
   ========================================================================== */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&family=Space+Grotesk:wght@300;400;500;600;700&family=Space+Mono:wght@400;700&family=Inter:wght@300;400;500;600;700&family=Bebas+Neue&family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400;1,700;1,900&family=Quicksand:wght@400;500;600;700&family=Oswald:wght@400;500;600;700&family=Roboto:wght@300;400;500;700&family=JetBrains+Mono:wght@300;400;500;600;700&family=Caveat:wght@400;500;600;700&family=Capriola&family=Droid+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap");

:root {
  --background: #fcfcfc;
  --foreground: #0e0e0e;
  --card: #ffffff;
  --card-foreground: #0e0e0e;
  --popover: #ffffff;
  --muted: #ededed;
  --muted-foreground: #666666;
  --accent: #e0e0e0;
  --border: #d9d9d9;
  --ring: #0e0e0e;
  --gradient-card-bg: #f6f6f6;
  --gradient-card-border: #e6e6e6;
  --input-bg: #f8f8f8;
  --radius: 0.5rem;
  --shadow: 0 8px 40px rgba(0, 0, 0, 0.06);
  --nav-bg: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] {
  --background: #0d0d0d;
  --foreground: #f5f5f5;
  --card: #0f0f0f;
  --card-foreground: #f5f5f5;
  --popover: #0f0f0f;
  --muted: #1f1f1f;
  --muted-foreground: #8c8c8c;
  --accent: #1f1f1f;
  --border: #262626;
  --ring: #d4d4d4;
  --gradient-card-bg: #151515;
  --gradient-card-border: #262626;
  --input-bg: rgba(255, 255, 255, 0.06);
  --shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
  --nav-bg: rgba(13, 13, 13, 0.7);
}

* {
  box-sizing: border-box;
}
html {
  font-size: 81%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: "Inter", system-ui, sans-serif;
  overflow-x: hidden;
  max-width: 100vw;
  transition:
    background-color 0.35s ease,
    color 0.35s ease;
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
h4 {
  font-family: "Space Grotesk", sans-serif;
  margin: 0;
}
p {
  margin: 0;
}
a {
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 4px;
}
img {
  max-width: 100%;
}
::selection {
  background: var(--foreground);
  color: var(--background);
}
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted-foreground) 30%, transparent);
  border-radius: 3px;
}

/* ---------- layout helpers ---------- */
.wrap {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.wrap-narrow {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.wrap-wide {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.wrap-6xl {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.wrap-4xl {
  max-width: 56rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}
section {
  position: relative;
}

/* ---------- page loader ---------- */
#loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background);
  transition: opacity 0.2s ease;
}
#loader.done {
  opacity: 0;
  pointer-events: none;
}
#loader .l-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
#loader .l-logo {
  font-family: "Space Grotesk", sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
#loader .l-bar {
  width: 80px;
  height: 2px;
  background: color-mix(in srgb, var(--foreground) 20%, transparent);
  border-radius: 999px;
  overflow: hidden;
}
#loader .l-fill {
  height: 100%;
  width: 0%;
  background: var(--foreground);
  border-radius: 999px;
  transition: width 0.1s ease-out;
}

/* ---------- route transition ---------- */
.route-enter {
  animation: routeIn 0.3s ease both;
}
@keyframes routeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- scroll reveal (IntersectionObserver adds .in) ---------- */
.rv {
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 0.7s ease,
    transform 0.7s cubic-bezier(0.25, 0.1, 0, 1);
}
.rv-x-l {
  transform: translateX(-60px);
  transition:
    opacity 0.8s ease,
    transform 0.8s cubic-bezier(0.25, 0.1, 0, 1);
}
.rv-x-r {
  transform: translateX(60px);
  transition:
    opacity 0.8s ease,
    transform 0.8s cubic-bezier(0.25, 0.1, 0, 1);
}
.rv.in,
.rv-x-l.in,
.rv-x-r.in {
  opacity: 1;
  transform: none;
}
.rv-d1 {
  transition-delay: 0.08s;
}
.rv-d2 {
  transition-delay: 0.16s;
}
.rv-d3 {
  transition-delay: 0.24s;
}

/* ---------- navbar ---------- */
#site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#site-nav .nav-shell {
  /* Transparent placeholder border/radius so the pill morph never
     shifts inner layout when the visible border fades in. */
  border: 1px solid transparent;
  border-radius: 1rem;
  transition:
    background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#site-nav.scrolled {
  padding: 0.75rem 1rem 0;
}
#site-nav.scrolled .nav-shell {
  background: var(--nav-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  border-radius: 1rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}
.nav-desktop {
  display: none;
}
@media (min-width: 768px) {
  .nav-desktop {
    display: flex;
  }
  .nav-mobile {
    display: none !important;
  }
}
.nav-desktop {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
  padding: 0 3rem;
  /* Same timing as the shell so inner content shrinks in sync (no snap). */
  transition:
    height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#site-nav.scrolled .nav-desktop {
  height: 52px;
  padding: 0 1.25rem;
}
.nav-logo {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-links a,
.nav-icon-btn {
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 1.15rem;
  font-weight: 500;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}
.nav-links a:hover,
.nav-icon-btn:hover {
  color: var(--foreground);
}
/* text-roll hover (per-letter stagger, mirrors reference TextRoll) */
.roll {
  position: relative;
  display: block;
  overflow: hidden;
  line-height: 1.175;
}
.roll-row {
  display: block;
  white-space: nowrap;
}
.roll-row.rl,
.roll-top .rl {
  display: inline-block;
}
.roll .rl {
  display: inline-block;
  transition: transform 0.3s ease-in-out;
}
.roll-top {
  position: absolute;
  inset: 0;
}
.roll-top .rl {
  transform: translateY(100%);
}
a:hover .roll .rl,
button:hover .roll .rl {
  transform: translateY(-100%);
}
a:hover .roll-top .rl,
button:hover .roll-top .rl {
  transform: translateY(0);
}
/* mobile nav */
.nav-mobile {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  transition:
    height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.3s,
    border-radius 0.3s;
  border: 1px solid transparent;
  height: 56px;
}
#site-nav.scrolled .nav-mobile {
  margin: 0 auto;
  max-width: 95%;
}
#site-nav.scrolled .nav-mobile:not(.open) {
  background: var(--nav-bg);
  border-color: color-mix(in srgb, var(--border) 55%, transparent);
  border-radius: 1rem;
  height: 48px;
}
.nav-mobile.open {
  height: 100dvh;
  background: color-mix(in srgb, var(--background) 95%, transparent);
}
#site-nav.scrolled .nav-mobile.open {
  border-radius: 1rem;
  height: calc(100dvh - 24px);
}
.nav-m-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  flex-shrink: 0;
  /* Sync with the mobile bar's height morph so the row never snaps. */
  transition:
    height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#site-nav.scrolled .nav-mobile:not(.open) .nav-m-head {
  height: 48px;
  padding: 0 1rem;
}
.nav-m-body {
  display: none;
  flex: 1;
  flex-direction: column;
  padding: 1.5rem;
  gap: 0.25rem;
  overflow-y: auto;
}
.nav-mobile.open .nav-m-body {
  display: flex;
}
.nav-m-body a.m-link {
  display: block;
  padding: 1rem;
  border-radius: 0.75rem;
  font-size: 2rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--foreground) 70%, transparent);
  text-decoration: none;
  opacity: 0;
  transform: translateY(-12px);
  transition:
    opacity 0.3s,
    transform 0.3s,
    background-color 0.2s,
    color 0.2s;
}
.nav-m-body button.m-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 1rem;
  border: 0;
  border-radius: 0.75rem;
  background: none;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--muted-foreground);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-12px);
  transition:
    opacity 0.3s,
    transform 0.3s,
    background-color 0.2s,
    color 0.2s;
}
.nav-mobile.open .nav-m-body a.m-link,
.nav-mobile.open .nav-m-body button.m-link {
  opacity: 1;
  transform: none;
}
.nav-m-body a.m-link:hover,
.nav-m-body button.m-link:hover {
  color: var(--foreground);
  background: var(--muted);
}
.nav-m-foot {
  margin-top: auto;
  padding: 1.5rem 0;
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
}
.menu-btn {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  color: var(--foreground);
  cursor: pointer;
}
.menu-btn svg {
  transition: transform 0.5s ease-in-out;
}
.menu-btn path {
  transition:
    transform 0.5s ease-in-out,
    opacity 0.3s;
  transform-box: fill-box;
  transform-origin: center;
}
.menu-btn.open svg {
  transform: rotate(-45deg);
}
.menu-btn.open .mb-l2 {
  opacity: 0;
}
.menu-btn.open .mb-l1 {
  transform: translateY(5px);
}
.menu-btn.open .mb-l3 {
  transform: translateY(-5px);
}
.nav-spacer {
  height: 4rem;
}

/* ---------- hero ---------- */
.hero {
  min-height: 42vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 86px 1.5rem;
}
@media (min-width: 1280px) {
  .hero {
    padding-top: 120px;
  }
}
@media (min-width: 1536px) {
  .hero {
    padding-top: 150px;
  }
}
.hero-grid {
  max-width: 64rem;
  width: 100%;
  margin: 0 auto;
  display: grid;
  gap: 2.5rem;
  align-items: center;
}
@media (min-width: 768px) {
  .hero-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.hero-name {
  font-size: 3rem;
  line-height: 0.9;
  font-weight: 700;
  letter-spacing: -0.03em;
}
@media (min-width: 768px) {
  .hero-name {
    font-size: 4.5rem;
  }
}
@media (min-width: 1024px) {
  .hero-name {
    font-size: 6rem;
  }
}
.hero-tag {
  margin-top: 1.5rem;
  color: var(--muted-foreground);
  font-size: 1rem;
  line-height: 1.625;
  max-width: 28rem;
}
@media (min-width: 768px) {
  .hero-tag {
    font-size: 1.125rem;
  }
}
.hero-socials {
  margin-top: 2rem;
  display: flex;
  gap: 1.25rem;
  align-items: center;
}
.hero-socials a {
  color: var(--muted-foreground);
  transition: color 0.2s;
  position: relative;
}
.hero-socials a:hover {
  color: var(--foreground);
}
.hero-socials svg {
  display: block;
}
.nav-m-foot svg {
  width: 1.5rem;
  height: 1.5rem;
  display: block;
}
.tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, 8px) scale(0);
  opacity: 0;
  transition: all 0.1s;
  background: color-mix(in srgb, var(--background) 80%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.85rem;
  white-space: nowrap;
}
a:hover .tip,
button:hover .tip {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
}
.avatar-tilt {
  perspective: 800px;
  display: flex;
  justify-content: center;
}
@media (min-width: 768px) {
  .avatar-tilt {
    justify-content: flex-end;
  }
}
.avatar-frame {
  width: 14rem;
  height: 14rem;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow:
    0 0 0 1px var(--border),
    0 0 15px -3px color-mix(in srgb, var(--foreground) 8%, transparent);
  transition: transform 0.15s ease-out;
}
@media (min-width: 768px) {
  .avatar-frame {
    width: 18rem;
    height: 18rem;
  }
}
.avatar-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

/* ---------- gradient card + glow ---------- */
.g-card {
  position: relative;
  border-radius: 0.75rem;
  padding: 1.25rem;
  overflow: hidden;
  border: 1px solid var(--gradient-card-border);
  background: var(--gradient-card-bg);
  --glow-x: 50%;
  --glow-y: 50%;
}
.g-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(
      100px circle at var(--glow-x) var(--glow-y),
      color-mix(in srgb, var(--foreground) 50%, transparent),
      transparent 70%
    )
    border-box;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.g-card:hover::before {
  opacity: 1;
}
.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted-foreground);
}

/* ---------- about bento ---------- */
.about {
  padding: 3rem 0;
}
.bento {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 768px) {
  .bento {
    grid-template-columns: repeat(6, 1fr);
  }
  .bento .s4 {
    grid-column: span 4;
  }
  .bento .s2 {
    grid-column: span 2;
  }
  .bento .tall {
    grid-row: span 2;
  }
}
.bento h3 {
  font-family: "Averia Serif Libre", serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
@media (min-width: 768px) {
  .bento h3 {
    font-size: 1.875rem;
  }
}
.bento p.body {
  color: var(--muted-foreground);
  line-height: 1.7;
  margin-top: 0.75rem;
  font-size: 1.05rem;
}
.tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--muted) 70%, transparent);
  border-radius: 0.375rem;
  padding: 0.1rem 0.6rem;
  font-size: 0.85em;
  font-weight: 500;
  white-space: nowrap;
}
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}
.t-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.t-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted-foreground) 40%, transparent);
  box-shadow: 0 0 0 2px var(--card);
  margin-top: 0.35rem;
  flex-shrink: 0;
}
.t-item.first .t-dot {
  background: var(--foreground);
}
.t-line {
  width: 1px;
  height: 2rem;
  background: var(--border);
  margin: 0.25rem auto 0;
}
.t-year {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted-foreground);
}
.t-text {
  margin-top: 0.25rem;
  font-size: 0.95rem;
  color: color-mix(in srgb, var(--foreground) 80%, transparent);
  line-height: 1.6;
}
.edu-row {
  margin-bottom: 0.9rem;
}
.edu-row .e-name {
  font-weight: 600;
  font-size: 1.05rem;
}
.edu-row .e-sub {
  display: flex;
  justify-content: space-between;
  color: var(--muted-foreground);
  font-size: 0.92rem;
}
/* github chart */
.gh-total {
  font-size: 1.7rem;
  font-weight: 700;
}
.gh-sub {
  font-size: 0.8rem;
  color: var(--muted-foreground);
}
.gh-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  min-height: 80px;
  flex: 1;
  margin-top: 0.75rem;
}
.gh-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  height: 100%;
  justify-content: flex-end;
}
.gh-bar {
  width: 100%;
  border-radius: 2px;
  background: color-mix(in srgb, var(--foreground) 80%, transparent);
  min-height: 3px;
  transition: height 0.5s;
}
.gh-lab {
  font-size: 0.68rem;
  color: var(--muted-foreground);
  font-family: "JetBrains Mono", monospace;
}

/* ---------- experience ---------- */
.exp {
  padding: 4rem 0;
}
@media (min-width: 768px) {
  .exp {
    padding: 5rem 0;
  }
}
.exp-head p {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted-foreground);
}
.exp-head h2 {
  font-family: "Averia Serif Libre", serif;
  font-size: 1.5rem;
  font-weight: 700;
}
@media (min-width: 768px) {
  .exp-head h2 {
    font-size: 1.875rem;
  }
}
.x-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.x-comp {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.x-logo {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.375rem;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  font-weight: 700;
}
.x-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.x-comp h3 {
  font-size: 1.2rem;
}
.x-live {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #43b581;
  box-shadow: 0 0 0 0 rgba(67, 181, 129, 0.6);
  animation: ping 1.6s infinite;
}
@keyframes ping {
  0% {
    box-shadow: 0 0 0 0 rgba(67, 181, 129, 0.5);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(67, 181, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(67, 181, 129, 0);
  }
}
.x-pos {
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  margin-top: 0.75rem;
  background: var(--card);
}
.x-pos-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: none;
  border: 0;
  color: var(--foreground);
  cursor: pointer;
  text-align: left;
  font-size: 1.02rem;
}
.x-pos-head .chev {
  margin-left: auto;
  transition: transform 0.25s;
  color: var(--muted-foreground);
}
.x-pos.open .x-pos-head .chev {
  transform: rotate(180deg);
}
.x-pos-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}
.x-pos-body > div {
  overflow: hidden;
}
.x-pos-text {
  padding: 0 1rem 1rem;
  color: color-mix(in srgb, var(--foreground) 82%, transparent);
  line-height: 1.7;
}
.x-pos.open .x-pos-body {
  grid-template-rows: 1fr;
}
.x-pos-body ul {
  margin: 0.5rem 0;
  padding-left: 1.1rem;
}
.x-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.x-skills span {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  color: var(--muted-foreground);
}

/* ---------- tech carousel ---------- */
.tech {
  padding: 1.5rem;
  margin-bottom: 1rem;
  text-align: center;
}
.tech h3 {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 1rem;
}
.ribbon {
  overflow: hidden;
  width: 100%;
  margin-bottom: 1.25rem;
}
.ribbon-track {
  display: flex;
  width: max-content;
  animation: ribbon 25s linear infinite;
}
.ribbon.rev .ribbon-track {
  animation-direction: reverse;
  animation-duration: 30s;
}
.ribbon:hover .ribbon-track {
  animation-play-state: paused;
}
@keyframes ribbon {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(-100% / 3));
  }
}
.skill-badge {
  flex-shrink: 0;
  padding: 0 1.75rem;
  font-size: 38px;
  display: flex;
  align-items: center;
  font-size: 2.4rem;
  color: color-mix(in srgb, var(--foreground) 70%, transparent);
  transition:
    color 0.2s,
    filter 0.2s;
  cursor: default;
}
.skill-badge:hover {
  color: var(--foreground);
  filter: brightness(1.25);
}
.skill-badge .glyph {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  width: 3.2rem;
  height: 3.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
}

/* opacity-only entrance (for elements with inline transforms, e.g. scattered cards) */
.rv-o {
  opacity: 0;
  transition: opacity 0.6s ease;
}
.rv-o.in {
  opacity: 1;
}
/* ---------- projects home ---------- */
.proj-sec {
  padding: 5rem 0;
  overflow: hidden;
  position: relative;
}
.proj-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 2rem;
}
.proj-head h2 {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
@media (min-width: 768px) {
  .proj-head h2 {
    font-size: 1.875rem;
  }
  .proj-head {
    margin-bottom: 3rem;
  }
}
.proj-head a {
  color: var(--muted-foreground);
  text-decoration: none;
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 1.05rem;
}
.proj-head a:hover {
  color: var(--foreground);
}
.m-cards {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
@media (min-width: 768px) {
  .m-cards {
    display: none;
  }
}
.p-card {
  display: block;
  border-radius: 1rem;
  overflow: hidden;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--foreground) 10%, transparent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  text-decoration: none;
  transition:
    transform 0.3s,
    box-shadow 0.3s;
}
.p-card:hover {
  transform: scale(1.02);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.14);
}
.p-card .ph {
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--muted);
}
.p-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
  display: block;
}
.p-card:hover img {
  transform: scale(1.05);
}
.p-card .pcap {
  padding: 1rem;
  font-family: "Quicksand", sans-serif;
  font-weight: 500;
}
.scatter {
  display: none;
}
/* Uniform project grid: equal-width cards (2 cols on tablet, 3 on desktop). */
@media (min-width: 768px) {
  .scatter {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
}
@media (min-width: 1024px) {
  .scatter {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- projects page ---------- */
.split {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1rem 0 3rem;
}
.split aside {
  display: none;
}
.split .m-head {
  margin-bottom: 2rem;
}
@media (min-width: 768px) {
  .split {
    flex-direction: row;
    height: calc(100vh - 4rem);
    overflow: hidden;
  }
  .split aside {
    display: block;
    width: 50%;
    min-width: 0;
    align-self: flex-start;
    padding-top: 1rem;
  }
  .split .m-head {
    display: none;
  }
  .split .list-col {
    flex: 1;
    overflow-y: auto;
    max-height: 605px;
    padding-top: 2rem;
    padding-bottom: 0.5rem;
    padding-right: 0.5rem;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(
      to bottom,
      transparent 0,
      black 48px,
      black calc(100% - 48px),
      transparent 100%
    );
    mask-image: linear-gradient(
      to bottom,
      transparent 0,
      black 48px,
      black calc(100% - 48px),
      transparent 100%
    );
  }
  .split .list-col::-webkit-scrollbar {
    display: none;
  }
}
.page-kicker {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted-foreground);
}
.page-title {
  font-size: 2.25rem;
  font-weight: 900;
  line-height: 1;
}
@media (min-width: 768px) {
  .page-title {
    font-size: 3rem;
  }
}
.detail-title {
  font-size: 3.75rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}
@media (min-width: 768px) {
  .detail-title {
    font-size: 6rem;
  }
}
.preview {
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--foreground) 10%, transparent);
  aspect-ratio: 16/10;
  background: var(--muted);
  position: relative;
  margin-top: 1rem;
}
.preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.15s;
}
.preview .plabel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.25rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  color: #fff;
  font-weight: 600;
  font-size: 1.15rem;
}
.prow {
  border-bottom: 1px solid
    color-mix(in srgb, var(--foreground) 10%, transparent);
}
.prow > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0;
  text-decoration: none;
}
.prow .idx {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  color: color-mix(in srgb, var(--muted-foreground) 60%, transparent);
  width: 1.25rem;
}
.prow .pt {
  font-size: 1.25rem;
  font-weight: 700;
  transition: transform 0.2s;
}
@media (min-width: 768px) {
  .prow .pt {
    font-size: 1.5rem;
  }
}
.prow:hover .pt {
  transform: translateX(6px);
}
.prow .meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.pill {
  font-size: 0.78rem;
  border: 1px solid color-mix(in srgb, var(--foreground) 10%, transparent);
  color: var(--muted-foreground);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
}
@media (max-width: 640px) {
  .pill {
    display: none;
  }
}
.prow .arr {
  transition:
    transform 0.2s,
    color 0.2s;
  color: var(--muted-foreground);
}
.prow:hover .arr {
  transform: translateX(4px);
  color: var(--foreground);
}
.m-preview {
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--foreground) 10%, transparent);
  aspect-ratio: 16/10;
  margin-bottom: 1rem;
}
@media (min-width: 768px) {
  .m-preview {
    display: none;
  }
}

/* ---------- project detail ---------- */
.detail-hero {
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--muted);
  margin: 1.5rem 0;
}
.detail-hero img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  display: block;
}
.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.25rem 0 2rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--foreground);
  background: transparent;
  cursor: pointer;
  transition:
    opacity 0.2s,
    background-color 0.3s,
    color 0.3s;
}
.btn:hover {
  opacity: 0.85;
}
.btn.solid {
  background: var(--foreground);
  color: var(--background);
  border-color: var(--foreground);
}
.btn.accent {
  color: #fff;
  border-color: transparent;
}
.btn-pill {
  border-radius: 999px;
  padding: 0.625rem 1.5rem;
}
.detail-grid {
  display: grid;
  gap: 0.75rem;
}
@media (min-width: 768px) {
  .detail-grid.c2 {
    grid-template-columns: 1fr 1fr;
  }
  .detail-grid.c3 {
    grid-template-columns: repeat(3, 1fr);
  }
}
.d-card {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 0.75rem;
  padding: 1.25rem;
}
.d-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}
.d-card p,
.d-card li {
  color: var(--muted-foreground);
  line-height: 1.65;
  font-size: 0.98rem;
}
.sec-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted-foreground);
  margin: 2.2rem 0 1rem;
}
.prevnext {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 2rem;
  margin: 3rem 0 4rem;
}
.prevnext a {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.prevnext a span.k {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted-foreground);
}
.prevnext a.next span.k {
  justify-content: flex-end;
}
.prevnext a span.t {
  font-weight: 700;
}
.prevnext a.next {
  text-align: right;
  align-items: flex-end;
}
/* side chevrons */
.sidenav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 80%, transparent);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}
@media (min-width: 768px) {
  .sidenav {
    display: inline-flex;
  }
}
.sidenav:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}
.sidenav.prev {
  left: 0.75rem;
}
.sidenav.next {
  right: 0.75rem;
}
/* contour template: live canvas behind clean layout */
.contour-stage {
  position: relative;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 0 -1.5rem;
}
.contour-stage canvas {
  position: absolute;
  inset: 0;
}
.contour-inner {
  position: relative;
  z-index: 1;
  padding: 3rem 1.5rem;
}
/* toc minimap (mirrors reference: 1px dashes, depth widths, hover titles) */
#toc {
  position: fixed;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}
@media (min-width: 1024px) {
  #toc {
    display: flex;
  }
}
#toc a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  text-decoration: none;
}
#toc .dash {
  display: block;
  height: 1px;
  background: color-mix(in srgb, var(--foreground) 35%, transparent);
  transform-origin: right;
  transition:
    transform 0.3s,
    background-color 0.3s;
}
#toc a.active .dash {
  background: var(--foreground);
  transform: scaleX(1.6);
}
#toc .tt {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: color-mix(in srgb, var(--foreground) 70%, transparent);
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
}
#toc:hover .tt {
  opacity: 1;
}
/* tv template */
.tv {
  border-radius: 2.25rem;
  border: 12px solid #1f1e1c;
  background: #252423;
  padding: 3rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.tv::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(255, 255, 255, 0.02) 3px,
    rgba(255, 255, 255, 0.02) 5px
  );
}
.tv h1 {
  font-size: clamp(3.3rem, 10vw, 7.8rem);
  font-weight: 400;
  letter-spacing: -0.02em;
}
/* newspaper template */
.paper {
  background: #f9f7f1;
  color: #1a1a1a;
  border-radius: 0.5rem;
  padding: 2.5rem 1.5rem;
}
.paper h1 {
  font-family: "Playfair Display", serif;
  font-weight: 900;
  font-size: clamp(3rem, 9vw, 6rem);
  line-height: 0.95;
}
[data-theme="dark"] .paper {
  background: #141414;
  color: #eee;
}
/* spotlight template */
.spot {
  border-radius: 1.25rem;
  padding: 2.5rem 1.5rem;
  background:
    radial-gradient(
      600px circle at 20% 0%,
      color-mix(in srgb, var(--accent) 60%, transparent),
      transparent 60%
    ),
    var(--card);
  border: 1px solid var(--border);
}
.feat-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  margin-right: 0.35rem;
  vertical-align: 1px;
}

/* toast */
#toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--foreground);
  color: var(--background);
  padding: 0.8rem 1.4rem;
  border-radius: 0.7rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.25s,
    transform 0.25s;
  z-index: 200;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem 3rem;
  color: var(--muted-foreground);
  font-size: 0.95rem;
}
footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

/* ---------- command palette ---------- */
#pal-back {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
#pal-back.open {
  opacity: 1;
  pointer-events: auto;
}
#pal {
  position: fixed;
  inset: 0;
  z-index: 101;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 1rem 1rem;
  pointer-events: none;
}
#pal .pal-card {
  width: min(560px, 90vw);
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 95%, transparent);
  backdrop-filter: blur(24px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  pointer-events: auto;
  transform: scale(0.96);
  opacity: 0;
  transition:
    transform 0.18s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.18s;
}
#pal.open .pal-card {
  transform: none;
  opacity: 1;
}
#pal.hidden {
  display: none;
}
.pal-search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.pal-search input {
  flex: 1;
  background: none;
  border: 0;
  outline: 0;
  color: var(--foreground);
  font-size: 0.95rem;
}
.pal-list {
  max-height: 340px;
  overflow-y: auto;
  padding: 0.5rem 0;
}
.pal-sec {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: color-mix(in srgb, var(--muted-foreground) 70%, transparent);
  padding: 0.75rem 1.25rem 0.35rem;
}
.pal-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: calc(100% - 8px);
  margin: 0 4px;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 0.375rem;
  background: none;
  color: var(--foreground);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.pal-item.active,
.pal-item:hover {
  background: color-mix(in srgb, var(--muted) 80%, transparent);
}
.pal-item kbd,
.pal-foot kbd {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.1rem 0.45rem;
  color: var(--muted-foreground);
}
.pal-foot {
  display: flex;
  justify-content: space-between;
  padding: 0.65rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--muted-foreground);
}
#pal-fab {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 60;
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 80%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--muted-foreground);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  transition:
    color 0.2s,
    background-color 0.2s;
}
#pal-fab:hover {
  color: var(--foreground);
  background: color-mix(in srgb, var(--muted) 80%, transparent);
}
@media (max-width: 767px) {
  #pal-fab {
    display: none;
  }
}

/* ---------- resume ---------- */
.resume-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 0;
  margin-top: 1rem;
}
@media (min-width: 768px) {
  .resume-top {
    margin-top: 0;
  }
}
.resume-top h1 {
  font-size: 1.875rem;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1;
}
@media (min-width: 768px) {
  .resume-top h1 {
    font-size: 3rem;
  }
}
.resume-top .btn {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
}
.resume-card {
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--card);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 3rem;
}
.resume-card img {
  width: 100%;
  display: block;
}
#lightrays {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
  overflow: hidden;
}
#lightrays::before,
#lightrays::after {
  content: "";
  position: absolute;
  top: -20%;
  width: 40vw;
  height: 140%;
  filter: blur(60px);
  opacity: 0.35;
  transform: rotate(18deg);
}
#lightrays::before {
  left: 5%;
  background: linear-gradient(var(--foreground), transparent);
}
#lightrays::after {
  right: 5%;
  background: linear-gradient(transparent, var(--foreground));
}
[data-theme="dark"] #lightrays::before,
[data-theme="dark"] #lightrays::after {
  opacity: 0.18;
}

/* ---------- grid bg (unused while the space starfield is the backdrop) ---------- */
.gridbg {
  display: none;
}

/* ---------- 404 ---------- */
.nf {
  min-height: 100vh;
  background: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  text-align: center;
}
.nf h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.nf p {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}
.nf a {
  text-decoration: underline;
}

/* ---------- utilities ---------- */
.muted {
  color: var(--muted-foreground);
}
.mono {
  font-family: "JetBrains Mono", monospace;
}
.center {
  text-align: center;
}
.mt2 {
  margin-top: 0.5rem;
}
.mt4 {
  margin-top: 1rem;
}
.mt8 {
  margin-top: 2rem;
}
.mt12 {
  margin-top: 3rem;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  color: var(--muted-foreground);
  text-decoration: none;
  margin: 1rem 0;
}
.back-link:hover {
  color: var(--foreground);
}

/* ---------- responsive ---------- */
@media (max-width: 767px) {
  .hero {
    padding-top: 70px;
  }
  .hero-name {
    font-size: 3rem;
  }
  .prevnext {
    grid-template-columns: 1fr;
  }
  .detail-grid.c2,
  .detail-grid.c3 {
    grid-template-columns: 1fr;
  }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html {
    scroll-behavior: auto;
  }
  .rv,
  .rv-x-l,
  .rv-x-r,
  .rv-o {
    opacity: 1;
    transform: none;
  }
}
