/* ---------- Tokens ---------- */
:root {
  --bg: #f4f4f4;
  --bg-project: #f5f5f5;
  --ink: #1e1e1e;
  --black: #000;
  --muted-tile: #ececec;
  --gutter: 24px;
  --gap: 16px;
  --radius: 16px;
  --font-display: "Nohemi", "Lexend", system-ui, sans-serif;
  --font-ui: "Inter", system-ui, sans-serif;
  --font-specimen: "Subito", "Lexend", system-ui, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
}

body.project {
  background: var(--bg-project);
}

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

a {
  color: inherit;
}

p,
h1,
h2 {
  margin: 0;
}

.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;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
  min-height: 48px;
  padding: 16px var(--gutter);
  background: var(--bg);
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0.96px;
  text-transform: uppercase;
  white-space: nowrap;
}

.site-header__group {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.site-header a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-header__home {
  text-decoration: none !important;
}

.site-header__phone--lg {
  font-size: 18px;
  letter-spacing: 1.08px;
}

/* ---------- Home: hero ---------- */
.hero {
  padding: 0 var(--gutter) var(--gutter);
}

.hero__media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1392 / 743;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
}

.hero__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Home: project grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  padding: 0 var(--gutter);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  aspect-ratio: 453.333 / 611;
  overflow: hidden;
  border-radius: var(--radius);
  text-decoration: none;
  isolation: isolate;
}

.card__media {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.card__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.card__media img.crop {
  inset: auto;
  max-width: none;
  object-fit: fill;
}

a.card:hover .card__media img,
a.card:focus-visible .card__media img {
  transform: scale(1.03);
}

a.card:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* Label bottom-left, optional badge bottom-right; the badge wraps above the
   label when a narrow card can't fit both on one line. */
.card__footer {
  display: flex;
  flex-wrap: wrap-reverse;
  align-items: flex-start; /* wrap-reverse flips the cross axis: this is the bottom */
  justify-content: space-between;
  gap: 10px 12px;
  padding: 16px;
}

.card__about {
  flex: 1 1 140px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: normal;
}

.card__category {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
}

.card__title {
  font-weight: 600;
  color: #fff;
}

.card__badge {
  flex: none;
  margin-left: auto;
  padding: 7px 10px 6px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--gutter);
  background: var(--bg);
}

.site-footer--center {
  justify-content: center;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 2px;
  border: 0;
  border-bottom: 1px solid #000;
  background: none;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.footer-link img {
  width: 20px;
  height: 20px;
}

.footer-link--prev img {
  transform: rotate(-90deg);
}

.footer-link--next img {
  transform: rotate(90deg);
}

/* ---------- Project page ---------- */
.project-content {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  width: 100%;
  padding: 0 var(--gutter);
}

.intro {
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding: 40px 0;
  color: #000;
}

.intro__title {
  font-size: clamp(32px, 4.6vw, 48px);
  font-weight: 600;
  line-height: normal;
  letter-spacing: 0.02em;
}

.intro__meta {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meta__label {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.32px;
  text-transform: uppercase;
}

.meta__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  letter-spacing: 0.28px;
}

.meta__list--tight {
  gap: 4px;
}

.credit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
}

.credit img {
  width: 8px;
  height: 8px;
}

.intro__desc {
  max-width: 813px;
  font-size: 24px;
  font-weight: 500;
  line-height: 28px;
  letter-spacing: 0.48px;
}

/* Media blocks: aspect ratio is set inline from the Figma frame size. */
.media {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--tile-bg, transparent);
}

.media > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media--contain > img {
  object-fit: contain;
}

.media > img.crop {
  inset: auto;
  max-width: none;
  object-fit: fill;
}

/* Row of media: children share one height because flex-grow and aspect-ratio
   both come from their Figma widths. */
.row {
  display: flex;
  gap: var(--gap);
}

.row > * {
  flex: var(--w) 1 0;
  min-width: 0;
}

/* Centered artwork on a solid tile (logos, devices, posters). */
.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: var(--tile-bg, var(--bg));
}

.stage__art {
  width: var(--art-w);
  height: auto;
}

.stage__art {
  max-width: none;
}

.stage--column {
  flex-direction: column;
}

/* Device-style frame (Anphinity, Atticsalt). */
.device {
  width: var(--art-w);
  padding: var(--pad);
  border: 1px solid var(--frame, #fff);
  border-radius: var(--radius-outer);
}

.device img {
  width: 100%;
  height: auto;
  aspect-ratio: var(--ratio);
  object-fit: cover;
  border-radius: var(--radius-inner);
}

/* Typography specimen (Anphinity). */
.specimen {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 5.1cqi;
  background: #000;
  color: var(--bg);
  font-family: var(--font-specimen);
  text-transform: uppercase;
}

.specimen__label {
  font-size: 2.04cqi;
}

.specimen__name {
  margin-top: 1.02cqi;
  font-size: 5.1cqi;
  font-weight: 500;
}

.specimen__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5.1cqi;
  font-size: 3.06cqi;
}

.specimen__weight {
  display: flex;
  flex-direction: column;
  gap: 2.04cqi;
  overflow-wrap: anywhere;
}

.specimen__weight p + p {
  margin-top: 1.55cqi;
}

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

  .site-header__location {
    display: none;
  }
}

