/* ─────────────────────────────────────────────────────────
   FontAI — single stylesheet
   "Type specimen": warm paper, black ink, vermilion accent, ruled lines.
   ───────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
[id] { scroll-margin-top: 84px; } /* keep anchored sections clear of the sticky header */

:root {
  --paper:       #f5f0e6;
  --paper-2:     #ede5d5;
  --card:        #fffdf8;
  --ink:         #161412;
  --ink-mid:     #4a443d;
  --ink-dim:     #7c7366;
  --rule:        #d6ccba;
  --accent:      #d9412a;
  --accent-dark: #a92f1c;
  --serif:       Georgia, "Times New Roman", Times, serif;
  --sans:        system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  --mono:        ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius:      3px;
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1160px; margin: 0 auto; padding: 0 22px; }

a { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.12; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); letter-spacing: -.025em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
code { font-family: var(--mono); font-size: .88em; background: var(--paper-2); padding: 1px 6px; border-radius: 2px; }
.muted { color: var(--ink-dim); }
.small { font-size: .88rem; }
.kicker { font-family: var(--mono); font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; color: var(--accent-dark); margin: 0 0 14px; }
.lead { font-size: 1.15rem; color: var(--ink-mid); max-width: 62ch; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 14px; }
.skip-link:focus { left: 8px; }
.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 ───────────────────────────────────────────── */
.site-header { border-bottom: 2px solid var(--ink); background: var(--paper); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.logo em, .footer-logo em { font-style: italic; color: var(--accent); }
.logo:hover { color: var(--ink); }
.site-nav { display: flex; gap: 4px; }
.site-nav a { color: var(--ink); text-decoration: none; padding: 8px 12px; font-size: .95rem; border-radius: var(--radius); }
.site-nav a:hover { background: var(--ink); color: var(--paper); }
.nav-toggle { display: none; width: 44px; height: 44px; padding: 11px 10px; border: 2px solid var(--ink); background: transparent; border-radius: var(--radius); }
.nav-toggle span { display: block; height: 2px; margin: 4px 0; background: var(--ink); }

/* ── BUTTONS ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 22px; border: 2px solid var(--ink); border-radius: var(--radius);
  background: transparent; color: var(--ink); font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background .15s, color .15s, transform .05s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn--accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn--sm { min-height: 36px; padding: 6px 14px; font-size: .9rem; }

/* ── HERO / GENERATOR ─────────────────────────────────── */
.hero { padding: 54px 0 36px; border-bottom: 1px solid var(--rule); }
.hero h1 { margin-bottom: .2em; }
.hero h1 em { font-style: italic; color: var(--accent); }
.ask { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: end; margin-top: 28px; max-width: 980px; }
.ask__field { display: flex; flex-direction: column; gap: 6px; }
.ask__label { font-family: var(--mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-dim); }
.ask input[type="text"] {
  width: 100%; padding: 10px 2px; border: 0; border-bottom: 3px solid var(--ink); background: transparent;
  font-family: var(--serif); font-size: clamp(1.25rem, 2.6vw, 1.75rem); border-radius: 0;
}
.ask input[type="text"]::placeholder { color: #a99f90; font-style: italic; }
.ask input[type="text"]:focus { outline: none; border-bottom-color: var(--accent); }
.ask select {
  min-height: 48px; padding: 8px 34px 8px 12px; border: 2px solid var(--ink); border-radius: var(--radius); background: var(--card);
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 12px) 21px; background-size: 6px 6px; background-repeat: no-repeat;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.chips__label { font-family: var(--mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-dim); align-self: center; margin-right: 4px; }
.chip { padding: 6px 14px; border: 1px solid var(--ink); border-radius: 999px; background: transparent; font-size: .92rem; }
.chip:hover { background: var(--ink); color: var(--paper); }

.status { margin-top: 26px; max-width: 980px; }
.status__bar { height: 4px; background: var(--rule); overflow: hidden; }
.status__bar span { display: block; height: 100%; width: 3%; background: var(--accent); transition: width .5s ease; }
.status p { margin: 10px 0 0; font-family: var(--mono); font-size: .88rem; color: var(--ink-mid); }
.error { margin: 22px 0 0; max-width: 980px; padding: 12px 16px; border-left: 4px solid var(--accent); background: #fbe9e4; color: #6d1f12; }

/* ── RESULT ───────────────────────────────────────────── */
.result { padding-top: 40px; padding-bottom: 10px; }
.result__bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px; padding-bottom: 18px; border-bottom: 2px solid var(--ink); }
.result__bar h2 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.8rem); overflow-wrap: anywhere; }
.result__bar p { margin: 6px 0 0; }
.result__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.tester { padding: 22px 0; border-bottom: 1px solid var(--rule); }
.tester__controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin-bottom: 14px; }
.tester__controls label { display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-dim); }
.tester__controls input[type="range"] { width: 180px; accent-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--ink); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; border-right: 1px solid var(--ink); background: transparent; padding: 6px 12px; font-size: .88rem; }
.seg button:last-child { border-right: 0; }
.seg button.is-active, .seg button:hover { background: var(--ink); color: var(--paper); }
.tester__sample {
  min-height: 1.4em; font-size: 72px; line-height: 1.25; padding: 6px 2px; overflow-wrap: anywhere;
  border-radius: var(--radius); outline-offset: 6px;
}
.tester__sample:focus { outline: 2px dashed var(--rule); }
.glyphs { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); border-left: 1px solid var(--rule); border-top: 1px solid var(--rule); margin: 26px 0 0; }
.glyphs span {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 1; font-size: 2rem;
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--card);
}
.result__help { margin-top: 14px; }

