/* Ohaly — Industrial Design Portfolio
   White ground, pure black type, single neo-grotesque family (Inter),
   full-bleed editorial layout. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@900&display=swap');

:root {
  --white: #ffffff;
  --black: #000000;
  --grey: #6a6a6a;
  --grey-light: #a3a3a3;
  --line: #e6e6e6;
  --accent: #ff3b1f;

  --font: 'Inter', -apple-system, 'Helvetica Neue', Arial, sans-serif;
  /* Titles: Outfit Black, standing in for the reference's Supreme Black */
  --font-display: 'Outfit', 'Inter', -apple-system, 'Helvetica Neue', Arial, sans-serif;

  --pad: clamp(16px, 2.2vw, 30px);
  --gap: clamp(16px, 2vw, 32px);
  --row-gap: clamp(64px, 11vh, 170px);

  --dur: 320ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --topbar-h: 62px;
  --nav-col: 84px;   /* width kept clear for the fixed corner nav */

  /* The three sizes the corner nav is hung off. They live here, rather than in
     the rules that use them, because the nav sits outside every one of those
     elements and still has to know how big their type is. */
  --wm-size: clamp(72px, 25vw, 420px);      /* the home wordmark */
  --title-size: clamp(48px, 15vw, 250px);   /* Works, About, Contact */
  --project-title-size: clamp(52px, 15vw, 250px);
  --nav-size: 20px;                         /* the corner nav itself */
}

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

/* iOS springs the whole document past its end when you keep dragging, so the
   page appears to carry on below the footer. The footer is where the site stops.
   Turning the bounce off also turns off pull-to-refresh. */
html {
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}

/* height:auto keeps width/height attributes (used to reserve space) from
   being taken as a literal pixel height once CSS sets a width. */
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.03em; line-height: 1.08; }

/* Big bold section titles — Ohaly / Work / About / Contact */
.display {
  font-family: var(--font-display);
  font-weight: 900;
  /* Outfit Black is wide and heavy: -0.055em made the letters collide, 0 was
     too airy. -0.025em tightens it without letting them touch. */
  letter-spacing: -0.025em;
  line-height: 0.88;
}
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* Landing on a tile from "Back to works" focuses it, and the red ring above
   would then frame the thumbnail you have just come back to. main.js sets
   is-arriving until the visitor touches the keyboard or the page, so the ring
   still belongs to anyone actually navigating. Both states are covered: engines
   differ on whether a fragment target counts as focus-visible. */
.is-arriving .tile:focus,
.is-arriving .tile:focus-visible { outline: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; left: var(--pad); top: -60px; z-index: 300;
  background: var(--black); color: var(--white);
  padding: 10px 16px; font-size: 14px;
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: 12px; }

/* ---------- Fixed chrome: small logo (inner pages) + Menu ---------- */

.chrome-nav {
  position: fixed;
  top: 18px; right: var(--pad);
  z-index: 200;
  text-align: right;
  /* The size is set here, not on the link. A line box is sized by its own
     strut as well as by what sits on it, and the strut takes the block's
     font-size -- 16px from the body, whatever the link was set to. That makes
     the distance from the nav's box to the first cap depend on which of the two
     is taller, so it does not scale with the type. Setting the size on the nav
     itself puts the strut and the link at the same size, and the offset becomes
     a plain fraction of it, which is what the alignment rules below rely on. */
  font-size: var(--nav-size);
  line-height: 1.35;
}
.chrome-nav ul { display: grid; gap: 3px; }
.chrome-nav a {
  font-weight: 500;
  letter-spacing: -0.02em;
  transition: color var(--dur) var(--ease);
}
.chrome-nav a:hover { color: var(--accent); }
/* The way home sits above the sections, set apart from them */
.nav-home { margin-bottom: 10px; }
.nav-home a { font-weight: 700; }
.chrome-nav a[aria-current="page"] { color: var(--grey); }
/* Over a dark photo the links flip to light (set per link by main.js) */
.chrome-nav a.on-dark { color: #fff; }
.chrome-nav a.on-dark[aria-current="page"] { color: rgba(255, 255, 255, 0.72); }
.chrome-nav a.on-dark:hover { color: var(--accent); }

/* Corner nav size per device: 15px suits a laptop, but reads oversized on a
   phone and undersized on a tablet held at arm's length. */
@media (max-width: 599px) {
  :root { --nav-col: 70px; --nav-size: 13px; }
  .chrome-nav ul { gap: 1px; }
  .nav-home { margin-bottom: 7px; }
}
@media (min-width: 600px) and (max-width: 1199px) {
  :root { --nav-col: 100px; --nav-size: 18px; }
  .chrome-nav ul { gap: 4px; }
  .nav-home { margin-bottom: 12px; }
}

/* ---------- Masthead (home) ---------- */

.masthead {
  padding: var(--pad) var(--pad) clamp(24px, 5vh, 56px);
}
/* The O is set at full size; the rest of the wordmark steps down, sharing
   the same baseline. */
.masthead-title .wm-rest { font-size: 1em; }

/* Hovering the wordmark runs it through an animated displacement map, the
   liquid warp the reference gets from a WebGL shader. Pointer devices only. */
.wm-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.masthead-title.is-warping { filter: url(#wm-warp); }

.masthead-title {
  position: relative;
  display: inline-block;
  margin: 0;
  font-size: var(--wm-size);
  padding-bottom: 0.06em;
  /* Measured: the O's ink starts 0.0838em below the heading box top, and its
     left sidebearing is 0.023em. Pulling up by the difference makes the gap
     above the O equal the gap to its left, and both scale with the type. */
  margin-top: -0.0608em;
}

/* ---------- Featured projects (auto-cycling) ---------- */

.featured { padding: 0 var(--pad); }

/* The opening film, where the home page carries one instead of the slideshow.
   It is framed exactly as the slideshow stage was, so swapping between them
   changes what plays and not how the page sits. The film is padded to 16:9 on
   white, which is the page's own ground, so a clip that was shot 4:3 simply
   appears narrower rather than sitting in visible bars. */
.opening { padding: 0 var(--pad); }
/* On anything wider than a phone the film is given a fifth more height and set
   further down the page, so it is not crowded under the wordmark. A phone's
   film is held by the width of the screen rather than its height, so neither
   number reaches it. */
@media (min-width: 600px) {
  .opening { padding-top: clamp(20px, 4vh, 48px); }
}
.opening video {
  display: block;
  /* The film keeps its own shape, which --film-ar carries from the file itself,
     so a 4:3 cut is not letterboxed into a 16:9 hole. Width gives way first, so
     a tall film narrows to stay within 74vh instead of being cropped. The
     element also carries height="...", which the browser applies as a style of
     its own; height:auto is what lets the ratio win. */
  width: min(100%, calc(88.8vh * var(--film-ar, 1.7778)));   /* 74vh, a fifth larger */
  height: auto;
  aspect-ratio: var(--film-ar, 1.7778);
  margin-inline: auto;
  background: var(--white);
}

.featured-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 74vh;
  background: var(--white);
}
@media (max-width: 700px) {
  .featured-stage { aspect-ratio: 4 / 3; }
}

.featured-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 300ms var(--ease);
  pointer-events: none;
}
.featured-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}
.featured-slide img,
.featured-slide video {
  display: block;
  width: 100%; height: 100%;
  object-fit: contain;
}

