/* ==========================================================================
   Theme palettes — hex values copied verbatim from shiki-config's own
   theme definitions (shiki-config/src/themes/*.rs), not approximated, so
   this site's theme switcher is pixel-faithful to what the actual TUI
   renders with the same theme name selected.
   ========================================================================== */

:root,
[data-theme="gruvbox-dark"] {
  --bg: #282828;
  --fg: #ebdbb2;
  --accent: #458588;
  --selection: #3c3836;
  --border: #504945;
  --statusbar: #1d2021;
  --success: #98971a;
  --warning: #d79921;
  --error: #cc241d;
  --muted: #a89984;
  --panel-title: #d3869b;
}

[data-theme="gruvbox-light"] {
  --bg: #fbf1c7;
  --fg: #3c3836;
  --accent: #458588;
  --selection: #ebdbb2;
  --border: #d5c4a1;
  --statusbar: #f2e5bc;
  --success: #98971a;
  --warning: #d79921;
  --error: #cc241d;
  --muted: #7c6f64;
  --panel-title: #8f3f71;
}

[data-theme="catppuccin-mocha"] {
  --bg: #1e1e2e;
  --fg: #cdd6f4;
  --accent: #89b4fa;
  --selection: #45475a;
  --border: #313244;
  --statusbar: #181825;
  --success: #a6e3a1;
  --warning: #fab387;
  --error: #f38ba8;
  --muted: #a6adc8;
  --panel-title: #f5c2e7;
}

[data-theme="catppuccin-macchiato"] {
  --bg: #24273a;
  --fg: #cad3f5;
  --accent: #8aadf4;
  --selection: #494d64;
  --border: #363a4f;
  --statusbar: #1e2030;
  --success: #a6da95;
  --warning: #f5a97f;
  --error: #ed8796;
  --muted: #a5adcb;
  --panel-title: #f5bde6;
}

[data-theme="catppuccin-frappe"] {
  --bg: #303446;
  --fg: #c6d0f5;
  --accent: #8caaee;
  --selection: #484d6d;
  --border: #414559;
  --statusbar: #292c3c;
  --success: #a6d189;
  --warning: #ef9f76;
  --error: #e78284;
  --muted: #a5adce;
  --panel-title: #f4b8e4;
}

[data-theme="catppuccin-latte"] {
  --bg: #eff1f5;
  --fg: #4c4f69;
  --accent: #1e66f5;
  --selection: #ccd0da;
  --border: #bcc0cc;
  --statusbar: #e6e9ef;
  --success: #40a02b;
  --warning: #fe640b;
  --error: #d20f39;
  --muted: #6c6f85;
  --panel-title: #ea76cb;
}

[data-theme="tokyo-night-storm"] {
  --bg: #24283b;
  --fg: #c0caf5;
  --accent: #7aa2f7;
  --selection: #364a82;
  --border: #414868;
  --statusbar: #1f2335;
  --success: #9ece6a;
  --warning: #e0af68;
  --error: #f7768e;
  --muted: #565f89;
  --panel-title: #7dcfff;
}

[data-theme="tokyo-night"] {
  --bg: #1a1b26;
  --fg: #c0caf5;
  --accent: #7aa2f7;
  --selection: #283457;
  --border: #292e42;
  --statusbar: #16161e;
  --success: #9ece6a;
  --warning: #e0af68;
  --error: #f7768e;
  --muted: #565f89;
  --panel-title: #7dcfff;
}

[data-theme="tokyo-night-moon"] {
  --bg: #222436;
  --fg: #c8d3f5;
  --accent: #82aaff;
  --selection: #2d3f76;
  --border: #2f334d;
  --statusbar: #1e2030;
  --success: #c3e88d;
  --warning: #ffc777;
  --error: #ff757f;
  --muted: #636da6;
  --panel-title: #86e1fc;
}

