/* ==========================================================================
   Text Tools — design
   Quiet editorial utility. A serif display face, one warm accent, hairline
   rules, and air instead of boxes. Mobile-first, fast, no web fonts.
   ========================================================================== */
:root {
  --accent: #b8492c;          /* warm terracotta, used sparingly */
  --accent-dark: #8f3620;
  --accent-soft: #f4e7e0;
  --ink: #211f1c;             /* near-black text */
  --ink-2: #3c3a35;           /* body prose */
  --muted: #6c6a64;           /* secondary text */
  --faint: #9b988f;           /* tertiary / captions */
  --bg: #fdfcfa;              /* warm off-white page */
  --bg-alt: #f6f3ec;          /* warm paper panel */
  --line: #ebe7dd;            /* hairline border */
  --line-strong: #ddd8cc;
  --radius: 10px;
  --maxw: 880px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.62;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 2px; }

img { max-width: 100%; height: auto; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

::selection { background: var(--accent-soft); }

/* ---- Header ------------------------------------------------------------- */
.site-header {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.1) blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  flex-wrap: wrap;
}
.logo {
  display: inline-flex;
  align-items: center;
}
.logo img {
  display: block;
  height: 26px;
  width: auto;
}
.logo:hover { text-decoration: none; }
.site-nav ul {
  list-style: none;
  display: flex;
  gap: 26px;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.site-nav a { color: var(--muted); font-weight: 500; font-size: .9rem; letter-spacing: .005em; }
.site-nav a:hover { color: var(--ink); text-decoration: none; }

/* ---- Layout ------------------------------------------------------------- */
main { padding: 26px 0 64px; }

.breadcrumbs {
  font-size: .8rem;
  color: var(--faint);
  margin: 0 0 26px;
  letter-spacing: .01em;
}
.breadcrumbs a { color: var(--faint); }
.breadcrumbs a:hover { color: var(--accent); }

h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 2.3rem;
  line-height: 1.12;
  margin: 0 0 .3em;
  letter-spacing: -.022em;
}
h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.55rem;
  margin: 2em 0 .5em;
  letter-spacing: -.015em;
}
h3 { font-size: 1.05rem; margin: 1.6em 0 .4em; letter-spacing: -.01em; }
.lead { font-size: 1.14rem; color: var(--muted); margin-top: 0; line-height: 1.55; }

/* ---- Tool widget -------------------------------------------------------- */
.tool {
  margin: 28px 0;
}
textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 13px 15px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea {
  min-height: 184px;
  resize: vertical;
  line-height: 1.6;
}
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
label { font-weight: 600; font-size: .82rem; display: inline-block; margin-bottom: 6px; color: var(--muted); letter-spacing: .01em; }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
  align-items: center;
}
.field { display: flex; flex-direction: column; gap: 2px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; font-size: .9rem; cursor: pointer; color: var(--muted); }
.check input { width: auto; accent-color: var(--accent); }

button, .btn {
  font-family: var(--sans);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  letter-spacing: .005em;
  transition: background .14s ease, border-color .14s ease, transform .08s ease;
}
button:hover, .btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button:active, .btn:active { transform: translateY(1px); }
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
button.secondary:hover { background: var(--bg-alt); border-color: var(--muted); color: var(--ink); }

/* Sticky copy button */
.copy-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 0 6px;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}

.privacy {
  font-size: .85rem;
  color: var(--muted);
  margin: 18px 0 0;
}
.privacy::before { content: "—"; color: var(--accent); margin-right: 8px; }

.output {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  min-height: 60px;
}

/* Stats read as a quiet inline row, not a boxed grid */
.stat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 28px 38px;
  margin: 24px 2px;
  padding: 0;
  background: none;
  border: 0;
}
.stat {
  background: none;
  padding: 0;
  text-align: left;
}
.stat b { display: block; font-family: var(--serif); font-size: 1.9rem; font-weight: 700; color: var(--ink); line-height: 1; letter-spacing: -.02em; }
.stat span { font-size: .72rem; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; margin-top: 7px; display: block; }

