/* Before the Number: site styles. Mobile first. One typeface, one weight. */

@font-face {
  font-family: "Pavilion";
  src: url("/assets/fonts/Pavilion-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0D0C0B;
  --text: #EDE6DA;
  --muted: #A2988C;
  --faint: #3A3632;      /* rules, frames: derived from the palette */
  --panel: #171513;
  --pad: clamp(1.25rem, 5vw, 3rem);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

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

html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Pavilion", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 400;
  font-synthesis: none;              /* never fake a bold or italic */
  font-kerning: normal;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, p, ol { margin: 0; padding: 0; font-weight: 400; font-size: inherit; }
ol { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

:focus-visible { outline: 1px solid var(--muted); outline-offset: 6px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ───────── Homepage ───────── */

.home main {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: var(--pad);
}

.figures {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.figure {
  display: block;
  font-size: clamp(2.5rem, 11vw, 3.5rem);
  line-height: 1;
  letter-spacing: -0.01em;
  padding: 0.15em 0.4em;
  transition: color .35s var(--ease);
}

/* Mobile: thin vertical rules between stacked figures */
.rule {
  width: 1px;
  height: clamp(1.75rem, 5.5svh, 3.25rem);
  margin: clamp(.4rem, 1.4svh, .9rem) 0;
  background: var(--faint);
}

/* Dim the others while one is being considered */
@media (hover: hover) {
  .figures:hover .figure { color: var(--muted); }
  .figures .figure:hover { color: var(--text); }
}

/* Quiet entrance */
@media (prefers-reduced-motion: no-preference) {
  .figures > li { opacity: 0; animation: rise .9s var(--ease) forwards; }
  .figures > li:nth-child(1)  { animation-delay: .05s; }
  .figures > li:nth-child(2)  { animation-delay: .12s; }
  .figures > li:nth-child(3)  { animation-delay: .19s; }
  .figures > li:nth-child(4)  { animation-delay: .26s; }
  .figures > li:nth-child(5)  { animation-delay: .33s; }
  .figures > li:nth-child(6)  { animation-delay: .40s; }
  .figures > li:nth-child(7)  { animation-delay: .47s; }
  .figures > li:nth-child(8)  { animation-delay: .54s; }
  .figures > li:nth-child(9)  { animation-delay: .61s; }
  .figures > li:nth-child(10) { animation-delay: .68s; }
  .figures > li:nth-child(11) { animation-delay: .75s; }
  .figures > li:nth-child(12) { animation-delay: .82s; }
  .figures > li:nth-child(13) { animation-delay: .89s; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

/* Desktop: one row, long thin rules that can't be read as ranges */
@media (min-width: 900px) {
  .figures {
    flex-direction: row;
    width: min(100%, 1600px);
  }
  .figures > li:not(.rule) { flex: 0 0 auto; }
  .figure { font-size: clamp(2.25rem, 4.2vw, 4.75rem); padding: .2em .1em; }
  .rule {
    flex: 1 1 0;
    min-width: 2.5rem;
    height: 1px;
    margin: 0 clamp(1.25rem, 2.2vw, 2.75rem);
  }
}

/* ───────── Project pages (carousel) ───────── */

.project { overflow: hidden; }

.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: calc(var(--pad) * .8) var(--pad);
  padding-top: max(calc(var(--pad) * .8), env(safe-area-inset-top));
  font-size: .875rem;
  letter-spacing: .02em;
  color: var(--muted);
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.bar__home { transition: color .25s; }
.bar__home:hover { color: var(--text); }

.carousel { position: relative; height: 100svh; }

.track {
  height: 100%;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  outline: none;
}
.track::-webkit-scrollbar { display: none; }

.card {
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 5rem var(--pad);
  text-align: center;
}

.line {
  max-width: 17ch;
  font-size: clamp(1.75rem, 7.2vw, 3.25rem);
  line-height: 1.16;
  letter-spacing: -0.005em;
  text-wrap: balance;
  hanging-punctuation: first;
}

.card--title .line {
  max-width: 13ch;
  font-size: clamp(2.25rem, 9.5vw, 5.25rem);
  line-height: 1.06;
  letter-spacing: -0.015em;
}

.card--ps .line { max-width: 22ch; font-size: clamp(1.4rem, 5.6vw, 2.5rem); }
.ps { color: var(--muted); margin-right: .2em; }

.contact {
  margin-top: 2.25rem;
  font-size: clamp(1rem, 3.6vw, 1.25rem);
  color: var(--muted);
  border-bottom: 1px solid var(--faint);
  padding-bottom: .2em;
  transition: color .25s, border-color .25s;
}
.contact:hover { color: var(--text); border-color: var(--muted); }

/* Film end card */
.card--video { padding-inline: clamp(.75rem, 4vw, 4rem); }

.film {
  --r: 1.7778;
  position: relative;
  width: min(100%, 1180px, calc(72svh * var(--r)));
  aspect-ratio: var(--r);
  background: var(--panel);
  overflow: hidden;
}
.film img, .film iframe {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border: 0; z-index: 1;
}
.film__fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: clamp(3rem, 14vw, 9rem); color: var(--faint);
}
.film__play {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .9rem;
  background: linear-gradient(to top, rgba(13,12,11,.55), rgba(13,12,11,0) 55%);
  border: 0; cursor: pointer; padding: 0;
}
.film__icon {
  width: 4rem; height: 4rem; border-radius: 50%;
  border: 1px solid rgba(237,230,218,.75);
  display: grid; place-items: center;
  transition: transform .4s var(--ease), background-color .3s;
}
.film__icon::after {
  content: ""; margin-left: .25rem;
  border-style: solid; border-width: .5rem 0 .5rem .85rem;
  border-color: transparent transparent transparent var(--text);
}
.film__play:hover .film__icon { transform: scale(1.06); background: rgba(237,230,218,.08); }
.film__note { font-size: .875rem; letter-spacing: .03em; color: var(--text); }
.film.is-pending .film__play { cursor: default; justify-content: flex-end; padding-bottom: clamp(.9rem, 3vw, 1.5rem); background: none; }
.film.is-pending .film__icon { display: none; }
.film.is-pending .film__note { color: var(--muted); }
.film.is-playing .film__play, .film.is-playing img { display: none; }

/* Desktop arrows: only where there's a precise pointer */
.arrow { display: none; }
@media (hover: hover) and (pointer: fine) {
  .arrow {
    display: block;
    position: absolute; top: 50%; z-index: 3;
    width: 3.5rem; height: 3.5rem; margin-top: -1.75rem;
    background: none; border: 0; cursor: pointer;
    color: var(--muted);
    transition: color .25s, opacity .3s;
  }
  .arrow::before {
    content: ""; position: absolute; top: 50%; left: 50%;
    width: .9rem; height: .9rem; margin: -.45rem 0 0 -.45rem;
    border-top: 1px solid currentColor; border-right: 1px solid currentColor;
  }
  .arrow--prev { left: clamp(.5rem, 2vw, 2rem); }
  .arrow--prev::before { transform: translateX(.15rem) rotate(-135deg); }
  .arrow--next { right: clamp(.5rem, 2vw, 2rem); }
  .arrow--next::before { transform: translateX(-.15rem) rotate(45deg); }
  .arrow:hover { color: var(--text); }
  .arrow:disabled { opacity: 0; pointer-events: none; }
}

/* Next project: appears on the last card */
.next {
  position: fixed; right: var(--pad); bottom: calc(var(--pad) * .8); z-index: 3;
  padding-bottom: env(safe-area-inset-bottom);
  font-size: .875rem; letter-spacing: .02em; color: var(--muted);
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity .4s var(--ease), transform .4s var(--ease), visibility 0s .4s;
}
.is-end .next { opacity: 1; visibility: visible; transform: none; transition-delay: .15s, .15s, 0s; }
.next a { transition: color .25s; }
.next a:hover { color: var(--text); }
.next__fig { color: var(--text); margin-left: .35em; }

@media (min-width: 900px) {
  .line { max-width: 24ch; font-size: clamp(2.25rem, 3.6vw, 3.5rem); }
  .card--title .line { max-width: 16ch; font-size: clamp(3rem, 5.4vw, 5.75rem); }
  .card--ps .line { max-width: 26ch; font-size: clamp(1.75rem, 2.6vw, 2.5rem); }
  .card { padding-inline: 7rem; }
}

/* ───────── 404 ───────── */

.notfound main {
  min-height: 100svh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: var(--pad); text-align: center;
}

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