/* =================================================================
   ALAN CAI — PORTFOLIO · ENIGMA cipher-minimal design system
   ================================================================= */

/* ---------------------------------------------------------- TOKENS */
:root {
  --bg: #efefef;
  --dark: #1c1c1c;
  --text: #1a1a1a;
  --white: #ffffff;
  --secondary: #8a8a8a;
  --border: #cccccc;
  --muted: #6b6b6b;

  --nav-h: 64px;
  --maxw: 1200px;
  --pad: clamp(20px, 5vw, 64px);
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --hero-font: "Share Tech Mono", var(--mono);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------------------------------------------------------- RESET */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

html,
body {
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { list-style: none; padding: 0; }
img { display: block; max-width: 100%; }

::selection { background: var(--text); color: var(--bg); }
::-moz-selection { background: var(--text); color: var(--bg); }

/* Scroll progress hairline — sits under the nav chrome so it stays
   visible on the page field; stack is above content, below nav. */
.scroll-progress {
  position: fixed;
  top: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  left: 0;
  width: 100%;
  height: 1px;
  z-index: 99; /* above content (3), below nav (100) */
  pointer-events: none;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
  .scroll-progress { transform: scaleX(1); will-change: auto; }
}

/* Keyboard focus — replace default; never remove */
a:focus-visible,
button:focus-visible,
.nav-toggle:focus-visible,
.proj-live:focus-visible,
.social-dot:focus-visible,
.contact-link:focus-visible,
.skill-card-link:focus-visible,
.hero-cta:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 3px;
}

/* =================================================================
   CUSTOM CURSOR — circle reticle, monochrome
   A hollow circle that lags toward the pointer + a solid dot that
   tracks 1:1. mix-blend-mode:difference auto-inverts it (dark on the
   light page, light over the dark nav). The circle expands over
   interactive elements; the dot stays put.
   ================================================================= */
.cursor-on,
.cursor-on body { cursor: none; }
.cursor-on a,
.cursor-on button,
.cursor-on [data-link],
.cursor-on .proj-live,
.cursor-on .social { cursor: none; }

.cursor-cell,
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  pointer-events: none;
  mix-blend-mode: difference;
  will-change: transform;
}
.cursor-cell {
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 1px solid #fff;
  border-radius: 50%;
  transition: width 0.22s cubic-bezier(0.2,0.8,0.2,1),
              height 0.22s cubic-bezier(0.2,0.8,0.2,1),
              margin 0.22s cubic-bezier(0.2,0.8,0.2,1),
              opacity 0.22s ease;
}
.cursor-dot {
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  background: #fff;
  border-radius: 50%;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
/* hover over interactive els: circle expands, dot stays */
.cursor-on.cursor-hot .cursor-cell {
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
}
/* mouse pressed: quick squeeze */
.cursor-on.cursor-down .cursor-cell {
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

.tk { display: inline-block; }

/* =================================================================
   NAV
   ================================================================= */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--dark);
  color: var(--bg);
  z-index: 100;
}
/* soft radial shadow under nav */
.nav::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 22px;
  background: radial-gradient(60% 100% at 50% 0%, rgba(28,28,28,0.20), rgba(28,28,28,0));
  filter: blur(8px);
  pointer-events: none;
}

.nav-inner {
  height: var(--nav-h);
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.wordmark {
  font-family: "Ma Shan Zheng", cursive;
  font-size: 30px;
  line-height: 1;
  color: var(--bg);
  letter-spacing: 0.04em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 30px;
}
.nav-links a {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--bg);
  opacity: 0.72;
  position: relative;
  display: inline-flex;
  align-items: center;
  transition: opacity 0.25s var(--ease);
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -7px;
  height: 1.5px;
  background: var(--white);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.28s var(--ease);
}
.nav-links a:hover { opacity: 1; }
.nav-links a:hover::after { transform: scaleX(1); }

