/* =========================================================
   Portfolio styles
   Colors live in the :root variables below — change them
   there and the whole site (light + dark) updates.
   ========================================================= */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --border: rgba(0, 0, 0, 0.1);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --chip-bg: #f0f0f3;
  --nav-bg: rgba(255, 255, 255, 0.72);
  --nav-border: rgba(0, 0, 0, 0.08);
  --dropdown-bg: rgba(255, 255, 255, 0.94);
  --brand: #0f8f7e;
  --grad-text: linear-gradient(90deg, #0f9f8a, #2563eb);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.04), 0 18px 40px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.05), 0 28px 60px rgba(0, 0, 0, 0.14);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --radius: 28px;
  --radius-sm: 14px;
  --maxw: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --nav-h: 64px;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-alt: #0f0f11;
    --surface: #1c1c1e;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #86868b;
    --border: rgba(255, 255, 255, 0.14);
    --accent: #2997ff;
    --accent-hover: #47a6ff;
    --chip-bg: #2c2c2e;
    --nav-bg: rgba(22, 22, 23, 0.72);
    --nav-border: rgba(255, 255, 255, 0.08);
    --dropdown-bg: rgba(30, 30, 32, 0.94);
    --brand: #5eead4;
    --grad-text: linear-gradient(90deg, #5eead4, #7cc4ff 55%, #9db8ff);
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 18px 40px rgba(0, 0, 0, 0.45);
    --shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.35), 0 28px 60px rgba(0, 0, 0, 0.6);
  }
}

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}