[data-theme="nord"] {
  --bg: #2e3440;
  --fg: #d8dee9;
  --accent: #88c0d0;
  --selection: #434c5e;
  --border: #3b4252;
  --statusbar: #242933;
  --success: #a3be8c;
  --warning: #d08770;
  --error: #bf616a;
  --muted: #8fbcbb;
  --panel-title: #81a1c1;
}

[data-theme="solarized-dark"] {
  --bg: #002b36;
  --fg: #839496;
  --accent: #268bd2;
  --selection: #073642;
  --border: #586e75;
  --statusbar: #073642;
  --success: #859900;
  --warning: #cb4b16;
  --error: #dc322f;
  --muted: #657b83;
  --panel-title: #d33682;
}

[data-theme="solarized-light"] {
  --bg: #fdf6e3;
  --fg: #657b83;
  --accent: #268bd2;
  --selection: #eee8d5;
  --border: #93a1a1;
  --statusbar: #eee8d5;
  --success: #859900;
  --warning: #cb4b16;
  --error: #dc322f;
  --muted: #839496;
  --panel-title: #d33682;
}

/* ==========================================================================
   Base
   ========================================================================== */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  background: var(--bg);
  color: var(--fg);
  transition: background-color 0.25s ease, color 0.25s ease;
  line-height: 1.6;
}

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

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

section {
  padding: 88px 0;
  border-bottom: 1px solid var(--border);
}

section:last-of-type {
  border-bottom: none;
}

h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

h2 {
  font-size: 2rem;
  color: var(--panel-title);
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.muted {
  color: var(--muted);
}

code, .code {
  font-family: inherit;
  background: var(--selection);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.9em;
}

/* ==========================================================================
   Top bar
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--statusbar);
  border-bottom: 1px solid var(--border);
}

.topbar .brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar .brand .cursor {
  display: inline-block;
  width: 10px;
  height: 1.1em;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.topbar nav {
  display: flex;
  gap: 24px;
  font-size: 0.9rem;
}

.topbar nav a {
  color: var(--muted);
}

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

/* ==========================================================================
   Buttons / pills
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.btn-primary:hover {
  filter: brightness(1.08);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--fg);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 6px 6px 0;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  padding-top: 96px;
  padding-bottom: 64px;
  border-bottom: 1px solid var(--border);
}

.hero .container {
  max-width: 1280px;
}

.hero-grid {
  display: grid;
  /* Screenshot column deliberately wider than the text column — the first
     thing a visitor should register is "this is a real, detailed terminal
     app", not a wall of marketing copy. */
  grid-template-columns: 0.85fr 1.35fr;
  gap: 56px;
  align-items: center;
}

.hero h1 {
  font-size: 3rem;
  line-height: 1.08;
}

.hero h1 .hl {
  color: var(--accent);
}

.hero p.lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 46ch;
  margin-bottom: 32px;
}

.hero .cta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.hero .install-hint {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Fake terminal window chrome wrapping the real screenshots */
.term-window {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--statusbar);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.5);
}

.term-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--statusbar);
  border-bottom: 1px solid var(--border);
}

.term-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}
.term-dot.red { background: var(--error); }
.term-dot.yellow { background: var(--warning); }
.term-dot.green { background: var(--success); }

.term-titlebar .term-title {
  margin-left: 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.term-window img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg);
}

/* `.term-window img`'s own `display: block` above is more specific than the
   browser's default `[hidden] { display: none }` UA rule, so without this,
   toggling `img.hidden = true` in main.js did nothing visually — the real
   screenshot from the last theme that had one stayed on screen, stacked
   above #term-fallback, instead of being replaced by it. This is why
   switching to a theme with no captured screenshot appeared to "not change
   anything": the stale image was still there, just no longer the theme
   actually selected. */
.term-window img[hidden] {
  display: none;
}

/* CSS-only fallback mockup, shown instead of a real screenshot for the 7
   palettes that don't have one captured yet (screenshots/scripts/screenshot.sh
   only ran for gruvbox-dark, catppuccin-mocha, tokyo-night-storm, nord, and
   solarized-dark) — showing a *real* screenshot baked with the wrong
   theme's pixel colors would be more misleading than a simple live mockup
   that genuinely recolors with the CSS variables above. */
