/* =========================================================================
   PowerList TCG: card identification guides (/identify-<game>-cards)
   Loaded only by the identification guide pages, alongside features.css
   (which supplies .fhero and .spec-table). All colour comes from site.css
   tokens, so dark mode follows on its own. The game colour comes from the
   sell-<game> class on <main> as --game-accent.
   Wide layout since 27 Oct 2026 (Walker: the column felt condensed and made
   the page long). Text keeps a readable measure; figures, tables and the
   rarity grids use the full width.
   ========================================================================= */

.idg-page {
  --idg-accent: var(--game-accent, var(--brand)); --idg-measure: 880px;
  /* The game colour as text: on white the Yu-Gi-Oh! purple is under 4.5:1, so
     light mode uses a deeper shade of it. Dark mode uses the colour itself. */
  --idg-ink: color-mix(in srgb, var(--idg-accent) 66%, #000);
}
[data-theme="dark"] .idg-page { --idg-ink: var(--idg-accent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .idg-page { --idg-ink: var(--idg-accent); }
}

/* ── HERO BACKGROUND (light mode) ──────────────────────────────────────── */
/* Walker, 8 Nov 2026: the white hero read as unstyled in light mode. A soft
   wash from the game colour into brand blue, with a faint grid that fades out
   around the card. Dark mode keeps the plain dark ground from features.css. */
.idg-hero {
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--idg-accent) 16%, #fff) 0%,
      color-mix(in srgb, var(--brand) 9%, #fff) 52%,
      color-mix(in srgb, var(--brand-bright) 12%, #fff) 100%);
}
.idg-hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--brand) 9%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--brand) 9%, transparent) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 85% at 72% 45%, #000 15%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 70% 85% at 72% 45%, #000 15%, transparent 72%);
}
[data-theme="dark"] .idg-hero { background: var(--bg); }
[data-theme="dark"] .idg-hero::after { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .idg-hero { background: var(--bg); }
  :root:not([data-theme="light"]) .idg-hero::after { display: none; }
}

/* ── HERO ANATOMY CARD ─────────────────────────────────────────────────── */
/* A Secret Rare that tilts like it does under a lamp (identify-guide.js sets
   --rx and --ry from the pad, a drag or the arrow keys; --sx, --sy, --gx, --gy
   and --shine move the shine with it). The pins ride on the card. */
.idg-anatomy { margin: 0 auto; max-width: 540px; }
.idg-tilt { display: flex; align-items: center; justify-content: center; gap: 1.6rem; }
.idg-tilt-stage { flex: 0 1 360px; min-width: 0; perspective: 1100px; }
.idg-anatomy-card {
  position: relative; box-shadow: var(--shadow-lg);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d; transition: transform .28s ease-out;
  touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none;
}
.idg-anatomy-card.is-dragging { transition: none; cursor: grabbing; }
.idg-anatomy-card img { display: block; width: 100%; height: auto; pointer-events: none; }

/* The relight canvas (identify-guide.js) covers the still photo exactly. It
   fades in once it holds a picture; until then, and without WebGL, the CSS
   shine below does the job. */
.idg-rti {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  pointer-events: none; opacity: 0; transition: opacity .35s ease-out;
}
.idg-anatomy-card.is-rti .idg-rti,
.idg-rti-card.is-rti .idg-rti { opacity: 1; }
.idg-anatomy-card.is-rti .idg-shine,
.idg-anatomy-card.is-rti .idg-glare { display: none; }