img, video { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

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

.container { width: min(var(--maxw), 100% - 2 * var(--gutter)); margin-inline: auto; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 200;
  background: var(--accent); color: #fff; padding: 0.6rem 1rem; border-radius: 10px;
}
.skip-link:focus { top: 1rem; }

/* Elements GSAP will animate start hidden (only when motion is allowed). */
.motion [data-reveal],
.motion [data-hero],
.motion [data-lines],
.motion .hero-portrait img,
.motion .hero-scan { opacity: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  padding: 0.75em 1.35em;
  border-radius: 980px;
  border: 1px solid transparent;
  font: inherit; font-size: 1rem; font-weight: 500; line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { color: var(--accent); border-color: var(--accent); }
.btn-secondary:hover { background: var(--accent); color: #fff; }
.btn-light { color: #fff; border-color: rgba(255, 255, 255, 0.6); background: rgba(255, 255, 255, 0.08); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.btn-light:hover { background: rgba(255, 255, 255, 0.2); }
.btn-lg { font-size: 1.1rem; padding: 0.9em 1.7em; }
.btn-block { width: 100%; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--nav-border);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .nav { background: var(--bg); }
}

/* While the dark hero is behind it, the nav uses dark colors in both themes */
.nav.on-dark {
  --nav-bg: rgba(13, 17, 23, 0.72);
  --nav-border: rgba(255, 255, 255, 0.08);
  --bg: #0d1117;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: rgba(245, 245, 247, 0.45);
  --brand: #5eead4;
  --chip-bg: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.12);
  --accent: #2997ff;
  --dropdown-bg: rgba(30, 32, 38, 0.94);
  transition: background-color 0.3s var(--ease);
}

.nav-inner {
  height: 100%;
  width: min(var(--maxw), 100% - 2 * var(--gutter));
  margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between;
}

.nav-logo { display: flex; align-items: center; gap: 0.75rem; color: var(--text); }
.nav-logo:hover { text-decoration: none; opacity: 0.85; }
.logo-badge {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 11px;
  border: 1px solid color-mix(in srgb, var(--brand) 55%, transparent);
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand);
  font-size: 0.85rem; font-weight: 800; letter-spacing: -0.02em;
}
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-text strong { font-size: 0.92rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.logo-text small {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-3);
}
.nav-links a.nav-cta {
  margin-left: 0.5rem; padding: 0.55rem 1.05rem;
  border: 1px solid color-mix(in srgb, var(--brand) 60%, transparent);
  border-radius: 12px;
  color: var(--brand); font-weight: 600;
}
.nav-links a.nav-cta:hover, .nav-links a.nav-cta.is-active { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }

.nav-links { display: flex; align-items: center; gap: 0.25rem; }
.nav-links a {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  color: var(--text-2);
  font-size: 0.875rem; font-weight: 500;
  border-radius: 980px;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.is-active { color: var(--text); background: var(--chip-bg); }
.nav-icon svg { width: 18px; height: 18px; }
.nav-icon-label { display: none; }

/* Projects dropdown — desktop: opens on hover / keyboard focus. Phone menu: shown as a sub-list. */
.has-dropdown { position: relative; }
.nav-caret { width: 10px; height: 10px; margin-left: -0.1rem; transition: transform 0.25s var(--ease); }
.dropdown {
  position: absolute; top: 100%; left: 50%;
  width: 380px; padding-top: 10px;
  transform: translate(-50%, -6px);
  opacity: 0; visibility: hidden;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
}
.dropdown-panel {
  padding: 0.5rem;
  background: var(--dropdown-bg);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--nav-border);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}
.dropdown-list:empty { display: none; }
.nav-links .dropdown a {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.55rem; border-radius: 12px;
  color: var(--text); font-size: 0.875rem;
}
.nav-links .dropdown a:hover, .nav-links .dropdown a:focus-visible { background: var(--chip-bg); }
.dropdown img { width: 64px; height: 44px; flex: none; border-radius: 8px; object-fit: cover; }
.dd-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.dd-text strong { font-weight: 600; line-height: 1.3; }
.dd-text small { font-size: 0.75rem; color: var(--text-2); }
.nav-links .dropdown .dropdown-all {
  justify-content: space-between;
  margin-top: 0.25rem; padding: 0.7rem 0.75rem;
  border-top: 1px solid var(--border); border-radius: 0 0 12px 12px;
  color: var(--accent); font-weight: 600;
}
@media (min-width: 721px) {
  .has-dropdown:focus-within .dropdown { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
  .has-dropdown:focus-within .nav-caret { transform: rotate(180deg); }
}
@media (hover: hover) and (min-width: 721px) {
  .has-dropdown:hover .dropdown { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
  .has-dropdown:hover .nav-caret { transform: rotate(180deg); }
}

.nav-toggle {
  display: none;
  width: 44px; height: 44px; margin-right: -10px;
  background: none; border: 0; cursor: pointer; color: var(--text);
  position: relative;
}
.nav-toggle span {
  position: absolute; left: 13px; right: 13px; height: 1.5px; background: currentColor; border-radius: 2px;
  transition: transform 0.3s var(--ease), top 0.3s var(--ease);
}
.nav-toggle span:first-child { top: 18px; }
.nav-toggle span:last-child { top: 25px; }
.nav-open .nav-toggle span:first-child { top: 21.5px; transform: rotate(45deg); }
.nav-open .nav-toggle span:last-child { top: 21.5px; transform: rotate(-45deg); }

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 0.5rem var(--gutter) 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--nav-border);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0.25s;
  }
  .nav-open .nav-links { opacity: 1; visibility: visible; transform: none; }
  .nav-links a {
    display: flex;
    padding: 0.9rem 0.25rem; font-size: 1.35rem; font-weight: 600; color: var(--text);
    border-radius: 0; border-bottom: 1px solid var(--border);
  }
  .nav-links a.is-active { background: none; color: var(--accent); }
  .nav-icon svg { width: 22px; height: 22px; }
  .nav-icon-label { display: inline; }
  .nav-links { max-height: calc(100dvh - var(--nav-h)); overflow-y: auto; }
  .nav-caret { display: none; }
  .dropdown { position: static; width: auto; padding: 0; transform: none; opacity: 1; visibility: visible; }
  .dropdown-panel { padding: 0.25rem 0 0.5rem; background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .nav-links .dropdown a { padding: 0.5rem 0.25rem 0.5rem 0.75rem; font-size: 1rem; font-weight: 500; border-bottom: 0; }
  .dropdown img { width: 52px; height: 36px; }
  .nav-links .dropdown .dropdown-all { display: none; }
  .nav-links a.nav-cta { justify-content: center; margin: 1.25rem 0 0; padding: 0.85rem; font-size: 1.1rem; border-bottom: 1px solid color-mix(in srgb, var(--brand) 60%, transparent); }
}

/* ---------- Hero ----------
   Always dark, whatever the system theme. Text on the left; the cut-out portrait
   stands at the bottom right, with a live LiDAR-style scan (canvas) behind it. */
.hero {
  --teal: #5eead4;
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse 45% 60% at 72% 55%, rgba(94, 234, 212, 0.07), transparent 70%),
    radial-gradient(ellipse 80% 50% at 50% 110%, rgba(124, 196, 255, 0.06), transparent 70%),
    #0d1117;
  color: #f5f5f7;
  isolation: isolate;
}

