/* ==========================================================================
   SPECIMENS — record-derived presentation, in production.

   Derived from the Phase 1 lab stylesheet, which is frozen as evidence and is
   NOT imported here. The duplication is deliberate: the lab has to keep
   rendering exactly what it rendered when the experiment was accepted.

   THE CONTRACT

   `.spec` on its own is the house container. Every rule below is gated on a
   data-* attribute that only appears when a corpus claim licensed it AND the
   decision survived surface capacity and viability. A record that derives
   nothing gets the house container and not one rule here fires.

   NOTHING HERE SETS A HUE, AN IMAGE, A MOTION VALUE, OR A CONTRAST BELOW THE
   FLOOR. Those are shell floors on every record.
   ========================================================================== */

.spec { --s-ground: transparent; --s-ink: inherit; }

/* --- ground + ink contrast ---------------------------------- token_rule --- */
.spec[data-ground="light"]     { --s-ground: #F2F2EF; --s-ink: #0E0F10; }
.spec[data-ground="off-white"] { --s-ground: #F5F2E9; --s-ink: #0A0A0A; }
.spec[data-ink-contrast="high"]    { --s-ink: #0E0F10; }
.spec[data-ink-contrast="highest"] { --s-ink: #000000; }
.spec[data-ground] {
  background: var(--s-ground);
  color: var(--s-ink);
  padding: var(--s4);
  border: 1px solid color-mix(in srgb, var(--s-ink) 16%, transparent);
}

/* --- type class. A CLASS is named; the face is the machine's. ------------- */
.spec[data-type-class="grotesque"]     { font-family: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", "Nimbus Sans", sans-serif; }
.spec[data-type-class="sans"]          { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.spec[data-type-class="grotesk_heavy"] { font-family: "Helvetica Neue", Helvetica, Arial, "Nimbus Sans", sans-serif; }
/* NOT var(--mono). The moment the apparatus face became a real brand asset,
   this line started rendering a RECORD's typography in Aesthetary's own voice —
   a specimen wearing the museum's clothes. A record whose research says
   "monospace" is making a claim about a generic class of typeface, not about
   our apparatus font. It gets the platform's mono, like every other type class
   in this file, for the same reason: here the system stack is correct because
   variety is the point and the exact face is not a claim. */
.spec[data-type-class="monospace"]     { font-family: ui-monospace, "SF Mono", Menlo, "DejaVu Sans Mono", monospace; }
.spec[data-type-weight="heavy"] .spec__name { font-weight: 800; letter-spacing: -0.015em; }
.spec[data-tracking="tight-display"] .spec__name { letter-spacing: -0.02em; }

/* --- type scale ---------------------------------------------- token_rule ---
   `few-sizes`: very few distinct sizes and weights in one composition. */
.spec[data-type-scale="restricted"] .spec__name,
.spec[data-type-scale="restricted"] .spec__line { font-size: var(--t-base); }
.spec[data-type-scale="two-weights"] .spec__name { font-weight: 600; }

/* --- alignment ----------------------------------------------- token_rule --- */
.spec[data-alignment="flush-left"] { text-align: left; }
.spec[data-alignment="flush-left"] .spec__line { hyphens: none; }
.spec[data-measure="ch-45-75"] .spec__line { max-width: 62ch; }

/* --- hierarchy ------------------------------------------------ token_rule ---
   `hierarchy-device` forbids size-alone AND colour-alone ranking, so the name
   is held at body size and ranks by weight, position and the interval beneath
   it. It is a REFUSAL, and only legible next to records that do rank by size. */
.spec[data-hierarchy="position-weight-interval"] .spec__name {
  font-size: var(--t-base); font-weight: 700; color: inherit;
  margin-block-end: var(--s4);
}
.spec[data-hierarchy="panel-area"] .spec__field > :first-child {
  grid-column: span 3; font-size: var(--t-md); display: flex; align-items: flex-end;
}

/* --- subdivision ---------------------------------------------- token_rule --- */
.spec__field { display: flex; flex-wrap: wrap; gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.spec__field li { font: var(--t-xs)/1.5 var(--mono); padding: 2px var(--s2); border: 1px solid currentColor; opacity: .62; }

.spec[data-subdivision="module-matrix"] .spec__field { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.spec[data-subdivision="module-matrix-min"] .spec__field { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.spec[data-subdivision^="module-matrix"] .spec__field li {
  border: 0; padding: var(--s2) var(--s2) var(--s2) 0; opacity: 1; min-width: 0; overflow-wrap: anywhere;
}
.spec[data-rule-treatment="hairline-structural"][data-subdivision^="module-matrix"] .spec__field li {
  border-inline-end: 1px solid color-mix(in srgb, var(--s-ink, currentColor) 18%, transparent);
  border-block-end: 1px solid color-mix(in srgb, var(--s-ink, currentColor) 18%, transparent);
  padding-inline: var(--s2);
}

.spec[data-subdivision^="unequal-panels"] .spec__field {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: minmax(1.4rem, auto);
}
.spec[data-subdivision^="unequal-panels"] .spec__field li {
  border: 0; opacity: 1; padding: 2px var(--s2);
  background: color-mix(in srgb, var(--s-ink, currentColor) 7%, transparent);
}
.spec[data-subdivision^="unequal-panels"] .spec__field li:nth-child(2) { grid-column: span 2; }
.spec[data-subdivision^="unequal-panels"] .spec__field li:nth-child(3) { grid-column: span 3; }
.spec[data-subdivision^="unequal-panels"] .spec__field li:nth-child(4) { grid-column: span 5; }
.spec[data-subdivision^="unequal-panels"] .spec__field li:nth-child(5) { grid-column: span 2; }
.spec[data-gutter="row-exceeds-panel"] .spec__field { column-gap: 2px; row-gap: 12px; }

/* --- radius, elevation, spacing ------------------------------- token_rule --- */
.spec[data-radius="zero"] { border-radius: 0; }
.spec[data-radius="consistent-free-magnitude"] { border-radius: 10px; }  /* magnitude: SHELL */
.spec[data-elevation="none"] { box-shadow: none; }
.spec[data-elevation="one-step"] { box-shadow: 0 6px 24px rgba(0,0,0,.09); }
.spec[data-spacing-unit="consistent-base"] .spec__field { gap: 8px; }

/* --- colour ROLES. Hue is the shell's on every record. -------- token_rule --- */
.spec[data-colour-roles="few-flat-functional"] .spec__field > :first-child {
  background: var(--s-ink, currentColor); color: var(--s-ground, var(--paper));
}
.spec[data-colour-roles="single-ink"] .spec__field > :first-child {
  background: var(--s-ink, currentColor); color: var(--s-ground, var(--paper));
}
.spec[data-colour-roles="one-accent-primary-only"] .spec__field > :first-child {
  /* Role from the record, hue AND paired foreground from the shell. `--paper`
     flips with the scheme: 6.4:1 light, 6.2:1 dark. A floor declared upstream
     is a comment; this is where it is enforced. */
  background: var(--accent); color: var(--paper); border-color: transparent; border-radius: 6px;
}
.spec[data-target-size="min-24"] .spec__field li { min-height: 24px; display: inline-flex; align-items: center; }

/* --- the "why does this look like this" affordance ------------------------
   The fifth separability device, in its smallest form. Shell register. */
.spec__why {
  font: var(--t-xs)/1.4 var(--mono);
  color: var(--ink-3);
  margin: var(--s2) 0 0;
}

/* --- the rest of the renderable type classes -------------------- token_rule
   Each names members of the CLASS, never a prescribed face — the same
   discipline as Swiss's `typeface-class`. Classes with no system member
   (hand_lettered, display_custom, wood_type, blackletter, script, bitmap) are
   withheld upstream as unrenderable rather than styled with a guess. */
.spec[data-type-class="neo_grotesk"]        { font-family: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", "Nimbus Sans", sans-serif; }
.spec[data-type-class="geometric_sans"]     { font-family: "Century Gothic", "URW Gothic", "Avant Garde", "Trebuchet MS", sans-serif; }
.spec[data-type-class="old_style_serif"]    { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; }
.spec[data-type-class="transitional_serif"] { font-family: "Times New Roman", Times, "Liberation Serif", "Nimbus Roman", serif; }
.spec[data-type-class="didone"]             { font-family: Didot, "Bodoni MT", "Playfair Display", "Times New Roman", serif; }
.spec[data-type-class="slab"]               { font-family: Rockwell, "Roboto Slab", "Courier New", Georgia, serif; }

/* ==========================================================================
   A SPECIMEN KEEPS ITS OWN LIGHT.

   A record that asserts a ground is asserting a CLAIM — Swiss light, Manga
   off-white — and that claim does not have a dark variant. But the apparatus
   printed inside it (the basis label, the editorial bracket, the claim key)
   was inheriting the shell's tokens, so on a dark theme light-violet
   [Our interpretation] landed on Swiss's pale grey at 1.97:1.

   Where a ground is asserted, the text tokens are restored to the values
   measured against a light ground. This is a no-op in day mode; at night it
   is what stops the wall's lighting from leaking onto the painting.
   ========================================================================== */
.spec[data-ground] {
  --ink:    #0B0D12;
  --ink-2:  #454C57;
  --ink-3:  #6B7280;
  --accent: #5B21D6;
  --brand:  #5B21D6;
  --rule:   #DFE4EA;
  --rule-firm: #B6BEC9;
}
