/* TTYper web. Token names and values follow the design system's tokens.json.
   Light is the default; dark follows prefers-color-scheme; the contrast theme
   applies under prefers-contrast: more and forced-colors. */
:root {
  color-scheme: light dark;
  --surface: #f7f6f2;
  --surface-raised: #ffffff;
  --surface-sunken: #ecebe5;
  --ink: #151918;
  --ink-muted: #5c6562;
  --hairline: #d6d4cc;
  --border-strong: #7b837f;
  --accent: #006b6b;
  --on-accent: #ffffff;
  --key-hint: #7a5c00;
  --correct: #2a6f2e;
  --incorrect: #b3261e;
  --term-accent: #00afaf;
  --term-hint: #d7af00;
  --term-correct: #5faf5f;
  --term-incorrect: #d75f5f;
  --term-muted: #767676;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --radius-0: 0;
  --radius-sm: 4px;
  --radius-md: 8px;
  --measure: 44rem;
  --measure-wide: 68rem;
  --target-min: 44px;
  --focus-width: 3px;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --font-sans: system-ui, -apple-system, "Segoe UI", "Noto Sans", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #101313;
    --surface-raised: #181c1c;
    --surface-sunken: #0a0c0c;
    --ink: #e4e8e6;
    --ink-muted: #97a19d;
    --hairline: #2a3030;
    --border-strong: #68736f;
    --accent: #3cc8c8;
    --on-accent: #0a0c0c;
    --key-hint: #e3b71e;
    --correct: #6fc36f;
    --incorrect: #ff8080;
  }
}
@media (prefers-contrast: more), (forced-colors: active) {
  :root {
    --surface: #000000;
    --surface-raised: #0b0b0b;
    --surface-sunken: #000000;
    --ink: #ffffff;
    --ink-muted: #d0d0d0;
    --hairline: #9a9a9a;
    --border-strong: #bdbdbd;
    --accent: #5ff0f0;
    --on-accent: #000000;
    --key-hint: #ffd75f;
    --correct: #8af08a;
    --incorrect: #ff9c9c;
    color-scheme: dark;
  }
}

/* Base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface); color: var(--ink); font-family: var(--font-sans); font-size: 17px; line-height: 28px; }
a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: var(--focus-width) solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-mono); font-weight: 700; color: var(--ink); }
h1 { margin: 0 0 var(--space-6); font-size: 30px; line-height: 38px; }
h2 { margin: var(--space-12) 0 var(--space-6); font-size: 20px; line-height: 28px; }
h3 { margin: var(--space-6) 0 var(--space-2); font-size: 17px; line-height: 26px; }
p { margin: 0 0 var(--space-4); }
code { font-family: var(--font-mono); font-size: 0.94em; overflow-wrap: anywhere; }
.tt-label { font-family: var(--font-mono); font-size: 13px; line-height: 18px; font-weight: 600; letter-spacing: 0.3px; color: var(--ink-muted); }
.tt-small { font-size: 14px; line-height: 22px; }
.tt-muted { color: var(--ink-muted); }

.tt-skip { position: absolute; left: -9999px; top: var(--space-2); z-index: 1; padding: var(--space-2) var(--space-4);
  background: var(--surface-raised); border: 1px solid var(--border-strong); }
.tt-skip:focus { left: var(--space-2); }

/* Page column */
.tt-wrap { max-width: var(--measure); margin: 0 auto; padding: 0 var(--space-4); }
.tt-wrap.tt-wide { max-width: var(--measure-wide); }
@media (min-width: 40rem) { .tt-wrap { padding: 0 var(--space-6); } }
.tt-main { padding: var(--space-12) 0 0; }
/* One outer width on every page keeps the header still; reading pages keep their text at measure. */
.tt-main { max-width: var(--measure); }
.tt-main.tt-main-wide { max-width: none; }
.tt-prose { max-width: var(--measure); }

/* SiteHeader */
.tt-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--space-2) var(--space-6); padding: var(--space-4) 0; border-bottom: 1px solid var(--hairline); }
.tt-wordmark { display: inline-flex; align-items: center; min-height: var(--target-min);
  font-family: var(--font-mono); font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; }
