/* ==========================================================================
   1. Reset
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
a {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
}

a {
  text-decoration: none;
}

/* ==========================================================================
   2. Tokens
   ========================================================================== */

:root {
  --bg: #050814;
  --bg-elevated: #0a0f1e;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);

  --text: #e8eef8;
  --text-muted: #8b9bb8;
  --text-dim: #5a6a86;

  --cyan: #22d3ee;
  --blue: #3b82f6;
  --purple: #a855f7;
  --magenta: #e879f9;
  --indigo: #6366f1;

  --gradient-primary: linear-gradient(135deg, var(--cyan), var(--blue), var(--purple));
  --gradient-soft: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(168, 85, 247, 0.15));

  --radius: 16px;
  --radius-sm: 10px;
  --radius-full: 9999px;

  --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.15);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);

  --font-sans: "Outfit", "Segoe UI", sans-serif;
  --font-display: "Syne", "Outfit", "Segoe UI", sans-serif;

  --header-h: 64px;
  --container: 1080px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.45s;

  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--cyan);
}

/* ==========================================================================
   3. Base
   ========================================================================== */

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
}

body.is-nav-open {
  overflow: hidden;
}

.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}

.btn:focus-visible,
.nav__toggle:focus-visible,
.project-card:focus-visible,
.project-card__link:focus-visible,
.nav__link:focus-visible {
  box-shadow: var(--focus-ring);
}

/* ==========================================================================
   4. Background
   ========================================================================== */

.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  will-change: transform;
  animation: orb-float 28s var(--ease-soft) infinite alternate;
}

.orb--blue {
  width: min(55vw, 480px);
  height: min(55vw, 480px);
  background: var(--blue);
  top: -10%;
  left: -8%;
  animation-duration: 32s;
}

.orb--cyan {
  width: min(40vw, 360px);
  height: min(40vw, 360px);
  background: var(--cyan);
  top: 35%;
  right: -12%;
  opacity: 0.3;
  animation-duration: 26s;
  animation-delay: -6s;
}

.orb--purple {
  width: min(50vw, 420px);
  height: min(50vw, 420px);
  background: var(--purple);
  bottom: 5%;
  left: 15%;
  opacity: 0.35;
  animation-duration: 36s;
  animation-delay: -12s;
}

.orb--magenta {
  width: min(35vw, 300px);
  height: min(35vw, 300px);
  background: var(--magenta);
  top: 55%;
  right: 20%;
  opacity: 0.25;
  animation-duration: 30s;
  animation-delay: -4s;
}

@keyframes orb-float {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(4%, 6%) scale(1.08);
  }
  100% {
    transform: translate(-3%, 3%) scale(0.95);
  }
}

.pointer-glow {
  display: none;
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    circle,
    rgba(34, 211, 238, 0.07) 0%,
    rgba(59, 130, 246, 0.04) 35%,
    transparent 70%
  );
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.4s ease;
  will-change: transform;
}

@media (pointer: fine) {
  .pointer-glow {
    display: block;
  }

  .pointer-glow.is-active {
    opacity: 1;
  }
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 2;
}

/* ==========================================================================
   5. Navigation
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(5, 8, 20, 0.72);
  border-bottom: 1px solid var(--border);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--header-h);
  position: relative;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.nav__toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 110;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
}

.nav__toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.35s var(--ease-out), opacity 0.25s ease, width 0.25s ease;
  transform-origin: center;
}

.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(2) {
  opacity: 0;
  width: 0;
}

.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav__overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 20, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.nav__overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.nav__menu {
  position: fixed;
  top: var(--header-h);
  right: 1rem;
  left: 1rem;
  z-index: 105;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.25rem;
  background: rgba(12, 18, 36, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card), 0 0 60px rgba(59, 130, 246, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px) scale(0.98);
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out), visibility 0.35s;
  pointer-events: none;
}

.nav__menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.nav__link {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.25s ease, background 0.25s ease, transform 0.35s var(--ease-out), opacity 0.35s ease;
  opacity: 0;
  transform: translateX(12px);
}

.nav__menu.is-open .nav__link {
  opacity: 1;
  transform: translateX(0);
}

.nav__menu.is-open li:nth-child(1) .nav__link {
  transition-delay: 0.05s;
}

.nav__menu.is-open li:nth-child(2) .nav__link {
  transition-delay: 0.1s;
}

.nav__menu.is-open li:nth-child(3) .nav__link {
  transition-delay: 0.15s;
}

.nav__menu.is-open li:nth-child(4) .nav__link {
  transition-delay: 0.2s;
}

.nav__link:hover,
.nav__link:focus-visible {
  color: var(--text);
  background: var(--surface-hover);
}

@media (min-width: 768px) {
  .nav__toggle {
    display: none;
  }

  .nav__overlay {
    display: none !important;
  }

  .nav__menu {
    position: static;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
  }

  .nav__link {
    opacity: 1;
    transform: none;
    min-height: 44px;
    padding: 0.5rem 0.9rem;
    font-size: 0.925rem;
  }
}

/* ==========================================================================
   6. Hero
   ========================================================================== */

