/* ============================================================
   Joan Sandoval — Portfolio
   Aesthetic: dark, swiss, grotesk, blue accent
   ============================================================ */

/* Self-hosted webfont: Inter variable (one file, all weights).
   SIL Open Font License — see assets/fonts/inter/LICENSE.txt */

@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/inter/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-sans: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --bg: #000000;
  --ink: #ffffff;
  --ink-soft: #b3b3b3;
  --muted: #888888;
  --muted-dark: #767676;
  --line: #1d1d1d;
  /* One UI blue; translucent treatments follow the same accent automatically. */
  --accent: #00bbff;
  --accent-wash: color-mix(in srgb, var(--accent) 8%, transparent);
  --on-accent: #1a1a1a;

  --gutter: clamp(16px, 2vw, 24px);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-panel: cubic-bezier(0.77, 0, 0.18, 1);

  --text-nav: 22px;
  --text-index: clamp(18px, 2vw, 28px);
  --text-display: clamp(40px, 7.5vw, 100px);
  --text-body: 20px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

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

.responsive-image {
  display: block;
  width: 100%;
  height: 100%;
}

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

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

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

.skip-link {
  position: fixed;
  top: 12px;
  left: var(--gutter);
  z-index: 300;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  transform: translateY(calc(-100% - 24px));
  transition: transform 0.2s var(--ease-out);
}

.skip-link:focus { transform: translateY(0); }

::selection { background: var(--accent); color: var(--on-accent); }

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

/* ------------------------------------------------------------
   Page transitions
   ------------------------------------------------------------ */

main {
  flex: 1;
  min-width: 0;
  transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
  padding-top: var(--header-h, 96px);
}

body.has-transitions:not(.is-loaded) main { opacity: 0; transform: translateY(12px); }
body.is-loaded main { opacity: 1; transform: none; }
body.is-leaving main { opacity: 0; transform: none; transition-duration: 0.32s; }

/* ------------------------------------------------------------
   Loading overlay (first visit in a tab, and on refresh)
   ------------------------------------------------------------ */

#loading {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: none;
  place-items: center;
  transition: transform 0.8s var(--ease-panel);
}

#loading.is-active { display: grid; }

#loading .wordmark {
  position: relative;
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 700;
  letter-spacing: -0.03em;
  opacity: 0;
  transform-origin: 50% 100%;
  animation: intro-fade .1s var(--ease-out) .05s forwards,
             intro-unfold .5s var(--ease-out) .1s both;
}

/* Keep the final name width reserved; only the brackets move across it. */
#loading .wordmark .name-bracket {
  position: relative;
  animation: intro-bracket-left .65s var(--ease-out) .65s both;
}

#loading .wordmark .name-bracket--end { animation-name: intro-bracket-right; }

#loading .wordmark .name-text { animation: intro-name-reveal .55s var(--ease-out) .75s both; }

@keyframes intro-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes intro-unfold {
  from { transform: scaleY(.04); }
  to { transform: scaleY(1); }
}

@keyframes intro-bracket-left {
  from { left: calc(50% - .04em); transform: translateX(-100%); }
  to { left: 0; transform: translateX(0); }
}

@keyframes intro-bracket-right {
  from { right: calc(50% - .04em); transform: translateX(100%); }
  to { right: 0; transform: translateX(0); }
}

@keyframes intro-name-reveal {
  from { opacity: 0; clip-path: inset(0 50%); }
  to { opacity: 1; clip-path: inset(0); }
}

#loading.is-done { transform: translateY(-101%); }
html.skip-intro #loading { display: none; }

/* Header and intro share the same blue first name and white surname. */
.logo,
#loading .wordmark { display: inline-flex; align-items: baseline; gap: .08em; }

.name-bracket { color: var(--accent); letter-spacing: 0; }
.name-bracket--end { color: var(--ink); }

.name-text { display: inline-block; vertical-align: top; white-space: nowrap; }
.name-first { color: var(--accent); }
.name-last { color: var(--ink); }

@media (forced-colors: active) {
  .name-text, .name-first, .name-last, .name-bracket { color: LinkText; }
}

/* ------------------------------------------------------------
   Header
   ------------------------------------------------------------ */

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: baseline;
  gap: 24px;
  padding: 22px var(--gutter);
  background: var(--bg);
  transform: translateY(0);
  transition: transform 1.5s var(--ease-out);
}

.site-header.is-hidden { transform: translateY(-100%); }
.site-header:focus-within { transform: none; transition: none; }

