/* ============================================================
   stoolme.com — design system
   Typography: Newsreader (display) + IBM Plex Sans (body) + IBM Plex Mono (code)
   Palette:   warm off-white, deep forest, single emerald accent
   ============================================================ */

:root {
  /* Color */
  --bg:           #faf9f5;
  --surface:      #ffffff;
  --surface-2:    #f3f1ea;
  --ink:          #0e1c14;
  --ink-2:        #2c3a32;
  --muted:        #6a7a70;
  --hair:         #e6e3d8;
  --hair-2:       #d8d4c4;

  --accent:       #14532d;       /* deep forest */
  --accent-2:     #166534;
  --accent-soft:  #dcfce7;
  --accent-tint:  #ecfdf3;

  --warn:         #92400e;
  --warn-soft:    #fef3c7;

  /* Type */
  --display:      "Newsreader", "Source Serif Pro", Georgia, serif;
  --body:         "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono:         "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Sizing */
  --container:    72rem;
  --container-narrow: 48rem;
  --radius:       6px;
  --radius-lg:    12px;
  --shadow-sm:    0 1px 2px rgba(14,28,20,0.04), 0 1px 1px rgba(14,28,20,0.03);
  --shadow:       0 4px 24px -8px rgba(14,28,20,0.10), 0 1px 2px rgba(14,28,20,0.04);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .15s ease, color .15s ease; }
a:hover { border-bottom-color: currentColor; }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 500; color: var(--ink); line-height: 1.18; letter-spacing: -0.01em; margin: 0 0 .6em; text-wrap: balance; }
h1 { font-size: clamp(2.25rem, 4.4vw, 3.5rem); font-weight: 450; letter-spacing: -0.022em; }
h2 { font-size: clamp(1.6rem, 2.6vw, 2.15rem); }
h3 { font-size: 1.25rem; font-weight: 500; }
h4 { font-size: 1.05rem; font-family: var(--body); font-weight: 600; letter-spacing: 0; }
p  { margin: 0 0 1em; text-wrap: pretty; max-width: 68ch; }
.lead { font-size: 1.18rem; line-height: 1.55; color: var(--ink-2); max-width: 56ch; }

hr { border: 0; border-top: 1px solid var(--hair); margin: 3rem 0; }

code, kbd, samp { font-family: var(--mono); font-size: .92em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; color: var(--ink-2); }
pre { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--hair); border-radius: var(--radius); padding: 1rem; overflow-x: auto; font-size: .88rem; line-height: 1.55; }
pre code { background: transparent; padding: 0; }

/* ====================== Layout ====================== */
.container { max-width: var(--container); margin: 0 auto; padding: 0 1.5rem; }
.container--narrow { max-width: var(--container-narrow); margin: 0 auto; padding: 0 1.5rem; }

/* ====================== Top bar ====================== */
.topbar {
  background: var(--bg);
  border-bottom: 1px solid var(--hair);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(8px);
  background: rgba(250, 249, 245, 0.85);
}
.topbar__inner {
  display: flex; align-items: center; gap: 2rem;
  max-width: var(--container);
  margin: 0 auto;
  padding: .9rem 1.5rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--display);
  font-size: 1.28rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  border: 0;
}
.brand:hover { border: 0; color: var(--accent); }
.brand__mark {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
  flex: 0 0 22px;
}
.brand__mark::after {
  content: "";
  position: absolute; inset: 4px;
  border-radius: 50%;
  border: 1.5px solid var(--bg);
}

.nav { display: flex; gap: 1.5rem; margin-left: auto; align-items: center; }
.nav a {
  color: var(--ink-2);
  font-size: .94rem;
  font-weight: 500;
  border: 0;
}
.nav a:hover { color: var(--accent); }
.nav a.is-active { color: var(--ink); }

