/* =========================================================
   Chayapa — portfolio
   Layout is drawn on a 1440px-wide wireframe:
   logo at 40px, content starts at 270px, right edge at 40px.
   ========================================================= */

/* Typeface: ABC Gramercy (Dinamo), Regular and Regular Italic, served from fonts/ */
@font-face {
  font-family: "ABC Gramercy";
  src: url("fonts/ABCGramercyTrial-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "ABC Gramercy";
  src: url("fonts/ABCGramercyTrial-RegularItalic.otf") format("opentype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --text: #111;
  --muted: #b3b3b3;           /* inactive category names */
  --red: #ef303c;             /* logo red, footer text */
  --rule: rgba(239, 48, 60, 0.5); /* every line and the swoosh: 1px, #EF303C at 50% */
  --placeholder: #d9d9d9;
  --bg: #fff;

  --edge: 20px;               /* left/right page margin */
  --top: 15px;                /* space above the logo */
  --bottom: 12px;             /* space below the footer */
  --content-left: 270px;      /* where the red line and content start */
  --header-h: 95px;

  --ease: cubic-bezier(0.65, 0, 0.35, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "ABC Gramercy", Georgia, serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.15;
  color: var(--text);
  background: var(--bg);
}

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

img,
video {
  display: block;
}

/* anything hidden (e.g. works filtered out on the Projects page) stays hidden */
[hidden] {
  display: none !important;
}

em,
.italic {
  font-style: italic;
}

/* Grey box used wherever an image is still missing */
.placeholder {
  background: var(--placeholder);
}

.placeholder img,
.placeholder video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =========================================================
   Swoosh — the short overlapping line drawn under the active word.
   script.js adds the <svg> to every element with [data-swoosh].
   ========================================================= */
.swoosh {
  position: absolute;
  left: 0;
  top: calc(100% - 6px);      /* nav: puts the svg's middle (y 5.5) on the header line */
  width: 58px;
  height: 11px;
  overflow: visible;
  pointer-events: none;
}

.swoosh path {
  fill: none;
  stroke: var(--rule);        /* same colour and weight as the lines */
  stroke-width: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;       /* hidden: the line is "undrawn" */
  transition: stroke-dashoffset 0.6s var(--ease);
}

.is-active > .swoosh path {
  stroke-dashoffset: 0;       /* drawn */
}

/* =========================================================
   Header: logo top-left, red line, navigation
   ========================================================= */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  background: var(--bg);
  z-index: 10;
}

.logo {
  position: absolute;
  left: var(--edge);
  top: var(--top);
  width: 210px;
  z-index: 2;
}

.logo img {
  width: 100%;
  height: auto;
}

/* Homepage logo, drawn as outlines (script.js builds it from logo-morph.js).
   1. the first logo fades in, rising from slightly below
   2. as soon as it is there, script.js morphs it into the overlapping logo
      (timing: MORPH_START / MORPH_DURATION in script.js) */
.logo-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  opacity: 0;
  /* a slow, gentle rise: 2s, easing in and out softly */
  animation: logo-fade-in 2s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
}

.logo-svg path {
  fill: none;
  stroke: #f0303b;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes logo-fade-in {
  from { opacity: 0; transform: translateY(10px); }   /* only a small rise */
  to   { opacity: 1; transform: none; }
}

/* no intro for people who turn animations off: show the final logo straight away */
@media (prefers-reduced-motion: reduce) {
  .logo-svg { opacity: 1; animation: none; }
  .nav-text, .nav-text-italic { transition: none; }
}

.header-bar {
  position: absolute;
  left: var(--content-left);
  right: var(--edge);
  top: 0;
  height: calc(var(--top) + 48px);   /* the line sits 48px below the top of the logo */
}

/* the long red line, slides in from the left */
.rule {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--rule);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 1s var(--ease);
}

.nav {
  position: absolute;
  inset: 0;
  display: grid;
  /* Selected Works sits over the project titles, Projects 280px after it, Info at the right edge */
  grid-template-columns: 59.292% 24.779% 1fr auto;  /* 670px / 280px of 1130px */
  align-items: end;
  font-size: 18px;
  opacity: 0;
  transition: opacity 0.6s ease 0.5s;
}