.logo {
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
  margin-right: auto;
}

.site-nav {
  display: flex;
  align-items: baseline;
  gap: clamp(12px, 1.6vw, 22px);
  font-size: var(--text-nav);
}

.site-nav a,
.site-nav button {
  position: relative;
  padding: 4px 0;
  line-height: 1.2;
  transition: color 0.32s var(--ease-out);
}

.site-nav a::after,
.site-nav button::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: 1px;
  height: 2px;
  background: currentColor;
  transition: right 0.3s var(--ease-out);
}

.site-nav a:hover::after,
.site-nav button:hover::after,
.site-nav a[aria-current="page"]::after,
.nav-contact[aria-expanded="true"]::after {
  right: 0;
  background: var(--accent);
}

.site-nav a[aria-current="page"],
.nav-contact[aria-expanded="true"] { color: var(--accent); }

body.is-leaving .site-nav a[aria-current="page"]:not(.is-transition-target) {
  color: var(--ink);
}

body.is-leaving .site-nav a[aria-current="page"]:not(.is-transition-target)::after {
  right: 100%;
}

body.is-leaving .site-nav a.is-transition-target {
  color: var(--accent);
}

body.is-leaving .site-nav a.is-transition-target::after {
  right: 0;
  background: var(--accent);
}

.nav-contact { margin-left: clamp(20px, 6vw, 120px); }

@media (max-width: 640px) {
  .site-header { flex-wrap: wrap; row-gap: 10px; }
  .logo { flex-basis: 100%; }
  .site-nav {
    width: 100%;
    min-width: 0;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: clamp(16px, 4.6vw, 18px);
  }
  .site-nav a,
  .site-nav button {
    display: inline-flex;
    align-items: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    white-space: nowrap;
  }
  .nav-contact { margin-left: 0; }
}

/* ------------------------------------------------------------
   Reveal on scroll
   ------------------------------------------------------------ */

.reveal {
  transition: opacity 0.8s ease, transform 0.8s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 60ms);
}

.reveal.is-pending:not(.is-visible) { opacity: 0; transform: translateY(16px); transition: none; }
.reveal.is-visible { opacity: 1; transform: none; }

.project-gallery .reveal { transition-delay: 0s; }

/* ------------------------------------------------------------
   Home — Selected Works
   ------------------------------------------------------------ */

.works {
  padding: clamp(40px, 7vh, 88px) var(--gutter) clamp(48px, 8vh, 96px);
}

.works-title {
  font-size: var(--text-display);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.95;
  color: var(--ink-soft);
  margin-bottom: clamp(32px, 6vh, 72px);
}

.works-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(40px, 5vh, 64px) 24px;
}

@media (max-width: 1024px) { .works-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .works-grid { grid-template-columns: minmax(0, 1fr); } }

.work-card {
  position: relative;
  min-width: 0;
  transition: opacity 0.8s ease, transform 0.45s var(--ease-out);
  transition-delay: 0s;
}

.work-card:hover,
.work-card:focus-visible {
  z-index: 1;
  transform: scale(1.015);
}

.work-card .frame {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  aspect-ratio: 4 / 3;
  background: var(--line);
}

.work-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.01);
  filter: grayscale(0.9);
  transition: transform 0.6s var(--ease-out), filter 0.7s ease;
}

.work-card:hover img,
.work-card:focus-visible img { transform: scale(1.045); filter: grayscale(0); }

@media (hover: none), (max-width: 640px) {
  .work-card img { filter: grayscale(0); }
}

.work-card h2 {
  position: relative;
  display: inline-block;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 16px;
  transition: color 0.45s ease;
  overflow-wrap: anywhere;
}

.work-card:hover h2,
.work-card:focus-visible h2 { color: var(--accent); }

.work-card h2::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: -2px;
  height: 2px;
  background: currentColor;
  transition: right 0.3s var(--ease-out);
}

.work-card:hover h2::after,
.work-card:focus-visible h2::after {
  right: 0;
  background: var(--accent);
}

.work-card p {
  font-size: 18px;
  color: var(--muted-dark);
  margin-top: 2px;
}

.work-card .work-card-author {
  color: var(--ink-soft);
}

.work-card .work-card-author + p {
  margin-top: 0;
}

/* ------------------------------------------------------------
   Index page
   ------------------------------------------------------------ */

.index-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: clamp(40px, 7vh, 88px) var(--gutter) 0;
}

