/* Ari-W9500 by Catterio Sylt, SIL OFL 1.1 (fonts/Ari-W9500-OFL.txt). Body copy is SF Pro, as specced: Apple's system font. */
@font-face {
  font-family: 'Ari-W9500';
  src: url('../fonts/Ari-W9500-Regular.woff2') format('woff2'),
       url('../fonts/Ari-W9500-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: block;
}

:root {
  --paper: #e9e9e9;
  --ink: #1f1ff2;          /* Sable's electric blue: her voice, everywhere */
  --star: #f2a5ee;
  --text: #111;
  --line: #4a4a4a;

  --pixel: 'Ari-W9500', ui-monospace, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;

  /* Composition is drawn from Sable's 1380 frame: card 290×408, stack 800, gap 43. */
  --cw: min(21vw, 34vh);
  --ch: calc(var(--cw) * 1.407);
  --gap: calc(var(--cw) * 0.15);
  --pad: 7.1vw;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.7, 0, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color .01s;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; }
[hidden] { display: none !important; }

@media (pointer: fine) {
  html, body, a, button { cursor: none; }
}

.link {
  font-family: var(--pixel);
  color: var(--ink);
  text-decoration: none;
  font-size: clamp(15px, 1.45vw, 22px);
  letter-spacing: .01em;
  position: relative;
}
/* Underline draws like a pixel row, left to right */
.link::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -3px; height: 2px;
  background: currentColor;
  transform: scaleX(0); transform-origin: left;
  transition: transform .45s var(--ease-out);
}
.link:hover::after, .link:focus-visible::after { transform: scaleX(1); }
.link:focus-visible { outline: none; }

/* ───────────── Masthead ───────────── */
.masthead {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline;
  padding: clamp(28px, 8.4vh, 80px) var(--pad) 0;
  pointer-events: none;
}
.masthead > * { pointer-events: auto; }
.masthead__menu { justify-self: start; text-transform: uppercase; }
.masthead__contact { justify-self: end; text-transform: uppercase; }
body[data-view="project"] .masthead__name { opacity: 0; pointer-events: none; }
.masthead__name { transition: opacity .4s; }

/* ───────────── Index ───────────── */
.index {
  position: relative; height: 100vh; min-height: 560px; overflow: hidden;
}
.index__intro {
  position: absolute; left: 0; right: 0; top: clamp(70px, 15.2vh, 140px);
  margin: 0; text-align: center;
  font-family: var(--pixel); color: var(--ink);
  font-size: clamp(15px, 1.45vw, 22px); line-height: 1.25;
}
.star-home {
  position: absolute; left: 72.6%; top: clamp(70px, 14.9vh, 130px);
  width: clamp(40px, 4.4vw, 72px); aspect-ratio: 1;
}

.stage {
  position: absolute; left: 0; right: 0; top: 39vh;
  display: flex; justify-content: center; gap: var(--gap);
}
.stack {
  position: relative;
  width: calc(var(--cw) * 2.76); height: var(--ch);
}
.card {
  position: absolute; top: 0; left: 0;
  width: var(--cw); height: var(--ch);
  display: block; overflow: hidden;
  outline: 1px solid var(--line); outline-offset: -1px;
  background: #ddd;
  box-shadow: -14px 0 28px -18px rgba(0,0,0,.35), 0 18px 30px -22px rgba(0,0,0,.4);
  will-change: transform;
}
.card img, .preview img {
  width: 100%; height: 100%; object-fit: cover;
}
.card img { object-position: left center; filter: saturate(.94); transition: filter .5s; }
.card.is-active img { filter: none; }
.card:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.preview {
  position: relative; margin: 0;
  width: var(--cw); height: var(--ch); overflow: hidden;
  outline: 1px solid var(--line); outline-offset: -1px;
  background: #ddd;
  box-shadow: 0 18px 30px -22px rgba(0,0,0,.4);
}
.preview img { position: absolute; inset: 0; }

.caption {
  position: absolute; top: calc(39vh + var(--ch) + 14px); left: 0;
  margin: 0; font-size: clamp(12px, 1.1vw, 15px); line-height: 1.35;
  white-space: nowrap; will-change: transform;
}
.caption > span { display: block; }

/* Hand the stage over to the transition */
.index.is-leaving .card:not(.is-chosen),
.index.is-leaving .preview,
.index.is-leaving .caption { opacity: 0; transition: opacity .35s; }

/* ───────────── Project world ───────────── */
.project {
  min-height: 100vh;
  padding: clamp(120px, 24vh, 220px) var(--pad) 0;
}
.project__hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 6vw; align-items: start;
}
.project__title {
  margin: 0 0 2.2em; font-family: var(--pixel); font-weight: 400; color: var(--ink);
  font-size: clamp(18px, 1.6vw, 24px); line-height: 1.3;
}
.project__title > span { display: block; }
.project__body { max-width: 34em; font-size: clamp(13px, 1vw, 15px); line-height: 1.55; }
.project__body p { margin: 0 0 1em; }
.project__cover {
  margin: 0; aspect-ratio: 4 / 5; overflow: hidden;
  height: min(66vh, 52vw); justify-self: end;
  outline: 1px solid var(--line); outline-offset: -1px;
}
.project__cover img { width: 100%; height: 100%; object-fit: cover; }