.nav-link {
  position: relative;
  padding-bottom: 9px;
}

.nav-link:nth-child(1) { grid-column: 2; }
.nav-link:nth-child(2) { grid-column: 3; }
.nav-link:nth-child(3) { grid-column: 4; }

/* "Info" sits at the end of the red line: its swoosh ends where the line ends
   (right-aligned to the word) and reaches back past the start of the word instead */
.nav-link:nth-child(3) > .swoosh {
  left: auto;
  right: 0;
}

/* Hover / active: the word turns italic gradually.
   script.js stacks an italic copy on the upright word; on hover the upright word
   leans forward and fades out while the italic copy straightens into place and fades in. */
.nav-text,
.nav-text-italic {
  display: inline-block;
  transform-origin: 0 100%;          /* lean from the baseline, like real italics */
  /* the lean runs the whole 0.45s; the swap between the two copies happens quickly
     in the middle, so the moment where both show (and look doubled) is very short */
  transition: transform 0.45s var(--ease), opacity 0.18s linear 0.13s;
}

.nav-text-italic {
  position: absolute;
  left: 0;
  top: 0;
  font-style: italic;
  white-space: nowrap;
  opacity: 0;
  /* starts leaning back (close to upright) and stretched to the upright word's width */
  transform: skewX(10deg) scaleX(var(--to-upright, 1));
  pointer-events: none;
}

.nav-link:hover .nav-text,
.nav-link.is-active .nav-text {
  opacity: 0;
  /* leans forward and narrows towards the italic */
  transform: skewX(-10deg) scaleX(var(--to-italic, 1));
}

.nav-link:hover .nav-text-italic,
.nav-link.is-active .nav-text-italic {
  opacity: 1;
  transform: none;
}

/* without script.js: switch straight to italic as before */
.nav-link:not(.has-layers).is-active,
.nav-link:not(.has-layers):hover {
  font-style: italic;
}

.site-header.is-revealed .rule {
  transform: scaleX(1);
}

.site-header.is-revealed .nav {
  opacity: 1;
}

.site-header:not(.is-revealed) .nav {
  pointer-events: none;
}

/* the swoosh waits until the header has finished sliding in */
.site-header:not(.nav-ready) .swoosh path {
  stroke-dashoffset: 1;
}

/* header already shown earlier in this visit: appear in place, no slide or draw (script.js) */
.site-header.no-anim .rule,
.site-header.no-anim .nav,
.site-header.no-anim .swoosh path {
  transition: none !important;
}

/* =========================================================
   Footer: contact details pinned to the bottom corners
   ========================================================= */
.site-footer {
  position: fixed;
  left: var(--edge);
  right: var(--edge);
  bottom: var(--bottom);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  color: var(--red);
  font-size: 16px;
  pointer-events: none;
  z-index: 5;
}

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

.site-footer a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* the footer only appears once the homepage logo has moved away */
body.home .site-footer {
  opacity: 0;
  transition: opacity 0.6s ease;
}

body.home.is-scrolled .site-footer {
  opacity: 1;
}

/* =========================================================
   Homepage
   ========================================================= */

/* Soft stop: scrolling back up stops once with the first work at the top
   (scroll-snap-stop), so one flick does not run all the way back to the big logo.
   "proximity" only snaps when you end near a stop, so free scrolling still works. */
html:has(body.home) {
  scroll-snap-type: y proximity;
}

/* first screen: only the logo, centred (script.js moves it) */
.intro {
  height: 100vh;
  scroll-snap-align: start;
}

.works {
  display: grid;
  grid-template-columns: 15.75% 1fr;   /* "Selected Works" label | list */
  margin-left: var(--content-left);
  margin-right: var(--edge);
  padding: 166px 0 0;
  /* exactly one screen tall: the page ends with the first work at the top,
     so Selected Works stays put and can't be scrolled further down */
  height: 100vh;
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;   /* a fast scroll up cannot skip past this stop */
}

.works-label {
  font-size: 18px;
  font-weight: 400;
  font-style: italic;
  /* fixed on the same line as the first work's year (2026): their baselines match */
  padding-top: 5px;
  align-self: start;
}

