/* hc-tui GitHub Pages — dark-first Catppuccin Mocha palette with matching
   Catppuccin Latte light theme, matching hc-tui's built-in palettes. */

:root {
  color-scheme: dark light;

  --bg: #141420;
  --surface: #181825;
  --surface-elev: #1e1e2e;
  --surface-subtle: #242536;
  --code-bg: #11111b;
  --border: #313244;
  --border-strong: #45475a;

  --text: #cdd6f4;
  --text-muted: #a6adc8;
  --text-dim: #7f849c;

  --accent: #89b4fa;
  --accent-hover: #a6c7fc;
  --accent-fg: #11111b;
  --accent-soft: rgba(137, 180, 250, 0.14);

  /* Agent state markers (crates/hc-tui/src/chrome/status.rs + themes.rs) */
  --state-blocked: #f38ba8;
  --state-done: #94e2d5;
  --state-working: #f9e2af;
  --state-waiting: #fab387;
  --state-idle: #a6e3a1;
  --state-unknown: #6c7086;

  --frame-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
  --radius: 2px;

  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;

  --container: 1080px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #eff1f5;
    --surface: #f7f8fb;
    --surface-elev: #e6e9ef;
    --surface-subtle: #dce0e8;
    --code-bg: #e6e9ef;
    --border: #ccd0da;
    --border-strong: #acb0be;

    --text: #4c4f69;
    --text-muted: #5c5f77;
    --text-dim: #6c6f85;

    --accent: #1e66f5;
    --accent-hover: #1553cc;
    --accent-fg: #ffffff;
    --accent-soft: rgba(30, 102, 245, 0.1);

    /* Catppuccin Latte status palette */
    --state-blocked: #d20f39;
    --state-done: #179299;
    --state-working: #df8e1d;
    --state-waiting: #fe640b;
    --state-idle: #40a02b;
    --state-unknown: #8c8fa1;

    --frame-shadow: 0 10px 28px rgba(76, 79, 105, 0.14);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  overflow-x: clip;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-hover);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

code {
  font-size: 0.875em;
  background: var(--surface-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.08em 0.34em;
  overflow-wrap: anywhere;
}

h1 code,
h2 code,
h3 code {
  font-size: 0.9em;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--accent);
}

pre {
  margin: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

pre code {
  display: block;
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.55;
  overflow-wrap: normal;
  white-space: pre;
}

kbd {
  display: inline-block;
  font-size: 0.8125rem;
  line-height: 1.3;
  padding: 0.12rem 0.4rem;
  color: var(--text);
  background: var(--surface-elev);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius);
  white-space: nowrap;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--text);
}

p {
  margin: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.5rem 0.85rem;
  background: var(--accent);
  color: var(--accent-fg);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  left: 0.75rem;
  top: 0.75rem;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1rem;
}

/* Square state markers matching hc-tui's sidebar aesthetic */
.sq {
  display: inline-block;
  width: 0.5625rem;
  height: 0.5625rem;
  flex-shrink: 0;
  border-radius: 0;
  vertical-align: middle;
}

.sq--accent {
  background: var(--accent);
}

.sq--blocked {
  background: var(--state-blocked);
}

.sq--done {
  background: var(--state-done);
}

.sq--working {
  background: var(--state-working);
}

.sq--waiting {
  border: 1.5px dashed var(--state-waiting);
  background: transparent;
}

.sq--idle {
  border: 1.5px solid var(--state-idle);
  background: transparent;
}

.sq--unknown {
  background: var(--state-unknown);
  opacity: 0.7;
}

/* Top bar styled after hc-tui's tab strip */
.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding-block: 0.65rem;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.brand-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.65rem;
  background: var(--accent);
  color: var(--accent-fg);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius);
}

.brand-tab:hover {
  color: var(--accent-fg);
  background: var(--accent-hover);
}