.nav__cta {
  background: var(--accent);
  color: #fff !important;
  padding: .45rem .85rem;
  border-radius: 999px;
  font-size: .88rem !important;
}
.nav__cta:hover { background: var(--accent-2); color: #fff !important; }

.nav-toggle { display: none; }

@media (max-width: 760px) {
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--hair); flex-direction: column; padding: 1rem 1.5rem; gap: .8rem; align-items: stretch; }
  .nav.is-open { display: flex; }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    margin-left: auto;
    background: transparent; border: 1px solid var(--hair); border-radius: 8px;
    cursor: pointer; color: var(--ink);
  }
}

/* ====================== Hero ====================== */
.hero { padding: 4.5rem 0 3rem; }
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--mono); font-size: .78rem;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.hero__eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--muted); }
.hero h1 { max-width: 18ch; margin-bottom: 1.1rem; }
.hero__lead { font-size: 1.2rem; color: var(--ink-2); max-width: 52ch; margin-bottom: 1.75rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; }

/* ====================== Buttons ====================== */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.1rem;
  border-radius: 999px;
  font-family: var(--body); font-size: .95rem; font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  text-decoration: none;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-2); color: #fff; border-color: transparent; }
.btn--ghost   { background: transparent; color: var(--ink); border-color: var(--hair-2); }
.btn--ghost:hover { background: var(--surface); color: var(--ink); border-color: var(--ink-2); }
.btn--small   { padding: .45rem .8rem; font-size: .85rem; }
.btn--block   { width: 100%; justify-content: center; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ====================== Stats strip ====================== */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--hair);
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 1rem 0 3rem;
}
.stat { background: var(--surface); padding: 1.3rem 1.4rem; }
.stat__n { font-family: var(--display); font-size: 1.9rem; font-weight: 500; color: var(--ink); line-height: 1; letter-spacing: -0.02em; }
.stat__l { font-size: .85rem; color: var(--muted); margin-top: .4rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }

/* ====================== Section ====================== */
.section { padding: 3.5rem 0; }
.section__head { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; flex-wrap: wrap; }
.section__head h2 { margin-bottom: .3rem; }
.section__head p  { color: var(--muted); max-width: 36ch; margin: 0; }
.section__head .btn { margin-left: auto; }

/* ====================== Tool cards grid ====================== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1px;
  background: var(--hair);
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.tool-card {
  background: var(--surface);
  padding: 1.4rem 1.4rem 1.3rem;
  display: flex; flex-direction: column;
  text-decoration: none;
  border: 0;
  transition: background .15s;
  position: relative;
  min-height: 168px;
}
.tool-card:hover { background: var(--accent-tint); border: 0; }
.tool-card__cat {
  font-family: var(--mono);
  font-size: .7rem; text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: .9rem;
}
.tool-card__t {
  font-family: var(--display);
  font-size: 1.18rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: .35rem;
}
.tool-card__d {
  font-size: .9rem;
  color: var(--ink-2);
  line-height: 1.5;
  margin: 0;
}
.tool-card__arrow {
  position: absolute; right: 1.2rem; top: 1.2rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .8rem;
  transition: transform .2s, color .2s;
}
.tool-card:hover .tool-card__arrow { color: var(--accent); transform: translateX(3px); }

/* ====================== Category nav (filters) ====================== */
.cat-nav { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.75rem; }
.cat-nav button, .cat-nav a {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .9rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--hair);
  color: var(--ink-2);
  font-size: .88rem; font-family: var(--body);
  cursor: pointer;
  transition: all .15s;
}
.cat-nav button:hover, .cat-nav a:hover { border-color: var(--ink-2); color: var(--ink); border-bottom-color: var(--ink-2); }
.cat-nav button.is-active, .cat-nav a.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.cat-nav__count { font-family: var(--mono); font-size: .78rem; color: inherit; opacity: .6; }

/* ====================== Why blocks ====================== */
.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}
.why h3 { font-family: var(--display); font-size: 1.2rem; margin-bottom: .4rem; }
.why p  { font-size: .95rem; color: var(--ink-2); }
.why__rule { width: 28px; height: 2px; background: var(--accent); margin-bottom: 1rem; }

