/* ==========================================================================
   Rep Llama — brand kit page (/brand)
   Loaded AFTER assets/styles.css, which supplies every token and the shared
   .container / .card / .btn / .site-header / .site-footer chrome. Only rules
   this page genuinely needs live here: spec typography, the token swatch grid,
   the mark gallery and the tool-accent grid.
   ========================================================================== */

/* --- Hero ---------------------------------------------------------------- */

.brand-hero {
  padding: clamp(2.5rem, 6vw, 4rem) 0 clamp(1.5rem, 3vw, 2rem);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand-hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 0.4em;
}
.brand-hero-lede {
  max-width: 46rem;
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
}
.brand-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.brand-hero-note {
  font-size: 0.9rem;
  margin: 0;
}

/* --- Layout: table of contents beside the spec --------------------------- */

.brand-layout {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
  padding-block: clamp(2rem, 5vw, 3.5rem);
}

.toc {
  position: sticky;
  top: calc(64px + 1.5rem); /* clears the sticky .site-header */
  max-height: calc(100vh - 64px - 3rem);
  overflow-y: auto;
}
.toc h2 {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  margin-bottom: 0.75rem;
}
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border);
}
.toc li a {
  display: block;
  padding: 0.3rem 0 0.3rem 0.85rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.35;
}
.toc li a:hover {
  color: var(--brand);
  border-left-color: var(--brand);
}

@media (max-width: 900px) {
  .brand-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .toc {
    position: static;
    max-height: none;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
  }
}

/* --- The spec itself ----------------------------------------------------- */

.spec {
  min-width: 0; /* lets wide tables scroll instead of blowing out the grid */
  max-width: 52rem;
}
.spec h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-top: 2.5rem;
  scroll-margin-top: calc(64px + 1rem);
}
.spec h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
  scroll-margin-top: calc(64px + 1rem);
}
.spec h4 {
  font-size: 1.05rem;
  margin-top: 1.5rem;
  scroll-margin-top: calc(64px + 1rem);
}
.spec p,
.spec li {
  color: var(--foreground);
}
.spec p {
  margin: 0 0 1rem;
}
.spec ul,
.spec ol {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
}
.spec li {
  margin-bottom: 0.4rem;
}
.spec li > ul,
.spec li > ol {
  margin-top: 0.4rem;
}
.spec hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}
.spec code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 0.12em 0.36em;
}
.spec pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 0 0 1.25rem;
}
.spec pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.6;
}
.spec blockquote {
  margin: 0 0 1.25rem;
  padding: 0.9rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--warning-subtle);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.spec blockquote p:last-child {
  margin-bottom: 0;
}

/* Heading anchors — visible on hover, and always visible to keyboard focus. */
.spec .anchor {
  float: left;
  margin-left: -1.1em;
  padding-right: 0.35em;
  color: var(--muted-2);
  opacity: 0;
  font-weight: 400;
  transition: opacity 0.12s ease;
}
.spec h2:hover .anchor,
.spec h3:hover .anchor,
.spec h4:hover .anchor,
.spec .anchor:focus-visible {
  opacity: 1;
}
@media (max-width: 640px) {
  .spec .anchor {
    display: none;
  }
}

/* --- Tables -------------------------------------------------------------- */

/* Wide spec tables scroll inside their own box; the page body never does. */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.spec table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}
.spec th,
.spec td {
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.spec thead th {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}
.spec tbody tr:last-child td {
  border-bottom: 0;
}

/* --- Injected visual blocks --------------------------------------------- */

.viz {
  margin: 0 0 2rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.viz figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* Colour swatches — light value and dark value side by side, always both. */
.swatch-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.85rem;
}
.swatch-pair {
  display: flex;
  height: 2.75rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-strong);
}
.swatch-chip {
  flex: 1;
}
/* Scoped under .viz on purpose: `.spec code` (0,1,1) paints every code span a
   chip background with its own padding, and would otherwise win over a bare
   single-class selector here. Inside the visual blocks these labels already sit
   in their own boxes, so the chip has to come back off. */
.viz .swatch-name {
  display: block;
  margin-top: 0.45rem;
  padding: 0;
  background: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--foreground);
  word-break: break-all;
}
.swatch-hex {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
}

/* Mark gallery */
.mark-gallery {
  display: grid;
  gap: 1.75rem;
}
.mark-group h4 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}
.mark-group p {
  font-size: 0.85rem;
  margin: 0 0 0.9rem;
  max-width: 44rem;
}
.mark-row {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}
.mark-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 9.5rem;
}
.mark-tile img {
  display: block;
  width: 112px;
  height: 112px;
}
.mark-dl {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-align: center;
  line-height: 1.35;
}

/* The two glyphs and mono-reverse carry no field of their own, so the tile has
   to supply the ground they were drawn for — §4. A gallery that puts them all
   on white silently loses the reverse artwork. */
.mark-tile.ground-auto {
  background: var(--surface-2);
}
.mark-tile.ground-light {
  background: #ffffff;
  border-color: var(--border-strong);
}
.mark-tile.ground-ink {
  background: #002952;
  border-color: #002952;
}
.mark-tile.ground-ink .mark-dl {
  color: #9db0c2;
}
.mark-tile.ground-ink .mark-dl:hover {
  color: #ffffff;
}

/* Tool accents — drawn as the 4px top rail the launcher card actually uses. */
.accent-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.75rem;
}
.accent-tile {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden; /* the rail is full-bleed, so the card must clip it */
  background: var(--surface);
  padding: 0;
  display: flex;
  flex-direction: column;
}
.accent-rail {
  display: block;
  height: 4px;
}
.accent-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.6rem 0.75rem 0;
}
.viz .accent-slug,
.viz .accent-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  background: none;
  padding: 0.15rem 0.75rem 0;
}
.viz .accent-meta {
  padding-bottom: 0.7rem;
}
.viz .accent-meta code {
  background: none;
  padding: 0;
  font-size: 1em;
}
