/* Grain ComponentShowcase layout — shipped in the package so consumers render
 * Grain's own gallery. Theme tokens (var(--*)) come from a grain theme CSS the
 * consumer imports (@goforgeit/grain/themes/cream.css). Self-contained: no
 * Tailwind build required. */
.flex { display: flex; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.text-xs { font-size: 12px; line-height: 1.25; }
.text-secondary { color: var(--ink-secondary); }
.mono { font-family: var(--font-mono, ui-monospace, monospace); }


* { margin: 0; box-sizing: border-box; }

body {
  background: var(--bg-gradient);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  transition: background var(--duration-normal) var(--ease-default),
              color var(--duration-normal) var(--ease-default);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

.app { position: relative; z-index: 1; }

.app { min-height: 100vh; }

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 48px;
  border-bottom: 1px solid var(--border);
  /* was rgba(253, 251, 247, 0.8) — a cream literal. --surface-overlay is the
     token for "translucent raised bar over content, behind a backdrop-filter"
     and it exists in cream, dark and the compat layer, so it follows
     the register instead of pinning the bar to daylight. */
  background: var(--surface-overlay);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { font-size: 18px; font-weight: 600; }

.topbar-nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

.topbar-nav a {
  font-size: 13px;
  color: var(--sol-accent-ink);
  text-decoration: none;
  font-weight: 500;
  transition: opacity var(--duration-fast);
}
.topbar-nav a:hover { opacity: 0.8; }

.topbar-nav .active-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.theme-toggle {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--background-sunken);
  color: var(--ink);
  cursor: pointer;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}
/* GRAIN names, not the spine's --sol-* ones, and the reason is the ENTRY POINT.
   This file is compiled by vite into dist/index.css and folded into the CDN
   bundle dist/grain.css, which deliberately ships WITHOUT the compat layer
   (build-grain-css.mjs LAYERS; check-alias-inert.mjs asserts it). The night
   re-point of every --sol-* name lives in that layer, so a --sol-* value here
   would render daylight under [data-theme="dark"] on the CDN entry point.
   --background-sunken IS var(--sol-ground-sunken) in the light register
   (cream.css) and is re-pointed for night by dark.css, so it carries the
   compat layer's mapping on BOTH entry points. Components are different: they
   ship as class strings in dist/index.js and are compiled by the CONSUMER
   against the barrel, which does import compat. */
.theme-toggle:hover { background: var(--background-sunken); border-color: var(--border-hairline); }

/* ── Main Content ───────────────────────────────────── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px;
}

/* ── Page Intro ────────────────────────────────────── */
.page-intro {
  margin-bottom: 48px;
}
.page-intro h2 {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.page-intro p {
  font-size: 14px;
  color: var(--ink-secondary);
  line-height: 1.5;
  max-width: 680px;
}

/* ── Section Card ──────────────────────────────────── */
.section-card {
  /* was rgba(255, 255, 255, 0.5) — byte-identical to cream's
     --surface-overlay, so this is a no-op in the cream register and a fix
     everywhere else. Composited over the night ground the literal made
     every card a #8a8f94 slab and dragged 279 rendered pairs below AA;
     check-contrast-pairs.mjs is what found it. */
  background: var(--surface-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--elevation-1);
  padding: 36px;
  margin-bottom: 40px;
  backdrop-filter: blur(8px);
}

.section-card-header {
  margin-bottom: 24px;
}

.section-card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.section-card-desc {
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.5;
  max-width: 640px;
}

/* ── Subsections ───────────────────────────────────── */
.subsection {
  margin-top: 28px;
}

.subsection-title {
  font-size: 12px;
  line-height: 1.25;
  font-weight: var(--weight-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--ink-tertiary);
  margin-bottom: 14px;
}

.subsection-content {}

/* ── Layout Helpers ─────────────────────────────────── */
.row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* ── Patterns Divider ──────────────────────────────── */
.patterns-divider {
  margin: 48px 0 40px;
  padding-top: 48px;
  border-top: 2px solid var(--border);
}
.patterns-divider-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.patterns-divider-desc {
  font-size: 14px;
  color: var(--ink-secondary);
  line-height: 1.5;
  max-width: 640px;
}

/* ── Demo helpers ──────────────────────────────────── */
.demo-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 600px;
}

.demo-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.demo-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.demo-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