.brand-note {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.nav a {
  display: inline-block;
  padding: 0.22rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
  background: var(--surface-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.nav a:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* Hero */
.hero {
  padding-block: 1.75rem 2.25rem;
  border-bottom: 1px solid var(--border);
}

.hero-head {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 1.35rem;
}

.eyebrow {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.eyebrow-markers {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.hero h1 {
  font-size: clamp(1.65rem, 3.8vw, 2.35rem);
  font-weight: 700;
}

.hero-lead {
  font-size: clamp(0.98rem, 1.8vw, 1.08rem);
  color: var(--text-muted);
  max-width: 66ch;
}

.hero-install {
  display: grid;
  gap: 0.5rem;
  max-width: 44rem;
}

.cmd-box {
  display: flex;
  align-items: stretch;
  background: var(--code-bg);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  min-width: 0;
}

.cmd-scroll {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.68rem 0.85rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.cmd-prompt {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  user-select: none;
  flex-shrink: 0;
}

.cmd-box pre {
  overflow: visible;
}

.cmd-box--multi .cmd-scroll {
  display: block;
}

.copy-btn {
  flex-shrink: 0;
  align-self: stretch;
  padding: 0 0.75rem;
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  cursor: pointer;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.copy-btn[hidden] {
  display: none;
}

.copy-btn:hover {
  background: var(--surface-elev);
  color: var(--text);
}

.copy-btn[data-copied="true"] {
  background: var(--accent);
  color: var(--accent-fg);
  border-left-color: var(--accent);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
  font-size: 0.86rem;
  color: var(--text-dim);
}

.hero-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

/* Terminal screenshot framing */
.shot {
  margin: 0;
  background: #181825;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--frame-shadow);
  overflow: hidden;
}

.shot--hero {
  border-color: var(--accent);
}

.shot img {
  width: 100%;
}

.shot figcaption {
  padding: 0.5rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

/* Sections */
.section {
  padding-block: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.section:last-of-type {
  border-bottom: 0;
}

.section-head {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1.5rem;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
}

.section-head h2 {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 700;
}

.section-head p {
  color: var(--text-muted);
  max-width: 66ch;
}

/* Features stack */
.features-stack {
  display: grid;
  gap: 1.5rem;
}

.feature-panel {
  display: grid;
  gap: 1.25rem;
  padding: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.feature-copy {
  display: grid;
  gap: 0.65rem;
  align-content: start;
}

.feature-title {
  font-size: 1.125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.feature-copy p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.feature-meta-list {
  margin: 0.15rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.feature-meta-list li {
  position: relative;
  padding-left: 0.95rem;
}

.feature-meta-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 0.375rem;
  height: 0.375rem;
  background: var(--border-strong);
}

/* Sidebar state markers legend */
.state-board {
  background: var(--surface-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
  display: grid;
  gap: 0.65rem;
  align-content: start;
}

.state-board-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}

.state-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.state-item {
  display: grid;
  grid-template-columns: auto minmax(5.6rem, auto) 1fr;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.875rem;
}

.state-name {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.state-desc {
  color: var(--text-muted);
  font-size: 0.84rem;
}

.state-foot {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
}

/* Media + copy feature rows */
.feature-row {
  display: grid;
  gap: 1.25rem;
  padding: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  align-items: center;
}

.feature-row .shot {
  box-shadow: none;
}

/* Paired cards for text-focused features */
.cards-2 {
  display: grid;
  gap: 1.25rem;
}

.card {
  display: grid;
  gap: 0.75rem;
  align-content: start;
  padding: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}

.card h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.waiting-code {
  font-weight: 500;
  color: var(--state-waiting);
}

.mini-kv {
  margin: 0.2rem 0 0;
  display: grid;
  gap: 0.45rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.mini-kv div {
  display: grid;
  gap: 0.12rem;
}

.mini-kv dt {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
}

.mini-kv dd {
  margin: 0;
  color: var(--text-muted);
}

/* Install & upgrade */
.install-layout {
  display: grid;
  gap: 1.25rem;
}

.install-cards {
  display: grid;
  gap: 1.25rem;
}

.stack-sm {
  display: grid;
  gap: 0.6rem;
  align-content: start;
  min-width: 0;
}

.subhead {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.note {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.compat-foot {
  margin-top: 0.9rem;
}

.env-list {
  margin: 0.1rem 0 0;
  display: grid;
  gap: 0.45rem;
  font-size: 0.86rem;
}

.env-list div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.55rem;
  align-items: baseline;
}

.env-list dt {
  font-family: var(--font-mono);
}

.env-list dd {
  margin: 0;
  color: var(--text-muted);
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

th,
td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

thead th {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--surface-elev);
  white-space: nowrap;
}

td {
  color: var(--text-muted);
}

td:first-child {
  color: var(--text);
}

.platforms-table td:first-child,
.platforms-table td:nth-child(2) {
  white-space: nowrap;
}

.platforms-table td:nth-child(3) {
  min-width: 13rem;
}

.compat-table td:first-child {
  min-width: 11.5rem;
}

.compat-table td:nth-child(4) {
  min-width: 15rem;
}

.cell-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text);
}

/* Getting started */
.start-grid {
  display: grid;
  gap: 1.5rem;
}

.keys-layout {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

.key-cell {
  white-space: nowrap;
}

/* Compatibility */
.compat-summary {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.compat-pill {
  padding: 0.95rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  display: grid;
  gap: 0.3rem;
}

.compat-pill--muted {
  border-left-color: var(--state-done);
}

.compat-pill h3 {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
}

.compat-pill p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Links & footer */
.site-footer {
  padding-block: 2.5rem 3rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.links-grid {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.link-col h3 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 0.7rem;
}

.link-col ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.42rem;
  font-size: 0.9rem;
}

.link-col a {
  text-decoration: none;
}

.link-col a:hover {
  text-decoration: underline;
}

.disclaimer {
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.65rem 1.5rem;
  font-size: 0.84rem;
  color: var(--text-dim);
}

.disclaimer strong {
  color: var(--text-muted);
  font-weight: 600;
}

/* Responsive breakpoints (mobile-first) */
@media (min-width: 640px) {
  .container {
    padding-inline: 1.5rem;
  }

  .compat-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .links-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 860px) {
  .hero {
    padding-block: 2.15rem 2.75rem;
  }

  .section {
    padding-block: 3.1rem;
  }

  .feature-panel {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    padding: 1.5rem;
    gap: 1.75rem;
    align-items: center;
  }

  .feature-row {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.45fr);
    padding: 1.5rem;
    gap: 1.75rem;
  }

  .feature-row--reverse {
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.95fr);
  }

  .feature-row--reverse .feature-copy {
    order: 2;
  }

  .feature-row--reverse .shot {
    order: 1;
  }

  .cards-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .install-cards {
    grid-template-columns: minmax(0, 1.28fr) minmax(0, 0.92fr);
    align-items: start;
  }

  .keys-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    align-items: start;
  }
}
