/* Humanly — design system. Paper-and-ink neutrals around the brand violet. */

:root {
  --bg: #f9f8fc;
  --surface: #ffffff;
  --surface-2: #f1eff8;
  --ink: #201c33;
  --muted: #5f5a75;
  --faint: #8d88a3;
  --line: #e5e2f0;
  --line-strong: #d2cde4;
  --accent: #6d56f5;
  --accent-hover: #5b44e0;
  --accent-ink: #ffffff;
  --accent-soft: #ece8fe;
  --good: #1d7a53;
  --good-soft: #e2f2ea;
  --warn: #a16207;
  --warn-soft: #fdf1d8;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --mark: #fde68a;
  --diff-add: #d7efe2;
  --diff-add-ink: #14532d;
  --diff-del: #fbe0dd;
  --diff-del-ink: #7f1d1d;

  --shadow-ink: 32 28 51;
  --font-ui: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, monospace;

  --fs-sm: clamp(0.8rem, 0.78rem + 0.1vw, 0.85rem);
  --fs-base: clamp(0.95rem, 0.9rem + 0.25vw, 1.05rem);
  --fs-lg: clamp(1.1rem, 1rem + 0.5vw, 1.3rem);
  --fs-xl: clamp(1.4rem, 1.2rem + 1vw, 1.9rem);
  --fs-hero: clamp(1.9rem, 1.4rem + 2.6vw, 3.1rem);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --shadow-1: 0 1px 2px rgb(var(--shadow-ink) / 0.06), 0 2px 8px rgb(var(--shadow-ink) / 0.05);
  --shadow-2: 0 4px 12px rgb(var(--shadow-ink) / 0.08), 0 12px 32px rgb(var(--shadow-ink) / 0.1);
  --space: clamp(1rem, 0.8rem + 1vw, 1.5rem);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131120;
    --surface: #1b1830;
    --surface-2: #241f3d;
    --ink: #e9e7f5;
    --muted: #a29dbd;
    --faint: #746e91;
    --line: #2e2a4a;
    --line-strong: #3f3a61;
    --accent: #8f7bff;
    --accent-hover: #a493ff;
    --accent-ink: #16123a;
    --accent-soft: #2b2452;
    --good: #4cc38a;
    --good-soft: #16281f;
    --warn: #e0b350;
    --warn-soft: #2d2415;
    --bad: #f2726a;
    --bad-soft: #331b18;
    --mark: #5c4a12;
    --diff-add: #1d3428;
    --diff-add-ink: #a7e0c0;
    --diff-del: #3b211e;
    --diff-del-ink: #f0b6ae;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-2: 0 8px 24px rgb(0 0 0 / 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--r-sm) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

.wrap {
  width: min(100% - 2rem, 1060px);
  margin-inline: auto;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 60px;
}
.wordmark {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.wordmark img { border-radius: 7px; display: block; }
.wordmark .dot { color: var(--accent); }
.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 0.45rem 0.7rem;
  border-radius: var(--r-sm);
}
.site-nav a:hover { color: var(--ink); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--ink); }
.nav-cta {
  color: var(--accent) !important;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.nav-cta:hover { background: var(--accent-soft) !important; }
.pro-chip {
  display: none;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--good);
  background: var(--good-soft);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
}
body.is-pro .pro-chip { display: inline-block; }
body.is-pro .nav-cta { display: none; }

/* ---------- Hero ---------- */
.hero { padding: clamp(2rem, 5vw, 3.5rem) 0 1.25rem; text-align: center; }
.hero h1 {
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
}
.hero h1 em { font-style: italic; color: var(--accent); }
.hero p {
  max-width: 42rem;
  margin: 0 auto;
  color: var(--muted);
  font-size: var(--fs-lg);
}
.trust-note {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.9rem;
  font-size: var(--fs-sm);
  color: var(--faint);
}

