/* Values taken from Figma "Frame 15" (1440 × 768 artboard).
   Sizes are expressed in vw relative to that 1440px width so the
   layout scales with the window: 1px in Figma = (100 / 1440)vw. */

:root {
  --px: calc(100vw / 1440);
  --bg: #fcfcfc;
  --fg: #000;
  --font: "Switzer", "Helvetica Neue", Arial, sans-serif;

  --margin: calc(60 * var(--px));
  --card-w: calc(527 * var(--px) * var(--carousel-size, 1)); /* front card width (size set in carousel.js) */
  --label-gap: calc(80 * var(--px)); /* gap between active card and title/year */
  --col-x: 50%; /* carousel column centre */
  --col-y: 50%; /* active card centre */
}

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

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body { overflow: hidden; }

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

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(33 * var(--px)) calc(40 * var(--px)) 0 var(--margin);
  pointer-events: none;
}

.site-header a { pointer-events: auto; }

.logo {
  font-weight: 900;
  font-size: calc(28.788 * var(--px));
  line-height: 1;
  letter-spacing: -0.02em;
}

.nav {
  display: flex;
  gap: calc(24 * var(--px));
  font-size: calc(20.571 * var(--px));
  line-height: calc(27 * var(--px));
}

/* Small square marker after each link */
.nav a::after {
  content: "";
  display: inline-block;
  width: calc(6 * var(--px));
  height: calc(6 * var(--px));
  margin-left: calc(4 * var(--px));
  background: currentColor;
  vertical-align: baseline;
  transition: transform 0.3s ease;
}

.nav a:hover::after { transform: rotate(45deg); }

/* ---------- Selected work carousel ---------- */

.work {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.work.is-dragging { cursor: grabbing; }

.work__stage {
  position: absolute;
  inset: 0;
}

.card {
  position: absolute;
  top: var(--col-y);
  left: var(--col-x);
  /* Every card is 16:9; other image formats are cropped to fill it. */
  width: var(--card-w);
  aspect-ratio: 16 / 9;
  margin: 0;
  overflow: hidden;
  border-radius: calc(5 * var(--px)); /* 5px at 1440 wide */
  will-change: transform;
  transform-origin: 50% 50%;
}

/* While a card is hovered, the others are veiled with 50% background colour.
   The cards stay solid, so nothing shows through them. */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.has-hover .card:not(.is-hover)::before { opacity: 0.3; }

/* Depth fog: cards further back fade into the background while staying
   opaque, so cards behind never show through the ones in front. */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg);
  z-index: 1;
  opacity: var(--fog, 0);
  pointer-events: none;
}

.card a,
.card img,
.card video {
  display: block;
  width: 100%;
  height: 100%;
}

.card img,
.card video {
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
}

.work__title,
.work__year {
  position: absolute;
  top: var(--col-y);
  margin: 0;
  font-size: calc(36 * var(--px));
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 2000;
}

/* Position is set from JS so the labels follow the hovered card */
.work__title { text-align: right; }

/* Letter-by-letter reveal: each letter sits in a clipping box and
   slides up into view, staggered by its index (--i). */
.ch {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.12em; /* room for descenders (g, y, p) */
  margin-bottom: -0.12em;
}

.ch > span {
  display: inline-block;
  transform: translateY(110%);
}

.is-visible .ch > span {
  transform: translateY(0);
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) calc(var(--i) * 22ms);
}

/* On leave the letters keep going up and out */
.is-leaving .ch > span {
  transform: translateY(-110%);
  transition: transform 0.35s cubic-bezier(0.5, 0, 0.75, 0) calc(var(--i) * 10ms);
}

@media (prefers-reduced-motion: reduce) {
  .ch > span { transition: none !important; }
}

/* Video cards: fixed thumbnail on top of the video, faded out on hover */
.card a { position: relative; }

.card__poster {
  position: absolute;
  inset: 0;
  transition: opacity 0.35s ease;
}

.card.is-hover .card__poster { opacity: 0; }

/* ---------- Scroll hint (Figma Frame 15, bottom right) ---------- */
/* Centred under "about me"; the wheel line rolls down and the arrows pulse
   to suggest scrolling up/down. */
.scroll-hint {
  position: absolute;
  right: calc(77 * var(--px));   /* centred under "about me" (x ≈ 1351 in Figma) */
  bottom: calc(61 * var(--px));  /* centre at y ≈ 675 in Figma */
  width: calc(24 * var(--px));
  height: calc(64 * var(--px));
  color: var(--fg);
  pointer-events: none;
  z-index: 2000;
}

.scroll-hint svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.scroll-hint__wheel { animation: wheel-roll 1.8s cubic-bezier(0.6, 0, 0.4, 1) infinite; }
.scroll-hint__up    { animation: arrow-up 1.8s ease-in-out infinite; }
.scroll-hint__down  { animation: arrow-down 1.8s ease-in-out infinite; }

@keyframes wheel-roll {
  0%   { transform: translateY(0); opacity: 1; }
  60%  { transform: translateY(8px); opacity: 0; }
  61%  { transform: translateY(-2px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes arrow-up {
  0%, 100% { transform: translateY(0); opacity: 0.35; }
  50%      { transform: translateY(-2px); opacity: 1; }
}

@keyframes arrow-down {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50%      { transform: translateY(2px); opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-hint * { animation: none !important; }
}
