/* ============ Reset ============ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { 
  scroll-behavior: smooth; 
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  font-family: 'Parkinsans', system-ui, -apple-system, Segoe UI, sans-serif;
  background: #0E0A14;
  color: #F5F0FF;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}
img { 
  max-width: 100%; 
  display: block;
  height: auto;
}
a { 
  color: inherit; 
  text-decoration: none;
  -webkit-touch-callout: none;
  user-select: none;
}
button { 
  font: inherit; 
  cursor: pointer; 
  border: none; 
  background: none; 
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
input, textarea { 
  font: inherit; 
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

/* ============ Tokens ============ */
:root {
  --bg:       #0E0A14;
  --bg-2:     #16101F;
  --text:     #F5F0FF;
  --text-dim: rgba(245, 240, 255, 0.65);
  --purple:   #A78BFA;
  --lilac:    #E8DDFF;
  --border:   rgba(245, 240, 255, 0.12);
  --radius:   14px;
  --radius-lg:22px;
  --max:      1440px;
  --gutter:   clamp(16px, 4vw, 64px);
  --display:  'Playwrite GB J', 'Parkinsans', cursive;
  --safe-area-inset-top: env(safe-area-inset-top, 0);
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0);
}

/* ============ Sitewide grain ============ */
.grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============ Logo mark (top-left, always visible) ============ */
.logo-mark {
  position: fixed;
  top: max(24px, var(--safe-area-inset-top));
  left: max(24px, env(safe-area-inset-left, 0));
  z-index: 110;
  font-family: var(--display);
  font-size: 22px;
  color: var(--text);
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(22, 16, 31, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: background .3s ease, transform .3s ease, box-shadow .25s ease;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
  contain: layout style paint;
}
@supports not ((backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px))) {
  .logo-mark { background: rgba(22, 16, 31, 0.95); }
}
.logo-mark:hover,
.logo-mark:focus-visible {
  background: rgba(167, 139, 250, 0.22);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -2px rgba(167, 139, 250, 0.3);
}

/* ============ Back pill (All projects — top-right) ============ */
.back-pill {
  position: fixed;
  top: max(24px, var(--safe-area-inset-top));
  right: max(24px, env(safe-area-inset-right, 0));
  z-index: 110;
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.5vw, 8px);
  padding: clamp(10px, 1.2vw, 12px) clamp(16px, 2.5vw, 20px);
  font-size: clamp(10px, 1.1vw, 12px);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--purple);
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(22, 16, 31, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: background .3s ease, color .25s ease, transform .3s ease, box-shadow .25s ease;
  min-height: 44px;
  outline-offset: 4px;
  will-change: transform;
  contain: layout style paint;
  -webkit-user-select: none;
  user-select: none;
}
@supports not ((backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px))) {
  .back-pill { background: rgba(22, 16, 31, 0.95); }
}
.back-pill:hover,
.back-pill:focus-visible {
  background: rgba(167, 139, 250, 0.22);
  color: var(--lilac);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -2px rgba(167, 139, 250, 0.3);
}
.back-pill:focus-visible {
  outline: 2px solid var(--purple);
}
.back-pill__arrow {
  font-weight: 400;
  display: inline-flex;
}

/* ============ Top nav ============ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: clamp(10px, 1.2vw, 14px) var(--gutter);
}
.nav.is-scrolled .nav__inner {
  box-shadow: 0 8px 40px -8px rgba(0,0,0,0.7);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 8px 18px;
  background: rgba(22, 16, 31, 0.82);
  border: 1px solid var(--border);
  border-radius: 16px;
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  box-shadow: 0 4px 24px -8px rgba(0,0,0,0.5);
  max-width: var(--max);
  margin: 0 auto;
  will-change: box-shadow;
  contain: layout style;
  transition: box-shadow .3s ease;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .nav__inner { background: rgba(22, 16, 31, 0.97); }
}

/* Logo inside nav */
.nav__logo {
  font-family: var(--display);
  font-size: 20px;
  color: var(--text);
  min-height: 44px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color .25s ease;
  -webkit-user-select: none;
  user-select: none;
}
.nav__logo:hover,
.nav__logo:focus-visible {
  color: var(--lilac);
}
.nav__logo:focus-visible {
  outline: 2px solid var(--lilac);
  outline-offset: 4px;
  border-radius: 4px;
}

