/*
 * Layout and page-specific rules for the /design-system reference page.
 * Shared components live in the root stylesheets (_buttons.css, _forms.css,
 * etc.). This file only contains selectors that belong to the reference
 * page itself.
 */

/* Layout */
.page {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* Sidebar nav */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--forest);
  padding: 2rem 0;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 0 1.25rem 2rem;
  border-bottom: 1px solid var(--on-dark-10);
}

.sidebar-logo strong {
  font-family: "Playfair Display", serif;
  font-size: 1rem;
  color: white;
  display: block;
}

.sidebar-logo span {
  font-size: var(--fs-xs);
  color: var(--on-dark-45);
}

.sidebar-nav {
  padding: 1.5rem 0;
  flex: 1;
}

.sidebar-nav a {
  display: block;
  padding: .45rem 1.25rem;
  font-size: var(--fs-xs);
  color: var(--on-dark-65);
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 600;
  transition: color .15s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active { color: white; }

.sidebar-nav .section-label {
  display: block;
  padding: 1.25rem 1.25rem .35rem;
  font-size: .6875rem;
  color: var(--on-dark-30);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 600;
}

/* Main content */
.main {
  padding: 3rem 3.5rem;
  max-width: 900px;
}

/* Section headers */
.ds-section {
  margin-bottom: 5rem;
  scroll-margin-top: 2rem;
}

.ds-section + .ds-section {
  padding-top: 1rem;
  border-top: 1px solid var(--sand);
}

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .75rem;
}

.section-eyebrow::before {
  content: "";
  display: block;
  width: 28px;
  height: 2px;
  background: var(--accent);
}

.ds-title {
  font-family: "Playfair Display", serif;
  font-size: var(--fs-2xl);
  color: var(--ink);
  margin-bottom: .5rem;
  font-weight: 700;
}

.ds-lead {
  font-size: var(--fs-sm);
  color: var(--muted);
  max-width: 60ch;
  line-height: 1.75;
  margin-bottom: 2.5rem;
}

.ds-subtitle {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
  margin-top: 2.5rem;
}

.ds-intro {
  margin-bottom: 4rem;
}

.ds-meta {
  font-size: var(--fs-xs);
  color: var(--muted);
  font-family: monospace;
}

/* Colour swatches */
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.swatch {
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--on-light-06);
}

.swatch-colour { height: 72px; }

.swatch-info {
  padding: .625rem .75rem;
  background: white;
}

.swatch-name {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink);
}

.swatch-hex {
  font-size: .75rem;
  color: var(--muted);
  font-family: monospace;
}

.swatch-var {
  font-size: .6875rem;
  color: var(--muted);
  font-family: monospace;
  margin-top: .15rem;
}

/* Type specimens */
.type-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: baseline;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--stone);
}

.type-label {
  font-size: .6875rem;
  color: var(--muted);
  font-family: monospace;
  font-weight: 600;
}

.type-sample { color: var(--ink); }

.type-meta {
  font-size: .6875rem;
  color: var(--muted);
  font-family: monospace;
  white-space: nowrap;
}

/* Spacing scale */
.spacing-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .625rem 0;
  border-bottom: 1px solid var(--stone);
}

.spacing-bar {
  background: var(--sage);
  border-radius: 2px;
  height: 20px;
  flex-shrink: 0;
}

.spacing-label {
  font-size: var(--fs-xs);
  font-family: monospace;
  color: var(--muted);
  min-width: 60px;
}

.spacing-value {
  font-size: var(--fs-xs);
  color: var(--ink);
}

/* Component demos */
.demo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.demo-block {
  background: var(--stone);
  border-radius: var(--r-lg);
  padding: 1.5rem 2rem;
}

.demo-block-dark { background: var(--forest); }

.demo-label {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .875rem;
}

/* Reference-page demo chrome for shared components. The real
 * components (.site-nav in _site_nav.css, .hero in _hero.css) are
 * full-bleed on real pages. The *-demo classes below add rounded-card
 * framing so they sit inside this page's sidebar layout. Use via
 * composition: class="site-nav site-nav-demo", class="hero hero-demo". */

.site-nav-demo {
  border-radius: var(--r-lg);
}

.hero-demo {
  border-radius: var(--r-lg);
  padding: 3.5rem 3rem 0;
}

.hero-demo > .status-bar {
  margin: 2rem -3rem 0;
  border-bottom-left-radius: var(--r-lg);
  border-bottom-right-radius: var(--r-lg);
  padding: .75rem 3rem;
}

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--sand);
  margin: 2rem 0;
}

/* Token reference table */
.token-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-xs);
}

.token-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--sand);
  text-transform: uppercase;
  letter-spacing: .07em;
}

.token-table td {
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--stone);
  font-family: monospace;
}

