/* ustwo.travel — a dark room. The chrome is deliberately quiet: the photographs
   are the only colour on the page. */

:root {
  --bg:        #0c0a09;
  --bg-lift:   #171614;
  --rule:      #292524;
  --text:      #d6d3d1;
  --text-dim:  #a8a29e;
  --muted:     #78716c;
  --bright:    #f5f5f4;

  /* The one exception to "photographs are the only colour": the destinations
     map's lit cities, pulled from the same sunset amber already sitting in
     the Aruba and Outer Banks photos rather than a chosen brand colour. */
  --ember:     #d97b45;

  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
           "Times New Roman", serif;
  --sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
           "Helvetica Neue", Arial, sans-serif;

  --gutter:  clamp(1.25rem, 5vw, 4rem);
  --measure: 34rem;   /* prose */
  --column:  1180px;  /* the widest a photograph gets outside full-bleed */
  --gap:     clamp(0.5rem, 1.4vw, 1.1rem);
  --flow:    clamp(3rem, 9vw, 7rem);

  /* The wall (home index + trip pages): photos packed edge to edge, so the
     seam between them is barely there rather than the collage's deliberate
     breathing room. */
  --wall-gap: clamp(2px, 0.4vw, 6px);
  --wall-cap: 44vh;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; }

a { color: var(--bright); text-decoration-color: var(--muted); text-underline-offset: 0.2em; }
a:hover { text-decoration-color: var(--bright); }

:focus-visible { outline: 2px solid var(--text-dim); outline-offset: 3px; }

.skip {
  position: absolute; left: -9999px;
  background: var(--bright); color: var(--bg);
  padding: 0.6rem 1rem; z-index: 200;
}
.skip:focus { left: var(--gutter); top: 0.5rem; }

/* --- header / footer ----------------------------------------------------- */

/* The header stays put, so the wordmark is always the way home and the nav is
   always reachable. It sits over photographs, so it is translucent and blurred
   rather than a solid bar -- and it grows a hairline only once you have scrolled,
   so at rest the page still opens with nothing but a name in the corner. */
.top {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem;
  padding: clamp(1.1rem, 3vw, 1.8rem) var(--gutter);
  background: rgba(12, 10, 9, 0.72);
  border-bottom: 1px solid transparent;
  transition: background 200ms ease, border-color 200ms ease;
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .top {
    background: rgba(12, 10, 9, 0.55);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    backdrop-filter: blur(14px) saturate(1.4);
  }
}
.top.stuck { background: rgba(12, 10, 9, 0.82); border-bottom-color: var(--rule); }

.mark {
  font-family: var(--serif);
  font-size: 1.15rem;
  letter-spacing: 0.1em;
  text-decoration: none;
  color: var(--bright);
}

.top nav { display: flex; gap: 1.6rem; }
.top nav a {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}
.top nav a:hover, .top nav a[aria-current="page"] { color: var(--text); }

.foot {
  margin-top: var(--flow);
  padding: 2.5rem var(--gutter) 4rem;
  border-top: 1px solid var(--rule);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}
.foot p { margin: 0.2rem 0; }
.foot .muted { color: var(--muted); }
.foot .heart {
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.45em;
  vertical-align: -0.08em;
  fill: var(--bright);
}

/* --- home ----------------------------------------------------------------- */

.masthead {
  padding: clamp(3rem, 12vw, 8rem) var(--gutter) clamp(2.5rem, 8vw, 5rem);
  max-width: calc(var(--column) + var(--gutter) * 2);
  margin: 0 auto;
}
.masthead h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.75rem, 11vw, 6rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--bright);
}
.masthead .tagline {
  margin: 1.2rem 0 0;
  max-width: 26rem;
  color: var(--text-dim);
  font-size: clamp(1rem, 2.2vw, 1.15rem);
}

