/* ===========================================================================
   Jasmin Aghayeva — portfolio

   Composition follows the reference deck:
     · the medium set huge and condensed in the top-left corner
     · title, medium, size stacked quietly beneath it
     · the work itself sharp, whole and untouched on the right
     · the ground is built from three colours taken out of that same work

   Nothing is ever laid on top of an artwork.
   =========================================================================== */

:root {
  --paper:   #C6C8C3;   /* only seen before a picture loads */
  --ink:     #191B19;   /* type */
  --ash:     #3D413E;   /* dark enough to hold over a varying ground */
  --dim:     #5B5F5A;
  --line:    rgba(25, 27, 25, 0.22);

  --pad: clamp(1.25rem, 2.6vw, 2.75rem);
  --top: 3.5rem;

  /* How tall a picture may be. Generous on purpose. */
  --frame-h: calc(100dvh - var(--top) - 3.5rem);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html { background: var(--paper); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

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

.skip {
  position: fixed; top: 0; left: 50%;
  transform: translate(-50%, -110%);
  z-index: 200;
  padding: 0.75rem 1.25rem;
  background: var(--ink); color: #fff;
  font-size: 0.8125rem; text-decoration: none;
  transition: transform 0.2s var(--ease);
}
.skip:focus { transform: translate(-50%, 0); }

/* ---------------------------------------------------------------------------
   The one typographic idea: Archivo's width axis. The medium runs at 62% width
   and 800 weight — a compressed gothic, blunt and modern, set against painting
   that is anything but. Everything else is the same family at normal width, so
   the page has one voice pitched two ways.
--------------------------------------------------------------------------- */

.mono-label {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ash);
}

.shout {
  margin: 0;
  font-weight: 800;
  font-stretch: 62%;
  font-variation-settings: "wdth" 62, "wght" 800;
  text-transform: uppercase;
  line-height: 0.8;
  letter-spacing: 0.005em;
}

/* --- fixed chrome ---------------------------------------------------------- */

.chrome {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 var(--pad);
  height: var(--top);
  pointer-events: none;
  mix-blend-mode: multiply;
}
.chrome > * { pointer-events: auto; position: relative; }

/* Over a picture the chrome carries no bar of its own — only the faintest
   darkening at the very top, enough to keep the two words legible against a
   painting that might be pale up there. Absolute, so it stays out of the
   flex row. */
.chrome::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: calc(var(--top) * 2.4);
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s var(--ease);
}

/* The deck tells the body which screen it is resting on. Over the full-bleed
   works the chrome turns to light type and stops multiplying — multiply over
   a dark painting would erase it. */
