/* --- Emily Nguyen portfolio — typography: Helvetica Bold headings (-9% track), Inter 20 body --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #6e6e6e;
  --chip: #e8e8e8;
  --chip-text: #1a1a1a;
  --nav-gap: clamp(1.5rem, 4vw, 3rem);
  --page-pad-x: clamp(2rem, 5vw, 4rem);
  --max-w: 1280px;
  --tracking-tight: -0.09em;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: clamp(17px, 1.05vw + 14px, 20px);
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration: underline;
}

/* --- Heading system (Helvetica Bold, -9%) --- */
.type-display,
.type-section,
.type-project-title {
  font-family:
    "Helvetica Neue",
    Helvetica,
    Arial,
    sans-serif;
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
}

.type-display {
  font-size: clamp(3rem, 8vw + 1rem, 7.5rem);
  line-height: 0.95;
  margin: 0;
}

.type-section {
  font-size: clamp(2rem, 4vw + 1rem, 3.75rem);
  line-height: 1;
  margin: 0 0 1.75rem;
}

.type-project-title {
  font-size: 1.15rem;
  margin: 0.65rem 0 0;
}

.type-micro {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.25rem 0 0;
}

/* --- Shell --- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
}

.skip-link:focus {
  left: var(--page-pad-x);
  top: 1rem;
  z-index: 100;
  background: var(--bg);
  padding: 0.5rem 1rem;
  outline: 2px solid currentColor;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--nav-gap);
  padding: clamp(1rem, 3vw, 1.5rem) var(--page-pad-x);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.logo-mark {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  line-height: 1;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1rem, 3vw, 2rem);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  /* text-transform: lowercase; */
}

.nav-links a {
  text-decoration: none;
}

.nav-links a:hover {
  text-decoration: underline;
}

main {
  padding-bottom: clamp(4rem, 10vw, 7rem);
}

.section {
  padding: clamp(4rem, 12vw, 10rem) var(--page-pad-x);
}

.section__inner {
  max-width: var(--max-w);
  margin-inline: auto;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

/* --- Hero --- */
.hero {
  padding: clamp(0.5rem, 1.5vw, 1rem) 0 0;
  min-height: auto;
}

.hero-layout {
  max-width: var(--max-w);
  width: min(var(--max-w), calc(100% - (var(--page-pad-x) * 2)));
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1rem, 3vw, 2rem);
  align-items: start;
}

.hero-copy {
  min-width: 0;
  display: grid;
  gap: 0.9rem;
}

.hero-title-wrap {
  position: relative;
  margin-bottom: 0.25rem;
}

.hero-media-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
  gap: clamp(0.75rem, 2vw, 1.25rem);
  align-items: stretch;
  overflow: visible;
}

.hero-meta {
  padding: 0.35rem 0.75rem;
  display: grid;
  grid-template-columns: 1fr minmax(360px, 52ch);
  gap: clamp(1rem, 2vw, 1.5rem);
  align-items: start;
  justify-content: space-between;
}

.hero-title-motion {
  position: relative;
  display: inline-block;
  isolation: isolate;
}

.hero-title-motion .motion-blur-layer {
  position: absolute;
  inset: -2% -4%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 42%,
    rgba(240, 240, 240, 0.6) 70%,
    rgba(220, 220, 220, 0.85) 100%
  );
  mix-blend-mode: lighten;
  filter: blur(8px);
  opacity: 0.65;
  transform: skewX(-4deg);
  pointer-events: none;
  z-index: 1;
}

.hero-title-motion .type-display {
  position: relative;
  z-index: 2;
}

.hero-intro {
  max-width: 48ch;
  width: 100%;
  margin: 0;
  color: var(--fg);
  justify-self: end;
  text-align: right;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.4rem;
  font-size: 1.08rem;
  line-height: 1.3;
}

/* .hero-embed-shell {
  /* position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: clamp(320px, 52vh, 520px);
  /* border: 1px solid rgba(0, 0, 0, 0.06); 
  background: var(--bg);
} */

