/* ============================================================
   INKBLAKE — compat.css  (Layout Compatibility Program, T3)
   One compatibility layer for phone height/width bands.

   `compat-tokens.js` puts these classes on <html>:
     .is-compact  height <= 360
     .is-tiny     height <= 420
     .is-short    height <= 480
     .is-narrow   width  <= 700
     .is-mid      width  <= 820
     .is-wide     width  >= 900
     .is-phone    short + <= 960 wide

   New screens should consume the variables/classes below rather than
   adding `@media (max-height: …)` / `@media (max-width: …)`. Existing
   legacy queries are grandfathered by scripts/check-compat-queries.js.
   This file is additive: it does not redesign any current screen.
   ============================================================ */
:root {
  /* v11.0.1-compat FIX-3: --vmin is the PLAYFIELD's min dimension / 100,
     not the raw viewport's. IB.Compat.update() writes --play-w/--play-h on
     <html>; before that JS runs (or in a standalone fixture that loads only
     this file) the 100vw/100vh fallbacks make it exactly the old raw vmin.
     style.css re-declares the same value for the game document; this copy
     keeps every --compat-* token resolvable when compat.css is consumed
     alone (tests/fixtures/compat-fixture.html). */
  --vmin: calc(min(var(--play-w, 100vw), var(--play-h, 100vh)) / 100);
  --compat-pad: var(--pad);
  --compat-gap: var(--gap);
  --compat-tap: var(--tap);
  --compat-gutter: clamp(8px, calc(2.2 * var(--vmin)), 18px);
  --compat-row-gap: 8px;
  --compat-card-min: 92px;
}

html.is-compact {
  --compat-pad: clamp(5px, calc(1.6 * var(--vmin)), 9px);
  --compat-gap: clamp(4px, calc(1.2 * var(--vmin)), 7px);
  --compat-tap: clamp(30px, calc(8.4 * var(--vmin)), 40px);
  --compat-gutter: 6px;
  --compat-row-gap: 5px;
  --compat-card-min: 74px;
}

html.is-tiny {
  --compat-pad: clamp(5px, calc(1.5 * var(--vmin)), 8px);
  --compat-gap: clamp(3px, calc(1.1 * var(--vmin)), 6px);
  --compat-tap: clamp(29px, calc(8 * var(--vmin)), 38px);
  --compat-card-min: 70px;
}

html.is-short {
  --compat-row-gap: 6px;
}

html.is-narrow {
  --compat-gutter: 6px;
  --compat-card-min: 80px;
}

html.is-regular {
  --compat-gutter: clamp(8px, calc(2.2 * var(--vmin)), 14px);
  --compat-card-min: 92px;
}

html.is-wide {
  --compat-gutter: clamp(10px, calc(2.6 * var(--vmin)), 22px);
  --compat-card-min: 108px;
}

/* Reusable primitives for new/fixture screens. */
.compat-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--compat-row-gap);
  min-width: 0;
}
.compat-row > * { min-width: 0; }
.compat-wrap {
  min-width: 0;
  overflow-wrap: anywhere;
}
.compat-gutter { padding: var(--compat-gutter); }
.compat-card {
  min-height: var(--compat-card-min);
  min-width: 0;
}
.compat-tap { min-height: var(--compat-tap); }

/* Never let a new screen hide its own text with a one-off rule. */
.compat-no-clip {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  height: auto;
  max-height: none;
  -webkit-line-clamp: unset;
}

/* v11.1.0 LIVE-OPS narrow-phone band (<=360px CSS width): the atelier
   shelf keeps wallet + gift chest + settings on one row, and the gift
   card's ribbon sheds a few px, so nothing clips on the narrowest
   phones. Kept HERE, not style.css — this file is the one audited home
   for device-shape queries (scripts/check-compat-queries.js). */
@media (max-width: 360px) {
  .gift-chest { width: calc(var(--tap) * .84); height: calc(var(--tap) * .84); }
  .gift-ribbon { width: 44px; height: 44px; font-size: 20px; }
  .gift-card { gap: 9px; padding: 10px; }
}
