/**
 * NEBO Phase 7 — Typography & Technical Surfaces
 * Token-driven type scale, mono strategy, code blocks, terminals, statistics.
 * Load after nebo-components.css. Does not change layouts.
 */

/* ═══════════════════════════════════════════════════════════════
   BASE & TYPE SCALE UTILITIES
   ═══════════════════════════════════════════════════════════════ */

body.nebo-dreams-app,
body.nebo-dreams-public,
body.nebo-dreams-auth {
  font-family: var(--nebo-font-sans);
  font-size: var(--nebo-type-body-size);
  line-height: var(--token-type-body-line);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.nebo-text-display {
  font-size: var(--nebo-type-display-size);
  font-weight: var(--token-type-display-weight);
  line-height: var(--token-type-display-line);
  letter-spacing: -0.02em;
}

.nebo-text-h1,
.nebo-mc-hero__title {
  font-size: var(--nebo-type-h1-size);
  font-weight: var(--token-type-h1-weight);
  line-height: var(--token-type-h1-line);
  letter-spacing: -0.015em;
}

.nebo-text-h2,
.nebo-mc-card__title,
.nebo-card__title {
  font-size: var(--nebo-type-h2-size);
  font-weight: var(--token-type-h2-weight);
  line-height: var(--token-type-h2-line);
}

.nebo-text-h3,
.nebo-cw-section__title,
.nebo-cw-solve-panel__title,
.nebo-mc-rail__title {
  font-size: var(--nebo-type-h3-size);
  font-weight: var(--token-type-h3-weight);
  line-height: var(--token-type-h3-line);
}

.nebo-text-h4,
.nebo-player-page .page-title h4,
.nebo-dashboard .page-title h4,
.nebo-admin-page .page-title h4,
.nebo-console-page .page-title h4,
.teams-page-title,
.leaderboard-page-title {
  font-size: var(--nebo-type-h4-size);
  font-weight: var(--token-type-h4-weight);
  line-height: var(--token-type-h4-line);
}

.nebo-text-body-lg,
.nebo-cw-prose,
.nebo-prose {
  font-size: var(--nebo-type-body-lg-size);
  line-height: var(--token-type-body-lg-line);
}

.nebo-text-body {
  font-size: var(--nebo-type-body-size);
  line-height: var(--token-type-body-line);
}

.nebo-text-caption,
.text-muted.fs-13,
.nebo-mc-card__subtitle,
.nebo-dashboard-recent-item__main .fs-13 {
  font-size: var(--nebo-type-caption-size);
  line-height: var(--token-type-caption-line);
}

.nebo-text-label,
.nebo-mc-stat__label,
.nebo-stat__label,
.nebo-mc-rail__dl dt,
.nebo-cw-solve-stats dt,
.leaderboard-mobile-label {
  font-size: var(--nebo-type-label-size);
  font-weight: var(--token-type-label-weight);
  line-height: var(--token-type-label-line);
  letter-spacing: var(--token-type-label-tracking);
  text-transform: uppercase;
  color: var(--token-text-on-light-muted);
}

.nebo-player-page .page-title p,
.nebo-dashboard .page-title p,
.leaderboard-page-subtitle {
  font-size: var(--nebo-type-caption-size);
  line-height: var(--token-type-caption-line);
  color: var(--token-text-on-light-muted);
  max-width: var(--nebo-measure-narrow, var(--token-measure-narrow));
}

.nebo-cw-prose,
.nebo-prose,
.nebo-learning-article {
  max-width: var(--nebo-measure-prose);
}

.nebo-cw-header__title {
  font-size: var(--nebo-type-h1-size);
  font-weight: var(--token-type-h1-weight);
  line-height: var(--token-type-h1-line);
}

/* ═══════════════════════════════════════════════════════════════
   JETBRAINS MONO — technical contexts only
   ═══════════════════════════════════════════════════════════════ */

.nebo-mono,
.nebo-text-mono,
.nebo-ctf-terminal,
.nebo-terminal-surface,
.nebo-terminal,
.nebo-code-block__pre,
.nebo-code-block__pre code,
.nebo-code-inline,
.nebo-doc-code,
.nebo-doc-code code,
.nebo-cw .flag-input,
.nebo-flag-panel .flag-input,
.nebo-form-flag .form-control,
.instance-url-text,
.nebo-cw-prose code,
.nebo-cw-flag-format code,
.nebo-terminal-host,
.nebo-terminal-port,
.nebo-challenge-id,
.nebo-submission-hash {
  font-family: var(--nebo-font-mono);
  font-size: var(--nebo-type-mono-size);
  line-height: var(--token-type-mono-line);
  font-variant-numeric: tabular-nums;
}

.nebo-code-inline,
.nebo-cw-prose code:not(.nebo-code-block code),
.nebo-doc-article code:not(.nebo-doc-code code) {
  font-size: 0.92em;
  padding: 0.12rem 0.35rem;
  border-radius: var(--token-radius-xs);
  background: var(--token-code-bg-light);
  color: var(--token-text-on-light-primary);
  border: 1px solid var(--token-code-border-light);
}

/* ═══════════════════════════════════════════════════════════════
   CODE BLOCKS
   ═══════════════════════════════════════════════════════════════ */

.nebo-code-block,
.nebo-doc-code {
  position: relative;
  background: var(--token-code-bg);
  color: var(--token-code-text);
  border: 1px solid var(--token-code-border);
  border-radius: var(--token-radius-sm);
  margin: 0 0 var(--token-space-4);
  overflow: hidden;
}

.nebo-code-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--token-space-3);
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--token-code-border);
  background: rgba(255, 255, 255, 0.03);
}