.hero-embed-shell iframe {
  display: block;
  width: 100%;
  border: 0;
}

.hero-embed-frame {
  height: clamp(300px, 50vh, 700px);
  border: 0;
}

.hero-embed-shell--title {
  max-width: 100%;
  width: 100%;
  margin-bottom: 0;
  margin-left: clamp(-72px, -6vw, -36px);
}

.hero-gif-shell {
  background: #fff;
  width: min(100%, 400px);
  min-height: clamp(220px, 50vh, 520px);
  justify-self: end;
}

.hero-gif-shell img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: invert(1);
}

@media (max-width: 860px) {
  .hero {
    padding-top: 0.5rem;
  }

  .hero-layout {
    width: 100%;
    margin-inline: 0;
  }

  .hero-media-row {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  .hero-embed-shell--title {
    margin-left: 0;
  }

  .hero-embed-frame {
    height: clamp(220px, 45vh, 320px);
  }

  .hero-gif-shell {
    width: min(100%, 88vw);
    justify-self: stretch;
    min-height: clamp(150px, 24vh, 240px);
  }

  .hero-meta {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  .hero-intro {
    max-width: 100%;
    justify-self: start;
    text-align: left;
    padding-inline: clamp(0.35rem, 2.5vw, 0.75rem);
  }

  .hero-links {
    font-size: 1rem;
    gap: 0.65rem 1rem;
    padding-inline: clamp(0.35rem, 2.5vw, 0.75rem);
  }
}

@media (max-width: 600px) {
  .hero {
    padding-top: 0.25rem;
  }

  .hero-copy {
    gap: 0.65rem;
  }

  .hero-media-row {
    gap: 0.7rem;
  }

  .hero-embed-frame {
    height: clamp(180px, 36vh, 260px);
  }

  .hero-gif-shell {
    width: min(100%, 84vw);
    min-height: clamp(120px, 20vh, 180px);
    justify-self: center;
  }

  .hero-meta {
    gap: 0.75rem;
  }
}

/* --- Filters --- */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 2rem;
}

.filter-chip {
  appearance: none;
  border: 0;
  padding: 0.45rem 0.95rem;
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  /* text-transform: uppercase; */
  cursor: pointer;
  background: var(--chip);
  color: var(--chip-text);
  border-radius: 2px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.filter-chip:hover {
  transform: translateY(-1px);
}

.filter-chip.is-active {
  background: #0a0a0a;
  color: #fff;
}

/* --- Project grid --- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: clamp(1.25rem, 3vw, 2rem);
}

.project-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

.project-card:hover .project-card-thumb {
  transform: scale(1.02);
}

.project-card-thumb {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #f2f2f2;
  border: 1px solid rgba(0, 0, 0, 0.06);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.project-card.is-hidden {
  display: none;
}

/* --- Gallery --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.75rem, 2vw, 1.25rem);
  align-items: start;
}

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

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

.gallery-cell {
  margin: 0;
  background: transparent;
  border: 0;
}

.gallery-cell img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.gallery-tile {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  font: inherit;
  color: inherit;
  text-align: inherit;
}

.gallery-tile:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.gallery-book {
  position: relative;
  display: block;
  max-width: 100%;
}

.gallery-book__open {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  font: inherit;
}

.gallery-book__open:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.gallery-book__page {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  transition: opacity 0.18s ease;
}

.gallery-book__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: clamp(2.25rem, 7vw, 3.25rem);
  height: clamp(3rem, 11vw, 4.25rem);
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: #fff;
  font-size: clamp(1.5rem, 4.5vw, 2.15rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  cursor: pointer;
  opacity: 0.55;
  text-shadow:
    0 0 1px rgba(0, 0, 0, 0.55),
    0 1px 4px rgba(0, 0, 0, 0.45);
  transition: opacity 0.15s ease;
}

.gallery-book__arrow--prev {
  left: 0.5rem;
}

.gallery-book__arrow--next {
  right: 0.5rem;
}

.gallery-book:hover .gallery-book__arrow,
.gallery-book:focus-within .gallery-book__arrow {
  opacity: 0.85;
}

.gallery-book__arrow:hover {
  opacity: 0.9;
}

.gallery-book__arrow:focus-visible {
  outline: 1px solid #fff;
  outline-offset: 2px;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .gallery-book__page {
    transition: none;
  }
}

/* Gallery lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.lightbox.is-open {
  display: flex;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(255, 255, 255, 0.92);
  cursor: zoom-out;
}

.lightbox__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: min(98vw, calc(100vw - 2rem));
  max-height: 90vh;
  margin: 0 auto;
}

.lightbox__stage {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  max-width: 100%;
  max-height: inherit;
}

.lightbox__img {
  display: block;
  flex: 0 1 auto;
  max-width: min(calc(92vw - 2.75rem), calc(100% - 2.5rem));
  max-height: 86vh;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0;
}

.lightbox__close {
  position: fixed;
  top: max(0.65rem, env(safe-area-inset-top));
  right: max(0.65rem, env(safe-area-inset-right));
  z-index: 302;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.65;
}

.lightbox__close:hover {
  opacity: 1;
}

.lightbox__close:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
  opacity: 1;
}

.lightbox__nav {
  flex-shrink: 0;
  align-self: center;
  padding: 0 0.15rem;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: #0a0a0a;
  font-size: clamp(1.35rem, 3.5vw, 1.85rem);
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s ease;
}

.lightbox__nav:hover {
  opacity: 1;
}

.lightbox__nav:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
  opacity: 1;
}

.gallery-wide {
  grid-column: span 2;
}

@media (max-width: 760px) {
  .gallery-wide {
    grid-column: auto;
  }
}

.btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.2rem;
  font: inherit;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  /* text-transform: lowercase; */
  background: var(--chip);
  color: var(--chip-text);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.btn-quiet:hover {
  background: #dcdcdc;
  transform: translateY(-1px);
  text-decoration: none;
}

/* --- About section --- */
.about-layout {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
}

@media (min-width: 900px) {
  #about-teaser .section__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: clamp(2rem, 5vw, 4rem);
  }

  #about-teaser .section-head {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
    align-items: baseline;
    justify-content: unset;
    gap: 0;
    column-gap: inherit;
  }

  #about-teaser .section-head .btn-quiet {
    justify-self: end;
  }

  #about-teaser .about-layout {
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
    column-gap: inherit;
    gap: 0;
    align-items: start;
  }

  #about-teaser .about-photo {
    justify-self: end;
    max-width: min(320px, 36vw);
  }
}

