/**
 * home_2 — design system and layout
 *
 * Visual language: luxury editorial (gold metallics + layered pastel mesh).
 * Semantic colors are CSS variables on :root / [data-theme="dark"] only.
 * Avoid hard-coded accent RGB in components — add tokens above and reference var(...).
 *
 * Motion: ambient (CSS), scroll reveals (Observer), hero accents.
 * prefers-reduced-motion collapses non-essential animation.
 */

/* -------------------------------------------------------------------------- */
/* Design tokens                                                                */
/* -------------------------------------------------------------------------- */
:root {
  color-scheme: light;
  /* Serif for headlines + refined sans for UI/body (luxury editorial pairing). */
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Outfit", system-ui, sans-serif;

  /* Gold scale — shared accent for light/dark (champagne / brushed gold). */
  --gold-100: #f7f0e3;
  --gold-200: #efe6d4;
  --gold-400: #c9a962;
  --gold-500: #b8945f;
  --gold-600: #9c7d4e;
  --gold-700: #7a6340;

  /* Pastel mesh (blue / pink / purple) for ambient gradients. */
  --pastel-blue: #c5dff5;
  --pastel-pink: #f7d4e6;
  --pastel-purple: #e4d6f7;

  --accent: var(--gold-500);
  /* Text placed on gold buttons / skip link for WCAG contrast on metallic fills. */
  --accent-foreground: #1c1611;
  --accent-soft: color-mix(in srgb, var(--gold-400) 20%, var(--gold-100) 80%);
  --accent-glow: color-mix(in srgb, var(--gold-400) 45%, transparent);
  /* Decorative borders tinted with gold (replaces ad-hoc teal RGB literals). */
  --accent-ring: color-mix(in srgb, var(--gold-500) 42%, transparent);
  --accent-ring-strong: color-mix(in srgb, var(--gold-500) 55%, transparent);

  /* Light: white-forward surfaces, warm neutrals, gold punctuation. */
  --bg0: #ffffff;
  --bg1: #faf8f5;
  --surface: color-mix(in srgb, #ffffff 76%, transparent);
  --surface-strong: color-mix(in srgb, #ffffff 94%, transparent);
  --text: #1a1614;
  --muted: #5e5852;
  --line: rgba(26, 22, 20, 0.1);

  --shadow-sm: 0 2px 16px color-mix(in srgb, var(--gold-700) 8%, transparent);
  --shadow-md: 0 22px 56px color-mix(in srgb, var(--gold-700) 14%, transparent);
  --shadow-glow: 0 0 0 1px var(--line), 0 28px 72px color-mix(in srgb, var(--gold-500) 18%, transparent);

  /* Card/media placeholders — pastel-led, no one-off purple RGB. */
  --media-gradient-start: color-mix(in srgb, var(--pastel-blue) 55%, white);
  --media-gradient-end: color-mix(in srgb, var(--pastel-pink) 50%, white);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --space-section-y: clamp(4rem, 10vw, 7rem);
  --content-max: 72rem;
  --header-h: 4.25rem;
  /**
   * Horizontal rhythm: same inset for header, sections, and dialog margins.
   * Scales with viewport so content never hugs narrow edges on large displays.
   */
  --pad-x: clamp(1rem, 4vw, 2.75rem);
  /**
   * Fill at least one dynamic viewport height minus header (see @supports below for dvh/svh).
   * Used for sections and main so the active route always “anchors” to the window.
   */
  --section-fill-min-height: calc(100vh - var(--header-h));

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Legacy aliases: hero conic & ambient layers read pastel trio + gold highlight. */
  --blob-a: var(--pastel-purple);
  --blob-b: var(--pastel-blue);
  --blob-c: var(--pastel-pink);
}

[data-theme="dark"] {
  color-scheme: dark;
  /* Deep black stack with warm undertone (not cold blue-black). */
  --bg0: #050505;
  --bg1: #0c0b0a;
  --surface: color-mix(in srgb, #121110 70%, transparent);
  --surface-strong: color-mix(in srgb, #181716 90%, transparent);
  --text: #f7f2ea;
  --muted: #b5ada3;
  --line: color-mix(in srgb, var(--gold-200) 18%, transparent);

  --gold-400: #e0c88a;
  --gold-500: #d4bc8a;
  --gold-600: #c4aa7a;
  --gold-700: #a68b5c;

  /* Pastels read as illuminated mist on black (still blue / pink / purple family). */
  --pastel-blue: #5a6d88;
  --pastel-pink: #8b6678;
  --pastel-purple: #726a8a;

  --accent: var(--gold-500);
  --accent-foreground: #120f0c;
  --accent-soft: color-mix(in srgb, var(--gold-500) 16%, transparent);
  --accent-glow: color-mix(in srgb, var(--gold-400) 42%, transparent);
  --accent-ring: color-mix(in srgb, var(--gold-500) 38%, transparent);
  --accent-ring-strong: color-mix(in srgb, var(--gold-400) 52%, transparent);

  --shadow-sm: 0 4px 28px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 28px 72px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 0 1px var(--line), 0 32px 88px color-mix(in srgb, var(--gold-600) 22%, transparent);

  --media-gradient-start: color-mix(in srgb, var(--pastel-blue) 45%, #0a0908);
  --media-gradient-end: color-mix(in srgb, var(--pastel-pink) 40%, #0a0908);

  --blob-a: var(--pastel-purple);
  --blob-b: var(--pastel-blue);
  --blob-c: var(--pastel-pink);
}

/* Prefer small viewport height on mobile (address bar), then dynamic viewport when available. */
@supports (height: 100svh) {
  :root {
    --section-fill-min-height: calc(100svh - var(--header-h));
  }
}

@supports (height: 100dvh) {
  :root {
    --section-fill-min-height: calc(100dvh - var(--header-h));
  }
}

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

html {
  scroll-behavior: smooth;
  min-height: 100%;
}

@supports (height: 100dvh) {
  html {
    min-height: 100dvh;
  }

  body {
    min-height: 100dvh;
  }
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: 0.012em;
  color: var(--text);
  background: var(--bg0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

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

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0.75rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(145deg, var(--gold-400), var(--gold-600));
  color: var(--accent-foreground);
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: var(--radius-sm);
  z-index: 9999;
}

.skip-link:focus {
  left: 0.75rem;
}

/* -------------------------------------------------------------------------- */
/* Ambient background                                                           */
/* -------------------------------------------------------------------------- */
.bg-ambient {
  position: fixed;
  inset: 0;
  z-index: -2;
  /* Pastels + gold; vmin/%-sized ellipses scale with the viewport. */
  background: radial-gradient(
      ellipse 120vmin 70vmin at 12% -12%,
      color-mix(in srgb, var(--gold-400) 28%, transparent),
      transparent 58%
    ),
    radial-gradient(
      ellipse 110vmin 65vmin at 92% 10%,
      color-mix(in srgb, var(--blob-a) 85%, transparent),
      transparent 56%
    ),
    radial-gradient(
      ellipse 95vmin 55vmin at 4% 75%,
      color-mix(in srgb, var(--blob-b) 80%, transparent),
      transparent 52%
    ),
    radial-gradient(
      ellipse 85vmin 50vmin at 88% 92%,
      color-mix(in srgb, var(--blob-c) 78%, transparent),
      transparent 52%
    ),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  opacity: 0.97;
}

.bg-ambient__noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.045;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

@media (prefers-reduced-motion: no-preference) {
  .bg-ambient {
    animation: driftHue 22s var(--ease-out-expo) infinite alternate;
  }
}

@keyframes driftHue {
  0% {
    filter: hue-rotate(-6deg) saturate(1.05);
    transform: scale(1) translate3d(0, 0, 0);
  }
  100% {
    filter: hue-rotate(10deg) saturate(1.12);
    transform: scale(1.03) translate3d(-1%, 1%, 0);
  }
}

/* -------------------------------------------------------------------------- */
/* Status banner (errors)                                                       */
/* -------------------------------------------------------------------------- */
.status-banner {
  display: none;
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  max-width: min(42rem, calc(100vw - 2 * var(--pad-x)));
  padding: 0.85rem 1.1rem;
  box-sizing: border-box;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  font-size: 0.9375rem;
}

.status-banner[aria-hidden="false"] {
  display: block;
  animation: bannerIn 0.45s var(--ease-out-expo) both;
}

@keyframes bannerIn {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* -------------------------------------------------------------------------- */
/* Header / navigation                                                          */
/* -------------------------------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: var(--header-h);
  z-index: 50;
  box-sizing: border-box;
  transition: background 0.35s var(--ease-out-expo), border-color 0.35s var(--ease-out-expo),
    box-shadow 0.35s var(--ease-out-expo), backdrop-filter 0.35s var(--ease-out-expo);
}

.site-header--scrolled {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.site-header__inner {
  width: 100%;
  max-width: calc(var(--content-max) + 2 * var(--pad-x));
  margin: 0 auto;
  padding: 0 var(--pad-x);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-sizing: border-box;
}

/* Header mark: VC monogram on Home, full wordmark on Work / Contact (toggled in JS). */
.brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--text);
  text-decoration: none;
}

.brand__monogram {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  min-height: 2.35rem;
  padding: 0.28rem 0.42rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  font-style: normal;
  letter-spacing: 0.06em;
  line-height: 1;
  color: var(--text);
  border: 1px solid var(--accent-ring);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--gold-100) 55%, var(--surface-strong));
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .brand__monogram {
  background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
}

.brand__wordmark {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: none;
  white-space: nowrap;
}

/* Home route: show boxed monogram only (wordmark visually hidden, still in DOM for hydration). */
.brand--monogram .brand__monogram {
  display: inline-flex;
}

.brand--monogram .brand__wordmark {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Work / Contact: full name, monogram hidden. */
.brand:not(.brand--monogram) .brand__wordmark {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
}

.brand:not(.brand--monogram) .brand__monogram {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.nav {
  display: none;
  align-items: center;
  gap: 0.25rem;
}

@media (min-width: 768px) {
  .nav {
    display: flex;
  }
}

.nav__link {
  position: relative;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.25s ease, background 0.25s ease, transform 0.25s var(--ease-spring);
}

.nav__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, transparent, var(--accent-soft), transparent);
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.3s var(--ease-out-expo), transform 0.3s var(--ease-out-expo);
  z-index: -1;
}

.nav__link:hover {
  color: var(--text);
}

.nav__link:hover::after {
  opacity: 1;
  transform: scale(1);
}

.nav__link[aria-current="page"] {
  color: var(--text);
}

.nav__link[aria-current="page"]::after {
  opacity: 1;
  transform: scale(1);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.icon-btn {
  width: 2.65rem;
  height: 2.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: transform 0.2s var(--ease-spring), border-color 0.2s ease, background 0.2s ease;
}

.icon-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent-ring);
}

.icon-btn:active {
  transform: scale(0.97);
}

.icon-btn svg {
  width: 1.2rem;
  height: 1.2rem;
}

.nav-mobile-toggle {
  display: flex;
  width: 2.65rem;
  height: 2.65rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
}

@media (min-width: 768px) {
  .nav-mobile-toggle {
    display: none;
  }
}

/* Mobile drawer */
.nav-mobile {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--bg0);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  transform: translateY(-100%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.55s var(--ease-out-expo), visibility 0.55s linear;
}

.nav-mobile--open {
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
}

.nav-mobile__link {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 6vw, 2.25rem);
  font-weight: 600;
  font-style: italic;
  letter-spacing: 0.02em;
  color: var(--muted);
  transition: color 0.25s ease, transform 0.35s var(--ease-out-expo);
}

.nav-mobile__link[aria-current="page"],
.nav-mobile__link:hover {
  color: var(--text);
  transform: translateX(4px);
}

/* -------------------------------------------------------------------------- */
/* Main layout & sections                                                       */
/* -------------------------------------------------------------------------- */
main {
  width: 100%;
  padding-top: var(--header-h);
  box-sizing: border-box;
}

/* Full-bleed section; inner `.stack` constrains reading width. */
.page-section {
  width: 100%;
  box-sizing: border-box;
  min-height: var(--section-fill-min-height);
  padding: var(--space-section-y) var(--pad-x);
  display: none;
  opacity: 0;
  transition: opacity 0.45s var(--ease-out-expo);
}

.page-section--active {
  display: block;
  opacity: 1;
}

/* Home: column flex so hero can grow and vertically center within the viewport slice. */
#home.page-section--active {
  display: flex;
  flex-direction: column;
}

.page-section.contact {
  text-align: center;
}

.page-section.contact.page-section--active {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1.5rem;
}

.stack {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  box-sizing: border-box;
}

.stack--home {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

.stack--contact {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* Hero: grid grows with stack; minmax keeps columns fluid down to narrow windows. */
.hero {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: end;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

@media (min-width: 960px) {
  .hero {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    align-items: center;
    align-content: center;
  }
}

.hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(3rem, 9vw, 6.25rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--text);
}

.hero__title .char {
  display: inline-block;
  transform-origin: 50% 80%;
  color: var(--text);
}

@media (prefers-reduced-motion: no-preference) {
  .hero__title .char {
    animation: charIn 0.9s var(--ease-out-expo) both;
    animation-delay: calc(var(--char-index, 0) * 0.028s);
  }
}

@keyframes charIn {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0) rotate(-4deg);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0);
  }
}

.hero__accent-line {
  margin: 1.25rem 0 0;
  height: 3px;
  width: min(14rem, 45%);
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--gold-600),
    var(--gold-400),
    color-mix(in srgb, var(--pastel-purple) 70%, var(--gold-400)),
    transparent
  );
  transform-origin: left center;
  transform: scaleX(0);
}