/* Links group */
.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav__link {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 10px;
  color: var(--text);
  transition: background .25s ease, color .25s ease;
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
  -webkit-user-select: none;
  user-select: none;
}
.nav__link:focus-visible {
  outline: 2px solid var(--lilac);
  outline-offset: 2px;
}
.nav__link:hover,
.nav__link:focus-visible {
  background: rgba(255,255,255,0.08);
}

.nav__link--contact {
  background: var(--lilac);
  color: #1A0F2E;
  font-weight: 600;
  box-shadow: 0 0 24px -4px rgba(232,221,255,0.55);
  transition: box-shadow .3s ease, transform .25s ease;
}
.nav__link--contact:hover,
.nav__link--contact:focus-visible {
  background: var(--lilac);
  box-shadow: 0 0 0 3px rgba(232,221,255,0.18), 0 0 36px -2px rgba(232,221,255,0.8);
  transform: translateY(-1px);
}

/* ============ Hero ============ */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(100px, 13vw, 130px) var(--gutter) clamp(60px, 10vw, 80px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  overflow: hidden;
  z-index: 2;
  padding-top: max(110px, calc(var(--safe-area-inset-top) + 90px));
  contain: layout style paint;
}
.hero__glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 55% 45% at 40% 55%, rgba(124,58,237,0.38), rgba(124,58,237,0.12) 45%, transparent 75%);
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

/* Full-viewport marquee — breaks out of gutter */
.marquee {
  width: 100vw;
  max-width: 100vw;
  height: clamp(80px, 12vw, 140px);
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  margin-bottom: clamp(-15px, -3vw, -20px);
  overflow: hidden;
}
.marquee svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  display: block;
  will-change: transform;
}
.marquee__text {
  font-family: 'Parkinsans', sans-serif;
  font-size: clamp(14px, 2vw, 22px);
  font-weight: 500;
  letter-spacing: 0.18em;
  fill: var(--purple);
  text-transform: uppercase;
  will-change: transform;
}

/* Hero content container */
.hero__content {
  position: relative;
  z-index: 2;
  width: 100%;
}

/* Name + status badge on same row */
.hero__name-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(16px, 3vw, 40px);
  flex-wrap: wrap;
}

.hero__name {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(48px, 13vw, 200px);
  line-height: 1.02;
  letter-spacing: -0.01em;
  background: linear-gradient(180deg, #FFFFFF 0%, var(--lilac) 55%, #BFA6FF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  padding: 0.05em 0 0.2em;
  word-break: break-word;
}
.hero__name span {
  display: inline-block;
}
.hero__name span + span {
  margin-left: 0.12em;
}

/* "Open to roles" status badge */
.hero__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: clamp(8px, 1vw, 10px) clamp(14px, 2vw, 20px);
  background: rgba(22, 16, 31, 0.75);
  border: 1px solid rgba(74, 222, 128, 0.35);
  border-radius: 999px;
  font-family: 'Parkinsans', sans-serif;
  font-size: clamp(12px, 1.1vw, 15px);
  font-weight: 500;
  color: var(--text);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  white-space: nowrap;
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 0.18em; /* optical alignment with name baseline */
  -webkit-user-select: none;
  user-select: none;
}
.hero__status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6);
  flex-shrink: 0;
  animation: status-pulse 2.4s ease-in-out infinite;
}
@keyframes status-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(74, 222, 128, 0.65); }
  50%  { box-shadow: 0 0 0 5px rgba(74, 222, 128, 0);   }
  100% { box-shadow: 0 0 0 0   rgba(74, 222, 128, 0);   }
}
@media (prefers-reduced-motion: reduce) {
  .hero__status-dot { animation: none; }
}