.nebo-code-block__lang {
  font-size: var(--nebo-type-label-size);
  font-weight: var(--token-type-label-weight);
  letter-spacing: var(--token-type-label-tracking);
  text-transform: uppercase;
  color: var(--token-text-muted);
}

.nebo-code-block__copy {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  font-size: var(--nebo-type-label-size);
  font-weight: var(--token-type-label-weight);
  color: var(--token-text-secondary);
  background: transparent;
  border: 1px solid var(--token-border);
  border-radius: var(--token-radius-xs);
  cursor: pointer;
  transition: color var(--token-duration-fast), border-color var(--token-duration-fast);
}

.nebo-code-block__copy:hover {
  color: var(--token-brand-primary-light);
  border-color: var(--token-brand-primary-border);
}

.nebo-code-block__copy:focus-visible {
  outline: 2px solid rgba(var(--token-brand-rgb), 0.85);
  outline-offset: 2px;
}

.nebo-code-block__copy.is-copied {
  color: var(--token-brand-primary);
  border-color: var(--token-brand-primary-border);
}

.nebo-code-block__pre,
.nebo-doc-code {
  margin: 0;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nebo-code-block__pre code,
.nebo-doc-code code {
  display: block;
  white-space: pre;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
}

body.nebo-dreams-app.nebo-app .nebo-code-block--light,
body.nebo-dreams-app.nebo-app .nebo-learning .nebo-code-block {
  background: var(--token-code-bg-light);
  color: var(--token-code-text-light);
  border-color: var(--token-code-border-light);
}

body.nebo-dreams-app.nebo-app .nebo-code-block--light .nebo-code-block__header {
  background: var(--token-surface-light-elevated);
  border-bottom-color: var(--token-code-border-light);
}

/* ═══════════════════════════════════════════════════════════════
   TERMINAL SURFACES
   ═══════════════════════════════════════════════════════════════ */

.nebo-terminal,
.nebo-ctf-terminal,
.nebo-terminal-surface {
  background: var(--token-terminal-bg);
  border: 1px solid var(--token-terminal-border);
  border-left: 3px solid var(--token-terminal-accent-border);
  border-radius: var(--token-radius-sm);
  padding: 1rem 1.15rem;
  font-family: var(--nebo-font-mono);
  font-size: var(--nebo-type-mono-size);
  line-height: var(--token-type-mono-line);
  color: var(--token-terminal-text);
}

.nebo-terminal-line,
.nebo-ctf-terminal-line {
  margin-bottom: 0.45rem;
  word-break: break-word;
}

.nebo-terminal-line:last-child,
.nebo-ctf-terminal-line:last-child {
  margin-bottom: 0;
}

.nebo-terminal-prompt,
.nebo-ctf-terminal-line > span:first-child {
  color: var(--token-terminal-prompt);
  user-select: none;
}

.nebo-terminal-cursor,
.nebo-ctf-terminal-cursor {
  display: inline-block;
  width: 2px;
  height: 0.95em;
  background-color: var(--token-terminal-prompt);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: nebo-terminal-blink 1.1s step-end infinite;
}

@keyframes nebo-terminal-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .nebo-terminal-cursor,
  .nebo-ctf-terminal-cursor {
    animation: none;
    opacity: 0.85;
  }
}