/* mobile toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  background: none;
  border: 1px solid rgba(239,239,239,0.28);
  cursor: pointer;
  padding: 0 9px;
}
.nav-toggle-bar {
  display: block;
  height: 1.5px;
  width: 100%;
  background: var(--bg);
  transition: transform 0.3s var(--ease), opacity 0.2s var(--ease);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(3.25px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { transform: translateY(-3.25px) rotate(-45deg); }

.nav-mobile {
  position: absolute;
  top: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  background: var(--dark);
  border-top: 1px solid rgba(239,239,239,0.12);
  display: flex;
  flex-direction: column;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease);
}
.nav-mobile.open { max-height: 320px; }
.nav-mobile a {
  padding: 18px var(--pad);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--bg);
  border-bottom: 1px solid rgba(239,239,239,0.08);
  display: flex;
  gap: 10px;
  align-items: baseline;
}

/* =================================================================
   HERO  (pinned scroll-zoom)
   ================================================================= */
main { position: relative; z-index: 3; }

.hero-scroll {
  position: relative;
  scroll-margin-top: 0;
  /* tall scroll runway is created by JS (ScrollTrigger pin); base height = viewport */
}

.hero-pin {
  position: relative;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg);
}

.hero-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-content {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + 12px) var(--pad) max(24px, env(safe-area-inset-bottom));
}

.hero-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin-bottom: clamp(18px, 3vh, 34px);
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--secondary);
}
.hero-meta-line { white-space: nowrap; }

/* the element that scales during scroll */
.hero-title-zoom {
  position: relative;
  transform-origin: 50% 50%;
  max-width: 100%;
  /* deliberately NO will-change/translateZ here: keeping the layer
     un-promoted lets the browser re-rasterise the vector glyphs at every
     zoom scale, so ALAN CAI stays razor sharp instead of going blurry. */
}

/* zoom origin reference — an INVISIBLE 1px marker pinned to the bottom
   base of the N's right leg. It draws nothing; it only gives the zoom a
   precise transform-origin. The viewport floods black using the LEG'S
   OWN INK as the title scales up around this point. */
.portal-anchor {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  background: transparent;
  opacity: 0;
  pointer-events: none;
}
.title-n {
  /* part of the ALAN wordmark — inline so it never disturbs kerning;
     it only exists as a precise measure point for the zoom target */
}

.hero-title {
  font-family: var(--hero-font);
  font-weight: 400;
  font-size: clamp(64px, 18vw, 220px);
  line-height: 0.92;
  letter-spacing: 0;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  max-width: 100%;
  white-space: nowrap;
  user-select: none;
}
/* gibberish during the scramble shows grey; locked letters are --text (black) */
.scramble-dim { color: var(--secondary); }
.title-word {
  letter-spacing: -0.05em;
  display: inline-block;
}
/* the portal — JS zooms THROUGH this gap */
.portal-gap {
  display: inline-block;
  width: 0.14em;
  height: 1em;
  background: var(--bg);
  flex: 0 0 auto;
}