.about-text {
  max-width: 48ch;
}

/* About 3D link carousel — tweak here:
   --about-carousel-nudge-x   shift whole carousel right (+) or left (-)
   --about-carousel-tilt     overall downward tilt (rotateX; lower = flatter)
   --about-carousel-origin-x/y  pivot for the tilt
   --about-perspective          “camera” strength (higher = less dramatic depth)
   --about-perspective-origin   where vanishing point sits (%, px)
   --about-orbit-radius         link spacing on the ring (smaller = tighter)
*/
.about-links-3d {
  --about-carousel-nudge-x: clamp(96px, 12vw + 1.5rem, 220px);
  --about-carousel-tilt: 10deg;
  --about-carousel-origin-x: 20%;
  --about-carousel-origin-y: 15%;
  --about-perspective: 1200px;
  --about-perspective-origin-x: 20%;
  --about-perspective-origin-y:60%;
  --about-orbit-radius: 160px;

  margin-top: 1.5rem;
  height: clamp(268px, 38vh, 420px);
  max-width: 100%;
  perspective: var(--about-perspective);
  perspective-origin: var(--about-perspective-origin-x)
    var(--about-perspective-origin-y);
  position: relative;
  touch-action: pan-y;
  overflow: visible;
}

.about-links-scene {
  width: 100%;
  height: 100%;
  display: grid;
  justify-items: start;
  align-items: center;
  transform-style: preserve-3d;
  transform: translateX(var(--about-carousel-nudge-x))
    rotateX(var(--about-carousel-tilt));
  transform-origin: var(--about-carousel-origin-x) var(--about-carousel-origin-y);
}

