/**
 * Bench page styles.
 *
 * Self-imposed discipline: this file uses semantic tokens only — same rule
 * the primitives must follow. The bench shouldn't drift from the system it
 * showcases.
 */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* Accessibility: visually hide content while keeping it in the
   accessibility tree (for screen-reader / heading-hierarchy use). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  font-family: var(--ds-font-body);
  font-size: var(--ds-text-body-md);
  font-weight: var(--ds-weight-body);
  line-height: var(--ds-leading-body);
  color: var(--ds-color-text-primary);
  background: var(--ds-color-surface-base);
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
ul { list-style: none; padding: 0; margin: 0; }
a { color: inherit; text-decoration: none; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  padding: var(--ds-space-3xs) var(--ds-space-2xs);
  background: var(--ds-color-surface-sunken);
  border-radius: var(--ds-radius-sm);
}

/* ─── Hero ─────────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: var(--ds-space-2xl) var(--ds-space-lg) var(--ds-space-xl);
  overflow: hidden;
  background: var(--ds-color-surface-base);
}
.hero__logomark {
  position: absolute;
  top: var(--ds-space-lg);
  right: var(--ds-space-lg);
  width: var(--ds-space-2xl);
  height: var(--ds-space-2xl);
  opacity: 0.12;
}
.hero__inner { max-width: 1080px; margin: 0 auto; }
.eyebrow {
  display: inline-block;
  padding: var(--ds-space-3xs) var(--ds-space-sm);
  background: var(--ds-color-surface-inverse);
  color: var(--ds-color-text-inverse);
  font-size: var(--ds-text-caption);
  font-weight: var(--ds-weight-strong);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--ds-radius-pill);
  margin-bottom: var(--ds-space-md);
}
.hero__title {
  font-family: var(--ds-font-display);
  font-size: var(--ds-text-display-xl);
  font-weight: var(--ds-weight-display);
  line-height: var(--ds-leading-display);
  color: var(--ds-color-text-heading);
  margin: 0 0 var(--ds-space-md) 0;
  letter-spacing: -0.02em;
}
.gradient-rule {
  width: var(--ds-space-3xl);
  height: var(--ds-space-3xs);
  background: var(--ds-gradient-hero);
  border-radius: var(--ds-radius-pill);
  margin: var(--ds-space-md) 0 var(--ds-space-lg);
}
.hero__lede {
  font-size: var(--ds-text-body-lg);
  color: var(--ds-color-text-secondary);
  max-width: 60ch;
  margin: 0 0 var(--ds-space-lg) 0;
}
.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-lg);
  font-size: var(--ds-text-body-sm);
  color: var(--ds-color-text-muted);
}
.hero__stats strong {
  color: var(--ds-color-text-heading);
  font-family: var(--ds-font-display);
  font-size: var(--ds-text-heading-md);
  font-weight: var(--ds-weight-display);
  margin-right: var(--ds-space-2xs);
}

/* ─── Content ──────────────────────────────────────────────────── */
.content {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--ds-space-lg) var(--ds-space-2xl);
}

/* ─── Component grid ───────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--ds-space-md);
  margin: var(--ds-space-xl) 0;
}
.empty-state {
  grid-column: 1 / -1;
  padding: var(--ds-space-xl);
  text-align: center;
  color: var(--ds-color-text-muted);
  background: var(--ds-color-surface-raised);
  border-radius: var(--ds-radius-card);
  border: 1px dashed var(--ds-color-border-subtle);
}
.card {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-2xs);
  padding: var(--ds-space-md);
  background: var(--ds-color-surface-raised);
  border: 1px solid var(--ds-color-border-subtle);
  border-radius: var(--ds-radius-card);
  transition: transform var(--ds-duration-default) var(--ds-ease-default),
              border-color var(--ds-duration-default) var(--ds-ease-default),
              box-shadow var(--ds-duration-default) var(--ds-ease-default);
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--ds-color-border-brand);
  box-shadow: var(--ds-shadow-card);
}
.card:focus-visible {
  outline: var(--ds-focus-ring);
  outline-offset: var(--ds-focus-ring-offset);
}
.card--placeholder {
  opacity: 0.55;
  cursor: not-allowed;
}
.card--placeholder:hover { transform: none; box-shadow: none; }
.card__tier {
  font-size: var(--ds-text-caption);
  font-weight: var(--ds-weight-strong);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ds-color-brand-action);
}
.card__title {
  font-family: var(--ds-font-body);
  font-size: var(--ds-text-heading-md);
  font-weight: var(--ds-weight-heading);
  margin: 0;
}
.card__summary {
  font-size: var(--ds-text-body-sm);
  color: var(--ds-color-text-secondary);
  margin: 0;
}
.status {
  display: inline-block;
  align-self: flex-start;
  padding: var(--ds-space-3xs) var(--ds-space-2xs);
  font-size: var(--ds-text-caption);
  font-weight: var(--ds-weight-emphasis);
  border-radius: var(--ds-radius-sm);
  margin-top: var(--ds-space-2xs);
}
.status--draft   { background: var(--ds-color-surface-sunken); color: var(--ds-color-text-muted); }
.status--review  { background: var(--ds-color-surface-sunken); color: var(--ds-color-brand-warm); }
.status--vetted  { background: var(--ds-color-surface-sunken); color: var(--ds-color-brand-primary); }

/* ─── Meta block ─────────────────────────────────────────────────
   Bench scaffolding only — not a primitive. Eyebrow above the title
   substitutes for the side-stripe accent we used to ship; the stripe
   was an impeccable border-accent-on-rounded antipattern (4px solid
   on a 12px-radius card — corner curves and stripe geometry visibly
   disagreed). See impeccable-review.md §4 / bench fix. */