.featured-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--gap);
  padding-top: 14px;
  flex-wrap: wrap;
}
/* Auto-advancing content needs a stop mechanism (WCAG 2.2.2), but it doesn't
   need to be visible: this one stays out of the layout until focused. */
.featured-pause {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  color: var(--grey);
  font-size: 13px;
}
.featured-pause:focus {
  position: static;
  width: auto; height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
}

/* ---------- Statement ---------- */

.statement {
  padding: clamp(90px, 16vh, 220px) var(--pad) clamp(60px, 10vh, 140px);
}
.statement p {
  font-size: clamp(24px, 3.35vw, 46px);
  line-height: 1.17;
  letter-spacing: -0.032em;
  width: min(100%, 56vw);
  max-width: 40ch;
}
.statement .statement-more {
  margin-top: clamp(24px, 4vh, 48px);
  font-size: 15px;
  letter-spacing: -0.01em;
}
.statement .statement-more a {
  border-bottom: 1px solid var(--black);
  padding-bottom: 2px;
}
.statement .statement-more a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Tile size slider ----------
   Left is the biggest and is the designed mosaic itself, which the page opens
   on; each notch after it is an even grid of that many columns -- three and
   four on a desktop, two and three on a phone. The mosaic's own spans, shapes
   and drops are set inside a min-width query, so the grid rules below have to
   outrank them. */

.tile-size {
  /* inline-flex so it shrinks to the slider, which the drawn handle is
     positioned against */
  display: inline-flex;
  position: relative;
  align-items: center;
  gap: 12px;
  margin-top: clamp(16px, 2.5vh, 28px);
  font-size: 13px;
  color: var(--grey);
  letter-spacing: -0.01em;
}
.tile-size input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: clamp(110px, 16vw, 190px);
  height: 18px;
  margin: 0;              /* the UA's 2px would offset the drawn dot from the real thumb */
  background: transparent;
  cursor: pointer;
}
.tile-size input[type="range"]::-webkit-slider-runnable-track {
  height: 1px; background: var(--line);
}
.tile-size input[type="range"]::-moz-range-track {
  height: 1px; background: var(--line);
}
/* The real handle stays where it is and keeps the dragging, the keyboard and
   the hit area; it is only made invisible. A native one cannot be animated --
   it is wherever its value says it is -- so the visible dot is a separate
   element that slides to each new position after the value has already
   changed. The thumbnails still land on whole columns; it is the handle that
   travels rather than jumping. */
.tile-size input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 11px; height: 11px; margin-top: -5px;
  border-radius: 50%; background: transparent; border: 0;
}
.tile-size input[type="range"]::-moz-range-thumb {
  width: 11px; height: 11px;
  border-radius: 50%; background: transparent; border: 0;
}

.tile-size-dot {
  position: absolute;
  top: 50%;
  width: 11px; height: 11px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: var(--black);
  pointer-events: none;
  left: calc((100% - 11px) * var(--p, 0));
  transition: left 260ms var(--ease);
}
/* while the handle is being dragged it has to sit under the pointer, so the
   glide is switched off and turned back on for the settle at the end */