.index-title {
  font-size: var(--text-display);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.95;
  color: var(--ink-soft);
  padding: 0;
}

.index-filters {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-bottom: 3px;
}

.index-filter {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  white-space: nowrap;
  transition: color 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
}

.index-filter::after {
  content: "";
  position: absolute;
  left: 12px;
  right: calc(100% - 12px);
  bottom: 3px;
  height: 1px;
  background: var(--accent);
  transition: right 0.3s var(--ease-out);
}

.index-filter span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-dark);
  transition: background-color 0.3s ease;
}

.index-filter:hover,
.index-filter:focus-visible { color: var(--ink-soft); border-color: var(--muted-dark); }

.index-filter:hover::after,
.index-filter:focus-visible::after,
.index-filter.is-active::after { right: 12px; }

.index-filter.is-active {
  color: var(--ink);
  border-color: var(--accent);
  background: var(--accent-wash);
}

.index-filter.is-active span { background: var(--accent); }

.index-section {
  padding: clamp(32px, 6vh, 72px) var(--gutter) clamp(64px, 10vh, 120px);
}

.index-head,
.index-row {
  display: grid;
  grid-template-columns: 30% 1fr 13% 9%;
  align-items: baseline;
  column-gap: 16px;
}

.index-head {
  font-size: 20px;
  color: var(--ink);
  margin-bottom: 7px;
}

.index-head span:last-child,
.index-row .year { text-align: right; }

.index-row {
  position: relative;
  font-size: var(--text-index);
  line-height: 1.28;
  letter-spacing: -0.015em;
  color: var(--muted);
  transition:
    color 0.45s ease,
    opacity 0.7s var(--ease-out) calc(var(--i, 0) * 60ms),
    transform 0.7s var(--ease-out) calc(var(--i, 0) * 60ms);
}

.index-row::before {
  content: "";
  position: absolute;
  top: 0.14em;
  bottom: 0.14em;
  left: -10px;
  width: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.3s var(--ease-out);
}

.index-row > span { min-width: 0; overflow-wrap: break-word; }

.index-row:hover,
a.index-row:focus-visible { color: var(--ink); }

.project-link-indicator {
  display: inline-block;
  margin-left: 0.18em;
  font-size: 0.8em;
  font-weight: 600;
  color: var(--muted-dark);
  transition: color 0.3s ease, transform 0.3s var(--ease-out);
}

a.index-row:hover .project-link-indicator,
a.index-row:focus-visible .project-link-indicator {
  color: var(--accent);
  transform: translateX(3px);
}

.index-row:hover::before,
a.index-row:focus-visible::before { transform: scaleY(1); }

@media (max-width: 1100px) {
  .index-heading { align-items: flex-start; flex-direction: column; gap: 24px; }
  .index-filters {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding-bottom: 6px;
  }
}

@media (max-width: 640px) {
  .index-head,
  .index-row {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 5px;
  }

  .index-head > span:first-child,
  .index-row > span:first-child { grid-column: 1; grid-row: 1; }

  .index-head > span:nth-child(2),
  .index-row > span:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }

  .index-head > span:last-child,
  .index-row .year { grid-column: 2; grid-row: 1; }

  .index-row { margin-bottom: 18px; }
  .index-row:last-child { margin-bottom: 0; }
  .index-row > span:first-child,
  .index-row .year { font-size: 16px; }

  .index-head span:nth-child(3),
  .index-row .loc { display: none; }
}

/* floating hover images */

.index-media {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.index-scroll-fade {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  height: clamp(80px, 13vh, 140px);
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), var(--bg) 88%);
  opacity: 1;
  transition: opacity 0.45s ease;
}

.index-scroll-fade.is-hidden { opacity: 0; }

.index-media figure {
  position: absolute;
  opacity: 0;
  transform: scale(0.97) translateY(8px);
  transition: opacity 1.1s ease, transform 0.9s var(--ease-out);
  will-change: opacity, transform;
}

.index-media figure.is-active { opacity: 1; transform: scale(1) translateY(0); }

.index-media img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: clamp(300px, 46vh, 480px);
  filter: grayscale(1);
  transition: filter 0.35s ease;
}

.index-media figure.is-active img {
  filter: grayscale(0);
  transition-duration: 3.25s;
}
.index-media figure.is-resetting img { filter: grayscale(1); transition: none; }

.index-media figcaption {
  position: absolute;
  left: 6px;
  bottom: 6px;
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.52);
  white-space: nowrap;
}

