/* ============================================================
   Site components — the rules the generator's pages need that
   the design prototype did not have. Everything below uses the
   theme's custom properties; no colour or font is hardcoded here.
   layout.css stays the ported prototype so the two can be diffed.
   ============================================================ */

/* ---------- chapter pages ---------- */

.chapter-head { padding: 62px 0 6px; }
.crumbs { font-size: .82rem; color: var(--slate); margin: 0 0 18px; }
.crumbs a { text-decoration: none; }
.chapter-head h1 { margin: 0 0 .2em; }
.chapter-sub { color: var(--slate); font-size: 1.08rem; max-width: var(--measure); }
.wrap--narrow { max-width: 780px; }

.prose { max-width: var(--measure); }
.prose h3 { margin: 1.5em 0 .4em; }
.prose h2 { margin: 1.6em 0 .5em; }
.prose ul, .prose ol { max-width: var(--measure); padding-left: 1.2em; }
.prose li { margin-bottom: .35em; }
.prose .li { margin: 0 0 .35em; }

/* ---------- the flight film ----------
   The film is one entry among more than twenty, but it is not a still. In the image grid it sat
   in a single cell at a fraction of the width, off centre against tiles of other shapes. A film
   is watched, not scanned, so it gets the full width of the column to itself, centred, with the
   stills following in the grid as before. */
.flight-films { margin: 30px 0 6px; }
.flight-films figure { margin: 0 auto; max-width: 1100px; }
.flight-films video {
  display: block; width: 100%; height: auto;
  border-radius: var(--radius); background: #000;
}
.flight-films figcaption { margin-top: 10px; font-size: .84rem; color: var(--slate); }

.figure { margin: 0; }
.figure-media { width: 100%; height: auto; border-radius: var(--radius); }

/* ---------- captioning, for the family ----------
   A page for one relative to fill in what was never labelled. It is a long list — a couple of
   hundred photographs — so each row stays compact: a medium thumbnail, its box beside it, and one
   small line saying whether that row saved. Close enough together to scroll, roomy enough to
   type in. */