/* Fallback shine on Exodia MC1-EN001: Secret Rare foil on the name and the art */
.idg-shine {
  position: absolute; pointer-events: none; border-radius: 2px;
  mix-blend-mode: color-dodge; opacity: var(--shine, .05);
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.0) 0 3px, rgba(255,255,255,.55) 3px 4px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.0) 0 3px, rgba(255,255,255,.45) 3px 4px),
    linear-gradient(115deg, #ff6b9a, #ffd36b, #7cff9a, #6bd5ff, #b18cff, #ff6b9a);
  background-size: 100% 100%, 100% 100%, 320% 320%;
  background-position: 0 0, 0 0, var(--sx, 50%) var(--sy, 50%);
  transition: opacity .28s ease-out, background-position .28s ease-out;
}
.idg-shine-art   { left: 16%; top: 23.5%; width: 68%; height: 45.5%; }
.idg-shine-name  { left: 14%; top: 10.5%; width: 63%; height: 4.8%; }
.idg-glare {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 25%), rgba(255,255,255,.38), rgba(255,255,255,0) 48%);
  mix-blend-mode: soft-light; opacity: var(--glare, 0);
  transition: opacity .28s ease-out;
}
.idg-anatomy-card.is-dragging .idg-shine,
.idg-anatomy-card.is-dragging .idg-glare { transition: none; }