.tile-size.is-dragging .tile-size-dot { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .tile-size-dot { transition: none; }
}
.tile-size input[type="range"]:focus-visible { outline: 2px solid var(--black); outline-offset: 4px; }

/* The grid, once the slider leaves the mosaic. The slider itself moves freely,
   but a row can only hold a whole number of tiles, so the layout lands on whole
   columns and the thumbnails change size in one step as the slider crosses the
   middle. The mosaic's own spans, shapes and drops are set inside a min-width
   query, so these have to outrank them. */
/* The denser views are laid out by hand in tools/layout_tool.py, which writes
   content/mosaic-layouts.json; build_site turns that into the placement rules
   printed into works.html. Here is only the frame they are placed on: twelve
   columns and square rows, so a tile spanning w columns by h rows really is
   w:h, and a layout holds its proportions at any screen width.

   Without a saved layout the placement rules are absent and tiles simply flow,
   which is the fallback rather than the intent. */
.mosaic[data-cols] {
  --mosaic-unit: calc((100vw - 2 * var(--pad) - 11 * var(--gap)) / 12);
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: var(--mosaic-unit);
  row-gap: var(--gap);
  align-items: stretch;
}
.mosaic[data-cols] .tile {
  margin-top: 0 !important;
  min-width: 0;
  min-height: 0;
}
/* the frame fills the cell it was given, so the shape is the one that was
   drawn in the tool rather than the photo's own */
.mosaic[data-cols] .tile .tile-frame {
  aspect-ratio: auto !important;
  height: 100%;
}

/* ---------- Mosaic (asymmetric project arrangement) ---------- */

.mosaic {
  padding: 0 var(--pad) clamp(80px, 14vh, 190px);
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gap);
  row-gap: var(--row-gap);
  align-items: start;
}

.tile { display: block; position: relative; }

/* Coming back from a project page lands on that project's own tile, not at the
   top of the mosaic. The margin keeps the tile clear of the fixed corner nav,
   and the grey ring fades out rather than staying, so the eye is pointed at the
   tile without the page being left permanently marked. */
.tile { scroll-margin-top: clamp(24px, 9vh, 96px); }

@keyframes tile-found {
  from { box-shadow: 0 0 0 2px var(--grey-light); }
  to   { box-shadow: 0 0 0 2px rgba(163, 163, 163, 0); }
}
.tile:target .tile-frame { animation: tile-found 1300ms var(--ease) 200ms both; }
@media (prefers-reduced-motion: reduce) {
  /* no fade to follow, so the mark is quieter again and simply stays */
  .tile:target .tile-frame { animation: none; box-shadow: 0 0 0 2px var(--line); }
}

.tile-frame {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--white);
}
/* Photos stay in colour. Hovering a tile cycles its frames; it no longer
   changes the treatment. */
.tile-img {
  width: 100%; height: 100%;
  object-fit: contain;
  transition: opacity var(--dur) var(--ease);
}
.tile[data-fit="cover"] .tile-img { object-fit: cover; }

/* Asymmetric placement — sizes and offsets vary per tile. Tiles are numbered
   t1–t6 and the sequence repeats, so any number of projects keeps the rhythm.
   No explicit rows: a tile whose column starts left of where the previous one
   ended drops to the next row by itself, which pairs t1/t2, t3/t4, t5/t6. */
@media (min-width: 900px) {
  .t1 { grid-column: 1 / span 6; }
  .t1 .tile-frame { aspect-ratio: 16 / 10; }

  .t2 { grid-column: 8 / span 5; margin-top: 16vh; }
  .t2 .tile-frame { aspect-ratio: 4 / 3; }

  .t3 { grid-column: 2 / span 5; }
  .t3 .tile-frame { aspect-ratio: 4 / 3; }

  .t4 { grid-column: 8 / span 5; margin-top: 13vh; }
  .t4 .tile-frame { aspect-ratio: 16 / 11; }

  .t5 { grid-column: 1 / span 4; margin-top: 4vh; }
  .t5 .tile-frame { aspect-ratio: 3 / 4; }

  .t6 { grid-column: 6 / span 7; margin-top: 20vh; }
  .t6 .tile-frame { aspect-ratio: 16 / 10; }

  /* A project can override the shape of the slot it lands in, keeping its
     place and column span. Only here: below 900px every tile is 4:3. */
  .tile.shape-wide .tile-frame { aspect-ratio: 16 / 10; }
  .tile.shape-tall .tile-frame { aspect-ratio: 3 / 4; }
}

/* The mosaic's narrow form is a single column. It is scoped away from the
   hand-made densities, which place every tile themselves and would otherwise
   be overruled by this !important and stack all of them on top of each other. */
@media (max-width: 899px) {
  .mosaic:not([data-cols]) { row-gap: clamp(44px, 7vh, 80px); }
  .mosaic:not([data-cols]) .tile { grid-column: 1 / -1 !important; margin-top: 0 !important; }
  .mosaic:not([data-cols]) .tile .tile-frame { aspect-ratio: 4 / 3; }
}