.captions-count { margin: 0 0 26px; }
.captions-group { margin-top: 34px; }
.captions-group h2 {
  font-family: var(--font-display); font-weight: var(--display-weight);
  font-size: 1.2rem; margin: 0 0 4px; color: var(--ink);
}
.captions { list-style: none; margin: 0; padding: 0; }
.caption-row {
  display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 16px;
  align-items: start; padding: 12px 0; border-top: 1px solid var(--hairline);
}
.caption-shot { margin: 0; }
.caption-shot img {
  display: block; width: 100%; height: auto;
  border-radius: var(--radius); border: 1px solid var(--hairline); background: var(--paper-2);
}
.caption-field label {
  display: block; font-size: .82rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--slate); margin-bottom: 6px;
}
.cap-input {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 1rem; line-height: 1.5;
  color: var(--ink); background: var(--paper-2); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 11px 13px; resize: vertical;
}
.cap-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.cap-input { min-height: 62px; }
.cap-note { margin: 5px 0 0; min-height: 1.1em; font-size: .84rem; color: var(--slate); }
.cap-note.is-saved { color: var(--accent); }
.cap-note.is-error { color: #b4482f; }
@media (max-width: 640px) {
  .caption-row { grid-template-columns: 1fr; gap: 8px; }
  .caption-shot img { max-width: 240px; }
}

/* ---------- sending files ----------
   The upload page's bar. It reports real bytes while the browser is sending, then the words
   take over for the part the browser cannot measure — the server reading files and making
   derivatives — because a bar that kept creeping would be inventing progress. */
.sending { margin-top: 22px; max-width: var(--measure); }
.bar {
  height: 8px; border-radius: 999px; overflow: hidden;
  background: var(--paper-2); border: 1px solid var(--hairline);
}
.bar-fill {
  display: block; width: 0; height: 100%; background: var(--accent);
  transition: width .25s ease;
}
.sending-note { margin: 10px 0 0; font-size: .92rem; line-height: 1.5; color: var(--slate); }
.sending--done .sending-note { color: var(--ink); }

/* ---------- the guest book ----------
   Lighter than the tribute cards on purpose: a guest book is a list of signatures, names and
   places, read down the page. The line somebody wrote is the loud part; who they are is quieter. */
.signatures { list-style: none; margin: 0; padding: 0; max-width: var(--measure); }
.signature { padding: 18px 0; border-top: 1px solid var(--hairline); }
.signature:first-child { border-top: 0; }
.signature-line {
  margin: 0 0 8px; font-family: var(--font-display);
  font-size: clamp(1.02rem, 1.7vw, 1.18rem); line-height: 1.55; color: var(--ink);
}
.signature-by { margin: 0; font-size: .88rem; color: var(--slate); }
.signature-by .who { color: var(--ink); font-weight: 600; }
.signature-by .when { font-variant-numeric: tabular-nums; }
.signature-empty { color: var(--slate); font-size: 1rem; }

/* A chapter cover is a band, not a full-height photograph. The carpentry cover is 577x1280, a
   very tall portrait, and at full width it ran the whole height of the screen before the
   chapter's own text had begun. The family asked for it to be cropped rather than capped, so
   the band crops: object-fit keeps the middle of the picture and throws the rest away, in the
   same 3:2 the chapter cards use. A definite height in the markup makes aspect-ratio inert, so
   the media rule states a height as well as the ratio. */
.figure--cover { aspect-ratio: 3 / 2; overflow: hidden; }
.figure--cover .figure-media { width: 100%; height: 100%; object-fit: cover; }
.figure figcaption {
  font-size: .84rem; color: var(--slate); margin-top: 10px;
}
.chapter-nav { padding: 26px 0 76px; }
.chapter-nav .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gallery-group { margin: 42px 0 16px; }
.more { margin-top: 28px; }
.cards--wide { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* ---------- media inside cards, tiles and frames ---------- */

.card-link { display: block; color: inherit; text-decoration: none; }
/* A definite height in the markup beats a ratio in the CSS. `<img width="5344"
   height="3006">` is a presentational hint with no specificity, but it is still a
   definite height, and per CSS a definite height makes `aspect-ratio` inert — so the
   chapter cards rendered 347x3006 for a 5344x3006 photograph. `height: auto` hands the
   shape back to the ratio and `object-fit: cover` crops to fill it. */
.card-media { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
.tile-media { width: 100%; height: auto; display: block; }
.frame-media { width: 100%; height: 100%; object-fit: cover; }
.film-media { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.card--person .card-body { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

.hero-kicker {
  display: block; font-size: .74rem; letter-spacing: var(--caps-tracking);
  text-transform: uppercase; margin-bottom: 14px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }

/* Masonry by columns rather than by row-span: real photographs keep their
   own proportions, placeholders get an aspect ratio, and neither one needs a
   hardcoded height. */
.gallery { columns: 4 190px; column-gap: 14px; display: block; }
.gallery .tile {
  display: block; break-inside: avoid; margin: 0 0 14px;
  border-radius: var(--tile-radius); overflow: hidden;
  border: var(--tile-border); box-shadow: var(--card-shadow); cursor: zoom-in;
}
.gallery .tile .ph { aspect-ratio: 4 / 3; }
.gallery .tile .ph.ratio-tall { aspect-ratio: 3 / 4; }
.gallery .tile .ph.ratio-wide { aspect-ratio: 16 / 9; }
.gallery .tile .ph.ratio-square { aspect-ratio: 1 / 1; }

/* ---------- the memory strip ---------- */

.memory-strip { background: var(--band-bg); color: var(--band-muted); font-size: .8rem; }
.memory-strip .wrap {
  display: flex; gap: 16px; align-items: center;
  padding-top: 8px; padding-bottom: 8px;
}
.memory-strip a { color: var(--band-marker); text-decoration: none; letter-spacing: .04em; }
.nav-memory { display: none; }
@media (max-width: 900px) {
  /* On narrow screens the menu wraps, so the memory link is already visible in
     it — showing the strip as well duplicates the link. */
  .nav-memory { display: block; }
  .memory-strip { display: none; }
}

/* ---------- films ---------- */

/* An uploaded film reserves its own shape from the dimensions stored in the
   database. Without that the browser paints a default 2:1 landscape box before the
   file loads, a portrait film sits as a narrow strip inside it, and the layout jumps
   once the metadata arrives. */
.film-frame--playable {
  display: flex; justify-content: center; align-items: flex-start;
  background: transparent; border-radius: var(--radius);
}
/* auto width AND height so the declared ratio wins: with a definite width the box
   gets clamped by max-height and stops matching the film's shape (black bars). */
.film-frame--playable video {
  display: block; margin: 0 auto;
  width: auto; height: auto; max-width: 100%; max-height: 76vh;
  aspect-ratio: var(--ar, 16 / 9);
  object-fit: contain;
  border-radius: var(--radius); background: #0b1119;
}
/* A row of portrait films, with landscape films and YouTube embeds spanning it.
   auto-fit (not auto-fill) so a single portrait film does not sit beside an empty
   track, and 280px is the floor at which a phone film is still worth watching —
   below that the grid drops to one column on its own. */
.film-list {
  display: grid; gap: 40px 26px; align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.film-list .film--wide { grid-column: 1 / -1; }
.film-list .film--portrait { width: 100%; max-width: 420px; }
.film--portrait { width: fit-content; max-width: min(100%, 520px); }
.film--portrait .film-frame--playable video { max-height: min(76vh, 820px); }

.film--wide { margin-bottom: 44px; max-width: 920px; }
.film-frame { position: relative; border-radius: var(--radius); overflow: hidden; }
.embed {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius);
  overflow: hidden; border: var(--tile-border); background: #000;
}
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- flashes, callouts, form furniture ---------- */

.flash {
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 26px;
  border-left: 3px solid var(--accent); background: var(--card-bg);
  box-shadow: var(--card-shadow); max-width: 640px;
}
.flash h3 { margin-bottom: .3em; }
.flash--bad { border-left-color: var(--marker); }
.callout {
  background: var(--card-bg); border: 1px solid var(--hairline);
  border-left: 3px solid var(--accent); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 30px; max-width: 620px;
  box-shadow: var(--card-shadow);
}
.callout h3 { margin-bottom: .3em; }
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.muted { opacity: .62; }
.note--upload { margin-top: 28px; }
.note {
  font-size: .84rem; color: var(--slate); max-width: var(--measure);
}
.revision {
  font-size: .76rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--slate); margin-bottom: 18px;
}
.tcard--empty { border-left-color: var(--slate); }
.person a.name { text-decoration: none; }
.person .name { font-family: var(--font-display); font-size: 1.05rem; }

/* ---------- places: the map ----------
   Two panels, each drawn at its own true aspect from the committed Natural Earth
   extract. Nothing is fetched at runtime and the projection is never stretched:
   the window is widened in longitude instead, because a panel forced into a shape
   its region does not have moves every coastline.

   The class is .map, not .mapbox: .mapbox in layout.css is the *placeholder*
   panel — a dark mat at 21:9 with decorative pins, for when no coordinate is
   confirmed. A real map reusing it inherits a dark background and a fixed aspect,
   which put the caption dark-on-dark and squashed both panels. */

.map { margin: 0 0 38px; }
.map-svg {
  display: block; width: 100%; height: auto; margin: 0 auto;
  background: var(--paper);                          /* under the sea tint */
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;              /* the viewport clips the coastline, exactly */
}
.map-svg--all { max-width: 380px; }
.map-svg--north { max-width: 960px; }

/* Land is the page's white and the sea is the theme's ink at 7.5%, which is the
   one pairing that gives a readable land/sea edge in both themes without either
   introducing a colour the themes do not have or a token the family's stored
   theme JSON would be missing. */
.map-sea { fill: var(--ink); opacity: .075; }
.map-land { fill: var(--card-bg); stroke: var(--ink); stroke-opacity: .3;
            stroke-width: 1; vector-effect: non-scaling-stroke; }
.map-lakes { fill: var(--ink); opacity: .075; }
.map-borders { fill: none; stroke: var(--ink); stroke-opacity: .34; stroke-width: 1;
               stroke-dasharray: 7 5; vector-effect: non-scaling-stroke; }
.map-grat line { stroke: var(--ink); stroke-opacity: .1; stroke-width: 1;
                 vector-effect: non-scaling-stroke; }
.map-grat-labels text {
  fill: var(--slate); font-family: var(--font-body); letter-spacing: .04em;
  paint-order: stroke; stroke: var(--card-bg); stroke-width: 3px;
}
.map-svg .map-detail-box {
  fill: none; stroke: var(--accent); stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.pin-halo { fill: var(--accent); opacity: .22; }
.pin-dot { fill: var(--accent); }
.pin--accident .pin-dot { fill: var(--marker); }
.pin--accident .pin-halo { fill: var(--marker); }
.pin--accident .pin-ring { fill: none; stroke: var(--marker); stroke-width: 2;
                           vector-effect: non-scaling-stroke; }
.pin-label {
  fill: var(--ink); font-family: var(--font-body); letter-spacing: .01em;
  paint-order: stroke; stroke: var(--card-bg); stroke-width: 4px; stroke-linejoin: round;
}
.map-scale line { stroke: var(--ink); stroke-opacity: .6; stroke-width: 2;
                  vector-effect: non-scaling-stroke; }
.map-scale text { fill: var(--slate); font-family: var(--font-body); }

.map-caption {
  font-size: .8rem; color: var(--slate); margin: 10px 2px 0; max-width: 68ch;
}
.map-caption strong { color: var(--ink); font-weight: 600; }
.map-legend { margin: 8px 2px 0; font-size: .72rem; color: var(--slate); }
.map-legend .legend { margin-right: 16px; white-space: nowrap; }
.map-legend .legend::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px;
  border-radius: 50%; background: var(--accent); vertical-align: middle;
}
.map-legend .legend--accident::before {
  background: none; border: 2px solid var(--marker);
}
.map-legend .legend--winter::before { background: var(--accent); opacity: .55; }
.map-empty-box { margin: 0 0 38px; }

/* Below this the six northern labels would be four-pixel type on top of each
   other, so the panel keeps the coastlines and the list below carries the names.
   The place names stay in the DOM either way — this is presentation only. */
@media (max-width: 700px) {
  .map-svg--north .pin-label { display: none; }
}
.places {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px; margin-top: 32px;
}
.place {
  background: var(--card-bg); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--card-shadow);
}
.place--accident { border-left: 3px solid var(--marker); }
.place h3 { margin-bottom: .2em; }
.place .rel { font-size: .76rem; letter-spacing: .04em; color: var(--slate); }
.place p { font-size: .92rem; color: var(--slate); margin: .7em 0 0; }

/* ---------- family and the hub ---------- */

.couple { margin-top: 40px; max-width: 640px; }
.hub-head { padding: 82px 0 18px; }
.hub-head h1 { margin-bottom: .25em; }
.brush { stroke: var(--accent); opacity: .55; display: block; margin: 14px 0 12px; }

/* ---------- print ---------- */

@media print {
  .reviewnote, .memory-strip, .chapter-nav, .embed, .map-svg { display: none; }
  .section { padding: 18px 0; break-inside: avoid; }
  a::after { content: " (" attr(href) ")"; font-size: .8em; }
}

/* ---------- the motto band ---------- */
.motto-band { padding: 34px 0 0; }
.motto {
  margin: 0 auto; max-width: 44ch; text-align: center;
  white-space: pre-line;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  line-height: 1.55;
  color: var(--ink);
}
.motto::before {
  content: ""; display: block;
  width: 54px; height: 1px; margin: 0 auto 18px;
  background: var(--accent); opacity: .55;
}

/* ---------- the slideshow caption and dots, on the picture ----------
   The caption used to sit under the stage at .86rem in --slate on the page background,
   and the dots sat below it, at the very bottom of the box. On his theme that is muted
   slate on dark navy — about 2.5:1, well under the 4.5:1 a caption should clear — and
   the whole thing reads as a strip of furniture under a photograph. Overlaid instead:
   the caption is white on a scrim, which is legible over any picture and does not
   depend on the theme, and the dots sit where a viewer looks for them. */
.slideshow .caption {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0;
  padding: 60px 24px 48px;
  font-size: clamp(1.05rem, 1.9vw, 1.4rem);
  line-height: 1.35;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9), 0 2px 14px rgba(0, 0, 0, .55);
  background: linear-gradient(to top, rgba(0, 0, 0, .74), rgba(0, 0, 0, .34) 52%, transparent);
}
.slideshow .caption:empty { display: none; }

.dots {
  position: absolute; left: 0; right: 0; bottom: 15px; margin: 0; padding: 0;
  display: flex; justify-content: center; gap: 10px;
  z-index: 2;
}
.dots button {
  width: 12px; height: 12px; padding: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .95);
  background: rgba(255, 255, 255, .3);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .65);
  cursor: pointer;
  transition: background .25s ease, transform .25s ease;
}
.dots button:hover { background: rgba(255, 255, 255, .65); }
.dots button[aria-current="true"] { background: #fff; transform: scale(1.2); }
.dots button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .dots button { transition: none; }
  .dots button[aria-current="true"] { transform: none; }
}

