/* Variable Font Explorer */

:root {
  --glow:      rgba(139, 92, 246, 0.3);
  --font-body: 'Space Grotesk', system-ui, sans-serif;
  --font-preview: 'Recursive', system-ui, sans-serif; /* default; switched by JS */
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--slate);
  color: var(--cloud);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── SKIP + HEADER ───────────────────────────────────────── */

.skip-link {
  position: absolute; top: -4rem; left: 1rem;
  background: var(--violet); color: var(--cloud);
  padding: 0.5rem 1rem; border-radius: 0 0 0.5rem 0.5rem;
  font-size: 0.875rem; text-decoration: none; z-index: 200;
  transition: top 0.15s;
}
.skip-link:focus { top: 0; }

.site-header {
  display: flex; align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--slate-raised);
}

.brand { display: flex; align-items: center; gap: 0.6rem; font-size: 0.8rem; }
.back-link { color: var(--violet-muted); text-decoration: none; transition: color 0.15s; }
.back-link:hover { color: var(--cloud); }
.brand-sep { color: var(--slate-raised); }
.brand-name { color: var(--violet-bright); font-weight: 600; letter-spacing: 0.02em; }

/* ── STAGE ───────────────────────────────────────────────── */

.stage-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  min-height: 40dvh;
}

.preview-wrap {
  width: 100%;
  max-width: 1100px;
  text-align: center;
}

.preview-word {
  font-family: var(--font-preview);
  font-size: clamp(4rem, 14vw, 13rem);
  font-weight: 400;
  line-height: 0.9;
  color: var(--cloud);
  text-shadow: 0 0 3rem var(--glow);
  white-space: nowrap;
  overflow: hidden;
  transition: font-variation-settings 0.05s linear;
  will-change: font-variation-settings;
  /* font-variation-settings set by JS */
}

.preview-pangram {
  margin-top: 1.5rem;
  font-family: var(--font-preview);
  font-size: clamp(0.9rem, 2vw, 1.25rem);
  font-weight: 400;
  line-height: 1.5;
  color: var(--violet-muted);
  transition: font-variation-settings 0.05s linear;
  will-change: font-variation-settings;
}

/* ── CONTROLS ────────────────────────────────────────────── */

.controls-section {
  background: var(--slate-panel);
  border-top: 1px solid var(--slate-raised);
  padding: 1.75rem 2rem 2rem;
}

.controls-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ctrl-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--violet-muted);
  display: block;
  margin-bottom: 0.6rem;
}

/* Font selector: segmented button group */
.font-selector-row { }

.segmented {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.seg-btn {
  background: var(--slate-raised);
  border: 1px solid transparent;
  color: var(--violet-muted);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font: 500 0.8rem var(--font-body);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.seg-btn:hover { color: var(--cloud); }
.seg-btn[aria-checked="true"] {
  background: var(--violet);
  color: var(--cloud);
  border-color: var(--violet);
}

/* Word input */
.word-row { }

.word-input {
  background: var(--slate-raised);
  border: 1px solid var(--slate-raised);
  color: var(--cloud);
  font: 500 1rem var(--font-body);
  padding: 0.55rem 0.9rem;
  border-radius: 0.6rem;
  width: min(100%, 280px);
  transition: border-color 0.15s;
}
.word-input:hover { border-color: var(--violet-deep); }
.word-input:focus { outline: 2px solid var(--cyan); outline-offset: 2px; border-color: transparent; }

/* Axes panel */
.axes-panel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem 2rem;
}

.axis-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.axis-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.axis-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cloud);
}

.axis-tag {
  font-size: 0.65rem;
  font-family: 'Space Mono', monospace;
  color: var(--violet-muted);
  letter-spacing: 0.06em;
}

.axis-value {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--violet-bright);
  min-width: 3.5ch;
  text-align: right;
}

input[type="range"].axis-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 0.35rem;
  background: var(--slate-raised);
  border-radius: 999px;
  cursor: pointer;
}
input[type="range"].axis-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1rem; height: 1rem; border-radius: 50%;
  background: var(--violet);
  border: 2px solid var(--cloud);
  box-shadow: 0 0 0.5rem var(--glow);
}
input[type="range"].axis-slider::-moz-range-thumb {
  width: 1rem; height: 1rem; border-radius: 50%;
  background: var(--violet); border: 2px solid var(--cloud);
}

/* Actions */
.actions-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--slate-raised);
  color: var(--violet-muted);
  padding: 0.45rem 1rem;
  border-radius: 0.5rem;
  font: 500 0.8rem var(--font-body);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-secondary:hover { border-color: var(--violet); color: var(--cloud); }
.btn-secondary[aria-pressed="true"] {
  border-color: var(--cyan);
  color: var(--cyan);
}

/* ── FOOTER ──────────────────────────────────────────────── */

.site-footer {
  padding: 1rem 2rem;
  border-top: 1px solid var(--slate-raised);
  font-size: 0.75rem;
}
.site-footer a { color: var(--violet-muted); text-decoration: none; transition: color 0.15s; }
.site-footer a:hover { color: var(--cloud); }

/* ── RESPONSIVE ──────────────────────────────────────────── */

@media (max-width: 600px) {
  .site-header { padding: 0.9rem 1.25rem; }
  .controls-section { padding: 1.25rem; }
  .axes-panel { grid-template-columns: 1fr; }
}

/* ── REDUCED MOTION ──────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .preview-word, .preview-pangram { transition: none; }
}
