/* ==========================================================================
   Anastasia Rovatsou — portfolio
   1. Tokens   2. Base   3. Type   4. Nav + cursor   5. Media
   6. Home     7. About  8. Project   9. Motion + transitions
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */

@font-face {
  font-family: "Unbounded";
  src: url("/assets/fonts/Unbounded-VariableFont_wght.ttf") format("truetype");
  font-weight: 200 900;
  font-display: swap;
}

:root {
  --bg: #f3f2ee;
  --ink: #111110;
  --muted: #86857f;
  --line: rgba(17, 17, 16, 0.16);
  --placeholder: #dbd9d3;

  /* Mouse cursor: a green circle everywhere. The two numbers are its centre (the click point). */
  --cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><circle cx='12' cy='12' r='10' fill='%2389f07d'/></svg>") 12 12, auto;
  --cursor-link: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><circle cx='12' cy='12' r='10' fill='%2389f07d'/></svg>") 12 12, pointer;

  /* Swap the typeface here once the final choice is made. */
  --font: "Neue Haas Grotesk Display Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: "Unbounded", var(--font); /* big titles */

  --margin: clamp(1rem, 2.2vw, 2.75rem);
  --gutter: clamp(0.75rem, 1.4vw, 1.75rem);
  --nav-h: calc(var(--margin) * 2 + 1rem);
  --space-s: clamp(1.5rem, 3vw, 3rem);
  --space-m: clamp(3rem, 7vw, 8rem);
  --space-l: clamp(5rem, 12vw, 14rem);

  --fs-label: clamp(0.6875rem, 0.62rem + 0.22vw, 0.875rem);
  --fs-body: clamp(1rem, 0.92rem + 0.3vw, 1.25rem);
  --fs-lead: clamp(1.25rem, 0.9rem + 1.5vw, 2.5rem);
  --fs-tile: clamp(1.25rem, 0.6rem + 1.7vw, 2.6rem);
  --fs-m: clamp(1.4rem, 0.7rem + 2.3vw, 3.4rem);
  --fs-l: clamp(1.9rem, 0.6rem + 5.6vw, 7.75rem);
  --fs-xl: calc((100vw - 2 * var(--margin)) * 0.143); /* name fills the content width */

  --ease: cubic-bezier(0.22, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.7, 0, 0.2, 1);
}

/* 2. Base ------------------------------------------------------------------ */

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