.hero-tagline {
  margin-top: clamp(22px, 4vh, 40px);
  font-size: clamp(14px, 1.4vw, 18px);
  letter-spacing: 0.02em;
  color: var(--muted);
  min-height: 1.6em;
}
.tag-prefix { color: var(--muted); }
.tag-phrase { color: var(--text); font-weight: 500; }
.tag-cursor {
  display: inline-block;
  margin-left: 1px;
  color: var(--text);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-actions {
  margin-top: clamp(26px, 5vh, 48px);
  display: flex;
  align-items: center;
  gap: clamp(20px, 4vw, 40px);
  flex-wrap: wrap;
  justify-content: center;
}

.hero-social {
  display: flex;
  align-items: center;
  gap: 12px;
}
.social-dot {
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.28s var(--ease), color 0.28s var(--ease), border-color 0.28s var(--ease), transform 0.28s var(--ease);
}
.social-icon { display: block; }
.social-dot:hover {
  background: var(--dark);
  color: var(--bg);
  border-color: var(--dark);
  transform: translateY(-2px);
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: var(--dark);
  color: var(--bg);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  border: 1px solid var(--dark);
  border-radius: 999px;
  transition: background 0.28s var(--ease), color 0.28s var(--ease);
}
.hero-cta .tk { transition: transform 0.28s var(--ease); }
.hero-cta:hover { background: transparent; color: var(--text); }
.hero-cta:hover .tk { transform: translateX(5px); }

/* scroll hint */
.hero-scrollhint {
  position: absolute;
  bottom: max(26px, env(safe-area-inset-bottom, 0px) + 12px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  letter-spacing: 0.26em;
  color: var(--secondary);
  transition: opacity 0.4s var(--ease);
}
.hint-rail {
  width: 1px;
  height: 38px;
  background: var(--border);
  position: relative;
  overflow: hidden;
}
.hint-dot {
  position: absolute;
  top: 0;
  left: -1.5px;
  width: 4px;
  height: 8px;
  background: var(--dark);
  animation: railDrop 1.8s var(--ease) infinite;
}
@keyframes railDrop {
  0% { transform: translateY(-10px); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: translateY(40px); opacity: 0; }
}

/* =================================================================
   HERO DRAGON STAGE  (black phase between N zoom and About)
   Absolute black plane for Three.js canvas / DOM seal fallback.
   ================================================================= */
.dragon-stage {
  position: absolute;
  inset: 0;
  z-index: 10; /* above zoomed title, below nav (z 100) */
  background: var(--text); /* matches flooded glyph ink (--text), not #111 */
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

/* =================================================================
   SECTIONS (shared)
   ================================================================= */
.section {
  position: relative;
  background: var(--bg);
  padding: clamp(80px, 12vh, 140px) 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + 8px);
}
#about {
  border-top: none;
  padding-bottom: clamp(28px, 4vh, 40px);
}
#projects {
  border-top: none;
  padding-top: clamp(28px, 4vh, 40px);
  padding-bottom: clamp(28px, 4vh, 40px);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: clamp(40px, 7vh, 72px);
  position: relative;
}
.section-index {
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--secondary);
  padding-top: 6px;
}
.section-title {
  font-size: clamp(20px, 2.6vw, 30px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--border);
  padding: 12px 20px;
  position: relative;
  white-space: nowrap;
}
/* soft shadow under section header box */
.section-head::after {
  content: "";
  position: absolute;
  left: 31px;
  bottom: -14px;
  width: min(340px, 70%);
  height: 18px;
  background: radial-gradient(60% 100% at 50% 0%, rgba(28,28,28,0.12), rgba(28,28,28,0));
  filter: blur(8px);
  pointer-events: none;
}

/* =================================================================
   ABOUT
   ================================================================= */
.about-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  grid-template-rows: auto auto;
  column-gap: clamp(36px, 6vw, 72px);
  row-gap: 0;
  align-items: stretch;
}
.about-heading {
  grid-column: 1;
  grid-row: 1;
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text);
  margin: 0;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.about-side-title {
  grid-column: 2;
  grid-row: 1;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--secondary);
  margin: 0;
  padding-top: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  align-self: start;
}
.about-side-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.about-main {
  grid-column: 1;
  grid-row: 2;
  margin-top: 24px;
}
.about-side {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.about-timeline-viewport {
  overflow: hidden;
  max-height: min(560px, calc(100vh - var(--nav-h) - 160px));
  flex: 1;
  padding-left: 12px;
}
.about-timeline-track {
  display: flex;
  flex-direction: column;
  gap: 28px;
  will-change: transform;
}
.about-body {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
  text-wrap: pretty;
  text-align: left;
}
.about-body + .about-body { margin-top: 18px; }
.about-impact-row {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.about-main .about-impact {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  max-width: fit-content;
}
.about-impact {
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  padding: 14px 18px;
  border-radius: 10px;
}
.impact-num {
  font-family: var(--hero-font);
  font-size: clamp(22px, 2.8vw, 30px);
  line-height: 1;
  letter-spacing: -0.02em;
}
.impact-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--secondary);
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: 40px;
  border: 1px solid var(--border);
  background: var(--white);
}
.stat-box {
  padding: 22px 20px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-box:last-child { border-right: none; }
.stat-num {
  font-family: var(--hero-font);
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1;
  color: var(--text);
}
.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--secondary);
}