.about-links-spin {
  position: relative;
  width: 1px;
  height: 1px;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
  will-change: transform;
}

.about-links-ring {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  transform-style: preserve-3d;
  padding: 0;
  margin: 0;
  border: 0;
}

.about-link-node {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 1rem;
  line-height: 1.25;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: inherit;
  text-decoration: none;
  text-underline-offset: 0.18em;
  backface-visibility: visible;
  transform: translate(-50%, -50%) rotateY(calc(var(--i) * 72deg))
    translateZ(var(--about-orbit-radius));
  transform-origin: center center;
}

.about-link-node:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.about-links-3d.is-hover-paused .about-link-node:hover,
.about-links-3d.is-hover-paused .about-link-node:focus-visible {
  text-decoration: underline;
}

.about-links-3d.is-reduced {
  height: auto;
  perspective: none;
  margin-left: 0;
  width: 100%;
  max-width: 100%;
}

.about-links-3d.is-reduced .about-links-scene {
  display: block;
  transform: none;
}

.about-links-3d.is-reduced .about-links-spin {
  width: auto;
  height: auto;
  transform: none;
}

.about-links-3d.is-reduced .about-links-ring {
  position: static;
  width: auto;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
}

.about-links-3d.is-reduced .about-link-node {
  position: static;
  transform: none;
  white-space: normal;
  backface-visibility: visible;
}

@media (max-width: 600px) {
  .about-links-3d {
    --about-carousel-tilt: 28deg;
    --about-orbit-radius: 76px;
  }

  .about-link-node {
    font-size: 0.92rem;
  }
}

@media (max-width: 899px) {
  .about-links-3d {
    --about-carousel-nudge-x: 0;
    --about-perspective-origin-x: 50%;
    --about-carousel-origin-x: 50%;
  }

  .about-links-scene {
    justify-items: center;
  }

  .about-photo {
    max-width: min(220px, 64vw);
    margin-inline: auto;
  }
}

.about-photo {
  margin: 0;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #eee;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

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

/* --- Footer --- */
.site-footer {
  background: #000000;
  color: #fafafa;
  padding: clamp(3rem, 10vw, 6rem) var(--page-pad-x);
  position: relative;
  overflow: hidden;
}

.footer-row {
  max-width: var(--max-w);
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
}

.footer-title {
  margin: 0;
  position: relative;
}

.footer-logo {
  display: block;
  width: clamp(200px, 38vw, 520px);
  height: auto;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.1rem;
  font-size: 0.9rem;
}

.footer-links a {
  opacity: 0.9;
}

.footer-links a:hover {
  opacity: 1;
}

.footer-copy {
  font-size: 0.85rem;
  opacity: 0.7;
}

.footer-credit {
  position: absolute;
  left: var(--page-pad-x);
  bottom: 1rem;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  /* text-transform: lowercase; */
  opacity: 0.35;
}

/* --- Project detail (CMS) --- */
.project-page {
  padding-top: clamp(2rem, 5vw, 3rem);
}

.project-hero-img {
  width: 100%;
  max-height: min(70vh, 720px);
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.08);
  margin-bottom: clamp(2rem, 5vw, 3rem);
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.project-body {
  max-width: 65ch;
}

.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

/* --- About empty page --- */
.about-empty {
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--page-pad-x);
  color: var(--muted);
}

/* --- Reveal helpers (GSAP) --- */
[data-reveal] {
  will-change: transform, opacity;
}