html {
  cursor: var(--cursor);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 100%;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

body { margin: 0; font-size: var(--fs-body); overflow-x: clip; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
a, button { cursor: var(--cursor-link); }
img, video { display: block; max-width: 100%; }
main { display: block; min-height: 100svh; outline: none; }
/* Selected (highlighted) text: blue letters on a green box. */
::selection { background: #89f07d; color: #2c18b1; }
:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: fixed; top: 0; left: 0; z-index: 30;
  padding: 0.75rem 1rem; background: var(--ink); color: var(--bg);
  transform: translateY(-100%);
}
.skip:focus { transform: none; }

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
}

/* 3. Type ------------------------------------------------------------------ */

.label {
  font-size: var(--fs-label);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.display-xl, .display-l, .display-m {
  font-family: var(--font-display);
  font-weight: 500;
  text-transform: uppercase;
  line-height: 0.96;
}
.display-xl { font-size: var(--fs-xl); letter-spacing: -0.03em; }
.display-l { font-size: var(--fs-l); letter-spacing: -0.03em; }
.display-m { font-size: var(--fs-m); letter-spacing: -0.025em; line-height: 1; }

.lead { font-size: var(--fs-lead); line-height: 1.16; letter-spacing: -0.02em; }
.lead p + p, .block__body p + p { margin-top: 1em; }

/* Arrow icon (see arrow() in js/lib/dom.js). */
.arrow {
  display: inline-block;
  width: 1em; height: 1em;
  vertical-align: -0.16em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
}
.arrow--ne { transform: rotate(-45deg); }
.arrow--s { transform: rotate(90deg); }
.arrow--w { transform: rotate(180deg); }
.label .arrow, .nav .arrow { width: 1.25em; height: 1.25em; vertical-align: -0.28em; }

/* Underline that draws in on hover. */
.link {
  background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 0 1px;
  transition: background-size 0.5s var(--ease);
}
.link:focus-visible { background-size: 100% 1px; }
@media (hover: hover) {
  .link:hover { background-size: 100% 1px; }
}

/* 4. Nav + cursor ---------------------------------------------------------- */

/* White + difference blending keeps the nav legible over any image. */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--gutter);
  padding: var(--margin);
  color: #fff;
  mix-blend-mode: difference;

  pointer-events: none;
  font-size: var(--fs-label);
  font-weight: 500;
  line-height: 1rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.nav a { pointer-events: auto; }
/* The nav's blending inverts colours, so its selection uses the inverses of the green and blue. */
.nav ::selection { background: #6a0271; color: #c7da3d; }
.nav__links { display: flex; gap: clamp(1rem, 2.5vw, 2.5rem); }

.cursor {
  position: fixed; top: 0; left: 0; z-index: 40;
  pointer-events: none;
  will-change: transform;
}
.cursor span {
  display: block;
  margin: 1rem 0 0 1rem;
  padding: 0.5em 0.8em;
  background: var(--ink);
  color: var(--bg);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transform: scale(0.6);
  transform-origin: 0 0;
  transition: opacity 0.25s var(--ease), transform 0.35s var(--ease);
}
.cursor.is-active span { opacity: 1; transform: none; }

/* Opening screen (js/lib/preloader.js). The base black layer is inline in index.html. */
.preloader.is-built { background: none; }
.preloader__black { position: absolute; inset: 0; background: #000; }
.preloader__defs { position: absolute; }
/* Full-screen layer: characters and the circle are placed from its middle. It covers the
   whole screen so the melting filter can reach letters that are still on their way in. */
.preloader__mass { position: absolute; inset: 0; }
.preloader__char {
  position: absolute; top: 50%; left: 50%;
  color: #fff;
  line-height: 1;
  white-space: pre;
  will-change: transform;
}
.preloader__char--name { font-family: var(--font-display); font-weight: 500; }
.preloader__char--label { font-family: var(--font-display); font-weight: 400; }
.preloader__disc {
  position: absolute; top: 50%; left: 50%;
  box-sizing: border-box;
  width: clamp(72px, 7vw, 116px); aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%) scale(0);
}
.preloader__dot {
  position: absolute; top: 50%; left: 50%;
  border-radius: 50%;
  background: #000;
  transform: translate(-50%, -50%) scale(0);
}
/* Once hollow, the circle is drawn as a white ring around a real hole in the black layer. */
.preloader__disc.is-ring { aspect-ratio: auto; background: none; border: 0 solid #fff; }
.preloader.is-open { pointer-events: none; }
.preloader.is-fading { opacity: 0; transition: opacity 0.35s ease; }

/* 5. Media ----------------------------------------------------------------- */

.media { position: relative; }
.media__asset { width: 100%; height: auto; background: var(--placeholder); }
.media__asset--placeholder { position: relative; }
.media__tag { position: absolute; left: 0.9rem; bottom: 0.8rem; color: var(--muted); }
.media__caption { margin-top: 0.75rem; color: var(--muted); }
/* On project pages a full-width or column image carries its title above it. */
.block--full > .media:has(> .media__caption), .block--columns > .media:has(> .media__caption) { display: flex; flex-direction: column-reverse; }
.block--full > .media > .media__caption, .block--columns > .media > .media__caption { margin: 0 0 0.75rem; }

.media--fill, .media--fill .media__asset {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  aspect-ratio: auto !important;
}

/* Device frames with auto-scrolling screens (js/lib/autoscroll.js). */
.stage {
  display: flex; justify-content: center; align-items: flex-start;
  gap: clamp(1.25rem, 6vw, 6rem);
  padding: clamp(1.5rem, 6vw, 6.5rem) clamp(1rem, 6vw, 6.5rem);
  background: var(--placeholder);
}
.device { min-width: 0; }
.device__screen { position: relative; overflow: hidden; background: #fff; }
.device__page { display: block; width: 100%; height: auto; will-change: transform; }
.device .media__caption { text-align: center; color: var(--ink); }

.device--browser { width: 100%; max-width: 78rem; }
.device--browser .device__screen { border-radius: 0 0 0.5rem 0.5rem; }
.device__bar {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem 0.5rem 0 0;
  background: var(--bg);
}
.device__bar i { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--placeholder); }
.device__bar span {
  margin: 0 auto;
  padding-right: 2.5rem;
  color: var(--muted);
  font-size: var(--fs-label);
  letter-spacing: 0.02em;
}

/* A click-through website: the screen scrolls for real and the design's links are buttons laid over it. */
.site__screen { overflow-y: auto; scrollbar-width: none; overscroll-behavior: auto; }
.site__screen::-webkit-scrollbar { display: none; }
.site__page { position: relative; }
.site__page[hidden] { display: none; }
.site__link { position: absolute; padding: 0; border: 0; background: none; cursor: pointer; }
.site__link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.device--phone { width: min(44%, 19rem); }
.device--phone .device__screen {
  border: clamp(5px, 0.9vw, 10px) solid var(--ink);
  border-radius: clamp(1.4rem, 3.6vw, 2.8rem);
}
/* Camera cut-out */
.device--phone .device__screen::after {
  content: "";
  position: absolute; top: 1.3%; left: 50%;
  width: 29%; aspect-ratio: 3.5 / 1;
  border-radius: 99px;
  background: var(--ink);
  transform: translateX(-50%);
}
.stage--row .device:nth-child(even) { margin-top: clamp(1.5rem, 7vw, 7rem); }

/* Photo mockups with live, scrolling screens laid over the screens in the photo. */
.mock { position: relative; overflow: hidden; }
.mock__photo { display: block; width: 100%; height: auto; }
/*
  Full-width landscape media (and the project hero) always spans the full width but is never
  taller than the screen: when it would be, it is cropped evenly at the top and bottom.
*/
.block--full > .media--fit > :is(img, video).media__asset,
.project__hero > .media--fit > :is(img, video).media__asset { max-height: 100svh; object-fit: cover; }
.block--full > .mock.media--fit,
.project__hero > .mock.media--fit { display: flex; flex-direction: column; justify-content: center; max-height: 100svh; }
.mock__stage { position: relative; flex: none; }
.mock__plane { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.mock__screen {
  position: absolute; top: 0; left: 0;
  overflow: hidden;
  background: #fff;
  transform-origin: 0 0;
}
/* The photo's light, multiplied over the page so it stays put while the page scrolls. */
.mock__shade { position: absolute; inset: 0; mix-blend-mode: multiply; pointer-events: none; }
.mock__island { position: absolute; border-radius: 99px; background: #050505; }
.mock__screen--still .device__page { width: 100%; height: 100%; object-fit: cover; object-position: top; }
/* A self-playing prototype: the page at rest, with the pieces that appear laid over it. */
.mock__screen--proto { background: #000; }
.proto { position: relative; }
.proto__base, .proto__layer { position: absolute; top: 0; left: 0; display: block; max-width: none; }
.js .proto__layer { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .js .proto__layer { opacity: 1; } }

/* 6. Home ------------------------------------------------------------------ */

/* Selected work: editorial index. Spans, ratios and order come from js/lib/work-index.js. */
.work { padding: calc(var(--nav-h) + var(--space-s)) var(--margin) 0; }
.work__head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: var(--space-s);
}
.tabs { display: flex; flex-wrap: wrap; gap: 0.4em clamp(1.25rem, 3vw, 3.5rem); }
.tab {
  padding: 0; border: 0; background: none;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: var(--fs-tile);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  cursor: var(--cursor-link);
  transition: color 0.4s var(--ease);
}
.tab sup {
  margin-left: 0.4em;
  font-family: var(--font);
  font-size: var(--fs-label);
  letter-spacing: 0.02em;
  vertical-align: top;
}
.tab[aria-pressed="true"] { color: var(--ink); }
@media (hover: hover) {
  .tab:hover { color: var(--ink); }
}
.index__empty { padding: var(--space-m) 0; color: var(--muted); }

.index {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(2.5rem, 5vw, 5.5rem) var(--gutter);
}
.tile { display: block; position: relative; grid-column: 1 / -1; min-width: 0; }
.tile[hidden] { display: none; }
.tile__media { position: relative; overflow: hidden; aspect-ratio: 16 / 10; }
.tile__info {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem var(--gutter);
  padding-top: 0.9rem;
}
.tile__year { text-align: right; }
.tile__title {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: var(--fs-tile);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  transition: transform 0.6s var(--ease);
}
.tile__cat { grid-column: 1 / -1; color: var(--muted); }


@media (hover: hover) {
  .tile .media--fill, .next .media--fill { transition: transform 1.2s var(--ease); }
  .tile:hover .media--fill, .next:hover .media--fill { transform: scale(1.035); }
  .tile:hover .tile__title { transform: translateX(0.35em); }
}

@media (min-width: 900px) {
  .tile { grid-column: span var(--span, 12); align-self: var(--align, end); }
  .tile__media { aspect-ratio: var(--ratio, 16 / 10); }
}

.closing {
  display: flex; flex-direction: column;
  gap: var(--space-s);
  padding: var(--space-l) var(--margin) var(--margin);
}
.closing__links, .biglist--links {
  display: flex; flex-wrap: wrap;
  gap: 0.4em clamp(1.5rem, 4vw, 4rem);
  font-size: var(--fs-lead);
  letter-spacing: -0.02em;
}
.footer {
  display: flex; justify-content: space-between; gap: var(--gutter);
  margin-top: var(--space-m);
  padding-top: var(--margin);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.missing {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start;
  gap: var(--space-s);
  padding: var(--nav-h) var(--margin) var(--margin);
}

/* 7. About ----------------------------------------------------------------- */

.about { padding: 0 var(--margin) var(--margin); }
.about__head {
  min-height: 72svh;
  display: flex; align-items: flex-end;
  padding: var(--nav-h) 0 var(--space-m);
}

.row { padding: var(--space-s) 0 var(--space-m); border-top: 1px solid var(--line); }
.row__label { grid-column: 1 / -1; padding-bottom: 1.25rem; color: var(--muted); }
.row__body { grid-column: 1 / -1; }

/* Journey: education → experience as a typographic sequence. */
.step {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem var(--gutter);
}
.step__stage, .step__note { color: var(--muted); }
.step__note { padding-top: 0.6em; }
.step__tags {
  display: flex; flex-wrap: wrap;
  gap: 0.4em 0.5em;
  padding-top: 0.5rem;
}
.step__tags li { padding: 0.45em 0.7em; border: 1px solid var(--line); }
.journey__arrow {
  padding: clamp(1.25rem, 3vw, 3rem) 0;
  font-size: var(--fs-m);
  font-weight: 300;
  line-height: 1;
}

.biglist { font-family: var(--font-display); font-size: var(--fs-m); font-weight: 500; line-height: 1.12; letter-spacing: -0.025em; text-transform: uppercase; }
.biglist--links {
  font-family: var(--font); font-size: clamp(1.9rem, 1rem + 3.4vw, 5rem); font-weight: 400;
  letter-spacing: -0.035em; text-transform: none; line-height: 1.2; flex-direction: column;
}
.plainlist { columns: 2; column-gap: var(--gutter); }
.plainlist li { padding-bottom: 0.3em; break-inside: avoid; }
/* Tools in two labelled columns, on the same two-column grid as .plainlist. */
.toolgroups { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem var(--gutter); }
.toolgroup__label { padding-bottom: 0.9em; color: var(--muted); }
.toolgroup__list li { padding-bottom: 0.3em; }

@media (min-width: 800px) {
  .row__label { grid-column: 1 / span 4; padding-bottom: 0; padding-top: 0.4em; }
  .row__body { grid-column: 5 / -1; }
  .row__body > .lead { max-width: 24em; }
  .step { grid-template-columns: 5fr 3fr; grid-template-areas: "stage stage" "title detail" "tags tags"; align-items: start; }
  .step__stage { grid-area: stage; }
  .step__title { grid-area: title; }
  .step__detail { grid-area: detail; padding-top: 0.3em; }
  .step__tags { grid-area: tags; }
}

/* 8. Project --------------------------------------------------------------- */

.project { padding: 0 var(--margin) var(--margin); }
.project .footer { margin-top: 0; }
.project .footer a { color: var(--ink); }
.project__head {
  min-height: 62svh;
  display: flex; flex-direction: column; justify-content: flex-end;
  gap: var(--space-s);
  padding: var(--nav-h) 0 var(--space-s);
}
.project__top { display: flex; justify-content: space-between; gap: var(--gutter); }
.project__num { color: var(--muted); }
.project__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem var(--gutter);
  padding-top: var(--margin);
  border-top: 1px solid var(--line);
}
.project__meta dt { color: var(--muted); padding-bottom: 0.4em; }
.project__credit { grid-column: 1 / -1; }

.block { margin-top: var(--gutter); }
.block--text, .block--split { margin-block: var(--space-m); }
.block__label { grid-column: 1 / -1; padding-bottom: 1.25rem; color: var(--muted); }
.block__body { grid-column: 1 / -1; }
.block--columns, .block--grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gutter);
  align-items: start;
}
.block--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.block__aside, .block__media { grid-column: 1 / -1; }

/*
  Colour palette: bars side by side, each with its name written up its side. One bar is open,
  showing its name and hex: the first by default, or the one under the cursor.
*/
.palette { display: flex; gap: clamp(0.4rem, 0.8vw, 0.9rem); height: min(56svh, 38vw); min-height: 16rem; }
.palette__bar {
  flex: 1 1 0; min-width: 0; position: relative; overflow: hidden; outline: none;
  color: #fff; transition: flex-grow 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.palette__bar--dark { color: #111110; }
.palette__tag, .palette__info {
  position: absolute; left: clamp(0.75rem, 1.4vw, 1.4rem); bottom: clamp(0.75rem, 1.4vw, 1.4rem);
  white-space: nowrap; transition: opacity 0.3s ease, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
/* closed: the name reads upwards along the bar */
.palette__tag { writing-mode: vertical-rl; transform: rotate(180deg); font-size: clamp(1rem, 0.6rem + 1vw, 1.6rem); letter-spacing: 0; line-height: 1; }
.palette__info { display: grid; gap: 0.35em; opacity: 0; transform: translateY(0.6rem); }
.palette__name { font-size: var(--fs-tile); line-height: 1; letter-spacing: -0.02em; }
.palette:not(:hover):not(:focus-within) .palette__bar:first-child,
.palette__bar:hover, .palette__bar:focus-visible { flex-grow: 3.2; }
.palette:not(:hover):not(:focus-within) .palette__bar:first-child .palette__tag,
.palette__bar:hover .palette__tag, .palette__bar:focus-visible .palette__tag { opacity: 0; transition-duration: 0.15s; }
.palette:not(:hover):not(:focus-within) .palette__bar:first-child .palette__info,
.palette__bar:hover .palette__info, .palette__bar:focus-visible .palette__info { opacity: 1; transform: none; transition-delay: 0.15s; }
/* Touch screens and narrow windows: stacked rows, each showing its name and hex. */
@media (hover: none), (max-width: 700px) {
  .palette { flex-direction: column; height: auto; min-height: 0; }
  .palette .palette__bar { flex: none; height: 4.5rem; }
  .palette .palette__tag { display: none; }
  .palette .palette__info { opacity: 1; transform: none; top: 50%; bottom: auto; translate: 0 -50%; grid-auto-flow: column; align-items: baseline; gap: 1em; }
}
@media (prefers-reduced-motion: reduce) { .palette__bar, .palette__tag, .palette__info { transition: none; } }

.block__links { list-style: none; display: grid; gap: 0.4em; }

/* A live website in a browser frame; the iframe is laid out at desktop width and scaled to fit. */
/* The whole frame (bar, site, link) stays a little under the height of the screen. */
.live { border: 1px solid var(--line); background: #fff; width: min(100%, calc((92svh - 6rem) * 1.6)); margin-inline: auto; }
.live__screen { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
.live__frame { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; }
.live > .media__caption { margin: 0; padding: 0.75rem 1rem; border-top: 1px solid var(--line); color: var(--ink); }

/* A pair: two images side by side, each filling half the width and (nearly) the height of the screen. */
.block--pair { display: grid; gap: var(--gutter); }
@media (min-width: 900px) {
  .block--pair { grid-template-columns: 1fr 1fr; height: min(100svh, 49vw); }
  .block--pair > .media { min-width: 0; height: 100%; overflow: hidden; }
  .block--pair > .media > .media__asset { width: 100%; height: 100%; aspect-ratio: auto !important; object-fit: cover; }
}

/* Album covers on a parent page (Film): one tile per album. */
.block--albums { display: grid; gap: var(--space-m) var(--gutter); margin-top: var(--space-m); }
.block--albums .album { grid-column: auto; }
.block--albums .tile__media { aspect-ratio: 3 / 2; }
@media (min-width: 700px) { .block--albums { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1300px) { .block--albums { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Photo batches: a titled collage, frames flowing down columns. */
.block--collage { margin-top: var(--space-m); }
.collage__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--gutter); padding-bottom: 1.25rem; }
.collage__title { font-family: var(--font-display); font-size: var(--fs-tile); line-height: 1; text-transform: uppercase; }
.collage__head .label { color: var(--muted); }
.collage { columns: 2; column-gap: clamp(0.5rem, 1.2vw, 1.25rem); }
.collage > .media { break-inside: avoid; margin-bottom: clamp(0.5rem, 1.2vw, 1.25rem); }
@media (min-width: 900px) { .collage { columns: 3; } }

/*
  Photo viewer (js/lib/lightbox.js): the album as a carousel of stacked cards.
  The front card is full size; its neighbours sit behind it, smaller, peeking out left and right.
*/
.collage .media__asset { cursor: var(--cursor-link); }
/* A small arrow in the top right corner of a photo: it opens in the carousel. */
.collage > .media::after {
  content: ""; position: absolute; top: 0.6rem; right: 0.6rem; width: 1.9rem; height: 1.9rem;
  background: rgba(0, 0, 0, 0.55) url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.6'><g transform='rotate(-45 12 12)'><path d='M2 12H21.5M13.6 4.4Q15.8 12 22 12Q15.8 12 13.6 19.6'/></g></svg>") center / 58% no-repeat;
  opacity: 0; transform: translate(-0.3rem, 0.3rem); pointer-events: none;
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.collage > .media:hover::after { opacity: 1; transform: none; }
@media (hover: none) { .collage > .media::after { opacity: 1; transform: none; } }
.has-lightbox { overflow: hidden; }
.lightbox { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, 0.9); color: #fff; }
.lightbox[hidden] { display: none; }
.lightbox__stage { position: absolute; inset: 0; overflow: hidden; touch-action: pan-y; --drag: 0px; }
.lightbox__card {
  position: absolute; left: 50%; top: 50%; display: block;
  --w: 58vw; --h: calc(100svh - 10rem); --r: 1.5; --x: 0px; --s: 1;
  width: min(var(--w), var(--h) * var(--r)); height: auto; aspect-ratio: var(--r); object-fit: cover;
  transform: translate(calc(-50% + var(--x) + var(--drag) * var(--follow, 1)), -50%) scale(var(--s));
  transition: transform 0.65s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease;
  background: var(--placeholder); user-select: none;
}
.lightbox__card[data-pos="0"] { z-index: 3; cursor: var(--cursor-link); }
.lightbox__card[data-pos="-1"] { --s: 0.84; z-index: 2; cursor: var(--cursor-link); }
.lightbox__card[data-pos="1"] { --s: 0.84; z-index: 2; cursor: var(--cursor-link); }
.lightbox__card[data-pos="-2"] { --s: 0.7; z-index: 1; opacity: 0; pointer-events: none; }
.lightbox__card[data-pos="2"] { --s: 0.7; z-index: 1; opacity: 0; pointer-events: none; }
.lightbox__card[data-pos="-3"], .lightbox__card[data-pos="3"] { --s: 0.7; opacity: 0; visibility: hidden; pointer-events: none; }
.lightbox.is-opening .lightbox__card { transition: none; }
/* While dragging, the cards track the pointer directly; the ones behind move a little less. */
.lightbox__stage.is-dragging .lightbox__card { transition: none; }
.lightbox__card:not([data-pos="0"]) { --follow: 0.6; }
.lightbox__btn { position: absolute; z-index: 5; background: none; border: 0; color: inherit; padding: 1.25rem var(--gutter); }
.lightbox__btn:hover, .lightbox__btn:focus-visible { opacity: 0.45; outline: none; }
.lightbox__close { top: 0; right: 0; }
.lightbox__foot { position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; display: grid; gap: 0.35em; justify-items: center; padding: 1.25rem var(--gutter); pointer-events: none; }
.lightbox__count { color: rgba(255, 255, 255, 0.6); }
@media (max-width: 700px) {
  /* Phones: a wider front card. */
  .lightbox__card { --w: 76vw; --h: calc(100svh - 11rem); }
}
@media (orientation: landscape) and (max-height: 500px) {
  /* Phones on their side: the front photo fills the screen top to bottom; Close and the count sit on it. */
  .lightbox__card { --w: 100vw; --h: 100svh; }
  .lightbox__btn, .lightbox__count { text-shadow: 0 0 0.6rem rgba(0, 0, 0, 0.6); }
  .lightbox__close { padding-top: 0.75rem; }
  .lightbox__foot { padding-bottom: 0.6rem; }
}
@media (prefers-reduced-motion: reduce) { .lightbox__card { transition: none; } }

/* Before / after rows on a white sheet (the product shots sit on white). */
.block--compare > .grid { margin-block: var(--space-m); }
.compare { background: #fff; padding: clamp(0.75rem, 2vw, 2rem); }
.compare__row + .compare__row { margin-top: clamp(0.75rem, 1.25vw, 1.25rem); padding-top: clamp(0.75rem, 1.25vw, 1.25rem); border-top: 1px solid var(--line, rgba(17, 17, 16, 0.12)); }
.compare__label { color: var(--muted); padding-bottom: 0.5rem; }
.compare__items { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: clamp(0.5rem, 2vw, 2rem); }
/* Both rows fit in one screen, so before and after can be compared without scrolling. */
.compare .media__asset { background: none; width: 100%; height: auto; max-height: calc((100svh - 11.5rem) / 2); object-fit: contain; }
.compare .media__caption { text-align: center; margin-top: 0.5rem; }
.block__aside { padding-bottom: var(--space-s); }

@media (min-width: 800px) {
  .project__meta { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .block__label { grid-column: 1 / span 4; padding-bottom: 0; padding-top: 0.4em; }
  .block--text .block__body { grid-column: 5 / span 7; }
  .block--columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .block--grid { grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
  .block__aside {
    grid-column: 1 / span 4;
    position: sticky; top: var(--nav-h);
    align-self: start;
    display: grid; gap: 1.25rem;
    padding: 0;
  }
  .block__aside .block__body { max-width: 22em; }
  .block__media { grid-column: 7 / -1; }
}

.next {
  display: grid;
  gap: var(--space-s);
  margin-top: var(--space-l);
  padding: var(--margin) 0;
  border-top: 1px solid var(--line);
}
.next__text { display: flex; flex-direction: column; gap: 1.25rem; }
.next__text .label:last-child { color: var(--muted); }
.next__media { position: relative; overflow: hidden; aspect-ratio: 16 / 10; }

@media (min-width: 800px) {
  .next { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-items: end; }
  .next__text { grid-column: 1 / span 7; }
  .next__media { grid-column: 9 / -1; }
}

/* 9. Motion + transitions -------------------------------------------------- */

/* Masked line reveal for display headings. */
.line { display: block; overflow: clip; overflow-clip-margin: 0.06em; }
.line > span {
  display: block;
  animation: rise 1.1s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 90ms + 80ms);
}
@keyframes rise { from { transform: translateY(105%); } }

.js [data-reveal] {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* Fallback page transition (browsers without the View Transitions API). */
main { transition: opacity 0.22s ease; }
main.is-leaving { opacity: 0; }

/* View transitions: quick cross-fade, shared project image morphs. */
.vt-hero { view-transition-name: project-media; }

::view-transition-old(root) { animation: vt-out 0.28s ease both; }
::view-transition-new(root) { animation: vt-in 0.45s ease 0.12s both; }
::view-transition-group(project-media) {
  animation-duration: 0.7s;
  animation-timing-function: var(--ease-in-out);
}
::view-transition-old(project-media),
::view-transition-new(project-media) {
  width: 100%; height: 100%;
  object-fit: cover;
  animation-duration: 0.7s;
}
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .line > span { animation: none; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .tile .media--fill, .tile__title, .next .media--fill, .cursor span, .link { transition: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