.index-media .pos-1 { left: 4vw;  top: 16vh; width: clamp(330px, 29vw, 440px); }
.index-media .pos-2 { left: 36vw; top: 8vh;  width: clamp(350px, 31vw, 470px); }
.index-media .pos-3 { right: 5vw; bottom: 10vh; width: clamp(330px, 28vw, 430px); }
.index-media .pos-4 { left: 10vw; bottom: 8vh;  width: clamp(340px, 29vw, 440px); }
.index-media .pos-5 { right: 12vw; top: 14vh; width: clamp(330px, 28vw, 430px); }
.index-media .pos-6 { left: 42vw; bottom: 16vh; width: clamp(340px, 30vw, 450px); }

@media (max-width: 900px), (hover: none) {
  .index-media { display: none; }
}

/* ------------------------------------------------------------
   CV / Curriculum (reuses .index-head / .index-row grid)
   ------------------------------------------------------------ */

.cv-group { margin-bottom: clamp(40px, 7vh, 72px); }
.cv-group:last-child { margin-bottom: 0; }

.cv-group-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent);
  margin: clamp(24px, 4vh, 40px) 0 12px;
}

/* ------------------------------------------------------------
   Missing page — same grid, typography and accent as the portfolio
   ------------------------------------------------------------ */

.not-found {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 40px;
  padding: clamp(40px, 7vh, 88px) var(--gutter) clamp(64px, 10vh, 120px);
}

.not-found .works-title { margin-bottom: 32px; }
.not-found-copy > p { color: var(--ink-soft); font-size: var(--text-body); }
.not-found-links { display: grid; justify-items: start; gap: 12px; margin-top: 32px; }
.not-found-links a {
  font-size: var(--text-body);
  padding: 8px 0;
  text-decoration: underline;
  text-decoration-color: var(--muted-dark);
  text-underline-offset: 6px;
}
.not-found-links a:hover { color: var(--accent); text-decoration-color: currentColor; }
.not-found-links span { color: var(--accent); margin-left: 8px; }
.not-found-art { display: block; width: 100%; max-width: 560px; justify-self: center; color: var(--accent); }
.not-found-eyes { animation: not-found-look 4.4s ease-in-out both; }

@keyframes not-found-look {
  0%, 12%, 90%, 100% { transform: translate(0, 0); }
  22%, 38% { transform: translate(-15px, 0); }
  48%, 64% { transform: translate(15px, -5px); }
  76% { transform: translate(0, 8px); }
}

@media (max-width: 640px) {
  .not-found { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .not-found-art { max-width: 360px; }
}

@media (prefers-reduced-motion: reduce) {
  .not-found-eyes { animation: none; }
}

/* ------------------------------------------------------------
   About page
   ------------------------------------------------------------ */

.about {
  padding: clamp(40px, 7vh, 88px) var(--gutter) clamp(64px, 10vh, 120px);
}

.about-title {
  font-size: var(--text-display);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.95;
  color: var(--ink-soft);
  margin-bottom: clamp(24px, 4vh, 40px);
}

.about-grid {
  display: grid;
  grid-template-columns: 32% 1fr 1fr;
  column-gap: 40px;
  row-gap: 48px;
  margin-top: clamp(56px, 10vh, 120px);
}

.about-photo {
  aspect-ratio: 4 / 5;
  border-radius: 10px;
  background: var(--line);
  color: var(--muted-dark);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

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

.about-grid p {
  font-size: var(--text-body);
  line-height: 1.55;
  color: var(--ink-soft);
}

.about-grid .col-bio { max-width: 60ch; }

@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------
   Project pages
   ------------------------------------------------------------ */

.project {
  padding: clamp(40px, 7vh, 88px) var(--gutter) clamp(64px, 10vh, 120px);
}

.project-title {
  font-size: var(--text-display);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.95;
  color: var(--ink-soft);
  max-width: 12ch;
}

.project-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px 40px;
  margin: clamp(24px, 4vh, 40px) 0 clamp(32px, 6vh, 64px);
}

.project-meta div { font-size: var(--text-index); line-height: 1.3; color: var(--ink-soft); }
.project-meta dt { margin-bottom: 7px; font-size: 20px; font-weight: 400; color: var(--ink); }

@media (max-width: 640px) {
  .project-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
  }
  .project-meta > div:nth-child(-n + 2) { grid-column: 1 / -1; }
}

.project-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.project-gallery figure { overflow: hidden; background: var(--line); }
.project-gallery .full { grid-column: 1 / -1; }

