/* =========================================================================
   The Font Generator — design system
   Aurora / studio aesthetic: layered surfaces, soft depth, gradient accents.
   ========================================================================= */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  /* Surfaces */
  --bg: #fbfaff;
  --bg-veil: #f3f1fd;
  --surface: #ffffff;
  --surface-2: #f5f4fc;
  --surface-3: #ecebf8;

  /* Ink */
  --text: #100e1c;
  --text-soft: #3a3752;
  --text-muted: #63607e;
  --text-faint: #8b88a3;

  /* Lines */
  --border: #e7e5f5;
  --border-strong: #d8d5ee;

  /* Brand */
  --accent: #6d4dfb;
  --accent-hover: #5a37ee;
  --accent-ink: #ffffff;
  --accent-soft: #efeaff;
  --accent-2: #d63bf0;
  --accent-3: #14b8d4;
  --gradient: linear-gradient(115deg, #6d4dfb 0%, #a340f5 45%, #e0459b 100%);
  --gradient-soft: linear-gradient(135deg, rgba(109, 77, 251, 0.14), rgba(224, 69, 155, 0.12));

  /* Status */
  --success: #0f9d70;
  --success-soft: #dff6ee;
  --star: #e09612;

  /* Depth */
  --shadow-xs: 0 1px 2px rgba(23, 16, 60, 0.05);
  --shadow-sm: 0 2px 8px rgba(23, 16, 60, 0.06);
  --shadow-md: 0 10px 30px -12px rgba(23, 16, 60, 0.18);
  --shadow-lg: 0 28px 60px -28px rgba(23, 16, 60, 0.3);
  --shadow-accent: 0 12px 28px -12px rgba(109, 77, 251, 0.55);
  --ring: 0 0 0 3px rgba(109, 77, 251, 0.28);

  /* Shape */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;

  /* Type */
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Layout */
  --max-width: 1180px;
  --max-prose: 760px;
  --header-h: 68px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #08070f;
  --bg-veil: #0d0b18;
  --surface: #14121f;
  --surface-2: #1b1930;
  --surface-3: #23203a;

  --text: #f4f2ff;
  --text-soft: #d9d5ee;
  --text-muted: #a7a2c2;
  --text-faint: #7a7597;

  --border: #262238;
  --border-strong: #35304e;

  --accent: #9b83ff;
  --accent-hover: #b09aff;
  --accent-ink: #100b26;
  --accent-soft: #241d44;
  --accent-2: #ec6ef8;
  --accent-3: #3ad7ef;
  --gradient: linear-gradient(115deg, #8f74ff 0%, #c06bff 45%, #ff6fb2 100%);
  --gradient-soft: linear-gradient(135deg, rgba(155, 131, 255, 0.18), rgba(255, 111, 178, 0.14));

  --success: #34d9a0;
  --success-soft: #102f27;
  --star: #f5b53d;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 14px 34px -14px rgba(0, 0, 0, 0.75);
  --shadow-lg: 0 34px 70px -30px rgba(0, 0, 0, 0.85);
  --shadow-accent: 0 14px 30px -14px rgba(155, 131, 255, 0.5);
  --ring: 0 0 0 3px rgba(155, 131, 255, 0.35);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -0.022em;
  line-height: 1.15;
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; }

button, input, textarea, select { font: inherit; color: inherit; }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-xs);
}