/* ---------- the music control in the header ----------
   One control, in the sticky header, where it is always in reach. Quiet by default — a
   memorial's chrome should not shout — with the accent arriving on hover and staying while
   the visitor has the music on. The words are dropped on narrow screens, where a header of
   eight menu items leaves little room; the button keeps its accessible name from
   aria-label and its state from aria-pressed, both of which the script keeps true. */

.nav-music {
  display: inline-flex; align-items: center; gap: 7px;
  margin-left: 4px;
  padding: 6px 13px 6px 11px;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--slate);
  font: inherit; font-size: .82rem; letter-spacing: .01em;
  white-space: nowrap; cursor: pointer;
  transition: color .18s ease, border-color .18s ease;
}
.nav-music:hover { color: var(--ink); border-color: var(--ink); }
.nav-music[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.nav-music .i-note { flex: none; opacity: .8; }
.nav-music:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 760px) {
  .nav-music { padding: 6px 9px; }
  .nav-music .music-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
}


/* ---------- the poem, under the hero ----------
   The family asked for it in small text underneath the two hero buttons. Small and quiet
   on purpose: it is a poem they keep with him, not a banner. `pre-line` keeps the lines
   and the stanza breaks exactly as they typed them, as the motto band does. The literal
   colour is --ink_2 rather than --slate: slate was measured at about 2.5:1 on his theme,
   which is fine for a hairline and not for sixteen lines of poetry. */