.project-gallery .has-video-fallback { position: relative; }

.video-play-fallback {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.8);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
}

.video-play-fallback[hidden] { display: none; }
.video-play-fallback:hover,
.video-play-fallback:focus-visible { border-color: var(--accent); color: var(--accent); }

.project-gallery img,
.project-gallery video,
.project-gallery iframe { width: 100%; height: 100%; object-fit: cover; border: 0; }

.project-gallery .half { aspect-ratio: 4/5; }
.project-gallery .half.portrait { aspect-ratio: 3/4; }
.project-gallery .contain img { object-fit: contain; background: var(--bg); }
.project-gallery .portrait-media {
  grid-column: 1 / -1;
  width: min(100%, 720px);
  aspect-ratio: 9/16;
  justify-self: center;
}
.project-gallery .half.landscape { aspect-ratio: 4/3; }
.project-gallery .half.widescreen { aspect-ratio: 16/9; }
.project-gallery .video-embed { aspect-ratio: 16/9; }
.project-gallery .media-stack {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 24px;
  min-height: 0;
  aspect-ratio: 4/5;
}

.project-gallery .media-stack figure {
  min-height: 0;
}

.project-gallery .mixed-media-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 25.6fr) minmax(0, 9fr);
  gap: 24px;
  align-items: stretch;
}

.project-gallery .mixed-media-row figure:first-child { aspect-ratio: 1276/797; }
.project-gallery .mixed-media-row figure:last-child { aspect-ratio: 9/16; }

@media (max-width: 640px) {
  .project-gallery { grid-template-columns: minmax(0, 1fr); }

  /* Let photographs use their real proportions on phones instead of
     cropping them into the fixed frames used by the desktop compositions. */
  .project-gallery figure:has(> .responsive-image),
  .project-gallery figure.half:has(> .responsive-image),
  .project-gallery .mixed-media-row figure:first-child:has(> .responsive-image) {
    aspect-ratio: auto;
  }

  .project-gallery figure:has(> .responsive-image) .responsive-image,
  .project-gallery figure:has(> .responsive-image) img {
    height: auto;
  }

  .project-gallery .media-stack {
    grid-template-rows: none;
    aspect-ratio: auto;
  }

  .project-gallery .mixed-media-row { grid-template-columns: minmax(0, 1fr); }
}

.project-desc {
  font-size: clamp(24px, 2.2vw, 30px);
  line-height: 1.4;
  letter-spacing: -0.01em;
  max-width: 56ch;
  margin: clamp(40px, 8vh, 80px) 0;
  color: var(--ink-soft);
}

.project-desc-source {
  display: block;
  margin-top: 14px;
  font-size: 18px;
  color: var(--muted-dark);
}

.project-gallery .has-credit { position: relative; }

.project-gallery .has-credit figcaption {
  position: absolute;
  left: 6px;
  bottom: 6px;
  z-index: 1;
  font-size: 11px;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.52);
}

@media (max-width: 640px) {
  .project-gallery .has-credit figcaption { font-size: 12px; }
}

.project-credits {
  max-width: 56ch;
  margin: calc(clamp(40px, 8vh, 80px) * -0.55) 0 clamp(40px, 8vh, 80px);
  font-size: 18px;
  line-height: 1.45;
  color: var(--muted-dark);
}

/* Keep a contribution paragraph distinct from the following dates/credits. */
.project-contribution + .project-credits { margin-top: 0; }

.project-credits h2 {
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 400;
  color: var(--ink-soft);
}

.project-credits .secondary-heading { margin-top: 24px; }

.project-credits a {
  display: inline-block;
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(118, 118, 118, 0.5);
  text-underline-offset: 0.18em;
  transition: color 0.3s ease, text-decoration-color 0.3s ease;
}

.project-credits a:hover,
.project-credits a:focus-visible {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.next-project {
  display: block;
  margin-top: clamp(56px, 10vh, 120px);
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.next-project span {
  display: block;
  font-size: 14px;
  color: var(--muted-dark);
  margin-bottom: 8px;
}

.next-project strong {
  position: relative;
  display: inline-block;
  font-size: clamp(32px, 5vw, 64px);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--ink-soft);
  transition: color 0.45s ease;
}

.next-project strong::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: -4px;
  height: 2px;
  background: currentColor;
  transition: right 0.3s var(--ease-out);
}

.next-project:hover strong { color: var(--accent); }

