/* General Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Modern teal blue color palette - NO GRADIENTS */
  --bg-color: #04151f; /* very dark blue */
  --bg-alt-color: #0b202f; /* slightly lighter dark blue */
  --main-color: #9afaff; /* teal */
  --main-color-hover: #00d7e2;
  --text-main: #f3f4f6;
  --text-muted: #a3b8c7;
  --card-bg: #112a3d;
  --card-border: #1a3c54;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --vf-bg: #020c12; /* inside the viewfinder, darker than the page */
}

html {
  scroll-behavior: smooth;
  font-family: 'Inter', sans-serif;
}

h1, h2, h3, h4, h5, h6, .logo, .main-name {
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: -0.02em;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  overflow-x: clip;
}

/* The whole page is seen through the lens: film grain plus a soft vignette,
   fixed over every scene. Grain is an inline SVG noise tile, no image file. */
body::after {
  content: '';
  position: fixed;
  inset: -10%; /* covers the grain keyframes' max 6% shift; a bigger layer costs GPU memory on low-end phones */
  z-index: 9000;
  pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.9s steps(5) infinite;
}

html::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 8999;
  pointer-events: none;
  background: radial-gradient(ellipse 120% 100% at 50% 50%, transparent 55%, rgba(0, 4, 8, 0.45));
}

@keyframes grain {
  0% { translate: 0 0; }
  20% { translate: -4% 3%; }
  40% { translate: 3% -5%; }
  60% { translate: -2% 6%; }
  80% { translate: 5% -2%; }
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

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

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 2000;
  padding: 0.6rem 1rem;
  background: var(--main-color);
  color: var(--bg-color);
  font-weight: 600;
  border-radius: 6px;
  transform: translateY(-160%);
  transition: transform 200ms var(--ease-out);
}

.skip-link:focus {
  transform: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.main-name {
  color: var(--main-color);
}

.text-center {
  text-align: center;
}

/* ---------------- */
/* Scroll progress  */
/* ---------------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  z-index: 1001;
  background: var(--main-color);
  transform-origin: 0 50%;
  transform: scaleX(var(--scroll-progress, 0));
  pointer-events: none;
}

/* --------- */
/* Scrollbar */
/* --------- */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: var(--main-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--main-color-hover);
}

/* --------- */
/* Navbar    */
/* --------- */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  padding: 1.5rem 2rem;
  z-index: 1000;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  background-color: transparent;
}

.navbar.sticky {
  background-color: rgba(4, 21, 31, 0.75);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  padding: 1rem 2rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(154, 250, 255, 0.05);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.logo-dot {
  color: var(--main-color);
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links li a {
  font-size: 1.1rem;
  font-weight: 500;
  position: relative;
  padding: 0.5rem 0;
  transition: color 200ms ease-out;
}

.nav-links li a:hover,
.nav-links li a.is-active {
  color: var(--main-color);
}

.nav-links li a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--main-color);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 300ms var(--ease-out);
  border-radius: 2px;
}

.nav-links li a:hover::after,
.nav-links li a.is-active::after {
  transform: scaleX(1);
}

/* One underline that slides to the active link (desktop) */
.nav-container {
  position: relative;
}

.nav-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 2px;
  border-radius: 2px;
  background: var(--main-color);
  transform-origin: 0 0;
  opacity: 0;
  pointer-events: none;
}

.nav-indicator.is-placed {
  opacity: 1;
  transition: transform 550ms var(--ease-out), opacity 200ms ease-out;
}

@media (min-width: 1025px) {
  .nav-links li a.is-active::after {
    transform: scaleX(0);
  }
}

.hamburger {
  display: none;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 8px;
  margin: -8px;
}

.hamburger .bar {
  display: block;
  width: 25px;
  height: 3px;
  margin: 5px auto;
  transition: transform 0.3s var(--ease-out), opacity 0.2s ease;
  background-color: var(--text-main);
}

/* --------- */
/* Home      */
/* --------- */
.home-section {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding-top: 80px;
  position: relative;
  overflow: hidden;
}

.home-section::before {
  content: '';
  position: absolute;
  top: 10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(0, 173, 181, 0.08) 0%, rgba(0, 173, 181, 0) 70%);
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
}

.home-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  flex-wrap: wrap;
  gap: 2rem 0;
}