.term-fallback {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1.8fr;
  gap: 0;
  background: var(--bg);
  min-height: 260px;
  font-size: 0.82rem;
}

.tf-col {
  border-right: 1px solid var(--border);
  padding: 10px 14px;
}

.tf-col:last-child {
  border-right: none;
}

.tf-title {
  color: var(--panel-title);
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 0.8rem;
}

.tf-item {
  padding: 3px 0;
  color: var(--muted);
}

.tf-item.active {
  color: var(--fg);
  background: var(--selection);
  padding: 3px 6px;
  margin: 0 -6px;
  border-radius: 3px;
}

.tf-line {
  color: var(--fg);
  margin-bottom: 6px;
}

/* ==========================================================================
   Features
   ========================================================================== */

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 40px;
}

.feature-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  background: var(--statusbar);
}

.feature-card .icon {
  font-size: 1.4rem;
  color: var(--accent);
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
  color: var(--fg);
}

.feature-card p {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}

/* ==========================================================================
   Theme switcher section
   ========================================================================== */

.theme-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 28px 0 36px;
}

.swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--statusbar);
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--muted);
  font-family: inherit;
}

.swatch:hover {
  border-color: var(--accent);
  color: var(--fg);
}

.swatch.active {
  border-color: var(--accent);
  color: var(--fg);
  box-shadow: 0 0 0 1px var(--accent);
}

.swatch .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.theme-note {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 12px;
}

/* ==========================================================================
   Install
   ========================================================================== */

.install-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 32px;
}

.install-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  background: var(--statusbar);
}

.install-card h3 {
  font-size: 0.95rem;
  margin-bottom: 10px;
  color: var(--fg);
}

.install-card pre {
  margin: 0;
  overflow-x: auto;
  font-size: 0.85rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 56px 12px 12px;
}

.code-block {
  position: relative;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-family: inherit;
  font-weight: 700;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--statusbar);
  color: var(--muted);
  cursor: pointer;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.copy-btn.copied {
  color: var(--success);
  border-color: var(--success);
}

.copy-btn-inline {
  position: static;
  margin-left: 4px;
  vertical-align: middle;
}

/* ==========================================================================
   Docs (homepage teaser — the actual reference content lives on its own
   page, documentation.html, not duplicated here)
   ========================================================================== */

.docs-cta {
  text-align: center;
}

.docs-cta .eyebrow,
.docs-cta p {
  margin-left: auto;
  margin-right: auto;
}

.docs-cta .btn {
  margin-top: 20px;
}

/* ==========================================================================
   Changelog
   ========================================================================== */

#changelog-content {
  margin-top: 32px;
}

#changelog-content h3 {
  color: var(--accent);
  font-size: 1.1rem;
  margin: 32px 0 6px;
}

#changelog-content h3:first-child {
  margin-top: 0;
}

#changelog-content .cl-date {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

#changelog-content h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 16px 0 6px;
}

#changelog-content ul {
  margin: 0 0 8px;
  padding-left: 20px;
}

#changelog-content li {
  margin-bottom: 6px;
  font-size: 0.92rem;
}

#changelog-content li::marker {
  color: var(--accent);
}

.changelog-loading, .changelog-error {
  color: var(--muted);
  font-size: 0.9rem;
}

.changelog-more {
  margin-top: 24px;
}

/* ==========================================================================
   Footer
   ========================================================================== */

footer.site-footer {
  padding: 48px 0;
  text-align: center;
}

footer.site-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

footer.site-footer .coffee-link {
  color: var(--warning);
  font-weight: 700;
}

footer.site-footer small {
  color: var(--muted);
  font-size: 0.8rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .features-grid, .install-grid {
    grid-template-columns: 1fr;
  }
  .hero h1 {
    font-size: 2.2rem;
  }
  .topbar nav {
    display: none;
  }
}