@media (prefers-reduced-motion: no-preference) {
  .hero__accent-line {
    animation: lineGrow 1s var(--ease-out-expo) 0.35s both;
  }
}

@keyframes lineGrow {
  to {
    transform: scaleX(1);
  }
}

.motto {
  margin: 1.25rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(1.0625rem, 2.5vw, 1.4rem);
  letter-spacing: 0.06em;
  color: var(--muted);
}

.motto__word {
  display: inline-block;
}

@media (prefers-reduced-motion: no-preference) {
  .motto__word {
    animation: mottoPop 0.7s var(--ease-spring) both;
    animation-delay: calc(var(--motto-index, 0) * 0.1s);
  }
}

@keyframes mottoPop {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  60% {
    transform: translateY(-2px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hero__card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  background: var(--surface-strong);
  border: 1px solid color-mix(in srgb, var(--gold-500) 28%, var(--line));
  box-shadow: var(--shadow-glow);
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 0.5s var(--ease-out-expo), box-shadow 0.5s var(--ease-out-expo);
}

.hero__card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 140deg, var(--blob-a), var(--blob-b), var(--blob-c), var(--blob-a));
  opacity: 0.12;
  filter: blur(36px);
  animation: spinGlow 14s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .hero__card::before {
    animation: none;
  }
}