/* right column — layout defined in ABOUT grid above */
.about-photo {
  position: relative;
  aspect-ratio: 4 / 5;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 9px, rgba(28,28,28,0.05) 9px, rgba(28,28,28,0.05) 10px),
    var(--white);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--secondary);
}
.photo-tag {
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.photo-sub {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.about-timeline {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
}
.about-timeline-item {
  position: relative;
  padding: 0 0 30px 24px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.about-timeline-item:last-child { padding-bottom: 0; }
.about-timeline-item::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 1.45em;
  width: 8px;
  height: 8px;
  background: var(--bg);
  border: 1.5px solid var(--dark);
  border-radius: 50%;
  box-sizing: border-box;
  z-index: 1;
}
.tl-year {
  font-size: 12px;
  letter-spacing: 0.14em;
  line-height: 1.4;
  color: var(--secondary);
}
.tl-role {
  font-size: clamp(18px, 1.6vw, 21px);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}
.tl-org {
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
}
.tl-desc {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
  text-wrap: pretty;
  max-width: 46ch;
}

/* =================================================================
   PROJECTS
   ================================================================= */
.projects-heading {
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text);
  margin: 0 0 clamp(36px, 6vh, 56px);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.projects-catalog {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, 1fr);
  grid-auto-flow: column;
  gap: clamp(18px, 2.5vw, 28px);
  align-items: stretch;
}

.proj-card {
  background: var(--white);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 18px 42px rgba(28, 28, 28, 0.06);
}

.proj-card.reveal {
  transition: opacity 0.7s var(--ease), transform 0.32s var(--ease), box-shadow 0.32s var(--ease), border-color 0.32s var(--ease);
}

.proj-card.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

.proj-card.reveal.in:hover {
  transform: translateY(-4px);
  border-color: #1c1c1c;
  box-shadow: 0 24px 52px rgba(28, 28, 28, 0.1);
}

@media (hover: none) {
  .proj-card.reveal.in:hover {
    transform: translateY(0);
    border-color: var(--border);
    box-shadow: 0 18px 42px rgba(28, 28, 28, 0.06);
  }
  .social-dot:hover,
  .hero-cta:hover,
  .skill-card-link:hover,
  .contact-link:hover,
  .proj-card a.proj-live:hover {
    transform: none;
    background: var(--white);
    color: var(--text);
    border-color: var(--border);
  }
  .hero-cta:hover { background: var(--dark); color: var(--bg); }
  .proj-card a.proj-live:hover { background: #ffffff; color: #1c1c1c; border-color: #1c1c1c; }
  .contact-link:hover { background: transparent; color: inherit; }
  .skill-card-link:hover { background: var(--white); border-color: var(--border); }
  .skill-card-link:hover .skill-name { color: var(--muted); }
}

.proj-body {
  padding: 20px 22px 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 14px;
  min-height: 0;
}

.proj-cover {
  aspect-ratio: 333 / 210;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 9px, rgba(28,28,28,0.05) 9px, rgba(28,28,28,0.05) 10px),
    #f7f7f7;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
}

.proj-cover-slot {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
}

.proj-cover--logo {
  background: #ffffff;
  aspect-ratio: 333 / 210;
  padding: clamp(16px, 3vw, 24px) 0;
  display: flex;
  align-items: center;
}

.proj-cover--logo .proj-cover-slot {
  flex: 1;
  min-height: 0;
  width: 100%;
}

.proj-cover--logo + .proj-desc-wrap {
  margin-top: 0;
}

.proj-cover--wordmark {
  justify-content: center;
}

.proj-wordmark {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(26px, 4.2vw, 36px);
  letter-spacing: -0.03em;
  line-height: 1;
  color: #000000;
  user-select: none;
}

.proj-wordmark-dot {
  color: #a8aaff;
}

.proj-cover--photo {
  background: #ffffff;
  aspect-ratio: 273 / 312;
  padding: clamp(16px, 3vw, 24px) 0;
  display: flex;
  align-items: center;
}

.proj-cover--photo .proj-cover-slot {
  flex: 1;
  min-height: 0;
  width: 100%;
}

.proj-cover--photo + .proj-desc-wrap {
  margin-top: 1lh;
}

.proj-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  min-height: 4.75em;
}

.proj-body > h4 {
  font-family: var(--hero-font);
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--text);
}

.proj-header .proj-title {
  margin: 0;
  line-height: 1;
  font-family: var(--hero-font);
  font-size: clamp(15px, 1.5vw, 18px);
  letter-spacing: -0.01em;
  color: var(--text);
}

.proj-header .proj-subtitle {
  margin: 0;
}

.proj-subtitle {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--secondary);
  margin: 6px 0 0;
}

