/* ==========================================================================
   SignSorted — shared stylesheet
   Used by the hub, the tools and all guide pages.
   ========================================================================== */

:root {
  --accent: #1d4ed8;
  --accent-strong: #1a43bb;
  --accent-soft: #eef3ff;
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --paper: #fdfdfb;
  --fg: #16181d;
  --fg-muted: #5b616e;
  --border: #e5e7eb;
  --shadow: 0 1px 2px rgba(16, 18, 29, 0.05), 0 8px 24px -12px rgba(16, 18, 29, 0.12);
  --max: 1080px;
  --prose: 720px;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #8ab0ff;
    --accent-strong: #a5c3ff;
    --accent-soft: #16233f;
    --bg: #101216;
    --bg-alt: #171a20;
    --paper: #171a20;
    --fg: #e8eaee;
    --fg-muted: #9aa2b1;
    --border: #2a2f3a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:hover { color: var(--accent-strong); }

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- header ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-head .inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
}
.brand em {
  font-style: normal;
  color: var(--accent);
}
.site-head nav {
  display: flex;
  gap: 18px;
  font-size: 15px;
  flex-wrap: wrap;
}
.site-head nav a {
  color: var(--fg-muted);
  text-decoration: none;
  white-space: nowrap;
}
.site-head nav a:hover { color: var(--fg); }
.site-head nav a[aria-current="page"] { color: var(--fg); font-weight: 600; }

/* ---------- layout ---------- */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 30px 20px 72px;
}
.narrow { max-width: var(--prose); }

.kicker {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}
h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 4.6vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.022em;
}
.lead {
  margin: 0 0 26px;
  font-size: 19px;
  line-height: 1.55;
  color: var(--fg-muted);
  max-width: 62ch;
}

/* ---------- prose ---------- */
.prose { max-width: var(--prose); }
.prose h2 {
  margin: 2.1em 0 0.6em;
  font-size: 26px;
  letter-spacing: -0.014em;
  line-height: 1.25;
}
.prose h3 {
  margin: 1.6em 0 0.5em;
  font-size: 19px;
}
.prose ul, .prose ol { padding-left: 1.35em; }
.prose li { margin: 0.4em 0; }
.prose p { margin: 0.9em 0; }

/* ---------- card / callout / buttons ---------- */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.callout {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 22px 0;
}
.callout p { margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font: 600 16px/1 inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.05s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.45; cursor: default; pointer-events: none; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
@media (prefers-color-scheme: dark) {
  .btn-primary { color: #101216; }
  .btn-primary:hover { color: #101216; }
}

.tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 650;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 3px 10px;
  vertical-align: 2px;
  white-space: nowrap;
}

/* ---------- FAQ ---------- */
.faq details {
  border-bottom: 1px solid var(--border);
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: 15px 0;
  list-style-position: outside;
}
.faq details p {
  margin: 0 0 15px;
  color: var(--fg-muted);
  max-width: var(--prose);
}

/* ---------- homepage: hero ---------- */
.hero { padding: 26px 0 10px; }
.hero .sig-svg {
  display: block;
  width: min(430px, 78vw);
  height: auto;
  margin: 6px 0 18px;
}
.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 8px;
}
.hero-note {
  font-size: 14px;
  color: var(--fg-muted);
  margin: 12px 0 0;
}

/* ---------- homepage: tool cards ---------- */
.tool-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 34px 0 10px;
}
.tool-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  background: var(--bg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tool-card h2 { margin: 0; font-size: 22px; letter-spacing: -0.012em; }
.tool-card p { margin: 0; color: var(--fg-muted); }
.tool-card .go {
  margin-top: auto;
  padding-top: 8px;
  font-weight: 600;
  text-decoration: none;
}
.tool-card .go:hover { text-decoration: underline; }

/* ---------- homepage: steps ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 18px 0 8px;
}
.step { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.step .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 10px;
}
.step h3 { margin: 0 0 6px; font-size: 17px; }
.step p { margin: 0; font-size: 15px; color: var(--fg-muted); }

/* ---------- homepage: use cases ---------- */
.usecases {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 18px 0 8px;
}
.usecase {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.usecase h3 { margin: 0 0 6px; font-size: 16px; }
.usecase p { margin: 0; font-size: 14.5px; color: var(--fg-muted); }
.usecase a { text-decoration: none; font-weight: 600; }

/* ---------- homepage: font teaser ---------- */
.font-teaser {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 18px 0 8px;
}
.font-sample {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 10px;
}
.font-sample .sample {
  font-size: 30px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.font-sample .meta {
  margin-top: 6px;
  font-size: 13px;
  color: var(--fg-muted);
}

/* ==========================================================================
   Tool page
   ========================================================================== */

.tool {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin: 8px 0 12px;
}

.tool-tabs {
  display: flex;
  gap: 8px;
  padding: 14px 16px 0;
}
.tab {
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--fg-muted);
  font: 600 15.5px/1 inherit;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab:hover { border-color: var(--accent); color: var(--accent); }
.tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  .tab.is-active { color: #101216; }
}

.stage {
  position: relative;
  margin: 14px 16px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background-color: var(--paper);
  background-image: radial-gradient(color-mix(in srgb, var(--accent) 7%, transparent) 1.1px, transparent 1.4px);
  background-size: 22px 22px;
  aspect-ratio: 1000 / 360;
  overflow: hidden;
}
.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  z-index: 1;
}
.stage .baseline {
  position: absolute;
  left: 9%;
  right: 9%;
  bottom: 27%;
  border-bottom: 2px dashed color-mix(in srgb, var(--fg-muted) 34%, transparent);
  z-index: 0;
}
.stage .baseline::before {
  content: "×";
  position: absolute;
  left: -22px;
  bottom: -14px;
  font-size: 20px;
  color: color-mix(in srgb, var(--fg-muted) 45%, transparent);
}
.stage .stage-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 20px;
  font-size: 17px;
  color: color-mix(in srgb, var(--fg-muted) 78%, transparent);
  pointer-events: none;
  z-index: 2;
}

.controls {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ctrl-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}
.ctrl-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-muted);
  min-width: 74px;
}