@keyframes spinGlow {
  to {
    transform: rotate(360deg);
  }
}

.hero__card-inner {
  position: relative;
  z-index: 1;
}

.hero__bio {
  margin: 0;
  min-height: 6.5rem;
  color: var(--muted);
}

.hero__bio::after {
  content: "";
  display: inline-block;
  width: 0.5ch;
  height: 1.1em;
  margin-left: 2px;
  background: var(--accent);
  vertical-align: -0.1em;
  animation: caretBlink 1s step-end infinite;
}

.hero__bio.is-done::after {
  display: none;
}

@keyframes caretBlink {
  50% {
    opacity: 0;
  }
}

.hero__meta {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--gold-700);
  border: 1px solid var(--accent-ring);
}

[data-theme="dark"] .pill {
  color: var(--gold-400);
}

/* Work section */
.work-head {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

@media (min-width: 720px) {
  .work-head {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }
}

.work-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  letter-spacing: -0.02em;
  color: var(--text);
}

.work-tabs {
  display: flex;
  flex-wrap: wrap;
  max-width: 100%;
  padding: 0.25rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
}

.work-tab {
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: background 0.3s var(--ease-out-expo), color 0.3s ease, transform 0.25s var(--ease-spring);
}

.work-tab[aria-selected="true"] {
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--accent-ring);
  transform: translateY(-1px);
}