::selection { background: var(--accent-soft); color: var(--text); }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 22px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 200;
  background: var(--accent);
  color: #fff;
  padding: 12px 20px;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* =========================================================================
   Header
   ========================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: var(--header-h);
  padding: 10px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  transition: transform 0.2s var(--ease);
}
.brand:hover { color: var(--text); transform: translateY(-1px); }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: contain;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  padding: 2px;
}
.brand-name { display: inline-flex; gap: 0.28em; }
.brand-accent {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-desktop {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}
.nav-desktop a {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.nav-desktop a:hover { color: var(--text); background: var(--surface-2); }
.nav-desktop a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.nav-desktop + .header-actions { margin-left: 10px; }

.icon-button {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.icon-button:hover {
  color: var(--accent);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.icon-button svg { width: 18px; height: 18px; }

.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }

.nav-toggle { display: none; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }
.nav-toggle[aria-expanded="true"] .icon-burger { display: none; }

.mobile-nav {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 12px 22px 20px;
}
.mobile-nav.is-open {
  display: block;
  animation: slide-down 0.25s var(--ease);
}
.mobile-nav a {
  display: block;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-weight: 600;
  font-size: 0.96rem;
}
.mobile-nav a:hover,
.mobile-nav a[aria-current="page"] {
  background: var(--surface-2);
  color: var(--accent);
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1080px) {
  .nav-desktop { display: none; }
  .nav-toggle { display: inline-flex; }
}

/* =========================================================================
   Hero
   ========================================================================= */
.hero {
  position: relative;
  padding: 60px 0 34px;
  text-align: center;
  overflow: hidden;
  isolation: isolate;
}
.hero-glow {
  position: absolute;
  inset: -220px 0 auto;
  height: 620px;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(46% 46% at 22% 34%, rgba(109, 77, 251, 0.3), transparent 68%),
    radial-gradient(40% 40% at 78% 26%, rgba(224, 69, 155, 0.24), transparent 66%),
    radial-gradient(38% 38% at 52% 60%, rgba(20, 184, 212, 0.18), transparent 70%);
  filter: blur(20px);
  animation: drift 22s ease-in-out infinite alternate;
}
[data-theme="dark"] .hero-glow { opacity: 0.7; }

@keyframes drift {
  from { transform: translate3d(-2%, 0, 0) scale(1); }
  to { transform: translate3d(3%, 2%, 0) scale(1.08); }
}

.hero-inner { position: relative; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 15px 7px 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  box-shadow: var(--shadow-xs);
  margin-bottom: 22px;
}
.eyebrow .pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.hero h1 {
  font-size: clamp(2.1rem, 5.4vw, 3.55rem);
  font-weight: 800;
  margin: 0 auto 18px;
  max-width: 17ch;
  letter-spacing: -0.035em;
}
.hero h1 .grad {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-lede {
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto;
  font-size: clamp(1rem, 1.6vw, 1.12rem);
  line-height: 1.65;
}

.hero-stats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 0;
  margin: 26px 0 0;
}
.hero-stats li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 76%, transparent);
  font-size: 0.86rem;
  color: var(--text-muted);
  box-shadow: var(--shadow-xs);
}
.hero-stats b { color: var(--text); font-weight: 700; }
.hero-stats svg { width: 15px; height: 15px; color: var(--accent); }

/* =========================================================================
   Studio (tool)
   ========================================================================= */
.studio {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px 22px;
  align-items: start;
  margin: 10px 0;
}
@media (max-width: 1000px) {
  .studio { grid-template-columns: 1fr; }
}

/* The primary field: full width, first in the flow, and larger than anything
   else on the page — it must never be confused with the style filter. */
.studio-input {
  grid-column: 1 / -1;
  padding: 20px 22px 18px;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}
.input-headline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 11px;
  cursor: text;
}
.input-headline-text {
  font-family: var(--font-display);
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.input-foot .char-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.input-foot .char-pill svg { width: 14px; height: 14px; color: var(--success); }

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.studio-rail {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}
@media (max-width: 1000px) {
  .studio-rail { position: static; }
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  margin-bottom: 9px;
}

.input-shell { position: relative; }
#text-input {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.5;
  padding: 16px 46px 16px 16px;
  outline: none;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
#text-input::placeholder { color: var(--text-faint); }
#text-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: var(--ring);
}

.input-clear {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s var(--ease), background 0.18s var(--ease), color 0.18s var(--ease);
}
.input-clear svg { width: 15px; height: 15px; }
.input-shell:hover .input-clear,
.input-shell.has-text .input-clear,
.input-clear:focus-visible { opacity: 1; }
.input-clear:hover { background: var(--surface-3); color: var(--text); }