/* ---------- Page headers (inner pages) ---------- */

.page-head {
  padding: var(--pad) var(--pad) clamp(28px, 5vh, 56px);
}
.page-kicker {
  font-size: 13px;
  color: var(--grey);
  letter-spacing: 0.02em;
  margin-bottom: clamp(14px, 2vh, 26px);
  display: block;
}
.page-head h1 {
  font-size: calc(var(--title-size) * var(--fit, 1));
  padding-right: var(--nav-col);
  padding-bottom: 0.04em;
  margin-top: -0.0608em;   /* cap sits flush at the top, same as the wordmark */
}

/* ---------- Work index ---------- */

.work-list {
  padding: 0 var(--pad) clamp(80px, 14vh, 180px);
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gap);
  row-gap: var(--row-gap);
  align-items: start;
}

/* ---------- Project detail ---------- */

.project-head {
  padding: var(--pad) var(--pad) clamp(24px, 4vh, 44px);
  display: grid;
  /* minmax(0, …): a grid track otherwise grows to fit the longest word, pushing
     long titles off-screen instead of letting them wrap or shrink to fit */
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(16px, 3vh, 30px);
}
.project-head h1 {
  font-size: calc(var(--project-title-size) * var(--fit, 1));
  padding-right: var(--nav-col);
  padding-bottom: 0.04em;
  margin-top: -0.0608em;
}

@media (max-width: 599px) {
  /* on a phone the title and the film it introduces belong close together */
  .project-head { padding-bottom: 35px; }
  .project-partner { padding-top: clamp(14px, 2vh, 22px); }
}

.project-cover {
  padding: 0 var(--pad);
}
/* A render floats on white and brings its own margin; a film on a solid ground
   starts at its own edge, so it needs the space between it and the title made. */
.project-cover.has-ground {
  padding-top: clamp(20px, 3vh, 36px);
}
.project-cover img {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
}
/* The box is held to the film's own shape. A `height` attribute is a
   presentational hint, so without this the box keeps the film's pixel height,
   gets clamped to 78vh and leaves the film letterboxed in a band of empty
   space — and no film is ever trimmed to fit a box that is not its shape. */
.project-cover .project-loop {
  display: block;
  width: min(100%, calc(78vh * var(--film-ar, 1.6)));
  height: auto;
  margin-inline: auto;
  object-fit: contain;
}

@media (max-width: 599px) {
  /* A render that carries a generous studio margin is trimmed top and bottom on
     a narrow screen, so the piece fills the frame rather than floating in it.
     Only a film that asks for it: the others are shown whole, never cropped. */
  .project-cover .project-loop.is-trimmed {
    aspect-ratio: 1.8;
    height: auto;
    max-height: none;
    object-fit: cover;
  }
}

/* Spec callouts over a cover render (Hybrid). The figure is a size container:
   the wide diagram (labels beside the desk) only shows once it is big enough for
   its labels to read; below that the narrow diagram (labels above and below a
   cropped render) takes over. */
.spec-figure {
  --spec: #b65a3a;
  container-type: inline-size;
  width: min(100%, 1600px, calc(92vh * var(--spec-ar, 1.6)));
  margin: 0 auto;
}
/* the same clearance on both sides, so the wide diagram stays centred and its
   labels pass clear of the fixed corner nav. The narrow one keeps its labels
   inside its own canvas, and at phone width needs every pixel it can get. */
.spec-wide {
  position: relative;
  display: none;
  padding-inline: calc(var(--nav-col) * 0.7);
  box-sizing: border-box;
}
.project-film {
  padding: 0 var(--pad) clamp(56px, 10vh, 130px);
}
.project-film figure { margin: 0 auto; max-width: 1280px; }
.project-film video,
/* a still may stand over the film; it is framed exactly like it */
.project-film img { display: block; width: 100%; height: auto; }
.project-film figure + figure { margin-top: clamp(24px, 4vh, 56px); }
/* ---------- Back to works ---------- */

/* Sits at the foot of every project page and carries that project's own slug,
   so Works opens on its tile. */
.project-back {
  display: flex;
  padding: clamp(32px, 6vh, 80px) var(--pad) clamp(64px, 11vh, 140px);
}
.project-back a {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--black);
  text-decoration: none;
}
.project-back a:hover,
.project-back a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 5px;
}
.back-arrow {
  display: inline-block;
  transition: transform var(--dur) var(--ease);
}
.project-back a:hover .back-arrow { transform: translateX(-5px); }

/* a photo lifted out of the gallery to stand under the description: framed
   exactly like a film, so the two read as one column down the page */
.project-lead-photo { padding: 0 var(--pad) clamp(56px, 10vh, 130px); }
.project-lead-photo figure { margin: 0 auto; max-width: 1280px; }
.project-lead-photo img { display: block; width: 100%; height: auto; }

.project-film figcaption {
  margin-top: 10px;
  font-size: 13px;
  color: var(--grey);
}

