/* The art gallery (2026-10-07). The companion's own palette (app.css), a
   dark reading of it, and a full-screen view over the wall. */
:root {
  --bg: #f7f5f0; --card: #fffdf8; --ink: #241f1b; --ink-soft: #4a4136; --muted: #7d7263;
  --rule: #ddd6c9; --chip: #efeae0; --accent: #7a1f1f; --accent-ink: #fff;
  --scrim: rgba(24, 20, 17, .97);
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16120f; --card: #211b17; --ink: #ece4d6; --ink-soft: #cfc4b2; --muted: #a3978a;
    --rule: #3a3029; --chip: #2c241f; --accent: #d9705f; --accent-ink: #16120f;
    --scrim: rgba(8, 6, 5, .97);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
/* The full view locks the wall (overflow: hidden on body); a kept gutter stops
   the wall reflowing sideways behind the scrim when the scrollbar goes. */
html { scrollbar-gutter: stable; }
/* The gutter is painted with the root's background, which the fixed scrim
   cannot cover; while the view is open the root takes the scrim colour. */
html:has(#lightbox:not([hidden])) { background: var(--scrim); }
body { margin: 0; padding: 0 16px 48px; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }

#head { max-width: 1100px; margin: 28px auto 8px; display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px 24px; }
#head h1 { font: 600 clamp(1.7rem, 4.5vw, 2.6rem)/1.1 var(--serif); margin: 0; text-wrap: balance; }
#head p { margin: 6px 0 0; color: var(--ink-soft); max-width: 60ch; }
#head nav { display: flex; gap: 8px; flex-wrap: wrap; }
#head nav a { font-size: 13px; padding: 7px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--card); color: var(--ink); text-decoration: none; }
#head nav a:hover, #head nav a:focus-visible { border-color: var(--accent); color: var(--accent); }

#bar { position: sticky; top: 0; z-index: 5; max-width: 1100px; margin: 18px auto 8px; display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 0; background: var(--bg); border-bottom: 1px solid var(--rule); }
#bar a { font-size: 13px; padding: 5px 10px; border-radius: 999px; background: var(--chip); color: var(--ink); text-decoration: none; font-variant-numeric: tabular-nums; }
#bar a span { color: var(--muted); margin-left: 4px; }
#bar a:hover, #bar a:focus-visible { background: var(--accent); color: var(--accent-ink); }
#bar a:hover span, #bar a:focus-visible span { color: inherit; }

.line { max-width: 1100px; margin: 26px auto 0; scroll-margin-top: 64px; }
.line-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 14px; }
.line-head h2 { font: 600 1.45rem/1.2 var(--serif); margin: 0; }
.line-head .count { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-variant-numeric: tabular-nums; }
.line-head p { flex-basis: 100%; margin: 0; color: var(--ink-soft); font-size: 15px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 168px), 1fr)); gap: 18px 16px; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; } }
/* The Bargain deck's faces: four even columns, two rows of four, at about
   the wall's tile width; two on a phone, as the wall. Its phone rule comes
   after the four, which outranks .grid's. A frame the card's shape (7:12),
   rounded like the card, its hairline standing it off the dark page. */
.grid.faces { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 760px; }
@media (max-width: 520px) { .grid.faces { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.face .frame { aspect-ratio: 7 / 12; border-radius: 6px; background: #0a0a0a; }
figure { margin: 0; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.frame { display: block; width: 100%; max-width: 100%; aspect-ratio: 2 / 3; padding: 0; border: 1px solid var(--rule); border-radius: 3px; overflow: hidden; background: var(--chip); cursor: zoom-in; }
.frame img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.frame:hover img { transform: scale(1.03); }
.frame:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
figcaption { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.name { font: 600 15px/1.25 var(--serif); }
.links { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; }
.links a { color: var(--accent); text-decoration: none; border-bottom: 1px solid currentColor; }
.links a:hover, .links a:focus-visible { border-bottom-width: 2px; }
.links a.shop { color: var(--muted); }

/* The full view is always dark, whatever the page's theme: a picture reads
   best on a dark ground. */
#lightbox { position: fixed; inset: 0; z-index: 20; background: var(--scrim); color: #ece4d6; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 24px; padding: 20px; align-items: center; }
#lightbox[hidden] { display: none; }
/* width/height auto: the attributes gallery.js sets reserve the aspect, and
   without these they became fixed CSS sizes the two max- caps clamped one
   axis at a time, squashing every plate. */
#lb-img { width: auto; height: auto; max-width: 100%; max-height: calc(100vh - 40px); margin: auto; display: block; border-radius: 2px; box-shadow: 0 18px 60px rgba(0, 0, 0, .5); }
/* Hidden from a step until the new picture has loaded (gallery.js). */
#lb-img.loading { visibility: hidden; }
/* A foe's card words can outrun the screen: the panel scrolls on its own,
   right of a picture that stays put. The right padding keeps the text clear
   of the close button's column. */
#lightbox aside { display: flex; flex-direction: column; gap: 12px; min-width: 0; max-height: calc(100vh - 40px); overflow-y: auto; padding: 36px 8px 4px 0; }
#lb-kind { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #b9ab98; }
#lb-title { font: 600 1.6rem/1.15 var(--serif); margin: 0; }
#lb-alt { margin: 0; color: #d8cdbd; font-size: 15px; white-space: pre-line; }
/* The foe's card words, laid out like the reader's card: a small caps label
   over each field. */
#lb-entry { display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.45; color: #d8cdbd; }
#lb-entry .meta { font-size: 13px; color: #b9ab98; margin-top: -6px; }
#lb-entry .label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #b9ab98; margin-bottom: 1px; }
#lb-acts { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
#lb-acts a, #lb-nav button { font: 14px/1 system-ui, sans-serif; padding: 11px 14px; border-radius: 6px; text-align: left; text-decoration: none; cursor: pointer; }
#lb-acts a.primary { background: #d9705f; color: #16120f; border: 0; }
#lb-acts a.secondary, #lb-nav button { background: transparent; color: #ece4d6; border: 1px solid #5a4d43; }
#lb-nav { display: flex; gap: 8px; }
#lb-nav button { flex: 1; text-align: center; }
#lb-close { position: absolute; top: 12px; right: 14px; font: 22px/1 system-ui, sans-serif; background: transparent; color: #ece4d6; border: 0; cursor: pointer; padding: 8px; }
#lightbox button:focus-visible, #lightbox a:focus-visible { outline: 2px solid #d9705f; outline-offset: 2px; }
@media (max-width: 760px) {
  /* Stacked: both rows size to their content and the view scrolls, so a
     tall caption pushes below the picture instead of under it. */
  #lightbox { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; align-content: start; gap: 14px; align-items: start; overflow-y: auto; }
  #lb-img { max-height: 62vh; }
  #lightbox aside { max-height: none; overflow: visible; padding: 0; }
}
@media (prefers-reduced-motion: reduce) { .frame img { transition: none; } }