.hero__intro {
  position: relative;
  z-index: 2;
  margin-top: clamp(16px, 3vw, 26px);
  max-width: 560px;
  font-size: clamp(14px, 1.4vw, 20px);
  color: var(--text-dim);
  line-height: 1.6;
}

/* ============ Section headers ============ */
.section__header {
  max-width: var(--max);
  margin: 0 auto clamp(40px, 7vw, 56px);
  padding: 0 var(--gutter);
}
.section__label {
  display: inline-block;
  font-size: clamp(10px, 1.5vw, 12px);
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--purple);
  margin-bottom: clamp(10px, 2vw, 14px);
}
.section__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(36px, 7vw, 104px);
  line-height: 1;
  color: var(--text);
  word-break: break-word;
}

/* ============ Projects ============ */
.projects {
  padding: clamp(100px, 15vw, 140px) 0;
  position: relative;
  z-index: 2;
}
.projects__grid {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(14px, 2vw, 22px);
  grid-auto-rows: clamp(240px, 45vw, 380px);
}
.project {
  grid-column: span var(--span, 3);
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-2);
  transition: transform .6s cubic-bezier(.2,.8,.2,1), border-color .35s ease;
  isolation: isolate;
  will-change: transform;
  contain: layout style paint;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.project:hover,
.project:focus-visible { 
  border-color: rgba(167, 139, 250, 0.55);
}
.project__media {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--c1, #7c3aed), var(--c2, #a78bfa));
  transition: transform .7s cubic-bezier(.2,.8,.2,1), filter .35s ease;
  will-change: transform;
}
.project:hover .project__media,
.project:focus-visible .project__media {
  transform: scale(1.06);
  filter: brightness(1.12) saturate(1.1);
}
.project::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(14,10,20,0.75) 100%);
  pointer-events: none;
  z-index: 1;
}
.project__meta {
  position: absolute;
  left: clamp(18px, 4vw, 26px);
  bottom: clamp(18px, 4vw, 26px);
  right: clamp(18px, 4vw, 26px);
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: clamp(12px, 2vw, 16px);
}
.project__name {
  font-family: var(--display);
  font-size: clamp(18px, 2.2vw, 36px);
  font-weight: 400;
  color: #FFFFFF;
  line-height: 1;
  word-break: break-word;
}
.project__type {
  font-size: clamp(9px, 1vw, 11px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.92);
  padding: clamp(6px, 1vw, 7px) clamp(10px, 2vw, 14px);
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  white-space: nowrap;
}

/* ============ About ============ */
.about { 
  padding: clamp(100px, 15vw, 120px) 0; 
  position: relative; 
  z-index: 2;
  contain: layout style;
}
.about__text {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(18px, 2.8vw, 40px);
  line-height: 1.3;
  color: var(--text);
  word-break: break-word;
}
.about__text p { 
  margin-bottom: clamp(28px, 6vw, 44px);
}
.about__text p:last-child { 
  margin-bottom: 0;
}
.about__text em {
  font-style: normal;
  color: var(--lilac);
}
.about__text .word {
  position: relative;
  display: inline-block;
  color: var(--purple);
  cursor: help;
  border-bottom: 2px dashed rgba(167,139,250,0.45);
  transition: color .3s ease;
  outline: none;
}
.about__text .word:hover { 
  color: var(--lilac);
}
.about__text .word:focus-visible {
  outline: 2px solid var(--lilac);
  outline-offset: 2px;
  border-radius: 2px;
  color: var(--lilac);
}
.about__text .word::after {
  content: attr(data-detail);
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 6px);
  font-family: 'Parkinsans', sans-serif;
  font-size: clamp(12px, 1.5vw, 14px);
  font-weight: 400;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: clamp(8px, 1vw, 10px) clamp(10px, 2vw, 14px);
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, visibility 0s .25s;
  visibility: hidden;
  z-index: 5;
  box-shadow: 0 10px 32px -8px rgba(0,0,0,0.6);
}
.about__text .word:hover::after,
.about__text .word:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 14px);
  transition: opacity .25s ease, transform .25s ease, visibility 0s;
}
.about__text .resume {
  font-family: 'Parkinsans', sans-serif;
  font-size: 0.38em;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #1A0F2E;
  background: var(--lilac);
  padding: 0.45em 0.8em;
  border-radius: 12px;
  vertical-align: middle;
  display: inline-block;
  box-shadow: 0 0 28px -6px rgba(232,221,255,0.55);
  transition: transform .25s ease, box-shadow .3s ease;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  will-change: transform;
}
.about__text .resume:hover,
.about__text .resume:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 0 40px -2px rgba(232,221,255,0.85);
}
.about__text .resume:focus-visible {
  outline: 2px solid #1A0F2E;
  outline-offset: 2px;
}

