/*
 * Typography — implements DESIGN.md §3 "Typography Rules".
 * Reads every value from shared/tokens.css. Mobile-first; the scale is compact
 * (10px–24px) by design, so it does not change across breakpoints.
 */

/* Inter 400/600/700 and JetBrains Mono 400/700 are the only weights the hierarchy uses. */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=JetBrains+Mono:wght@400;700&display=swap");

/* ---- Base ---- */

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-ui);
  font-size: var(--text-lg);
  font-weight: var(--weight-regular);
  line-height: var(--leading-relaxed);
  color: var(--color-foreground);
  background-color: var(--color-night);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---- Headings map to the hierarchy table ---- */

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  color: var(--color-foreground);
  text-wrap: balance;
}

/* Page Title — 24px / 700 / 1.20 */
h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
}

/* Section Heading — 18px / 600 / 1.30 */
h2 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
}

/* Emphasis — 16px / 700 / 1.40 */
h3 {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  line-height: var(--leading-normal);
}

/* Anything deeper collapses to the 14px semibold used for channel names and buttons */
h4, h5, h6 {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-normal);
}

/* ---- Body copy ---- */

p {
  margin: 0 0 var(--space-4);
}

p:last-child {
  margin-bottom: 0;
}

strong, b {
  font-weight: var(--weight-bold);
}

small {
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  color: var(--color-comment);
}

a {
  color: var(--color-cyan);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:focus-visible {
  outline: none;
  border-radius: var(--radius-subtle);
  box-shadow: var(--glow-purple);
}

/* ---- Machine voice: everything system-produced is mono ---- */

code, kbd, samp, pre, time {
  font-family: var(--font-mono);
}

code, kbd, samp {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

pre {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--color-foreground);
  background-color: var(--color-deep-night);
  border-radius: var(--radius-standard);
  overflow-x: auto;
}

pre code {
  font-size: inherit;
}

/* ---- Role classes: one per row of the hierarchy table ---- */

.text-page-title {
  font-family: var(--font-ui);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--color-foreground);
}

.text-section-heading {
  font-family: var(--font-ui);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  color: var(--color-foreground);
}

.text-emphasis {
  font-family: var(--font-ui);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  line-height: var(--leading-normal);
  color: var(--color-foreground);
}

.text-body {
  font-family: var(--font-ui);
  font-size: var(--text-lg);
  font-weight: var(--weight-regular);
  line-height: var(--leading-relaxed);
  color: var(--color-foreground);
}

.text-nav {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-comment);
}

.text-nav--active {
  font-weight: var(--weight-bold);
  color: var(--color-foreground);
}

.text-button {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-none);
  letter-spacing: var(--tracking-button);
}

.text-channel {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-normal);
  color: var(--color-comment);
}

.text-channel--active {
  color: var(--color-foreground);
}

/* The "#" prefix stays muted even when the channel is active */
.text-channel__hash {
  color: var(--color-comment);
}

.text-caption {
  font-family: var(--font-ui);
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-comment);
}

.text-timestamp {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: var(--leading-relaxed);
  color: var(--color-comment);
  font-variant-numeric: tabular-nums;
}

.text-badge {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-badge);
  text-transform: uppercase;
}

.text-bot-label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  line-height: var(--leading-none);
  text-transform: uppercase;
  color: var(--color-night);
  background-color: var(--color-cyan);
  padding: var(--space-0-5) var(--space-1);
  border-radius: var(--radius-subtle);
}

/* ---- Color modifiers: color is earned, not decorative ---- */

.text-muted     { color: var(--color-comment); }
.text-tertiary  { color: var(--color-purple-tint); }
.text-success   { color: var(--color-green); }
.text-danger    { color: var(--color-red); }
.text-warning   { color: var(--color-orange); }
.text-attention { color: var(--color-yellow); }
.text-info      { color: var(--color-cyan); }
.text-live      { color: var(--color-pink); }

/* ---- Utilities ---- */

.text-mono {
  font-family: var(--font-mono);
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-clamp-2,
.text-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.text-clamp-2 { -webkit-line-clamp: 2; }
.text-clamp-3 { -webkit-line-clamp: 3; }

.text-tabular {
  font-variant-numeric: tabular-nums;
}