.meta-block {
  margin-top: var(--ds-space-2xl);
  padding: var(--ds-space-lg);
  background: var(--ds-color-surface-raised);
  border-radius: var(--ds-radius-card);
  border: 1px solid var(--ds-color-border-subtle);
}
.meta-block__eyebrow {
  font-family: var(--ds-font-body);
  font-size: var(--ds-text-caption);
  font-weight: var(--ds-weight-strong);
  letter-spacing: var(--ds-tracking-overline);
  text-transform: uppercase;
  color: var(--ds-color-brand-primary);
  margin: 0 0 var(--ds-space-2xs) 0;
}
.meta-block__title {
  font-family: var(--ds-font-body);
  font-size: var(--ds-text-heading-md);
  font-weight: var(--ds-weight-heading);
  margin: 0 0 var(--ds-space-md) 0;
}
.meta-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--ds-space-2xs) var(--ds-space-md);
  margin: 0;
}
.meta-list dt {
  font-weight: var(--ds-weight-strong);
  color: var(--ds-color-text-heading);
}
.meta-list dd {
  margin: 0;
  color: var(--ds-color-text-secondary);
}

/* ─── Footer ───────────────────────────────────────────────────── */
.footer {
  margin-top: var(--ds-space-xl);
  padding-top: var(--ds-space-md);
  border-top: 1px solid var(--ds-color-border-subtle);
  font-size: var(--ds-text-body-sm);
  color: var(--ds-color-text-muted);
  text-align: center;
}

/* ─── Responsive ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero { padding: var(--ds-space-xl) var(--ds-space-md); }
  .hero__title { font-size: var(--ds-text-display-md); }
  .meta-list { grid-template-columns: 1fr; }
  .meta-list dt { margin-top: var(--ds-space-sm); }
}

/* ─── Per-primitive bench layout ──────────────────────────────────
   Used by every component's index.html. DRY shared chrome so each
   primitive's bench page only needs to specify its own variants. */
.bench-section {
  margin: var(--ds-space-xl) 0;
  padding: var(--ds-space-lg);
  background: var(--ds-color-surface-raised);
  border-radius: var(--ds-radius-card);
  border: 1px solid var(--ds-color-border-subtle);
}
.bench-section__title {
  font-family: var(--ds-font-body);
  font-size: var(--ds-text-heading-md);
  font-weight: var(--ds-weight-heading);
  color: var(--ds-color-text-heading);
  margin: 0 0 var(--ds-space-2xs) 0;
}
.bench-section__desc {
  font-size: var(--ds-text-body-sm);
  color: var(--ds-color-text-secondary);
  margin: 0 0 var(--ds-space-md) 0;
}
.bench-section__sub {
  font-family: var(--ds-font-body);
  font-size: var(--ds-text-body-sm);
  font-weight: var(--ds-weight-strong);
  color: var(--ds-color-text-action);
  margin: 0 0 var(--ds-space-sm) 0;
  text-transform: uppercase;
  letter-spacing: var(--ds-tracking-overline);
}

.bench-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-md);
  align-items: center;
  padding: var(--ds-space-md) 0;
}
.bench-row + .bench-row { border-top: 1px dashed var(--ds-color-border-subtle); }
.bench-row__label {
  flex: 0 0 140px;
  font-size: var(--ds-text-caption);
  font-weight: var(--ds-weight-strong);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ds-color-text-muted);
}
.bench-row__items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-sm);
  align-items: center;
}

/* Context frames — the primitive in real surface contexts */
.ctx-frame {
  padding: var(--ds-space-md);
  border: 1px dashed var(--ds-color-border-subtle);
  border-radius: var(--ds-radius-card);
  background: var(--ds-color-surface-base);
}
.ctx-frame--inverse {
  background: var(--ds-color-surface-inverse);
  color: var(--ds-color-text-inverse);
}
.ctx-frame--gradient { background: var(--ds-gradient-hero); }
.ctx-frame--card {
  background: var(--ds-color-surface-raised);
  border-style: solid;
  box-shadow: var(--ds-shadow-card);
}
.ctx-label {
  display: block;
  font-size: var(--ds-text-caption);
  font-weight: var(--ds-weight-strong);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ds-color-text-muted);
  margin-bottom: var(--ds-space-2xs);
}

/* Back-to-index link in per-primitive page header.
   Bottom margin reserves --ds-space-xl below the breadcrumb row before
   the display-xl primitive title — see design-language.md §8 type-to-space. */
.back-link {
  display: inline-block;
  margin-bottom: var(--ds-space-xl);
  font-size: var(--ds-text-body-sm);
  color: var(--ds-color-text-link);
}
.back-link:hover { text-decoration: underline; }
