/* mrph brand center — Inter throughout, light/dark by system preference. */

:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;

  --bg: #ffffff;
  --bg-sunken: #f6f7f9;
  --bg-raised: #ffffff;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #14181f;
  /* muted/faint both clear 4.5:1 on --bg and --bg-raised (WCAG 2.2 AA, 1.4.3) */
  --text-muted: #596273;
  --text-faint: #667085;
  --accent: #14181f;
  --accent-contrast: #ffffff;
  --focus: #2563eb;

  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 264px;
  --topbar-h: 60px;
}

/* Dark values live in one place; applied by system preference, and by an
   explicit [data-theme] when the user picks a side with the toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e1116;
    --bg-sunken: #14181f;
    --bg-raised: #171c24;
    --border: #262d38;
    --border-strong: #333c4a;
    --text: #e9edf3;
    --text-muted: #a3aebd;
    --text-faint: #8b96a6;
    --accent: #e9edf3;
    --accent-contrast: #0e1116;
    --focus: #60a5fa;
  }
}

:root[data-theme='dark'] {
  --bg: #0e1116;
  --bg-sunken: #14181f;
  --bg-raised: #171c24;
  --border: #262d38;
  --border-strong: #333c4a;
  --text: #e9edf3;
  --text-muted: #a3aebd;
  --text-faint: #8b96a6;
  --accent: #e9edf3;
  --accent-contrast: #0e1116;
  --focus: #60a5fa;
}

/* Keep native form controls and scrollbars in step with the chosen theme. */
:root { color-scheme: light; }
:root[data-theme='dark'] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) { color-scheme: dark; }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  /* keeps anchored + focused targets clear of the sticky header (2.4.11) */
  scroll-padding-top: calc(var(--topbar-h) + 56px);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 100;
  display: flex;
  align-items: center;
  min-height: 32px;
  background: var(--bg-raised);
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.wordmark {
  display: flex;
  align-items: center;
  min-height: 24px; /* 2.5.8 minimum target size */
  gap: 9px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark em {
  font-style: normal;
  font-weight: 400;
  color: var(--text-muted);
}
.wordmark-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 420px;
  margin-left: auto;
}
.search-wrap input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 34px 8px 12px;
}
.search-wrap input::placeholder { color: var(--text-faint); }
.search-wrap kbd {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  font: 500 11px/1 var(--mono);
  color: var(--text-faint);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 5px;
  pointer-events: none;
}

.nav-toggle {
  display: none;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 36px;
  padding: 7px 12px;
  cursor: pointer;
}

/* theme toggle — 36px square clears the 24px minimum target size (2.5.8) */
.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--text);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0;
}
.icon-btn:hover { border-color: var(--border-strong); }
.icon-btn svg {
  grid-area: 1 / 1;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* show the icon for the theme the button switches *to* */
.icon-btn .icon-sun { display: none; }
.icon-btn .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .icon-btn .icon-sun { display: block; }
  :root:not([data-theme='light']) .icon-btn .icon-moon { display: none; }
}
:root[data-theme='dark'] .icon-btn .icon-sun { display: block; }
:root[data-theme='dark'] .icon-btn .icon-moon { display: none; }
:root[data-theme='light'] .icon-btn .icon-sun { display: none; }
:root[data-theme='light'] .icon-btn .icon-moon { display: block; }

/* ---------- shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 18px 12px 40px;
  border-right: 1px solid var(--border);
  background: var(--bg-sunken);
}

.nav-group + .nav-group { margin-top: 2px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.nav-link:hover { background: var(--border); }
.nav-link[aria-current='page'] {
  background: var(--accent);
  color: var(--accent-contrast);
}
.nav-link .swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex: none;
  background: var(--text-faint);
}
.nav-link .count {
  margin-left: auto;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
.nav-link[aria-current='page'] .count { color: inherit; opacity: 0.7; }

.nav-sub {
  margin: 2px 0 6px 17px;
  padding-left: 10px;
  border-left: 1px solid var(--border-strong);
}
.nav-sub .nav-link {
  font-weight: 400;
  font-size: 13.5px;
  color: var(--text-muted);
}
.nav-sub .nav-link[aria-current='page'] { color: var(--accent-contrast); }

.nav-empty {
  padding: 10px;
  font-size: 13px;
  color: var(--text-faint);
}

/* ---------- main ---------- */

.main {
  padding: 32px 40px 96px;
  max-width: 1080px;
  outline: none;
}