.proj-desc-wrap .proj-desc {
  margin: 0;
}

.proj-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  text-wrap: pretty;
}

.proj-desc-wrap.is-collapsed {
  position: relative;
  height: 5.1em;
  max-height: 5.1em;
  overflow: hidden;
  flex-shrink: 0;
}

.proj-desc-wrap.is-collapsed::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.2em;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--white));
  pointer-events: none;
}

.proj-toggle {
  align-self: flex-start;
  margin: -2px 0 0;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--white);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1;
  color: var(--secondary);
  cursor: pointer;
  transition: color 0.28s var(--ease), border-color 0.28s var(--ease), background 0.28s var(--ease);
}

.proj-toggle-icon {
  display: block;
  transform: translateY(-1px);
  transition: transform 0.28s var(--ease);
}

.proj-toggle[aria-expanded="true"] .proj-toggle-icon {
  transform: translateY(-1px) rotate(180deg);
}

.proj-toggle:hover,
.proj-toggle:focus-visible {
  color: var(--dark);
  border-color: var(--dark);
}

.proj-cover--static {
  justify-content: center;
}

.proj-cover-img {
  display: block;
  max-width: 72%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.proj-stack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: auto;
  min-height: 46px;
}

.proj-stack img {
  width: 22px;
  height: 22px;
  opacity: 0.92;
}

.proj-card a.proj-live {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  margin-top: 0;
  min-height: 38px;
  padding: 10px 18px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  background: #ffffff;
  color: #1c1c1c;
  border: 1px solid #1c1c1c;
  border-radius: 999px;
  transition: background 0.28s var(--ease), color 0.28s var(--ease), border-color 0.28s var(--ease);
}

.proj-card a.proj-live:hover {
  background: #1c1c1c;
  color: #ffffff;
  border-color: #1c1c1c;
}

/* =================================================================
   SKILLS
   ================================================================= */
.skills-heading {
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text);
  margin: 0 0 clamp(28px, 4vh, 40px);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

#skills {
  border-top: none;
  padding-top: clamp(28px, 4vh, 40px);
  padding-bottom: clamp(28px, 4vh, 40px);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(16px, 2.5vw, 28px);
}

.skill-col-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--secondary);
  margin: 0 0 14px;
}

.skill-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.skill-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 88px;
}

.skill-card-link {
  text-decoration: none;
  color: inherit;
  transition: background 0.28s var(--ease), border-color 0.28s var(--ease), color 0.28s var(--ease);
}

.skill-card-link:hover {
  background: var(--dark);
  border-color: var(--dark);
}

.skill-card-link:hover .skill-name {
  color: var(--bg);
}

.skill-card-link:hover .skill-icon img[src*="nextdotjs"],
.skill-card-link:hover .skill-icon img[src*="cursor"] {
  filter: invert(1);
}

.skill-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.skill-icon img,
.skill-icon svg {
  display: block;
  width: 24px;
  height: 24px;
}

.skill-name {
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted);
  line-height: 1.2;
  text-align: center;
}

/* =================================================================
   CONTACT
   ================================================================= */
.section-contact {
  border-top: none;
  padding-top: clamp(28px, 4vh, 40px);
  padding-bottom: clamp(48px, 8vh, 80px);
}

.contact-block {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  column-gap: clamp(32px, 5vw, 64px);
  align-items: start;
}

.contact-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.contact-label-spacer {
  font-size: 11px;
  letter-spacing: 0.22em;
  line-height: 1.2;
  padding-top: 0.35em;
  visibility: hidden;
  user-select: none;
  pointer-events: none;
}

.contact-lead {
  margin: 22px 0 0;
  font-family: var(--mono);
  font-size: clamp(28px, 3.2vw, 38px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.04em;
  color: var(--text);
  white-space: nowrap;
}

.contact-reach-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--secondary);
  margin: 0;
  padding-top: 0.35em;
  line-height: 1.2;
}

.contact-intro {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
  text-wrap: pretty;
  margin: 0;
  max-width: none;
}