/* Fancy/result list rows (stylish text, etc.) */
.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 2px;
  margin-bottom: 0;
}
.result-row .val { word-break: break-word; flex: 1; }
.result-row .tag { font-size: .68rem; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.result-row button { padding: 6px 13px; font-size: .8rem; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 11px 20px;
  border-radius: 8px;
  font-size: .88rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Content / prose ---------------------------------------------------- */
.prose { max-width: 660px; }
.prose p { margin: 0 0 1.15em; color: var(--ink-2); }
.prose ul, .prose ol { padding-left: 1.3em; color: var(--ink-2); }
.prose li { margin: .4em 0; }
.prose .example {
  background: var(--bg-alt);
  border-radius: 8px;
  padding: 13px 18px;
  margin: 14px 0;
  font-size: .95rem;
  color: var(--ink-2);
}
.prose .example strong { color: var(--ink); }

.faq details {
  border-bottom: 1px solid var(--line);
  padding: 2px 0;
  background: none;
}
.faq summary { font-weight: 600; cursor: pointer; padding: 15px 0; list-style: none; color: var(--ink); transition: color .14s ease; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--faint); font-weight: 400; font-size: 1.2rem; line-height: 1; transition: transform .2s ease, color .14s ease; }
.faq details[open] summary::after { transform: rotate(45deg); color: var(--accent); }
.faq summary:hover { color: var(--accent); }
.faq details > div { padding: 0 0 16px; color: var(--ink-2); }

/* ---- Icons -------------------------------------------------------------- */
.ic { display: block; }

/* ---- Homepage hub ------------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 44px;
  align-items: center;
  padding: 10px 0 6px;
  margin: 0;
}
.hero h1 { font-size: 2.45rem; margin: 0 0 .22em; max-width: 16ch; letter-spacing: -.028em; line-height: 1.08; }
.hero .lead { font-size: 1.06rem; max-width: 46ch; margin: 0; color: var(--muted); line-height: 1.5; }
.hero-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; }
.hero-tags li {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .78rem; font-weight: 500; color: var(--ink-2);
  background: var(--bg-alt); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 13px 5px 11px;
}
.hero-tags li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }

/* Live demo card — the page feels like a product, not an article */
.hero-demo {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(33,31,28,.03), 0 14px 32px -22px rgba(33,31,28,.35);
}
.hero-demo label { display: inline-flex; align-items: center; gap: 7px; color: var(--faint); }
.hero-demo label .ic { color: var(--accent); }
.hero-demo input[type="text"] { background: var(--bg); border-radius: 9px; font-size: 1rem; }
.ft-demo-out { margin: 12px 0 2px; }
.ft-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 2px; border-bottom: 1px solid var(--line);
}
.ft-row:last-child { border-bottom: 0; }
.ft-val {
  font-size: 1.12rem; color: var(--ink); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ft-copy {
  flex: none; background: transparent; color: var(--muted);
  border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 5px 13px; font-size: .78rem; font-weight: 600;
}
.ft-copy:hover { background: var(--bg); border-color: var(--accent); color: var(--accent); }
.hero-demo-link { display: inline-block; margin-top: 12px; font-size: .85rem; font-weight: 600; }

/* Auto-playing tool carousel — cycles through several animated tool demos.
   The stage is a FIXED height so the card never resizes (no layout shift). */
.dc-head { display: flex; align-items: center; gap: 9px; min-height: 22px; }
.dc-ic { display: inline-flex; color: var(--accent); flex: none; }
.dc-ic svg { display: block; }
.dc-name { font-size: .92rem; font-weight: 700; color: var(--ink); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-dots { display: flex; gap: 5px; flex: none; }
.dc-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); transition: width .25s ease, background .25s ease; }
.dc-dot.is-on { width: 16px; border-radius: 3px; background: var(--accent); }
.dc-stage { position: relative; height: 164px; margin: 13px 0 8px; overflow: hidden; transition: opacity .28s ease; }
.dc-stage.is-fading { opacity: 0; }

