/* ForgeOS spotlight card: one feature, told plainly, with a drawing and one way in.
 *
 * Format only, after a promotional card the owner liked (2026-11-16): a soft
 * grey card, a large backdrop whose drawn person breaks out of its top edge
 * pointing at a prop, a bold two-line headline, one line of body, and a
 * full-width pill action. Everything is a --m19-* token: no raw colour, no new
 * type size, radius, shadow or duration (tests/test_design_foundations.py).
 *
 * Combinations are attributes on .spot, set by forgeos-spotlight.js or by
 * src/forgeos/web/spotlight.py:
 *   data-art      top | start | end | none
 *   data-shape    circle | square | blob | none   (drawn in the SVG itself)
 *   data-tone     teal | blue | violet | pink | orange | green | brand | amber
 *   data-overflow on | off                       (figure above the backdrop)
 *   data-density  compact | regular | hero
 *   data-action   solid | outline | link | pair
 *   data-whole    on: the primary action's click area covers the card (one link)
 * Layout is logical (inline/block), so Arabic and Urdu mirror; a container
 * query, not the viewport, decides when art sits beside the words, so the card
 * reads the same in a narrow column on a wide screen as on a 320px phone. */

.spot-slot { margin-block: var(--m19-space-6); }
.spot-slot:empty { margin-block: 0; }
.spot-slot--gallery { margin-block: 0; }

.spot {
  --spot-pad: var(--m19-space-6);
  --spot-art: 15rem;
  --spot-tone: color-mix(in oklab, color-mix(in oklab, var(--m19-spectrum-1) 38%, var(--m19-spectrum-5)) 58%, var(--m19-surface));
  container-type: inline-size;
  position: relative;
  display: block;
  box-sizing: border-box;
  inline-size: 100%;
  max-inline-size: var(--m19-reading-max, 42rem);
  margin-inline: auto;
  padding: var(--spot-pad);
  border: 1px solid var(--m19-line);
  border-radius: var(--m19-radius-xl);
  background: var(--m19-surface-2);
  color: var(--m19-ink);
  font-family: var(--m19-font);
  text-align: start;
  overflow-wrap: anywhere;
}

.spot[data-density="compact"] { --spot-pad: var(--m19-space-4); --spot-art: 10rem; }
.spot[data-density="hero"] { --spot-pad: var(--m19-space-8); --spot-art: 19rem; }

/* Tones: the brand's accents, softened toward the card's own ground so a dark
 * page gets a dark tone and a light page a light one. */
.spot[data-tone="blue"] { --spot-tone: color-mix(in oklab, var(--m19-spectrum-1) 46%, var(--m19-surface)); }
.spot[data-tone="violet"] { --spot-tone: color-mix(in oklab, var(--m19-spectrum-2) 42%, var(--m19-surface)); }
.spot[data-tone="pink"] { --spot-tone: color-mix(in oklab, var(--m19-spectrum-3) 40%, var(--m19-surface)); }
.spot[data-tone="orange"] { --spot-tone: color-mix(in oklab, var(--m19-spectrum-4) 46%, var(--m19-surface)); }
.spot[data-tone="green"] { --spot-tone: color-mix(in oklab, var(--m19-spectrum-5) 46%, var(--m19-surface)); }
.spot[data-tone="brand"] { --spot-tone: color-mix(in oklab, var(--m19-brand-500) 44%, var(--m19-surface)); }
.spot[data-tone="amber"] { --spot-tone: color-mix(in oklab, var(--m19-state-warning) 52%, var(--m19-surface)); }

.spot-in { display: grid; gap: var(--m19-space-5); align-items: center; }

/* The drawing. Its box keeps the SVG's 200 x 240 ratio before the SVG arrives,
 * so nothing below it moves (no layout shift). */
.spot-art {
  inline-size: min(100%, var(--spot-art));
  aspect-ratio: 5 / 6;
  margin-inline: auto;
  color: var(--m19-ink);
}
.spot-art svg { display: block; inline-size: 100%; block-size: 100%; overflow: visible; }
.spot-backdrop { fill: var(--spot-tone); }
.spot-figure { transform-box: view-box; transform-origin: 50% 63%; }
.spot[data-art="none"] .spot-art { display: none; }

/* Beside the words once the card itself is wide enough. */
@container (min-width: 34rem) {
  .spot[data-art="start"] .spot-in,
  .spot[data-art="end"] .spot-in { grid-template-columns: minmax(8rem, 13rem) minmax(0, 1fr); gap: var(--m19-space-6); }
  .spot[data-art="end"] .spot-art { order: 2; }
  .spot[data-art="start"] .spot-art,
  .spot[data-art="end"] .spot-art { inline-size: 100%; }
}
@container (max-width: 33.99rem) {
  .spot[data-art="start"],
  .spot[data-art="end"] { --spot-art: 11rem; }
}