.work-panel {
  display: none;
}

.work-panel--active {
  display: block;
  animation: panelIn 0.55s var(--ease-out-expo) both;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/**
 * Cards collapse to one column on narrow widths and add columns as space allows
 * (minmax + auto-fit tracks the window without hard breakpoints-only logic).
 */
.card-grid {
  display: grid;
  gap: clamp(1rem, 2.5vw, 1.35rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17.5rem), 1fr));
}

.project-card {
  position: relative;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  transform: translateZ(0);
  transition: transform 0.45s var(--ease-out-expo), box-shadow 0.45s var(--ease-out-expo),
    border-color 0.35s ease;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-ring-strong);
}

.project-card:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.project-card__media {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--media-gradient-start), var(--media-gradient-end));
  position: relative;
  overflow: hidden;
}

.project-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-card__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  color: color-mix(in srgb, var(--text) 22%, transparent);
}

[data-theme="dark"] .project-card__placeholder {
  color: color-mix(in srgb, var(--text) 22%, transparent);
}

.project-card__shine {
  position: absolute;
  inset: -40% 40% 40% -60%;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255, 255, 255, 0.35) 45%,
    transparent 80%
  );
  transform: translateX(-30%) rotate(12deg);
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.8s var(--ease-out-expo);
  pointer-events: none;
}