/* Injected client-side by site.js, matched against the visitor's own clock
   rather than baked in at the last deploy -- see "on this day" there. Same
   tile treatment as the wall below: no caption until you hover it. */
.today {
  max-width: calc(var(--column) + var(--gutter) * 2);
  margin: 0 auto;
  padding: clamp(2.5rem, 10vw, 7rem) var(--gutter) 0;
}
.today-kicker {
  margin: 0 0 1.1rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Less top air once the featured trip has already opened the page. */
.today + .index { padding-top: clamp(2rem, 6vw, 4rem); }

/* With no masthead above it, the index carries its own opening silence --
   the wall of covers below just starts. */
.index { padding: clamp(2.5rem, 10vw, 7rem) 0 0; }

/* --- the public teaser ------------------------------------------------------- */

.teaser-note {
  max-width: calc(var(--measure) + var(--gutter) * 2);
  margin: 0 auto;
  padding: clamp(2.5rem, 9vw, 6rem) var(--gutter) clamp(2rem, 6vw, 3rem);
}
.teaser-note p {
  margin: 0 0 0.6em;
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  line-height: 1.5;
  color: var(--text-dim);
}
.teaser-note p:last-child { margin-bottom: 0; }

/* --- page headers ----------------------------------------------------------- */

.page-head {
  max-width: calc(var(--measure) + var(--gutter) * 2);
  margin: 0 auto;
  padding: clamp(2.5rem, 9vw, 6rem) var(--gutter) clamp(2rem, 6vw, 3.5rem);
}
.page-head h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.25rem, 8vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--bright);
}

/* --- the prose + collage grid --------------------------------------------- */

/* One grid with three named spans. Prose sits in `text`; photographs break out
   to `wide` or all the way to `full` without leaving the flow. */
.prose {
  display: grid;
  grid-template-columns:
    [full-start] minmax(var(--gutter), 1fr)
    [wide-start] minmax(0, calc((var(--column) - var(--measure)) / 2))
    [text-start] min(var(--measure), 100% - var(--gutter) * 2) [text-end]
    minmax(0, calc((var(--column) - var(--measure)) / 2)) [wide-end]
    minmax(var(--gutter), 1fr) [full-end];
}

.prose > * { grid-column: text; margin-block: 0 1.15em; }
.prose > *:last-child { margin-bottom: 0; }