.poem-band { padding: 30px 0 2px; }
.poem {
  margin: 0 auto; max-width: 46ch; text-align: center;
  white-space: pre-line;
  font-family: var(--font-display);
  font-size: .92rem; line-height: 1.62;
  color: var(--ink_2);
}
.poem::before {
  content: ""; display: block;
  width: 34px; height: 1px; margin: 0 auto 16px;
  background: var(--accent); opacity: .4;
}
.poem-credit {
  margin: 14px auto 0; max-width: 46ch; text-align: center;
  font-size: .82rem; letter-spacing: .04em;
  color: var(--ink_2);
}


/* ---------- a saying kept with a chapter ----------
   The width is 52ch, not the narrower measure the poem uses: this saying's second line is
   "Measure twice, cut once — and he kept both thumbs." (50 characters), and at 40ch it
   broke across two lines with a stranded "thumbs." hanging on its own. ----------
   Del's "Jack of all trades" line was the motto band at the top of the front page. The
   family asked for it under the carpentry chapter instead — the work it describes — so the
   value moved and the band is empty. Set in the display face with the same accent hairline
   as the motto band, and `pre-line` so the second line stays the second line. */
.chapter-quote {
  margin: 30px auto; max-width: 52ch; text-align: center;
  white-space: pre-line;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.5;
  color: var(--ink);
}
.chapter-quote::before {
  content: ""; display: block;
  width: 44px; height: 1px; margin: 0 auto 18px;
  background: var(--accent); opacity: .5;
}


