/* anygrade landing - dark, developer-forward, terminal-flavored.
   Palette adapts internal/web/static/app.css to a dark surface. */

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c2230;
  --line: #30363d;
  --fg: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;          /* app blue #1d4ed8, lightened for dark */
  --accent-strong: #388bfd;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 0.5rem;
  --radius-sm: 0.35rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.mono { font-family: var(--mono); font-size: 0.92em; }

.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 1.25rem; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #06121f;
  padding: 0.5rem 0.9rem;
  z-index: 100;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 3.5rem;
}
.brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.topnav {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
  font-size: 0.92rem;
}
.topnav a { color: var(--muted); }
.topnav a:hover { color: var(--fg); text-decoration: none; }
.topnav-gh { white-space: nowrap; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #06121f;
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost {
  background: var(--surface);
  color: var(--fg);
}
.btn-ghost:hover { border-color: var(--muted); }
.btn-ghost span { color: var(--warn); }
/* Latest release: the version reads as plain text, only the arrow is accented
   (the .btn-ghost rule above paints every span like the GitHub star). */
.btn-ver .mono { color: var(--fg); }
.btn-ver span[aria-hidden] { color: var(--accent); }

/* Hero */
.hero { padding: 4rem 0 3rem; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 3rem;
  align-items: center;
}
/* Let grid children shrink below their content width so overflow-x:auto
   inside terminal/code blocks scrolls instead of widening the page. */
.hero-grid > *,
.feature-cols > *,
.steps > *,
.why-grid > * { min-width: 0; }
.headline {
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}
.sub {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 1.1rem;
  margin: 0 0 1.25rem;
}
.lead { color: var(--muted); font-size: 1.05rem; margin: 0 0 1.75rem; max-width: 34rem; }
.cta-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.cta-center { justify-content: center; margin-top: 2.5rem; }

/* Terminal / faux window */
.terminal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(1, 4, 9, 0.5);
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.dot { width: 0.72rem; height: 0.72rem; border-radius: 50%; display: inline-block; }
.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }
.terminal-title {
  margin-left: 0.6rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}
.terminal-body {
  margin: 0;
  padding: 1.1rem 1.1rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--fg);
  overflow-x: auto;
  white-space: pre;
}
.t-dim { color: var(--muted); }
.t-accent { color: var(--accent); }
.t-ok { color: var(--ok); }
.t-bad { color: var(--bad); }

/* Sections */
.section { padding: 4rem 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}
.section-lead { color: var(--muted); font-size: 1.05rem; margin: 0 0 2rem; max-width: 44rem; }

/* Steps */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.step {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
}
.section-alt .step { background: var(--surface-2); }
.step-num {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  margin-bottom: 0.85rem;
}
.step h3 { margin: 0 0 0.4rem; font-size: 1.1rem; }
.step p { margin: 0; color: var(--muted); }

/* Callout */
.callout {
  margin-top: 1.75rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 1.1rem 1.3rem;
}
.section-alt .callout { background: var(--surface-2); }
.callout p { margin: 0; color: var(--muted); }
.callout strong { color: var(--fg); }

/* Features */
.feature-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
.feature-title {
  font-family: var(--mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 1rem;
}
.feature-list { list-style: none; margin: 0; padding: 0; }
.feature-list li {
  padding: 0.65rem 0 0.65rem 1.5rem;
  border-bottom: 1px solid var(--line);
  position: relative;
  color: var(--muted);
}
.feature-list li:last-child { border-bottom: none; }
.feature-list li::before {
  content: "\2192";
  position: absolute;
  left: 0;
  color: var(--accent);
}
.feature-list strong { color: var(--fg); }

/* Code blocks */
pre[data-lang] {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0 0 1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.65;
}
.section-alt pre[data-lang] { background: var(--surface-2); }
pre[data-lang] code { font-family: inherit; color: var(--fg); }

/* Copy button (injected by main.js) */
.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
pre:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: var(--fg); border-color: var(--muted); }
.copy-btn.copied { color: var(--ok); border-color: var(--ok); }

/* Minimal syntax highlighting tokens (set by main.js) */
.tok-comment { color: var(--muted); font-style: italic; }
.tok-string { color: var(--ok); }
.tok-key { color: var(--accent); }
.tok-num { color: var(--warn); }
.tok-cmd { color: #d2a8ff; }

/* Quick start */
.qs-step { margin: 2rem 0 0.75rem; font-size: 1.15rem; }
.qs-note { color: var(--muted); margin: 0 0 0.9rem; }
.qs-more { margin-top: 1.75rem; color: var(--muted); }

/* Tabs */
.tablist {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 0.85rem;
}
.tab {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--accent); color: #06121f; font-weight: 600; }
/* No-JS fallback: both panels visible, tablist hidden */
.tabpanel + .tabpanel { margin-top: 0.5rem; }
[data-tabs]:not(.js-tabs) .tablist { display: none; }
.js-tabs .tabpanel[hidden] { display: none; }

/* Why grid */
.why-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.why-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
}
.why-card h3 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.why-card p { margin: 0; color: var(--muted); }

/* Footer */
.footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0;
  background: var(--surface);
}
.footer-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.footer-brand { font-weight: 700; color: var(--fg); }
.footer-links { display: flex; gap: 1.1rem; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--fg); }
.footer-meta { margin-left: auto; color: var(--muted); font-size: 0.9rem; }

/* Responsive */
@media (max-width: 820px) {
  .hero-grid, .feature-cols, .steps, .why-grid { grid-template-columns: 1fr; }
  .hero { padding: 2.5rem 0; }
  .topnav { display: none; }
  .footer-meta { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