.input-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.char-pill {
  font-size: 0.78rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.char-pill b { color: var(--text-muted); font-weight: 700; }

.ghost-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.79rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.ghost-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.rail-divider {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 2px 0;
}

/* Collapsible rail section (decorations) */
.rail-group summary {
  cursor: pointer;
  list-style: none;
  margin-bottom: 0;
}
.rail-group summary::-webkit-details-marker { display: none; }
.rail-group summary > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.rail-caret {
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 0.2s var(--ease);
}
.rail-group[open] .rail-caret { transform: rotate(-135deg) translate(-1px, -1px); }
.rail-group[open] summary { margin-bottom: 9px; }
.rail-group summary:hover { color: var(--accent); }

/* ---------- Chips ---------- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease),
    background 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
}
.chip--active {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.chip--active .chip-count { color: rgba(255, 255, 255, 0.8); }
.chip-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- Decorations ---------- */
.deco-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 7px;
  max-height: 210px;
  overflow-y: auto;
  padding: 3px 4px 3px 0;
  margin-top: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.deco-list::-webkit-scrollbar { width: 8px; }
.deco-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
.deco-list::-webkit-scrollbar-track { background: transparent; }

.deco-item {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  border-radius: var(--radius-xs);
  padding: 9px 6px;
  cursor: pointer;
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease), transform 0.16s var(--ease);
}
.deco-item:hover { border-color: var(--accent); transform: translateY(-1px); }
.deco-item--active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* ---------- Size control ---------- */
.size-row { display: flex; align-items: center; gap: 12px; }
.size-row input[type="range"] {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 99px;
  background: var(--surface-3);
  cursor: pointer;
}
.size-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-sm);
}
.size-row input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
}
.size-value {
  min-width: 52px;
  text-align: right;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- Results column ---------- */
.studio-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.results-bar {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
}
@media (max-width: 1000px) { .results-bar { position: static; } }

/* Deliberately small, last in the bar, and quieter than the main text field —
   it filters style names and must not read as the box you type your text in. */
.search-shell {
  position: relative;
  flex: 0 0 auto;
  width: 190px;
  max-width: 100%;
  margin-left: auto;
}
.search-shell svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-faint);
  pointer-events: none;
}
#font-search {
  width: 100%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: 999px;
  padding: 7px 12px 7px 32px;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
#font-search::placeholder { color: var(--text-faint); }
#font-search:focus {
  border-color: var(--accent);
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--ring);
}

.results-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.results-count {
  font-size: 0.82rem;
  color: var(--text-faint);
  font-weight: 600;
  white-space: nowrap;
}
.results-count b { color: var(--text); }

.category-scroll {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.category-scroll::-webkit-scrollbar { display: none; }
.category-scroll .chip { flex: 0 0 auto; }

#results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
@media (max-width: 520px) { #results { grid-template-columns: 1fr; } }

.result-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px 16px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
  animation: rise 0.32s var(--ease) both;
}
.result-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.result-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--gradient-soft);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
  pointer-events: none;
}
.result-card:hover::before { opacity: 0.5; }
.result-card > * { position: relative; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.result-name {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.result-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease), background 0.16s var(--ease),
    transform 0.16s var(--ease);
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.icon-btn--active {
  color: var(--star);
  border-color: color-mix(in srgb, var(--star) 55%, transparent);
  background: color-mix(in srgb, var(--star) 12%, transparent);
}
.icon-btn--active:hover { color: var(--star); border-color: var(--star); }

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  border-radius: 10px;
  font-size: 0.79rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.16s var(--ease), background 0.16s var(--ease), border-color 0.16s var(--ease),
    transform 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.copy-btn svg { width: 14px; height: 14px; }
.copy-btn:hover {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-accent);
}
.copy-btn.is-copied,
.copy-btn.is-copied:hover {
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 45%, transparent);
  color: var(--success);
  box-shadow: none;
  transform: none;
}

.result-text {
  font-size: 22px;
  line-height: 1.45;
  word-break: break-word;
  color: var(--text);
  cursor: pointer;
  min-height: 1.45em;
}

