/*
 * Template base layer — structural CSS shared by all 5 templates. Consumes TOKENS ONLY (no hardcoded
 * colors/radii/shadows); each template's tokens are injected on the [data-template] root and its skin.css
 * adds the per-template character. Scoped under .tpl so it never touches the legacy player app.
 * Encodes the shell contracts: outset focus rings, tabular money numerals, reduced-motion gating.
 */

.tpl,
.tpl *,
.tpl *::before,
.tpl *::after {
  box-sizing: border-box;
}

.tpl {
  font-family: var(--font-ui);
  color: var(--text-primary);
  background: var(--bg-base);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

/* Display type inherits the template's face, tracking, and case (uppercase templates set it via token). */
.tpl h1,
.tpl h2,
.tpl h3,
.tpl .tpl-display {
  font-family: var(--font-display);
  letter-spacing: var(--tracking-display);
  text-transform: var(--transform-display);
  margin: 0;
  color: var(--text-primary);
}

.tpl p {
  margin: 0;
  color: var(--text-secondary);
}

.tpl a {
  color: var(--accent);
  text-decoration: none;
}

/* SHELL CONTRACT — tabular numerals on every money/balance figure (aligned columns, no jitter). */
.tpl-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* SHELL CONTRACT — focus rings render OUTSET on the page background (focus-ring == accent in most
 * templates, so an inset ring on an accent fill would be invisible). */
.tpl :focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.tpl :focus:not(:focus-visible) {
  outline: none;
}

/* SHELL CONTRACT — honor prefers-reduced-motion: kill all animation + transition, leave instant state. */
@media (prefers-reduced-motion: reduce) {
  .tpl *,
  .tpl *::before,
  .tpl *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Layout helpers (token-driven; templates may override gutters/max-width in their skin). */
.tpl-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}
.tpl-stack {
  display: grid;
  gap: 16px;
}
.tpl-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.tpl-muted {
  color: var(--text-muted);
}
.tpl-section__title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
