/*
 * specimen.css — the page's own CSS, and nothing else's.
 *
 * This file exists to be honest about a thing every design system elides: the
 * documentation page always needs more than the system provides. Rather than
 * quietly growing chapbook.css until it covers tables, tab groups and
 * swatches that no real site needs, the extras live here, scoped to this page.
 *
 * That is also the recommended pattern for using the system. Take
 * chapbook.css unchanged, add a file like this one beside it, and keep the
 * two separate so you can always see what you added.
 *
 * Everything below obeys the nine rules. No radius, no shadow, no fill except
 * --sunk; hairlines and space do the separating; mono carries structure.
 */

/* The nine rules ---------------------------------------------------------- */
/* A row anatomy without a row's affordances — nothing here is a link, so
   nothing here gets a hover fill or a redrawing hairline. */

.rules { border-top: 1px solid var(--rule); }

.rule {
  padding: 1.5rem 0 1.6rem;
  border-bottom: 1px solid var(--rule);
}

.rule-n {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.11em;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  color: var(--accent);
}

.rule-title {
  margin-top: 0.45rem;
  max-width: 26ch;
  font-family: var(--display);
  font-size: clamp(1.15rem, 3vw, 1.45rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.rule-body {
  margin-top: 0.7rem;
  max-width: var(--measure);
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.55;
  text-wrap: pretty;
}

/* The implementation line. Mono, because it says what kind of thing the rule
   is rather than what the rule means. */
.rule-spec {
  margin-top: 0.75rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.7;
  color: var(--faint);
  word-break: break-word;
}

.rule-body code,
.rule-spec code,
.small code,
.lede code {
  font-family: var(--mono);
  font-size: 0.92em;
  color: var(--ink);
}

/* The skin picker --------------------------------------------------------- */
/* Rule 08: these do something, so they are bordered controls rather than more
   words in a row of words. */

.skinpick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--rule);
}

.skinbtns { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.skinbtn {
  padding: 0.42rem 0.85rem;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 200ms var(--ease), border-color 200ms var(--ease);
}

.skinbtn:hover { color: var(--ink); border-color: var(--ink); }

/* The pressed state is a border in ink, not a fill — a filled button here
   would be the first card on the page. */
.skinbtn[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--ink);
}

.skinnote { margin-top: 1.1rem; }
.skinnote b { color: var(--ink); font-weight: 500; }

/* Tables ------------------------------------------------------------------ */
/* Hairlines only. A zebra fill would be a second fill in a system that has
   one, and the one it has is the row hover. */

.tablewrap {
  margin-top: 1.1rem;
  overflow-x: auto;   /* wide content scrolls inside its column, never the page */
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.6;
  white-space: nowrap;
}

.tbl th,
.tbl td {
  padding: 0.55rem 1rem 0.55rem 0;
  text-align: left;
  vertical-align: baseline;
  border-bottom: 1px solid var(--rule);
}

.tbl thead th {
  border-bottom: 2px solid var(--ink);
  color: var(--ink);
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.tbl tbody th {
  color: var(--ink);
  font-weight: 400;
}

.tbl td { color: var(--faint); }

.tbl .num { font-variant-numeric: tabular-nums; }

/* The role column is the only prose in the table, so it is the only cell that
   is allowed to wrap. */
.tbl .role {
  white-space: normal;
  min-width: 12rem;
  color: var(--muted);
}

.tbl code { font-family: inherit; color: var(--ink); }

/* A swatch, sized to the mono cap height so it sits on the baseline of the
   hex value beside it rather than floating above it. */
.chip {
  display: inline-block;
  width: 0.72rem;
  height: 0.72rem;
  margin-right: 0.5rem;
  background: var(--c);
  border: 1px solid var(--rule);
  vertical-align: -1px;
}

/* Print ------------------------------------------------------------------- */
/* The skin picker does nothing on paper. The panels do — all of them open, so
   a printed copy carries every palette rather than whichever one happened to
   be on screen. */

@media print {
  .skinpick { display: none !important; }
  .skinpanel { display: block !important; }
  .skinpanel[hidden] { display: block !important; }
  .rule,
  .tbl tr { break-inside: avoid; }
  .tablewrap { overflow-x: visible; }
  .tbl { white-space: normal; font-size: 8pt; }
}
