/* ==========================================================================
   github-stats-svg — landing page styles
   No frameworks, no build step. System fonts only.

   Type system: monospace carries identity + data (this tool's own output
   IS code), system sans carries body copy. Two voices, one page.
   ========================================================================== */

/* ---- reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
img, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
ul { list-style: none; padding: 0; }

/* ---- design tokens -------------------------------------------------------
   Palette (6 named + 1 semantic exception for danger/error, unavoidable):
     ink-950   #0a0c12  canvas
     ink-900   #141824  raised surface
     ink-850   #191d29  inset surface (inputs, wells)
     ink-800   #262b3c  hairline borders
     paper     #eef0f6  primary text
     amber     #f2b84c  brand / CTA / focus / links
     green     #5fd98a  success, "added" semantics
     red       #f2685c  error, "removed" semantics (utility, not brand)
   All text pairings checked against WCAG AA (>=4.5:1) against canvas/surface.
   ---------------------------------------------------------------------- */
:root {
  color-scheme: dark;

  --bg: #0a0c12;
  --surface: #141824;
  --surface-2: #191d29;
  --border: #262b3c;
  --border-soft: #1c2130;

  --ink: #eef0f6;
  --ink-dim: #9aa1b8;
  --ink-faint: #5b6178;

  --amber: #f2b84c;
  --amber-ink: #1a1406;
  --green: #5fd98a;
  --red: #f2685c;
  --violet: #b9a4f5;

  --glow: #58a6ff; /* live-updated by app.js to match the selected card theme's accent */

  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'JetBrains Mono', 'Fira Code', Consolas, 'Roboto Mono', 'Courier New', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --container: 1120px;
}

/* ---- base ---------------------------------------------------------------- */
html, body {
  background: var(--bg); /* painted explicitly: never relies on UA default */
}
body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
}