.hero-content {
  position: relative; z-index: 2;
  width: min(var(--maxw), 100% - 2 * var(--gutter));
  margin-inline: auto;
  padding: calc(var(--nav-h) + 3rem) 0 4rem;
}
.hero-content > * { max-width: min(600px, 50%); }
.hero-content > .hero-title { max-width: min(760px, 56%); }

/* Shared by the home hero and the dark page headers */
.hero-eyebrow {
  display: flex; align-items: center; gap: 0.75rem;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: clamp(0.72rem, 1vw, 0.85rem);
  font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: #5eead4;
  margin-bottom: 1.4rem;
}
.eyebrow-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: #5eead4;
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.15), 0 0 14px rgba(94, 234, 212, 0.7);
  animation: dot-pulse 2.4s ease-in-out infinite;
}
@keyframes dot-pulse { 50% { box-shadow: 0 0 0 7px rgba(94, 234, 212, 0.05), 0 0 18px rgba(94, 234, 212, 0.9); } }
.hero-rule {
  display: block;
  width: 64px; height: 3px;
  background: #5eead4;
  border-radius: 2px;
  margin-bottom: 1.75rem;
  transform-origin: left center;
}

.hero-title {
  font-size: clamp(2.5rem, 4.6vw, 4.6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.04;
}
.title-line { display: block; }
.grad {
  font-style: normal;
  background: linear-gradient(90deg, #5eead4, #7cc4ff 55%, #9db8ff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero-tagline {
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  font-weight: 400; line-height: 1.65;
  color: rgba(245, 245, 247, 0.72);
  margin: 1.75rem 0 2.25rem;
}
.hero-tagline strong { color: #fff; font-weight: 700; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero .btn-primary { background: var(--teal); color: #05241f; font-weight: 600; }
.hero .btn-primary:hover { background: #8ff3e1; }

.hero-portrait {
  position: absolute; z-index: 1;
  bottom: 0; left: 72%;
  height: min(86%, 940px);
  aspect-ratio: 1086 / 1320;
  transform: translateX(-50%);
  pointer-events: none;
}
.hero-portrait img {
  position: relative;
  width: 100%; height: 100%;
  object-fit: contain; object-position: bottom center;
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.5));
  will-change: transform;
}
.hero-visual {
  position: absolute; z-index: -1;
  left: 50%; top: 40%;
  width: 165%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
}
.hero-scan { display: block; width: 100%; height: 100%; }
.hero-fig {
  position: absolute; top: 16%; left: 50%; transform: translateX(-50%);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.68rem; letter-spacing: 0.28em; text-transform: uppercase; white-space: nowrap;
  color: rgba(245, 245, 247, 0.28);
}
.hero-vertical {
  position: absolute; z-index: 2;
  right: clamp(12px, 2vw, 28px); top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.35em; text-transform: uppercase;
  color: rgba(245, 245, 247, 0.3);
}
@media (max-width: 1100px) { .hero-vertical { display: none; } }

/* Phones & small tablets: text on top, portrait below it */
@media (max-width: 820px) {
  .hero { flex-direction: column; align-items: stretch; }
  .hero-content { padding: calc(var(--nav-h) + 2rem) 0 1.5rem; }
  .hero-content > *, .hero-content > .hero-title { max-width: 34rem; }
  .hero-rule { margin-bottom: 1.25rem; }
  .hero-tagline { margin: 1.1rem 0 1.5rem; }
  .hero-fig { display: none; }
  .hero-portrait {
    position: relative; left: auto; transform: none;
    margin: auto auto 0;
    height: auto; width: min(100%, 600px, 50svh);
  }
}

/* ---------- Sections ---------- */
.section { padding: clamp(5.5rem, 12vw, 10rem) 0; background: var(--bg); }
.section-alt { background: var(--bg-alt); }
.section-tight { padding-top: clamp(2rem, 4vw, 3rem); }

.section-eyebrow {
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.section-title {
  font-size: clamp(2.5rem, 6.5vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.04;
}
.section-sub {
  font-size: clamp(1.1rem, 1.9vw, 1.4rem);
  color: var(--text-2);
  max-width: 40ch;
  margin-top: 1rem;
  line-height: 1.4;
}

/* ---------- Facts (About page + project pages) ---------- */
.facts {
  display: grid; gap: 1.25rem;
  margin-top: 3rem; padding-top: 2rem;
  border-top: 1px solid var(--border);
}
@media (min-width: 560px) { .facts { grid-template-columns: repeat(3, 1fr); } }
.facts dt { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin-bottom: 0.35rem; }
.facts dd { font-size: 0.98rem; line-height: 1.45; }

/* ---------- About page: picture + overlapping text box ---------- */
.story { padding-block: clamp(3rem, 7vw, 5.5rem); }
.story + .story { padding-top: clamp(1rem, 3vw, 2rem); }
.story-row { display: grid; align-items: center; }
.story-media {
  border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--bg-alt);
  box-shadow: var(--shadow);
}
.story-media img { width: 100%; height: 100%; object-fit: cover; }
.story-card {
  position: relative; z-index: 1;
  padding: clamp(1.75rem, 4vw, 3.25rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
}
.story-num {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.2em;
  color: var(--brand); margin-bottom: 0.75rem;
}
.story-title {
  display: inline-block;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800; letter-spacing: -0.035em; line-height: 1.08;
  margin-bottom: 1.25rem;
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.story-card p { font-size: 1.05rem; line-height: 1.75; color: var(--text-2); }
.story-card p + p { margin-top: 1.1rem; }

@media (min-width: 900px) {
  .story-row { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .story-media { grid-column: 1 / 8; grid-row: 1; }
  .story-card { grid-column: 7 / 13; grid-row: 1; }
  /* "My Journey": text box on the left, a bit wider/longer; picture on the right */
  .story-reverse .story-media { grid-column: 6 / 13; aspect-ratio: 1 / 1; }
  .story-reverse .story-card { grid-column: 1 / 8; }
}
@media (max-width: 899px) {
  .story-card { margin: -3.5rem 0.75rem 0; }
}

.about-facts { padding-top: clamp(2rem, 5vw, 3.5rem); }
.about-facts .facts.facts-strip { margin-top: 0; }
.about-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.9rem; margin-top: 3rem; }

/* ---------- Project cards (home carousel + projects page) ---------- */
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.5rem 2rem; }
.project-status { color: var(--text-2); }

.project-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.4s var(--ease), transform 0.4s var(--ease);
}
.project-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-6px); }

.card-media { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg-alt); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease); }
.project-card:hover .card-media img { transform: scale(1.05); }