.tt-wordmark .tt-prompt { color: var(--accent); margin-right: var(--space-2); }
.tt-nav { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.tt-nav a { display: inline-flex; align-items: center; min-height: var(--target-min); padding: 0 var(--space-3);
  font-family: var(--font-mono); font-size: 14px; color: var(--ink-muted); text-decoration: none; border-radius: var(--radius-sm); }
.tt-nav a:hover { color: var(--ink); }
.tt-nav a[aria-current] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: 2px; text-underline-offset: 6px; }

/* Footer */
.tt-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-6); margin-top: var(--space-16);
  padding: var(--space-6) 0 var(--space-12); border-top: 1px solid var(--hairline);
  font-size: 14px; line-height: 22px; color: var(--ink-muted); }
.tt-footer a { display: inline-flex; align-items: center; min-height: var(--target-min); }

/* CommandBlock */
.tt-command { display: flex; align-items: center; gap: var(--space-3); margin: 0 0 var(--space-4); padding: var(--space-4) var(--space-6);
  background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  font-family: var(--font-mono); font-size: 18px; line-height: 1.45; overflow-x: auto; }
.tt-command .tt-prompt { color: var(--ink-muted); user-select: none; }
.tt-command code { color: var(--ink); font-size: inherit; font-weight: 700; white-space: nowrap; overflow-wrap: normal; }

/* Fingerprint */
.tt-fingerprint { margin: 0 0 var(--space-6); padding: var(--space-4) var(--space-6); background: var(--surface-raised);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md); }
.tt-fingerprint .tt-label { display: block; margin-bottom: var(--space-2); }
.tt-fingerprint code { display: block; font-size: 16px; line-height: 24px; color: var(--ink); overflow-wrap: anywhere; }

/* Landing */
.tt-hero { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-12); padding: var(--space-4) 0 var(--space-12); }
.tt-hero-text { flex: 1 1 22rem; min-width: 0; }
.tt-hero-text h1 { margin: var(--space-4) 0 var(--space-6); font-size: clamp(30px, 8vw, 44px); line-height: 1.15; letter-spacing: -0.5px; }
.tt-hero-text .tt-label { margin: 0; }
.tt-hero .tt-command { font-size: clamp(18px, 5vw, 24px); }
.tt-lead { margin: 0; font-size: 19px; line-height: 30px; color: var(--ink-muted); }
.tt-hero > .tt-term { flex: 1 1 28rem; }
.tt-section { padding: var(--space-12) 0; border-top: 1px solid var(--hairline); }
.tt-section h2 { margin-top: 0; }

/* Steps */
.tt-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-8);
  max-width: var(--measure); counter-reset: step; }
.tt-steps > li { position: relative; min-width: 0; padding-left: calc(2.25rem + var(--space-4)); counter-increment: step; }
.tt-steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 2.25rem; height: 2.25rem;
  display: grid; place-items: center; font-family: var(--font-mono); font-weight: 700; font-size: 15px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--accent); }
.tt-steps h3 { margin: 0 0 var(--space-2); line-height: 2.25rem; }
.tt-steps > li > :last-child { margin-bottom: 0; }

/* TerminalWindow: always a black ground, like a real terminal, so the term-*
   foreground values keep their contrast in every theme. */