.work-list {
  display: grid;
  row-gap: 18px;
  align-content: start;         /* rows keep their own height; spare space is not shared out */
}

/* one project row: year | main image | gap | title.
   The three rows share the screen below the top padding, so the last main image
   (and the extra images that open beside it) ends on the footer text's baseline:
   100vh − 166px top padding − 16px (footer's 12px bottom + its text's descent) − 2 × 18px gaps */
.works {
  --work-h: calc((100vh - 166px - 16px - 36px) / 3);
}

.work {
  position: relative;
  display: grid;
  grid-template-columns: 15.25% 26.6% 9.85% 1fr;
  align-items: start;           /* the row is as tall as its image, no taller */
}

.work-year {
  font-size: 16px;
  padding-top: 7px;
}

.work-image {
  position: relative;
  z-index: 1;                   /* sits on top of the hover line */
  height: var(--work-h);        /* see .works above; the picture fills it (object-fit: cover) */
}

.work-info {
  grid-column: 4;
  padding-top: 8px;
}

.work-title {
  display: block;
  font-size: 16px;
}

.work-category {
  display: block;
  font-size: 15px;
  font-style: italic;
  letter-spacing: 0.01em;
}

/* hover line: runs from the left edge of the content to the right edge */
.work-line {
  position: absolute;
  top: 55px;                    /* ~11px below the category text */
  left: -18.7%;                 /* reaches back under the "Selected Works" label */
  right: 0;
  height: 1px;
  background: var(--rule);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.7s var(--ease);
}

/* swoosh under the title */
.work .swoosh {
  left: 51.681%;              /* start of the title column (492px of 952px) */
  top: 50px;                  /* hover line is at 55px, its centre at 55.5px */
}

/* extra images to the right of the main image */
.work-extras {
  position: absolute;
  left: 43.07%;
  bottom: 0;
  /* 37.5% wide, but on short windows (where the rows are short) smaller, so their top always
     stays 20px under the hover line (line at 55px, images from 75px): 2.362 = width / height */
  width: min(37.5%, calc((var(--work-h) - 75px) * 2.362));
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 3.64%;
  z-index: 1;
}

/* each extra image is hidden behind a mask that opens downward from its top edge */
.work-extras .placeholder {
  aspect-ratio: 172 / 152;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.6s var(--ease);
}

/* hover: line, then swoosh, then the extra images one after another */
.work:hover .work-line,
.work:focus-visible .work-line {
  transform: scaleX(1);
}

.work:hover .swoosh path,
.work:focus-visible .swoosh path {
  stroke-dashoffset: 0;
  transition-delay: 0.3s;
}

.work:hover .work-extras .placeholder,
.work:focus-visible .work-extras .placeholder {
  clip-path: inset(0 0 0 0);
}

.work:hover .work-extras .placeholder:nth-child(1) { transition-delay: 0.35s; }
.work:hover .work-extras .placeholder:nth-child(2) { transition-delay: 0.55s; }

/* =========================================================
   Project page (e.g. Hidden Pathways)
   ========================================================= */
.project {
  display: grid;
  /* text | images | gap | categories  (345 / 670 / 170 / 175 on the wireframe) */
  grid-template-columns: 345fr 670fr 170fr 175fr;
  padding: 162px var(--edge) 120px;
  align-items: start;
}

.project-text {
  position: sticky;
  top: 162px;
}

.project-text {
  max-width: 215px;
}

/* Opening a project page: the text fades in and rises a little, then the images
   follow one after another (same gentle fade as the Projects page, @keyframes work-in).
   A grid of small images (.project-grid) comes in as one. */
.project-text,
.project-images > * {
  animation: work-in 0.8s cubic-bezier(0.25, 0.6, 0.3, 1) both;
}

.project-images > * { animation-delay: 0.6s; }   /* 5th image and after */
.project-images > :nth-child(1) { animation-delay: 0.2s; }
.project-images > :nth-child(2) { animation-delay: 0.3s; }
.project-images > :nth-child(3) { animation-delay: 0.4s; }
.project-images > :nth-child(4) { animation-delay: 0.5s; }