.project__gallery {
  margin: 12vh calc(var(--pad) * -1) 0;
  padding: 10vh var(--pad);
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 3vw;
}
.project__gallery figure { margin: 0; }
.project__gallery img { width: 100%; outline: 1px solid var(--line); outline-offset: -1px; }
.slot {
  aspect-ratio: 4 / 3; display: grid; place-items: center;
  border: 1px dashed color-mix(in srgb, var(--ink) 45%, transparent);
  font-family: var(--pixel); color: var(--ink); font-size: 13px; opacity: .7;
}
.slot--wide { grid-column: 1 / -1; aspect-ratio: 16 / 7; }

.project__next {
  margin: 0 calc(var(--pad) * -1); padding: 12vh var(--pad) 16vh;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 4vw;
}
.project__next-label { font-family: var(--pixel); color: var(--ink); font-size: clamp(15px, 1.45vw, 22px); }
.project__next .card {
  position: relative; --cw: min(15vw, 28vh); --ch: calc(var(--cw) * 1.407);
  transition: transform .8s var(--ease-out);
}
.project__next .card:hover { transform: translateY(-10px) rotate(-1.5deg); }
.project__next .card img { object-position: center; }

[data-reveal] { opacity: 0; transform: translateY(26px); }
.is-revealed .project__hero [data-reveal], .project [data-reveal].in {
  opacity: 1; transform: none;
  transition: opacity .9s var(--ease-out), transform 1.1s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}

/* ───────────── Menu ───────────── */
.menu {
  position: fixed; inset: 0; z-index: 15;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  display: grid; place-items: center;
  animation: fade .4s var(--ease-out);
}
.menu__list { list-style: none; margin: 0; padding: 0; text-align: center; }
.menu__list a { font-size: clamp(24px, 3.4vw, 52px); line-height: 1.5; }
@keyframes fade { from { opacity: 0; } }

/* ───────────── Transition layers ───────────── */
.flood {
  position: fixed; left: 0; width: 100vw; z-index: 30;
  overflow: hidden; pointer-events: none; display: none;
}
.flood img { position: absolute; top: 0; height: 100%; object-fit: cover; object-position: left center; }

/* The blue wave: a dome rising through the screen, carrying you between worlds. */
.wave {
  position: fixed; left: -6vw; top: 0; z-index: 40;
  width: 112vw; height: 260vh;
  border-radius: 50% / 44vh;
  background: linear-gradient(to bottom,
    rgba(31, 31, 242, .62) 0, rgba(31, 31, 242, .9) 30vh, var(--ink) 52vh,
    var(--ink) calc(100% - 52vh), rgba(31, 31, 242, .9) calc(100% - 30vh), rgba(31, 31, 242, .62) 100%);
  backdrop-filter: blur(34px) saturate(1.3); -webkit-backdrop-filter: blur(34px) saturate(1.3);
  transform: translateY(110vh);
  pointer-events: none; visibility: hidden;
}
.wave-title {
  position: fixed; inset: 0; z-index: 41; margin: 0;
  display: grid; place-items: center; text-align: center;
  font-family: var(--pixel); color: #fff; font-size: clamp(22px, 2.6vw, 40px); line-height: 1.3;
  pointer-events: none; opacity: 0;
}

/* ───────────── Star ───────────── */
.star {
  position: fixed; left: 0; top: 0; z-index: 100;
  width: 0; height: 0;
  pointer-events: none; will-change: transform;
}
.star__body {
  position: absolute; left: -36px; top: -36px; width: 72px; height: 72px;
  will-change: transform;
}
.star__body svg { width: 100%; height: 100%; display: block; overflow: visible; }
.star__body .pix { display: none; }
body.is-pixel .star__body .vec { display: none; }
body.is-pixel .star__body .pix { display: block; }
.star__label {
  position: absolute; left: 0; top: 0;
  font-family: var(--pixel); color: var(--ink); font-size: 14px; white-space: nowrap;
  clip-path: inset(0 100% 0 0);
  transition: clip-path .4s var(--ease-out);
}
.star.has-label .star__label { clip-path: inset(0 0 0 0); }
body[data-busy] .star__label { clip-path: inset(0 100% 0 0); }
@media (pointer: coarse) { .star { display: none; } }

/* ───────────── Small screens ───────────── */
@media (max-width: 760px) {
  :root { --cw: 52vw; --pad: 6vw; }
  .preview { display: none; }
  .stack { width: 88vw; }
  .star-home { left: 80%; }
  .project__hero { grid-template-columns: 1fr; }
  .project__gallery { grid-template-columns: 1fr; }
  .project__next { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .project [data-reveal] { transition-duration: .01s; transition-delay: 0s; }
}
