/* ============================================================
   ALINA SZAPOCZNIKOW — Expositions index : Liste + Galerie
   Loaded on expositions.html only (like home.css on index.html). Replaced the
   old Grille/Liste split (the .exh-toolbar / .exh-grid / .exh-card path in
   wireframe.css, still used by actualites.html). Origin: the prototype in
   _prototypes/expositions-index/, itself built from the reference in
   _references/expositions index prototype/. Engine: expo-index.js.

   LISTE   = archivio-uno row rollover   (grid-template-rows 0fr → 1fr, pure CSS)
   GALERIE = centrephotogeneve card, sticky-stacked by default, image entière
   FICHE   = bespoke side panel (header · title · dates over image | fields+desc),
             overlapping the index at 85% (NOT the shared fiche.js — it stacks the
             image as a full-width hero, unreadable at this width).

   The toolbar sticks UNDER the site topbar (var(--topbar-h) from tweaks-apply.js);
   the sticky-stack cards clear topbar + toolbar.

   ⚠ CLASS NAMESPACING — do not remove. wireframe.css already owns
   .reveal .row .yr .hide .on .note .meta; `.reveal{opacity:0}` is only
   lifted by the reveal-on-scroll observer, so anything reusing that name
   lays out and paints nothing. Everything here is prefixed x*.
   ============================================================ */

.xsheet { padding: 0 var(--xedge, 10px); --xedge: 10px; }

/* ONE image scale for every list reveal. Sizing method (shared by all four lists):
   fix the HEIGHT, let width:auto + object-fit:contain keep the true aspect ratio —
   the archive mixes portrait sculpture shots with landscape installation views, so a
   common height gives a tidy baseline without ever cropping. Source is M_ (815px) in
   every case, so 240px is well within resolution. Change the scale here, once. */
:root { --xthumb: 240px; }

.xhead { padding: clamp(18px, 3.5vh, 40px) 0 4px; }
.xhead h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 3rem); text-transform: uppercase; letter-spacing: .01em; }
.xhead p  { margin: 6px 0 0; font-family: var(--ui); font-size: var(--fs-meta); color: var(--ph-ink); }

/* ---- toolbar : sticks under the real topbar ---------------- */
/* the settings bar sits at the BOTTOM of the viewport (the top nav stays purely for
   navigation); content clears it via body[data-view] .xsheet padding-bottom below. */
.xtools {
  position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 30;
  display: flex; flex-wrap: wrap; gap: 8px 30px; align-items: baseline; justify-content: center;
  padding: 11px var(--xedge, 10px) 12px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px);
  border-top: 1px solid var(--rule);
  font-family: var(--ui); font-size: var(--fs-meta);
  text-transform: uppercase; letter-spacing: .06em;
}
body[data-view] .xsheet { padding-bottom: calc(var(--tb, 48px) + 22px); }   /* clear the fixed bottom bar */
.xtools .xgrp { display: flex; gap: 16px; align-items: baseline; }
.xtools .xlbl { color: var(--ph-ink); }
/* simple underlined settings, no box (matches the site's original toolbar style) */
.xtools button { font: inherit; background: none; border: 0; border-bottom: 1px solid transparent;
  padding: 0 0 3px; cursor: pointer; color: var(--mut); white-space: nowrap;
  text-transform: uppercase; letter-spacing: .06em; }
.xtools button:hover { color: var(--ink); }
.xtools button.is-on { border-bottom-color: var(--ink); color: var(--ink); font-weight: 600; }
.xtools .gal-only { display: none; }
body[data-view="gallery"] .xtools .gal-only { display: flex; }

/* ============================================================
   LISTE — archivio-uno mechanism, pure CSS
   ============================================================ */
.xlist { display: flex; flex-direction: column; }
.xitem { border-bottom: 1px solid var(--rule); }
.xitem:first-child { border-top: 1px solid var(--rule); }
.xitem.xhide { display: none; }