/* Empty / preview state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 26px 16px 4px;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 12px;
}
.empty-state .empty-icon svg { width: 24px; height: 24px; }
.empty-state h3 { margin: 0 0 6px; font-size: 1.08rem; }
.empty-state p { margin: 0; font-size: 0.92rem; }

.preview-item {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 16px 14px;
  text-align: center;
  background: var(--surface-2);
  color: var(--text-muted);
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.preview-item:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); }
.preview-sample { font-size: 1.08rem; color: var(--text); }
.preview-name {
  display: block;
  margin-top: 7px;
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 34px 22px;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.no-results-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text);
  overflow-wrap: anywhere;
}
.no-results-hint {
  margin: 0 auto;
  max-width: 44ch;
  font-size: 0.9rem;
  line-height: 1.6;
}
.no-results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: center;
  margin-top: 18px;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  background: var(--gradient);
  color: #fff;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  max-width: 100%;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-accent);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.primary-btn:hover { transform: translateY(-1px); }

/* =========================================================================
   Saved panels
   ========================================================================= */
.side-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 30px 0 10px;
}
@media (max-width: 820px) { .side-panels { grid-template-columns: 1fr; } }

.panel { padding: 18px 20px; }
.panel-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}
.panel-head svg { width: 16px; height: 16px; color: var(--accent); }
.panel-head h2 { margin: 0; font-size: 0.95rem; font-weight: 700; letter-spacing: -0.01em; }

.empty-hint { color: var(--text-faint); font-size: 0.86rem; margin: 0; }

.fav-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.fav-row:last-child { border-bottom: none; }
.fav-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-chip {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 6px 13px;
  margin: 0 6px 7px 0;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), color 0.16s var(--ease), transform 0.16s var(--ease);
}
.history-chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* =========================================================================
   Toast
   ========================================================================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--text);
  color: var(--bg);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
  z-index: 120;
}
.toast svg { width: 16px; height: 16px; flex: 0 0 auto; }
.toast--visible { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================================
   Feature strip
   ========================================================================= */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin: 46px 0 10px;
}
.feature {
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.feature-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 13px;
}
.feature-icon svg { width: 20px; height: 20px; }
.feature h3 { margin: 0 0 6px; font-size: 1rem; }
.feature p { margin: 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }

/* =========================================================================
   Editorial content
   ========================================================================= */
.content { padding-top: 26px; padding-bottom: 20px; }
.prose { max-width: var(--max-prose); }
.content h2 {
  font-size: clamp(1.45rem, 2.7vw, 1.95rem);
  margin: 54px 0 14px;
  font-weight: 800;
}
.content > .prose > h2:first-child { margin-top: 14px; }
.content h3 { font-size: 1.14rem; margin: 30px 0 8px; }
.content p,
.content li {
  color: var(--text-muted);
  line-height: 1.8;
  font-size: 1.02rem;
}
.content ul, .content ol { padding-left: 20px; }
.content li { margin-bottom: 8px; }
.content li::marker { color: var(--accent); }
.content strong { color: var(--text-soft); }

/* Steps */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0 10px;
}
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }
.step-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.step-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.step-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--gradient);
}
.step-num {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--gradient);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: var(--shadow-accent);
}
.step-card h3 { margin: 0 0 7px; font-size: 1.04rem; }
.step-card p { margin: 0; color: var(--text-muted); font-size: 0.93rem; line-height: 1.65; }

/* FAQ */
.faq-list {
  max-width: var(--max-prose);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: none; }
.faq-item summary {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  padding: 17px 20px;
  font-weight: 600;
  font-size: 0.99rem;
  color: var(--text);
  list-style: none;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "";
  margin-left: auto;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-faint);
  border-bottom: 2px solid var(--text-faint);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.22s var(--ease), border-color 0.22s var(--ease);
}
.faq-item summary:hover { background: var(--surface-2); color: var(--accent); }
.faq-item[open] summary { color: var(--accent); }
.faq-item[open] summary::after {
  transform: rotate(-135deg) translate(-2px, -2px);
  border-color: var(--accent);
}
.faq-item p {
  margin: 0;
  padding: 0 20px 19px;
  color: var(--text-muted);
  font-size: 0.96rem;
  line-height: 1.75;
}