.hero {
  padding: 3rem 0 4rem;
  min-height: calc(100dvh - var(--header-h));
  display: flex;
  align-items: center;
}

.hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 640px;
  margin-inline: auto;
}

.hero__avatar {
  margin-bottom: 1.75rem;
}

.avatar {
  position: relative;
  width: 112px;
  height: 112px;
}

.avatar__ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    var(--cyan),
    var(--blue),
    var(--purple),
    var(--magenta),
    var(--cyan)
  );
  animation: ring-spin 8s linear infinite, ring-pulse 4s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.45));
}

.avatar__ring::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--bg);
}

.avatar__core {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #0e1630, #0a1020);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 30px rgba(59, 130, 246, 0.15);
  z-index: 1;
  overflow: hidden;
}

.avatar__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 50%;
  display: block;
}

.avatar__initials {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@keyframes ring-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes ring-pulse {
  0%,
  100% {
    filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.35));
    opacity: 0.9;
  }
  50% {
    filter: drop-shadow(0 0 18px rgba(168, 85, 247, 0.5));
    opacity: 1;
  }
}

.hero__name {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 8vw, 3.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}

.section__title,
.project-card__title,
.page-404__title,
.page-404__code {
  font-family: var(--font-display);
}

.hero__firstname,
.hero__lastname {
  display: block;
}

.hero__role {
  font-size: 1rem;
  font-weight: 500;
  color: var(--cyan);
  letter-spacing: 0.04em;
  margin-bottom: 1.25rem;
}

.hero__bio {
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 28ch;
  margin-bottom: 2rem;
}

.hero__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 320px;
}

/* Buttons */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  overflow: hidden;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s ease, background 0.3s ease, border-color 0.3s ease;
  isolation: isolate;
}

.btn--primary {
  color: #fff;
  background: var(--gradient-primary);
  background-size: 200% 200%;
  border: 1px solid transparent;
  box-shadow: 0 4px 24px rgba(59, 130, 246, 0.35), 0 0 40px rgba(34, 211, 238, 0.12);
}

.btn--primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255, 255, 255, 0.35) 50%,
    transparent 60%
  );
  transform: translateX(-120%);
  transition: transform 0.6s var(--ease-out);
  z-index: -1;
}

.btn--primary:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 32px rgba(59, 130, 246, 0.5), 0 0 50px rgba(168, 85, 247, 0.2);
}

.btn--primary:hover::before {
  transform: translateX(120%);
}

.btn--primary:active {
  transform: scale(0.98);
}

.btn--ghost {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn--ghost:hover {
  background: var(--surface-hover);
  border-color: rgba(34, 211, 238, 0.35);
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.12);
  transform: scale(1.02);
}

.btn--ghost:active {
  transform: scale(0.98);
}

/* Hero intro stagger */
.reveal-hero {
  opacity: 0;
  transform: translateY(24px);
  filter: blur(6px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out), filter 0.7s var(--ease-out);
}

.reveal-hero.is-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

.reveal-hero[data-hero-step="0"] {
  transition-delay: 0.1s;
}
.reveal-hero[data-hero-step="1"] {
  transition-delay: 0.35s;
}
.reveal-hero[data-hero-step="2"] {
  transition-delay: 0.55s;
}
.reveal-hero[data-hero-step="3"] {
  transition-delay: 0.75s;
}
.reveal-hero[data-hero-step="4"] {
  transition-delay: 0.95s;
}

/* ==========================================================================
   7. Technologies
   ========================================================================== */

.section {
  padding: 4rem 0;
}

.section__header {
  margin-bottom: 2rem;
}

.section__header--center {
  text-align: center;
}

.section__eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 0.5rem;
}

.section__title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tech-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.tech-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.55rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s var(--ease-out), background 0.3s ease;
}

.tech-chip:hover {
  border-color: rgba(34, 211, 238, 0.4);
  background: var(--surface-hover);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.12);
  transform: translateY(-2px);
}

.tech-chip__icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

.tech-chip__icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.tech-chip__label {
  white-space: nowrap;
}