.wrap {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

h1, h2, h3 { font-family: var(--font-mono); line-height: 1.15; font-weight: 700; }

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

a { text-decoration-color: color-mix(in srgb, var(--amber) 50%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--amber); }

/* visible keyboard focus everywhere, no exceptions */
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
/* mouse users don't need the ring; keyboard users always do */
:focus:not(:focus-visible) { outline: none; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.flag {
  color: var(--amber);
  opacity: 0.85;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

noscript .noscript-banner {
  display: block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-6);
  color: var(--ink-dim);
  font-size: 0.9rem;
}

/* ==========================================================================
   header
   ========================================================================== */
.site-header {
  padding-block: var(--space-6);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.wordmark {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: baseline;
  gap: 0.15em;
}
.wordmark .dim { color: var(--ink-faint); font-weight: 400; }
.header-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3em 0.75em;
  white-space: nowrap;
}
.header-chip strong { color: var(--green); font-weight: 600; }

/* ==========================================================================
   hero
   ========================================================================== */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: var(--space-8) var(--space-12);
}

/* signature texture: a faint, tiled contribution-graph pattern behind the
   hero — this product turns your commit history into an SVG, so the ambient
   backdrop is built from the same visual grammar GitHub itself uses. */
.heatmap-bg {
  position: absolute;
  inset: -10% -5%;
  z-index: 0;
  opacity: 0.55;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='66' height='66' viewBox='0 0 66 66'%3E%3Crect x='6' y='6' width='14' height='14' rx='3' fill='%235fd98a' fill-opacity='0.07'/%3E%3Crect x='26' y='6' width='14' height='14' rx='3' fill='%235fd98a' fill-opacity='0.18'/%3E%3Crect x='46' y='6' width='14' height='14' rx='3' fill='%235fd98a' fill-opacity='0.05'/%3E%3Crect x='6' y='26' width='14' height='14' rx='3' fill='%235fd98a' fill-opacity='0.30'/%3E%3Crect x='26' y='26' width='14' height='14' rx='3' fill='%235fd98a' fill-opacity='0.11'/%3E%3Crect x='46' y='26' width='14' height='14' rx='3' fill='%235fd98a' fill-opacity='0.05'/%3E%3Crect x='6' y='46' width='14' height='14' rx='3' fill='%235fd98a' fill-opacity='0.22'/%3E%3Crect x='26' y='46' width='14' height='14' rx='3' fill='%235fd98a' fill-opacity='0.08'/%3E%3Crect x='46' y='46' width='14' height='14' rx='3' fill='%235fd98a' fill-opacity='0.16'/%3E%3C/svg%3E");
  background-size: 66px 66px;
  mask-image: radial-gradient(60% 60% at 30% 20%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(60% 60% at 30% 20%, #000 0%, transparent 75%);
}
/* a soft glow tied to the currently selected card theme's accent colour —
   the one element on the page that visibly reacts to the theme you pick */
.hero::after {
  content: '';
  position: absolute;
  z-index: 0;
  top: -10%;
  right: -10%;
  width: min(560px, 60vw);
  height: min(560px, 60vw);
  background: radial-gradient(circle, color-mix(in srgb, var(--glow) 28%, transparent) 0%, transparent 70%);
  filter: blur(10px);
  pointer-events: none;
  transition: background 0.6s ease;
}

.hero .wrap {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: var(--space-12);
  align-items: start;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  margin-bottom: var(--space-4);
}
.eyebrow::before {
  content: '';
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 20%, transparent);
}

.hero h1 {
  font-size: clamp(1.9rem, 1.15rem + 3.2vw, 3.15rem);
  letter-spacing: -0.01em;
  max-width: 15ch;
}

.hero .lede {
  margin-top: var(--space-5);
  color: var(--ink-dim);
  font-size: 1.05rem;
  max-width: 46ch;
}
.hero .lede code { color: var(--ink); background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0.1em 0.4em; font-size: 0.88em; }

/* quick-start: username + card tabs, right inside the hero */
.quickstart {
  margin-top: var(--space-8);
}
.username-row {
  display: flex;
  gap: var(--space-2);
  max-width: 30rem;
}
.username-row .field {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.username-row .field-prefix {
  position: absolute;
  left: var(--space-3);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  pointer-events: none;
}
#username {
  width: 100%;
  padding: 0.85em 1em 0.85em 1.8em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  transition: border-color 0.15s ease;
}
#username::placeholder { color: var(--ink-faint); }
#username:hover { border-color: color-mix(in srgb, var(--ink-dim) 60%, var(--border)); }
#username:focus-visible { border-color: var(--amber); }
#username[aria-invalid="true"] { border-color: var(--red); }

.field-hint {
  margin-top: var(--space-2);
  font-size: 0.82rem;
  color: var(--ink-faint);
  min-height: 1.2em;
}
.field-hint[data-state="error"] { color: var(--red); }

.card-tabs {
  margin-top: var(--space-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-dim);
  padding: 0.55em 1em;
  border-radius: 999px;
  font-size: 0.86rem;
  font-family: var(--font-mono);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.tab:hover { color: var(--ink); border-color: color-mix(in srgb, var(--ink-dim) 50%, var(--border)); }
.tab[aria-pressed="true"] {
  color: var(--amber-ink);
  background: var(--amber);
  border-color: var(--amber);
  font-weight: 600;
}

/* ---- preview / terminal chrome ------------------------------------------- */
.preview-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.7);
}
.frame-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.frame-dots { display: flex; gap: 0.4em; }
.frame-dots span { width: 0.65em; height: 0.65em; border-radius: 50%; display: block; }
.frame-dots span:nth-child(1) { background: var(--red); }
.frame-dots span:nth-child(2) { background: var(--amber); }
.frame-dots span:nth-child(3) { background: var(--green); }
.frame-path {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--green);
  flex-shrink: 0;
}
.live-tag[hidden] { display: none; }
.live-tag .dot {
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.8s ease-in-out infinite;
}
.frame-body {
  padding: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--glow) 10%, transparent), transparent 60%),
    var(--surface);
  transition: background 0.6s ease;
}
.frame-body img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.35));
}
.frame-body.is-loading img { opacity: 0.5; }
.frame-footnote {
  padding: var(--space-2) var(--space-4) var(--space-3);
  font-size: 0.76rem;
  color: var(--ink-faint);
  border-top: 1px solid var(--border-soft);
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 45%, transparent); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px transparent; }
}

/* ==========================================================================
   controls / "build your card"
   ========================================================================== */
