/* Tool Teacher — mockup styles.
   EVERY value below mirrors DESIGN.md frontmatter 1:1. No ad-hoc colors, sizes, or radii.
   Dark is the default theme; light applies only under [data-theme="light"]. */

:root {
  /* colors.dark */
  --bg: #0B0E14;
  --surface: #12161F;
  --surface-alt: #1A1F2B;
  --border: #262C38;
  --border-strong: #333B4A;
  --text-primary: #E6EAF2;
  --text-secondary: #9BA6B8;
  --text-muted: #6B7688;
  --accent: #5AC8D8;
  --accent-text: #04121A;
  --focus-ring: #5AC8D8;
  /* semantic.dust */
  --dust-fresh: #45C08A;
  --dust-idle: #6E86C4;
  --dust-dusty: #C89A5B;
  --dust-unknown: #7A8598;
  /* semantic.severity */
  --sev-breaking: #FF4D3D;
  --sev-behavior: #F2A33C;
  --sev-feature: #5AC8D8;
  --sev-fix: #45C08A;
  --sev-unknown: #7A8598;
  /* semantic.source */
  --src-brew: #F2A33C;
  --src-npm: #C86BD8;
  --src-app: #6E86C4;
  --src-local: #7FB069;
  /* semantic.state */
  --state-outdated: #F2A33C;
  --state-current: #45C08A;
  --state-unseen: #5AC8D8;
  /* fonts */
  --font-sans: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'IBM Plex Mono', ui-monospace, monospace;
  /* spacing (4px grid) */
  --space-xs: 4px; --space-sm: 8px; --space-md: 12px; --space-lg: 16px;
  --space-xl: 24px; --space-2xl: 32px; --space-3xl: 48px;
  /* rounded */
  --r-sm: 3px; --r-md: 6px; --r-lg: 10px; --r-full: 9999px;
  /* shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.40);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.50);
  --shadow-breaking-glow: 0 0 0 1px rgba(255,77,61,0.55), 0 0 18px rgba(255,77,61,0.18);
}

[data-theme="light"] {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface-alt: #F1F3F6;
  --border: #E1E5EB;
  --border-strong: #CBD2DC;
  --text-primary: #1A2029;
  --text-secondary: #57616F;
  --text-muted: #8A94A3;
  --accent: #0E8FA6;
  --accent-text: #FFFFFF;
  --focus-ring: #0E8FA6;
  --dust-fresh: #1E9E6A;
  --dust-idle: #4A63A8;
  --dust-dusty: #96702E;
  --dust-unknown: #6B7688;
  --sev-breaking: #D63424;
  --sev-behavior: #B9701A;
  --sev-feature: #0E8FA6;
  --sev-fix: #1E9E6A;
  --sev-unknown: #6B7688;
  --src-brew: #B9701A;
  --src-npm: #9B3FB0;
  --src-app: #4A63A8;
  --src-local: #4E7A3A;
  --state-outdated: #B9701A;
  --state-current: #1E9E6A;
  --state-unseen: #0E8FA6;
}

/* ---------- base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9375rem; line-height: 1.55; /* body-md */
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- typography (DESIGN.md ramp) ---------- */
.h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.15; }
.h2 { font-size: 1.25rem; font-weight: 650; line-height: 1.25; }
.h3 { font-size: 1rem; font-weight: 600; line-height: 1.3; }
.body-md { font-size: 0.9375rem; font-weight: 400; line-height: 1.55; }
.body-sm { font-size: 0.8125rem; font-weight: 400; line-height: 1.5; }
.label-caps { font-size: 0.6875rem; font-weight: 600; line-height: 1.2; letter-spacing: 0.07em; text-transform: uppercase; }
.mono-md { font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 500; line-height: 1.45; }
.mono-sm { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; line-height: 1.4; }
.code { font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 500; line-height: 1.4; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

/* ---------- mockup chrome (top bar of every page) ---------- */
.mock-nav {
  display: flex; align-items: center; gap: var(--space-lg);
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 10;
  flex-wrap: wrap;
}
.mock-nav .brand { font-family: var(--font-mono); font-weight: 500; color: var(--text-primary); }
.mock-nav .brand .tt { color: var(--accent); }
.mock-nav nav { display: flex; gap: var(--space-md); flex-wrap: wrap; }
.mock-nav nav a { color: var(--text-secondary); font-size: 0.8125rem; }
.mock-nav nav a.active { color: var(--text-primary); font-weight: 600; }
.mock-nav .spacer { flex: 1; }
.unread-nav { position: relative; display: inline-flex; align-items: center; gap: var(--space-xs); }

/* theme toggle + state switcher */
.toggle-btn {
  font-family: var(--font-mono); font-size: 0.75rem;
  background: var(--surface-alt); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--space-xs) var(--space-sm); cursor: pointer;
}
.toggle-btn:hover { border-color: var(--border-strong); color: var(--text-primary); }
.state-switch { display: flex; gap: var(--space-xs); align-items: center; }
.state-switch .label-caps { color: var(--text-muted); margin-right: var(--space-xs); }
.state-switch button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* state panels: exactly one visible per data-state group */
.state-panel { display: none; }
.state-panel.active { display: block; }