.idg-pin {
  position: absolute; transform: translate(-50%, -50%) translateZ(14px);
  box-sizing: border-box; width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--idg-accent); color: var(--game-on, #fff);
  font-weight: 800; font-size: .82rem; line-height: 1;
  border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.idg-pin-sm { font-size: .66rem; letter-spacing: -.02em; }

/* The pad: four arrows around the 4 badge, like a controller */
.idg-pad {
  flex: 0 0 auto;
  display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(3, 44px); gap: 4px;
  grid-template-areas: ". up ." "left mid right" ". down .";
}
.idg-pad button {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
  border: 1px solid var(--border2); background: var(--bg2); color: var(--text);
  cursor: pointer; transition: border-color .15s, color .15s, transform .1s;
}
.idg-pad button:hover { border-color: var(--idg-accent); color: var(--idg-accent); }
.idg-pad button:active { transform: scale(.94); }
.idg-pad button:focus-visible { outline: 3px solid var(--idg-accent); outline-offset: 2px; }
.idg-pad svg { width: 18px; height: 18px; fill: currentColor; }
.idg-pad-up { grid-area: up; } .idg-pad-down { grid-area: down; }
.idg-pad-left { grid-area: left; } .idg-pad-right { grid-area: right; }
.idg-pad .idg-pad-mid { grid-area: mid; background: var(--idg-accent); border-color: var(--idg-accent); color: var(--game-on, #fff); font-weight: 800; font-size: .95rem; }
.idg-pad .idg-pad-mid:hover { color: var(--game-on, #fff); filter: brightness(1.1); }
.idg-tilt-hint { margin: .9rem 0 0; text-align: center; font-size: .8rem; color: var(--muted); }

.idg-legend {
  list-style: none; margin: 1rem 0 0; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: .45rem 1rem;
  font-size: .88rem; font-weight: 600; color: var(--text2);
}
.idg-legend li { display: flex; align-items: center; gap: .5rem; }
.idg-legend li > span:not(.idg-legend-pair),
.idg-legend-pair > span {
  flex: 0 0 auto; box-sizing: border-box; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--idg-accent); color: var(--game-on, #fff);
  font-size: .72rem; font-weight: 800; line-height: 1;
}
.idg-legend-pair { display: inline-flex; gap: 3px; }

@media (prefers-reduced-motion: reduce) {
  .idg-anatomy-card, .idg-shine, .idg-glare { transition: none; }
}

/* Family rows in the full rarity chart */
.idg-rarity-table tr.idg-chart-group th {
  background: color-mix(in srgb, var(--brand) 7%, var(--surface)); color: var(--brand-strong); text-align: left;
  font-size: .76rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
}
.idg-rarity-all tbody th a { text-decoration: underline; text-decoration-color: var(--border2); text-underline-offset: 3px; }
.idg-rarity-all tbody th a:hover { text-decoration-color: currentColor; }

/* ── LAYOUT: sticky contents beside one wide column ────────────────────── */
.idg-section { padding-top: 3rem; }
.idg-layout {
  max-width: 1320px; margin: 0 auto;
  display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 3.5rem;
  align-items: start;
}
.idg-toc { position: sticky; top: calc(var(--nav-h) + 1.25rem); }
.idg-toc summary {
  list-style: none; cursor: default;
  font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text2); margin-bottom: .7rem;
}
.idg-toc summary::-webkit-details-marker { display: none; }
.idg-toc a {
  display: block; padding: .36rem 0 .36rem .85rem;
  border-left: 2px solid var(--border2);
  color: var(--text2); font-size: .9rem; text-decoration: none;
  transition: color .15s, border-color .15s, background-color .15s;
}
.idg-toc a.idg-toc-sub { padding-left: 1.6rem; font-size: .84rem; color: var(--text2); }
.idg-toc a:hover,
.idg-toc a.is-active { color: var(--idg-ink); border-left-color: var(--idg-accent); }
.idg-toc a.is-active { font-weight: 600; background: color-mix(in srgb, var(--idg-accent) 10%, transparent); border-radius: 0 6px 6px 0; }

.idg-article { min-width: 0; }
.idg-article > p,
.idg-article > .idg-list,
.idg-article > .idg-note,
.idg-article > .idg-steps { max-width: var(--idg-measure); }
.idg-article h2 {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1.45rem, 2.4vw, 1.85rem); letter-spacing: -.02em;
  color: var(--text); margin: 3.4rem 0 1rem;
  scroll-margin-top: calc(var(--nav-h) + 1rem);
}
/* Each main section opens on a hairline rule with a short accent bar, so a
   reader can see a new section start (Walker, 8 Nov 2026). Not on the
   PowerList box, which has its own frame. */
.idg-article > h2 {
  position: relative; padding-top: 1.5rem; margin-top: 4rem;
  border-top: 1px solid var(--border2);
}
.idg-article > h2::before {
  content: ''; position: absolute; top: -2px; left: 0;
  width: 72px; height: 4px; border-radius: 2px; background: var(--idg-accent);
}
.idg-article h3 {
  font-weight: 700; font-size: 1.2rem; color: var(--text);
  margin: 2.4rem 0 .75rem;
  scroll-margin-top: calc(var(--nav-h) + 1rem);
}
.idg-article p { color: var(--text2); line-height: 1.75; margin: 0 0 1.1rem; font-size: 1.02rem; }
.idg-article a:not(.btn):not(.idg-map-tile):not(.idg-zoom-link) { color: var(--brand-strong); }
.idg-small { font-size: .92rem !important; color: var(--muted) !important; }
.idg-article .spec-wrap { margin: 1.25rem 0 1.6rem; border-color: var(--border2); box-shadow: 0 1px 3px rgba(15, 17, 23, .05); }
/* Tables: brand blue header band and full-strength body text, so they read
   clearly in light mode (Walker, 8 Nov 2026). The tokens flip in dark mode. */
.idg-article .spec-table thead th {
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 15%, var(--surface)), color-mix(in srgb, var(--brand) 7%, var(--surface)));
  color: var(--brand-strong);
  border-bottom: 1px solid color-mix(in srgb, var(--brand) 30%, var(--border));
}
.idg-article .spec-table td { color: var(--text2); }
.idg-article .spec-table tbody tr:hover > * { background: color-mix(in srgb, var(--brand) 3%, var(--surface)); }
.idg-article .spec-table tbody tr.idg-chart-group:hover > * { background: color-mix(in srgb, var(--brand) 7%, var(--surface)); }
.idg-mono { font-family: var(--font-mono, 'DM Mono', monospace); font-size: .92em; background: var(--bg3); padding: .1rem .4rem; border-radius: 5px; }

/* Lists */
.idg-list { margin: 0 0 1.4rem; padding-left: 1.2rem; }
.idg-list li { color: var(--text2); line-height: 1.7; margin-bottom: .7rem; }
.idg-list strong { color: var(--text); }
.idg-steps { list-style: none; counter-reset: idg; margin: 0 0 1.4rem; padding: 0; }
.idg-steps li {
  counter-increment: idg; position: relative;
  padding: .85rem 1rem .85rem 3.4rem; margin-bottom: .6rem;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text2); line-height: 1.6;
}
.idg-steps li::before {
  content: counter(idg); position: absolute; left: 1rem; top: .85rem;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--idg-accent); color: var(--game-on, #fff);
  font-weight: 800; font-size: .8rem; line-height: 26px; text-align: center;
}
.idg-steps strong { color: var(--text); }

