/* ===========================================================================
   wispa · Free Tools - page styles (Ink & Wisp)
   ...........................................................................
   Loaded AFTER styles.css, which provides the tokens + base type + shared
   components (.btn, .kicker, .section-head, .footer, .lang-*, .icon-toggle,
   .brand, .reveal, .container, .mono, .wisp). This file adds only what the
   tool pages need on top: a persistent top nav (cold search visitors need
   wayfinding the landing's bare pill does not give), the tool hero, the
   breadcrumb, the interactive widgets, the longform SEO blocks and the CTA.
   =========================================================================== */

/* ------------------------------------------------------- persistent nav --- */
.tool-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg-strong);
  border-bottom: 1px solid var(--hairline);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
}
.tool-nav-inner {
  max-width: 1120px;
  margin-inline: auto;
  padding: 12px clamp(16px, 4vw, 44px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.tool-nav .brand-name { font-size: 1.16rem; }
.tool-nav-right { display: flex; align-items: center; gap: 10px; }
.tool-nav .btn { height: 40px; padding-inline: 16px; font-size: 0.9rem; }
.tool-nav .icon-toggle { width: 40px; height: 40px; }
.nav-tools-link { font-size: 0.9rem; font-weight: 500; color: var(--muted); text-decoration: none; padding: 6px 6px; transition: color 0.2s; }
.nav-tools-link:hover { color: var(--ink); }
@media (max-width: 560px) { .nav-tools-link { display: none; } }

/* ------------------------------------------------------------- tool hero -- */
.tool-hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(40px, 7vw, 88px) clamp(56px, 8vw, 104px);
}
.tool-hero-inner {
  position: relative;
  max-width: 860px;
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 44px);
  text-align: center;
}
.breadcrumb {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted-soft);
  margin-bottom: 22px;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent-text); }
.breadcrumb span[aria-hidden] { opacity: 0.5; }
.breadcrumb .bc-current { color: var(--body-c); }

.tool-hero .kicker { justify-content: center; }
.tool-h1 {
  font-size: clamp(2.4rem, 5.2vw, 3.8rem);
  line-height: 1.04;
  letter-spacing: -0.022em;
  margin: 6px 0 16px;
}
.tool-sub {
  color: var(--muted);
  font-size: 1.08rem;
  max-width: 46ch;
  margin: 0 auto clamp(30px, 4vw, 44px);
  text-wrap: balance;
}

/* ====================================================== typing speed test = */
.tst { position: relative; max-width: 760px; margin-inline: auto; text-align: left; }

.tst-stats {
  display: flex;
  align-items: flex-end;
  gap: clamp(18px, 4vw, 40px);
  margin-bottom: 22px;
}
.tst-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.tst-stat-num {
  display: inline-block;
  text-align: left;
  font-family: var(--mono);
  font-feature-settings: "tnum" 1;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 500;
  color: var(--ink);
  line-height: 1;
}
/* reserve a fixed slot per stat so the numbers never nudge their neighbours
   (wpm is capped to 3 digits in JS; accuracy tops out at "100%") */
#tstWpm { min-width: 3ch; }
#tstAcc { min-width: 4ch; }
#tstTime { min-width: 5ch; }
.tst-stat.is-wpm .tst-stat-num { color: var(--accent-text); }
.tst-stat-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-soft);
}
.tst-shuffle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding-inline: 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline-strong);
  background: transparent;
  color: var(--body-c);
  font-family: var(--sans);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.tst-shuffle:hover { background: var(--surface-2); color: var(--ink); }

.tst-window {
  position: relative;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  padding: clamp(20px, 3vw, 30px);
  box-shadow: var(--shadow-sm);
}
.tst-passage {
  font-family: var(--mono);
  font-size: clamp(1.05rem, 2.4vw, 1.32rem);
  line-height: 1.9;
  letter-spacing: 0.01em;
  color: var(--muted-soft);
  min-height: 5.7em;             /* reserve height so swapping text never shifts */
  cursor: text;
  word-break: break-word;
}
.tst-word { white-space: nowrap; }   /* letters stay together; wrap only at spaces */
.tst-char { transition: color 0.08s ease; }
.tst-char.is-correct { color: var(--ink); }
.tst-char.is-wrong {
  color: var(--voice-text);
  background: var(--voice-soft);
  border-radius: 2px;
}
.tst-char.is-wrong.is-space { background: var(--voice-soft); }
.tst-char.is-current {
  border-left: 2px solid var(--accent);
  margin-left: -2px;
  /* blink the caret BAR only (border-color), never the letter's opacity, so
     the character you are about to type stays fully visible */
  animation: tst-caret 1.05s step-end infinite;
}
@keyframes tst-caret { 50% { border-left-color: transparent; } }
.tst-done .tst-char.is-current { animation: none; border-left-color: transparent; }