/* ---------- the poem over a photograph ----------
   The family uploaded a picture of Summit Lake — mostly blue sky and blue water, mountains
   about two thirds down — and asked for it behind the poem with the words still readable.
   The scrim is the whole mechanism. 0.6 of black over the brightest thing the picture can
   be (a white cloud) leaves #666, and white on #666 measures 5.7:1; over this picture's
   actual blue it is nearer 8:1. The photograph still shows through at 40 per cent, and the
   text-shadow only has to deal with the JPEG's own noise. Without a photograph none of this
   applies: the block keeps the dark text it had. */
.poem-band--image {
  background-size: cover;
  background-position: center 42%;
  background-repeat: no-repeat;
  padding: 62px 0 58px;
  /* The scrim, as a blend rather than an overlay element: nothing can end up sitting on
     top of the words, and an inline background-image does not override these longhands.
     Mid-grey #666 multiplied with the picture is exactly a 0.6 black wash over it — a
     white cloud lands on #666, where white text measures 5.7:1, and this picture's blue
     lands near #545d63, about 9:1. A near-black here would have multiplied the photograph
     down to nothing, which is the mistake this comment exists to prevent. */
  background-color: #666666;
  background-blend-mode: multiply;
}
.poem-band--image .poem,
.poem-band--image .poem-credit { color: #fff; }
.poem-band--image .poem { text-shadow: 0 1px 3px rgba(0, 0, 0, .45); }