.controls {
  padding-block: var(--space-8);
  border-top: 1px solid var(--border-soft);
}
.section-heading {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.section-heading h2 { font-size: 1.3rem; }
.section-heading .flag { font-size: 0.85rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.field-group { margin-bottom: var(--space-6); }
.field-group:last-child { margin-bottom: 0; }
.field-group > label,
.field-group > .field-group-label {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: var(--space-3);
}
.field-group .help {
  margin-top: var(--space-2);
  font-size: 0.82rem;
  color: var(--ink-dim);
  max-width: 55ch;
}

.theme-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: var(--space-3);
}
.swatch {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  text-align: left;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.swatch:hover { border-color: color-mix(in srgb, var(--ink-dim) 55%, var(--border)); }
.swatch:active { transform: scale(0.98); }
.swatch[aria-pressed="true"] {
  border-color: var(--amber);
  box-shadow: 0 0 0 1px var(--amber);
}
.swatch-chip {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 7px;
  flex-shrink: 0;
  position: relative;
  border-width: 2px;
  border-style: solid;
}
.swatch-chip .dot {
  position: absolute;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  bottom: 0.3rem;
}
.swatch-chip .dot.title { left: 0.3rem; }
.swatch-chip .dot.accent { right: 0.3rem; }
.swatch-name {
  font-size: 0.85rem;
  color: var(--ink);
  font-weight: 500;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  width: fit-content;
}
.segmented button {
  background: var(--surface-2);
  border: none;
  color: var(--ink-dim);
  padding: 0.55em 1.2em;
  font-size: 0.88rem;
  font-family: var(--font-mono);
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button[aria-pressed="true"] { background: var(--amber); color: var(--amber-ink); font-weight: 600; }

select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: var(--radius-md);
  padding: 0.6em 1em;
  font-size: 0.9rem;
  max-width: 16rem;
  width: 100%;
}
select:focus-visible { border-color: var(--amber); }

.cache-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
input[type="range"] {
  flex: 1;
  accent-color: var(--amber);
  height: 1.5rem;
  background: transparent;
}
.cache-value {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--amber);
  min-width: 3.2em;
  text-align: right;
}

/* ---- collapsible power mode ---------------------------------------------- */
.power-mode {
  margin-top: var(--space-8);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.power-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface-2);
  border: none;
  text-align: left;
}
.power-toggle .chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.power-toggle[aria-expanded="true"] .chevron { transform: rotate(90deg); }
.power-toggle-copy { display: flex; flex-direction: column; gap: 0.2em; }
.power-toggle-title { font-weight: 600; font-size: 0.95rem; }
.power-toggle-sub { font-size: 0.8rem; color: var(--ink-dim); }

.power-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease;
}
.power-panel[data-open="true"] { grid-template-rows: 1fr; }
.power-panel-inner { overflow: hidden; }
.power-panel-content { padding: var(--space-5); border-top: 1px solid var(--border); }

#pat {
  width: 100%;
  padding: 0.75em 1em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
#pat:focus-visible { border-color: var(--amber); }

.field-checkbox {
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin-top: var(--space-4);
}
.field-checkbox input[type="checkbox"] {
  width: 1.1em;
  height: 1.1em;
  accent-color: var(--amber);
  flex-shrink: 0;
}
.field-checkbox input[type="checkbox"]:disabled { opacity: 0.5; cursor: not-allowed; }
.field-checkbox label { font-size: 0.88rem; }
.field-checkbox:has(input:disabled) label { color: var(--ink-faint); }

.power-copy {
  margin-top: var(--space-4);
  font-size: 0.85rem;
  color: var(--ink-dim);
  line-height: 1.65;
}
.power-copy strong { color: var(--ink); }
.power-copy a { color: var(--amber); }
.power-copy + .power-copy { margin-top: var(--space-3); }

/* ---- generate ------------------------------------------------------------- */
.generate-row {
  margin-top: var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
}
.btn-primary {
  background: var(--amber);
  color: var(--amber-ink);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.9em 2.2em;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  transition: transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--amber) 70%, transparent);
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: progress; transform: none; }

.generate-error {
  color: var(--red);
  font-size: 0.88rem;
  min-height: 1.3em;
}

/* ==========================================================================
   result panel
   ========================================================================== */
.result {
  padding-block: var(--space-8);
  border-top: 1px solid var(--border-soft);
}
.result[hidden] { display: none; }
.result-intro { color: var(--ink-dim); margin-bottom: var(--space-6); }

.result-row {
  margin-bottom: var(--space-5);
}
.result-row label {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-dim);
  margin-bottom: var(--space-2);
  font-weight: 600;
}
.copy-field {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
}
.copy-field input,
.copy-field textarea {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--ink);
  padding: 0.7em 0.9em;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  resize: none;
}
.copy-field textarea { min-height: 3.2em; }

