/* CCAANZ front page — styles for public/front.html and public/front.js (bead
   cca-9f0kn.2; Miranda's Gate 1 design, ADR-073). The page is framed
   cross-origin on the WordPress front page, so no theme reaches it: it styles
   itself completely, in the front page's own tokens — gold #85754d (white on
   it 4.52:1; not tokens.css's #86754d, 4.50), ink #282317, olive #7d7150, grey
   #717171, and Montserrat only. Every length is px or a container unit.

   Layout follows the FRAME's own width (container queries on .cca-front,
   never the viewport), in three tiers: below 560px one column — the gold tile
   first, then the three wide tiles full width at 2.15:1, the squares hidden;
   560–719px Miranda's 4 × 3 — the gold tile, the three wide tiles and two
   squares; from 720px today's 5 × 3 mosaic, measured from the old 1100 × 643
   banner — 23px between columns (2.09%), 21px between rows (1.91%), 200px rows
   (18.18%). Every tile box is fixed before any picture arrives, so nothing
   shifts; the gold tile is never cut (test/front.test.ts models its fit at the
   4 × 3's narrowest width; a real-browser render confirms it).

   Motion is a 700ms opacity fade only, and only under
   prefers-reduced-motion: no-preference. No dark theme: the colours are
   explicit light ones. */

/* front.html's page: no margin, white, so the frame shows only the hero. */
body.cca-front__page {
  margin: 0;
  background: #fff;
}

/* The hero root: the query container. Below it, today's spacing under the
   band it replaces — 48px, then a 1px #e2e2e2 rule; the page's own spacing
   follows the frame. */
.cca-front {
  container: cca-front / inline-size;
  box-sizing: border-box;
  margin: 0;
  padding: 0 0 48px;
  border-bottom: 1px solid #e2e2e2;
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #282317;
  color-scheme: light;
}
.cca-front *,
.cca-front *::before,
.cca-front *::after {
  box-sizing: inherit;
}

/* The mosaic: one column below 720px of frame width. */
.cca-front__mosaic {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: 2.09cqi;
  row-gap: 1.91cqi;
}

/* Every tile is a fixed box in the brand ink until a picture fills it; a tile
   with nothing for it, or whose picture will not load, stays ink. */
.cca-front__tile {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: #282317;
}
.cca-front__tile--wide {
  aspect-ratio: 2.15 / 1;
}
.cca-front__tile--square {
  display: none;
}

/* The mission sentence: live text (WCAG 1.1.1, 1.4.5), Montserrat 400, white
   on #85754d (4.52:1), sized from the TILE's own width — clamp(24px,
   width / 11.5, 38px). The tile is a size container so the sentence can read
   that width (cqi); the padding is a share of it too. It is never clamped or
   cut (Miranda): overflow stays visible, so a tile too small for it would show
   in a render rather than hide words — the tiers are set so it fits.
   WCAG 1.4.12 (Miranda r1, confirmed by render): with a reader's own text
   spacing the sentence can outgrow the tile, so it is centred SAFELY — the
   tile is a flex column and the sentence's auto block margins centre it, and
   auto margins never go below zero, so an overflow only ever runs DOWN, never
   above the tile (or the frame's top). The tiers' rows are minimums, not fixed
   sizes, so that overflow makes the mosaic taller instead. */
.cca-front__gold {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  overflow: visible;
  background: #85754d;
}
.cca-front__mission {
  flex: none;
  min-width: 0;
  margin: auto 0;
  padding: 6cqi;
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(24px, calc(100cqi / 11.5), 38px);
  font-weight: 400;
  line-height: 1.2;
  color: #fff;
}

/* 560–719px of frame width: Miranda's 4 × 3 (cca-9f0kn.2 r2). Row 1 — the
   gold tile across columns 1–2 (rows 1–2) and a wide tile across 3–4; row 2 —
   two squares; row 3 — two wide tiles. The squares s3–s5 stay hidden. The two
   squares set the row height: every row is at least one column wide (square),
   written out so all three rows hold it — a row of wide tiles alone, whose
   pictures are absolutely placed, would otherwise have no height of its own.
   Only the gold sentence can make a row taller (under a reader's text
   spacing, WCAG 1.4.12); pictures never do, so nothing shifts as they arrive.
   DOM order is unchanged, so the gold is still first and Tab and the changes
   still run d1 → d2 → d3. The upper bound is 719.98px, not 719px, so a
   fractional frame width just under 720px is not left without a tier. */