.home-text {
  flex: 1;
  min-width: min(300px, 100%);
  padding-right: 2rem;
  will-change: transform, opacity;
}

.heading {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.5rem, 2.4vw, 2.25rem);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.wave {
  animation-name: wave-animation;
  animation-duration: 2.1s;
  animation-iteration-count: infinite;
  transform-origin: 70% 70%;
  display: inline-block;
}

@keyframes wave-animation {
  0% { transform: rotate(0deg); }
  10% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  30% { transform: rotate(14deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
  60% { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

.heading-name {
  font-size: clamp(2.5rem, 6vw, 4.75rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}

.heading-name .main-name {
  letter-spacing: inherit;
}

.typewriter-container {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  color: var(--main-color);
  font-weight: 600;
  min-height: 1.5em;
}

.cursor {
  animation: blink 0.7s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2.5rem;
}

.home-image {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: min(300px, 100%);
  animation: float 6s ease-in-out infinite;
}

/* Hero portrait: a lens that focuses in */
.hero-image-wrapper {
  position: relative;
  width: min(340px, 68vw);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: perspective(900px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transition: transform 700ms var(--ease-out);
}

.hero-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid rgba(154, 250, 255, 0.3);
  /* Developer aesthetic: Grayscale by default, color on hover */
  filter: grayscale(100%) contrast(1.1) brightness(0.9);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
  transition: clip-path 1300ms var(--ease-out), filter 1400ms var(--ease-out), transform 1400ms var(--ease-out), border-color 500ms ease;
}

.hero-image-wrapper:hover img {
  filter: grayscale(0%) contrast(1) brightness(1);
  transform: scale(1.03);
  border-color: var(--main-color);
  transition-duration: 1300ms, 700ms, 700ms, 500ms;
}

/* Focus ring with distance-scale ticks, turns as you scroll */
.lens-ring {
  position: absolute;
  inset: -26px;
  border-radius: 50%;
  pointer-events: none;
  transition: opacity 1200ms var(--ease-out), transform 1600ms var(--ease-out);
}

.lens-ring::before,
.lens-ring::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  transform: rotate(var(--ring-rot, 0deg));
}

/* minor ticks */
.lens-ring::before {
  background: repeating-conic-gradient(rgba(154, 250, 255, 0.35) 0 0.5deg, transparent 0.5deg 4deg);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 7px), #000 calc(100% - 7px));
  mask: radial-gradient(closest-side, transparent calc(100% - 7px), #000 calc(100% - 7px));
}

/* major ticks + index mark */
.lens-ring::after {
  background:
    conic-gradient(var(--main-color) 0 1.4deg, transparent 1.4deg),
    repeating-conic-gradient(rgba(154, 250, 255, 0.7) 0 0.8deg, transparent 0.8deg 30deg);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 14px), #000 calc(100% - 14px));
  mask: radial-gradient(closest-side, transparent calc(100% - 14px), #000 calc(100% - 14px));
}

/* Intro choreography (only when JS is running) */
.js .hero-image-wrapper img {
  clip-path: circle(0% at 50% 50%);
  filter: grayscale(100%) blur(16px);
  transform: scale(1.18);
}

.js .lens-ring {
  opacity: 0;
  transform: scale(0.88) rotate(-50deg);
}

.js .intro-line {
  opacity: 0;
  transform: translateY(0.5em);
  filter: blur(8px);
  transition: opacity 900ms var(--ease-out), transform 1000ms var(--ease-out), filter 900ms var(--ease-out);
}

.js.is-ready .hero-image-wrapper img {
  clip-path: circle(50% at 50% 50%);
  filter: grayscale(100%) contrast(1.1) brightness(0.9) blur(0);
  transform: none;
}

.js.is-ready .hero-image-wrapper:hover img {
  filter: grayscale(0%) contrast(1) brightness(1) blur(0);
  transform: scale(1.03);
}

.js.is-ready .lens-ring {
  opacity: 1;
  transform: none;
}

.js.is-ready .intro-line {
  opacity: 1;
  transform: none;
  filter: blur(0);
}

.js.is-ready .intro-line:nth-child(1) { transition-delay: 450ms; }
.js.is-ready .intro-line:nth-child(2) { transition-delay: 560ms; }
.js.is-ready .intro-line:nth-child(3) { transition-delay: 670ms; }
.js.is-ready .intro-line:nth-child(4) { transition-delay: 780ms; }

/* Layered depth: scrolling pulls the hero planes apart. --hero-t runs 0 to 1
   over the first viewport. The far glow lags, the portrait recedes, the lens
   ring comes toward you, and the text leaves first. Individual translate/scale
   properties keep this off the tilt and intro transform transitions. */
.home-section::before {
  translate: 0 calc(var(--hero-t, 0) * 40vh);
}

.hero-image-wrapper {
  scale: calc(1 - var(--hero-t, 0) * 0.1);
}

.lens-ring {
  scale: calc(1 + var(--hero-t, 0) * 0.35);
}

/* A wide, faint outer ring: the nearest plane. It turns against the inner
   ring and rushes toward you fastest as the hero leaves */
.lens-ring-outer {
  inset: -38%;
  --ring-rot-outer: calc(var(--ring-rot, 0deg) * -0.5);
  scale: calc(1 + var(--hero-t, 0) * 0.9);
}

.lens-ring-outer::before,
.lens-ring-outer::after {
  transform: rotate(var(--ring-rot-outer));
}

.js.is-ready .lens-ring-outer {
  opacity: 0.35;
}

/* Desktop only: stacked on mobile, a sinking portrait would run into the text */
@media (min-width: 1025px) {
  .hero-image-wrapper {
    width: min(460px, 34vw);
    translate: 0 calc(var(--hero-t, 0) * 18vh);
  }
}

/* --------- */
/* Buttons   */
/* --------- */
.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  transition: background-color 200ms ease-out, color 200ms ease-out, border-color 200ms ease-out, transform 200ms var(--ease-out);
}

.btn-primary {
  background-color: var(--main-color);
  color: var(--bg-color);
}

.btn-primary:hover {
  background-color: var(--main-color-hover);
  transform: translateY(-2px);
}

.btn-ghost {
  border: 1px solid rgba(154, 250, 255, 0.35);
  color: var(--main-color);
}

.btn-ghost:hover {
  border-color: var(--main-color);
  background-color: rgba(154, 250, 255, 0.08);
  transform: translateY(-2px);
}

.btn-primary:active,
.btn-ghost:active {
  transform: scale(0.96);
}

/* --------- */
/* About     */
/* --------- */
.about-section {
  padding: 120px 0;
  background-color: var(--bg-alt-color);
  position: relative;
  overflow: hidden;
}

/* Ground shift: fades from the Home section's dark background into the About background */
.about-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(to bottom, var(--bg-color), transparent);
  z-index: 0;
  pointer-events: none;
}

/* Ambient glow behind the avatar — mirrors the hero's ::before blob */
.about-section::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -5%;
  transform: translateY(-50%);
  width: 55vw;
  height: 55vw;
  background: radial-gradient(circle, rgba(0, 173, 181, 0.07) 0%, rgba(0, 173, 181, 0) 68%);
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
}

.section-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  text-align: center;
  margin-bottom: 3rem;
}