.btn-copy {
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: var(--radius-md);
  padding: 0 1.1em;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-copy:hover { border-color: var(--amber); color: var(--amber); }
.btn-copy[data-copied="true"] { border-color: var(--green); color: var(--green); }
.btn-copy svg { width: 1em; height: 1em; flex-shrink: 0; }

.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-2);
}
.gallery-frame {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}
.gallery-frame-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.gallery-frame-title { font-size: 0.82rem; font-weight: 600; color: var(--ink); }
.gallery-default-tag {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 14%, transparent);
  border-radius: 999px;
  padding: 0.2em 0.6em;
}
.gallery-live { margin-left: auto; font-size: 0.66rem; }
.gallery-frame-body {
  flex: 1;
  padding: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--glow) 8%, transparent), transparent 60%),
    var(--surface);
}
.gallery-frame-body img {
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.3));
  opacity: 1;
  transition: opacity 0.25s ease;
}
.gallery-frame-body.is-loading img { opacity: 0; }
.gallery-frame-body.is-loading {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: gallery-shimmer 1.4s ease-in-out infinite;
}
@keyframes gallery-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.gallery-copy {
  width: 100%;
  justify-content: center;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  padding: 0.65em;
  background: var(--surface-2);
}

.gallery-badge-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
}
.gallery-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.gallery-badge-imgwrap {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  min-width: 120px;
  border-radius: var(--radius-md);
}
/* overflow stays visible: the badge SVG already has its own rounded corners
   at whatever `radius` param it was rendered with (default 8px) — clipping
   this wrapper too (a different, unrelated 10px radius) double-rounds the
   same corner at two mismatched curves, visibly cutting into the badge's own
   curve. border-radius above is purely cosmetic, for the loading shimmer's
   own background shape; it never clips the loaded image. */
.gallery-badge-imgwrap img { opacity: 1; transition: opacity 0.25s ease; }
.gallery-badge-imgwrap.is-loading img { opacity: 0; }
.gallery-badge-imgwrap.is-loading {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: gallery-shimmer 1.4s ease-in-out infinite;
}
.gallery-badge-copy { flex-shrink: 0; padding: 0.4em 0.9em; font-size: 0.76rem; }

.gallery-langs-toggle { margin: var(--space-3) var(--space-3) 0; }
.gallery-langs-toggle button { padding: 0.35em 0.85em; font-size: 0.76rem; }

.manage-key-box {
  margin-top: var(--space-6);
  border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--border));
  background: color-mix(in srgb, var(--amber) 8%, var(--surface));
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.manage-key-box .callout-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--amber);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: var(--space-2);
}
.manage-key-box .callout-title svg { width: 1.1em; height: 1.1em; flex-shrink: 0; }
.manage-key-box p { color: var(--ink-dim); font-size: 0.85rem; margin-bottom: var(--space-3); }
.manage-key-box .copy-field input { font-weight: 600; letter-spacing: 0.01em; }

.downgrade-note {
  margin-top: var(--space-4);
  font-size: 0.82rem;
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 30%, var(--border));
  border-radius: var(--radius-sm);
  padding: var(--space-3);
}
.downgrade-note[hidden] { display: none; }

.revoke-note {
  margin-top: var(--space-5);
  font-size: 0.82rem;
  color: var(--ink-faint);
  max-width: 65ch;
}

/* ==========================================================================
   footer
   ========================================================================== */
.site-footer {
  padding-block: var(--space-8) var(--space-12);
  border-top: 1px solid var(--border-soft);
}
.footer-grid {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-8);
  flex-wrap: wrap;
}
.repo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-size: 0.9rem;
  color: var(--ink-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.65em 1.1em;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.repo-link:hover { border-color: var(--amber); color: var(--ink); }
.repo-link svg { width: 1.15em; height: 1.15em; flex-shrink: 0; }
.footer-tagline {
  margin-top: var(--space-3);
  font-size: 0.78rem;
  color: var(--ink-faint);
  max-width: 40ch;
}

.revoke-widget { width: 100%; max-width: 24rem; }
.revoke-widget .field-group-label { font-size: 0.82rem; color: var(--ink-dim); font-weight: 600; margin-bottom: var(--space-2); }
.revoke-form { display: flex; gap: var(--space-2); }
#revoke-key {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--ink);
  padding: 0.65em 0.9em;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
#revoke-key:focus-visible { border-color: var(--amber); }
.btn-secondary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: var(--radius-md);
  padding: 0 1.3em;
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}
.btn-secondary:hover { border-color: var(--amber); color: var(--amber); }
.btn-secondary:disabled { opacity: 0.6; cursor: progress; }