.nebo-cw-instance .instance-url-text,
.nebo-instance-url {
  font-family: var(--nebo-font-mono);
  font-size: var(--nebo-type-mono-size);
  letter-spacing: 0.01em;
}

/* ═══════════════════════════════════════════════════════════════
   STATISTICS PRESENTATION
   ═══════════════════════════════════════════════════════════════ */

.nebo-stat,
.nebo-mc-stat {
  text-align: center;
}

.nebo-stat__value,
.nebo-mc-stat__value,
.nebo-mc-rail__dl dd,
.nebo-cw-solve-stats dd,
.leaderboard-points,
.leaderboard-mobile-value,
.leaderboard-rank,
.nebo-mc-hero__stat-value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.nebo-stat__value,
.nebo-mc-stat__value {
  display: block;
  font-size: clamp(1.125rem, 2vw, 1.35rem);
  font-weight: 700;
  line-height: var(--token-line-height-tight);
  color: var(--token-text-on-light-primary);
}

.nebo-stat__label,
.nebo-mc-stat__label {
  display: block;
  margin-top: 0.2rem;
}

.nebo-mc-rail__dl dd {
  font-size: var(--nebo-type-body-lg-size);
  font-weight: 700;
}

.nebo-mc-rail__dl dt {
  font-weight: var(--token-type-label-weight);
}

.nebo-cw-solve-stats dd {
  font-size: var(--nebo-type-body-size);
  font-weight: 600;
  margin: 0;
}

.nebo-cw-solve-stats dt {
  margin-bottom: 0.15rem;
}

.nebo-mc-hero__stat-value {
  font-size: var(--nebo-type-body-lg-size);
  font-weight: 700;
}

.nebo-mc-hero__stat-label {
  font-size: var(--nebo-type-label-size);
  letter-spacing: var(--token-type-label-tracking);
  text-transform: uppercase;
}

.nebo-stat__value--percent,
.nebo-mc-progress-ring__value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════
   DATA DENSITY — scanability
   ═══════════════════════════════════════════════════════════════ */

.nebo-table th,
.nebo-dashboard-table th,
.leaderboard-table th {
  font-size: var(--nebo-type-label-size);
  letter-spacing: var(--token-type-label-tracking);
  font-weight: var(--token-type-label-weight);
}

.leaderboard-table .leaderboard-points {
  font-size: var(--nebo-type-body-lg-size);
  font-weight: 700;
}

.leaderboard-username {
  font-size: var(--nebo-type-body-size);
  font-weight: 600;
}

.leaderboard-name,
.leaderboard-muted,
.leaderboard-solve-time,
.leaderboard-country {
  font-size: var(--nebo-type-caption-size);
}

.leaderboard-section-title {
  font-size: var(--nebo-type-h3-size);
  font-weight: var(--token-type-h3-weight);
}

.nebo-dashboard-recent-item__title a {
  font-size: var(--nebo-type-body-size);
  font-weight: 600;
}

.nebo-admin-page .table td,
.nebo-console-page .table td {
  font-size: var(--nebo-type-body-size);
}

.nebo-admin-page .table th,
.nebo-console-page .table th {
  font-size: var(--nebo-type-label-size);
  text-transform: uppercase;
  letter-spacing: var(--token-type-label-tracking);
  font-weight: var(--token-type-label-weight);
  color: var(--token-text-on-light-muted);
}

.nebo-meta-row,
.nebo-dashboard-recent-item__main .text-muted,
.nebo-cw-header__meta {
  font-size: var(--nebo-type-caption-size);
  color: var(--token-text-on-light-muted);
}