.section-lead {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin: -1.75rem auto 0;
  max-width: 60ch;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.about-text p {
  font-size: 1.2rem;
  line-height: 1.8;
  margin-bottom: 1rem;
  max-width: 62ch;
}

.about-activity {
  margin-top: 2rem;
}

.about-activity li {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.about-activity li i {
  width: 1.25em;
  text-align: center;
}

.about-image {
  display: flex;
  justify-content: center;
}

.about-image img {
  width: 250px;
  height: 250px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--main-color);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  animation: float 6s ease-in-out infinite;
}

.about-social-container {
  display: flex;
  gap: 15px;
}

.connect-text {
  margin-top: 25px;
  margin-bottom: 10px;
  color: var(--main-color);
  font-weight: 500;
}

/* Depth of field (motion only): --dof is 0 in the focal plane, 1 far out */
.vf :is(.about-text > *, .about-image img) {
  filter: blur(calc(var(--dof, 0) * 3px));
  opacity: calc(1 - var(--dof, 0) * 0.5);
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-15px); }
  100% { transform: translateY(0px); }
}

@media (max-width: 768px) {
  .about-section::after {
    width: 90vw;
    height: 90vw;
    right: -20%;
    opacity: 0.6;
  }
}

/* --------- */
/* Projects  */
/* --------- */
.project-section {
  padding: 120px 0;
  background-color: var(--bg-color);
  position: relative;
  overflow: clip; /* clip, not hidden: hidden would break the sticky viewfinder */
}