.xrow {
  display: grid;
  grid-template-columns: 4.4rem minmax(0, 2fr) minmax(0, 1.3fr) minmax(0, .9fr) 10.5rem 1rem;
  column-gap: 20px; align-items: baseline;
  /* no horizontal inset: row text sits on the same 10px axis as the brand + section bars */
  padding: 7px 0; text-decoration: none; color: var(--ink);
  transition: background-color 160ms ease, opacity 160ms ease;
}
.xitem:hover > .xrow, .xitem:focus-within > .xrow { background: var(--wash); opacity: .55; }
/* HOVER INTENT (see the .xrev note below) — the row state waits for the same rest delay,
   so a sweep across the list doesn't strobe a trail of highlights behind the pointer. */
.xitem:hover > .xrow { transition-delay: var(--xhover-intent, 160ms); }
.xitem:focus-within > .xrow { transition-delay: 0s; }
.xrow .xyr    { font-family: var(--ui); font-size: var(--fs-meta); color: var(--mut); }
.xrow .xttl   { font-family: var(--body); font-size: var(--fs-body); }
.xrow .xlieu,
.xrow .xville,
.xrow .xtype  { font-family: var(--ui); font-size: var(--fs-meta); color: var(--mut);
  text-transform: uppercase; letter-spacing: .04em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xrow .xtype  { text-align: right; }
.xrow .xtick  { font-family: var(--ui); font-size: .6rem; color: var(--ph-ink); text-align: right; }

/* THE MECHANISM: auto height animated as a grid track */
.xrev {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 320ms cubic-bezier(.4, 0, .2, 1);
}
.xitem:hover > .xrev, .xitem:focus-within > .xrev { grid-template-rows: 1fr; }
/* HOVER INTENT — the reveal is ~390px against a 40px row (≈10× push), so on a plain
   :hover every row the pointer crosses shoved the ~37 rows below it down, and the row
   you were aiming at ran away mid-motion: that cascade is what felt "nervous" (Seba).
   Same family as the strip bug — geometry moving under a live driver. Fix: only open
   once the pointer RESTS on a row. The delay sits on the :hover rule ONLY, so a
   pass-through never starts the animation at all, while CLOSING stays instant and
   keyboard :focus-within opens immediately (rule below wins on equal specificity). */
.xitem:hover > .xrev { transition-delay: var(--xhover-intent, 160ms); }
.xitem:focus-within > .xrev { transition-delay: 0s; }
.xrev > .xinner { overflow: hidden; }

/* the reveal is the full record, not a thumbnail */
.xpanel { display: grid; grid-template-columns: auto minmax(0, 46ch) minmax(0, 1fr);
  gap: 26px; align-items: start; padding: 12px 4px 20px; }
.xpanel figure { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.xpanel img { height: var(--xthumb, 240px); width: auto; object-fit: contain;
  background: var(--ph); display: block; }
.xpanel img.xbroken { width: calc(var(--xthumb, 240px) * .74);
  background: repeating-linear-gradient(45deg, var(--ph), var(--ph) 5px, var(--ph-line) 5px, var(--ph-line) 6px); }
.xpanel figcaption { font-family: var(--ui); font-size: .6rem; color: var(--mut); }
.xitem[data-img="0"] .xpanel { grid-template-columns: minmax(0, 46ch) minmax(0, 1fr); }

/* left column: the record's fields as a definition list */
.xfields { font-family: var(--ui); font-size: var(--fs-meta); color: var(--mut);
  display: grid; grid-template-columns: 7.2rem minmax(0, 1fr); gap: 2px 12px; margin: 0; }
.xfields dt { color: var(--ph-ink); text-transform: uppercase; letter-spacing: .05em; }
.xfields dd { margin: 0; color: var(--ink); }
.xfields .xrec-title { grid-column: 1 / -1; font-family: var(--body);
  font-size: var(--fs-body); color: var(--ink); margin-bottom: 8px; }

/* right column: the description, as the CMS wrote it (sanitised) */
.xdesc { font-family: var(--body); font-size: var(--fs-body); color: var(--ink);
  line-height: 1.55; max-width: 70ch; }
.xdesc p { margin: 0 0 .7em; }
.xdesc p:last-child { margin-bottom: 0; }
.xdesc a { color: var(--accent); }
.xdesc .xnodesc { font-family: var(--ui); font-size: var(--fs-meta); color: var(--ph-ink); }

/* the record opens the fiche; a hairline hint sits under the reveal */
.xmore { display: inline-block; font-family: var(--ui); font-size: .6rem; letter-spacing: .05em;
  text-transform: uppercase; color: var(--accent); margin: 10px 0 0; }

/* ============================================================
   GALERIE — centrephotogeneve model
   ============================================================ */
.xgal { display: grid; grid-template-columns: repeat(var(--cols, 2), 1fr); gap: var(--xedge, 10px); }

/* GALERIE card — image framed on top, record BELOW it (Seba, 2026-07-29). The old design
   floated the title OVER the image; on Alina's grey studio seamless that half-dissolved the
   text (the legibility problem the scrim/difference tricks were fighting). With the caption
   under the picture there is no overlap to fight, so the scrim + data-leg/fit/pos variants are
   gone. Images always `contain` (63% of the archive is portrait — never crop). */
.xcard { position: relative; display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg); text-decoration: none; isolation: isolate; }
.xcard.xhide { display: none; }
.xcard img { display: block; width: 100%; object-fit: contain; background: var(--ph);
  transition: transform 600ms cubic-bezier(.22,.61,.36,1); }
.xcard:hover img { transform: scale(1.01); }

.xcard .xover {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start;
  padding: 10px 12px 6px; color: var(--ink);
}
.xcard .xkick  { font-family: var(--ui); font-size: var(--fs-meta); color: var(--mut);
  text-transform: uppercase; letter-spacing: .05em; margin: 0; }
.xcard .xgttl  { font-family: var(--display); font-weight: 400; line-height: 1.05;
  font-size: clamp(1.15rem, 1.7vw, 1.9rem); margin: 4px 0 0; text-wrap: balance; }
.xcard .xvenue { font-family: var(--ui); font-size: var(--fs-meta); color: var(--mut);
  text-transform: uppercase; letter-spacing: .04em; margin: 8px 0 0; }

/* GRID (2 & 3 columns): a tidy 4/3 frame keeps rows aligned. `cover` fills the frame with
   no letterbox (Seba, "for now") — tall portrait works are cropped top/bottom. */
.xgal:not(.xstack) .xcard img { aspect-ratio: 4 / 3; height: auto; object-fit: cover; }

/* cadence 1 = the sticky stack. Cards pin under the topbar and slide over the last by DOM
   order (no z-index). The image is `contain` on WHITE; a white dwell zone (padding-bottom)
   sits under the caption so the incoming pile card crosses empty white before it reaches the
   caption — otherwise the next card sat flush against the caption and hid it the instant you
   scrolled (Seba). */
.xgal.xstack { display: block; }
.xgal.xstack .xcard {
  position: sticky; top: var(--topbar-h, 52px);
  height: calc(100dvh - var(--topbar-h, 52px) - var(--tb, 44px));
  background: #fff; padding-bottom: 6vh;   /* small dwell — enough to protect the caption, not a big empty band */
}
.xgal.xstack .xcard img { flex: 1 1 auto; min-height: 0; height: auto; background: #fff; }
.xgal.xstack .xcard .xgttl { font-size: clamp(1.6rem, 3vw, 2.8rem); }

/* ---- view switch ------------------------------------------- */
body[data-view="gallery"] .xlist { display: none; }
body[data-view="list"]    .xgal  { display: none; }

.xwithheld { font-family: var(--ui); font-size: var(--fs-meta); color: var(--ph-ink);
  padding: 16px 4px; margin: 0; }

/* ============================================================
   FICHE — bespoke panel (ported from the reference), overlapping the index at 85%.
   NOT fiche.js: fiche.js stacks the image as a full-width hero on top, which is
   unreadable at this width (Seba's note on the screenshot). This lays the record
   out as a header (kicker · title · dates) over a two-column body (image | fields
   + description). Fixed overlay; the index underneath never moves, so the exposed
   left strip stays live (année + titre). Below 900px it goes near-full-width and
   the body stacks. On adoption this is what moves into the site (its own panel for
   the Expositions record — expositions carry no relations, so no pivot/trail here).
   ============================================================ */
.xfiche {
  position: fixed; top: 0; right: 0; z-index: 80;
  width: 85vw; height: 100vh; height: 100dvh;
  background: var(--bg); border-left: 1px solid var(--rule);
  box-shadow: -22px 0 70px rgba(26,26,26,0.20);
  overflow-y: auto; overflow-x: hidden;
  transform: translateX(100%);
  transition: transform .5s cubic-bezier(.77, 0, .175, 1);
}
body.xopen .xfiche { transform: none; }
.xfiche-inner { padding: 14px clamp(16px,3vw,40px) 20vh; min-height: 100%; }

/* just a cross — no "Fermer" label, no box (Seba). Sized as a comfortable tap target;
   the accessible name lives on aria-label since the glyph alone carries no meaning. */
.xfiche-close {
  position: sticky; top: 0; float: right; z-index: 5;
  font: inherit; font-family: var(--ui); font-size: 1.6rem; line-height: 1;
  background: none; border: 0; padding: 4px 2px 8px 14px;
  cursor: pointer; color: var(--mut); transition: color .18s ease;
}
.xfiche-close:hover, .xfiche-close:focus-visible { color: var(--ink); }

.xfiche-kick { font-family: var(--ui); font-size: var(--fs-meta); color: var(--mut);
  text-transform: uppercase; letter-spacing: .05em; margin: 0 0 8px; }
.xfiche-title { font-family: var(--display); font-weight: 400; line-height: 1.03;
  font-size: clamp(2rem, 5vw, 4.6rem); margin: 0; max-width: 22ch; text-wrap: balance; }
.xfiche-dates { font-family: var(--display); font-weight: 400; line-height: 1.05;
  font-size: clamp(1.4rem, 3.2vw, 3rem); margin: 18px 0 0; color: var(--ink); }

.xfiche-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 40px; margin-top: 34px; align-items: start; }
.xfiche-fig { margin: 0; }
.xfiche-fig img { width: 100%; height: auto; display: block; background: var(--ph); }
.xfiche-fig figcaption { font-family: var(--ui); font-size: .62rem; color: var(--mut); margin-top: 6px; }
.xfiche-side .xfields { grid-template-columns: 7.6rem minmax(0, 1fr); margin-bottom: 26px; }
.xfiche-side .xdesc { max-width: 62ch; }

@media (max-width: 900px) {
  /* the TYPE group is wider than a phone: let each control group wrap so no
     button (e.g. Foires) clips off-screen and becomes unreachable */
  .xtools .xgrp { flex-wrap: wrap; }
  .xfiche { width: 94vw; }                 /* near-full-screen; a sliver keeps the close affordance */
  .xfiche-body { grid-template-columns: 1fr; gap: 24px; }
  .xfiche-title { font-size: clamp(1.7rem, 8vw, 2.6rem); }
  .xfiche-dates { font-size: clamp(1.2rem, 5vw, 1.8rem); }
  /* Phone: year + TITLE ONLY. The venue column used to take half the width, squeezing
     "Broken: The Power of the Fragment in Sculpture" into four wrapped lines and truncating
     the venue anyway ("NATIONAL GALL…"). Everything else is one tap away in the fiche. */
  .xrow { grid-template-columns: 3.6rem minmax(0, 1fr); }
  .xrow .xlieu, .xrow .xville, .xrow .xtype, .xrow .xtick { display: none; }
  .xrev { display: none; }              /* no hover on touch: tap opens the fiche */
  .xgal { grid-template-columns: 1fr !important; }
  .xgal.xstack .xcard { height: 90dvh; }   /* next card peeks in, as CPG does */
  .xpanel { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .xrev { transition-duration: 1ms; }
  .xcard:hover img { transform: none; }
}