.project-specs {
  padding: 0 var(--pad) clamp(56px, 10vh, 130px);
}
.spec-plate img { display: block; width: 100%; height: auto; }
.spec-wide .spec-callouts {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.spec-narrow { max-width: 560px; margin: 0 auto; }
.spec-narrow .spec-callouts { display: block; width: 100%; height: auto; overflow: visible; }
.spec-callouts { pointer-events: none; }
.spec-callouts polyline {
  fill: none;
  stroke: var(--spec);
  stroke-width: 1.1px;
  vector-effect: non-scaling-stroke;
}
.spec-callouts circle { fill: var(--spec); }
.spec-callouts text {
  font-size: var(--spec-fs, 26px);
  letter-spacing: -0.01em;
  fill: var(--grey);
}
.spec-narrow .spec-callouts text { font-size: var(--spec-fs-n, 30px); }
.spec-narrow .spec-callouts circle { r: 7px; }

@container (min-width: 880px) {
  .spec-wide { display: block; }
  .spec-narrow { display: none; }
}

/* The producer's logo always sits at the right. Narrow pages stack it above the
   description; from 900px the two sit side by side, aligned at the top. */
.project-partner {
  display: flex;
  justify-content: flex-end;
  margin-bottom: clamp(20px, 3vh, 30px);
  /* stacked above the text, it still reaches the page's right margin: the body
     holds a nav-wide column clear on the right, so that is given back here */
  margin-right: calc(var(--nav-col) * -1);
}
@media (max-width: 899px) {
  /* stacked, the logo sits just under the film and the text right below it,
     so the three read as one block rather than drifting apart */
  .project-body.with-partner { padding-top: clamp(14px, 2vh, 24px); }
  .project-partner { margin-bottom: clamp(10px, 1.6vh, 18px); }
}

@media (min-width: 900px) {
  .project-body.with-partner {
    /* the logo leads this block, and sits closer to the film above it than a
       page of running text would */
    padding-top: clamp(26px, 4.8vh, 62px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: var(--gap);
    align-items: start;
    /* the logo sits at the page's right margin, like the nav above it */
    padding-right: var(--pad);
  }
  .with-partner .project-text { grid-area: 1 / 1; }
  .with-partner .project-partner {
    grid-area: 1 / 2;
    margin-bottom: 0;
    margin-right: 0;
    /* drop it by the first line's leading so the logo's top edge lines up with
       the top of the text rather than with its invisible line box */
    margin-top: 0.3em;
  }
}
.project-partner img {
  display: block;
  /* a credit, not a banner: it keeps its share of the page on a phone too */
  width: min(143px, 22.5vw);
  height: auto;
}

.project-body {
  padding: clamp(56px, 10vh, 130px) var(--pad);
  /* the fixed corner nav sits over this column on narrow screens */
  padding-right: calc(var(--pad) + var(--nav-col));
}
.project-desc {
  font-size: clamp(19px, 2.1vw, 28px);
  line-height: 1.3;
  letter-spacing: -0.025em;
  max-width: 40ch;
}
.project-desc.is-placeholder { color: var(--grey); }
/* Real project write-ups run longer than a one-line placeholder */
.project-text {
  font-size: clamp(17px, 1.55vw, 21px);
  line-height: 1.55;
  letter-spacing: -0.015em;
  max-width: 62ch;
}
.project-text p + p { margin-top: 1em; }
/* A page whose description is a spec list: set smaller and tighter than prose. */
.project-text.is-dense {
  font-size: clamp(13.5px, 1vw, 15.5px);
  line-height: 1.45;
  max-width: 56ch;
}
.project-text.is-dense p + p { margin-top: 0.8em; }

.project-points {
  list-style: none;
  margin: 0.7em 0 0;
  padding: 0;
}
.project-points li {
  position: relative;
  padding-left: 1em;
  margin-top: 0.15em;
}
.project-points li::before {
  content: '•';
  position: absolute;
  left: 0.08em;
  color: var(--grey);
}
.project-text ul + p { margin-top: 1.1em; }
.project-text strong { font-weight: 600; }
/* a date sits directly under the paragraph it belongs to */
.project-text p + p.project-date { margin-top: 0.2em; }
.project-credits {
  margin-top: 1.4em;
  font-size: 13px;
  color: var(--grey);
  /* a credit keeps to the same measure as the text it belongs to */
  max-width: 62ch;
}
/* a credit that belongs to the statement above it rather than to the small
   print at the foot of a page: set as body text, not as a caption */
.project-credits.is-body {
  font-size: clamp(17px, 1.55vw, 21px);
  line-height: 1.55;
  letter-spacing: -0.015em;
  color: var(--black);
}
.project-credits strong { font-weight: 600; }
.project-text + .project-credits { margin-top: 2em; }
.project-text + .project-credits.is-body { margin-top: 1em; }
.project-credits + .project-credits { margin-top: 0.3em; }
.placeholder-note {
  display: inline-block;
  margin-top: 18px;
  font-size: 13px;
  color: var(--grey-light);
  border: 1px dashed var(--line);
  padding: 6px 10px;
}

/* Justified rows: every photo in a row shares one height and keeps its own
   proportions, so rows end flush however differently the photos are shaped. */
.project-gallery {
  --row-h: clamp(220px, 34vh, 420px);
  padding: 0 var(--pad) clamp(60px, 10vh, 130px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;   /* a short last row sits centred, not stranded left */
  gap: var(--gap);
}
.project-gallery > figure > img {
  display: block;
  width: 100%;
  height: var(--row-h);
  object-fit: cover;
}
/* full-width and closing photos stand on their own row, uncropped */
.project-gallery > figure.wide,
.project-gallery > figure.centred { flex: 0 0 100%; }
/* a film standing in a gallery row is framed exactly as a photograph there is,
   so a portrait one is held to a screenful rather than run to the column width
   and made two screens tall */
.project-gallery > figure.wide > video,
.project-gallery > figure.wide > img,
.project-gallery > figure.centred > img {
  display: block;   /* a video is inline by default, and margin auto would not centre it */
  /* a full-width photo is capped at a screenful and centred, so a tall one is
     shown as large as it can be without a letterbox around it */
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 80vh;
  margin-inline: auto;
}
/* a gallery set to one photo per row can instead run them all to the full
   column width, so the run reads as a single edge down the page however
   differently the photos are shaped -- a tall one is then taller than the screen */
.project-gallery.is-full > figure.wide > img {
  width: 100%;
  max-height: none;
}

/* Upright photographs set to one width (EQUAL_PORTRAITS in build_site.py),
   which each figure carries as --pin: the narrowest of their own ratios. In a
   justified row they are pinned rather than allowed to grow, since justifying
   stretches each picture by whatever that row needs -- which is what made them
   different widths to begin with. A photo standing on its own row is sized by
   its height instead, so there the width goes on the picture: 80vh is the cap
   it already had, so the narrowest still fills a screenful and the rest come
   out shorter rather than wider.

   Only on a wide screen. Below that every photo takes the full column, and a
   pinned width would leave a tall picture stranded a third of the way across. */
@media (min-width: 900px) {
  /* :not(.wide) -- a photo on its own row keeps the full column and is sized
     by the rule below instead; without this it would take the pinned basis and
     come out a sixth of the screen wide */
  .project-gallery > figure.pinned:not(.wide) {
    flex: 0 0 calc(var(--row-h) * var(--pin));
    max-width: none;
  }
  .project-gallery > figure.wide.pinned > img {
    width: min(100%, calc(80vh * var(--pin)));
    height: auto;
  }
}

@media (max-width: 899px) {
  .project-gallery > figure { flex: 0 0 100%; max-width: 100%; }
  .project-gallery > figure > img { height: auto; }
}
.project-gallery figure { margin: 0; }
.project-gallery figure.centred > img {
  width: min(100%, 620px);
  margin-inline: auto;
}
.video-frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* The cover takes the pointer, so YouTube's own title bar and controls never
   appear; a progress bar of the site's own rises at the foot on hover. */
.video-frame .video-cover {
  position: absolute;
  inset: 0;
  cursor: pointer;
}
.video-frame .video-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.28);
  opacity: 0;
  transition: opacity 180ms var(--ease), height 180ms var(--ease);
}
.video-frame:hover .video-progress,
.video-frame:focus-within .video-progress { opacity: 1; height: 5px; }
.video-frame .video-played {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}
/* reduced motion, or no scripting: the player keeps its own controls */
.video-frame.is-manual .video-cover { display: none; }

/* The sound control, on the films whose sound is part of the work. It sits
   above the cover -- the cover takes every pointer event in the frame, so a
   button underneath it could never be pressed -- and stays visible instead of
   rising on hover, because a visitor who never brings the pointer to the film
   would otherwise never learn there was anything to hear. */
.video-frame .video-sound {
  position: absolute;
  right: 12px; bottom: 14px;
  z-index: 2;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.video-frame .video-sound:hover { background: var(--accent); }
.video-frame .video-sound[aria-pressed="true"] { background: rgba(0, 0, 0, 0.38); }
.video-frame .video-sound[aria-pressed="true"]:hover { background: var(--accent); }
/* with the player's own controls showing, its volume button is the real one */
.video-frame.is-manual .video-sound { display: none; }

/* A film long enough to want moving through carries a bar of its own, which
   rises at the foot of the picture on hover. The wrapper is held to the film's
   shape so the bar stops where the picture does. Andy's film is a pale grey
   set, so the bar is dark; --scrub-ink and --scrub-bed flip it for a dark one. */
.video-scrub {
  position: relative;
  width: min(100%, calc(78vh * var(--film-ar, 1.7778)));
  margin-inline: auto;
}
.video-scrub .project-loop { width: 100%; }
.video-scrubbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 18px;
  display: flex;
  align-items: flex-end;
  cursor: pointer;
  opacity: 0;
  transition: opacity 180ms var(--ease);
}
.video-scrub:hover .video-scrubbar,
.video-scrub.is-scrubbing .video-scrubbar,
.video-scrubbar:focus-visible { opacity: 1; }
.video-scrubbar:focus-visible { outline: none; }
.video-track {
  width: 100%;
  height: 3px;
  background: var(--scrub-bed, rgba(0, 0, 0, 0.16));
  transition: height 180ms var(--ease);
}
.video-scrub:hover .video-track,
.video-scrub.is-scrubbing .video-track,
.video-scrubbar:focus-visible .video-track { height: 5px; }
.video-scrub .video-played {
  display: block;
  height: 100%;
  width: 0;
  background: var(--scrub-ink, rgba(0, 0, 0, 0.62));
}
/* a touch screen has no hover to reveal the bar, so it stays in view */
.video-scrub.is-touch .video-scrubbar { opacity: 1; }

/* full screen: the film fills the screen whole, and the bar rides over it */
.video-scrub:fullscreen,
.video-scrub:-webkit-full-screen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  background: var(--black);
  --scrub-bed: rgba(255, 255, 255, 0.28);
  --scrub-ink: #fff;
}
.video-scrub:fullscreen .project-loop,
.video-scrub:-webkit-full-screen .project-loop {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

/* turned sideways, a phone gives the film the whole width of the screen */
@media (max-width: 899px) and (orientation: landscape) {
  .project-cover.has-ground { padding: 0; }
  .project-cover .video-scrub {
    width: 100%;
    max-width: none;
  }
  .project-cover .video-scrub .project-loop {
    aspect-ratio: auto;
    max-height: 100vh;
    object-fit: contain;
  }
}
.project-gallery figcaption {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--grey);
  max-width: 60ch;
}
.project-gallery img { width: 100%; }
.project-gallery .wide { grid-column: 1 / -1; }
@media (max-width: 700px) {
  .project-gallery { grid-template-columns: 1fr; }
  .project-gallery .wide { grid-column: auto; }
}