.project-section::before {
  content: '';
  position: absolute;
  bottom: -10%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(0, 173, 181, 0.05) 0%, rgba(0, 173, 181, 0) 70%);
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
}

/* Ground shift: fades from the About section's background into the Projects background */
.project-section::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(to bottom, var(--bg-alt-color), transparent);
  z-index: 0;
  pointer-events: none;
}

/* Content sits above each section's glow and ground-shift layers */
.about-section > .container,
.project-section > .viewfinder,
.stack-section > .container {
  position: relative;
  z-index: 1;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
  gap: 3rem;
  margin-top: 4rem;
}

.project-card-view {
  position: relative;
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  transition: box-shadow 400ms var(--ease-out), border-color 300ms ease-out;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* soft top light on hover */
.project-card-view::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(500px circle at 50% 0%, rgba(154, 250, 255, 0.1), transparent 45%);
  opacity: 0;
  transition: opacity 300ms ease-out;
  pointer-events: none;
}

.project-card-view:hover {
  border-color: rgba(154, 250, 255, 0.4);
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.6);
}

.project-card-view:hover::after {
  opacity: 1;
}

.card-media {
  overflow: hidden;
  border-bottom: 1px solid var(--card-border);
}

.card-img-top {
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: top;
  transition: transform 900ms var(--ease-out);
}

.project-card-view:hover .card-img-top {
  transform: scale(1.05);
}

.card-body {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.project-title {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--main-color);
}

.project-text {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.project-meta {
  font-size: 0.9rem;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.project-award {
  color: var(--main-color);
  white-space: nowrap;
}

/* Long award names don't fit one line on small phones */
@media (max-width: 480px) {
  .project-award {
    white-space: normal;
  }
}

.project-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.project-stack li {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid rgba(154, 250, 255, 0.25);
  border-radius: 999px;
  color: var(--text-muted);
}

.card-links {
  display: flex;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

/* ------------------------------------------------------------------ */
/* Viewfinder: Work pins for 3.5 screens. An aperture opens as it      */
/* arrives (--e), then a focus ring racks between the projects.        */
/* Per card, script.js sets --f focus, --o presence and --c caption.   */
/* .vf is only set when motion is allowed, so otherwise the cards      */
/* above stay a plain grid.                                            */
/* ------------------------------------------------------------------ */
.focus-scale {
  display: none;
}

.vf .project-section {
  height: 350svh;
  padding: 0;
}

.vf .viewfinder {
  position: sticky;
  top: 0;
  height: 100svh;
  display: flex;
  align-items: center;
  padding: 84px 0 20px;
  background: var(--vf-bg);
  clip-path: circle(calc(12% + var(--e, 1) * 66%) at 50% 50%);
}

.vf .viewfinder > .container {
  width: 100%;
}

.vf .project-section .section-title {
  text-align: left;
  margin-bottom: 0.5rem;
}

.vf .project-section .section-lead {
  margin: 0;
  text-align: left;
}

/* Both projects share one frame; viewfinder corner brackets wrap it */
.vf .project-grid {
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin-top: 2rem;
}

.vf .project-grid::before {
  --s: 22px;
  content: '';
  position: absolute;
  inset: -12px;
  border: 1.5px solid rgba(154, 250, 255, 0.3);
  -webkit-mask: conic-gradient(at var(--s) var(--s), transparent 75%, #000 0) 0 0 / calc(100% - var(--s)) calc(100% - var(--s));
  mask: conic-gradient(at var(--s) var(--s), transparent 75%, #000 0) 0 0 / calc(100% - var(--s)) calc(100% - var(--s));
  pointer-events: none;
  transition: border-color 200ms ease-out;
}

/* focus confirmed */
.vf .viewfinder.is-sharp .project-grid::before {
  border-color: var(--main-color);
}

.vf .project-card {
  grid-area: 1 / 1;
}

.vf .project-card:not(.is-active) {
  pointer-events: none;
}

.vf .project-card-view,
.vf .project-card-view:hover {
  display: grid;
  gap: 1.25rem;
  background: none;
  border: 0;
  border-radius: 0;
  overflow: visible;
  transform: none;
  box-shadow: none;
}

.vf .project-card-view::after {
  display: none;
}

/* The focus pull is opacity only: the sharp screenshot fades in over a
   statically blurred copy of itself, so nothing re-filters per frame */
.vf .card-media {
  position: relative;
  width: 100%; /* keeps full width when max-height clips the ratio */
  aspect-ratio: 3 / 1;
  max-height: 42svh;
  border: 0;
  border-radius: 6px;
  background: var(--shot) left top / cover;
  opacity: var(--o, 1);
}

.vf .card-media::before {
  content: '';
  position: absolute;
  inset: -24px;
  background: inherit;
  filter: blur(14px) brightness(0.75);
}

.vf .card-img-top,
.vf .project-card-view:hover .card-img-top {
  position: relative;
  height: 100%;
  object-position: left top;
  opacity: var(--f, 1);
  scale: calc(1 + (1 - var(--f, 1)) * 0.04); /* focus breathing */
  transform: none;
  transition: none;
}

.vf .card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 3rem;
  padding: 0;
  opacity: var(--c, 1);
  translate: 0 calc((1 - var(--c, 1)) * 14px);
}

.vf .project-title {
  margin-bottom: 0.4rem;
}

.vf .project-text {
  margin: 0;
  max-width: 68ch;
}

.vf .card-body > :not(.card-links) {
  grid-column: 1;
}

.vf .project-meta {
  margin: 0.75rem 0 0.6rem;
}

.vf .project-stack {
  margin: 0;
}

.vf .card-links {
  grid-column: 2;
  grid-row: 1 / span 4;
  align-self: end;
}

/* Lens distance scale: ticks and project marks slide under a fixed index */
.vf .focus-scale {
  --step: 280px;
  display: block;
  position: relative;
  height: 44px;
  margin-top: 1.75rem;
  overflow: hidden;
  -webkit-mask: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent);
  mask: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent);
}

.vf .focus-scale::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 18px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--main-color);
}