body[data-chrome="light"] .chrome { mix-blend-mode: normal; }
body[data-chrome="light"] .chrome::before { opacity: 1; }
body[data-chrome="light"] .wordmark,
body[data-chrome="light"] .btn-index { color: rgba(255, 255, 255, 0.94); }
body[data-chrome="light"] .chrome :focus-visible,
.work--full :focus-visible { outline-color: #FFFFFF; }

.wordmark {
  text-decoration: none;
  color: var(--ink);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: color 0.35s var(--ease);
}

.btn-index {
  display: inline-flex; align-items: center; gap: 0.6rem;
  color: var(--ink);
  font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  transition: color 0.35s var(--ease);
}
.btn-index__mark {
  width: 12px; height: 12px;
  background: radial-gradient(circle, currentColor 1.4px, transparent 1.5px) 0 0 / 5px 5px;
  opacity: 0.75;
  transition: opacity 0.2s var(--ease);
}
.btn-index:hover .btn-index__mark { opacity: 1; }

/* --- deck ------------------------------------------------------------------ */

/* One screen per scroll. `mandatory` never lets the deck rest between two
   panels, and `scroll-snap-stop: always` stops a fast flick from skipping
   past a picture. Every panel is exactly one viewport tall so the snap can
   never trap you inside something too big to see. */
.deck {
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

.panel {
  position: relative;
  height: 100dvh;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  display: grid;
  isolation: isolate;
  overflow: hidden;
}
/* Kept for anything that genuinely cannot fit a screen: it opts out of the
   hard stop so it stays scrollable. Nothing uses it at the moment. */
.panel--tall {
  height: auto;
  min-height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: normal;
}

/* ---------------------------------------------------------------------------
   The wash. One gradient, left to right, between the two colours the picture
   meets the page with: the average down its left edge and the average down
   its right. The script measures where the picture stands across the screen
   and pins the gradient's ends to it, so the colour beside either edge is
   that edge's own and the join disappears. Beyond the picture it holds flat.
--------------------------------------------------------------------------- */

.wash {
  --t1: #DFDDD2;
  --t2: #CFCCC2;
  --t3: #BFBCB2;
  /* Set from the manifest; these stand in until the script gets there. */
  --e1: var(--t1);
  --e2: var(--t3);
  --x1: 0%;
  --x2: 100%;
  position: absolute; inset: 0;
  z-index: -2;
  overflow: hidden;
  background: linear-gradient(
    to right,
    var(--e1) 0,
    var(--e1) var(--x1),
    var(--e2) var(--x2),
    var(--e2) 100%
  );
}
/* The blurred picture would shift the field off the edge colours it is being
   matched to. It is kept for the contact screen, which is nothing but colour. */
.wash img {
  display: none;
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.18);
  filter: blur(56px) saturate(1.15);
  opacity: 0.4;
  mix-blend-mode: soft-light;
}

/* A field taken from a dark picture is dark. Where the script finds that the
   page reads better in light type than in ink, it says so on the field and the
   screen's whole palette turns — one rule, because everything on a work screen
   is set in these three. */
.panel:has(> .wash.is-dim) {
  --ink:  #F1EFE9;
  --ash:  rgba(241, 239, 233, 0.82);
  --dim:  rgba(241, 239, 233, 0.60);
  --line: rgba(241, 239, 233, 0.22);
}

/* One work at a time can be hung on paper instead of on its own colour: add
   `ground: "paper"` to that entry in the catalogue. The sheet is near white,
   the picture's tones let into it at a whisper, and the type turns to ink.
   Nothing else on the site is affected. */
.work.on-paper .wash {
  --sheet: #F5F3EF;
  background: var(--sheet);
}
@supports (background: color-mix(in srgb, red 50%, blue)) {
  .work.on-paper .wash {
    background:
      radial-gradient(88% 78% at 16% 14%, color-mix(in srgb, var(--t1) 18%, var(--sheet)) 0%, transparent 68%),
      radial-gradient(78% 76% at 90% 28%, color-mix(in srgb, var(--t3) 13%, var(--sheet)) 0%, transparent 64%),
      color-mix(in srgb, var(--t2) 8%, var(--sheet));
  }
}
.work.on-paper .wash img { filter: blur(72px) saturate(1.05); opacity: 0.14; }
.work.on-paper .work__medium {
  color: var(--ink);
  opacity: 0.86;
  text-shadow: none;
}
.work.on-paper .work__frame {
  box-shadow:
    0 0.75rem 2rem -0.9rem rgba(30, 30, 26, 0.24),
    0 2.75rem 5.5rem -2.25rem rgba(30, 30, 26, 0.30);
}
.work.on-paper .plate__frame {
  box-shadow:
    0 0.6rem 1.6rem -0.75rem rgba(30, 30, 26, 0.24),
    0 2rem 4rem -1.75rem rgba(30, 30, 26, 0.30);
}

/* ---------------------------------------------------------------------------
   A work — the standing design.

   The medium set huge and condensed in the corner, the facts stacked beneath
   it, the work itself whole and untouched to the right.
--------------------------------------------------------------------------- */

/* The margin is as wide as the longest word in the medium needs and no wider,
   so "SKETCH" gives its width back to the picture and "PAINTING" keeps it. */
.work {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  align-items: start;
  gap: clamp(1.25rem, 2.5vh, 2.5rem) clamp(1.5rem, 3vw, 3rem);
  padding: calc(var(--top) + 1rem) var(--pad) var(--pad);
}

/* The medium, huge, low contrast, in the corner — the anchor of every screen. */
.work__medium {
  grid-column: 1; grid-row: 1;
  padding-top: clamp(0.5rem, 4vh, 3rem);
  font-size: clamp(2.25rem, 5.2vw, 5.5rem);
  color: #FFFFFF;
  opacity: 0.78;
  max-width: 24vw;
  overflow-wrap: normal;   /* never break a word across lines */
  text-shadow: 0 1px 2px rgba(255,255,255,0.25);
}

.work__meta {
  grid-column: 1; grid-row: 2;
  align-self: start;
  display: grid;
  gap: 1.15rem;
  min-width: 0;
  max-width: 24vw;
}

.work__title {
  margin: 0;
  font-size: clamp(1rem, 1.35vw, 1.375rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.25;
}

.work__facts {
  margin: 0;
  display: grid;
  gap: 0.15rem;
  font-size: 0.875rem;
  color: var(--ash);
}
.work__facts dd { margin: 0; }

.work__note {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--dim);
  max-width: 30ch;
  padding-top: 0.35rem;
  border-top: 1px solid var(--line);
}

.work__plate {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

/* the work itself */
.work__stage {
  grid-column: 2; grid-row: 1 / 3;
  align-self: center;
  justify-self: center;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0;
  min-width: 0;
}

.work__frame {
  display: block;
  padding: 0;
  line-height: 0;
  max-width: 100%;
  max-height: var(--frame-h);
  cursor: zoom-in;
  box-shadow:
    0 1rem 2.5rem -0.75rem rgba(28,30,28,0.3),
    0 3.5rem 7rem -2.5rem rgba(28,30,28,0.45);
}
.work__frame img {
  max-width: 100%;
  max-height: var(--frame-h);
  width: auto; height: auto;
  object-fit: contain;
  transition: opacity 0.3s var(--ease);
}
.work__frame.is-swapping img { opacity: 0; }

/* Several works are photographed hanging on a gallery wall, leaning on a
   floor, or held in a hand. The crop values in the catalogue trim the room
   away. Sized by width, never height — an explicit height plus max-width
   makes the box stop honouring aspect-ratio. */
.work__frame.is-cropped {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(--crop-ar);
  width: min(100%, calc(var(--frame-h) * var(--crop-ar)));
  height: auto;
  max-height: var(--frame-h);
}
.work__frame.is-cropped img,
.plate__frame.is-cropped img,
.lightbox__crop img {
  position: absolute;
  max-width: none;
  max-height: none;
  width: calc(100% / var(--cw));
  height: calc(100% / var(--ch));
  left: calc(var(--cx) / var(--cw) * -100%);
  top: calc(var(--cy) / var(--ch) * -100%);
}

/* ---------------------------------------------------------------------------
   A group of two to four on one screen. Big pictures get a screen to
   themselves; studies share one.
--------------------------------------------------------------------------- */

.plate {
  display: grid;
  gap: clamp(0.75rem, 1.8vw, 2rem);
  width: 100%;
  height: 100%;
  align-items: stretch;
  justify-items: center;
}
.work--group.is-2 .plate { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.work--group.is-3 .plate { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.work--group.is-4 .plate {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.work--group.is-2,
.work--group.is-3 { --cell-h: calc(var(--frame-h) - 2.75rem); }
.work--group.is-4 { --cell-h: calc((var(--frame-h) - 5rem) / 2); }

/* rows 1fr / auto so every caption in a row sits on one line */
.plate__cell {
  margin: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.65rem;
  justify-items: center;
  min-width: 0;
  max-width: 100%;
  height: 100%;
}
.plate__frame {
  display: block;
  align-self: center;
  padding: 0;
  line-height: 0;
  max-width: 100%;
  max-height: var(--cell-h);
  cursor: zoom-in;
  box-shadow:
    0 0.75rem 2rem -0.75rem rgba(28,30,28,0.3),
    0 2.5rem 5rem -2rem rgba(28,30,28,0.4);
}
.plate__frame img {
  max-width: 100%;
  max-height: var(--cell-h);
  width: auto; height: auto;
  object-fit: contain;
}
.plate__frame.is-cropped {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(--crop-ar);
  width: min(100%, calc(var(--cell-h) * var(--crop-ar)));
  height: auto;
  max-height: var(--cell-h);
}

.plate__caption {
  align-self: end;
  display: grid;
  gap: 0.05rem;
  text-align: center;
  max-width: 26ch;
}
.plate__title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}
.plate__medium { font-size: 0.75rem; color: var(--dim); }

/* other views of the same work */
.views { display: grid; gap: 0.5rem; }
.views__strip { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.thumb {
  width: 3rem; height: 3rem;
  padding: 0; overflow: hidden;
  border: 1px solid transparent;
  opacity: 0.55;
  transition: opacity 0.2s var(--ease), border-color 0.2s var(--ease);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb:hover { opacity: 0.9; }
.thumb[aria-current="true"] { opacity: 1; border-color: var(--ink); }

/* ===========================================================================
   FULL-BLEED PRESENTATION

   Opt in per work with `layout: "full"` in the catalogue. The painting runs
   edge to edge — under the chrome, out to both sides of the device — and
   everything the page says about it sits on a veil that gathers at the foot
   of the screen. Nothing else is on the picture: no counter, no arrows. The
   next work is one scroll down.

   Currently used by Evening Company only.
   =========================================================================== */

.work--full {
  display: block;
  padding: 0;
  cursor: zoom-in;
  /* How deep the veil runs up from the bottom edge. */
  --veil-h: clamp(8.5rem, 21vh, 13rem);
  --room: var(--tone, #4A463C);
  background: #0C0B09;
}
/* The room around a work shown whole, mixed from that work's own dominant
   colour and taken down until it reads as an unlit wall rather than a page. */
@supports (background: color-mix(in srgb, red 50%, blue)) {
  .work--full {
    --room: color-mix(in srgb, var(--tone, #4A463C) 58%, #0C0B09);
    background:
      radial-gradient(120% 92% at 50% 44%, var(--room) 0%, transparent 74%),
      #0C0B09;
  }
}

/* The standing design centres this box with align-self/justify-self. Those
   properties still apply once it is absolutely positioned, and centred
   self-alignment makes a box shrink to fit rather than stretch between its
   insets — so it collapsed to nothing and its overflow:hidden clipped the
   painting away. They have to be reset back to stretch, not just overridden
   on position and inset. */
.work--full .work__stage {
  position: absolute;
  grid-column: auto;
  grid-row: auto;
  align-self: stretch;
  justify-self: stretch;
  inset: 0;
  display: block;
  width: auto;
  height: auto;
  overflow: hidden;
  padding: 0;
}
.work--full .work__stage img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  transition: opacity 0.35s var(--ease);
}
.work--full.is-swapping .work__stage img { opacity: 0; }

/* A picture whose shape is close to the screen's fills it completely. One
   whose shape is far off — a wide picture on an upright phone — would lose
   its sides to the crop, so it is shown whole instead: still the full width
   of the device, held clear of the chrome above and the veil below. */
.work--full.is-whole .work__stage {
  padding: var(--top) 0 var(--veil-h);
}
.work--full.is-whole .work__stage img { object-fit: contain; }

/* A cropped picture is trimmed first, then that trimmed rectangle is what
   fills the screen. The box carries the crop's own aspect ratio, so nothing
   stretches. */
.work__crop {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  aspect-ratio: var(--crop-ar);
  width: max(100%, calc(100dvh * var(--crop-ar)));
  overflow: hidden;
}
.work--full.is-whole .work__crop {
  position: relative;
  top: auto; left: auto;
  transform: none;
  margin: 0 auto;
  width: min(100%, calc((100dvh - var(--top) - var(--veil-h)) * var(--crop-ar)));
  max-height: 100%;
}

/* A work hung in its frame normally covers the screen — the script opens its
   crop out from the frame into the wall around it. Only where the screen is
   too far off the frame's shape to allow that does it fall back to whole, and
   then it is given as much of the screen as it can take: held off the top and
   bottom edges only, with the veil lying across its foot the way it does on a
   work that fills the screen. */
.work--full.is-hung { --hold: clamp(0.75rem, 3.5vh, 2.25rem); }
.work--full.is-hung.is-whole .work__stage { padding: var(--hold) 0; }
.work--full.is-hung.is-whole .work__crop {
  width: min(100%, calc((100dvh - 2 * var(--hold)) * var(--crop-ar)));
}
/* Scoped through .work__stage so it outranks the plain fill rule above —
   otherwise the image simply fills the crop box and the crop does nothing. */
.work--full .work__stage .work__crop img {
  position: absolute;
  width: calc(100% / var(--cw));
  height: calc(100% / var(--ch));
  left: calc(var(--cx) / var(--cw) * -100%);
  top: calc(var(--cy) / var(--ch) * -100%);
  max-width: none;
  max-height: none;
  object-fit: cover;
}

/* --- the veil -------------------------------------------------------------- */

/* Not a band across the bottom of the picture — a depth of field in it. Five
   layers of backdrop blur, each masked to begin lower than the one before, so
   the softening builds from nothing at the top of the veil to a haze at the
   bottom edge and the painting keeps going the whole way down. A warm dark
   wash sits over all five to hold the type. */
.work__veil {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: var(--veil-h);
  z-index: 2;
  pointer-events: none;
}
.work__veil i {
  position: absolute;
  inset: 0;
  display: block;
}
.work__veil i:nth-child(1) {
  -webkit-backdrop-filter: blur(0.5px); backdrop-filter: blur(0.5px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 20%);
          mask-image: linear-gradient(to bottom, transparent 0%, #000 20%);
}
.work__veil i:nth-child(2) {
  -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 15%, #000 36%);
          mask-image: linear-gradient(to bottom, transparent 15%, #000 36%);
}
.work__veil i:nth-child(3) {
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 32%, #000 54%);
          mask-image: linear-gradient(to bottom, transparent 32%, #000 54%);
}
.work__veil i:nth-child(4) {
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 50%, #000 72%);
          mask-image: linear-gradient(to bottom, transparent 50%, #000 72%);
}
.work__veil i:nth-child(5) {
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 68%, #000 90%);
          mask-image: linear-gradient(to bottom, transparent 68%, #000 90%);
}
/* The wash. Painted last, so it lies over every blurred layer. */
.work__veil::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(16, 14, 11, 0) 0%,
    rgba(16, 14, 11, 0.22) 36%,
    rgba(16, 14, 11, 0.46) 72%,
    rgba(16, 14, 11, 0.60) 100%
  );
}

/* --- what the page says about the work -------------------------------------- */

.work__bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  display: grid;
  justify-items: start;
  padding: 0 var(--pad) clamp(1.15rem, 3.2vh, 2.25rem);
  color: #fff;
  cursor: default;
}

.work__headline {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6em;
  font-size: clamp(1.5rem, 2.5vw, 2.625rem);
  font-weight: 500;
  font-stretch: 62%;
  font-variation-settings: "wdth" 62, "wght" 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  color: #FFFFFF;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.3);
}
.work__sub {
  font-size: 0.8125rem;
  font-weight: 400;
  font-stretch: 100%;
  font-variation-settings: "wdth" 100, "wght" 400;
  letter-spacing: 0.01em;
  text-transform: none;
  color: rgba(255, 255, 255, 0.6);
}

/* One line, the facts run together the way a wall label sets them. */
.work__bar .work__facts {
  margin: 0.6rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  font-size: clamp(0.75rem, 0.95vw, 0.875rem);
  color: rgba(255, 255, 255, 0.82);
  white-space: nowrap;
}
.work__bar .work__facts dd { margin: 0; }
.work__bar .work__facts dd + dd::before {
  content: "·";
  padding: 0 0.6em;
  opacity: 0.5;
}

.work__bar .work__note {
  margin: 0.45rem 0 0;
  padding: 0;
  border: 0;
  font-size: 0.8125rem;
  font-style: italic;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.6);
  max-width: 52ch;
}

.work__bar .views__strip { margin: 0.7rem 0 0; gap: 0.4rem; }
.work__bar .thumb {
  width: 4.25rem; height: 2.9rem;
  opacity: 0.4;
}
.work__bar .thumb:hover { opacity: 0.85; }
.work__bar .thumb[aria-current="true"] {
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.7);
}


/* ===========================================================================
   THE OPENING

   Her name, her portrait, and the account of the work — one screen, three
   columns. The name is set as large as the column will carry and runs a
   little way over the photograph; the reading matter sits down the right at
   the size of a printed page.
   =========================================================================== */

/* Nothing is on show on the contact screen, so its picture blurs away
   entirely and it is left as pure colour. */
.contact .wash img { display: block; filter: blur(120px) saturate(1.2); opacity: 0.5; }

.opening {
  --sheet:  #EFEBE0;   /* warm paper, the whole screen */
  --rule:   rgba(30, 28, 22, 0.18);
  --accent: #B08D57;   /* the one warm mark on the page */
  --name:   #861E13;   /* her name, set in oxide red */

  background: var(--sheet);
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.82fr) minmax(0, 0.64fr);
  align-content: center;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 3.25rem);
  padding: calc(var(--top) + 1.5rem) var(--pad) calc(var(--pad) + 1rem);
}
.opening.is-unpictured { grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.7fr); }

/* --- her name -------------------------------------------------------------- */

/* Above the photograph, and reaching a little way across it — the negative
   margin is what lets the last line cross the edge instead of stopping at
   the column. */
.opening__name {
  position: relative;
  z-index: 2;
  margin-right: -2.5vw;
}
.opening__title {
  margin-top: 0.5rem;
  font-size: clamp(3rem, 9.6vw, 9.5rem);
  color: var(--name);
}

/* A short warm rule, then what she does. */
.opening__foot {
  margin-top: clamp(1.5rem, 3.5vh, 2.75rem);
  max-width: 30rem;
}
.opening__foot::before {
  content: "";
  display: block;
  width: 3.25rem; height: 2px;
  margin-bottom: 1.15rem;
  background: var(--accent);
}
.opening__statement {
  margin: 0;
  max-width: 32ch;
  font-size: clamp(0.9375rem, 1.15vw, 1.0625rem);
  color: var(--ash);
}
/* --- the photograph -------------------------------------------------------- */

.opening__portrait {
  margin: 0;
  position: relative;
  z-index: 1;
  align-self: stretch;
  display: grid;
  place-items: center;
  min-height: 0;
}
.opening__portrait button {
  display: block;
  padding: 0;
  line-height: 0;
  max-width: 100%;
  max-height: 100%;
  cursor: zoom-in;
}
.opening__portrait img {
  width: auto; height: auto;
  max-width: 100%;
  max-height: min(80dvh, 100%);
  object-fit: contain;
  box-shadow: 0 1.25rem 3.5rem -2rem rgba(30, 28, 22, 0.4);
}

/* --- who she is ------------------------------------------------------------ */

.opening__about {
  align-self: center;
  max-width: 26rem;
}
.opening__eyebrow { color: var(--ash); }
.opening__eyebrow::after {
  content: "";
  display: block;
  width: 2.5rem; height: 2px;
  margin-top: 0.7rem;
  background: var(--accent);
}
.opening__bio { display: grid; gap: 1rem; margin-top: 1.5rem; }
.opening__bio p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--ash);
}
.opening__facts {
  margin: clamp(1.5rem, 3.5vh, 2.5rem) 0 0;
  display: grid; gap: 0.6rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--rule);
}
.opening__facts div { display: flex; gap: 1rem; align-items: baseline; }
.opening__facts dt {
  flex: 0 0 6.5rem;
  font-size: 0.625rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--dim);
}
.opening__facts dd { margin: 0; font-size: 0.875rem; color: var(--ash); }

/* --- film ------------------------------------------------------------------ */

.film {
  grid-template-columns: minmax(13rem, 25%) minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 3rem);
  align-content: center;
  padding: calc(var(--top) + 1.5rem) var(--pad) var(--pad);
}
.film__side { padding-top: clamp(0.5rem, 4vh, 3rem); }
.film__shout {
  font-size: clamp(2.25rem, 5.2vw, 5.5rem);
  color: #FFFFFF;
  opacity: 0.78;
}
.film__blurb {
  margin: 1.5rem 0 0;
  font-size: 0.8125rem; line-height: 1.7;
  color: var(--dim); max-width: 30ch;
}
/* Rows share whatever height is left, so however many frames there are the
   block still fits one screen. */