/* generic staggered reveal used by scenes */
.dc-reveal { opacity: 0; transform: translateY(6px); transition: opacity .22s ease, transform .22s ease; }
.dc-reveal.is-in { opacity: 1; transform: none; }

/* Word Unscrambler scene */
.un-rack { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 0 0 12px; }
.un-tile {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 34px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--bg); color: var(--faint); font-family: var(--serif);
  font-size: 1.05rem; font-weight: 600; text-transform: uppercase;
}
.un-tile.un-lock { color: var(--ink); border-color: var(--line-strong); animation: unPop .26s cubic-bezier(.34,1.56,.64,1); }
@keyframes unPop { 0% { transform: scale(1.28); border-color: var(--accent); } 100% { transform: scale(1); } }
.un-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.un-word {
  font-size: .84rem; color: var(--ink-2); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 9px; line-height: 1.2;
  opacity: 0; transform: translateY(6px) scale(.96);
  transition: opacity .2s ease, transform .2s ease;
}
.un-word.is-in { opacity: 1; transform: none; }

/* Fancy Text scene */
.dc-fx-row { display: flex; align-items: center; gap: 12px; padding: 7px 2px; border-bottom: 1px solid var(--line); }
.dc-fx-row:last-child { border-bottom: 0; }
.dc-fx-tag { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); width: 56px; flex: none; }
.dc-fx-val { font-size: 1.18rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Case Converter scene */
.dc-case { display: flex; flex-direction: column; justify-content: center; height: 100%; gap: 10px; }
.dc-case-cap { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.dc-case-line { font-size: 1.5rem; font-weight: 600; color: var(--ink); line-height: 1.25; min-height: 2.5em; }

/* Slug Generator scene */
.dc-slug { display: flex; flex-direction: column; justify-content: center; height: 100%; gap: 8px; }
.dc-slug-src { font-size: 1rem; color: var(--muted); }
.dc-slug-arrow { color: var(--faint); font-size: 1rem; line-height: 1; }
.dc-slug-out { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.05rem; font-weight: 600; color: var(--accent); min-height: 1.4em; word-break: break-all; }

@media (prefers-reduced-motion: reduce) {
  .un-tile.un-lock { animation: none; }
  .un-word, .dc-reveal, .dc-stage, .dc-dot { transition: none; }
}

/* ---- Popular / featured row -------------------------------------------- */
.section-eyebrow {
  font-family: var(--sans) !important;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em;
  color: var(--faint); margin: 40px 0 14px;
}
.featured { margin-top: 6px; }
.feat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.feat-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.feat-card:hover {
  text-decoration: none;
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px -20px rgba(33,31,28,.4);
}
.feat-ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-bottom: 8px;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 10px;
}
.feat-name { font-weight: 600; color: var(--ink); font-size: 1rem; }
.feat-card:hover .feat-name { color: var(--accent); }
.feat-desc {
  color: var(--muted); font-size: .84rem; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.category { margin: 34px 0; scroll-margin-top: 76px; }
.category:first-of-type { margin-top: 46px; padding-top: 36px; border-top: 1px solid var(--line); }
.category h2 {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 8px;
  font-size: 1.4rem;
}
.cat-ic {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; width: 34px; height: 34px;
  color: var(--accent); background: var(--accent-soft); border-radius: 9px;
}
.cat-name { flex: 1; }
.cat-count {
  font-family: var(--sans); font-size: .7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; color: var(--faint);
}

/* Tool list: hairline-separated rows with a quiet line icon */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  column-gap: 36px;
  border-top: 1px solid var(--line);
}
.tool-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 15px 26px 15px 2px;
  background: none;
  position: relative;
}
.tool-ic { flex: none; margin-top: 1px; color: var(--faint); transition: color .15s ease, transform .15s ease; }
.tool-card:hover { text-decoration: none; }
.tool-card:hover .tool-ic { color: var(--accent); transform: translateY(-1px); }
.tool-card::after {
  content: "→";
  position: absolute;
  right: 2px;
  top: 15px;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .16s ease, transform .16s ease;
}
.tool-card:hover::after { opacity: 1; transform: translateX(0); }
.tool-card:hover .tool-name { color: var(--accent); }
.tool-meta { min-width: 0; }
.tool-name { display: block; font-weight: 600; color: var(--ink); font-size: 1rem; line-height: 1.3; transition: color .14s ease; }
.tool-desc {
  color: var(--muted); font-size: .85rem; line-height: 1.45; margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Per-tool mark above the H1 on tool pages */
.tool-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; margin-bottom: 12px;
  color: var(--accent); background: var(--accent-soft); border-radius: 12px;
}