.swatches { display: flex; gap: 10px; align-items: center; }
.swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 2px var(--bg), 0 0 0 1px var(--border);
  background: var(--c);
  cursor: pointer;
  padding: 0;
}
.swatch.is-active { border-color: var(--accent); }
.swatch-custom {
  position: relative;
  overflow: hidden;
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
}
.swatch-custom input {
  position: absolute;
  inset: -6px;
  opacity: 0;
  cursor: pointer;
}

input[type="range"] {
  accent-color: var(--accent);
  width: min(220px, 46vw);
}
.range-value {
  font-size: 13px;
  color: var(--fg-muted);
  min-width: 2.4em;
}

.text-field input[type="text"] {
  font: 400 17px/1.3 inherit;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  width: min(380px, 100%);
}
.text-field input[type="text"]:focus {
  border-color: var(--accent);
  outline: none;
}

.font-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
  width: 100%;
}
.font-chip {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  font-size: 21px;
  line-height: 1.15;
  padding: 9px 10px;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.font-chip:hover { border-color: var(--accent); }
.font-chip.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.tool-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.tool-actions .btn-primary { min-width: 180px; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  background: var(--fg);
  color: var(--bg);
  font-size: 15px;
  padding: 11px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  max-width: min(90vw, 480px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- footer ---------- */
.site-foot {
  border-top: 1px solid var(--border);
  margin-top: 30px;
  padding: 30px 20px 44px;
  font-size: 14px;
  color: var(--fg-muted);
}
.site-foot .inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.site-foot nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.site-foot nav a { color: var(--fg-muted); text-decoration: none; }
.site-foot nav a:hover { color: var(--fg); }
.site-foot p { margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .tool-cards { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .font-teaser { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  main { padding: 22px 16px 56px; }
  .site-head nav { gap: 12px; font-size: 14px; }
  .font-teaser { grid-template-columns: 1fr; }
  .stage { margin: 12px 10px 0; }
  .controls { padding: 13px 12px; }
  .tool-actions { justify-content: stretch; }
  .tool-actions .btn { flex: 1; min-width: 0; }
  .tool-actions .btn-primary { min-width: 0; }
  .font-chips { grid-template-columns: repeat(2, 1fr); }
  .font-chip { font-size: 18px; }
}

/* ==========================================================================
   Email signature tool page
   ========================================================================== */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  width: 100%;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
}
.field input[type="text"],
.field input[type="url"],
.field input[type="email"] {
  font: 400 15.5px/1.3 inherit;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  width: 100%;
}
.field input:focus { border-color: var(--accent); outline: none; }
.field input[type="color"] {
  width: 100%;
  height: 44px;
  padding: 4px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
}
.field-full { grid-column: 1 / -1; }
.field .field-hint { font-size: 12.5px; color: var(--fg-muted); }

.tpl-row { display: flex; gap: 8px; flex-wrap: wrap; }

.sig-preview {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
  margin-top: 4px;
}
.sig-preview iframe {
  display: block;
  width: 100%;
  height: 250px;
  border: 0;
  background: #ffffff;
}

/* ==========================================================================
   Font gallery page
   ========================================================================== */

.font-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 22px 0 8px;
}
.font-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.font-card .glyph {
  font-size: 38px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
}
.font-card h3 { margin: 0; font-size: 16px; }
.font-card p { margin: 0; font-size: 14px; color: var(--fg-muted); }
.font-card .try {
  margin-top: auto;
  padding-top: 8px;
  font-weight: 600;
  text-decoration: none;
  font-size: 14.5px;
}
.font-card .try:hover { text-decoration: underline; }

/* ==========================================================================
   Guide pages
   ========================================================================== */

.meta-line {
  font-size: 14px;
  color: var(--fg-muted);
  margin: 0 0 18px;
}

.answer-box {
  border-left: 4px solid var(--accent);
  background: var(--bg-alt);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px;
  margin: 18px 0 26px;
  max-width: var(--prose);
}
.answer-box p { margin: 0; }
.answer-box .label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}

.cta-card {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--accent-soft);
  padding: 18px 22px;
  margin: 26px 0;
  flex-wrap: wrap;
  max-width: var(--prose);
}
.cta-card .cta-text { max-width: 58ch; }
.cta-card h3 { margin: 0 0 4px; font-size: 18px; }
.cta-card p { margin: 0; color: var(--fg-muted); font-size: 15px; }

/* ==========================================================================
   Responsive additions for the blocks above
   ========================================================================== */

@media (max-width: 820px) {
  .font-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .font-grid { grid-template-columns: 1fr; }
  .cta-card { flex-direction: column; align-items: flex-start; }
}