.film__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: clamp(0.6rem, 1.2vw, 1.25rem);
  align-content: center;
  max-height: calc(100dvh - var(--top) - 6rem);
  min-height: 0;
}
.shot { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 0.5rem; margin: 0; min-height: 0; }
.shot__img {
  display: block; width: 100%; height: 100%;
  min-height: 0;
  overflow: hidden;
  background: rgba(255,255,255,0.25);
  padding: 0;
  cursor: zoom-in;
  box-shadow: 0 0.75rem 2rem -0.75rem rgba(28,30,28,0.3);
}
.shot__img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}
.shot__img:hover img { transform: scale(1.04); }
.shot__caption { margin: 0; font-size: 0.75rem; font-weight: 500; color: var(--ink); }
.shot__credit {
  display: block; color: var(--dim);
  font-size: 0.625rem; letter-spacing: 0.1em; text-transform: uppercase;
}

/* --- contact --------------------------------------------------------------- */

.contact {
  align-content: center;
  padding: calc(var(--top) + 2rem) var(--pad) calc(var(--pad) + 2rem);
}
.contact__shout { font-size: clamp(2.75rem, 9vw, 8.5rem); color: var(--ink); }
.contact__foot {
  display: flex; flex-wrap: wrap;
  align-items: flex-end; justify-content: space-between;
  gap: 1.5rem 3rem;
  margin-top: clamp(1.75rem, 4vh, 3rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.contact__note { margin: 0; max-width: 30ch; color: var(--ash); font-size: 0.9375rem; }
.contact__links { display: grid; gap: 0.4rem; }
.contact__links a {
  color: var(--ink);
  font-size: clamp(1rem, 1.8vw, 1.375rem);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.1em;
  transition: border-color 0.25s var(--ease);
}
.contact__links a:hover { border-color: var(--ink); }

/* --- index overlay --------------------------------------------------------- */

.index {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(233, 233, 228, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.28s var(--ease);
}
.index[hidden] { display: none; }
.index.is-open { opacity: 1; }
.index__inner { padding: var(--pad); max-width: 96rem; margin: 0 auto; }
.index__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; padding-bottom: 1.25rem; margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--line);
}
.index__title { margin: 0; font-size: clamp(1.5rem, 4vw, 3rem); color: var(--ink); }
.index__close {
  font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--ash);
}
.index__close:hover { color: var(--ink); }
.index__group { margin-bottom: 2.75rem; }
.index__group-title {
  margin: 0 0 1rem;
  font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--ash);
}
.index__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr));
  gap: clamp(0.6rem, 1.2vw, 1rem);
}
.index__item { display: grid; gap: 0.45rem; text-align: left; padding: 0; }
.index__item-img { aspect-ratio: 1; overflow: hidden; background: rgba(255,255,255,0.4); }
.index__item-img img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.5s var(--ease);
}
.index__item:hover .index__item-img img { transform: scale(1.05); }
.index__item-title {
  font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase; line-height: 1.3;
  color: var(--ink);
}
.index__item-medium { font-size: 0.6875rem; color: var(--dim); }