/* ---------- About ---------- */

.about-grid {
  /* The display title is up to 250px tall and the bio sets at 17-22px, so the
     shared page-head padding leaves them crowded on a page that is nothing but
     text. The extra breath is added here rather than on .page-head, which Works
     also uses -- there a mosaic follows the title and the tighter gap is right. */
  padding: clamp(32px, 6vh, 72px) var(--pad) clamp(80px, 12vh, 160px);
}

.bio {
  font-size: clamp(17px, 1.55vw, 22px);
  line-height: 1.62;
  letter-spacing: -0.017em;
  max-width: 62ch;
}
.bio p + p { margin-top: 1.35em; }

.cv-block { margin-top: clamp(32px, 5vh, 60px) !important; }
.cv-link {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 14px; font-weight: 500;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--black);
  padding-bottom: 3px;
}
.cv-link:hover { color: var(--accent); border-color: var(--accent); }
.cv-link svg { width: 14px; height: 14px; }

/* ---------- Contact ---------- */

/* Contact holds four lines, so it should sit on one screen and stop there.
   100dvh did neither: it measured a whole viewport and then let the footer add
   itself underneath, which left every phone with a screenful of content and a
   strip of scroll after it. Worse, dvh grows as Safari retracts its toolbar, so
   the block kept growing while it was being scrolled and the footer kept
   retreating. svh is the viewport with the toolbars still showing -- it never
   grows -- and the page is laid out as one column that the footer belongs to,
   so the two together come to a screen rather than a screen plus a footer. */