.crumbs {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { color: var(--text-faint); margin: 0 6px; }

.page-head { margin-bottom: 8px; }
.page-head h1 {
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.page-head .tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: 15.5px;
  max-width: 68ch;
}

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }
.badge {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
}
.badge[data-status='active'] { color: #0a7a45; border-color: #0a7a4540; background: #0a7a450f; }
.badge[data-status='draft'] { color: #9a6a00; border-color: #9a6a0040; background: #9a6a000f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .badge[data-status='active'] { color: #4ade80; }
  :root:not([data-theme='light']) .badge[data-status='draft'] { color: #fbbf24; }
}
:root[data-theme='dark'] .badge[data-status='active'] { color: #4ade80; }
:root[data-theme='dark'] .badge[data-status='draft'] { color: #fbbf24; }

/* in-page section nav */
.section-nav {
  position: sticky;
  top: var(--topbar-h);
  z-index: 20;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  margin: 22px -8px 0;
  padding: 10px 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a {
  flex: none;
  display: flex;
  align-items: center;
  min-height: 28px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.section-nav a:hover { background: var(--bg-sunken); color: var(--text); }
.section-nav a.active { background: var(--accent); color: var(--accent-contrast); }

section { padding-top: 34px; scroll-margin-top: calc(var(--topbar-h) + 52px); }
section h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.empty {
  color: var(--text-faint);
  font-size: 14px;
  background: var(--bg-sunken);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 16px;
}
.empty code {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ---------- sub-brand cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.card {
  display: block;
  text-decoration: none;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.card:hover { border-color: var(--border-strong); }
.card .card-name { font-weight: 600; margin-bottom: 3px; }
.card .card-meta { font-size: 13px; color: var(--text-muted); }
.card .card-bar {
  display: flex;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--border);
}
.card .card-bar i { flex: 1; }

/* ---------- colours ---------- */

.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
}
.color {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-raised);
}
.color-chip {
  height: 76px;
  border-bottom: 1px solid var(--border);
}
.color-body { padding: 10px 12px 12px; }
.color-name { font-weight: 600; font-size: 13.5px; }
.color-hex {
  display: inline-flex;
  align-items: center;
  min-height: 24px; /* 2.5.8 minimum target size */
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  background: none;
  border: 0;
  padding: 0 4px 0 0;
  margin-top: 2px;
  cursor: pointer;
}
.color-hex:hover { color: var(--text); }
.color-meta {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 5px;
  line-height: 1.45;
}
.color-role {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 4px;
}

/* ---------- typography ---------- */

.type-list { display: grid; gap: 10px; }
.type-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.type-role {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  width: 100%;
}
.type-family { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.type-detail { font-size: 13px; color: var(--text-muted); }
.type-detail a { color: var(--text-muted); }

/* ---------- file lists ---------- */

.file-list { display: grid; gap: 6px; }
.file {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.file:hover { border-color: var(--border-strong); }
.file-ext {
  flex: none;
  width: 42px;
  text-align: center;
  font: 600 10.5px/1 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 0;
}
.file-name { min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.file-size {
  margin-left: auto;
  flex: none;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
.file-warn {
  margin-left: auto;
  flex: none;
  font-size: 11.5px;
  font-weight: 500;
  color: #9a6a00;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .file-warn { color: #fbbf24; }
}
:root[data-theme='dark'] .file-warn { color: #fbbf24; }

.logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.logo-tile {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-raised);
}
.logo-tile:hover { border-color: var(--border-strong); }
.logo-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 116px;
  padding: 16px;
  overflow: hidden;
  background: #fff;
  background-image:
    linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%),
    linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}
.logo-preview img {
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  object-fit: contain;
}
.logo-caption {
  padding: 9px 12px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}
.logo-caption span { display: block; color: var(--text-faint); font-size: 11.5px; }

/* ---------- links ---------- */

.link-list { display: grid; gap: 6px; }
.link-row {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: 14px;
}
.link-row:hover { border-color: var(--border-strong); }
.link-row .link-label { font-weight: 500; }
.link-row .link-kind {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-faint);
}

/* ---------- prose (guidelines.md) ---------- */

.prose {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  max-width: 74ch;
}
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
/* guidelines.md headings are shifted down two levels, so # lands on h3 */
.prose h3 { font-size: 20px; letter-spacing: -0.01em; margin: 26px 0 10px; }
.prose h4 { font-size: 15.5px; margin: 24px 0 8px; }
.prose h5, .prose h6 { font-size: 14px; margin: 18px 0 6px; }
.prose :is(h3, h4, h5, h6) { color: var(--text); font-weight: 600; }
.prose p, .prose li { color: var(--text-muted); }
.prose li { margin: 3px 0; }
.prose blockquote {
  margin: 14px 0;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--border-strong);
  color: var(--text-faint);
  font-style: italic;
}
.prose code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }

.note {
  background: #9a6a000f;
  border: 1px solid #9a6a0040;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 16px;
}
.note strong { color: var(--text); }

/* ---------- home ---------- */

.home-lede {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 62ch;
  margin: 0 0 4px;
}
.stats { display: flex; flex-wrap: wrap; gap: 26px; margin: 24px 0 6px; }
.stat-n { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.stat-l { font-size: 12.5px; color: var(--text-faint); }

/* ---------- search results ---------- */

.result-brand {
  font-size: 12px;
  color: var(--text-faint);
  margin-left: auto;
  flex: none;
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    display: none;
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar.open { display: block; }
  .nav-toggle { display: block; }
  .main { padding: 22px 20px 80px; }
  .search-wrap { max-width: none; }
  .wordmark em { display: none; }
}

/* Below this the three controls and the search field stop fitting on one row,
   so the search gets its own. --topbar-h grows to match, keeping the sticky
   sidebar and section nav aligned under it. */
@media (max-width: 640px) {
  :root { --topbar-h: 102px; }
  .topbar {
    flex-wrap: wrap;
    align-content: center;
    gap: 10px;
    padding: 0 14px;
  }
  .wordmark { margin-right: auto; }
  .search-wrap {
    order: 3;
    flex-basis: 100%;
    max-width: none;
    margin-left: 0;
  }
  .search-wrap kbd { display: none; }
  .page-head h1 { font-size: 25px; }
}