.project-card:hover .project-card__shine {
  opacity: 0.55;
  transform: translateX(40%) rotate(12deg);
}

.project-card__body {
  padding: 1.1rem 1.15rem 1.2rem;
}

.project-card__body h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.project-card__body p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.65s var(--ease-out-expo), transform 0.65s var(--ease-out-expo);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Contact */
.contact__panel {
  width: 100%;
  max-width: min(36rem, 100%);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  box-sizing: border-box;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-glow);
}

.contact__panel h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 2.85rem);
  letter-spacing: -0.02em;
  color: var(--text);
}

.contact__cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  padding: 1rem 1.75rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
  font-style: italic;
  font-size: 1.125rem;
  letter-spacing: 0.04em;
  border: 2px solid color-mix(in srgb, var(--gold-500) 65%, var(--text));
  background: transparent;
  color: var(--text);
  overflow: hidden;
  transition: transform 0.35s var(--ease-spring), color 0.35s ease, border-color 0.35s ease;
}

.contact__cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, var(--gold-500), var(--gold-600));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-out-expo);
  z-index: -1;
}

.contact__cta:hover {
  color: var(--accent-foreground);
  border-color: var(--gold-600);
}

.contact__cta:hover::before {
  transform: scaleX(1);
}

.contact__links {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: max-height 0.55s var(--ease-out-expo), opacity 0.45s ease;
}

.contact__panel.is-open .contact__links {
  max-height: 12rem;
  opacity: 1;
  pointer-events: auto;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: transform 0.25s var(--ease-spring), border-color 0.25s ease, box-shadow 0.25s ease;
}

.contact-link:hover {
  transform: translateY(-2px);
  border-color: var(--accent-ring-strong);
  box-shadow: var(--shadow-sm);
}

.contact-link svg {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--pad-x);
  box-sizing: border-box;
  background: color-mix(in srgb, #0a0806 64%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-out-expo), visibility 0.35s linear;
}

.modal[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal__dialog {
  width: min(52rem, 100%);
  max-width: 100%;
  max-height: min(90vh, 880px);
  box-sizing: border-box;
  overflow: auto;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  transform: translateY(16px) scale(0.96);
  transition: transform 0.4s var(--ease-out-expo);
}

.modal[aria-hidden="false"] .modal__dialog {
  transform: translateY(0) scale(1);
}

.modal__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--accent-soft);
}

.modal__media-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-style: italic;
  font-size: clamp(2rem, 6vw, 3.25rem);
  letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--text) 18%, transparent);
}

[data-theme="dark"] .modal__media-placeholder {
  color: color-mix(in srgb, var(--text) 15%, transparent);
}

.modal__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal__body {
  padding: 1.35rem clamp(1rem, 3vw, 1.75rem) 1.5rem;
}

.modal__body h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.modal__body p {
  margin: 0 0 1.15rem;
  color: var(--muted);
}

.modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.06em;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: transform 0.2s var(--ease-spring), background 0.2s ease;
}

.btn--primary {
  background: linear-gradient(145deg, var(--gold-400), var(--gold-600));
  color: var(--accent-foreground);
  border-color: transparent;
}

.btn--primary:hover {
  filter: brightness(1.05);
}

.btn--ghost:hover {
  background: var(--accent-soft);
}

body.modal-open {
  overflow: hidden;
}

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