@media (prefers-reduced-motion: reduce) {
  .project-text,
  .project-images > * {
    animation: none;
  }
}

.project-title {
  font-size: 20px;
  font-weight: 400;
  font-style: italic;
}

/* optional line under the title (e.g. Hidden Pathways) */
.project-subtitle {
  margin-top: 4px;
  font-style: italic;
}

.project-year {
  margin-top: 8px;
}

/* description and collaborators are 14px on every project page */
.project-description {
  margin-top: 22px;
  font-size: 14px;
}

/* a second paragraph (e.g. Morpho) follows closer than the gap under the year */
.project-description + .project-description {
  margin-top: 10px;
}

/* collaborators follow straight after the description, with a gap above */
.project-credits {
  margin-top: 40px;
  font-size: 14px;
}

.project-credits p {
  white-space: nowrap;   /* one name per line (names are split by <br>), never broken in two */
}

.project-credits h2 {
  font-size: 14px;
  font-weight: 400;
  font-style: italic;
  margin-bottom: 6px;
}

.project-images {
  grid-column: 2;
  display: grid;
  row-gap: 5px;
}

/* .is-page-centre: the images are larger than the usual column (57.5% of the page's width
   inside its margins, about 805px on a 1440px screen) and centred on the page's middle line,
   left to right; the top stays on the line where the page starts (e.g. Poolside) */
.project-images.is-page-centre {
  grid-column: 1 / -1;
  grid-row: 1;
  justify-self: center;
  width: 57.5%;
}

/* ...and the text stays in its own top-left place beside it (otherwise it drops below) */
.project:has(.is-page-centre) .project-text {
  grid-column: 1;
  grid-row: 1;
}

/* every image and video fills the column's full width at its own shape (no crop, no frame) */
.project-images .placeholder:has(img, video) {
  background: none;
}

.project-images .placeholder img,
.project-images .placeholder video {
  display: block;
  height: auto;
}

/* smaller images three to a row, together as wide as the column (e.g. A Cave Within A Cave);
   same 5px gap as between full-width images */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

/* two to a row instead (e.g. Orchids Unfold) */
.project-grid.is-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* .is-fit-screen: a tall (portrait) image or video is shrunk so it fits on one screen:
   its top on the line where the page starts (162px), its bottom at the page's bottom margin
   (e.g. Carpetman). It keeps its shape and sits in the middle of the column. */
.project-images .placeholder.is-fit-screen img,
.project-images .placeholder.is-fit-screen video {
  width: auto;
  max-width: 100%;
  height: calc(100vh - 162px - var(--bottom));
  margin-inline: auto;
}

/* .is-cropped: show only part of an image or video, given in its own pixels on the frame:
   --src-w (its full width), --crop-x / --crop-y (top-left corner kept), --crop-w / --crop-h
   (size kept). The kept part fills the column's width (e.g. Betta Fish 101's animation). */
.project-images .placeholder.is-cropped {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(--crop-w) / var(--crop-h);
}

.project-images .placeholder.is-cropped img,
.project-images .placeholder.is-cropped video {
  position: absolute;
  max-width: none;
  width: calc(var(--src-w) / var(--crop-w) * 100%);
  height: auto;
  left: calc(var(--crop-x) / var(--crop-w) * -100%);
  top: calc(var(--crop-y) / var(--crop-h) * -100%);
}

/* a frame still waiting for its image stays a grey box of the usual shape */
.project-images .placeholder:not(:has(img, video)) {
  aspect-ratio: 670 / 381;
}

/* the category list on project pages is the same one as on the Projects page (.index-categories) */

/* =========================================================
   Projects page: all works, one column per year
   (1440px wireframe: columns every 230px from x 270, tiles 137px, a work every 190px)
   ========================================================= */
.index {
  /* bottom = the footer's: at the end of the page the last caption's baseline lines up with the footer's */
  padding: 162px var(--edge) var(--bottom) var(--content-left);
}

/* Works never rise above the line where they start (level with "All works"):
   a white band covers the top of the screen down to that line, so scrolling works
   are cut off there. The header sits above it; years and categories sit below it. */
