:root {
  --bg: #fbf9f5;
  --ink: #2c2c2c;
  --ink-muted: #4a4a4a;
  --brand: #3f4f42;
  --border: #ebe6dc;
  --pad: clamp(1.5rem, 7vw, 5.5rem);
  --max: 1500px;
  --about-max: 42rem;
  --work-max: 1120px;
  --header-h: 5.25rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-ui: "Poppins", system-ui, sans-serif;
  --font-body: "Esteban", "Georgia", serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.is-locked {
  overflow: hidden;
}

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

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

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

/* --- Header --- */
.site-header {
  --header-veil: 1;
  position: sticky;
  top: 0;
  z-index: 70;
  min-height: var(--header-h);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: clamp(1rem, 2.5vw, 2rem);
  padding: 1.75rem var(--pad) 1.5rem;
  background: color-mix(in srgb, var(--bg) calc(var(--header-veil) * 92%), transparent);
  pointer-events: none;
}

.site-header .nav-toggle,
.site-header .site-title {
  pointer-events: auto;
  opacity: var(--header-veil);
  transform: translate3d(0, calc((1 - var(--header-veil)) * -0.45rem), 0);
  filter: blur(calc((1 - var(--header-veil)) * 1.5px));
}

.site-header.is-away .nav-toggle,
.site-header.is-away .site-title {
  pointer-events: none;
}

.site-header.is-away:focus-within,
body.nav-open .site-header {
  --header-veil: 1 !important;
  background: var(--bg);
}

.site-header.is-away:focus-within .nav-toggle,
.site-header.is-away:focus-within .site-title,
body.nav-open .site-header .nav-toggle,
body.nav-open .site-header .site-title {
  pointer-events: auto;
  opacity: 1;
  transform: none;
  filter: none;
}

@media (min-width: 1321px) {
  .site-header .nav-list {
    pointer-events: auto;
    opacity: var(--header-veil);
    transform: translate3d(0, calc((1 - var(--header-veil)) * -0.35rem), 0);
    filter: blur(calc((1 - var(--header-veil)) * 1.25px));
  }

  .site-header.is-away .nav-list {
    pointer-events: none;
  }

  .site-header.is-away:focus-within .nav-list,
  body.nav-open .site-header .nav-list {
    pointer-events: auto;
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header .nav-toggle,
  .site-header .site-title,
  .site-header .nav-list {
    transform: none;
    filter: none;
  }
}

.nav-toggle {
  display: none;
  position: relative;
  z-index: 80;
  grid-column: 1;
  justify-self: start;
  width: 1.65rem;
  height: 1.35rem;
}

.nav-toggle__bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand);
  border-radius: 1px;
  transition:
    transform 0.4s var(--ease),
    top 0.4s var(--ease);
}

.nav-toggle__bar:first-child {
  top: 0.28rem;
}