/* The four checks as a map: each tile jumps to its section */
.idg-map { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin: 1.2rem 0 1.6rem; }
.idg-map-tile {
  display: flex; flex-direction: column; gap: .35rem;
  padding: 1rem 1.05rem 1.1rem; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg);
  text-decoration: none; color: var(--text2); font-size: .9rem; line-height: 1.5;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.idg-map-tile:hover { border-color: var(--idg-accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.idg-map-tile strong { color: var(--text); font-size: 1rem; }
.idg-map-n {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--idg-accent); color: var(--game-on, #fff);
  font-weight: 800; font-size: .82rem; line-height: 28px; text-align: center;
}

/* Note */
.idg-note {
  display: flex; gap: .9rem; align-items: flex-start;
  margin: 1.6rem 0; padding: 1rem 1.15rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--idg-accent) 8%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--idg-accent) 30%, transparent);
  color: var(--text2); line-height: 1.6;
}
.idg-note i { color: var(--idg-accent); margin-top: .25rem; }
.idg-note strong { color: var(--text); }

/* ── FIGURES ───────────────────────────────────────────────────────────── */
.idg-figure { margin: 1.4rem 0 1.8rem; }
.idg-figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--border); }
.idg-figure figcaption { margin-top: .6rem; font-size: .88rem; color: var(--muted); line-height: 1.5; }
.idg-zoom img { width: 100%; max-width: 420px; }