.index::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 162px;             /* = .index top padding and the years' sticky top */
  background: var(--bg);
  z-index: 4;
  pointer-events: none;
}

.index-columns {
  display: flex;
  align-items: flex-start;   /* each column keeps its own height, so it can scroll and hold */
}

/* script.js sets --col-top: a column scrolls until its last work is in view, then holds.
   Without the script (top: auto) the columns just scroll with the page. */
.index-column {
  width: 230px;
  position: sticky;
  top: var(--col-top, auto);
}

.year-group {
  display: grid;
  grid-template-columns: 61px 1fr;   /* [year] | works */
}

/* space between two years in one column; a hidden (filtered-out) year leaves no gap */
.year-group:not([hidden]) ~ .year-group:not([hidden]) {
  margin-top: 15px;
}

.year {
  font-size: 15px;
  font-weight: 400;
  position: sticky;                  /* the year stays put while its works scroll */
  top: 162px;
  align-self: start;
}

.year-works {
  list-style: none;
  display: grid;
  row-gap: 15px;
}

.index-work {
  display: block;
  font-size: 15px;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

.index-work .tile {
  width: 137px;
  margin-bottom: 4px;
}

.index-title,
.index-category {
  display: block;
  white-space: nowrap;   /* long titles run past the tile, as on the wireframe */
}

.index-category {
  font-style: italic;
}

/* ---------------------------------------------------------
   One category chosen (script.js adds .is-filtered to .index):
   no years, the works in one grid, newest first, three per row.
   The columns and years step aside (display: contents) so every
   work becomes a cell of the grid; the HTML stays as it is.
   Tiles sit where they sit in "All works" (61px in, every 230px).
   --------------------------------------------------------- */
.is-filtered .index-columns {
  display: grid;
  grid-template-columns: repeat(3, 230px);
  row-gap: 15px;
  padding-left: 61px;          /* = the year column's width */
}

.is-filtered .index-column,
.is-filtered .year-group:not([hidden]),
.is-filtered .year-works {
  display: contents;
}

.is-filtered .year {
  display: none;
}

/* the works fade in one by one: left to right, then the next row
   (in "All works" and in every category).
   script.js numbers the shown works (--i) and restarts this on each click;
   a year label fades in (no rise, it is sticky) together with its first work. */
.is-entering .year-works > li:not([hidden]) {
  animation: work-in 0.7s cubic-bezier(0.25, 0.6, 0.3, 1) both;
  animation-delay: calc(var(--i, 0) * 90ms);
}

.is-entering .year-group:not([hidden]) .year {
  animation: year-in 0.7s ease-out both;
  animation-delay: calc(var(--i, 0) * 90ms);
}

@keyframes year-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes work-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .is-entering .year-works > li:not([hidden]),
  .is-entering .year-group:not([hidden]) .year {
    animation: none;
  }
}

/* category list, pinned top right */
.index-categories {
  position: fixed;
  top: 162px;
  /* starts directly under "Projects" in the menu: the menu's first two columns are
     59.292% + 24.779% = 84.071% of the header bar (which runs from --content-left to --edge) */
  left: calc(var(--content-left) + (100% - var(--content-left) - var(--edge)) * 0.84071);
  right: var(--edge);
  list-style: none;
  font-size: 16px;
  line-height: 1.33;
}

.index-categories a {
  position: relative;
  display: block;
  color: var(--muted);
  transition: color 0.2s;
}

.index-categories a:hover {
  color: var(--text);
}

.index-categories a.is-active {
  color: var(--text);
  font-style: italic;
  padding-bottom: 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

.index-categories .swoosh {
  top: calc(100% - 5px);      /* the border sits just below the box */
}

/* Click a photo on a project page to see it larger (script.js, section 8):
   centred, up to 80% of the screen (never full size), on a light see-through white layer */
.project-images img {
  cursor: zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;               /* above the header, footer and Previous / Next */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.82);
  cursor: zoom-out;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}

.lightbox:focus {
  outline: none;
}

.lightbox img {
  max-width: 80vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  transform: scale(0.97);
  transition: transform 0.3s ease;
}

.lightbox.is-open img {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .lightbox,
  .lightbox img {
    transition: none;
  }
}

