@import url('https://fonts.googleapis.com/css2?family=Pathway+Extreme:opsz,wght@8..144,100..900&family=Bitter:ital,wght@0,100..900;1,100..900&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:           #ffffff;
  --text:         #0a0a0a;
  --text-muted:   #666660;
  --border:       #0a0a0a;
  --btn-fill-bg:  #0a0a0a;
  --btn-fill-txt: #ffffff;

  --font-display: 'Pathway Extreme', sans-serif;
  --font-body:    'Bitter', serif;

  --fv-header: 'wght' 748, 'wdth' 100, 'opsz' 72;
  --fv-ui:     'wght' 700, 'wdth' 88.75, 'opsz' 18;

  --rule-solid:  3px solid var(--border);
  --rule-dashed: 3px dashed var(--border);

  --radius-pill: 999px;
  --radius-md:   8px;
}

[data-theme="dark"] {
  --bg:           #111110;
  --text:         #f0efe8;
  --text-muted:   #888880;
  --border:       #f0efe8;
  --btn-fill-bg:  #f0efe8;
  --btn-fill-txt: #111110;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 1.0625rem;
  line-height: 1.75;
  transition: background 0.2s, color 0.2s;
  min-height: 100vh;
}

/* ── Page wrapper ───────────────────────────────────────────── */
.page-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 2rem 0;
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.site-logo {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-header);
  font-size: clamp(3rem, 8vw, 5.5rem);
  line-height: 1.0;
  color: var(--text);
  text-decoration: none;
  display: block;
}

/* ── Theme toggle — pill with sliding icon ──────────────────── */
.theme-toggle {
  position: relative;
  width: 72px;
  height: 36px;
  border: 3px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 0.75rem;
  transition: background 0.2s, border-color 0.2s;
  padding: 0;
}

/* The sliding knob */
.theme-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--border);
  transition: transform 0.25s cubic-bezier(.4,0,.2,1), background 0.2s;
}

[data-theme="dark"] .theme-toggle::after {
  transform: translateX(36px);
}

/* Both icons sit inside the pill */
.theme-toggle .t-icons {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
  pointer-events: none;
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

/* Moon on left, sun on right */
.icon-moon { fill: var(--bg); opacity: 1; }
.icon-sun  { fill: var(--border); opacity: 0.45; }

/* Dark mode: moon fades, sun becomes active under the knob */
[data-theme="dark"] .icon-moon { fill: var(--border); opacity: 0.45; }
[data-theme="dark"] .icon-sun  { fill: var(--bg); opacity: 1; }

.hero-sub {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-ui);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.hero-intro {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-muted);
  max-width: 600px;
  padding-bottom: 1.5rem;
}
.hero-intro a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
}
.hero-intro a:hover { color: var(--text-muted); }

/* ── Screen-reader / crawler only ──────────────────────────── */
.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;
}

/* ── Header border — solid ──────────────────────────────────── */
.header-rule { border: none; border-top: var(--rule-solid); margin: 0; }

/* ── Main ───────────────────────────────────────────────────── */
.main {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 2rem 6rem;
}

/* ── Eyebrows ───────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-ui);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: block;
}

/* ── Steps — dashed separators between, solid at last ──────── */
.step {
  border-top: var(--rule-dashed);
  padding: 2rem 0;
}
.step:last-of-type {
  border-bottom: var(--rule-dashed);
}
/* First step sits directly under the solid header rule — no double border */
.step--first {
  border-top: none;
}

.step-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.step-num {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-header);
  font-size: 2rem;
  line-height: 1;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 2rem;
}

.step-title {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-ui);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}

/* ── Search ─────────────────────────────────────────────────── */
.search-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

select,
input[type="text"] {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-ui);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  background: var(--bg);
  color: var(--text);
  border: 3px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.55rem 1rem;
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

select { padding-right: 2rem; background-image: none; cursor: pointer; }
input[type="text"] { flex: 1; }
input[type="text"]::placeholder { color: var(--text-muted); }
input[type="text"]:focus, select:focus { border-color: var(--border); }

/* ── Article indicator ──────────────────────────────────────── */
.article-row {
  display: none;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.article-row.visible { display: flex; }

.article-indicator {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-ui);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.article-indicator strong { color: var(--text); }

.article-link {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-ui);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
}
.article-link:hover { color: var(--text-muted); border-color: var(--text-muted); }

/* ── Search results ─────────────────────────────────────────── */
.search-results {
  border: 3px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 0.75rem;
  display: none;
}
.search-results.visible { display: block; }