/* ---- Related tools ------------------------------------------------------ */
.related { margin-top: 56px; }
.related h2 { font-size: 1.45rem; margin-bottom: 6px; }

/* ---- Ad slots ----------------------------------------------------------
   Sparse and always BELOW content (never above the fold, never inside a tool).
   Clearly framed + labelled so they read as "advertising", not disguised
   content — which is both better UX and required by AdSense policy. The
   dashed hatch is the dev placeholder; the real <ins> ad fills the same box. */
.ad-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 110px;
  margin: 40px 0;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: repeating-linear-gradient(
    45deg, transparent, transparent 9px,
    rgba(184, 73, 44, .045) 9px, rgba(184, 73, 44, .045) 18px);
  text-align: center;
}
.ad-slot-label {
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.ad-slot-meta {
  font-size: .66rem;
  letter-spacing: .04em;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
/* The footer ad sits on the alt-paper footer — soften its frame there. */
.site-footer .ad-slot { margin-top: 0; margin-bottom: 40px; }

/* ---- Footer ------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-alt);
  padding: 52px 0 40px;
  margin-top: 72px;
  font-size: .9rem;
}
.footer-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 32px;
}
.footer-cols h4 {
  margin: 0 0 14px;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--faint);
  font-weight: 700;
}
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols li { margin: 8px 0; }
.footer-cols a { color: var(--muted); }
.footer-cols a:hover { color: var(--accent); }
.footer-bottom {
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--line-strong);
  color: var(--faint);
  font-size: .82rem;
  max-width: 64ch;
  line-height: 1.6;
}

/* ---- Motion (satisfying, but only when the user is OK with it) ---------- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes rise-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
  }
  .hero, .featured, .category, .tool-mark, .tool {
    animation: rise-in .55s cubic-bezier(.2, .7, .3, 1) both;
  }
  .featured { animation-delay: .06s; }
  .category:nth-of-type(1) { animation-delay: .12s; }
  .category:nth-of-type(2) { animation-delay: .18s; }
  .category:nth-of-type(3) { animation-delay: .24s; }

  /* The featured cards lift a touch faster than they settle — feels lively. */
  .feat-card:active { transform: translateY(0); transition-duration: .05s; }
  .ft-copy:active { transform: scale(.96); }
  .ft-row .ft-val { transition: color .15s ease; }
}

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 22px; padding-top: 4px; }
  .hero h1 { max-width: 20ch; }
  .hero .lead { max-width: none; }
}

@media (max-width: 600px) {
  h1 { font-size: 1.95rem; }
  h2 { font-size: 1.4rem; }
  .hero h1 { font-size: 1.95rem; }
  .hero .lead { font-size: .98rem; }
  main { padding: 18px 0 48px; }
  .stat-grid { gap: 20px 32px; }
  .category:first-of-type { margin-top: 34px; padding-top: 28px; }
  /* Keep ads compact on phones so they never dominate the screen. */
  .ad-slot { min-height: 96px; margin: 28px 0; }
}