body:has(.contact-page) {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
/* the column already gives it everything the footer does not use, so its own
   viewport height would only add that height back on top of the footer */
body:has(.contact-page) .contact-page { flex: 1 1 auto; min-height: 0; }
body:has(.contact-page) > main { display: flex; flex-direction: column; flex: 1 1 auto; }

.contact-page {
  min-height: 100svh;
  padding: var(--pad) var(--pad) clamp(40px, 7vh, 84px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(56px, 10vh, 130px);
}
.contact-title {
  font-size: calc(var(--title-size) * var(--fit, 1));
  padding-right: var(--nav-col);
  padding-bottom: 0.04em;
  margin-top: -0.0608em;
}
.contact-foot {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: clamp(26px, 4vh, 44px);
}
.contact-lede {
  font-size: clamp(16px, 1.5vw, 21px);
  line-height: 1.35;
  letter-spacing: -0.022em;
  max-width: 34ch;
}
.contact-details {
  display: grid;
  gap: 4px;
  font-size: clamp(16px, 1.5vw, 21px);
  letter-spacing: -0.022em;
}
.contact-details a { overflow-wrap: anywhere; }
.contact-details a:hover { color: var(--accent); }

/* The dark pages: Contact, and any project whose work was photographed on
   black (DARK_PAGES in build_site.py, which puts is-dark on the body). The
   colour tokens are redefined for the page rather than each rule overridden, so
   everything that paints with them -- the corner nav, the footer and its rule,
   the skip link, captions and credits -- turns over without being named here. The greys are lifted and the hairline dropped,
   because a value that reads against white disappears against black.

   The nav's own light/dark switch cannot help: it only fires where a photo sits
   under a link, and this page has none, so the links take the page's colour.

   color-scheme carries the dark ground into the scrollbar and any UI the
   browser draws for itself. */
body:has(.contact-page),
body.is-dark {
  --white: #000000;
  --black: #ffffff;
  --grey: #9b9b9b;
  --grey-light: #6f6f6f;
  --line: #2b2b2b;
  color-scheme: dark;
  background: var(--white);
  color: var(--black);
}

/* ---------- Full-screen photo view ---------- */

.project-gallery > figure > img { cursor: zoom-in; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: var(--white);
  display: grid;
  /* minmax(0, …): a plain 1fr row grows to the photo's own height, which pushes
     a tall photo off the screen instead of fitting it */
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
  padding: clamp(44px, 6vh, 72px) clamp(16px, 4vw, 64px) clamp(20px, 4vh, 40px);
}
.lightbox[hidden] { display: none; }
.lightbox img {
  grid-row: 1;
  justify-self: center;
  align-self: center;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.lightbox figcaption {
  grid-row: 2;
  text-align: center;
  font-size: 13px;
  color: var(--grey);
}
.lightbox button {
  position: absolute;
  border: 0;
  background: none;
  color: var(--black);
  font: inherit;
  line-height: 1;
  cursor: pointer;
  padding: 10px;
}
.lightbox button:hover { color: var(--accent); }
.lightbox .lb-close {
  top: clamp(10px, 2vh, 20px);
  right: clamp(10px, 2vw, 24px);
  font-size: 28px;
}
.lightbox .lb-prev, .lightbox .lb-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 34px;
}
.lightbox .lb-prev { left: clamp(4px, 1.5vw, 20px); }
.lightbox .lb-next { right: clamp(4px, 1.5vw, 20px); }
.lightbox .lb-count {
  position: absolute;
  top: clamp(14px, 2vh, 24px);
  left: clamp(16px, 4vw, 64px);
  font-size: 13px;
  color: var(--grey);
}
body.lb-open { overflow: hidden; }

/* ---------- Footer ---------- */

.site-footer {
  /* the rule stops where the wordmark starts and where the menu ends, rather
     than running out to the edges: it is drawn inside the footer's own padding
     as a pseudo-element, since a border would follow the full-width box */
  position: relative;
  padding: clamp(32px, 5vh, 56px) var(--pad) clamp(24px, 4vh, 40px);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: var(--gap);
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--grey);
}
.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--pad);
  right: var(--pad);
  border-top: 1px solid var(--line);
}

