/* CF2 infrastructure project cards: Snapshot swipe rail (server markup, no JS), Dashboard compact rail, Full pinned scroller (cf2-src/ext/infra.js).
   Layer `infra` is the LAST layer (tokens.css first line). SPLIT in two: infra.css is inlined (critical.min.css), infra.tier.css is lazy (tiers.min.css). Tokens only; palette locked. */
/* SNAPSHOT SUBSET: only what the Snapshot document (server markup + lazy snapshot hydration) needs. The Dashboard/Full remainder is infra.tier.css. */
@layer infra {
  .cf2-inf { --cw: clamp(14.5rem, 70vw, 17rem); --gap: var(--s-4); min-inline-size: 0; }
  .cf2-inf-scroll { min-inline-size: 0; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: thin; padding-block: 4px var(--s-3); }
  .cf2-inf-scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
  .cf2-inf-rail { display: flex; gap: var(--gap); margin: 0; padding: 0; list-style: none; position: relative; inline-size: max-content; min-inline-size: 100%; }
  /* card: the WHOLE picture on top in a reserved 16:9 box (object-fit: contain, never cropped, so the "impression" flag baked into the image
  is never hidden), the text on a solid navy surface below it; portrait overall (2:3). Nothing is overlaid on the picture except the small
  credit caption, bottom-LEFT (the flag is bottom-right). */
  .cf2-inf-card {
    flex: 0 0 var(--cw); inline-size: var(--cw); aspect-ratio: var(--car, 2 / 3); block-size: var(--ch, auto); scroll-snap-align: start;
    position: relative; display: flex; flex-direction: column; overflow: hidden;
    border-radius: var(--r-3); background: var(--navy-8); color: #fff; box-shadow: var(--e-1);
  }
  .cf2-inf-card[hidden] { display: none; }
  .cf2-inf-card:focus-within { outline: 2px solid var(--focus); outline-offset: 3px; }
  /* The picture box is FIXED (16:9, clipped); the image is laid over it and can never change its size: a file of the wrong shape (an old
  portrait crop, a 4:3 original) is letterboxed inside, it can not grow the box or push the text out of the card. */
  .cf2-inf-pic { position: relative; flex: none; aspect-ratio: 16 / 9; min-block-size: 0; overflow: hidden; background: var(--navy-9); }
  .cf2-inf-img { position: absolute; inset: 0; display: block; inline-size: 100%; block-size: 100%; object-fit: contain; }
  .cf2-inf-cap { position: absolute; inset: auto auto var(--s-2) var(--s-2); max-inline-size: 58%; padding: 1px var(--s-2); border-radius: var(--r-pill); background: rgb(12 20 29 / .74); color: #fff; font-size: var(--t-xs); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
  /* "AI impression" tag (6 Oct 2026 clarity wave, S-M7 / O-M3): every generated project image carries alt="AI impression: ..." and the footnote says "Images marked AI impression are illustrative only", but nothing on screen marked
     them. One rule and no markup (the HTML budget stays put): the picture box shows the tag when its image's alt starts with that phrase. Bottom-left, clear of the three AreaSearch pins (the watermark baked into the picture file,
     bottom-right); a credit caption in the same corner (an image that is not AI) moves it up one line. Browsers without :has() simply show no tag (the alt text and the footnote stay). */
  .cf2-inf-pic:has(> img[alt^="AI impression"])::after { content: "AI impression"; position: absolute; inset: auto auto var(--s-2) var(--s-2); padding: 1px var(--s-2); border-radius: var(--r-pill); background: rgb(12 20 29 / .78); color: #fff; font-size: 11px; line-height: 1.4; white-space: nowrap; pointer-events: none; }
  .cf2-inf-pic:has(> .cf2-inf-cap):has(> img[alt^="AI impression"])::after { inset-block-end: calc(var(--s-2) + 1.9em); }
  .cf2-inf-body { flex: 1 1 0; min-block-size: 0; display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-1); padding: var(--s-3) var(--s-4) var(--s-4); overflow: hidden; }
  .cf2-inf-body > * { flex: none; max-inline-size: 100%; }
  .cf2-inf-st { padding: 2px var(--s-3); border: 1px solid rgb(255 255 255 / .3); border-radius: var(--r-pill); background: var(--track); color: var(--fg-2); font: var(--w-strong) var(--t-xs)/1.3 var(--f); white-space: nowrap; }
  .cf2-inf-st-building { background: var(--orange); border-color: var(--orange); color: var(--navy-9); }
  .cf2-inf-st-approved { background: var(--teal); color: #fff; }
  .cf2-inf-st-planned { background: #fff; color: var(--teal); }
  .cf2-inf-name { margin: 0; color: #fff; font: var(--w-h) var(--nfs, var(--t-md))/1.15 var(--f); letter-spacing: -.02em; text-wrap: balance; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
  .cf2-inf-name a { color: inherit; text-decoration: none; }
  .cf2-inf-name a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
  /* the detail dialog's button (13 Oct 2026, cf2/ext/infra.php): a real button over the WHOLE card, above the name link's stretched ::after (z 1), which stays underneath it as the keyboard / no-script route to the source.
     core.js tap-to-load opens the dialog on a click; page.php hides the button in <noscript>. The card's own :focus-within ring is its focus ring. */
  .cf2-inf-open { position: absolute; inset: 0; z-index: 2; margin: 0; padding: 0; border: 0; border-radius: inherit; background: transparent; cursor: pointer; }
  .cf2-inf-open[aria-busy="true"] { cursor: progress; }
  .cf2-inf-open::after { content: "+"; position: absolute; inset: .75rem .75rem auto auto; display: grid; place-items: center; inline-size: 1.75rem; block-size: 1.75rem; border-radius: 50%; background: rgb(255 255 255 / .92); color: var(--navy-9); font: var(--w-h) 1.25rem/1 var(--f); }   /* the same "+" circle the Full and Dashboard cards carry (infra.tier.css .cf2-inf-tgl): this card opens a dialog */
  .cf2-inf-open[data-tap-failed] { display: none; }   /* the chunk did not load (core.js marks the button): the button steps aside and the name link under it is the card's link again */
  .cf2-inf-card:hover .cf2-inf-name a { text-decoration: underline; text-underline-offset: 3px; }
  .cf2-inf-meta { margin: 0; color: rgb(255 255 255 / .84); font-size: var(--t-xs); line-height: 1.35; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .cf2-inf-desc { margin: 0; color: rgb(255 255 255 / .92); font-size: var(--dfs, var(--t-sm)); line-height: 1.35; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--dlc, 2); overflow: hidden; }
  .cf2-inf-note { margin: var(--s-3) 0 0; max-inline-size: 62ch; color: var(--fg-3); font-size: var(--t-xs); line-height: 1.45; }
  .cf2-inf-all { margin: var(--s-3) 0 0; font-size: var(--t-sm); font-weight: var(--w-med); }
  .cf2-inf-all a { display: inline-block; padding-block: 15px; margin-block: -15px; }
  /* Full / Dashboard: details inside the fixed card (hover, focus, tap), tools, rail buttons */
  .cf2-inf-snap { container-type: inline-size; }
  .cf2-inf-skip { position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }
  .cf2-inf-skip:focus { position: static; inline-size: auto; block-size: auto; margin: 0 0 var(--s-2); overflow: visible; clip-path: none; display: inline-block; padding: var(--s-2) var(--s-3); background: var(--surface); }
  .cf2-inf-prog { display: none; }
  /* PAGE DOTS (13 Oct 2026, cf2-src/ext/infra.js attachDots): the row is reserved (an empty .cf2-inf-dots in the markup), the dots fill it once the chunk is here. 8 px dot, 24 px button. */
  .cf2-inf-dots { display: flex; flex-wrap: wrap; justify-content: center; min-block-size: 1.5rem; }
  .cf2-inf-dot { position: relative; inline-size: 1.5rem; block-size: 1.5rem; margin: 0; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
  .cf2-inf-dot::before { content: ""; position: absolute; inset: 50% auto auto 50%; inline-size: .5rem; block-size: .5rem; translate: -50% -50%; border-radius: 50%; background: #7F8B96; background: color-mix(in srgb, var(--fg-3) 80%, var(--bg)); transition: scale var(--d-1) var(--ease), background-color var(--d-1) var(--ease); }   /* inactive: 3:1 or better against the page in Light and Dark */
  .cf2-inf-dot:hover::before { background: var(--fg-3); }
  .cf2-inf-dot[aria-current="true"]::before { background: var(--fill); scale: 1.3; }
  .cf2-inf-dot:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
  @media (prefers-reduced-motion: reduce) { .cf2-inf-dot::before { transition: none; } }
  /* PIN LENGTH (wave 5): pan distance x .55, so a pinned scene never runs longer than --cap screens (Full 2.5, Snapshot strip 2.25); --pan = the rail's travel */
  .cf2-inf-pin { --cap: 2.5; --pan: max(0px, calc(var(--n, 6) * (var(--cw) + var(--gap)) - 100cqw + 2 * var(--s-4))); --pinlen: min(calc(var(--pan) * .55), calc(var(--cap) * 100svh - var(--stageh))); }
  .cf2-inf-snap .cf2-inf-pin { --cap: 2.25; }
  /* knobs the pinned gate turns on (defaults = the swipe rail): the card fills the stage, larger type, the stage's own label */
  .cf2-inf-hd { display: var(--hd, none); align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4); order: -2; margin-inline: var(--hdm, 0); }
  .cf2-inf-hn { font: var(--w-strong) var(--t-sm)/1.2 var(--f); color: var(--ink); }
  /* PINNED horizontal scroll. Everything is switched by ONE class, .cf2-inf-on, chosen automatically: desktop width, a hover-capable fine pointer, motion allowed, more than 4 cards
     (the media gate below mirrors the scripts). The Snapshot strip sets it from its inline script (cf2/ext/infra.php), the Full widget from cf2-src/ext/infra.js; everything else
     (phones, touch, narrow windows, reduced motion, no JS) keeps the swipe rail above. There is no manual switch. Browsers without scroll-driven animations get --p from the same scripts. */
  @media (min-width: 56.25rem) and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
    .cf2-inf-on { --stageh: calc(100svh - var(--top-h)); --cw: clamp(15rem, 25cqw, 21rem); --ch: min(62svh, 31rem); --car: auto; --hd: flex; --hdm: var(--s-4); --nfs: var(--t-lg); --dfs: var(--t-base); --dlc: 4; }
    .cf2-inf-on .cf2-inf-pin { block-size: calc(var(--stageh) + var(--pinlen)); }
    .cf2-inf-snap.cf2-inf-on .cf2-inf-pin { margin-block: min(0px, calc((var(--ch) + 7.25rem - var(--stageh)) / 2)); }
    .cf2-inf-snap.cf2-inf-on .cf2-inf-stage { pointer-events: none; }
    .cf2-inf-snap.cf2-inf-on .cf2-inf-stage > * { pointer-events: auto; }
    .cf2-inf-on .cf2-inf-stage { position: sticky; inset-block-start: var(--top-h); block-size: var(--stageh); display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; gap: var(--s-4); }
    .cf2-inf-on .cf2-inf-scroll { overflow: clip; scroll-snap-type: none; padding-block: var(--s-2); margin-inline: 0; padding-inline: 0; }
    .cf2-inf-on .cf2-inf-rail { padding-inline: var(--s-4); }
    .cf2-inf-on .cf2-inf-prog { display: block; block-size: 4px; order: -1; margin-inline: var(--s-4); border-radius: var(--r-pill); background: var(--track); overflow: hidden; }
    .cf2-inf-on .cf2-inf-prog i { display: block; block-size: 100%; background: var(--teal); transform-origin: left; }
    @supports (animation-timeline: view()) {
      .cf2-inf-on .cf2-inf-pin { view-timeline: --cf2-inf block; view-timeline-inset: var(--top-h) 0; }
      .cf2-inf-on .cf2-inf-rail { animation-name: cf2-inf-pan; animation-duration: 1s; animation-timing-function: linear; animation-fill-mode: both; animation-timeline: --cf2-inf; animation-range: contain 0% contain 100%; }
      .cf2-inf-on .cf2-inf-prog i { animation-name: cf2-inf-bar; animation-duration: 1s; animation-timing-function: linear; animation-fill-mode: both; animation-timeline: --cf2-inf; animation-range: contain 0% contain 100%; }
    }
    @supports not (animation-timeline: view()) {
      .cf2-inf-on .cf2-inf-rail { transform: translateX(calc(var(--p, 0) * min(0px, 100cqw - 100%))); will-change: transform; }
      .cf2-inf-on .cf2-inf-prog i { transform: scaleX(var(--p, 0)); }
    }
  }
  /* (the animation longhands are spelled out on purpose: minifiers fold them into the `animation` shorthand, whose timeline slot older engines reject) */
  @keyframes cf2-inf-pan { to { transform: translateX(min(0px, calc(100cqw - 100%))); } }
  @keyframes cf2-inf-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  @media (min-width: 48rem) and (max-width: 87.99rem) {
    .cf2-inf-snap:not(.cf2-inf-on) .cf2-inf-scroll { margin-inline-end: calc(-1 * var(--gutter)); padding-inline-end: var(--gutter); }
  }
}