/* ==========================================================================
   8. Projects
   ========================================================================== */

.projects__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s ease, border-color 0.4s ease;
  cursor: pointer;
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(34, 211, 238, 0.5),
    rgba(59, 130, 246, 0.2),
    rgba(168, 85, 247, 0.5)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.55;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.project-card:hover,
.project-card:focus-within {
  border-color: rgba(34, 211, 238, 0.35);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 40px rgba(59, 130, 246, 0.2);
}

.project-card:hover::before,
.project-card:focus-within::before {
  opacity: 1;
}

@media (pointer: fine) {
  .project-card:hover {
    transform: translateY(-5px);
  }
}

.project-card__visual {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  transition: transform 0.45s var(--ease-out);
}

.project-card:hover .project-card__visual {
  transform: translateY(-4px) scale(1.02);
}

.project-card__art {
  width: 100%;
  max-width: 280px;
  height: auto;
}

.project-card__body {
  position: relative;
  z-index: 1;
  padding-right: 3rem;
}

.project-card__title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}

.project-card__desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.project-card__arrow {
  position: absolute;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-soft);
  border: 1px solid var(--border-strong);
  color: var(--cyan);
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s ease, background 0.35s ease;
}

.project-card:hover .project-card__arrow {
  transform: translateX(4px);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.25);
  background: rgba(34, 211, 238, 0.12);
}

.project-card__link {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
}

.project-card__link:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--cyan);
}

/* ==========================================================================
   9. CTA
   ========================================================================== */

.cta-panel {
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.cta-panel::before {
  content: "";
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.2), transparent 70%);
  pointer-events: none;
}

.cta-panel__text {
  color: var(--text-muted);
  max-width: 36ch;
  margin: 0.75rem auto 0;
  font-size: 0.95rem;
}

.cta-panel__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.75rem;
  max-width: 320px;
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   10. Footer
   ========================================================================== */