/* ---------- layout ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: var(--space-xl); }
.page-narrow { max-width: 760px; margin: 0 auto; padding: var(--space-xl); }
.layout-rail { display: grid; grid-template-columns: 200px 1fr; gap: var(--space-xl); }
@media (max-width: 900px) { .layout-rail { grid-template-columns: 1fr; } }
.section { margin-bottom: var(--space-2xl); }
.section > .h2, .section > .h3 { margin-bottom: var(--space-lg); }

/* filter rail */
.filter-rail { display: flex; flex-direction: column; gap: var(--space-sm); align-items: flex-start; }
.filter-rail .label-caps { color: var(--text-muted); margin: var(--space-md) 0 var(--space-xs); }

/* card grid */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-md); }

/* ---------- components ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-lg);
  display: flex; flex-direction: column; gap: var(--space-sm);
  position: relative;
}
.card:hover { background: var(--surface-alt); border-color: var(--border-strong); }
.card.card-breaking { border-left: 2px solid var(--sev-breaking); box-shadow: var(--shadow-breaking-glow); }
.card .name-row { display: flex; align-items: baseline; gap: var(--space-sm); }
.card .name-row .h3 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .headline { color: var(--text-secondary); font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge-source {
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  background: var(--surface-alt); border-radius: var(--r-sm);
  padding: 2px var(--space-xs);
}
.badge-source.src-brew { color: var(--src-brew); }
.badge-source.src-npm { color: var(--src-npm); }
.badge-source.src-app { color: var(--src-app); }
.badge-source.src-local { color: var(--src-local); }

.pill {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  border-radius: var(--r-full);
  padding: 2px var(--space-sm);
  font-size: 0.75rem; font-family: var(--font-mono); font-weight: 500;
}
.pill-fresh   { color: var(--dust-fresh);   background: color-mix(in srgb, var(--dust-fresh) 12%, transparent); }
.pill-idle    { color: var(--dust-idle);    background: color-mix(in srgb, var(--dust-idle) 12%, transparent); }
.pill-dusty   { color: var(--dust-dusty);   background: color-mix(in srgb, var(--dust-dusty) 12%, transparent); }
.pill-unknown { color: var(--dust-unknown); background: color-mix(in srgb, var(--dust-unknown) 12%, transparent); }
.pill-breaking { color: var(--sev-breaking); background: color-mix(in srgb, var(--sev-breaking) 12%, transparent); }
.pill-behavior { color: var(--sev-behavior); background: color-mix(in srgb, var(--sev-behavior) 12%, transparent); }
.pill-feature  { color: var(--sev-feature);  background: color-mix(in srgb, var(--sev-feature) 12%, transparent); }
.pill-fix      { color: var(--sev-fix);      background: color-mix(in srgb, var(--sev-fix) 12%, transparent); }
.pill-sev-unknown { color: var(--sev-unknown); background: color-mix(in srgb, var(--sev-unknown) 12%, transparent); }

.version-line { font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 500; display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; }
.version-line .old, .version-line .arrow { color: var(--text-muted); }
.version-line .new { color: var(--state-unseen); }
.version-line .current { color: var(--state-current); }

.command-chip {
  display: inline-flex; align-items: center; gap: var(--space-sm);
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500;
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--space-xs) var(--space-sm);
  cursor: pointer; color: var(--text-primary);
}
.command-chip:hover { border-color: var(--border-strong); }
.command-chip .dollar { color: var(--text-muted); }
.command-chip .copy { color: var(--accent); }
.command-chip.copied .copy { color: var(--state-current); }

.unseen-counter {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--r-full);
  background: var(--accent); color: var(--accent-text);
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500;
}
.unseen-counter.has-breaking { background: var(--sev-breaking); color: #FFFFFF; }

.filter-chip {
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  background: var(--surface-alt); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--r-full);
  padding: var(--space-xs) var(--space-md); cursor: pointer;
}
.filter-chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.filter-chip.chip-breaking[aria-pressed="true"] { background: var(--sev-breaking); color: #FFFFFF; border-color: var(--sev-breaking); }

/* release rows (tool detail / digest) */
.release-row {
  display: grid; grid-template-columns: auto auto 1fr auto; gap: var(--space-md);
  align-items: baseline;
  padding: var(--space-md); border-bottom: 1px solid var(--border);
}
.release-row:last-child { border-bottom: none; }
.release-row .date { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.75rem; }