/* the real input surface, focusable but invisible (keeps mobile keyboards) */
.tst-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  left: 0;
  top: 0;
  resize: none;
}
.tst-hint {
  margin: 16px 0 0;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--muted-soft);
  text-align: center;
}
.tst-mobile-note { display: none; }
@media (hover: none) and (pointer: coarse) {
  .tst-mobile-note { display: block; }
}

/* result panel: replaces the hint row once the passage is finished */
.tst-results {
  margin-top: 26px;
  padding: clamp(22px, 3vw, 30px);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-xl);
  background:
    radial-gradient(120% 140% at 100% 0%, var(--accent-soft), transparent 60%),
    color-mix(in srgb, var(--surface) 70%, transparent);
  text-align: center;
}
.tst-result-title {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  color: var(--ink);
  margin: 6px 0 12px;
}
.tst-result-compare {
  color: var(--body-c);
  font-size: 1.02rem;
  max-width: 48ch;
  margin: 0 auto 22px;
}
.tst-result-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* ================================================ mic test / voice recorder = */
.audio-stage { position: relative; max-width: 640px; margin-inline: auto; text-align: center; }
.audio-device {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 22px; font-size: 0.86rem; color: var(--muted);
}
.audio-device select {
  font-family: var(--sans); font-size: 0.86rem;
  color: var(--body-c); background: var(--surface-2);
  border: 1px solid var(--hairline-strong); border-radius: var(--r-pill);
  padding: 7px 12px; cursor: pointer; max-width: 240px;
}

/* live waveform */
.audio-wave {
  display: block; width: 100%; height: 88px; margin-bottom: 18px;
  opacity: 0.35; transition: opacity 0.3s;
}
.audio-stage.is-live .audio-wave { opacity: 1; }

/* level meter (row of segments, last ones run hot) */
.level-meter { display: flex; gap: 5px; align-items: center; justify-content: center; margin-bottom: 30px; }
.level-meter .lm-label {
  font-family: var(--mono); font-size: 0.66rem; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--muted-soft); margin-right: 8px;
}
.level-meter i { width: 9px; height: 9px; border-radius: 50%; background: var(--hairline-strong); transition: background 0.06s linear; }
.level-meter i.on { background: var(--accent); }
.level-meter i.on.hot { background: var(--voice); }

/* the big round primary button */
.audio-btn {
  position: relative;
  width: 84px; height: 84px; border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: var(--surface-2); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow-card);
  transition: transform 0.15s, background 0.2s, color 0.2s, border-color 0.2s;
}
.audio-btn:hover { transform: translateY(-1px); }
.audio-btn:active { transform: translateY(1px); }
.audio-btn svg { width: 30px; height: 30px; }
.audio-btn.is-rec {
  background: #ff5d6c; color: #fff; border-color: transparent;
  animation: audio-pulse 1.7s ease-out infinite;
}
@keyframes audio-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 93, 108, 0.4), var(--shadow-card); }
  50% { box-shadow: 0 0 0 12px rgba(255, 93, 108, 0), var(--shadow-card); }
}
.audio-btn-label {
  display: block; margin-top: 14px;
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.04em; color: var(--muted);
}
.audio-timer {
  font-family: var(--mono); font-feature-settings: "tnum" 1;
  font-size: 1.5rem; color: var(--ink); margin-bottom: 18px; min-height: 1.5em;
}

.audio-actions {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 22px;
}
.audio-actions:empty { margin-top: 0; }
.audio-player { width: 100%; max-width: 420px; margin: 20px auto 0; display: block; }
.audio-hint {
  margin: 20px 0 0; font-family: var(--mono); font-size: 0.74rem;
  letter-spacing: 0.03em; color: var(--muted-soft); text-align: center;
}
.audio-error { color: var(--voice-text); }