.contact-links {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  min-width: 0;
}
.contact-link {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  transition: background 0.26s var(--ease), color 0.26s var(--ease);
}
.contact-link:last-child { border-bottom: none; }
.contact-link:hover { background: var(--dark); color: var(--white); }
.cl-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: color 0.26s var(--ease);
}
.contact-link:hover .cl-icon { color: var(--white); }
.cl-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.cl-key {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--secondary);
}
.cl-val {
  font-size: 14px;
  color: inherit;
  overflow-wrap: anywhere;
}
.contact-link .tk {
  color: var(--secondary);
  transition: transform 0.26s var(--ease), color 0.26s var(--ease);
}
.contact-link:hover .tk { transform: translateX(5px); color: var(--white); }

.site-footer {
  background: var(--dark);
  color: var(--bg);
  padding: 20px var(--pad);
}

.site-footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--secondary);
}

/* =================================================================
   REVEAL
   ================================================================= */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.18s; }
.reveal[data-delay="3"] { transition-delay: 0.28s; }

/* About is hidden until hero scroll fades it in */
#about { opacity: 0; transition: opacity 0.6s var(--ease); }
#about.about-visible { opacity: 1; }

/* =================================================================
   RESPONSIVE
   ================================================================= */
@media (max-width: 1000px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-heading { grid-column: 1; grid-row: 1; }
  .about-side-title { grid-column: 1; grid-row: 2; }
  .about-main { grid-column: 1; grid-row: 3; }
  .about-side { grid-column: 1; grid-row: 4; max-width: 520px; }
  .about-timeline-viewport { overflow: visible; max-height: none; }
  .about-timeline-track { will-change: auto; transform: none !important; }
  .projects-catalog {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-flow: row;
  }
  .skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  :root { --pad: clamp(16px, 4.5vw, 28px); }

  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .wordmark { font-size: 26px; }
  .projects-catalog {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-flow: row;
  }
  .skills-grid { grid-template-columns: 1fr; }
  .skill-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about-stats { grid-template-columns: 1fr; }
  .stat-box { border-right: none; border-bottom: 1px solid var(--border); }
  .stat-box:last-child { border-bottom: none; }
  .hero-meta { font-size: 10px; }
  .contact-block { grid-template-columns: 1fr; row-gap: 28px; }
  .contact-label-spacer { display: none; }
  .contact-lead {
    margin-top: 0;
    white-space: normal;
    font-size: clamp(24px, 7.5vw, 32px);
  }
  .contact-link { grid-template-columns: 24px 1fr auto; gap: 16px; padding: 18px; }
  .hero-title { font-size: clamp(38px, 13.5vw, 72px); }
  .hero-tagline {
    font-size: clamp(13px, 3.8vw, 16px);
    max-width: 28ch;
    margin-top: clamp(16px, 3vh, 28px);
  }
  .hero-actions {
    margin-top: clamp(20px, 4vh, 36px);
    gap: 16px;
  }
  .hero-cta {
    min-height: 44px;
    padding: 12px 22px;
  }
  .social-dot {
    width: 44px;
    height: 44px;
  }
  .section { padding: clamp(56px, 10vh, 96px) 0; }
  .section-head { flex-wrap: wrap; gap: 12px; margin-bottom: clamp(28px, 5vh, 48px); }
  .section-title { white-space: normal; font-size: clamp(17px, 4.5vw, 22px); padding: 10px 16px; }
  .about-heading,
  .projects-heading,
  .skills-heading { font-size: clamp(20px, 5.5vw, 26px); }
  .about-impact-row { flex-direction: column; }
  .about-main .about-impact { max-width: 100%; width: 100%; }
  .impact-label { font-size: 8px; letter-spacing: 0.12em; }
  .proj-body { padding: 18px 18px 22px; }
  .site-footer { padding-bottom: max(20px, env(safe-area-inset-bottom, 0px) + 12px); }
}

@media (max-width: 480px) {
  .nav-toggle {
    width: 44px;
    height: 44px;
  }
  .hero-title { font-size: clamp(34px, 12.5vw, 56px); }
  .hero-scrollhint { display: none; }
  .skill-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .skill-card { min-height: 80px; padding: 12px 8px 10px; }
  .contact-link { padding: 16px; gap: 14px; }
}

/* =================================================================
   REDUCED MOTION
   ================================================================= */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
  .tag-cursor { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  #about { opacity: 1; }
  .hero-scrollhint { display: none; }
}