/* ============ Contact ============ */
.contact {
  padding: clamp(100px, 15vw, 120px) 0 clamp(100px, 15vw, 140px);
  position: relative;
  z-index: 2;
  contain: layout style;
}
.contact__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: clamp(48px, 7vw, 96px);
  align-items: start;
}
/* Left column: label, title, tagline, mail */
.contact__left .section__label {
  display: inline-block;
  font-size: clamp(10px, 1.5vw, 12px);
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--purple);
  margin-bottom: clamp(10px, 2vw, 14px);
}
.contact__left .section__title {
  margin-bottom: clamp(14px, 2vw, 20px);
}
.contact__tagline {
  font-size: clamp(14px, 1.3vw, 16px);
  color: var(--text-dim);
  line-height: 1.65;
}

/* ---- Animated envelope ---- */
.contact__mail {
  margin-top: clamp(40px, 7vw, 72px);
}
.mail-svg {
  width: clamp(90px, 14vw, 160px);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 0 28px rgba(167, 139, 250, 0.25));
}

/* SVG path draw-on animation */
.mail-rect {
  stroke-dasharray: 430;
  stroke-dashoffset: 430;
}
.mail-flap {
  stroke-dasharray: 155;
  stroke-dashoffset: 155;
}
.mail-seam {
  stroke-dasharray: 65;
  stroke-dashoffset: 65;
}
.mail-sparkles {
  opacity: 0;
  transform-origin: 112px 26px;
  transform: scale(0.4);
}

/* Triggered when .contact__mail gets .is-visible (added by JS) */
.contact__mail.is-visible .mail-rect {
  animation: mail-draw 1s cubic-bezier(.4,0,.2,1) forwards 0.1s;
}
.contact__mail.is-visible .mail-flap {
  animation: mail-draw 0.7s cubic-bezier(.4,0,.2,1) forwards 0.9s;
}
.contact__mail.is-visible .mail-seam--l {
  animation: mail-draw 0.45s ease forwards 1.45s;
}
.contact__mail.is-visible .mail-seam--r {
  animation: mail-draw 0.45s ease forwards 1.6s;
}
.contact__mail.is-visible .mail-sparkles {
  animation: mail-sparkle 0.5s cubic-bezier(.2,.8,.2,1) forwards 1.9s;
}

@keyframes mail-draw {
  to { stroke-dashoffset: 0; }
}
@keyframes mail-sparkle {
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .contact__mail.is-visible .mail-rect,
  .contact__mail.is-visible .mail-flap,
  .contact__mail.is-visible .mail-seam--l,
  .contact__mail.is-visible .mail-seam--r {
    stroke-dashoffset: 0;
    animation: none;
  }
  .contact__mail.is-visible .mail-sparkles {
    opacity: 1;
    transform: scale(1);
    animation: none;
  }
}