/* digest inbox */
.briefing {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  margin-bottom: var(--space-xl); overflow: hidden;
}
.briefing.unread { border-left: 2px solid var(--accent); }
.briefing-header { padding: var(--space-lg); border-bottom: 1px solid var(--border); display: flex; align-items: baseline; gap: var(--space-md); }
.finding { padding: var(--space-lg); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: var(--space-sm); }
.finding:last-child { border-bottom: none; }
.finding.finding-breaking { border-left: 2px solid var(--sev-breaking); }
.finding .finding-head { display: flex; align-items: baseline; gap: var(--space-md); flex-wrap: wrap; }

/* skeletons (loading) */
.skeleton { background: var(--surface-alt); border-radius: var(--r-md); min-height: 14px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }
.progress-line { height: 2px; background: var(--accent); width: 38%; border-radius: var(--r-full); animation: slide 1.6s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: 0; width: 20%; } 50% { margin-left: 40%; width: 38%; } 100% { margin-left: 80%; width: 20%; } }

/* notices */
.notice { color: var(--text-secondary); font-size: 0.8125rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--space-sm) var(--space-md); }

/* ---------- terminal ---------- */
.terminal {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-lg);
  font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 500; line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  color: var(--text-primary);
}
.terminal .t-dim { color: var(--text-muted); }
.terminal .t-sec { color: var(--text-secondary); }
.terminal .t-accent { color: var(--accent); }
.terminal .t-breaking { color: var(--sev-breaking); font-weight: 700; }
.terminal .t-behavior { color: var(--sev-behavior); }
.terminal .t-feature { color: var(--sev-feature); }
.terminal .t-fix { color: var(--sev-fix); }
.terminal .t-fresh { color: var(--dust-fresh); }
.terminal .t-idle { color: var(--dust-idle); }
.terminal .t-dusty { color: var(--dust-dusty); }
.terminal .t-unknown { color: var(--dust-unknown); }

/* ---------- design-system helpers ---------- */
.swatch-row { display: flex; flex-wrap: wrap; gap: var(--space-md); }
.swatch { width: 180px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.swatch .chip { height: 44px; }
.swatch .meta { padding: var(--space-sm) var(--space-md); }

/* segmented bar (report) */
.seg-bar { display: flex; height: 14px; border-radius: var(--r-full); overflow: hidden; border: 1px solid var(--border); }
.seg-fresh { background: var(--dust-fresh); }
.seg-idle { background: var(--dust-idle); }
.seg-dusty { background: var(--dust-dusty); }
.seg-unknown { background: var(--dust-unknown); }
.legend { display: flex; gap: var(--space-lg); flex-wrap: wrap; margin-top: var(--space-sm); }
.legend .item { display: inline-flex; gap: var(--space-xs); align-items: center; font-size: 0.75rem; font-family: var(--font-mono); color: var(--text-secondary); }