.spot-text { display: grid; gap: var(--m19-space-2); min-inline-size: 0; }
.spot-eyebrow {
  margin: 0;
  color: var(--m19-ink-3);
  font-size: var(--m19-text-sm);
  font-weight: var(--m19-weight-semibold);
}
.spot-title {
  margin: 0;
  color: var(--m19-ink);
  font-size: var(--m19-text-xl);
  font-weight: var(--m19-weight-bold);
  line-height: 1.25;
  text-wrap: balance;
}
.spot[data-density="hero"] .spot-title { font-size: var(--m19-text-2xl); }
.spot[data-density="compact"] .spot-title { font-size: var(--m19-text-lg); }
.spot-body { margin: 0; color: var(--m19-ink-2); font-size: var(--m19-text-md); line-height: 1.5; text-wrap: pretty; }
.spot-meta { margin: 0; color: var(--m19-ink-3); font-size: var(--m19-text-sm); }

/* Actions. Solid: the near-black pill, full width; the ink flips in dark. */
.spot-actions { display: flex; flex-wrap: wrap; gap: var(--m19-space-3); margin-block-start: var(--m19-space-3); }
.spot-action {
  display: inline-flex;
  flex: 1 1 100%;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-block-size: var(--m19-tap);
  padding: var(--m19-space-3) var(--m19-space-6);
  border: 1px solid var(--m19-ink);
  border-radius: var(--m19-radius-pill);
  background: var(--m19-ink);
  color: var(--m19-surface);
  font-size: var(--m19-text-md);
  font-weight: var(--m19-weight-bold);
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}
.spot-action:focus-visible { outline: var(--m19-focus-ring); outline-offset: var(--m19-focus-offset); }
.spot[data-action="outline"] .spot-action--primary,
.spot-action--secondary { background: transparent; color: var(--m19-ink); border-color: var(--m19-line-strong); }
.spot[data-action="pair"] .spot-action { flex: 1 1 12rem; }
.spot[data-action="link"] .spot-action--primary {
  flex: 0 1 auto;
  justify-content: flex-start;
  padding-inline: 0;
  border-color: transparent;
  background: transparent;
  color: var(--m19-brand-700);
  text-decoration: underline;
  text-underline-offset: .2em;
}
.spot-arrow { margin-inline-start: var(--m19-space-2); }
.spot-arrow::before { content: "\2192"; }
:dir(rtl) .spot-arrow::before { content: "\2190"; }

/* One link for the whole card: its click area is stretched over the card, so
 * there is one tab stop and one name, never a link inside a link. */
.spot[data-whole="on"] .spot-action--primary::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.spot[data-whole="on"] { cursor: pointer; }
.spot[data-whole="on"]:has(.spot-action--primary:focus-visible) { outline: var(--m19-focus-ring); outline-offset: var(--m19-focus-offset); }

.spot-foot { display: flex; justify-content: flex-end; margin-block-start: var(--m19-space-1); }
.spot-dismiss {
  position: relative;
  z-index: 1;
  min-block-size: var(--m19-tap);
  padding: 0 var(--m19-space-2);
  border: 0;
  background: none;
  color: var(--m19-ink-3);
  font: inherit;
  font-size: var(--m19-text-sm);
  text-decoration: underline;
  text-underline-offset: .2em;
  cursor: pointer;
}
.spot-dismiss:focus-visible { outline: var(--m19-focus-ring); outline-offset: var(--m19-focus-offset); }
.spot-said { margin: 0; color: var(--m19-ink-3); font-size: var(--m19-text-sm); }

/* A small lift when pointed at; still for anyone who asked for less motion. */
@media (hover: hover) {
  .spot .spot-figure { transition: transform var(--m19-motion-base) var(--m19-ease-out); }
  .spot:hover .spot-figure { transform: translateY(-2%); }
  .spot[data-whole="on"]:hover { box-shadow: var(--m19-shadow-md); }
}
@media (prefers-reduced-motion: reduce) {
  .spot .spot-figure { transition: none; }
  .spot:hover .spot-figure { transform: none; }
}
:root[data-fx-motion="less"] .spot .spot-figure { transition: none; transform: none; }

@media (forced-colors: active) {
  .spot { border-color: CanvasText; }
  .spot-backdrop { fill: GrayText; }
  .spot-action { border-color: ButtonText; }
}

/* The dev gallery's grid (tests' fixture only; never linked from a page). */
.spot-gallery { display: grid; gap: var(--m19-space-6); grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); align-items: start; }