/* Related links */
.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin: 22px 0 10px;
}
.link-card {
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 44px 18px 18px;
  color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.link-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  color: var(--text);
}
.link-card strong { display: block; font-weight: 700; font-size: 0.96rem; line-height: 1.35; }
.link-card span {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 5px;
  line-height: 1.55;
}
.link-card::after {
  content: "\2192";
  position: absolute;
  top: 18px;
  right: 18px;
  color: var(--text-faint);
  transition: transform 0.2s var(--ease), color 0.2s var(--ease);
}
.link-card:hover::after { color: var(--accent); transform: translateX(3px); }

/* CTA band */
.cta-band {
  margin: 56px 0 10px;
  border-radius: var(--radius-xl);
  padding: 44px 34px;
  text-align: center;
  background: var(--gradient);
  color: #fff;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.cta-band::after {
  content: "";
  position: absolute;
  inset: -50% -10% auto;
  height: 240px;
  background: radial-gradient(50% 60% at 50% 50%, rgba(255, 255, 255, 0.28), transparent 70%);
  pointer-events: none;
}
.cta-band h2 {
  color: #fff;
  margin: 0 0 10px;
  font-size: clamp(1.4rem, 3vw, 2rem);
}
.cta-band p {
  color: rgba(255, 255, 255, 0.9);
  margin: 0 auto 22px;
  max-width: 520px;
}
.btn-light {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: #fff;
  color: #2c1a70;
  border: none;
  border-radius: 999px;
  padding: 13px 26px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.5);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.btn-light svg { width: 18px; height: 18px; flex: 0 0 auto; }
.btn-light:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px -14px rgba(0, 0, 0, 0.55);
  color: #2c1a70;
}

/* =========================================================================
   Footer
   ========================================================================= */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-veil);
  padding: 54px 0 30px;
  margin-top: 64px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 30px;
}
@media (max-width: 820px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 26px; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }

.footer-brand .brand { font-size: 1.05rem; }
.footer-tagline {
  color: var(--text-muted);
  font-size: 0.88rem;
  max-width: 290px;
  margin: 14px 0 16px;
  line-height: 1.65;
}
.footer-badges { display: flex; flex-wrap: wrap; gap: 7px; }
.footer-badges span {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 11px;
}
.footer-col h4 {
  font-size: 0.73rem;
  margin: 0 0 13px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
}
.footer-col a {
  display: block;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 10px;
  transition: color 0.16s var(--ease), transform 0.16s var(--ease);
}
.footer-col a:hover { color: var(--accent); transform: translateX(2px); }
.footer-bottom {
  margin-top: 38px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-faint);
  font-size: 0.82rem;
}

/* =========================================================================
   Small screens — tighten the fold so the tool is reachable fast
   ========================================================================= */
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .hero { padding: 30px 0 20px; }
  .eyebrow { margin-bottom: 16px; font-size: 0.76rem; padding: 6px 13px 6px 10px; }
  .hero h1 { max-width: 100%; font-size: clamp(1.95rem, 8.5vw, 2.5rem); margin-bottom: 14px; }
  .hero-lede { font-size: 0.98rem; }
  .hero-stats { gap: 8px; margin-top: 18px; }
  .hero-stats li { padding: 6px 12px; font-size: 0.79rem; }
  .studio-rail { padding: 16px; gap: 14px; }
  #text-input { min-height: 96px; font-size: 1rem; }
  .panel { padding: 16px; }
  .result-card { padding: 13px 14px; }
  .site-footer { padding: 40px 0 26px; margin-top: 44px; }
  .cta-band { padding: 34px 22px; }
  .content h2 { margin-top: 42px; }
}

/* =========================================================================
   Motion preferences
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