.site-footer {
  padding: 2.5rem 0 2rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

.footer__brand {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.footer__location {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer__pin {
  color: var(--cyan);
  display: flex;
}

.footer__copy {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* ==========================================================================
   11. Animations (Scroll Reveal)
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(30px);
  filter: blur(4px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out), filter 0.7s var(--ease-out);
  transition-delay: calc(var(--stagger, 0) * 0.1s);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* ==========================================================================
   12. Responsive
   ========================================================================== */

@media (min-width: 480px) {
  .hero__actions {
    flex-direction: row;
    max-width: none;
    justify-content: center;
  }

  .hero__actions .btn {
    min-width: 140px;
  }

  .cta-panel__actions {
    flex-direction: row;
    max-width: none;
    justify-content: center;
  }

  .cta-panel__actions .btn {
    min-width: 140px;
  }
}

@media (min-width: 768px) {
  .hero {
    padding: 4rem 0 5rem;
  }

  .avatar {
    width: 128px;
    height: 128px;
  }

  .avatar__initials {
    font-size: 2rem;
  }

  .hero__bio {
    max-width: 36ch;
  }

  .section {
    padding: 5rem 0;
  }

  .projects__grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }

  .projects__grid .project-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    max-width: calc(50% - 0.75rem);
    justify-self: center;
  }

  .cta-panel {
    padding: 3.5rem 3rem;
  }

  .footer__inner {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }

  .footer__copy {
    margin-top: 0;
  }
}

@media (min-width: 1024px) {
  :root {
    --header-h: 72px;
  }

  .container {
    width: min(100% - 3rem, var(--container));
  }

  .hero__bio br {
    display: inline;
  }

  .tech-grid {
    gap: 0.85rem;
  }

  .projects__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .projects__grid .project-card:last-child:nth-child(odd) {
    grid-column: auto;
    max-width: none;
    justify-self: stretch;
  }

  .project-card {
    min-height: 320px;
    padding: 1.5rem;
  }
}

@media (min-width: 1440px) {
  :root {
    --container: 1140px;
  }

  .orb {
    filter: blur(100px);
  }
}

/* Small phones */
@media (max-width: 359px) {
  .container {
    width: min(100% - 1.5rem, var(--container));
  }

  .hero__name {
    font-size: 2rem;
  }

  .tech-chip {
    font-size: 0.8rem;
    padding: 0.45rem 0.85rem;
  }
}

/* ==========================================================================
   13. Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .orb {
    animation: none !important;
  }

  .avatar__ring {
    animation: none !important;
  }

  .pointer-glow {
    display: none !important;
  }

  .reveal,
  .reveal-hero {
    opacity: 1;
    transform: none;
    filter: none;
  }

  .project-card:hover {
    transform: none;
  }

  .btn--primary::before {
    display: none;
  }
}

/* ==========================================================================
   404 Page extras (shared file)
   ========================================================================== */

.page-404 {
  min-height: calc(100dvh - var(--header-h));
  display: flex;
  align-items: center;
  padding: 3rem 0 4rem;
}

.page-404__inner {
  position: relative;
  text-align: center;
  max-width: 560px;
  margin-inline: auto;
}

.page-404__code {
  position: relative;
  font-size: clamp(6rem, 22vw, 10rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 40px rgba(59, 130, 246, 0.4));
  margin-bottom: 1rem;
  animation: glitch-subtle 6s ease-in-out infinite;
}

.page-404__code::before,
.page-404__code::after {
  content: "404";
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0.7;
  pointer-events: none;
}

.page-404__code::before {
  clip-path: inset(0 0 55% 0);
  transform: translate(-2px, 0);
  animation: glitch-top 5s ease-in-out infinite;
}

.page-404__code::after {
  clip-path: inset(50% 0 0 0);
  transform: translate(2px, 0);
  animation: glitch-bottom 5s ease-in-out infinite;
  animation-delay: 0.15s;
}

@keyframes glitch-subtle {
  0%,
  92%,
  100% {
    transform: none;
    filter: drop-shadow(0 0 40px rgba(59, 130, 246, 0.4));
  }
  93% {
    transform: translate(-1px, 0.5px);
    filter: drop-shadow(2px 0 20px rgba(232, 121, 249, 0.5));
  }
  94% {
    transform: translate(1px, -0.5px);
  }
  95% {
    transform: none;
  }
}

@keyframes glitch-top {
  0%,
  90%,
  100% {
    transform: translate(0);
    opacity: 0;
  }
  91% {
    opacity: 0.6;
    transform: translate(-3px, -1px);
  }
  93% {
    opacity: 0;
    transform: translate(2px, 1px);
  }
}

@keyframes glitch-bottom {
  0%,
  88%,
  100% {
    transform: translate(0);
    opacity: 0;
  }
  89% {
    opacity: 0.55;
    transform: translate(3px, 1px);
  }
  91% {
    opacity: 0;
    transform: translate(-2px, -1px);
  }
}

.page-404__title {
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.page-404__text {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 1rem;
}

.page-404__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 320px;
  margin-inline: auto;
}

@media (min-width: 480px) {
  .page-404__actions {
    flex-direction: row;
    max-width: none;
    justify-content: center;
  }

  .page-404__actions .btn {
    min-width: 150px;
  }
}

.code-particles {
  position: absolute;
  inset: -20% -10%;
  pointer-events: none;
  overflow: hidden;
  z-index: -1;
  opacity: 0.35;
}

.code-particles span {
  position: absolute;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  font-size: 0.75rem;
  color: var(--cyan);
  opacity: 0.4;
  animation: particle-drift 18s linear infinite;
  white-space: nowrap;
}

.code-particles span:nth-child(1) {
  top: 10%;
  left: 8%;
  animation-duration: 22s;
  color: var(--blue);
}
.code-particles span:nth-child(2) {
  top: 25%;
  right: 12%;
  animation-duration: 16s;
  animation-delay: -4s;
  color: var(--purple);
}
.code-particles span:nth-child(3) {
  top: 55%;
  left: 5%;
  animation-duration: 20s;
  animation-delay: -8s;
}
.code-particles span:nth-child(4) {
  top: 70%;
  right: 8%;
  animation-duration: 24s;
  animation-delay: -2s;
  color: var(--magenta);
}
.code-particles span:nth-child(5) {
  top: 40%;
  left: 40%;
  animation-duration: 19s;
  animation-delay: -6s;
  color: var(--indigo);
}
.code-particles span:nth-child(6) {
  top: 15%;
  left: 55%;
  animation-duration: 21s;
  animation-delay: -10s;
}

@keyframes particle-drift {
  0% {
    transform: translateY(0) translateX(0);
    opacity: 0.15;
  }
  50% {
    opacity: 0.45;
  }
  100% {
    transform: translateY(-30px) translateX(10px);
    opacity: 0.15;
  }
}

.page-404__orb {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(70vw, 320px);
  height: min(70vw, 320px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.25), transparent 70%);
  filter: blur(40px);
  z-index: -2;
  animation: orb-float 20s ease-in-out infinite alternate;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .page-404__code,
  .page-404__code::before,
  .page-404__code::after {
    animation: none !important;
  }

  .code-particles span {
    animation: none !important;
  }

  .page-404__orb {
    animation: none !important;
  }
}
