/* SnippetShots — dark, sober, no framework. */

/* Self-hosted so raw SVG previews (hero, playground) render identically for
   every visitor — the server declares this same family name in its SVG
   output, but a viewer's own browser only honours that if the font is
   actually available to it. */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0b0d12;
  --bg-raised: #12151d;
  --bg-input: #171b24;
  --border: #232838;
  --border-strong: #303649;
  --fg: #e6e9f0;
  --fg-muted: #8b92a8;
  --fg-subtle: #5f6679;
  --accent: #7c9cff;
  --accent-hover: #93aeff;
  --accent-contrast: #0b0d12;
  --success: #4ade80;
  --danger: #f87171;
  --warning: #fbbf24;

  --radius: 10px;
  --radius-lg: 14px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --maxw: 1080px;
}

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

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

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

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

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 0.5em; font-weight: 650; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.125rem; }
p { margin: 0 0 1rem; }

code, pre, .mono { font-family: var(--mono); font-size: 0.875em; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.centered { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 1rem; padding: 20px; }
.display { font-size: clamp(3rem, 12vw, 6rem); margin: 0; letter-spacing: -0.04em; }
.lede { color: var(--fg-muted); font-size: 1.125rem; max-width: 34rem; }
.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); font-size: 0.875rem; }
.center { text-align: center; }
.stack { display: grid; gap: 1rem; }
.stack > * { min-width: 0; }
.row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.hidden { display: none !important; }
[hidden] { display: none !important; }

/* ---------- header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(11, 13, 18, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: 0.55rem; color: var(--fg); font-weight: 650; letter-spacing: -0.02em; }
.brand:hover { color: var(--fg); }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; flex: none; display: block; }
.nav { display: flex; align-items: center; gap: 1.25rem; }
.nav a { color: var(--fg-muted); font-size: 0.9375rem; }
.nav a:hover { color: var(--fg); }
.lang-switch {
  border: 1px solid var(--border); background: transparent; color: var(--fg-muted);
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; padding: 0.3rem 0.55rem;
  border-radius: 6px; cursor: pointer; line-height: 1;
}
.lang-switch:hover { color: var(--fg); border-color: var(--fg-subtle); }

@media (max-width: 640px) {
  .nav a.nav-optional { display: none; }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  color: var(--fg);
  font: inherit; font-size: 0.9375rem; font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: #1a1e29; color: var(--fg); border-color: #3a4159; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-contrast); }
.btn-danger { color: var(--danger); border-color: #3d2430; }
.btn-danger:hover { background: #2a1720; border-color: #5c2f3f; color: var(--danger); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.8125rem 1.5rem; font-size: 1rem; }

/* ---------- forms ---------- */

label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.375rem; color: var(--fg); }

input[type='email'], input[type='text'], select, textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font: inherit; font-size: 0.9375rem;
}
textarea { font-family: var(--mono); font-size: 0.8125rem; line-height: 1.6; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.15); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%238b92a8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.6rem center; padding-right: 2rem; }

.field { margin-bottom: 1rem; }
.checkbox { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--fg-muted); cursor: pointer; }
.checkbox input { width: auto; margin: 0; accent-color: var(--accent); }

/* ---------- cards ---------- */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.card-title { font-size: 0.8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-subtle); margin: 0 0 1rem; }

/* ---------- alerts ---------- */

