/* ==========================================================================
   K02 Color, Tokens & Stage Presets — page styles (kit/color-and-tokens.html)
   ========================================================================== */

/* Shares a view transition with the K02 hero tile on the cover page */
.page-color-and-tokens .kit-shell__main {
  view-transition-name: k02;
}

.tokens-lead {
  max-width: 64ch;
}

/* Section heading with a meta label on the right */
.tokens-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 20px;
}

.tokens-head__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: -.02em;
}

/* h2 followed by an intro paragraph */
.kit-h2--tight {
  margin-bottom: 8px;
}

.tokens-intro {
  max-width: 64ch;
  margin: 0 0 20px;
  color: var(--ink-2);
}

/* Token architecture ----------------------------------------------------- */
.token-layers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 12px;
}

.token-layer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

/* The semantic (brand) layer is the one you edit — highlighted */
.token-layer--brand {
  padding: 19px;
  border: 2px solid var(--ink);
}

.token-layer__code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
}

.token-layer__text {
  font-size: 14px;
  color: var(--ink-2);
}

.token-snippet {
  margin: 12px 0 0;
  padding: 20px;
  overflow: auto;
  border-radius: 16px;
  background: var(--inverse);
  color: var(--on-inverse);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
}

/* Semantic palette table ------------------------------------------------- */
.palette-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.palette-table__row {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(140px, 1.4fr);
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
}

.palette-table__row--head {
  gap: 0;
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}

.palette-table__token {
  font-family: var(--font-mono);
  font-size: 13px;
}

.palette-table__value {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
}

.palette-table__use {
  font-size: 14px;
  color: var(--ink-2);
}

/* Swatch color comes from --swatch on the element */
.palette-swatch {
  flex-shrink: 0;
  width: 36px;
  height: 28px;
  border: 1px solid rgba(0, 0, 0, .1);
  border-radius: 6px;
  background: var(--swatch);
}

.palette-swatch--dark {
  border-color: rgba(255, 255, 255, .12);
}

/* Contrast tables -------------------------------------------------------- */
.contrast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 16px;
}

.contrast-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.contrast-card__title {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}

.contrast-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
}

/* Fixed sample colors via --fg / --bg (the pair being measured) */
.contrast-row__sample {
  padding: 6px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.contrast-row__label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-2);
}

.contrast-row__ratio {
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.contrast-grade {
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}

.contrast-grade--pass  { background: var(--pos-bg);  color: var(--pos); }
.contrast-grade--large { background: var(--warn-bg); color: var(--warn); }
.contrast-grade--fail  { background: var(--neg-bg);  color: var(--neg); }

/* Delta & status --------------------------------------------------------- */
.delta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.delta-pill {
  padding: 5px 11px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.delta-pill--pos { background: var(--pos-bg); color: var(--pos); }
.delta-pill--neg { background: var(--neg-bg); color: var(--neg); }

.delta-pill--flat {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 10px;
  margin-top: 16px;
}

.status {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
}

.status--pos  { background: var(--pos-bg);  color: var(--pos); }
.status--warn { background: var(--warn-bg); color: var(--warn); }
.status--neg  { background: var(--neg-bg);  color: var(--neg); }
.status--info { background: var(--info-bg); color: var(--info); }

/* Data-viz palette ------------------------------------------------------- */
.viz-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

.viz-swatch {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.viz-swatch__color {
  height: 64px;
  background: var(--swatch);
}

.viz-swatch__meta {
  padding: 8px 10px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.viz-scales {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

/* Fixed ramps (daylight values) — intentionally not themed */
.viz-scale {
  height: 28px;
  border-radius: 8px;
}

.viz-scale--sequential {
  background: linear-gradient(90deg, #EEF3FA, #9DB8DE, #3E6FB0, #1C3A66);
}

.viz-scale--diverging {
  background: linear-gradient(90deg, #A8342B, #E9B7AE, #F2F2EE, #9FCDB2, #1E6B43);
}

.viz-scale__legend {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}

/* Stage presets ---------------------------------------------------------- */
.stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}

.stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Each stage sets its own radius, padding, headline size and width axis.
   Defaults = Launch. */
.stage-card {
  --stage-r: 24px;
  --stage-pad: 24px;
  --stage-size: 40px;
  --stage-wdth: 88;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 300px;
  padding: var(--stage-pad);
  border: 1px solid var(--line);
  border-radius: var(--stage-r);
  background: var(--surface);
}

.stage-card--prelaunch {
  --stage-r: 12px;
  --stage-pad: 28px;
  --stage-size: 46px;
  --stage-wdth: 78;
}

.stage-card--scale {
  --stage-r: 12px;
  --stage-size: 30px;
  --stage-wdth: 96;
}

.stage-card__head {
  font-family: var(--font-display);
  font-size: var(--stage-size);
  font-weight: 700;
  line-height: .95;
  letter-spacing: -.04em;
  font-variation-settings: 'wdth' var(--stage-wdth);
}

.stage-card__sub {
  font-size: 14px;
  color: var(--ink-2);
}

.stage-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

/* Static button look (preview only, not interactive) */
.stage-card__btn {
  padding: 10px 16px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.stage-card__btn--primary {
  border: 0;
  background: var(--action);
  color: var(--on-action);
}

.stage-card__proof {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
}

.stage__rules {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink-2);
}

.stage__rules b {
  color: var(--ink);
}