/* ====================== Tool page layout ====================== */
.tool-page { padding: 2.5rem 0 5rem; }
.crumbs {
  font-family: var(--mono); font-size: .78rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 1.25rem;
}
.crumbs a { color: var(--muted); border: 0; }
.crumbs a:hover { color: var(--accent); }
.crumbs__sep { padding: 0 .5rem; opacity: .5; }

.tool-head { margin-bottom: 2rem; }
.tool-head h1 { margin-bottom: .5rem; }
.tool-head .lead { margin-bottom: 0; }

.tool-card-main {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2.5rem;
}

/* Form controls */
label { display: block; font-size: .85rem; font-weight: 500; color: var(--ink-2); margin-bottom: .35rem; font-family: var(--body); }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .35rem; }
.label-row label { margin: 0; }

textarea, input[type="text"], input[type="number"], input[type="email"], input[type="password"], input[type="url"], select {
  width: 100%;
  padding: .65rem .8rem;
  background: var(--bg);
  border: 1px solid var(--hair-2);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: .95rem;
  color: var(--ink);
  line-height: 1.5;
  transition: border-color .15s, background .15s;
}
input[type="text"], input[type="email"], input[type="url"] { font-family: var(--body); }
textarea { min-height: 180px; resize: vertical; }
textarea:focus, input:focus, select:focus { outline: 0; border-color: var(--accent); background: var(--surface); }

select { appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%236a7a70' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/></svg>");
  background-repeat: no-repeat; background-position: right .85rem center; padding-right: 2.25rem;
}

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; background: var(--hair); border-radius: 2px; outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid #fff; box-shadow: var(--shadow-sm); }
input[type="range"]::-moz-range-thumb     { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid #fff; }

.check { display: inline-flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--ink-2); cursor: pointer; }
.check input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border: 1px solid var(--hair-2); border-radius: 4px; background: var(--bg); cursor: pointer; position: relative; flex: 0 0 18px; }
.check input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.check input[type="checkbox"]:checked::after { content: ""; position: absolute; left: 5px; top: 2px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }

.controls { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0; align-items: end; }
.controls > * { flex: 1 1 180px; min-width: 0; }
.controls .btn { flex: 0 0 auto; }

.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }

/* Stats inside tools */
.kv-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 1px; background: var(--hair); border: 1px solid var(--hair); border-radius: var(--radius); overflow: hidden; margin-top: 1rem; }
.kv { background: var(--surface); padding: .85rem 1rem; }
.kv__v { font-family: var(--display); font-size: 1.5rem; font-weight: 500; color: var(--ink); line-height: 1; }
.kv__l { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-top: .4rem; }

.output-box {
  background: var(--surface-2);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  padding: 1rem;
  font-family: var(--mono);
  font-size: .9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 80px;
  color: var(--ink);
}

.note {
  border-left: 3px solid var(--accent);
  background: var(--accent-tint);
  padding: .8rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.25rem 0;
  font-size: .92rem;
  color: var(--ink-2);
}
.note strong { color: var(--ink); }

.error-note {
  border-left: 3px solid var(--warn);
  background: var(--warn-soft);
  padding: .8rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1rem 0;
  font-size: .92rem;
  color: var(--ink);
}

/* ====================== Guide / prose ====================== */
.guide { max-width: 68ch; }
.guide h2 { margin-top: 2.5rem; font-family: var(--display); font-size: 1.65rem; }
.guide h2:first-of-type { margin-top: 0; }
.guide h3 { margin-top: 2rem; font-family: var(--display); font-size: 1.22rem; font-weight: 500; }
.guide p, .guide li { font-size: 1rem; color: var(--ink-2); }
.guide ul, .guide ol { padding-left: 1.3rem; margin: 0 0 1.2rem; }
.guide li { margin-bottom: .4rem; }
.guide table { width: 100%; border-collapse: collapse; margin: 1.25rem 0; font-size: .92rem; }
.guide th, .guide td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--hair); vertical-align: top; }
.guide th { font-weight: 600; color: var(--ink); background: var(--surface-2); font-family: var(--body); }
.guide td code { font-size: .85em; }