/* Right column: form */
.contact__form {
  display: grid;
  gap: clamp(16px, 2vw, 22px);
}
.field { 
  display: flex; 
  flex-direction: column; 
  gap: clamp(6px, 1vw, 8px);
}
.field label {
  font-size: clamp(9px, 1.2vw, 11px);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--purple);
  font-weight: 600;
}
.field input, 
.field textarea {
  width: 100%;
  padding: clamp(12px, 2vw, 16px) clamp(14px, 2vw, 20px);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  transition: border-color .3s ease, background .3s ease, box-shadow .25s ease;
  resize: vertical;
  font-family: inherit;
  min-height: 44px;
  will-change: border-color, background;
}
.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-dim);
}
.field input:focus, 
.field textarea:focus {
  outline: none;
  border-color: var(--lilac);
  background: rgba(167, 139, 250, 0.08);
  box-shadow: 0 0 0 3px rgba(232, 221, 255, 0.1);
}
.field textarea {
  min-height: 140px;
}
.contact__submit {
  justify-self: start;
  padding: clamp(14px, 1.5vw, 16px) clamp(24px, 3vw, 34px);
  background: var(--lilac);
  color: #1A0F2E;
  font-weight: 600;
  font-size: clamp(13px, 1.2vw, 15px);
  border-radius: var(--radius);
  box-shadow: 0 0 32px -6px rgba(232,221,255,0.55);
  transition: transform .25s ease, box-shadow .3s ease;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}
.contact__submit:hover,
.contact__submit:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 0 44px -2px rgba(232,221,255,0.9);
}
.contact__submit:focus-visible {
  outline: 2px solid var(--lilac);
  outline-offset: 2px;
}
.contact__status {
  font-size: clamp(12px, 1vw, 14px);
  color: var(--text-dim);
  min-height: 1.2em;
  font-family: 'Parkinsans', sans-serif;
}
.contact__status.is-success { 
  color: #B8F0CE;
}
.contact__status.is-error { 
  color: #F5B5C5;
}

/* ============ Footer ============ */
.footer {
  padding: clamp(40px, 5vw, 48px) var(--gutter) clamp(48px, 8vw, 64px);
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 2;
  contain: layout style;
}
.footer__inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: clamp(16px, 3vw, 24px);
  flex-wrap: wrap;
}
.footer__logo { 
  font-family: var(--display); 
  font-size: clamp(18px, 2vw, 22px);
}
.footer__back-to-top {
  font-size: clamp(10px, 1.1vw, 12px);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--purple);
  font-weight: 600;
  transition: color .25s ease;
  outline-offset: 4px;
  display: flex;
  align-items: center;
  min-height: 44px;
  -webkit-user-select: none;
  user-select: none;
}

.footer__back-to-top:hover,
.footer__back-to-top:focus-visible {
  color: var(--lilac);
}

.footer__back-to-top:focus-visible {
  outline: 2px solid var(--purple);
}
.footer__social { 
  display: flex; 
  gap: clamp(14px, 3vw, 24px); 
  flex-wrap: wrap;
  justify-content: center;
}
.footer__social a {
  font-size: clamp(12px, 1.2vw, 14px);
  color: var(--text-dim);
  transition: color .25s ease;
  min-height: 44px;
  display: flex;
  align-items: center;
  outline-offset: 4px;
}
.footer__social a:hover,
.footer__social a:focus-visible { 
  color: var(--lilac);
}
.footer__social a:focus-visible {
  outline: 2px solid var(--lilac);
}
.footer__copy { 
  font-size: clamp(11px, 1vw, 13px); 
  color: var(--text-dim);
  width: 100%;
  text-align: center;
  order: 3;
}