/* ---------- Tool ---------- */
.tool {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: var(--space);
  margin-top: 1.5rem;
}
.tool-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.9rem;
}
.control-group { display: flex; flex-direction: column; gap: 0.3rem; }
.control-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 3px;
}
.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}
.segmented button:active { transform: scale(0.97); }
.segmented button .lock { font-size: 0.75em; margin-left: 0.2rem; }
body.is-pro .segmented button .lock,
body.is-pro .locked-tag { display: none; }

select.style-select {
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.5rem 0.7rem;
  cursor: pointer;
}

.editor {
  width: 100%;
  min-height: 13rem;
  resize: vertical;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 0.9rem 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.editor:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.tool-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-top: 0.7rem;
  min-height: 2.4rem;
}
.word-counter { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.word-counter.near { color: var(--warn); font-weight: 700; }
.word-counter.over { color: var(--bad); font-weight: 700; }
.uses-left { font-size: var(--fs-sm); color: var(--faint); font-variant-numeric: tabular-nums; }
.tool-actions { margin-left: auto; display: flex; gap: 0.6rem; align-items: center; }

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: var(--fs-sm);
  padding: 0.55rem 1rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.06s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-size: var(--fs-base);
  padding: 0.65rem 1.4rem;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

/* ---------- Status / loading ---------- */
.status-line {
  display: none;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.9rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.status-line.visible { display: flex; }
.status-line.error { background: var(--bad-soft); color: var(--bad); }
.status-line.warn { background: var(--warn-soft); color: var(--warn); }
.spinner {
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-track {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.4s ease;
}

/* ---------- Results ---------- */
.results { display: none; margin-top: 1.4rem; }
.results.visible { display: block; animation: rise 0.35s ease; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}
.results-head h2 { font-size: var(--fs-lg); margin: 0; font-family: var(--font-display); }
.view-toggle { margin-left: auto; }
.output-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1rem 1.1rem;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  max-height: 26rem;
  overflow-y: auto;
}
.output-pane ins {
  text-decoration: none;
  background: var(--diff-add);
  color: var(--diff-add-ink);
  border-radius: 3px;
  padding: 0 2px;
}
.output-pane del {
  text-decoration: line-through;
  background: var(--diff-del);
  color: var(--diff-del-ink);
  border-radius: 3px;
  padding: 0 2px;
}
.output-pane mark {
  background: var(--mark);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}
.results-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }

/* ---------- Metrics ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem;
  margin-top: 1.1rem;
}
.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.75rem 0.9rem;
  min-height: 4.6rem;
}
.metric .label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.3rem;
}
.metric .value {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.metric .delta { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.metric .delta.up { color: var(--good); }
.metric .delta.down { color: var(--bad); }

.meter-card { grid-column: 1 / -1; }
.meter-track {
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--bad-soft), var(--warn-soft), var(--good-soft));
  border: 1px solid var(--line);
  position: relative;
  margin-top: 0.5rem;
}
.meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--accent), var(--good));
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.meter-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--faint);
  margin-top: 0.3rem;
}

/* ---------- History ---------- */
.history { margin-top: 1.6rem; }
.history h2 { font-size: var(--fs-lg); font-family: var(--font-display); margin: 0 0 0.2rem; }
.history .privacy-note { font-size: var(--fs-sm); color: var(--faint); margin: 0 0 0.7rem; }
.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.history-list li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.6rem 0.9rem;
}
.history-list .snippet {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.history-list time { font-size: 0.72rem; color: var(--faint); flex: none; }

/* ---------- Sections / prose ---------- */
.section { padding: clamp(2rem, 5vw, 3.5rem) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section h2 {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
}
.prose { max-width: 46rem; }
.prose p { color: var(--muted); margin: 0 0 1rem; }
.prose strong { color: var(--ink); }
.prose a { color: var(--accent); }
.prose ul { color: var(--muted); padding-left: 1.2rem; }
.prose li { margin-bottom: 0.4rem; }
.prose h3 { font-size: var(--fs-lg); margin: 1.6rem 0 0.5rem; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.9rem;
}
.feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.1rem;
}
.feature h3 { margin: 0 0 0.4rem; font-size: var(--fs-base); }
.feature p { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.feature .glyph { font-size: 1.3rem; margin-bottom: 0.5rem; display: block; }

/* ---------- FAQ ---------- */
.faq details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0;
  margin-bottom: 0.6rem;
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.9rem 1.1rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.2rem; flex: none; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0; padding: 0 1.1rem 1rem; color: var(--muted); }

/* ---------- Pricing table ---------- */
.compare-scroll { overflow-x: auto; }
table.compare {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.compare th, .compare td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.compare th { background: var(--surface-2); font-size: var(--fs-base); }
.compare th .price { display: block; color: var(--accent); font-size: 1.3rem; }
.compare td.yes { color: var(--good); font-weight: 700; }
.compare td.no { color: var(--faint); }
.compare tr:last-child td { border-bottom: 0; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(20 15 10 / 0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 1rem;
  z-index: 60;
  overflow-y: auto;
}
.modal-backdrop.visible { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  width: min(100%, 560px);
  padding: clamp(1.2rem, 3vw, 1.8rem);
  animation: rise 0.25s ease;
}
.modal h2 { font-family: var(--font-display); margin: 0 0 0.3rem; font-size: var(--fs-xl); }
.modal .modal-close { float: right; margin: -0.4rem -0.4rem 0 0; }
.code-row { display: flex; gap: 0.5rem; margin-top: 0.6rem; flex-wrap: wrap; }
.code-row input {
  flex: 1;
  min-width: 220px;
  font: inherit;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  text-transform: uppercase;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 0.55rem 0.8rem;
}
.code-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.code-feedback { font-size: var(--fs-sm); margin-top: 0.5rem; min-height: 1.3rem; }
.code-feedback.ok { color: var(--good); }
.code-feedback.err { color: var(--bad); }
.paypal-steps { margin: 0.8rem 0; padding-left: 1.2rem; color: var(--muted); font-size: var(--fs-sm); }
.paypal-steps li { margin-bottom: 0.35rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translate(-50%, 120%);
  background: var(--ink);
  color: var(--bg);
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  box-shadow: var(--shadow-2);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 70;
  max-width: min(92vw, 480px);
  text-align: center;
}
.toast.visible { transform: translate(-50%, 0); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding: 2rem 0 2.5rem;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: flex-start;
}
.footer-brand { max-width: 20rem; }
.footer-brand .wordmark { font-size: 1.1rem; }
.footer-brand p { margin: 0.4rem 0 0; color: var(--faint); }
.footer-links { display: flex; gap: 2.5rem; flex-wrap: wrap; margin-left: auto; }
.footer-links nav { display: flex; flex-direction: column; gap: 0.35rem; }
.footer-links .col-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.2rem;
}
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--ink); }
.footer-legal { width: 100%; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--faint); }

/* ---------- Page hero (subpages) ---------- */
.page-hero { padding: clamp(2rem, 5vw, 3rem) 0 0.5rem; }
.page-hero h1 {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  letter-spacing: -0.01em;
  margin: 0 0 0.4rem;
}
.page-hero .lede { color: var(--muted); font-size: var(--fs-lg); margin: 0; max-width: 44rem; }
.breadcrumbs { font-size: var(--fs-sm); color: var(--faint); padding-top: 1rem; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--ink); }

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .site-nav a:not(.nav-cta) { padding: 0.45rem 0.45rem; }
  .tool-actions { margin-left: 0; width: 100%; }
  .tool-actions .btn-primary { flex: 1; justify-content: center; }
  .view-toggle { margin-left: 0; width: 100%; }
  .footer-links { margin-left: 0; gap: 1.5rem; }
}