/* ---- toast ---------------------------------------------------------------- */
.toast {
  margin-top: var(--space-3);
  font-size: 0.85rem;
  padding: 0.6em 0.9em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  max-width: 24rem;
}
.toast:empty { display: none; }
.toast[data-kind="ok"] { color: var(--green); background: color-mix(in srgb, var(--green) 10%, transparent); border-color: color-mix(in srgb, var(--green) 30%, var(--border)); }
.toast[data-kind="error"] { color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); border-color: color-mix(in srgb, var(--red) 30%, var(--border)); }

/* ==========================================================================
   responsive — down to 360px
   ========================================================================== */
@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .preview-frame { max-width: 32rem; }
}

@media (max-width: 560px) {
  .wrap { padding-inline: 1rem; }
  .panel { padding: var(--space-4); }
  .hero { padding-block: var(--space-6) var(--space-8); }
  .username-row { flex-direction: column; }
  .footer-grid { flex-direction: column; }
  .revoke-widget { max-width: none; }
  .cache-row { flex-wrap: wrap; }
  .gallery { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .hero h1 { font-size: 1.65rem; }
  .theme-swatches { grid-template-columns: repeat(2, 1fr); }
  .revoke-form { flex-direction: column; }
  .btn-secondary { width: 100%; padding-block: 0.6em; }
}

/* ---- reduced motion -------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---- static content pages (privacy, security, 404) ----------------------- */
.page-main { padding: calc(var(--space-6) * 1.2) 0 var(--space-6); }
.page-main .wrap { max-width: 760px; }
.breadcrumbs { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-dim); margin-bottom: var(--space-4); }
.breadcrumbs a { color: var(--ink-dim); text-decoration: none; }
.breadcrumbs a:hover { color: var(--amber); }
.breadcrumbs span[aria-hidden] { margin: 0 0.4em; color: var(--ink-faint); }
.page-main h1 { font-family: var(--font-mono); font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin-bottom: var(--space-2); }
.page-updated { color: var(--ink-faint); font-size: 0.85rem; margin-bottom: var(--space-5); }
.page-main h2 { font-family: var(--font-mono); font-size: 1.15rem; margin: var(--space-5) 0 var(--space-2); color: var(--amber); }
.page-main p, .page-main li { color: var(--ink-dim); line-height: 1.65; margin-bottom: var(--space-2); }
.page-main ul { list-style: disc; padding-left: 1.4em; margin-bottom: var(--space-3); }
.page-main a { color: var(--amber); }
.page-main code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 4px; padding: 0.1em 0.35em; }
.page-main strong { color: var(--ink); }
.footer-nav { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-2); font-size: 0.85rem; }
.footer-nav a { color: var(--ink-dim); text-decoration: none; }
.footer-nav a:hover { color: var(--amber); }
.notfound-hero { text-align: center; padding: var(--space-6) 0; }
.notfound-hero .code { font-family: var(--font-mono); font-size: 5rem; font-weight: 700; color: var(--amber); }

/* ---------- docs page (page-main additions) ---------- */
.page-main h3 { font-family: var(--font-mono); font-size: 1rem; margin: var(--space-4) 0 var(--space-2); color: var(--ink); }
.page-main pre { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 8px; padding: var(--space-3); overflow-x: auto; margin-bottom: var(--space-3); font-size: 0.85rem; line-height: 1.55; }
.page-main pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.page-main table { width: 100%; border-collapse: collapse; margin-bottom: var(--space-3); font-size: 0.9rem; display: block; overflow-x: auto; }
.page-main th, .page-main td { text-align: left; padding: 0.5em 0.75em; border-bottom: 1px solid var(--border-soft); color: var(--ink-dim); vertical-align: top; }
.page-main th { color: var(--ink); font-family: var(--font-mono); font-size: 0.8rem; white-space: nowrap; }
.hero-docs-cta { color: var(--ink-dim); font-size: 0.9rem; margin-top: var(--space-2); }
.hero-docs-cta a { color: var(--amber); }