/* --- lightbox -------------------------------------------------------------- */

.lightbox {
  /* The margin the picture is held inside. Taller top and bottom so the
     close control and the caption never sit on the work. */
  --lb-x: clamp(1rem, 2.5vw, 2.5rem);
  --lb-y: clamp(2.75rem, 6vh, 4.25rem);

  position: fixed; inset: 0; z-index: 150;
  padding: var(--lb-y) var(--lb-x);
  background: rgba(236, 236, 231, 0.98);
  opacity: 0;
  transition: opacity 0.22s var(--ease);
  cursor: zoom-out;
}
.lightbox.is-open { opacity: 1; }

/* The picture sits in its own box so it can be scrolled once magnified. */
.lightbox__pan {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.lightbox.is-zoomed .lightbox__pan {
  place-items: start;
  overflow: auto;
  cursor: grab;
  scrollbar-width: thin;
}
.lightbox.is-zoomed.is-dragging .lightbox__pan { cursor: grabbing; }

/* Sized against the viewport, not against the box around it: a percentage
   max-height cannot resolve against a row that is itself sized by this
   element, so it does nothing and the picture runs off the screen. */
.lightbox__pan > * {
  max-width: calc(100vw - 2 * var(--lb-x));
  max-height: calc(100dvh - 2 * var(--lb-y));
  cursor: zoom-in;
}
.lightbox.is-zoomed .lightbox__pan > * {
  max-width: none;
  max-height: none;
  cursor: inherit;
}

.lightbox img {
  width: auto; height: auto;
  object-fit: contain;
  box-shadow: 0 2rem 5rem -1.5rem rgba(28,30,28,0.4);
}
.lightbox.is-zoomed img { width: var(--zoom-w); height: auto; max-width: none; }

.lightbox__crop {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: var(--crop-ar);
  width: min(calc(100vw - 2 * var(--lb-x)), calc((100dvh - 2 * var(--lb-y)) * var(--crop-ar)));
  height: auto;
  box-shadow: 0 2rem 5rem -1.5rem rgba(28,30,28,0.4);
}
.lightbox.is-zoomed .lightbox__crop { width: var(--zoom-w); }
.lightbox__crop img { box-shadow: none; }
.lightbox__close {
  position: absolute; top: 0; right: var(--lb-x);
  height: var(--lb-y);
  display: flex; align-items: center;
  z-index: 2;
  font-size: 0.6875rem; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--ash);
}
.lightbox__close:hover { color: var(--ink); }
.lightbox__caption {
  position: absolute; left: var(--lb-x); bottom: 0;
  height: var(--lb-y);
  display: flex; align-items: center; gap: 0.75rem;
  z-index: 2;
  margin: 0; font-size: 0.75rem; color: var(--ash);
}
.lightbox__hint {
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

.noscript { padding: 4rem var(--pad); max-width: 40rem; }
.noscript p { color: var(--ash); }

/* --- motion ---------------------------------------------------------------- */

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

/* ===========================================================================
   Narrower screens — the corner word moves above the work
   =========================================================================== */

@media (max-width: 62rem) {
  /* One variable drives every picture box, cropped or not. */
  :root { --frame-h: 48dvh; }

  .film { grid-template-columns: minmax(0, 1fr); }

  /* Three columns will not go on an upright screen. The opening becomes one
     column and is allowed to grow past the viewport; the deck softens its
     snapping so you can read down through it. */
  .deck { scroll-snap-type: y proximity; }
  .opening,
  .opening.is-unpictured {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    scroll-snap-align: start;
    scroll-snap-stop: normal;
    align-content: start;
    gap: clamp(1.75rem, 5vh, 3rem);
    padding: calc(var(--top) + 1.5rem) var(--pad) calc(var(--pad) + 2rem);
  }
  .opening__name { margin-right: 0; }
  .opening__portrait { align-self: start; justify-items: start; }
  .opening__portrait img { max-height: 52dvh; }
  .opening__about { max-width: none; }

  /* One column: medium, then the work, then its caption. */
  .work {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    align-content: start;
    gap: 0.9rem;
  }
  .work__medium,
  .work__meta { max-width: none; }
  .work__medium { grid-column: 1; grid-row: 1; padding-top: 0; font-size: clamp(1.75rem, 7.5vw, 3rem); }
  .work__stage  { grid-column: 1; grid-row: 2; }
  .work__meta   { grid-column: 1; grid-row: 3; gap: 0.8rem; }
  .work__note { max-width: none; }

  /* The full-bleed variant keeps its own shape; only its caption stacks. */
  .work--full { padding: 0; --veil-h: clamp(7.5rem, 24vh, 12rem); }
  .work--full .work__stage { grid-column: auto; grid-row: auto; }
  .work__bar .work__note { display: none; }

  .film { align-content: start; }
  .film__blurb { max-width: none; margin-bottom: 1.5rem; }
  .film__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 40rem) {
  :root { --top: 3rem; --frame-h: 46dvh; }
  .opening__title { font-size: clamp(2.75rem, 15vw, 5rem); }
  .work--group.is-3 .plate { grid-template-columns: 1fr; }
  .index__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .deck { scroll-behavior: auto; }
  [data-reveal] { opacity: 1; transform: none; }
}

@media (hover: none) {
  .shot__img:hover img { transform: none; }
}