/* ============ Custom cursor (desktop only) ============ */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--lilac);
  pointer-events: none;
  z-index: 200;
  mix-blend-mode: difference;
  transition: width .3s cubic-bezier(.2,.8,.2,1),
              height .3s cubic-bezier(.2,.8,.2,1),
              background .3s ease,
              mix-blend-mode 0s .15s;
  display: none;
  will-change: transform;
}
.cursor__label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Parkinsans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #1A0F2E;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .25s ease;
  will-change: opacity;
}
.cursor.is-hover {
  width: 128px;
  height: 128px;
  mix-blend-mode: normal;
  background: var(--lilac);
  box-shadow: 0 0 40px -4px rgba(232,221,255,0.6);
}
.cursor.is-hover .cursor__label { 
  opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
  .cursor { 
    display: block;
  }
  body { 
    cursor: none;
  }
  a, button, input, textarea, label { 
    cursor: none;
  }
}

/* ============ Responsive ============ */

/* Large screens (1025px and above) */
@media (max-width: 1440px) {
  .projects__grid {
    grid-auto-rows: clamp(240px, 40vw, 380px);
  }
}

/* Tablets and larger (1024px and below) */
@media (max-width: 1024px) {
  .projects__grid {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: clamp(220px, 35vw, 320px);
    gap: clamp(12px, 2vw, 18px);
  }
  .project { 
    grid-column: span 2 !important;
  }
  .nav__link {
    padding: 10px 16px;
    font-size: 13px;
  }
}

/* Medium tablets (769px to 1024px) */
@media (max-width: 1022px) and (min-width: 769px) {
  .hero { 
    padding-top: max(100px, calc(var(--safe-area-inset-top) + 80px));
  }
  .marquee { 
    height: clamp(70px, 10vw, 100px);
  }
}

/* Tablets and phones (768px and below) */
@media (max-width: 768px) {
  .back-pill {
    top: max(12px, var(--safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right, 0));
    padding: clamp(8px, 1.2vw, 10px) clamp(12px, 2vw, 16px);
    font-size: clamp(9px, 1vw, 11px);
    gap: clamp(4px, 1vw, 6px);
  }
  .nav {
    padding: 8px var(--gutter);
  }
  .nav__inner {
    padding: 6px 6px 6px 14px;
  }
  .nav__link {
    padding: 8px 12px;
    font-size: 12px;
  }

  .hero {
    min-height: 100dvh;
    padding-top: max(90px, calc(var(--safe-area-inset-top) + 70px));
    padding-bottom: clamp(40px, 8vw, 60px);
  }
  .hero__glow { opacity: 0.7; }
  .hero__status {
    font-size: 12px;
    padding: 7px 13px;
  }
  .marquee {
    height: clamp(60px, 10vw, 90px);
    margin-bottom: clamp(-10px, -2vw, -15px);
  }
  .marquee__text {
    font-size: clamp(12px, 1.8vw, 16px);
    letter-spacing: 0.14em;
  }

  .section__header {
    margin-bottom: clamp(32px, 6vw, 40px);
  }

  .projects {
    padding: clamp(80px, 12vw, 100px) 0;
  }
  .projects__grid {
    grid-template-columns: 1fr;
    grid-auto-rows: clamp(200px, 50vw, 280px);
    gap: clamp(12px, 3vw, 16px);
  }
  .project {
    grid-column: span 1 !important;
  }
  .project__meta {
    left: clamp(14px, 3vw, 20px);
    right: clamp(14px, 3vw, 20px);
    bottom: clamp(14px, 3vw, 20px);
    gap: clamp(10px, 2vw, 14px);
  }

  .about {
    padding: clamp(80px, 12vw, 100px) 0;
  }
  .about__text {
    font-size: clamp(16px, 4vw, 28px);
  }
  .about__text p {
    margin-bottom: clamp(20px, 4vw, 32px);
  }
  .about__text .word::after {
    white-space: normal;
    max-width: clamp(180px, 70vw, 240px);
    font-size: clamp(11px, 1.5vw, 13px);
    left: 50%;
    transform: translate(-50%, 6px);
  }

  /* Contact: stack on mobile */
  .contact {
    padding: clamp(80px, 12vw, 100px) 0 clamp(80px, 12vw, 120px);
  }
  .contact__inner {
    grid-template-columns: 1fr;
    gap: clamp(40px, 8vw, 56px);
  }
  .contact__mail {
    margin-top: clamp(28px, 5vw, 40px);
  }
  .contact__form {
    gap: clamp(14px, 2.5vw, 20px);
  }

  .footer__inner {
    flex-direction: column;
    text-align: center;
    gap: clamp(12px, 2vw, 18px);
  }
  .footer__social {
    justify-content: center;
    width: 100%;
  }
  .footer__copy {
    margin-top: clamp(8px, 1vw, 12px);
  }
}

