/* Demo page — showcases transparent overlay + flame; not part of the library */

:root {
  --bg-deep: #06060a;
  --bg-card: rgba(18, 16, 28, 0.72);
  --stroke: rgba(255, 255, 255, 0.08);
  --text: #e6e2f0;
  --muted: rgba(230, 226, 240, 0.55);
  --accent: #ff6b2c;
  --accent-dim: rgba(255, 107, 44, 0.35);
  --radius: 14px;
  --font-ui: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Bebas Neue', Impact, sans-serif;
  /* https://fonts.google.com/specimen/Yuji+Syuku */
  --font-yuji-syuku: 'Yuji Syuku', 'Noto Serif SC', serif;
}

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

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg-deep);
  position: relative;
  overflow-x: hidden;
}

/* Background proves transparency: grid + glow show through empty canvas pixels */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 35%, black 20%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  inset: -20%;
  background:
    radial-gradient(ellipse 50% 40% at 50% 30%, rgba(120, 60, 180, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 50% at 70% 60%, rgba(255, 80, 40, 0.12), transparent 50%),
    radial-gradient(ellipse 50% 40% at 30% 70%, rgba(40, 100, 200, 0.08), transparent 45%);
  pointer-events: none;
  z-index: 0;
}

.top {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

.brand-name {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand-pill {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.top-note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 18rem;
  line-height: 1.4;
}

.main {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 880px) {
  .main {
    grid-template-columns: 1fr 320px;
    align-items: start;
    gap: 3rem;
  }
}

.stage {
  text-align: center;
  padding: 1rem 0 2rem;
}

.lede {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

.headline {
  font-family: var(--font-yuji-syuku), var(--font-display), Georgia, serif;
  font-size: 30rem;
  line-height: 0.95;
  margin: 0;
  letter-spacing: 0.08em;
  /* Dark ember “fuel” letter like reference art */
  color: #6a1418;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.45),
    0 0 24px rgba(120, 30, 25, 0.35),
    0 0 48px rgba(255, 60, 30, 0.12);
}

#headline:lang(zh) {
  font-family: var(--font-yuji-syuku);
  letter-spacing: 0.14em;
}

.presets {
  position: relative;
  z-index: 1;
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.presets-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.preset-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.preset {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.1s;
}

.preset:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.preset:active {
  transform: scale(0.98);
}

.panel {
  border-radius: var(--radius);
  padding: 1.35rem 1.35rem 1.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--stroke);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

.panel-title {
  margin: 0 0 1.15rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.field {
  margin-bottom: 1.15rem;
}

.field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.45rem;
}

.field-head label {
  font-size: 0.88rem;
  font-weight: 500;
}

.field-head output {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 600;
}

.field-hint {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--muted);
}

input[type='range'] {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

input[type='range']::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff 0%, #e8e0f0 100%);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  border: 2px solid var(--accent);
}

input[type='range']::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff 0%, #e8e0f0 100%);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  border: 2px solid var(--accent);
}

.toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1.4;
  margin: 0.25rem 0 1.15rem;
  user-select: none;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-ui {
  flex-shrink: 0;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--stroke);
  position: relative;
  transition: background 0.2s;
}

.toggle-ui::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-ui {
  background: rgba(255, 107, 44, 0.35);
  border-color: rgba(255, 107, 44, 0.5);
}

.toggle input:checked + .toggle-ui::after {
  transform: translateX(18px);
}

.toggle input:focus-visible + .toggle-ui {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.btn.primary {
  background: linear-gradient(180deg, rgba(255, 120, 60, 0.35) 0%, rgba(255, 80, 40, 0.2) 100%);
  border-color: rgba(255, 107, 44, 0.45);
}

.btn.primary:hover {
  background: linear-gradient(180deg, rgba(255, 120, 60, 0.45) 0%, rgba(255, 80, 40, 0.28) 100%);
  border-color: rgba(255, 140, 80, 0.55);
}

.btn:active {
  transform: translateY(1px);
}

.foot {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem 2.5rem;
  text-align: center;
}

.foot code {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--stroke);
}

/* GitHub Pages landing — tweaks on top of demo styles */

.showcase-intro {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
}

.showcase-intro code {
  font-size: 0.8em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--stroke);
}

.embed-docs {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
}

.embed-docs h2 {
  margin: 0 0 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.embed-docs-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 720px) {
  .embed-docs-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.embed-card {
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--stroke);
}

.embed-card h3 {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.embed-card p {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
}

.embed-card pre {
  margin: 0;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--stroke);
  font-size: 0.68rem;
  line-height: 1.45;
  overflow-x: auto;
  color: #c8c0d8;
}

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

.embed-card a:hover {
  text-decoration: underline;
}

.top-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.top-links a {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 107, 44, 0.35);
  background: rgba(255, 107, 44, 0.08);
}

.top-links a:hover {
  background: rgba(255, 107, 44, 0.15);
}

@media (max-width: 640px) {
  .headline {
    font-size: clamp(4rem, 22vw, 12rem);
  }
}