@container cca-front (min-width: 560px) and (max-width: 719.98px) {
  .cca-front__mosaic {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(calc((100cqi - 3 * 2.09cqi) / 4), auto));
    grid-template-areas:
      'gold gold d1 d1'
      'gold gold s1 s2'
      'd2 d2 d3 d3';
  }
  .cca-front__tile--wide {
    aspect-ratio: auto;
  }
  .cca-front__tile[data-slot='s1'],
  .cca-front__tile[data-slot='s2'] {
    display: block;
    aspect-ratio: 1;
  }
  .cca-front__gold {
    grid-area: gold;
  }
  .cca-front__tile[data-slot='s1'] {
    grid-area: s1;
  }
  .cca-front__tile[data-slot='s2'] {
    grid-area: s2;
  }
  .cca-front__tile[data-slot='d1'] {
    grid-area: d1;
  }
  .cca-front__tile[data-slot='d2'] {
    grid-area: d2;
  }
  .cca-front__tile[data-slot='d3'] {
    grid-area: d3;
  }
}

/* From 720px of frame width: today's 5 × 3. Row 1 — three squares, a wide
   tile across columns 4–5; the gold tile columns 1–2 × rows 2–3; row 2 — a
   wide tile across columns 3–4, a square; row 3 — a square, a wide tile
   across columns 4–5. Rows are at least 18.18cqi, and grow only for the gold
   sentence under a reader's text spacing (WCAG 1.4.12). */
@container cca-front (min-width: 720px) {
  .cca-front__mosaic {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(18.18cqi, auto));
    grid-template-areas:
      's1 s2 s3 d1 d1'
      'gold gold d2 d2 s4'
      'gold gold s5 d3 d3';
  }
  .cca-front__tile--wide {
    aspect-ratio: auto;
  }
  .cca-front__tile--square {
    display: block;
  }
  .cca-front__gold {
    grid-area: gold;
  }
  .cca-front__tile[data-slot='s1'] {
    grid-area: s1;
  }
  .cca-front__tile[data-slot='s2'] {
    grid-area: s2;
  }
  .cca-front__tile[data-slot='s3'] {
    grid-area: s3;
  }
  .cca-front__tile[data-slot='s4'] {
    grid-area: s4;
  }
  .cca-front__tile[data-slot='s5'] {
    grid-area: s5;
  }
  .cca-front__tile[data-slot='d1'] {
    grid-area: d1;
  }
  .cca-front__tile[data-slot='d2'] {
    grid-area: d2;
  }
  .cca-front__tile[data-slot='d3'] {
    grid-area: d3;
  }
}

/* A layer fills its tile; a change stacks the new layer over the old in the
   same box. Inside, the picture and the scrim share one grid cell, so the
   scrim paints over the picture without being positioned — which leaves the
   LAYER as the headline's nearest positioned ancestor, so the stretched link
   below covers the whole tile. */