.idg-compare-rows { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; max-width: var(--idg-measure); }
.idg-row { display: grid; grid-template-columns: 110px minmax(0,1fr); gap: .8rem; align-items: center; margin-bottom: .7rem; }
.idg-row img { width: 100%; }
.idg-tag {
  justify-self: start; font-size: .75rem; font-weight: 700; letter-spacing: .03em;
  padding: .3rem .6rem; border-radius: 50px;
  background: var(--idg-accent); color: var(--game-on, #fff); white-space: nowrap;
}
.idg-tag-muted { background: var(--bg3); color: var(--text2); border: 1px solid var(--border2); }
.idg-holos { display: flex; gap: 1.2rem; margin: .4rem 0 0 calc(110px + .8rem); }
.idg-holos div { text-align: center; font-size: .8rem; font-weight: 600; color: var(--text2); }
.idg-holos img { width: 86px; height: auto; margin-bottom: .3rem; }

/* Printings compared: one block per printing, number crop above the bottom line */
.idg-versions { display: grid; gap: .8rem; }
.idg-versions-3 { max-width: var(--idg-measure); }
.idg-versions figcaption { grid-column: 1 / -1; }
.idg-ver { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem; min-width: 0; }
.idg-ver img { display: block; width: 100%; height: auto; border: 1px solid var(--border); }
.idg-ver img.idg-num { width: 45%; margin-bottom: .5rem; }
.idg-ver-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .6rem; margin-bottom: .7rem; font-size: .88rem; color: var(--muted); }
.idg-ver-head strong { color: var(--text); font-size: .92rem; }
.idg-num-badge {
  flex: 0 0 22px; height: 22px; border-radius: 50%; background: var(--idg-accent); color: var(--game-on, #fff);
  font-size: .75rem; font-weight: 800; line-height: 22px; text-align: center;
}
@media (min-width: 1100px) {
  .idg-versions-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── RARITIES ──────────────────────────────────────────────────────────── */
/* One card per rarity: photo, the rarity name as a heading, one line on the tell.
   Three across at most so the foil is big enough to read; two on a phone. */
/* Card photos stay square (Walker, 8 Nov 2026): this is an identification guide,
   so nothing on the card is cut off. A real card has slightly rounded die-cut
   corners, so a little of the shooting mat can show in a corner. */
.idg-rgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.2rem 1.6rem; margin: 1.5rem 0 2.6rem; }
.idg-rcard { min-width: 0; scroll-margin-top: calc(var(--nav-h) + 1rem); }
.idg-rcard img { display: block; width: 100%; height: auto; box-shadow: var(--shadow-md); }
.idg-rcard h4 { margin: .85rem 0 .3rem; font-size: 1.08rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.idg-rcard p { margin: 0; font-size: .93rem; line-height: 1.55; color: var(--text2); }
/* The note only means something once the card is live; its space is kept so nothing jumps */
.idg-rcard .idg-rti-note { visibility: hidden; }
.idg-rti-card.is-rti ~ .idg-rti-note { visibility: visible; }

/* A relightable card in a grid (identify-guide.js): the canvas covers the still */
.idg-rti-card { position: relative; touch-action: pan-y; }

/* Flat and foil-light pair: the lit shot sits on top of the flat one and fades in
   (identify-guide.js adds is-lit on hover or the button) */
.idg-duo .idg-zoom-link { position: relative; }
.idg-duo img.idg-lit { position: absolute; inset: 0; height: 100%; opacity: 0; transition: opacity .35s ease; }
.idg-duo.is-lit img.idg-lit { opacity: 1; }
.idg-duo-btn {
  display: inline-flex; align-items: center; gap: .35rem; margin-top: .6rem; padding: .3rem .65rem;
  font: inherit; font-size: .74rem; font-weight: 600; line-height: 1.2; color: var(--text2);
  background: var(--bg); border: 1px solid var(--border2); border-radius: 999px; cursor: pointer;
}
.idg-duo-btn[hidden] { display: none; }
.idg-duo-btn:hover { border-color: var(--idg-accent); color: var(--text); }
.idg-duo-btn[aria-pressed="true"] { background: var(--idg-accent); border-color: var(--idg-accent); color: var(--game-on, #fff); }
.idg-duo-btn:focus-visible { outline: 3px solid var(--idg-accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .idg-duo img.idg-lit { transition: none; } }
/* Front, back and torn views (Spotting Fakes): the first shot holds the space, the
   others sit on top of it and fade in when their button is pressed */
.idg-views .idg-zoom-link { position: relative; display: block; }
.idg-views img.idg-view { opacity: 0; transition: opacity .3s ease; }
.idg-views img.idg-view:first-child { opacity: 1; }
.idg-views img.idg-view:not(:first-child) { position: absolute; inset: 0; height: 100%; }
.idg-views img.idg-view.is-on { opacity: 1; }
.idg-views-btns { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.idg-views-btns[hidden] { display: none; }
.idg-views-btns .idg-duo-btn { margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .idg-views img.idg-view { transition: none; } }

/* One whole card as a figure */
.idg-figure-card img { width: 100%; max-width: 240px; border: 0; box-shadow: var(--shadow-md); }

/* Tap to enlarge */
.idg-zoom-link { display: block; cursor: zoom-in; }
.idg-zoom-link:focus-visible { outline: 3px solid var(--idg-accent); outline-offset: 3px; }

/* Empty photo slots (draft only, until the photo is shot) */
.idg-slot {
  aspect-ratio: 420 / 604;
  border: 2px dashed var(--border2); background: var(--bg2);
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: .78rem; font-weight: 600; color: var(--muted);
}
.idg-slot-wide { aspect-ratio: 6 / 1; }
.idg-slot-art { aspect-ratio: 3 / 2; }

/* Close-ups: names on top, art underneath, one card in three foils */
.idg-closeups { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.idg-closeup-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
/* Two close-ups side by side: a genuine and a fake (Spotting Fakes) */
.idg-closeup-grid.idg-closeup-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.idg-closeup { min-width: 0; }
.idg-closeup img { width: 100%; }
.idg-closeup span { display: block; margin-top: .4rem; font-size: .8rem; font-weight: 600; color: var(--text2); text-align: center; }

/* Rarity Collection lineup: seven rarities in one row */
.idg-lineup-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .6rem; }
.idg-lineup-row > div { min-width: 0; }
.idg-lineup-row img { width: 100%; }
.idg-lineup-row span { display: block; margin-top: .4rem; font-size: .76rem; font-weight: 600; color: var(--text2); text-align: center; line-height: 1.3; }

/* Mix-ups */
.idg-mixups { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .8rem; margin: 1.2rem 0 1.6rem; }
.idg-mixups div {
  background: var(--bg2); border: 1px solid var(--border); border-left: 3px solid var(--idg-accent);
  border-radius: var(--radius-sm); padding: .85rem 1rem;
  font-size: .93rem; color: var(--text2); line-height: 1.55;
}
.idg-mixups strong { display: block; color: var(--text); margin-bottom: .25rem; }

/* PowerList block */
.idg-pl {
  margin-top: 3.4rem; padding: 1.6rem 1.7rem; max-width: var(--idg-measure);
  border-radius: var(--radius); border: 1px solid var(--border);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 7%, var(--bg)), var(--bg2));
}
.idg-pl h2 { margin-top: 0 !important; }
.idg-pl-links { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: .4rem; }

/* ── LIGHTBOX (identify-guide.js) ──────────────────────────────────────── */
.idg-lightbox {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: .8rem;
  padding: 1.5rem; background: rgba(8, 10, 16, .88); cursor: zoom-out;
}
.idg-lightbox[hidden] { display: none; }
.idg-lightbox img { max-width: min(92vw, 560px); max-height: 82vh; width: auto; height: auto; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.idg-lightbox p { margin: 0; max-width: 560px; color: #e5e7eb; font-size: .9rem; text-align: center; line-height: 1.45; }
.idg-lightbox button {
  position: absolute; top: 1rem; right: 1rem;
  width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.14); color: #fff; font-size: 1.3rem; cursor: pointer;
}

/* ── RESPONSIVE ────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .idg-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .idg-layout { grid-template-columns: 1fr; gap: 1.5rem; }
  .idg-toc { position: static; }
  .idg-toc details { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem 1rem; }
  .idg-toc summary { cursor: pointer; margin: 0; }
  .idg-toc summary::after { content: " +"; }
  .idg-toc details[open] summary::after { content: " \2212"; }
  .idg-toc details[open] summary { margin-bottom: .6rem; }
  .idg-lineup-row { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 1rem; }
}
@media (max-width: 680px) {
  .idg-map { grid-template-columns: 1fr; }
  .idg-tilt { flex-direction: column; gap: 1rem; }
  .idg-tilt-stage { flex: 0 1 auto; width: min(100%, 320px); }
  .idg-pin { width: 24px; height: 24px; font-size: .74rem; }
  .idg-pin-sm { font-size: .6rem; }
  .idg-rgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.6rem .9rem; }
  .idg-rcard h4 { font-size: .98rem; }
  .idg-rcard p { font-size: .86rem; }
  .idg-closeup-grid { gap: .5rem; }
  .idg-closeup span { font-size: .72rem; }
  .idg-closeups { padding: .7rem; }
  .idg-lineup-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .idg-ver img.idg-num { width: 70%; }
  .idg-row { grid-template-columns: 1fr; gap: .4rem; }
  .idg-holos { margin-left: 0; }
  .idg-pl { padding: 1.2rem; }

  /* Short reference tables wrap instead of scrolling sideways */
  .idg-article .spec-table { min-width: 0; }
  .idg-article .spec-table tbody th[scope="row"] { white-space: normal; }
  .idg-article .spec-table td.spec-eg { white-space: normal; }

  /* The rarity charts stack: one block per rarity, the tell first; family rows stay headings */
  .idg-rarity-table tbody tr.idg-chart-group { padding: .55rem .9rem; }
  .idg-chart-wrap { overflow: visible; }
  .idg-rarity-table { min-width: 0; }
  .idg-rarity-table thead { display: none; }
  .idg-rarity-table tbody tr { display: grid; grid-template-columns: 1fr; padding: .75rem .9rem; border-bottom: 1px solid var(--border); }
  .idg-rarity-table tbody tr:last-child { border-bottom: 0; }
  .idg-rarity-table tbody th, .idg-rarity-table tbody td { display: block; padding: .12rem 0; border: 0; }
  .idg-rarity-table tbody th { order: -2; font-size: 1rem; margin-bottom: .15rem; }
  .idg-rarity-table tbody td::before { content: attr(data-label) ": "; font-weight: 600; color: var(--text2); }
  .idg-rarity-table tbody td:last-child { order: -1; color: var(--text); margin-bottom: .2rem; }
  .idg-rarity-table tbody td:last-child::before { content: ""; }
}

/* 2020 Reprint and 25th Anniversary Edition set lists, side by side */
.idg-setlists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.4rem; max-width: var(--idg-measure); margin: 1.2rem 0 1.8rem; }
.idg-setlists > div { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem 1rem; }
.idg-setlists > div > h3 { margin: 0 0 .7rem; font-size: 1rem; font-weight: 700; color: var(--text); }
.idg-setlists ol { margin: 0; padding-left: 1.4rem; color: var(--text2); font-size: .97rem; line-height: 1.55; }
.idg-setlists li { padding: .18rem 0; }
.idg-setlists li::marker { color: var(--idg-accent); font-weight: 700; }
@media (max-width: 640px) { .idg-setlists { grid-template-columns: 1fr; } }

/* App screenshot inside the PowerList box */
.idg-appshot { margin: 1.4rem 0 1.5rem; }
.idg-appshot img { width: 100%; height: auto; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md); }
/* .idg-figure img sets display:block, which would show both shots, so the
   site's light/dark swap (site.css, app-shot) is repeated here at higher weight. */
.idg-appshot img.app-shot-dark { display: none; }
[data-theme="dark"] .idg-appshot img.app-shot-light { display: none; }
[data-theme="dark"] .idg-appshot img.app-shot-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .idg-appshot img.app-shot-light { display: none; }
  :root:not([data-theme="light"]) .idg-appshot img.app-shot-dark { display: block; }
}

/* FAQ: heading beside one ruled list, the tool pages' layout */
.idg-faq { display: grid; gap: 1.5rem 4rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) {
  .idg-faq { grid-template-columns: minmax(0, .8fr) minmax(0, 1.6fr); }
  .idg-faq-head { position: sticky; top: calc(var(--nav-h) + 1.5rem); align-self: start; }
}
.idg-faq-head h2 { margin: 0 0 .8rem; font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1.45rem, 2.4vw, 1.95rem); letter-spacing: -.015em; line-height: 1.15; color: var(--text); }
.idg-faq-head p { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.6; }
.idg-faq-list { border-top: 1px solid var(--border2); }
.idg-q { border-bottom: 1px solid var(--border); }
.idg-q summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 1.5rem;
  padding: 1.05rem 0; font-weight: 700; font-size: 1.04rem; color: var(--text); }