/* "Previous" / "Next" / "Back" on project pages (added by script.js, section 7):
   bottom right (the bottom line stays put, so adding Back pushes Previous / Next up a line), lined up on the left with the category list above,
   kept clear of the footer's cchayapa.co (one 16px line at --bottom) */
.project-pager {
  position: fixed;
  left: calc(var(--content-left) + (100% - var(--content-left) - var(--edge)) * 0.84071);
  right: var(--edge);
  bottom: calc(var(--bottom) + 48px);
  font-size: 16px;
  line-height: 1.33;
  z-index: 5;
}

.project-pager a {
  display: block;
  width: fit-content;
  color: var(--muted);
  transition: color 0.2s;
}

.project-pager a:hover {
  color: var(--text);
}

/* square frame used for every work; grey until it has an image */
.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 115px;
  aspect-ratio: 1 / 1;
  background: var(--placeholder);
  overflow: hidden;   /* anything zoomed in (e.g. Betta Fish 101) is clipped to the square */
  clip-path: inset(0); /* same, for browsers (Safari) that let a zoomed video escape overflow */
  transition: opacity 0.2s;
}

.tile:hover {
  opacity: 0.6;
}

.tile:has(img, video) {
  background: none;
}

/* every image fills its square; whatever sticks out is cropped */
.tile img,
.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =========================================================
   Smaller screens: stack everything
   ========================================================= */
@media (max-width: 900px) {
  :root {
    --edge: 16px;
    --content-left: 16px;
    --header-h: 120px;
  }

  .logo {
    top: 16px;
    width: 150px;
  }

  .header-bar {
    top: 70px;
    height: 44px;
  }

  .nav {
    grid-template-columns: auto auto auto;
    justify-content: space-between;
    font-size: 16px;
  }

  .nav-link:nth-child(n) {
    grid-column: auto;
  }

  .works {
    grid-template-columns: 1fr;
    padding-top: 150px;
    padding-bottom: 40px;
    row-gap: 24px;
    height: auto;          /* stacked works are taller than a screen: let them scroll */
    overflow: visible;
  }

  .work {
    grid-template-columns: 1fr;
    row-gap: 8px;
  }

  .work-image {
    height: auto;              /* stacked layout: the usual shape, full width */
    aspect-ratio: 253 / 225;
  }

  .work-info {
    grid-column: 1;
  }

  .work-line,
  .work .swoosh,
  .work-extras {
    display: none;
  }

  .project {
    grid-template-columns: 1fr;
    row-gap: 32px;
    padding-top: 150px;
  }

  .project-text {
    position: static;
    max-width: none;
  }

  .project-images,
  .project-images.is-page-centre {
    grid-column: 1;
    grid-row: auto;
    width: auto;
  }

  .project-credits {
    margin-top: 24px;
  }

  /* stacked layout: a fit-screen image goes back to the full width */
  .project-images .placeholder.is-fit-screen img,
  .project-images .placeholder.is-fit-screen video {
    width: 100%;
    height: auto;
  }

  .index::before {
    display: none;         /* stacked layout scrolls normally under the header */
  }

  /* projects page: categories on top, then the year columns stacked */
  .index {
    display: flex;
    flex-direction: column-reverse;
    gap: 32px;
    padding-top: 150px;
  }

  .index-columns {
    flex-direction: column;
    gap: 32px;
  }

  .index-column,
  .year,
  .index-categories {
    position: static;
  }

  .index-column {
    width: 100%;
  }

  .index-categories {
    width: auto;
  }

  /* one category: still three per row, shrunk to fit the screen */
  .is-filtered .index-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 12px;
    padding-left: 0;
  }

  .is-filtered .index-work .tile {
    width: 100%;
  }

  .is-filtered .index-title,
  .is-filtered .index-category {
    white-space: normal;
  }

  .site-footer {
    position: static;
    padding: 0 0 24px;
    margin: 0 var(--edge);
  }

  /* stacked layout: Previous / Next come after the images, in the page flow */
  .project-pager {
    position: static;
    grid-column: 1;
  }
}