.cca-front__layer {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
}
.cca-front__layer[hidden] {
  display: none;
}
.cca-front__layer > * {
  grid-area: 1 / 1;
  min-width: 0;
  min-height: 0;
}
.cca-front__pic {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cca-front__pic--story {
  object-position: 50% 30%;
}

/* A story's text sits on the ink at 75%: white on it over a pure-white sky is
   6.8:1 (the worst case; Miranda), over anything darker more. */
.cca-front__scrim {
  align-self: end;
  padding: 10px 14px 12px;
  background: rgba(40, 35, 23, 0.75);
  color: #fff;
}
/* "Publisher ↗ · date", 13/600, one line: only the publisher gives way. */
.cca-front__eyebrow {
  display: flex;
  align-items: baseline;
  margin: 0 0 4px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.cca-front__source {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* pre: the spaces round the dot survive at the edges of a flex item. */
.cca-front__ext,
.cca-front__sep,
.cca-front__date {
  flex: none;
  white-space: pre;
}
/* The headline, 18/600, two lines at most (the whole of it stays in the
   DOM). It is the tile's ONE link; its ::after is stretched over the whole
   tile (the layer), as widget.css stretches a card's. */
.cca-front__headline {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  text-decoration: none;
}
.cca-front__headline::after {
  content: '';
  position: absolute;
  inset: 0;
}
.cca-front__headline:hover {
  text-decoration: underline;
}
/* A story whose picture would not load: the ink tile (white on it 15.6:1),
   the headline set large. */
.cca-front__layer--plain .cca-front__scrim {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  background: #282317;
}
.cca-front__layer--plain .cca-front__headline {
  -webkit-line-clamp: 3;
  line-clamp: 3;
  font-size: 22px;
  line-height: 1.25;
}
/* The small wide tiles' story type (Miranda, r2 and r4): the 4 × 3's wide
   tiles, and the 5 × 3's up to a 900px frame (the same size, about 280 × 131
   at 720px), take a 16px headline and a 20px ink fallback (still at most
   three lines); the eyebrow stays 13px, the crop and the scrim as above. After
   the rules it overrides, which it matches selector for selector. */
@container cca-front (min-width: 560px) and (max-width: 899.98px) {
  .cca-front__headline {
    font-size: 16px;
  }
  .cca-front__layer--plain .cca-front__headline {
    font-size: 20px;
  }
}

/* The crossfade: the new layer fades in over the old, 700ms, opacity only. */
@keyframes cca-front-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .cca-front__layer--in {
    animation: cca-front-in 700ms ease-in-out both;
  }
}

/* The caption row: the band's disclaimer, then See all on the right; it wraps
   on a narrow frame. No Pause: the registrar removed it (22 Oct 2026). */
.cca-front__caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  margin: 1.91cqi 0 0;
}
.cca-front__note {
  flex: 1 1 320px;
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: #717171;
  text-wrap: pretty;
}
/* The slot for future caption actions; today it holds See all alone. */
.cca-front__actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}
/* See all sits at the frame's right edge, where an outside ring would be cut
   off: a little inline padding, and its ring drawn inside it (below). */
.cca-front__all {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 6px;
  font-size: 18px;
  font-weight: 500;
  color: #7d7150;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.cca-front__all:hover {
  color: #6b5e3d;
}

/* Focus: a 3px #85754d ring round a link. See all's is drawn INSIDE it, in
   its padding, because it sits at the frame's right edge. */
.cca-front a:focus-visible {
  outline: 3px solid #85754d;
  outline-offset: 2px;
}
.cca-front .cca-front__all:focus-visible {
  outline-offset: -3px;
}
/* A story has ONE ring, round its whole tile and drawn INSIDE it — the frame
   would cut an outside ring wherever a tile meets its edge — in two tones, 3px
   ink outside 3px white. Each band is set for what it meets (Miranda r2): the
   ink band, at the tile's edge, meets the white page round the tile (15.6:1);
   the white band meets the tile's content — the ink fallback tile (15.6:1),
   the scrim, or a picture, over which the pair holds at least 3:1 whatever its
   colour (where the picture is as light as the white band, the ink beside it
   shows; the worst case is the square root of white on ink's 15.6:1, about
   3.95:1). Six px deep, it stays clear of the story text: the scrim's padding
   is at least 10px, the ink fallback tile's 16px. It is an overlay above the
   tile's layers (a ::after, which comes after them) that lets every click
   through. The headline gives up its own ring: its selector out-ranks the
   general one above (0,3,1 over 0,2,1). Without :has() the headline keeps the
   general ring instead. */
@supports selector(:has(a)) {
  .cca-front__tile:has(.cca-front__headline:focus-visible)::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid #282317;
    box-shadow: inset 0 0 0 3px #fff;
    pointer-events: none;
  }
  .cca-front a.cca-front__headline:focus-visible {
    outline: none;
  }
}

/* Forced colours: the system's palette, with visible tile edges and rings. */
@media (forced-colors: active) {
  .cca-front__tile {
    border: 1px solid CanvasText;
  }
  .cca-front a:focus-visible {
    outline-color: Highlight;
  }
}
@supports selector(:has(a)) {
  @media (forced-colors: active) {
    .cca-front__tile:has(.cca-front__headline:focus-visible)::after {
      border-color: Highlight;
    }
  }
}