.prose p { font-size: 1.02rem; color: var(--text-dim); }
.prose h2 {
  margin: 1.5em 0 0.5em;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.6rem;
  color: var(--bright);
}
.prose h2 .anchor, .prose h3 .anchor { display: none; }
.prose h3 {
  margin: 1.4em 0 0.4em;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.prose blockquote {
  margin: 1.6em 0;
  padding-left: 1.2rem;
  border-left: 1px solid var(--rule);
  font-family: var(--serif);
  font-style: italic;
  color: var(--text-dim);
}
.prose hr {
  margin: var(--flow) 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

/* The collage wrapper is structural only; its rows are the real grid items. */
.collage { display: contents; }

.row {
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
  margin-block: var(--flow);
}
.row-wide, .row-inset-left, .row-inset-right, .row-stagger { grid-column: wide; }
.row-full { grid-column: full; gap: clamp(0.25rem, 0.8vw, 0.6rem); }

.cell { flex: var(--grow, 1) 1 0; min-width: 0; }

/* Nothing is ever cropped to fit the window, so instead the row narrows until
   it fits. A justified row is `height = width / sum-of-aspect-ratios`, which
   inverts to the width at which the row is exactly --cap tall. Take whichever
   of that and the full column is smaller, and centre the result. The leftover
   space becomes margin, which is most of why the page reads as a collage. */
.row-wide, .row-stagger, .row-full {
  width: min(100%, calc(var(--cap) * var(--sum-ar) + var(--gap) * var(--gaps, 0)));
  margin-inline: auto;
}
.row-wide, .row-stagger { --cap: 76vh; }
/* 90vh is chosen so that a 16:9 panorama on a normal desktop window comes out
   exactly edge-to-edge, while a 3:2 stops short of it and keeps its margins. */
.row-full { --cap: 90vh; }

/* A single small photograph pushed to one side, with the margin left empty.
   This is where the layout gets to breathe. */
.row-inset-left, .row-inset-right { --cap: 62vh; margin-block: calc(var(--flow) * 1.15); }
.row-inset-left  { justify-content: flex-start; }
.row-inset-right { justify-content: flex-end; }
.row-inset-left > .cell, .row-inset-right > .cell {
  flex: 0 0 min(38%, calc(var(--cap) * var(--grow)));
}

.row-stagger > .cell:nth-child(even) { margin-top: clamp(1.5rem, 6vw, 4.5rem); }

/* --- the photo wall: home index and trip pages ----------------------------- */

/* No hand-authored rows here -- lib/wall.js packs every photo into justified
   rows at build time, and this reuses the same --grow-by-aspect-ratio math as
   the collage above, just tighter: photos sit edge to edge, nested rather than
   given room to breathe, and a row is stretched to fill the column instead of
   centring short of it. */
.wall {
  max-width: calc(var(--column) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.wall .row {
  display: flex;
  gap: var(--wall-gap);
  width: min(100%, calc(var(--wall-cap) * var(--sum-ar) + var(--wall-gap) * var(--gaps, 0)));
  margin: 0 auto;
}
.wall .row + .row { margin-top: var(--wall-gap); }
.wall .cell, .wall .tile { flex: var(--grow, 1) 1 0; min-width: 0; }

/* A tile is a cell that is also a link -- the home index's covers, and the
   "on this day" feature. The caption stays hidden until it's hovered or
   focused, so the wall itself never carries visible text. */
.tile {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 2px;
  text-decoration: none;
  color: inherit;
}
.tile .shot { cursor: pointer; }
.tile-info {
  position: absolute;
  inset: auto 0 0 0;
  padding: 1.6rem 1rem 0.9rem;
  background: linear-gradient(to top, rgba(6, 5, 4, 0.82), rgba(6, 5, 4, 0) 75%);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}
.tile:hover .tile-info, .tile:focus-visible .tile-info { opacity: 1; transform: translateY(0); }
.tile-info b {
  display: block;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1rem, 2vw, 1.3rem);
  color: var(--bright);
}
.tile-info i {
  display: block;
  font-style: normal;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}
.tile-info em {
  display: block;
  font-style: normal;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.35rem;
}

/* --- a single photograph -------------------------------------------------- */

.shot {
  display: block;
  position: relative;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg-lift);
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

.shot-blur {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(14px) saturate(1.15);
  transform: scale(1.1);
}

.shot picture { display: block; position: relative; }

.shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 700ms ease, transform 700ms cubic-bezier(0.2, 0, 0.1, 1);
}
.shot img.loaded { opacity: 1; }
.shot:hover img.loaded { transform: scale(1.015); }

.cap {
  margin: 0.7rem 0 0;
  font-size: 0.75rem;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.row-full .cap { padding-inline: var(--gutter); }

/* Referenced but not yet imported, or an intentional layout placeholder. */
.shot-missing, .shot-placeholder {
  display: grid;
  place-items: center;
  background: repeating-linear-gradient(
    135deg, var(--bg-lift), var(--bg-lift) 10px, #1f1d1a 10px, #1f1d1a 20px
  );
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: default;
}
.shot-missing span, .shot-placeholder span { padding: 0.5rem; text-align: center; }

/* --- destinations: the map -------------------------------------------------- */

.worldmap {
  position: relative;
  max-width: calc(var(--column) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.worldmap svg { display: block; width: 100%; height: auto; }

/* Unvisited: geography only, a thin line that blends toward the page.
   The source file mixes two shapes for the `cc` attribute: some countries
   are <g cc="xx"><path/></g>, others a bare <path cc="xx"/>, so this targets
   `[cc]` itself (relying on SVG fill/stroke inheriting into any plain child
   paths) rather than `[cc] path`, which only the first shape has. */
.worldmap [cc] {
  fill: none;
  stroke: var(--rule);
  stroke-width: 0.5;
  transition: fill 200ms ease, filter 200ms ease;
}

/* Visited: the whole country is the light, not a pin on it. */
.worldmap [cc].lit {
  fill: var(--ember);
  fill-opacity: 0.22;
  stroke: var(--ember);
  stroke-width: 0.6;
  filter: drop-shadow(0 0 3px rgba(217, 123, 69, 0.35));
  cursor: pointer;
}
.worldmap [cc].lit:hover,
.worldmap [cc].lit:focus,
.worldmap [cc].lit.active {
  fill-opacity: 0.4;
  filter: drop-shadow(0 0 6px rgba(217, 123, 69, 0.55));
}

/* The one exception: a visited place too small for this low-resolution map
   to draw at all (so far only Aruba) gets a point instead of a shape. */
.worldmap .point {
  fill: var(--ember);
  filter: drop-shadow(0 0 2px var(--ember)) drop-shadow(0 0 6px var(--ember));
  cursor: pointer;
  transition: filter 200ms ease, r 200ms ease;
}
.worldmap .point:hover, .worldmap .point:focus, .worldmap .point.active {
  filter: drop-shadow(0 0 3px var(--bright)) drop-shadow(0 0 12px var(--ember));
  r: 4.4;
}
.worldmap [cc], .worldmap .point { outline: none; }

.worldmap .tip {
  position: absolute; pointer-events: none; transform: translate(-50%, -100%); margin-top: -12px;
  background: var(--bg-lift); border: 1px solid var(--rule); border-radius: 4px;
  padding: 0.6rem 0.8rem; min-width: 9rem; max-width: 22rem; opacity: 0;
  transition: opacity 120ms ease; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); z-index: 2;
}
/* Only clickable while actually shown -- its last hover position otherwise
   sticks around in an inline style (site.js only ever moves it, never resets
   it), and an invisible element with pointer-events left on would silently
   block clicks under wherever it happened to land last, including possibly
   the header above the map. */
.worldmap .tip.show { opacity: 1; pointer-events: auto; }
.worldmap .tip .name { margin: 0; font-family: var(--serif); font-size: 1rem; color: var(--bright); }

/* A cloud, not a scrolling list -- Brazil's eleven trips need to be visible
   all at once, not stacked one-per-line behind a scrollbar a hover tooltip
   can never actually be scrolled with. Wrapping this way instead of
   stacking is also the tell for "a lot of trips": the cloud visibly gets
   wider and denser, not longer. Each trip is its own little flex-wrap group
   so its cities stay visually together, and the groups themselves wrap
   against each other the same way. A written trip's group is a real link
   (see site.js) -- with more than one trip in a country there's no way to
   guess which one a click on the map shape meant, so this is how you pick. */
.worldmap .tip .trips {
  list-style: none; margin: 0.5rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.5rem 0.7rem;
}
.worldmap .tip .trips li {
  font-size: 0.76rem; line-height: 1.4; color: var(--text-dim);
}
.worldmap .tip .trips li > a, .worldmap .tip .trips li > span {
  display: flex; flex-wrap: wrap; gap: 0 0.35em;
  color: inherit; text-decoration: none;
}
.worldmap .tip .trips li span.place { white-space: nowrap; }
.worldmap .tip .trips li span.place + span.place::before { content: "·"; margin-right: 0.35em; color: var(--muted); }
.worldmap .tip .trips li.written { color: var(--bright); }
.worldmap .tip .trips li.written span.place + span.place::before { color: var(--ember); }
.worldmap .tip .trips li.written a:hover,
.worldmap .tip .trips li.written a:focus-visible { color: var(--ember); }

/* The year reads as a subtitle under that trip's cities, not one more name
   in the list -- its own line, smaller, quieter. */
.worldmap .tip .trips li span.year {
  display: block; width: 100%;
  font-size: 0.65rem; letter-spacing: 0.08em; color: var(--muted);
  margin-top: 0.1rem;
}

/* Brazil (so far the one country with too many trips to read as a cloud of
   names) shows a single symbol instead. */
.worldmap .tip .trips.is-symbol { display: block; }
.worldmap .tip .trips .symbol {
  font-family: var(--serif); font-size: 1.6rem; line-height: 1; color: var(--ember);
  cursor: help;
}

.map-credit {
  max-width: calc(var(--column) + var(--gutter) * 2);
  margin: 0.6rem auto 0; padding: 0 var(--gutter);
  font-size: 0.7rem; color: var(--muted);
}
.map-credit a { color: var(--muted); text-decoration-color: var(--rule); }
.map-credit a:hover { color: var(--text-dim); }

@media (prefers-reduced-motion: reduce) {
  .worldmap [cc], .worldmap .point { transition: none; }
}

/* --- destinations: the timeline ---------------------------------------------- */

/* One row per year: the year on the left, every visit that year flowing left
   to right after it. Reads chronologically top-to-bottom and, within a year,
   left-to-right -- a ledger of visits rather than a full-width block per
   country, which is most of why it's so much more compact. */
.timeline {
  max-width: calc(var(--column) + var(--gutter) * 2);
  margin: clamp(2rem, 6vw, 3.5rem) auto 0;
  padding: 0 var(--gutter);
}
.tl-row {
  display: flex;
  align-items: baseline;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  padding: 0.65rem 0;
  border-top: 1px solid var(--rule);
}
.tl-row:last-child { border-bottom: 1px solid var(--rule); }
.tl-yearlabel {
  flex: 0 0 auto;
  width: 3rem;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--muted);
}
.tl-entries {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
}
.tl-point {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45em;
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
}
.tl-country {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--bright);
}
.tl-place {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* A trip we haven't written up yet is not a link, and says so rather than
   pretending to be one -- the timeline still places it on its year, just
   quietly. */
.tl-point.is-quiet .tl-country { color: var(--text-dim); }
.tl-point:not(.is-quiet):hover .tl-country,
.tl-point:not(.is-quiet):focus-visible .tl-country {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: var(--ember);
  text-underline-offset: 0.2em;
}

/* The handful of visits with no matching page at all, and so no year to sit
   on -- closes the timeline as its own quiet row instead of guessing a date. */
.tl-row-undated { opacity: 0.65; }

/* --- trip-to-trip navigation ---------------------------------------------- */

/* A sticky row with zero height: it takes up no space in the gallery's flow,
   but as you scroll it settles at the vertical centre of the viewport and
   stays there -- bounded, though, to wherever its parent (the trip article)
   actually is. That's what keeps the arrows from drifting into the header
   above it or the footer below it the way a plain `position:fixed` would;
   a sticky element can never stick past its own containing block. Full width
   of the article (which itself has no max-width) rather than matching the
   wall's own column, so the arrows land out in the screen's own margins
   beside the photos instead of overlapping them. */
.tarrow-row {
  position: sticky;
  top: 50%;
  height: 0;
  overflow: visible;
  z-index: 40;
  display: flex;
  padding: 0 clamp(0.5rem, 2vw, 1.5rem);
  pointer-events: none;
}

/* Icon-only, on purpose -- the trip title lives in the tab and the floating
   label below, not repeated here. */
.tarrow {
  pointer-events: auto;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: rgba(12, 10, 9, 0.55);
  color: var(--text-dim);
  font-size: 1.7rem;
  line-height: 1;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .tarrow { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
}
.tarrow:hover, .tarrow:focus-visible { color: var(--bright); background: rgba(12, 10, 9, 0.8); }
/* Whichever arrow exists sits at its own edge -- `next` pushed to the far
   right so a trip with only one of the two still lands on the correct side
   instead of both defaulting to the left. */
.tarrow-next { margin-left: auto; }

/* The one header a trip page has -- floating rather than sitting in the
   flow, so it reads as a label on the gallery rather than a page title.
   Purely informational: it never intercepts a click meant for a photo. */
.tlabel {
  position: fixed;
  left: var(--gutter);
  top: clamp(4.5rem, 12vh, 6rem);
  z-index: 40;
  padding: 0.5rem 0.9rem;
  border-radius: 3px;
  background: rgba(12, 10, 9, 0.5);
  pointer-events: none;
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .tlabel { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
}
.tlabel b {
  display: block;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--text);
}
.tlabel i {
  display: block;
  font-style: normal;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.2rem;
}

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

.lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: 1fr auto;
  background: rgba(6, 5, 4, 0.985);
  opacity: 0;
  transition: opacity 220ms ease;
}
.lb.open { opacity: 1; }
body.lb-locked { overflow: hidden; }

.lb-stage {
  display: grid;
  place-items: center;
  padding: clamp(2.5rem, 6vw, 4rem) clamp(1rem, 6vw, 5rem) 0;
  min-height: 0;
}
.lb-stage img {
  max-width: 100%;
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 260ms ease;
}
.lb-stage img.loaded { opacity: 1; }

.lb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 6vw, 5rem) 1.6rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.lb-cap { max-width: 46rem; }
.lb-count { letter-spacing: 0.14em; white-space: nowrap; }

.lb button {
  position: absolute;
  background: none;
  border: 0;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.9rem;
  line-height: 1;
  font-size: 1.6rem;
  transition: color 150ms ease;
}
.lb button:hover { color: var(--bright); }
.lb-close { top: 0.4rem; right: clamp(0.4rem, 3vw, 2rem); font-size: 1.4rem; }
.lb-prev  { left: clamp(0.1rem, 2vw, 1.5rem); top: 50%; transform: translateY(-50%); }
.lb-next  { right: clamp(0.1rem, 2vw, 1.5rem); top: 50%; transform: translateY(-50%); }
.lb button[hidden] { display: none; }

/* --- narrow screens ------------------------------------------------------- */

/* Below this, every row becomes one photograph per screen. Side-by-side
   photographs at phone width are too small to be worth looking at. */
@media (max-width: 46rem) {
  .row { display: block; }
  .row-wide, .row-stagger, .row-full { width: 100%; }
  /* Same no-cropping rule one photograph at a time: a portrait at full phone
     width would otherwise run to one and a half screens. */
  .cell { max-width: calc(var(--cap, 72vh) * var(--grow, 1)); margin-inline: auto; }
  .cell + .cell { margin-top: var(--flow); }
  .row-inset-left > .cell, .row-inset-right > .cell { flex: none; }
  .row-stagger > .cell:nth-child(even) { margin-top: var(--flow); }
  .lb-stage img { max-height: 74vh; }

  /* The wall stays nested even stacked one-per-row -- a hairline seam, not
     the collage's deliberate breathing room. `.wall .row` outranks the plain
     `.row` rule above by specificity, so its mobile behaviour has to be
     restated here rather than inherited. */
  .wall .row { display: block; width: 100%; }
  .wall .cell + .cell, .wall .tile + .tile { margin-top: var(--wall-gap); }

  /* Smaller and closer to the edge, so the floating chrome stays out of the
     way of a phone-width photograph instead of eating a chunk of it. */
  .tarrow-row { padding: 0 0.4rem; }
  .tarrow { width: 2.25rem; height: 2.25rem; font-size: 1.4rem; }
  .tlabel { left: 0.6rem; top: 4rem; padding: 0.4rem 0.7rem; }
}

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