.site-footer a:hover { color: var(--black); }

/* ---------- Hanging the corner nav off the page's own title ----------
   The menu is positioned from the title rather than from the top of the screen,
   so the two read as one line of type instead of two things that happen to be
   near each other.

   Nothing here is guessed. Each number is the slope of a straight line fitted
   to the page itself at three sizes -- the baseline found with a zero-height
   inline box, the glyph tops taken from the font -- so the rule holds at every
   width while the type changes size under it. The small pixel left over at the
   end is the intercept of those lines: where a line box lands after rounding,
   which does not scale with the type and so cannot be folded into the slope.

   Every page hangs the menu off the same line through the type: the
   x-height of the title. On home that is the a in Ohaly, which the W of
   Works meets; on Works, About and Contact it is the o, which the O of
   Ohaly meets. One line, so the menu keeps its height in the letters
   instead of jumping up to the cap the moment you leave home. 0.2472 is
   that line measured on the page titles and 0.2486 the same line on the
   wordmark -- they differ only by the box each title sits in.

   Because the x-height does not depend on which letter a title starts
   with, Works, About and Contact can share one number. The cap line could
   not: a round C hangs past a flat W, which is why those two rules used to
   carry different slopes.

   The 0.2725 and 0.2627 are the same distance -- the first link's own ink
   inside the box the nav positions -- measured to a W and to a round O, which
   overshoots by about a hundredth of an em.

   --title-fit is what the script in main.js had to take off a title too wide
   for its column; the menu follows it down rather than hanging in the air. */
body:has(.masthead) .chrome-nav {
  top: calc(var(--pad) + 0.2486 * var(--wm-size)
            - 0.2725 * var(--nav-size) - 1.11px);
}
body:has(.page-head) .chrome-nav,
body:has(.contact-page) .chrome-nav {
  top: calc(var(--pad) + 0.2472 * var(--title-size) * var(--title-fit, 1)
            - 0.2627 * var(--nav-size) - 0.50px);
}
body:has(.project-head) .chrome-nav {
  top: calc(var(--pad) + 0.0387 * var(--project-title-size) * var(--title-fit, 1)
            - 0.2627 * var(--nav-size) - 0.77px);
}

/* Ohaly belongs to the menu, not above it: the same gap as the rest of it */
.nav-home { margin-bottom: 0; }

/* On a phone the screen is the whole page, so the titles are set 20% larger
   than the shared 15vw. Each still passes through --fit, so a title that would
   run into the corner nav is pulled back rather than clipped. */
@media (max-width: 599px) {
  :root { --title-size: clamp(58px, 18vw, 250px); }
}

@media (max-width: 760px) {
  /* At 26vw the wordmark clears the nav horizontally, so it can stay at the
     top like it does on desktop — keeping the gap above the O equal to the
     gap beside it. */
  :root { --wm-size: 26vw; }

  /* The 56vw measure is a desktop cap — on a phone it squeezes the statement
     to a few words per line, so let it use the full column. */
  .statement {
    padding-top: clamp(48px, 8vh, 80px);
    padding-bottom: clamp(40px, 7vh, 72px);
  }
  .statement p {
    width: 100%;
    max-width: none;
    font-size: clamp(23px, 6.2vw, 30px);
  }
}