@media (max-width: 768px) {
  :root {
    --gutter: 16px;
    --gap: 12px;
  }

  .site-header {
    flex-wrap: wrap;
    padding-top: 12px;
    padding-bottom: 12px;
    font-size: 12px;
    letter-spacing: 0.6px;
  }

  .site-header__group {
    gap: 12px;
  }

  .site-header__phone--lg {
    font-size: 13px;
    letter-spacing: 0.7px;
  }

  .hero__media {
    aspect-ratio: 4 / 5;
  }

  .row {
    flex-direction: column;
  }

  .row > * {
    flex: none;
  }

  .intro {
    gap: 32px;
    padding: 24px 0 32px;
  }

  .intro__meta {
    gap: 32px;
  }

  .intro__desc {
    font-size: 18px;
    line-height: 24px;
    letter-spacing: 0.3px;
  }

  .specimen {
    aspect-ratio: auto !important;
    padding: 24px;
  }

  .specimen__label {
    font-size: 12px;
  }

  .specimen__name {
    margin-top: 6px;
    font-size: 26px;
  }

  .specimen__grid {
    gap: 24px;
    font-size: 14px;
  }

  .specimen__weight {
    gap: 8px;
  }

  .specimen__weight p + p {
    margin-top: 6px;
  }

  .footer-link {
    font-size: 14px;
  }
}

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

  .card__about {
    flex-basis: 120px;
  }

  .card__badge {
    padding: 6px 8px 5px;
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  .site-header {
    justify-content: flex-start;
    font-size: 11px;
    letter-spacing: 0.4px;
  }

  .site-header__group {
    flex-wrap: wrap;
    gap: 6px 12px;
  }

  .site-header__phone--lg {
    font-size: 12px;
    letter-spacing: 0.5px;
  }

  .specimen__grid {
    grid-template-columns: 1fr;
  }
}

/* Design shows ABOUT as underlined text; there is no About page yet. */
.site-header__about {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Motion ---------- */
:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
}

/* Cross-fade between pages in browsers that support view transitions. */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
}

/* Intro loader */
.loader {
  display: none;
}

.show-loader .loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 24px;
  padding: var(--gutter);
  background: var(--bg);
  color: var(--ink);
  transition: transform 0.9s var(--ease-in-out);
}

.show-loader body {
  overflow: hidden;
}

.loader-out .loader {
  transform: translateY(-100%);
}

.loader__name {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.25em;
  font-size: clamp(56px, 13.5vw, 220px);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.02em;
}

.loader__word {
  display: inline-flex;
  overflow: hidden;
  padding-bottom: 0.06em;
}

.loader__char {
  display: inline-block;
  transform: translateY(105%);
  animation: loader-char 0.9s var(--ease-out) forwards;
  animation-delay: calc(0.15s + var(--i) * 0.05s);
}

.loader__word + .loader__word .loader__char {
  animation-delay: calc(0.4s + var(--i) * 0.05s);
}

.loader-out .loader__char {
  transition: transform 0.6s var(--ease-in-out);
  transform: translateY(-105%);
  animation: none;
}

@keyframes loader-char {
  to {
    transform: translateY(0);
  }
}

.loader__meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  font-size: 14px;
  letter-spacing: 0.84px;
  opacity: 0;
  animation: fade-in 0.6s ease 0.6s forwards;
}

.loader__count {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.loader__bar {
  height: 1px;
  background: rgba(0, 0, 0, 0.1);
}

.loader__bar span {
  display: block;
  height: 100%;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
}

@keyframes fade-in {
  to {
    opacity: 1;
  }
}

/* Header: slides away while scrolling down, returns on scroll up. */
.site-header {
  transition: transform 0.45s var(--ease-out), box-shadow 0.3s ease;
}

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

.site-header.is-scrolled {
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.js .site-header {
  opacity: 0;
  transform: translateY(-12px);
}

.js.is-ready .site-header {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s var(--ease-out), box-shadow 0.3s ease;
}

.js.is-ready .site-header.is-hidden {
  transform: translateY(-100%);
}

/* Scroll reveals: fade + rise, images settle from a slight zoom. */
.js .reveal {
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 0.9s ease var(--delay, 0ms),
    transform 1.1s var(--ease-out) var(--delay, 0ms);
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

.js .reveal--zoom > img,
.js .reveal--zoom .card__media img {
  transform: scale(1.08);
  transition: transform 1.6s var(--ease-out) var(--delay, 0ms);
}

.js .reveal--zoom.is-in > img,
.js .reveal--zoom.is-in .card__media img {
  transform: none;
}

.js a.card.reveal.is-in:hover .card__media img {
  transform: scale(1.03);
  transition-duration: 0.6s;
  transition-delay: 0ms;
}

/* The hero only fades/zooms; rising a full-screen block looks heavy. */
.js .hero__media.reveal {
  transform: scale(0.985);
}

.js .hero__media.reveal.is-in {
  transform: none;
}

/* Card label slides up a beat after its image. */
.js .card.reveal .card__about,
.js .card.reveal .card__badge {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s ease, transform 0.8s var(--ease-out);
  transition-delay: calc(var(--delay, 0ms) + 0.35s);
}

.js .card.reveal .card__badge {
  transition-delay: calc(var(--delay, 0ms) + 0.5s);
}

.js .card.reveal.is-in .card__about,
.js .card.reveal.is-in .card__badge {
  opacity: 1;
  transform: none;
}

/* Footer links: arrow nudges on hover. */
.footer-link img {
  transition: translate 0.3s var(--ease-out);
}

.footer-link:hover img {
  translate: 0 -3px;
}

.footer-link--prev:hover img {
  translate: -3px 0;
}

.footer-link--next:hover img {
  translate: 3px 0;
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal,
  .js .reveal--zoom > img,
  .js .reveal--zoom .card__media img,
  .js .card.reveal .card__about,
  .js .card.reveal .card__badge,
  .js .site-header {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  @view-transition {
    navigation: none;
  }
}