/* ── RECENT ───────────────────────────────────────────── */
.recent { padding-top: 34px; padding-bottom: 6px; }
.recent__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.recent__item { position: relative; border: 1px solid var(--rule); background: var(--card); border-radius: var(--radius); }
.recent__open { display: block; width: 100%; padding: 16px 16px 14px; border: 0; background: none; text-align: left; }
.recent__open b { display: block; font-size: 2.4rem; font-weight: normal; line-height: 1.1; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent__open span { display: block; font-size: .82rem; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent__del { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-dim); font-size: 1.1rem; }
.recent__del:hover { background: var(--ink); color: var(--paper); }

/* ── CONTENT ──────────────────────────────────────────── */
.section { padding: 52px 0; border-bottom: 1px solid var(--rule); }
.section:last-of-type { border-bottom: 0; }
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px; }
.col h3 { display: flex; gap: 10px; align-items: baseline; }
.col h3 span { font-family: var(--mono); font-size: .8rem; color: var(--accent-dark); }
.col p { color: var(--ink-mid); margin: 0; }
.twocol { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 34px; }
.twocol p, .twocol li { color: var(--ink-mid); }
.ticks { list-style: none; padding: 0; margin: 0; }
.ticks li { padding: 10px 0 10px 30px; border-bottom: 1px solid var(--rule); position: relative; }
.ticks li::before { content: "✓"; position: absolute; left: 4px; color: var(--accent-dark); font-weight: 700; }
.ticks li.no::before { content: "✕"; color: var(--ink-dim); }

.ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0; border-left: 1px solid var(--rule); border-top: 1px solid var(--rule); margin-bottom: 30px; }
.idea { padding: 18px 18px 16px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--card); display: flex; flex-direction: column; gap: 8px; }
.idea h3 { margin: 0; }
.idea p { margin: 0; color: var(--ink-mid); font-family: var(--serif); font-style: italic; flex: 1; }
.idea .btn { align-self: flex-start; }

.faq details { border-bottom: 1px solid var(--rule); padding: 16px 0; }
.faq details:first-of-type { border-top: 1px solid var(--rule); }
.faq summary { cursor: pointer; font-family: var(--serif); font-size: 1.2rem; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 18px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); color: var(--accent); }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 10px 0 0; color: var(--ink-mid); max-width: 75ch; }

.prose { max-width: 760px; padding-top: 34px; padding-bottom: 50px; }
.prose--wide { max-width: 1160px; }
.prose h2 { margin-top: 1.6em; font-size: 1.6rem; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .45em; }
.breadcrumb { font-family: var(--mono); font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-dim); margin-bottom: 20px; }
.breadcrumb a { color: var(--ink-mid); text-decoration: none; }
.note { padding: 16px 18px; border: 1px solid var(--ink); background: var(--card); border-radius: var(--radius); margin: 22px 0; }
.note p:last-child { margin: 0; }

/* ── FOOTER ───────────────────────────────────────────── */
.site-footer { background: var(--ink); color: #d9d2c4; padding: 44px 0 22px; margin-top: 40px; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 30px; }
.footer-logo { font-family: var(--serif); font-size: 1.8rem; font-weight: 700; color: var(--paper); }
.footer-col { display: flex; flex-direction: column; gap: 6px; }
.footer-col strong { font-family: var(--mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .14em; color: #9d9384; margin-bottom: 4px; font-weight: 400; }
.footer-col a { color: var(--paper); text-decoration: none; }
.footer-col a:hover { color: #ffb4a6; }
.footer-col p { color: #b9b0a1; font-size: .95rem; max-width: 40ch; }
.footer-bottom { margin-top: 30px; padding-top: 16px; border-top: 1px solid #3a352f; }
.footer-bottom p { margin: 0; font-size: .82rem; color: #9d9384; }

/* ── TOAST ────────────────────────────────────────────── */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 90; transform: translate(-50%, 16px); opacity: 0; padding: 10px 18px; background: var(--ink); color: var(--paper); border-radius: var(--radius); transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 900px) {
  .ask { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ask__field--prompt { grid-column: 1 / -1; }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .twocol { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  body { font-size: 16px; }
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; padding: 8px 22px 16px; background: var(--paper); border-bottom: 2px solid var(--ink); }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px 4px; }
  .hero { padding-top: 34px; }
  .ask { grid-template-columns: minmax(0, 1fr); }
  .ask .btn, .ask select { width: 100%; }
  .tester__sample { font-size: 44px; }
  .tester__controls label { width: 100%; }
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1; padding: 6px 4px; }
  .glyphs { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); }
  .glyphs span { font-size: 1.6rem; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-col--about { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .status__bar span, .btn, .toast { transition: none; }
}