/* =========================================================
   Info page
   Columns follow the 1440px wireframe: name | photo + tools (413) |
   section labels (161) | years (79) | entries (477), all after --content-left.
   ========================================================= */
.info {
  --info-grey: #8a8a8a;
  display: grid;
  /* the 4th and 5th columns meet at 670 / 1130, the same place as Selected Works in the header,
     so the Experience entries line up under it */
  grid-template-columns: calc(var(--content-left) - var(--edge)) 413fr 161fr 96fr 460fr;
  /* Tools & Education come up on shorter screens so the page fits without scrolling */
  row-gap: clamp(32px, calc(100vh - 760px), 72px);
  padding: 140px var(--edge) 60px;
  align-items: start;
}

.info ul { list-style: none; }

.info-name {
  grid-column: 1;
  grid-row: 1;
  font-size: 32px;
  font-weight: 400;
  font-style: italic;
  line-height: 1;
  color: var(--red);
}

.info-intro {
  grid-column: 2;
  grid-row: 1;
  max-width: 270px;
}

.info-photo {
  display: block;
  width: 267px;
  max-width: 100%;
  aspect-ratio: 267 / 317;
  object-fit: cover;
  object-position: 50% 40%;
}

.info-bio {
  margin-top: 12px;
  font-size: 15px;
  font-style: italic;
}

.info-label {
  font-size: 16px;
  font-weight: 400;
  font-style: italic;
}

/* Experience and Education share the label / year / entries columns */
.info-experience,
.info-education {
  grid-column: 3 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: start;
}

.info-experience { grid-row: 1; padding-top: 10px; }
.info-education { grid-row: 2; }

.info-experience .info-label,
.info-education .info-label {
  grid-column: 1;
  grid-row: 1;
}

.info-year {
  grid-column: 2;
  font-size: 15px;
}

.info-experience .info-entries { grid-column: 3; }
.info-education .info-entries  { grid-column: 2 / -1; max-width: 350px; }

.info-entries li { margin-bottom: 10px; }
.info-education .info-entries li { margin-bottom: 14px; }

/* the role (Experience) or the years (Education), in grey */
.info-entries span {
  display: block;
  font-size: 15px;
  color: var(--info-grey);
}

.info-experience .info-entries span { margin-top: 1px; }

.info-tools {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: 107px 1fr;
}

/* footer extras on this page: Download CV sits under the Education entries,
   IG above cchayapa.co on the right */
.footer-cv {
  position: absolute;
  bottom: 0;
  left: calc(var(--content-left) - var(--edge) + (100vw - var(--content-left) - var(--edge)) * 0.50796);
}

.footer-right { text-align: left; }   /* IG and cchayapa.co start on one line, like E / T on the left */

/* Opening the page: same gentle fade-and-rise as the project pages (@keyframes work-in) */
.info > * {
  animation: work-in 0.8s cubic-bezier(0.25, 0.6, 0.3, 1) both;
}

.info-intro      { animation-delay: 0.2s; }
.info-experience { animation-delay: 0.3s; }
.info-tools      { animation-delay: 0.4s; }
.info-education  { animation-delay: 0.5s; }

@media (prefers-reduced-motion: reduce) {
  .info > * { animation: none; }
}

@media (max-width: 900px) {
  .info {
    grid-template-columns: 1fr;
    row-gap: 48px;
    padding: calc(var(--header-h) + 32px) var(--edge) 48px;
  }

  .info-name,
  .info-intro,
  .info-experience,
  .info-tools,
  .info-education {
    grid-column: 1;
    grid-row: auto;
  }

  .info-experience,
  .info-education,
  .info-tools {
    grid-template-columns: 56px 1fr;
    row-gap: 0;
    padding-top: 0;
  }

  .info-experience .info-label,
  .info-education .info-label,
  .info-tools .info-label {
    grid-column: 1 / -1;
    margin-bottom: 16px;
  }

  .info-year { grid-column: 1; }
  .info-experience .info-entries { grid-column: 2; }
  .info-education .info-entries,
  .info-tools .info-list { grid-column: 1 / -1; }

  .site-footer { flex-wrap: wrap; gap: 16px; }
  .footer-cv { position: static; }
}