.next-project:hover strong::after {
  right: 0;
  background: var(--accent);
}

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 24px;
  padding: 12px var(--gutter) 14px;
  font-size: 12px;
  color: var(--muted-dark);
}

.site-footer a { transition: color 0.45s ease; }
.site-footer a:hover { color: var(--accent); }

.site-footer noscript { margin-left: auto; }
.site-footer .contact-fallback {
  color: var(--ink-soft);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.site-footer .contact-fallback:hover { color: var(--accent); }

/* ------------------------------------------------------------
   Contact panel (slides from below)
   ------------------------------------------------------------ */

.contact-scrim {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.48);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

body.contact-open .contact-scrim { opacity: 1; pointer-events: auto; }

.contact-panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  min-height: clamp(250px, 31vh, 330px);
  background: #0b0b0b;
  color: var(--ink);
  border-top: 2px solid var(--accent);
  transform: translateY(101%);
  transition: transform 0.55s var(--ease-panel);
  padding: 12px var(--gutter) clamp(32px, 5vh, 56px);
}

body.contact-open .contact-panel { transform: translateY(0); }

.contact-inner {
  display: grid;
  grid-template-columns: minmax(180px, 0.65fr) minmax(0, 1.35fr);
  min-width: 0;
  align-items: center;
  gap: clamp(32px, 6vw, 96px);
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.contact-greeting {
  font-size: clamp(32px, 5vw, 64px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.contact-greeting-typing {
  display: inline-block;
  min-height: 1em;
  white-space: nowrap;
}

.contact-greeting-typing::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 0.85em;
  margin-left: 0.08em;
  vertical-align: -0.02em;
  background: currentColor;
}

body.contact-open .contact-greeting-typing::after {
  animation: contact-cursor-blink 1.2s step-end infinite;
}

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

.contact-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(24px, 4vh, 40px);
  min-width: 0;
}

.contact-email a {
  display: inline-flex;
  max-width: 100%;
  font-size: clamp(30px, 5.2vw, 72px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  transition: color 0.3s var(--ease-out);
}

.contact-social {
  display: flex;
  align-items: baseline;
  gap: 16px;
  font-size: var(--text-body);
}

.contact-social span { color: var(--muted); }

.contact-social a {
  color: var(--ink-soft);
  transition: color 0.3s var(--ease-out);
}

.contact-social a,
.contact-email a { position: relative; }

.contact-social a::after,
.contact-email a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: -3px;
  height: 2px;
  background: var(--accent);
  transition: right 0.3s var(--ease-out);
}

.contact-social a:hover::after,
.contact-social a:focus-visible::after,
.contact-email a:hover::after,
.contact-email a:focus-visible::after { right: 0; }

.contact-social a:hover,
.contact-social a:focus-visible,
.contact-email a:hover,
.contact-email a:focus-visible { color: var(--accent); }

.contact-close {
  position: static;
  justify-self: end;
  z-index: 1;
  font-size: 17px;
  color: var(--ink-soft);
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
}

.contact-close:hover,
.contact-close:focus-visible { color: var(--accent); }

@media (max-width: 760px) {
  .contact-panel {
    top: 0;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding:
      calc(12px + env(safe-area-inset-top))
      max(var(--gutter), env(safe-area-inset-right))
      calc(28px + env(safe-area-inset-bottom))
      max(var(--gutter), env(safe-area-inset-left));
  }

  .contact-inner {
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    align-items: start;
    gap: clamp(44px, 8vh, 72px);
    min-height: 0;
  }

  .contact-greeting { font-size: clamp(44px, 13vw, 64px); }
  .contact-details { gap: 24px; }
  .contact-email { width: 100%; }
  .contact-email a {
    display: block;
    width: 100%;
    font-size: clamp(24px, 7.2vw, 36px);
    overflow-wrap: anywhere;
  }
  .contact-social { flex-direction: column; gap: 5px; font-size: 18px; }
}

/* ------------------------------------------------------------
   Reduced motion
   ------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body.contact-open .contact-greeting-typing::after { animation: none; }
  .name-text { animation: none !important; }

  main,
  .reveal,
  .work-card,
  .work-card img,
  .site-header,
  .index-media figure,
  .contact-panel,
  .contact-scrim,
  #loading {
    transition: none !important;
    animation: none !important;
  }

  main, .reveal,
  body.has-transitions:not(.is-loaded) main,
  .reveal.is-pending:not(.is-visible) { opacity: 1; transform: none; }
  #loading, #loading.is-active { display: none; }
  .work-card { transform: none !important; }
}