.focus-track {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  translate: calc(var(--rs, 0) * var(--step) * -1) 0;
}

.focus-track::before {
  content: '';
  position: absolute;
  top: 4px;
  left: calc(var(--step) * -2);
  width: calc(var(--step) * 6);
  height: 8px;
  background: repeating-linear-gradient(90deg, rgba(163, 184, 199, 0.35) 0 1px, transparent 1px calc(var(--step) / 10));
}

.focus-mark {
  position: absolute;
  top: 0;
  left: calc(var(--at) * var(--step));
  translate: -50% 0;
  padding-top: 20px;
  font: 0.75rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text-muted);
  white-space: nowrap;
}

.focus-mark::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 14px;
  background: rgba(154, 250, 255, 0.6);
}

@media (max-width: 768px) {
  .vf .viewfinder {
    padding-top: 76px;
  }

  .vf .card-media {
    aspect-ratio: 16 / 10;
  }

  .vf .card-body {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 1rem;
  }

  .vf .card-links {
    grid-column: 1;
    grid-row: auto;
  }

  .vf .focus-scale {
    --step: 170px;
  }

  .vf .project-section .section-lead {
    display: none;
  }

  .vf .project-grid {
    margin-top: 1.25rem;
  }
}

/* Portrait tablets: a taller frame fills the screen instead of a thin strip */
@media (orientation: portrait) {
  .vf .card-media {
    aspect-ratio: 16 / 10;
  }
}

/* Short landscape screens (tablets, small laptops): a full-width strip
   would crop the shot to a sliver, so the frame sits beside its caption */
@media (min-width: 769px) and (max-height: 800px) and (orientation: landscape) {
  .vf .project-card-view,
  .vf .project-card-view:hover {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 2.5rem;
  }

  .vf .card-media {
    width: auto;
    height: 50svh;
    max-height: none;
    aspect-ratio: 16 / 10;
  }

  .vf .card-body {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 1.25rem;
  }

  .vf .card-links {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }
}

/* Short phones: the stack tags go and the frame gets a wider crop, so the
   caption and link still fit under the nav */