/* ====================== FAQ ====================== */
.faq { margin-top: 2rem; }
.faq details {
  border-bottom: 1px solid var(--hair);
  padding: 1rem 0;
}
.faq details:first-of-type { border-top: 1px solid var(--hair); }
.faq summary {
  cursor: pointer;
  font-family: var(--display);
  font-size: 1.12rem;
  font-weight: 500;
  color: var(--ink);
  list-style: none;
  display: flex; align-items: start; justify-content: space-between; gap: 1rem;
  letter-spacing: -0.005em;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-family: var(--mono);
  font-weight: 400;
  font-size: 1.4rem;
  color: var(--muted);
  flex: 0 0 auto;
  line-height: 1;
  transition: transform .2s;
}
.faq details[open] summary::after { content: "−"; }
.faq details > *:not(summary) { margin-top: .7rem; color: var(--ink-2); }

/* ====================== Related tools ====================== */
.related {
  border-top: 1px solid var(--hair);
  margin-top: 3rem;
  padding-top: 2rem;
}
.related h2 { font-size: 1.3rem; margin-bottom: 1rem; }
.related-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}
.related-list a {
  display: block;
  padding: .9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: .92rem;
  font-weight: 500;
  border-bottom: 1px solid var(--hair);
}
.related-list a:hover { background: var(--accent-tint); border-color: var(--accent); }
.related-list a small { display: block; color: var(--muted); font-weight: 400; margin-top: .2rem; font-size: .85rem; }

/* ====================== Ad slot placeholder ====================== */
.ad-slot {
  border: 1px dashed var(--hair-2);
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 1.2rem;
  text-align: center;
  font-family: var(--mono);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 2.5rem 0;
}
/* No ad slot in tool work area — keep tools clean. AdSense rule: don't put ads above the fold on thin pages. */

/* ====================== Footer ====================== */
.footer {
  border-top: 1px solid var(--hair);
  margin-top: 4rem;
  padding: 3.5rem 0 2rem;
  background: var(--bg);
}
.footer__grid {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, 1fr);
  gap: 2.5rem;
  margin-bottom: 3rem;
}
.footer__about p { font-size: .92rem; color: var(--ink-2); max-width: 32ch; }
.footer__col h4 { font-size: .78rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 1rem; }
.footer__col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .55rem; }
.footer__col a { color: var(--ink-2); font-size: .92rem; border: 0; }
.footer__col a:hover { color: var(--accent); }
.footer__bottom {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  border-top: 1px solid var(--hair);
  padding-top: 1.5rem;
  flex-wrap: wrap;
  color: var(--muted); font-size: .85rem;
}

@media (max-width: 760px) {
  .footer__grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
  .footer__about { grid-column: 1 / -1; }
  .section { padding: 2.5rem 0; }
  .hero { padding: 3rem 0 2rem; }
}

/* ====================== Misc utilities ====================== */
.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; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.center { text-align: center; }

.copy-confirm { color: var(--accent); font-family: var(--mono); font-size: .8rem; opacity: 0; transition: opacity .2s; margin-left: .5rem; }
.copy-confirm.is-on { opacity: 1; }

/* Pulse animation for copied state */
@keyframes flash { 0% { background: var(--accent-soft); } 100% { background: var(--surface); } }
.flash { animation: flash .8s ease-out; }

/* Color swatch (color picker tool) */
.swatch { width: 100%; height: 160px; border-radius: var(--radius); border: 1px solid var(--hair); margin-bottom: 1rem; }

/* QR canvas */
.qr-canvas { display: block; margin: 1.25rem auto; background: #fff; padding: .5rem; border: 1px solid var(--hair); border-radius: var(--radius); }