.idg-q summary::-webkit-details-marker { display: none; }
.idg-q summary::after { content: ''; flex: none; width: .55rem; height: .55rem; margin-top: .35rem;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; }
.idg-q[open] summary::after { transform: rotate(-135deg); margin-top: .6rem; }
.idg-q summary:focus-visible { outline: 3px solid var(--idg-accent); outline-offset: 2px; }
.idg-q p { margin: 0 0 1.15rem; max-width: 72ch; color: var(--text2); font-size: 1rem; line-height: 1.7; }
@media (prefers-reduced-motion: reduce) { .idg-q summary::after { transition: none; } }

/* Rarity family headings under Other Yu-Gi-Oh! Rarities: a small accent tick so
   each family's table and photos read as one group */
.idg-article > h4.idg-family {
  margin: 2.6rem 0 .5rem; padding-left: .75rem; border-left: 3px solid var(--idg-accent);
  font-size: 1.08rem; font-weight: 700; color: var(--text); line-height: 1.3;
  scroll-margin-top: calc(var(--nav-h) + 1rem);
}
.idg-article > h4.idg-family + p { margin-bottom: .4rem; }

/* A rarity with no photo yet, while show_photo_slots is False: heading and tell only */
.idg-rcard-text { align-self: start; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg2); }
.idg-rcard-text h4 { margin-top: 0; }