.alert { padding: 0.75rem 1rem; border-radius: var(--radius); font-size: 0.9375rem; border: 1px solid; }
.alert-error { background: #2a1620; border-color: #5c2f3f; color: #fca5a5; }
.alert-success { background: #12241a; border-color: #245c3a; color: #86efac; }
.alert-info { background: #151d2e; border-color: #2c3d5c; color: #a5c4fc; }
.alert-warn { background: #241d10; border-color: #5c4a20; color: #fcd34d; }

/* ---------- landing ---------- */

.hero { padding: clamp(3rem, 9vw, 6rem) 0 clamp(2rem, 5vw, 3.5rem); text-align: center; }
.hero .lede { margin: 0 auto 2rem; font-size: clamp(1rem, 2.5vw, 1.1875rem); }
.hero-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.eyebrow { display: inline-block; font-size: 0.8125rem; color: var(--fg-muted); border: 1px solid var(--border); border-radius: 999px; padding: 0.25rem 0.75rem; margin-bottom: 1.25rem; }

.hero-shot { margin: 3rem auto 0; max-width: 760px; }
.hero-shot img, .hero-shot svg { width: 100%; height: auto; display: block; border-radius: var(--radius-lg); }

.section { padding: clamp(3rem, 7vw, 5rem) 0; border-top: 1px solid var(--border); }
.section-head { max-width: 40rem; margin: 0 auto 2.5rem; text-align: center; }
.section-head p { color: var(--fg-muted); margin: 0; }

.grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }

.feature h3 { margin-bottom: 0.375rem; }
.feature p { color: var(--fg-muted); font-size: 0.9375rem; margin: 0; }

/* ---------- pricing ---------- */

.plan { display: flex; flex-direction: column; gap: 1rem; position: relative; }
.plan.featured { border-color: var(--accent); }
.plan-badge { position: absolute; top: -0.7rem; left: 1.5rem; background: var(--accent); color: var(--accent-contrast); font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.15rem 0.5rem; border-radius: 999px; }
.plan-price { font-size: 2.25rem; font-weight: 650; letter-spacing: -0.03em; line-height: 1; }
.plan-price span { font-size: 0.9375rem; font-weight: 400; color: var(--fg-muted); letter-spacing: 0; }
.plan ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; font-size: 0.9375rem; color: var(--fg-muted); flex: 1; }
.plan li { display: flex; gap: 0.5rem; align-items: flex-start; }
.plan li::before { content: '✓'; color: var(--success); flex: none; }

/* ---------- code blocks ---------- */

pre.code {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  overflow-x: auto;
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.7;
  color: #c8cfe0;
}
pre.code .c-key { color: #cba6f7; }
pre.code .c-str { color: #a6e3a1; }
pre.code .c-com { color: #6c7086; font-style: italic; }
pre.code .c-fn { color: #89b4fa; }

/* ---------- key reveal ---------- */

.key-box { display: flex; gap: 0.5rem; align-items: center; }
.key-value {
  flex: 1; min-width: 0;
  font-family: var(--mono); font-size: 0.8125rem;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.625rem 0.75rem;
  overflow-x: auto; white-space: nowrap;
  user-select: all;
}

/* ---------- usage meter ---------- */

.meter { height: 8px; border-radius: 999px; background: var(--bg-input); overflow: hidden; border: 1px solid var(--border); }
.meter-fill { height: 100%; background: linear-gradient(90deg, #7c9cff, #b18cff); border-radius: 999px; transition: width 0.4s ease; }
.meter-fill.warn { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.meter-fill.full { background: linear-gradient(90deg, #f87171, #ef4444); }

.stat-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.5rem; }
.stat-value { font-size: 1.5rem; font-weight: 650; letter-spacing: -0.02em; }

/* ---------- dashboard layout ---------- */

.dash { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: stretch; }
.dash-full { grid-column: 1 / -1; }
.dash-wide { grid-column: span 2; }

/* ---------- playground ---------- */

.pg { display: grid; gap: 1rem; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; }
@media (max-width: 900px) { .pg { grid-template-columns: 1fr; } }
.pg-full { grid-column: 1 / -1; min-width: 0; }

.pg-controls { display: grid; gap: 0.75rem; grid-template-columns: 1fr 1fr; }
.pg-controls .field { margin: 0; }
.pg-preview {
  background: repeating-conic-gradient(#161a23 0% 25%, #12151d 0% 50%) 50% / 20px 20px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1rem; min-height: 240px;
  display: grid; place-items: center; overflow: auto;
}
.pg-preview svg, .pg-preview img { max-width: 100%; height: auto; border-radius: 8px; }

.color-swatch {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 2.25rem; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: none; cursor: pointer;
}
.color-swatch::-webkit-color-swatch-wrapper { padding: 3px; }
.color-swatch::-webkit-color-swatch { border: none; border-radius: 7px; }
.color-swatch::-moz-color-swatch { border: none; border-radius: 7px; }

.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } * { transition-duration: 0.01ms !important; } }

/* ---------- docs ---------- */

.docs { display: grid; gap: 2rem; }
.docs h2 { margin-top: 1rem; scroll-margin-top: 80px; }
.docs table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.docs th, .docs td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.docs th { color: var(--fg-subtle); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.docs td code { color: var(--accent); background: var(--bg-input); padding: 0.1rem 0.35rem; border-radius: 4px; }
.docs td:nth-child(2) { color: var(--fg-muted); white-space: nowrap; }

/* ---------- footer ---------- */

.site-footer { border-top: 1px solid var(--border); padding: 2rem 0; margin-top: 4rem; color: var(--fg-subtle); font-size: 0.875rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.site-footer a { color: var(--fg-muted); }

/* ---------- auth pages ---------- */

.auth-shell { max-width: 26rem; margin: clamp(2rem, 8vh, 5rem) auto; padding: 0 20px; }
.auth-shell h1 { font-size: 1.75rem; margin-bottom: 0.375rem; }
.auth-shell .lede { font-size: 0.9375rem; margin-bottom: 1.5rem; }
