/*!
 * Teamz Lab games — cross-promo strip + menu modal.
 *
 * Every colour comes from an existing site token with a literal fallback, so
 * the strip inherits light/dark automatically and never renders unstyled text
 * on an unstyled ground. Backgrounds and foregrounds are always set as a PAIR
 * (--surface/--text, --accent/--accent-text) — never one without the other.
 */

.tz-mg {
  /* Own surface + border so this block reads as site content and can never be
     mistaken for an ad unit (AdSense ad-distinguishability). */
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #dddddd);
  border-radius: 14px;
  padding: 16px;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tz-mg__label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted, rgba(18, 21, 26, 0.75));
}

/* Grid, not a scroller: a horizontal swipe strip inside a game page fights the
   page's own vertical scroll and the browser back-swipe on iOS. */
.tz-mg__row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px; /* >= 8px between touch targets */
}

/* Specificity note: shared/css/tools.css sets `.tool-content a { color; underline }`
   at (0,1,1). A bare `.tz-mg__item` is (0,1,0) and LOSES, which rendered every
   tile as underlined body-link text. `.tz-mg a.tz-mg__item` is (0,2,1) and wins
   without needing !important. Keep both parts of the selector. */
.tz-mg a.tz-mg__item {
  display: flex;
  align-items: center;
  gap: 10px;
  /* min-height, not height: the name may wrap to two lines and the tile must
     grow rather than clip it. */
  min-height: 56px; /* >= 44px touch target */
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border, #dddddd);
  background: var(--bg, transparent);
  color: var(--text, #12151a);
  text-decoration: none;
  transition: transform 180ms ease-out, border-color 180ms ease-out;
}

/* The spans inherit the underline too unless it is cleared on them directly. */
.tz-mg a.tz-mg__item .tz-mg__name,
.tz-mg a.tz-mg__item .tz-mg__tag,
.tz-mg a.tz-mg__item .tz-mg__badge {
  text-decoration: none;
}

.tz-mg a.tz-mg__item:hover,
.tz-mg a.tz-mg__item:focus-visible {
  border-color: var(--accent, #d9fe06);
  /* translate only — never width/height/top, which would reflow the page. */
  transform: translateY(-2px);
}

.tz-mg a.tz-mg__item:focus-visible {
  outline: 2px solid var(--accent, #d9fe06);
  outline-offset: 2px;
}

.tz-mg__badge {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  /* Paired: this ground stays dark in both themes, so the on-colour is a fixed
     white rather than a token that could flip to dark on it.
     28% lightness is not arbitrary — white-on-hsl(h,62%,L) was measured across
     all 19 generated hues: L=32% drops to 4.27:1 on the yellow-green hues and
     fails WCAG AA. 28% puts the worst hue at 5.33:1. Do not raise it. */
  background: hsl(var(--tz-mg-hue, 200), 62%, 28%);
  color: #ffffff;
}

.tz-mg__meta {
  display: flex;
  flex-direction: column;
  min-width: 0; /* lets the ellipsis actually engage inside a grid child */
}

/* Wrap to two lines rather than truncating: "Forty Thiev…" and "Daily Word…"
   are unreadable, and a title the user cannot read cannot be chosen. Two lines
   fits every name in the manifest; the clamp is only a runaway guard. */
.tz-mg__name {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
  color: var(--text, #12151a);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.tz-mg__tag {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted, rgba(18, 21, 26, 0.75));
}

.tz-mg a.tz-mg__all {
  align-self: flex-start;
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #12151a);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 8px 2px; /* keeps the tap height usable without a visible box */
}

.tz-mg a.tz-mg__all:focus-visible {
  outline: 2px solid var(--accent, #d9fe06);
  outline-offset: 2px;
}

/* ── Dock-menu modal ─────────────────────────────────────────────────────── */
.tz-mg-modal__panel {
  max-width: 460px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Inside the modal the panel already supplies the surface — a second bordered
   card within it would read as a box in a box. */
.tz-mg-modal__panel .tz-mg {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  max-height: 60vh;
  overflow-y: auto;
}

.tz-mg-modal__close {
  align-self: stretch;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border, #dddddd);
  background: transparent;
  color: var(--text, #12151a);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.tz-mg-modal__close:focus-visible {
  outline: 2px solid var(--accent, #d9fe06);
  outline-offset: 2px;
}

@media (max-width: 380px) {
  .tz-mg__row { grid-template-columns: 1fr; }
}

/* The modal is narrower than the page column, so two tiles per row squeeze the
   longest names. One column inside the modal on phone widths. */
@media (max-width: 460px) {
  .tz-mg-modal__panel .tz-mg__row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .tz-mg a.tz-mg__item { transition: none; }
  .tz-mg a.tz-mg__item:hover,
  .tz-mg a.tz-mg__item:focus-visible { transform: none; }
}