.result-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.result-item:last-child { border-bottom: none; }
.result-item:hover { background: color-mix(in srgb, var(--border) 8%, var(--bg)); }

.result-item-title {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-ui);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}
.result-item-desc {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ── Presets ────────────────────────────────────────────────── */
.presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.preset-btn {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-ui);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 3px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  padding: 0.4rem 1rem;
  cursor: pointer;
  transition: all 0.15s;
}
.preset-btn:hover { color: var(--text); }
.preset-btn.active {
  background: var(--btn-fill-bg);
  color: var(--btn-fill-txt);
  border-color: var(--btn-fill-bg);
}

/* ── Spinners — only paragraphs + bullets ───────────────────── */
.spinners {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
}

.spinner-field { display: flex; flex-direction: column; gap: 0.5rem; }

.spinner-label {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-ui);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.spinner-row { display: flex; align-items: center; gap: 0.75rem; }

.spin-btn {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.spin-btn:hover { background: var(--btn-fill-bg); color: var(--btn-fill-txt); }

.spin-val {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-header);
  font-size: 1.75rem;
  line-height: 1;
  color: var(--text);
  min-width: 2ch;
  text-align: center;
}

/* ── Toggle groups ──────────────────────────────────────────── */
.toggle-group { display: flex; gap: 8px; flex-wrap: wrap; }

.toggle-btn {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-ui);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 3px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  padding: 0.4rem 1rem;
  cursor: pointer;
  transition: all 0.15s;
}
.toggle-btn:hover { color: var(--text); }
.toggle-btn.active {
  background: var(--btn-fill-bg);
  color: var(--btn-fill-txt);
  border-color: var(--btn-fill-bg);
}

/* ── Options row ────────────────────────────────────────────── */
.options-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
@media (max-width: 580px) {
  .options-row { grid-template-columns: 1fr; gap: 1.25rem; }
}
.option-group { display: flex; flex-direction: column; gap: 0.75rem; }

/* ── Generate ───────────────────────────────────────────────── */
.generate-wrap {
  margin-top: 2.5rem;
  margin-bottom: 1.5rem;
  padding-top: 2.5rem;
  border-top: var(--rule-dashed);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.btn-generate {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-ui);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 3px solid var(--btn-fill-bg);
  border-radius: var(--radius-pill);
  background: var(--btn-fill-bg);
  color: var(--btn-fill-txt);
  padding: 0.65rem 2rem;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-generate:hover:not(:disabled) { opacity: 0.8; }
.btn-generate:disabled { opacity: 0.3; cursor: not-allowed; }

.status-text {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-ui);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Output ─────────────────────────────────────────────────── */
.output-section { margin-top: 0; display: none; }
.output-section.visible { display: block; }

.btn-outline {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-ui);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 3px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  padding: 0.4rem 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s, color 0.15s;
}
.btn-outline:hover { background: var(--btn-fill-bg); color: var(--btn-fill-txt); }

/* Output area — matches page style, no background fill */
.output-area {
  background: var(--bg);
  border: 3px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  min-height: 120px;
  max-height: 560px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.output-area::-webkit-scrollbar { width: 3px; }
.output-area::-webkit-scrollbar-track { background: transparent; }
.output-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 0; }

/* Rich text output typography */
.output-area .out-h1 {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-header);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  line-height: 1.1;
  color: var(--text);
  margin: 0 0 1rem;
}
.output-area .out-h2 {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-ui);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  margin: 1.5rem 0 0.5rem;
}
.output-area .out-p {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 1rem;
}
.output-area .out-ul {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--text);
  padding-left: 1.25rem;
  margin: 0 0 1rem;
}
.output-area .out-ul li { margin-bottom: 0.35rem; }

/* Raw text output */
.output-area.raw {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Attribution ────────────────────────────────────────────── */
.attribution {
  margin-top: 1rem;
  font-family: var(--font-display);
  font-variation-settings: var(--fv-ui);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.attribution a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
}
.attribution a:hover { color: var(--text-muted); }

/* ── Footer ─────────────────────────────────────────────────── */
.footer-rule { border: none; border-top: var(--rule-solid); margin: 0; }
.site-footer {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.25rem 2rem;
}
.site-footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.footer-text {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-ui);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.footer-text a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
}
.footer-text a:hover { color: var(--text-muted); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .site-header { padding: 1.25rem 1rem 0; }
  .main { padding: 0 1rem 4rem; }
  .search-row { flex-direction: column; }
  select { width: 100%; }
  .generate-wrap { flex-direction: column; align-items: flex-start; }
}