.card-body { display: flex; flex-direction: column; gap: 0.75rem; padding: 1.6rem 1.6rem 1.75rem; flex: 1; }
.card-meta { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.card-title { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--accent); text-decoration: none; }
.card-summary { color: var(--text-2); font-size: 1rem; }
.card-cta { margin-top: auto; align-self: flex-start; }

.btn-sm { font-size: 0.95rem; padding: 0.6em 1.15em; }
.btn svg { width: 1.05em; height: 1.05em; transition: transform 0.25s var(--ease); }
.btn:hover svg { transform: translateX(3px); }

.tools { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tools li {
  font-size: 0.78rem; font-weight: 500;
  padding: 0.3rem 0.65rem;
  border-radius: 980px;
  background: var(--chip-bg);
  color: var(--text-2);
}

.links { display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; }
.links a { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.95rem; font-weight: 500; }
.links svg { width: 16px; height: 16px; flex: none; }

/* "Browse all projects" end card + round arrow */
.more-card {
  justify-content: center; gap: 0.75rem;
  padding: 2.25rem;
  color: var(--text);
  min-height: 100%;
}
.more-card:hover { text-decoration: none; }
.more-card .card-title { font-size: 1.75rem; }
.more-arrow {
  display: grid; place-items: center;
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent); color: #fff;
  margin-bottom: 0.75rem;
  transition: transform 0.3s var(--ease);
}
.more-arrow svg { width: 26px; height: 26px; }
.more-card:hover .more-arrow, .next-card:hover .more-arrow { transform: translateX(6px); }