@media (max-height: 760px) and (max-width: 768px) {
  .vf .project-stack {
    display: none;
  }

  .vf .project-card-view,
  .vf .card-body {
    gap: 0.75rem;
    row-gap: 0.5rem;
  }

  .vf .project-text {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .vf .card-media {
    aspect-ratio: 5 / 2;
  }

  .vf .focus-scale {
    margin-top: 0.5rem;
  }
}

/* The flow section after a pin starts reading right away */
.vf .stack-section {
  padding-top: 60px;
}

.vf .stack-section::after {
  background: linear-gradient(to bottom, var(--vf-bg), transparent);
}

/* --------------- */
/* Built With      */
/* --------------- */
.stack-section {
  padding: 120px 0;
  background-color: var(--bg-alt-color);
  position: relative;
}

/* faint blueprint dot grid, fading at the edges */
.stack-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(154, 250, 255, 0.09) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-mask: radial-gradient(ellipse at 50% 55%, #000 25%, transparent 75%);
  mask: radial-gradient(ellipse at 50% 55%, #000 25%, transparent 75%);
  pointer-events: none;
}

/* Ground shift: fades from the Projects section's background into the Stack background */
.stack-section::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(to bottom, var(--bg-color), transparent);
  pointer-events: none;
}

.stack-grid {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  margin-top: 4rem;
}

.stack-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stack-tab {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: none;
  color: var(--text-main);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 200ms ease-out, border-color 200ms ease-out, transform 300ms var(--ease-out);
}

.stack-tab:hover {
  background-color: rgba(154, 250, 255, 0.04);
  transform: translateX(4px);
}

.stack-tab[aria-selected="true"] {
  background-color: var(--card-bg);
  border-color: var(--card-border);
  transform: translateX(8px);
}

.stack-icon {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 1.35rem;
  color: var(--main-color);
  background-color: rgba(154, 250, 255, 0.06);
  border: 1px solid rgba(154, 250, 255, 0.12);
  transition: background-color 250ms ease-out, color 250ms ease-out;
}

.stack-tab[aria-selected="true"] .stack-icon {
  background-color: var(--main-color);
  color: var(--bg-color);
}

.stack-name {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
}

.stack-role {
  display: block;
  margin-top: 2px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* All panels share one grid cell, so the window never jumps in height */
.stack-window {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  background-color: #06121b;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 48px -20px rgba(0, 0, 0, 0.6);
}

.stack-panel {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  visibility: hidden;
  opacity: 0;
  transition: opacity 150ms ease-out, visibility 0s linear 150ms;
}

.stack-panel.is-shown {
  visibility: visible;
  opacity: 1;
  transition: opacity 150ms ease-out;
}

.stack-panel:focus-visible {
  outline-offset: -3px;
}

.stack-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1.25rem;
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--card-border);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.stack-file {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.stack-file i {
  color: var(--main-color);
}

.stack-lang {
  flex: none;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.code {
  counter-reset: ln;
  flex-grow: 1;
  padding: 1.25rem 1.25rem 1.25rem 0;
  font: 0.875rem/1.75 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Long lines wrap under a hanging indent instead of scrolling sideways,
   so narrow screens never get an unfocusable scroll region */
.ln {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding-left: calc(1rem + 2ch + 1.25rem);
  text-indent: calc(-2ch - 1.25rem);
}

.ln::before {
  counter-increment: ln;
  content: counter(ln);
  display: inline-block;
  width: 2ch;
  margin-right: 1.25rem;
  text-indent: 0;
  text-align: right;
  color: rgba(163, 184, 199, 0.35);
}

.t-k { color: var(--main-color); }
.t-a { color: #8fc1e3; }
.t-s { color: #ffcf9a; }
.t-f { color: #c9b8ff; }
.t-c { color: var(--text-muted); font-style: italic; }

.stack-note {
  padding: 1rem 1.25rem;
  border-top: 1px dashed var(--card-border);
  color: var(--text-muted);
  line-height: 1.6;
}

.stack-note a {
  color: var(--main-color);
  font-weight: 600;
  white-space: nowrap;
}

.stack-note a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.stack-stage {
  flex-grow: 1;
  padding: 1.5rem 1.25rem;
}

.type-stage {
  display: grid;
  gap: 1.25rem;
  align-content: start;
}

.type-try {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.type-try input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.8rem;
  background-color: var(--bg-alt-color);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text-main);
  font: inherit;
  font-size: 1rem;
  transition: border-color 200ms ease-out;
}

.type-try input:focus {
  border-color: var(--main-color);
}

.specimen {
  display: grid;
  gap: 0.35rem;
  padding-top: 1rem;
  border-top: 1px solid var(--card-border);
}

.specimen-glyph {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.specimen-glyph.is-grotesk {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--main-color);
}

.specimen-glyph.is-inter {
  font-weight: 300;
}

.specimen-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.specimen-meta strong {
  color: var(--text-main);
  font-weight: 600;
}

.icon-stage {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 0.75rem;
  align-content: start;
}

.icon-cell {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 0.6rem;
  padding: 1.1rem 0.5rem;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background-color: rgba(154, 250, 255, 0.02);
  font: 0.75rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text-muted);
  transition: border-color 200ms ease-out;
}

.icon-cell i {
  font-size: 1.5rem;
  color: var(--main-color);
  transition: transform 300ms var(--ease-out);
}

.icon-cell:hover {
  border-color: rgba(154, 250, 255, 0.4);
}

.icon-cell:hover i {
  transform: translateY(-3px) scale(1.12);
}

/* Lines and items write themselves in when a panel opens */
.js .stack-panel :is(.ln, .stack-stage > *, .stack-note) {
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 150ms ease-out, transform 150ms ease-out;
}

.js .stack-window.is-in .stack-panel.is-shown :is(.ln, .stack-stage > *, .stack-note) {
  opacity: 1;
  transform: none;
  transition: opacity 500ms var(--ease-out), transform 600ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 45ms + 120ms);
}

.footer-stack {
  color: var(--main-color);
}

.footer-stack:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ------------------------------ */
/* Scroll reveals (JS-enhanced)   */
/* ------------------------------ */
.js .reveal-on-scroll {
  opacity: 0;
  transform: translateY(28px);
  filter: blur(6px);
  transition: opacity 800ms var(--ease-out), transform 900ms var(--ease-out), filter 800ms var(--ease-out);
}

.js .reveal-on-scroll.is-in {
  opacity: 1;
  transform: none;
  filter: none;
}

/* --------- */
/* Footer    */
/* --------- */
/* The close is a scene, not a strip: the lens ring from the hero returns and
   lands on its index mark exactly as the page runs out (--cp: 0 to 1) */
.footer {
  background-color: var(--bg-alt-color);
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: 4rem 0 2rem;
  overflow: clip; /* the ring is scaled up before it lands */
}

.close-stage {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 3.5rem;
  text-align: center;
}

.close-copy {
  display: grid;
  justify-items: center;
  gap: 1.5rem;
}

/* Bookend to the hero: the same portrait, now resolving from a soft
   monochrome into sharp colour as the ring lands */
.close-lens {
  --ring-rot: calc((1 - var(--cp, 1)) * -150deg);
  position: relative;
  width: min(240px, 56vw);
  aspect-ratio: 1;
}

.close-lens img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid rgba(154, 250, 255, 0.3);
  filter: grayscale(calc(1 - var(--cp, 1))) blur(calc((1 - var(--cp, 1)) * 8px));
}

.close-lens .lens-ring {
  scale: calc(1 + (1 - var(--cp, 1)) * 0.3);
}

.close-mail,
.inline-link {
  color: var(--main-color);
  text-decoration: underline;
  text-decoration-color: rgba(154, 250, 255, 0.4);
  text-underline-offset: 4px;
  transition: text-decoration-color 200ms ease-out;
}

.close-mail:hover,
.inline-link:hover {
  text-decoration-color: var(--main-color);
}

.close-mail {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  font-weight: 500;
}

.close-title {
  font-size: clamp(2rem, 5vw, 2.75rem);
}

.close-note {
  color: var(--text-muted);
}

.footer-content {
  display: flex;
  justify-content: center;
  text-align: center;
}

.footer-copywright {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
}

.footer-icons {
  display: flex;
  gap: 1.5rem;
}

.home-social-icons {
  width: 40px;
  height: 40px;
  background-color: var(--text-main);
  color: var(--bg-color);
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  font-size: 1.2rem;
  transition: transform 200ms var(--ease-out), background-color 200ms ease-out, box-shadow 200ms ease-out;
}

.home-social-icons:hover {
  background-color: var(--main-color);
  transform: translateY(-4px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
}

.home-social-icons:active {
  transform: scale(0.93);
}

section {
  scroll-margin-top: 80px;
}

/* ------------------------------ */
/* Custom Cursor (Immersive UX)   */
/* ------------------------------ */
.cursor-dot,
.cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease-out, scale 250ms var(--ease-out), background-color 250ms ease-out, border-color 250ms ease-out;
}

.cursor-dot {
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  background-color: var(--main-color);
  z-index: 10000;
}

.cursor-glow {
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 1px solid rgba(154, 250, 255, 0.3);
  z-index: 9999;
}

.has-cursor.cursor-visible .cursor-dot,
.has-cursor.cursor-visible .cursor-glow {
  opacity: 1;
}

.cursor-hover .cursor-dot {
  scale: 0.5;
}

.cursor-hover .cursor-glow {
  scale: 1.5;
  background-color: rgba(154, 250, 255, 0.06);
  border-color: rgba(154, 250, 255, 0.6);
}

@media (pointer: fine) {
  .has-cursor body,
  .has-cursor a,
  .has-cursor button {
    cursor: none;
  }
}

/* ---------- */
/* Responsive */
/* ---------- */
@media (max-width: 992px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .stack-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    margin-top: 3rem;
  }

  .stack-tabs {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .stack-tab {
    width: auto;
    gap: 0.6rem;
    padding: 0.4rem 0.9rem 0.4rem 0.4rem;
    border-color: var(--card-border);
  }

  .stack-tab:hover,
  .stack-tab[aria-selected="true"] {
    transform: none;
  }

  .stack-tab[aria-selected="true"] {
    border-color: var(--main-color);
  }

  .stack-icon {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }

  .stack-role {
    display: none;
  }
}

@media (max-width: 1024px) {
  .navbar,
  .navbar.sticky {
    padding: 1rem 1.25rem;
  }

  .home-content {
    flex-direction: column-reverse;
    text-align: center;
  }

  .home-text {
    padding-right: 0;
  }

  .hero-actions {
    justify-content: center;
  }

  .nav-links {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    gap: 0;
    background-color: var(--bg-alt-color);
    border-bottom: 1px solid var(--card-border);
    text-align: center;
    box-shadow: 0 16px 24px rgba(0, 0, 0, 0.35);
    padding: 1rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 200ms ease-out, transform 300ms var(--ease-out), visibility 0s linear 300ms;
  }

  .nav-links li a {
    display: inline-block;
    padding: 0.9rem 0;
  }

  .nav-links.active {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 200ms ease-out, transform 300ms var(--ease-out), visibility 0s;
  }

  .nav-indicator {
    display: none;
  }

  /* Menu items cascade in */
  .nav-links li {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 200ms ease-out, transform 300ms var(--ease-out);
  }

  .nav-links.active li {
    opacity: 1;
    transform: none;
    transition: opacity 350ms ease-out, transform 450ms var(--ease-out);
  }

  .nav-links.active li:nth-child(2) { transition-delay: 50ms; }
  .nav-links.active li:nth-child(3) { transition-delay: 100ms; }
  .nav-links.active li:nth-child(4) { transition-delay: 150ms; }

  .hamburger {
    display: block;
  }

  .hamburger.active .bar:nth-child(2) {
    opacity: 0;
  }

  .hamburger.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .hamburger.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  .about-section,
  .project-section,
  .stack-section {
    padding: 90px 0;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .about-text p {
    font-size: 1.05rem;
  }

  .card-body {
    padding: 1.5rem;
  }
}

/* ------------------------------ */
/* Reduced motion                 */
/* Touch devices (where the low-end GPUs are): drop the effects that re-blur
   or repaint on every scroll frame. The look holds; the per-frame cost goes. */
@media (pointer: coarse) {
  .navbar.sticky {
    background-color: rgba(4, 21, 31, 0.94);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .vf :is(.about-text > *, .about-image img) {
    filter: none;
  }

  body::after {
    animation: none;
  }
}

/* ------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .wave,
  .home-image,
  .about-image img,
  .cursor,
  body::after {
    animation: none;
  }

  .js .hero-image-wrapper img,
  .js .lens-ring,
  .js .intro-line,
  .js .reveal-on-scroll {
    transform: none;
    filter: none;
    clip-path: none;
    transition: opacity 400ms ease-out;
  }

  .js .hero-image-wrapper img {
    opacity: 0;
    filter: grayscale(100%) contrast(1.1) brightness(0.9);
  }

  .js.is-ready .hero-image-wrapper img {
    opacity: 1;
  }

  .hero-image-wrapper,
  .project-card-view:hover .card-img-top,
  .stack-tab,
  .icon-cell:hover i,
  .js .stack-panel :is(.ln, .stack-stage > *, .stack-note) {
    transform: none !important;
  }
}