/* ============================================== tool cards (hub + crosslinks) */
.tool-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(238px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.tool-card {
  display: block; padding: 24px;
  border: 1px solid var(--hairline); border-radius: var(--r-xl);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.tool-card:hover { border-color: var(--hairline-strong); transform: translateY(-2px); background: color-mix(in srgb, var(--surface) 78%, transparent); }
.tool-card h3 { font-family: var(--serif); font-size: 1.28rem; color: var(--ink); margin: 0 0 7px; }
.tool-card p { color: var(--muted); font-size: 0.96rem; margin: 0 0 16px; max-width: none; }
.tool-card-go {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--accent-text);
}
.tool-card-go::after { content: "\2192"; transition: transform 0.2s; }
.tool-card:hover .tool-card-go::after { transform: translateX(3px); }

/* the "while you're here" block on tool pages */
.tool-cross { border-top: 1px solid var(--hairline); padding-block: clamp(52px, 7vw, 88px); }
.tool-cross .container { max-width: 900px; }

/* ------------------------------------------------------- longform blocks -- */
.tool-body { padding-block: clamp(56px, 8vw, 104px); }
.tool-body .container { max-width: 760px; }
.tool-sec { margin-bottom: clamp(52px, 7vw, 84px); }
.tool-sec:last-child { margin-bottom: 0; }
.tool-sec .section-head { margin-bottom: clamp(20px, 3vw, 28px); }
.tool-sec p { color: var(--body-c); font-size: 1.05rem; max-width: 62ch; }
.tool-sec p + p { margin-top: 1em; }
.tool-inline-link { color: var(--accent-text); text-decoration: none; border-bottom: 1px solid var(--accent-soft); }
.tool-inline-link:hover { border-bottom-color: var(--accent); }

/* WPM benchmark table */
.tst-table-wrap { margin-top: 26px; border: 1px solid var(--hairline); border-radius: var(--r-lg); overflow: hidden; }
.tst-table { width: 100%; border-collapse: collapse; font-size: 0.96rem; }
.tst-table th, .tst-table td { text-align: left; padding: 13px 18px; border-bottom: 1px solid var(--hairline); }
.tst-table thead th {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-soft);
  font-weight: 500;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.tst-table tbody tr:last-child td { border-bottom: 0; }
.tst-table td:first-child {
  font-family: var(--mono);
  font-feature-settings: "tnum" 1;
  color: var(--accent-text);
  width: 84px;
}
.tst-table td:nth-child(3) { color: var(--voice-text); }

/* FAQ (lightweight, static, no accordion) */
.tool-faq-list { display: grid; gap: 4px; margin-top: 8px; }
.tool-faq-item { padding: 20px 0; border-top: 1px solid var(--hairline); }
.tool-faq-q { font-family: var(--serif); font-size: 1.16rem; color: var(--ink); margin: 0 0 8px; }
.tool-faq-a { color: var(--body-c); margin: 0; max-width: 64ch; }

/* --------------------------------------------------------------- tool CTA - */
.tool-cta {
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--hairline);
  padding-block: clamp(64px, 9vw, 120px);
  text-align: center;
}
.tool-cta-inner { position: relative; max-width: 640px; margin-inline: auto; padding-inline: clamp(20px, 5vw, 44px); }
.tool-cta h2 { font-size: clamp(2rem, 4.4vw, 3rem); margin-bottom: 16px; }
.tool-cta p { color: var(--muted); max-width: 48ch; margin: 0 auto 28px; }

/* footer: 4 columns on tool pages (brand + product + free tools + legal) */
.tool-footer .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; }
@media (max-width: 720px) { .tool-footer .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 460px) { .tool-footer .footer-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- mobile -- */
@media (max-width: 620px) {
  .tool-nav .btn span.btn-label { display: none; }   /* download icon only */
  .tool-nav .btn { padding-inline: 12px; }
  .tst-stats { gap: 16px; }
  .tst-shuffle span { display: none; }
  .tst-shuffle { padding-inline: 10px; }
}