/* Home carousel */
.carousel {
  --edge: max(var(--gutter), (100% - var(--maxw)) / 2);
  display: grid; grid-auto-flow: column; grid-auto-columns: min(400px, 84%);
  gap: clamp(1rem, 2vw, 1.5rem);
  margin-top: clamp(1.5rem, 4vw, 3rem);
  padding: 1rem var(--edge) 2.5rem;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--edge);
  scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel > * { scroll-snap-align: start; }
.carousel:focus-visible { outline-offset: -3px; }

.carousel-controls { display: flex; align-items: center; gap: 0.75rem; }
.arrow-btn {
  display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 50%;
  border: 0; cursor: pointer;
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.arrow-btn svg { width: 22px; height: 22px; }
.arrow-btn:hover:not(:disabled) { background: var(--accent); color: #fff; }
.arrow-btn:active:not(:disabled) { transform: scale(0.94); }
.arrow-btn:disabled { opacity: 0.35; cursor: default; box-shadow: none; }

/* Projects page grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: clamp(1.25rem, 2.5vw, 2rem);
}

/* ---------- Dark page header (projects + project pages) ---------- */
.page-hero {
  position: relative;
  padding: calc(var(--nav-h) + clamp(3rem, 8vw, 6rem)) 0 clamp(4rem, 9vw, 7rem);
  background:
    radial-gradient(ellipse 50% 70% at 80% 30%, rgba(94, 234, 212, 0.09), transparent 70%),
    #0d1117;
  color: #f5f5f7;
  overflow: hidden;
}
.page-hero.has-cover { padding-bottom: clamp(6rem, 13vw, 10rem); }
.page-hero.page-hero-compact { padding: calc(var(--nav-h) + clamp(2rem, 5vw, 3.25rem)) 0 clamp(2.25rem, 5vw, 3.25rem); }
.page-hero-compact .hero-rule { margin-bottom: 1.25rem; }
.page-hero-compact .hero-eyebrow { margin-bottom: 0.9rem; }
.page-hero-compact .page-hero-title { font-size: clamp(2.2rem, 4.5vw, 3.6rem); }
.page-hero-compact .page-hero-sub { margin-top: 0.9rem; font-size: clamp(1rem, 1.5vw, 1.2rem); }
.page-hero-compact .page-hero-count { margin-top: 0.9rem; }
.page-hero-title {
  font-size: clamp(2.5rem, 6.5vw, 5rem);
  font-weight: 800; letter-spacing: -0.04em; line-height: 1.04;
  max-width: 20ch; text-wrap: balance;
}
.page-hero-sub {
  font-size: clamp(1.1rem, 1.8vw, 1.35rem); line-height: 1.5;
  color: rgba(245, 245, 247, 0.75);
  max-width: 48ch; margin-top: 1.25rem;
}
.page-hero-count { margin-top: 1.5rem; font-size: 0.95rem; font-weight: 600; color: #5eead4; }
.page-hero-extras { display: grid; gap: 1.25rem; margin-top: 2rem; }
.page-hero-extras:empty { display: none; }
.page-hero .tools li { background: rgba(255, 255, 255, 0.1); color: #d1d1d6; font-size: 0.85rem; }
.page-hero .links a { color: #2997ff; }
.back-link {
  display: inline-flex; gap: 0.4rem;
  margin-bottom: 2.25rem;
  font-size: 0.95rem; font-weight: 500;
  color: rgba(245, 245, 247, 0.7);
}
.back-link:hover { color: #fff; text-decoration: none; }

/* ---------- Project detail page ---------- */
.figure-frame { overflow: hidden; border-radius: var(--radius); background: var(--bg-alt); box-shadow: var(--shadow); }
.figure-frame img { width: 100%; height: 100%; object-fit: cover; }
figcaption { margin-top: 0.85rem; font-size: 0.9rem; color: var(--text-2); }

.project-cover { position: relative; z-index: 1; margin-top: calc(-1 * clamp(3.5rem, 8vw, 6.5rem)); }
.cover-figure .figure-frame { aspect-ratio: 16 / 9; box-shadow: var(--shadow-hover); }

.facts.facts-strip {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding: 0 0 clamp(2rem, 4vw, 3rem);
  border-top: 0; border-bottom: 1px solid var(--border);
}

.overview { display: grid; gap: 1rem 3rem; padding: clamp(3.5rem, 8vw, 6.5rem) 0 clamp(1.5rem, 4vw, 3rem); }
@media (min-width: 860px) { .overview { grid-template-columns: minmax(0, 1fr) minmax(0, 2.6fr); } }
.overview-label { font-size: 1.05rem; font-weight: 600; color: var(--accent); padding-top: 0.5rem; }
.overview p { font-size: clamp(1.15rem, 1.8vw, 1.45rem); font-weight: 500; letter-spacing: -0.015em; line-height: 1.55; }
.overview p + p { margin-top: 1rem; }

.split { display: grid; gap: clamp(1.75rem, 5vw, 4.5rem); align-items: center; padding-block: clamp(2.5rem, 6vw, 5rem); }
@media (min-width: 860px) {
  .split { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .split-reverse { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
  .split-reverse .split-media { order: 2; }
}
.split.split-text-only { grid-template-columns: minmax(0, 760px); }
.split-media .figure-frame { aspect-ratio: 4 / 3; }
.split-num { font-size: 0.9rem; font-weight: 700; letter-spacing: 0.1em; color: var(--accent); margin-bottom: 0.75rem; }
.split-title { font-size: clamp(1.8rem, 3.5vw, 2.7rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.12; margin-bottom: 1.1rem; }
.split-text p { font-size: 1.1rem; line-height: 1.7; color: var(--text-2); }
.split-text p + p { margin-top: 1rem; }
.split-list { display: grid; gap: 0.9rem; margin-top: 1.4rem; }
.split-list li { position: relative; padding-left: 1.6rem; font-size: 1.05rem; line-height: 1.6; color: var(--text-2); }
.split-list li::before {
  content: ""; position: absolute; left: 0; top: 0.6em;
  width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent);
}
.split-list strong { color: var(--text); font-weight: 600; }

.block-title { font-size: clamp(1.8rem, 3.5vw, 2.7rem); font-weight: 700; letter-spacing: -0.03em; margin-bottom: 1.75rem; }
.skills-block { padding-block: clamp(3rem, 7vw, 5rem); border-top: 1px solid var(--border); }
.skill-list { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.skill-list li { padding: 0.6rem 1.15rem; border-radius: 980px; background: var(--chip-bg); font-weight: 500; }

.gallery-block { padding-bottom: clamp(4rem, 9vw, 7rem); }
.gallery-grid { display: grid; gap: clamp(1rem, 2vw, 1.5rem); grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.gallery-item .figure-frame { aspect-ratio: 4 / 3; }
@media (min-width: 860px) {
  .gallery-grid.is-mosaic { grid-template-columns: 2fr 1fr; }
  .gallery-grid.is-mosaic .gallery-item:first-child { grid-row: span 2; display: flex; flex-direction: column; }
  .gallery-grid.is-mosaic .gallery-item:first-child .figure-frame { flex: 1; aspect-ratio: auto; }
}

.next-block { padding: clamp(4rem, 9vw, 7rem) 0; background: var(--bg-alt); }
.next-card {
  display: grid; overflow: hidden;
  background: var(--surface); color: var(--text);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: box-shadow 0.4s var(--ease), transform 0.4s var(--ease);
}
.next-card:hover { text-decoration: none; box-shadow: var(--shadow-hover); transform: translateY(-4px); }
@media (min-width: 760px) { .next-card { grid-template-columns: 1fr 1fr; } }
.next-media { aspect-ratio: 16 / 10; overflow: hidden; }
.next-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease); }
.next-card:hover .next-media img { transform: scale(1.05); }
.next-text { display: flex; flex-direction: column; justify-content: center; gap: 0.75rem; padding: clamp(1.75rem, 4vw, 3rem); }
.next-title { font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
.next-text .more-arrow { margin: 0.75rem 0 0; }
.project-actions { display: flex; justify-content: center; margin-top: 2.5rem; }
.not-found { padding: 4rem 0 8rem; }

/* ---------- Resume ---------- */
.resume-inner { text-align: center; }
.resume-inner .section-sub { margin-inline: auto; }
.resume-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.9rem; margin-top: 2.25rem; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; gap: clamp(3rem, 6vw, 5rem); }
@media (min-width: 900px) { .contact-grid { grid-template-columns: 1fr 1fr; align-items: start; } }

.contact-links { margin-top: 2.5rem; display: grid; gap: 0.75rem; }
.contact-links a {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.contact-links a:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.contact-links svg { width: 24px; height: 24px; flex: none; color: var(--accent); }
.contact-links span { display: flex; flex-direction: column; font-size: 0.95rem; color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.contact-links strong { color: var(--text); font-weight: 600; font-size: 1rem; }

.contact-form {
  display: grid; gap: 1.1rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.field { display: grid; gap: 0.4rem; }
.field label { font-size: 0.9rem; font-weight: 600; }
.field input, .field textarea {
  width: 100%;
  font: inherit; font-size: 1rem;
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent);
}
.form-status { min-height: 1.5em; font-size: 0.95rem; color: var(--text-2); text-align: center; }
.form-status.is-success { color: #1a9f4b; }
.form-status.is-error { color: #e0352b; }

/* ---------- Footer ---------- */
.footer { padding: 2rem 0; background: var(--bg-alt); border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--text-3); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .project-card:hover, .contact-links a:hover { transform: none; }
  .project-card:hover .card-media img, .next-card:hover .next-media img { transform: none; }
  .next-card:hover, .more-card:hover .more-arrow, .next-card:hover .more-arrow, .btn:hover svg { transform: none; }
  .eyebrow-dot { animation: none; }
}