.token-table td:first-child {
  color: var(--forest);
  font-weight: 600;
}

.token-table tr:last-child td { border-bottom: none; }

.token-preview {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 3px;
  border: 1px solid var(--sand);
  vertical-align: middle;
  margin-right: .35rem;
}

/* Code sample block */
.code-sample {
  background: var(--ink);
  color: var(--code-fg);
  padding: 1.25rem 1.5rem;
  border-radius: var(--r-lg);
  font-size: var(--fs-xs);
  line-height: 1.8;
  overflow-x: auto;
}

/* Inline code reference */
.code-inline {
  font-family: monospace;
  font-size: .9em;
  background: var(--stone);
  padding: .1em .35em;
  border-radius: .25rem;
}

/* Demo grid helpers (page-scoped, used by the reference page only) */
.demo-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.demo-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.demo-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.demo-row-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.demo-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.demo-col-wide {
  display: flex;
  flex-direction: column;
  gap: .875rem;
  max-width: 600px;
}

.card-narrow { max-width: 360px; }

.card-body-flush { padding: 0; }

/* Radius demo */
.radius-demo {
  text-align: center;
}

.radius-demo-swatch {
  width: 64px;
  height: 64px;
  background: var(--sage);
  margin: 0 auto .5rem;
}

.radius-demo-r    { border-radius: var(--r); }
.radius-demo-r-lg { border-radius: var(--r-lg); }
.radius-demo-pill { border-radius: 999px; }

.radius-demo-caption {
  font-size: var(--fs-xs);
  font-family: monospace;
  color: var(--muted);
}

/* Shadow demo */
.shadow-demo {
  background: white;
  border-radius: var(--r-lg);
  padding: 1.25rem 1.5rem;
}

.shadow-demo-sm { box-shadow: var(--shadow); }
.shadow-demo-lg { box-shadow: var(--shadow-lg); }

.shadow-demo-label { margin-bottom: .25rem; }

.shadow-demo-value {
  font-size: var(--fs-xs);
  font-family: monospace;
  color: var(--muted);
}

/* Swatch override — let inline style set background for neutral swatches
 * with a visible border */
.swatch-colour.bordered {
  border: 1px solid var(--sand);
}

/* Typographic pattern demos */
.pattern-demo { display: flex; flex-direction: column; gap: 1.25rem; }

.pattern-demo-label {
  margin-top: .25rem;
  font-size: var(--fs-xs);
  color: var(--muted);
  font-family: monospace;
}

.pattern-eyebrow {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.pattern-section-title {
  font-family: "Playfair Display", serif;
  font-size: var(--fs-2xl);
  font-weight: 700;
}

.pattern-lead {
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.75;
  display: block;
  max-width: 52ch;
}

.pattern-link {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Eyebrow pattern block */
.eyebrow-block-title {
  font-family: "Playfair Display", serif;
  font-size: var(--fs-2xl);
  font-weight: 700;
  margin-top: .625rem;
}

.eyebrow-block-title-sm {
  font-family: "Playfair Display", serif;
  font-size: var(--fs-xl);
  font-weight: 700;
  margin-top: .625rem;
}

/* Type specimen block */
.type-specimen-playfair {
  font-family: "Playfair Display", serif;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
}

.type-specimen-playfair em {
  color: var(--muted);
  font-style: italic;
}

.type-specimen-alphabet {
  font-family: "Playfair Display", serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: .75rem;
}

.type-specimen-body {
  font-family: "Source Serif 4", serif;
  font-size: var(--fs-base);
  line-height: 1.75;
  color: var(--ink);
}

/* Type scale samples */
.type-sample-hero {
  font-family: "Playfair Display", serif;
  font-size: var(--fs-hero);
  font-weight: 700;
  line-height: 1;
}

.type-sample-3xl {
  font-family: "Playfair Display", serif;
  font-size: var(--fs-3xl);
  font-weight: 700;
  line-height: 1.1;
}

.type-sample-2xl {
  font-family: "Playfair Display", serif;
  font-size: var(--fs-2xl);
  font-weight: 700;
}

.type-sample-xl {
  font-family: "Playfair Display", serif;
  font-size: var(--fs-xl);
  font-weight: 700;
}

.type-sample-lg {
  font-size: var(--fs-lg);
  font-weight: 600;
}

.type-sample-base { font-size: var(--fs-base); }
.type-sample-sm   { font-size: var(--fs-sm); }
.type-sample-xs   {
  font-size: var(--fs-xs);
  color: var(--muted);
}

/* Card gallery — used in the cards section */
.card-gallery { display: flex; flex-direction: column; gap: 2rem; }

/* Version footer */
.ds-version {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-top: 5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--sand);
}

/* Badge sizing variant used inline in news-card meta */
.badge-inline {
  font-size: .6875rem;
  padding: .15rem .45rem;
}