.tt-term { min-width: 0; margin: 0; background: #000000; color: #e4e8e6; border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); overflow: hidden; }
.tt-term-bar { display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid #2a3030; font-family: var(--font-mono); font-size: 12px; line-height: 18px; color: #97a19d; }
.tt-term pre { margin: 0; padding: var(--space-4); font-family: var(--font-mono); font-size: 14px; line-height: 21px;
  color: #e4e8e6; white-space: pre; overflow-x: auto; }
.tt-term pre:focus-visible { outline-offset: -4px; }
.tt-term .t-mute { color: var(--term-muted); }
.tt-term .t-acc { color: var(--term-accent); }
.tt-term .t-hint { color: var(--term-hint); font-weight: 700; }
.tt-term .t-ok { color: var(--term-correct); }
.tt-term .t-bad { color: var(--term-incorrect); font-weight: 700; text-decoration: underline; }
.tt-term .t-err { color: var(--term-incorrect); font-weight: 700; }
.tt-term .t-b { font-weight: 700; }
.tt-term .t-rev { background: #e4e8e6; color: #000000; }
.tt-term .t-focus { background: #e4e8e6; color: #000000; font-weight: 700; }
/* Each feature is one row: an 80-column screen needs about 34rem, so panels never sit three abreast. */
.tt-features { display: grid; gap: var(--space-12); }
.tt-feature { display: grid; gap: var(--space-4) var(--space-8); align-items: center; min-width: 0; }
.tt-feature h3 { margin: 0; }
.tt-feature p { margin: 0; color: var(--ink-muted); max-width: 28rem; }
@media (min-width: 56rem) {
  .tt-feature { grid-template-columns: minmax(0, 36rem) minmax(0, 1fr); }
  .tt-feature > .tt-term { grid-row: 1 / span 2; }
  .tt-feature h3 { align-self: end; }
  .tt-feature p { align-self: start; }
}

/* Check list */
.tt-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); max-width: var(--measure); }
.tt-checks li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: var(--space-2); }
.tt-checks .tt-mark { color: var(--correct); font-family: var(--font-mono); font-weight: 700; }

/* Notice */
.tt-notice { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: var(--space-3); margin: 0 0 var(--space-6);
  padding: var(--space-4); border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface-raised); }
.tt-notice .tt-mark { font-family: var(--font-mono); font-weight: 700; }
.tt-notice.tt-ok .tt-mark { color: var(--correct); }
.tt-notice.tt-warn .tt-mark { color: var(--key-hint); }
.tt-notice.tt-err .tt-mark { color: var(--incorrect); }
.tt-notice p { margin: 0; overflow-wrap: anywhere; }
.tt-notice strong { display: block; font-family: var(--font-mono); }

/* Button */
.tt-button { display: inline-flex; align-items: center; justify-content: center; min-height: var(--target-min);
  padding: 0 var(--space-6); border-radius: var(--radius-sm); font: 600 16px/1 var(--font-sans); cursor: pointer;
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); text-decoration: none; }
.tt-button.tt-secondary { background: transparent; color: var(--ink); border-color: var(--border-strong); }

/* Legal */
.tt-links { padding-left: var(--space-6); }
.tt-links a { display: inline-flex; align-items: center; min-height: var(--target-min); }
.tt-legal { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-6) var(--space-12); }
.tt-toc { flex: 1 1 12rem; max-width: 15rem; }
.tt-toc .tt-label { margin: 0 0 var(--space-2); }
.tt-toc ul { list-style: none; margin: 0; padding: 0; }
.tt-toc a { display: flex; align-items: center; min-height: var(--target-min); font-family: var(--font-mono); font-size: 14px;
  line-height: 20px; text-decoration: none; }
.tt-toc a:hover { text-decoration: underline; }
.tt-doc { flex: 999 1 30rem; min-width: 0; }
.tt-doc h2 { scroll-margin-top: var(--space-4); }
.tt-doc ul { padding-left: var(--space-6); }
.tt-doc li { margin-bottom: var(--space-2); }
.tt-table { margin: 0 0 var(--space-6); overflow-x: auto; border: 1px solid var(--border-strong); border-radius: var(--radius-md); }
.tt-table table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 24px; }
.tt-table th, .tt-table td { padding: var(--space-2) var(--space-3); text-align: left; vertical-align: top; border-bottom: 1px solid var(--hairline); }
.tt-table th { font-family: var(--font-mono); font-size: 14px; background: var(--surface-raised); }
.tt-table tr:last-child td { border-bottom: 0; }
.tt-code { margin: 0 0 var(--space-6); padding: var(--space-4); background: var(--surface-sunken); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); font-family: var(--font-mono); font-size: 14px; line-height: 21px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tt-code code { font-size: inherit; }

/* Forced colours: system colours replace the palette; keep the caret, focus
   row and focus ring visible. */
@media (forced-colors: active) {
  .tt-term .t-rev, .tt-term .t-focus { forced-color-adjust: none; background: CanvasText; color: Canvas; }
  a:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline-color: Highlight; }
  .tt-nav a[aria-current] { text-decoration-color: currentColor; }
}