.nav-toggle__bar:last-child {
  top: 0.85rem;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:first-child {
  top: 0.56rem;
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:last-child {
  top: 0.56rem;
  transform: rotate(-45deg);
}

.site-nav {
  position: relative;
  z-index: 1;
  grid-column: 1;
  justify-self: start;
  min-width: 0;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.7rem clamp(0.65rem, 1.4vw, 1.15rem);
}

.nav-list a {
  font-family: var(--font-body);
  font-size: clamp(0.88rem, 1.15vw, 1.05rem);
  color: var(--ink);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.nav-list a:hover,
.nav-list a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

.site-title {
  position: relative;
  z-index: 80;
  justify-self: center;
  grid-column: 2;
  font-family: var(--font-body);
  font-size: clamp(1.25rem, 2.2vw, 1.85rem);
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--brand);
  white-space: nowrap;
}

/* Collapse to hamburger before nav and title collide (incl. ~150% zoom) */
@media (max-width: 1320px) {
  .site-header {
    grid-template-columns: 2.5rem 1fr 2.5rem;
    padding: 1.15rem var(--pad);
  }

  .nav-toggle {
    display: block;
  }

  .site-title {
    font-size: clamp(1.25rem, 5vw, 1.65rem);
  }

  .site-nav {
    position: fixed;
    inset: 0;
    z-index: 75;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    background: #ffffff;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.35s var(--ease),
      visibility 0.35s var(--ease);
  }

  body.nav-open .site-nav {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .nav-list {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
    transform: translateY(12px);
    transition: transform 0.4s var(--ease);
  }

  body.nav-open .nav-list {
    transform: none;
  }

  .nav-list a {
    font-size: clamp(1.4rem, 4.5vw, 1.85rem);
    color: var(--brand);
  }
}

/* --- Home hero --- */
.page-home {
  min-height: calc(100vh - var(--header-h));
}

.hero {
  min-height: calc(100vh - var(--header-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 5vw, 3.5rem) var(--pad);
}

.hero-frame {
  width: min(72vmin, 640px);
  aspect-ratio: 1;
  opacity: 0;
  transform: scale(0.985) translateY(10px);
  animation: hero-in 1s var(--ease) 0.15s forwards;
}

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

@keyframes hero-in {
  to {
    opacity: 1;
    transform: none;
  }
}

/* --- About --- */
.page-about {
  padding: clamp(2rem, 6vw, 4rem) var(--pad) clamp(4rem, 10vw, 6.5rem);
}

.about-layout {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(240px, 0.95fr) minmax(280px, 1.15fr);
  gap: clamp(1.75rem, 5vw, 3.5rem);
  align-items: start;
  opacity: 0;
  transform: translateY(14px);
  animation: fade-up 0.85s var(--ease) 0.1s forwards;
}

.about-photo {
  margin: 0;
  aspect-ratio: 1;
  overflow: hidden;
  background: #e6e2d8;
}

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

.about-copy {
  padding-top: 0.15rem;
}

.about-copy p {
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 1.85vw, 1.22rem);
  line-height: 1.65;
  color: var(--brand);
  margin: 0 0 1.25em;
}

.about-copy p:last-child {
  margin-bottom: 0;
}

.about-copy a {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.about-copy a:hover {
  opacity: 0.65;
}

.about-copy strong {
  font-weight: 700;
}

@media (max-width: 800px) {
  .about-layout {
    grid-template-columns: 1fr;
    max-width: 28rem;
  }

  .about-photo {
    max-width: 22rem;
    margin: 0 auto;
    width: 100%;
  }
}

/* --- Work grid --- */
.page-work {
  padding: clamp(3.5rem, 8vw, 5.75rem) var(--pad) clamp(4.5rem, 11vw, 7rem);
  max-width: var(--work-max);
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.work-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(0.9rem, 1.6vw, 1.25rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 560px) {
  .work-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 860px) {
  .work-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.work-card {
  opacity: 0;
  transform: translateY(16px);
  animation: fade-up 0.7s var(--ease) forwards;
}

.work-card:nth-child(1) { animation-delay: 0.05s; }
.work-card:nth-child(2) { animation-delay: 0.1s; }
.work-card:nth-child(3) { animation-delay: 0.15s; }
.work-card:nth-child(4) { animation-delay: 0.2s; }
.work-card:nth-child(5) { animation-delay: 0.25s; }
.work-card:nth-child(6) { animation-delay: 0.3s; }
.work-card:nth-child(7) { animation-delay: 0.35s; }
.work-card:nth-child(8) { animation-delay: 0.4s; }
.work-card:nth-child(9) { animation-delay: 0.45s; }
.work-card:nth-child(10) { animation-delay: 0.5s; }
.work-card:nth-child(11) { animation-delay: 0.55s; }
.work-card:nth-child(12) { animation-delay: 0.6s; }

.work-card a {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: #f3f3f3;
}

.work-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.55s var(--ease);
}

.work-card a:hover img {
  transform: scale(1.04);
}

.work-tile {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.35rem;
  aspect-ratio: 1;
  width: 100%;
  padding: clamp(1rem, 3vw, 1.5rem);
  color: #f7f7f7;
  transition: transform 0.55s var(--ease), filter 0.35s ease;
}

.work-tile:hover {
  transform: scale(1.02);
  filter: brightness(1.06);
}

.work-tile__label {
  font-family: var(--font-ui);
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.work-tile__meta {
  font-family: var(--font-body);
  font-size: clamp(0.85rem, 1.6vw, 0.95rem);
  opacity: 0.82;
}

button.work-tile {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.work-tile--1 { background: linear-gradient(145deg, #1c1c1c, #3a3a3a); }
.work-tile--2 { background: linear-gradient(145deg, #15202b, #2f4a63); }
.work-tile--3 { background: linear-gradient(145deg, #1e2a1e, #3d5a3d); }
.work-tile--4 { background: linear-gradient(145deg, #1f1812, #4a3a28); }
.work-tile--5 { background: linear-gradient(145deg, #1a2428, #3d555c); }
.work-tile--6 { background: linear-gradient(145deg, #241828, #4a3558); }
.work-tile--7 { background: linear-gradient(145deg, #182028, #35506a); }
.work-tile--8 { background: linear-gradient(145deg, #111111, #2e2e2e); }

.work-media {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: #111;
}

.work-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.55s var(--ease);
}

.work-media:hover img {
  transform: scale(1.04);
}

.work-media--arvp {
  background: #1a2226;
}

.work-media--arvp img {
  object-fit: cover;
  object-position: center center;
}

.work-media--signbridge {
  background: #2a2a2a;
}

.work-media--signbridge img {
  object-fit: cover;
  object-position: center center;
}

.work-media--syllasync {
  background: #0b1c3a;
}

.work-media--syllasync img {
  object-fit: cover;
  object-position: center center;
}

.work-media--mathtools {
  background: #0f1419;
}

.work-media--mathtools img {
  object-fit: cover;
  object-position: center center;
}

.work-media__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: clamp(0.85rem, 2.5vw, 1.25rem);
  color: #f7f7f7;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
}

.work-media .work-tile__meta {
  color: #f0f0f0;
}

button.work-media {
  width: 100%;
  text-align: left;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* --- Project modal --- */
.project-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s var(--ease), visibility 0.28s;
}

.project-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.project-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.55);
}

.project-modal__box {
  position: relative;
  z-index: 1;
  width: min(100%, 30rem);
  max-height: min(92vh, 52rem);
  overflow: auto;
  background: var(--bg);
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
  transform: translateY(10px) scale(0.98);
  transition: transform 0.28s var(--ease);
}

.project-modal.has-media .project-modal__box {
  width: min(100%, 54rem);
  padding: 0;
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  align-items: stretch;
}

.project-modal.is-open .project-modal__box {
  transform: none;
}

.project-modal__close {
  position: absolute;
  top: 0.55rem;
  right: 0.75rem;
  z-index: 2;
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink);
  background: rgba(251, 249, 245, 0.88);
  opacity: 0.85;
}

.project-modal__close:hover {
  opacity: 1;
}

.project-modal__media {
  background: #1a1a1a;
  min-height: 14rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.project-modal__slider {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-modal__img {
  width: 100%;
  height: auto;
  max-height: min(70vh, 34rem);
  object-fit: contain;
  display: block;
}

.project-modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 2.35rem;
  height: 2.35rem;
  border: 0;
  border-radius: 999px;
  background: rgba(251, 249, 245, 0.92);
  color: var(--brand);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.9;
}

.project-modal__nav:hover {
  opacity: 1;
}

.project-modal__prev {
  left: 0.35rem;
}

.project-modal__next {
  right: 0.35rem;
}

.project-modal__dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.45rem;
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  pointer-events: none;
}

.project-modal__dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  border: 0;
  padding: 0;
  background: rgba(251, 249, 245, 0.45);
  pointer-events: auto;
  cursor: pointer;
}

.project-modal__dot.is-active {
  background: #fbf9f5;
}

.project-modal__body {
  padding: 1.75rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.project-modal:not(.has-media) .project-modal__body {
  padding: 0;
}

.project-modal__title {
  margin: 0 0 0.75rem;
  padding-right: 2rem;
  font-family: var(--font-ui);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.project-modal__text {
  margin: 0 0 1.25rem;
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--ink-muted);
}

.project-modal__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.project-modal__links a {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.project-modal__links a:hover {
  opacity: 0.65;
}

@media (max-width: 800px) {
  .project-modal.has-media .project-modal__box {
    grid-template-columns: 1fr;
    width: min(100%, 28rem);
  }

  .project-modal__media {
    min-height: 12rem;
    padding: 0.75rem;
  }

  .project-modal__img {
    max-height: min(42vh, 18rem);
  }
}

/* --- Resume --- */
.page-resume {
  padding: clamp(2rem, 6vw, 4rem) var(--pad) clamp(4rem, 10vw, 6.5rem);
}

.resume-inner {
  max-width: 60rem;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(14px);
  animation: fade-up 0.85s var(--ease) 0.1s forwards;
}

.resume-actions {
  margin-bottom: 1.5rem;
}

.resume-download {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.55rem 1rem;
  border: 1px solid var(--brand);
  color: var(--brand);
  transition: background 0.25s ease, color 0.25s ease;
}

.resume-download:hover {
  background: var(--brand);
  color: var(--bg);
}

.resume-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.resume-name {
  margin: 0 0 0.5rem;
  font-family: var(--font-body);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--brand);
  text-transform: uppercase;
}

.resume-contact {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(0.82rem, 1.35vw, 0.95rem);
  line-height: 1.5;
  color: var(--ink-muted);
  white-space: nowrap;
}

.resume-contact a {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.resume-meta {
  white-space: nowrap;
}

.resume-section {
  margin-bottom: 1.35rem;
}

.resume-section h2 {
  margin: 0 0 0.65rem;
  padding-bottom: 0.35rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand);
  border-bottom: 1px solid var(--brand);
}

.resume-entry {
  margin-bottom: 0.85rem;
}

.resume-entry__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.1rem;
}

.resume-entry__title {
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--brand);
}

.resume-entry__org {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--brand);
}

.resume-entry--stack .resume-entry__main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

.resume-entry--stack .resume-entry__org {
  display: block;
  margin-top: 0.15rem;
}

.resume-entry__sub {
  margin: 0.15rem 0 0;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.resume-status {
  margin: 0.55rem 0 0;
  padding-left: 1.15rem;
  width: 100%;
  max-width: 28rem;
}

.resume-status li {
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink-muted);
  margin-bottom: 0.15rem;
}

.resume-entry__date,
.resume-entry__loc {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--ink-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.resume-entry ul {
  margin: 0.35rem 0 0;
  padding-left: 1.15rem;
}

.resume-entry li {
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink-muted);
  margin-bottom: 0.2rem;
}

.resume-skills {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--ink-muted);
}

@media (max-width: 640px) {
  .resume-entry__row {
    flex-direction: column;
    gap: 0.15rem;
  }

  .resume-entry__date,
  .resume-entry__loc {
    white-space: normal;
  }

  .resume-contact,
  .resume-meta {
    white-space: normal;
  }
}

/* --- Contact --- */
.page-contact {
  padding: clamp(2.5rem, 8vw, 5.5rem) var(--pad) clamp(4rem, 12vw, 7rem);
}

.contact-inner {
  max-width: var(--about-max);
  margin: 0 auto;
  opacity: 0;
  transform: translateY(14px);
  animation: fade-up 0.85s var(--ease) 0.1s forwards;
}

.contact-intro {
  font-family: var(--font-body);
  font-size: clamp(1.15rem, 2.2vw, 1.35rem);
  line-height: 1.65;
  color: var(--ink-muted);
  margin: 0 0 2.5rem;
}

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.35rem;
}

.contact-list li {
  display: grid;
  gap: 0.25rem;
}

.contact-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}

.contact-list a,
.contact-list span:not(.contact-label) {
  font-family: var(--font-body);
  font-size: clamp(1.1rem, 2vw, 1.25rem);
  color: var(--ink-muted);
}

.contact-list a {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.contact-list a:hover {
  opacity: 0.65;
}

/* --- Photography --- */
.page-photo {
  padding: clamp(1.5rem, 4vw, 2.5rem) var(--pad) clamp(3rem, 8vw, 5rem);
  max-width: var(--max);
  margin: 0 auto;
}

.photo-coming-soon {
  margin: 0;
  min-height: calc(70vh - var(--header-h));
  display: grid;
  place-items: center;
  font-family: var(--font-body);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  letter-spacing: 0.02em;
  color: var(--brand);
  text-align: center;
  cursor: default;
  user-select: none;
}

.page-photo.is-unlocked .photo-coming-soon {
  display: none;
}

.photo-vault[hidden] {
  display: none !important;
}

.page-photo.is-unlocked .photo-vault {
  display: block;
}

.photo-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 1;
  column-gap: clamp(0.75rem, 1.8vw, 1.25rem);
}

@media (min-width: 560px) {
  .photo-grid {
    columns: 2;
  }
}

@media (min-width: 900px) {
  .photo-grid {
    columns: 3;
  }
}

@media (min-width: 1280px) {
  .photo-grid {
    columns: 4;
  }
}

.photo-card {
  break-inside: avoid;
  margin: 0 0 clamp(0.75rem, 1.8vw, 1.25rem);
  overflow: hidden;
  background: #ebe6dc;
  opacity: 0;
  transform: translateY(14px);
  animation: fade-up 0.75s var(--ease) forwards;
}

.photo-card:nth-child(6n + 1) { animation-delay: 0.04s; }
.photo-card:nth-child(6n + 2) { animation-delay: 0.1s; }
.photo-card:nth-child(6n + 3) { animation-delay: 0.16s; }
.photo-card:nth-child(6n + 4) { animation-delay: 0.22s; }
.photo-card:nth-child(6n + 5) { animation-delay: 0.28s; }
.photo-card:nth-child(6n + 6) { animation-delay: 0.34s; }

.photo-card img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.6s var(--ease);
}

.photo-trigger {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  text-align: left;
}

.photo-card:hover img {
  transform: scale(1.025);
}

/* Photo lightbox */
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2.5rem);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s var(--ease), visibility 0.28s;
}

.photo-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.photo-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 12, 12, 0.88);
  cursor: zoom-out;
}

.photo-lightbox__figure {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: min(96vw, 1400px);
  max-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-lightbox__img {
  display: block;
  max-width: 96vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.photo-lightbox__close {
  position: absolute;
  top: 0.85rem;
  right: 1rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  line-height: 1;
  color: #fbf9f5;
  opacity: 0.85;
  cursor: pointer;
}

.photo-lightbox__close:hover {
  opacity: 1;
}

.photo-lightbox__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  line-height: 1;
  color: #fbf9f5;
  opacity: 0.8;
  cursor: pointer;
}

.photo-lightbox__nav:hover {
  opacity: 1;
}

.photo-lightbox__prev {
  left: 0.5rem;
}

.photo-lightbox__next {
  right: 0.5rem;
}

@media (max-width: 700px) {
  .photo-lightbox__nav {
    top: auto;
    bottom: 1rem;
    transform: none;
  }

  .photo-lightbox__prev {
    left: calc(50% - 3.5rem);
  }

  .photo-lightbox__next {
    right: calc(50% - 3.5rem);
  }
}

@keyframes fade-up {
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .hero-frame,
  .about-layout,
  .contact-inner,
  .resume-inner,
  .work-card,
  .photo-card {
    opacity: 1;
    transform: none;
  }
}