/* Small phones (480px and below) */
@media (max-width: 640px) {
  :root {
    --gutter: 16px;
  }

  .logo-mark {
    font-size: 16px;
    padding: 8px 10px;
  }
  
  .back-pill {
    font-size: 10px;
    padding: 8px 10px;
    gap: 4px;
  }
  
  .nav {
    padding: 8px 16px;
  }
  .nav__inner {
    padding: 5px 5px 5px 12px;
  }
  .nav__logo {
    font-size: 17px;
  }
  .nav__link {
    padding: 7px 10px;
    font-size: 11px;
  }

  .hero {
    min-height: 100dvh;
    padding: max(80px, calc(var(--safe-area-inset-top) + 64px)) 16px 40px;
  }
  .hero__name-row {
    flex-wrap: wrap;
    gap: 12px;
  }
  .hero__status {
    align-self: auto;
    margin-bottom: 0;
  }
  .marquee {
    height: clamp(50px, 12vw, 70px);
    margin-bottom: clamp(-8px, -1.5vw, -12px);
  }
  .marquee__text {
    font-size: clamp(11px, 2vw, 14px);
    letter-spacing: 0.12em;
  }

  .projects__grid {
    gap: clamp(10px, 2.5vw, 14px);
  }

  .section__label {
    font-size: 10px;
  }

  .about__text p {
    margin-bottom: clamp(20px, 5vw, 28px);
  }

  .field input,
  .field textarea {
    padding: 12px 14px;
    font-size: 16px;
  }
  .field textarea {
    min-height: 120px;
  }

  .contact__submit {
    width: 100%;
    justify-self: stretch;
    text-align: center;
  }

  .footer__logo {
    font-size: 16px;
  }
}

/* Extra small phones (under 480px) */
@media (max-width: 479px) {
  .nav__link {
    padding: 8px 10px;
  }
  .projects__grid {
    row-gap: clamp(10px, 2vw, 12px);
  }
}

/* Large phones/small tablets (480px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  .projects__grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: clamp(180px, 40vw, 260px);
  }
  .project {
    grid-column: span 1 !important;
  }
}

/* Landscape mode adjustments */
@media (orientation: landscape) and (max-height: 700px) {
  .hero {
    min-height: auto;
    padding: max(60px, var(--safe-area-inset-top)) var(--gutter) 40px;
  }
  .marquee {
    height: clamp(40px, 8vh, 60px);
    margin-bottom: -8px;
  }
  .hero__name {
    font-size: clamp(36px, 8vh, 80px);
  }
  .hero__intro {
    display: none;
  }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .grain {
    opacity: 0.03;
  }
}

/* Motion preferences ============ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .logo-mark,
  .nav,
  .project,
  .project__media,
  .about__text .resume,
  .contact__submit {
    will-change: auto;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E0A14;
    --bg-2: #16101F;
  }
}

/* High contrast mode */
@media (prefers-contrast: more) {
  :root {
    --border: rgba(245, 240, 255, 0.25);
  }
  .field input:focus,
  .field textarea:focus {
    box-shadow: 0 0 0 4px rgba(232, 221, 255, 0.2);
  }
}