/* ── Tool pages: index, word-counter, character-counter, text-compare, tone-checker, grammar-checker ── */

/* ── Pill button (copy/clear in toolbar) ── */
.pill-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 34px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-sec);
  border-radius: 100px;
  font-size: .78rem;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
  letter-spacing: .01em;
}
.pill-btn:hover { background: var(--surface-2); color: var(--text-pri); border-color: var(--text-muted); }
.pill-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
@media (max-width: 400px) {
  .pill-btn span { display: none; }
  .pill-btn { padding: 0 10px; }
}

/* ── Main layout ── */
.main {
  max-width: 820px;
  margin: 0 auto;
  padding: calc(var(--toolbar-h) + 36px) 20px 60px;
}

/* ── Page heading ── */
.page-heading { margin-bottom: 32px; }

.page-heading h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.1;
  color: var(--text-pri);
}

.page-heading h1 em {
  font-style: normal;
  color: var(--accent);
  transition: color var(--t-med);
}

.page-heading p {
  margin-top: 10px;
  font-size: .9rem;
  color: var(--text-sec);
  line-height: 1.6;
}

/* ── Stats bar ── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 10px 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: background var(--t-med), border-color var(--t-fast);
}

.stat-card.primary {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.stat-value {
  font-family: var(--font-num);
  font-size: clamp(1.2rem, 2.5vw, 1.75rem);
  font-weight: 300;
  color: var(--text-pri);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: color var(--t-med);
}

.stat-card.primary .stat-value { color: var(--accent); }

.stat-label {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 680px) { .stats-bar { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 400px) { .stats-bar { grid-template-columns: repeat(2, 1fr); } }

/* ── Editor / textarea ── */
.editor {
  width: 100%;
  min-height: 300px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-pri);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.8;
  resize: vertical;
  outline: none;
  transition: border-color var(--t-fast), background var(--t-med);
  caret-color: var(--accent);
}
.editor::placeholder { color: var(--text-muted); font-style: italic; }
.editor:focus { border-color: var(--accent); }

/* ── Density row ── */
.density-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.density-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.density-track {
  flex: 1;
  height: 3px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}

.density-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 180ms ease, background var(--t-med);
}

.density-pct {
  font-family: var(--font-num);
  font-size: .7rem;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 34px;
  text-align: right;
}

/* ── Section label ── */
.section-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 28px 0 10px;
}

/* ── Keyword table ── */
.keyword-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.keyword-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}
.keyword-row:last-child { border-bottom: none; }
.keyword-row:hover { background: var(--surface-2); }

.kw-word { font-size: .88rem; color: var(--text-pri); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kw-bar-wrap { width: 90px; height: 3px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.kw-bar { height: 100%; background: var(--accent); border-radius: 2px; opacity: .55; transition: background var(--t-med); }
.kw-count { font-family: var(--font-num); font-size: .78rem; color: var(--text-sec); text-align: right; min-width: 28px; }
.kw-empty { padding: 26px 16px; text-align: center; color: var(--text-muted); font-size: .85rem; font-style: italic; }

@media (max-width: 400px) { .kw-bar-wrap { width: 50px; } }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--surface-2);
  color: var(--text-pri);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 8px 22px;
  font-size: .84rem;
  font-weight: 500;
  z-index: 400;
  box-shadow: var(--shadow);
  transition: opacity var(--t-fast), transform var(--t-fast);
  pointer-events: none;
}
.toast.hidden { opacity: 0; transform: translateX(-50%) translateY(10px); }

/* ── More tools grid ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 10px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}

.tool-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  transform: translateY(-2px);
}

.tool-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tool-card--active {
  opacity: .55;
  cursor: default;
  pointer-events: none;
}

.tool-card--active:hover {
  border-color: var(--border);
  box-shadow: none;
  transform: none;
}

.tool-card-badge {
  display: inline-block;
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  align-self: flex-start;
}

.tool-card-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.tool-card-icon svg { width: 16px; height: 16px; color: var(--accent); }

.tool-card-name {
  font-size: .84rem;
  font-weight: 700;
  color: var(--text-pri);
  letter-spacing: -.01em;
}

.tool-card-desc {
  font-size: .76rem;
  color: var(--text-muted);
  line-height: 1.45;
}

@media (max-width: 600px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── SEO section (tool pages) ── */
.seo-section {
  margin-top: 56px;
  border-top: 1px solid var(--border);
  padding-top: 40px;
}

.seo-section h2 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text-pri);
  margin-bottom: 12px;
}

.seo-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-pri);
  margin: 28px 0 8px;
}

.seo-section p {
  font-size: .9rem;
  color: var(--text-sec);
  line-height: 1.75;
  margin-bottom: 12px;
}

.seo-section a { color: var(--accent); text-decoration: none; }
.seo-section a:hover { text-decoration: underline; }

.seo-section ul {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.seo-section ul li {
  font-size: .88rem;
  color: var(--text-sec);
  line-height: 1.6;
  padding-left: 16px;
  position: relative;
}

.seo-section ul li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: .8rem;
}

/* ── FAQ on tool pages (inline accordion) ── */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 12px;
}

.faq-item {
  border-bottom: 1px solid var(--border);
}
.faq-item:last-child { border-bottom: none; }

.faq-q {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: none;
  padding: 14px 16px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-pri);
  font-family: var(--font-ui);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: background var(--t-fast);
}
.faq-q:hover { background: var(--surface-2); }
.faq-q:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.faq-arrow {
  flex-shrink: 0;
  width: 16px; height: 16px;
  color: var(--text-muted);
  transition: transform var(--t-fast);
}
.faq-item.open .faq-arrow { transform: rotate(180deg); }

/* faq-icon variant (+ style for text-compare/tone/grammar) */
.faq-icon {
  flex-shrink: 0;
  width: 16px; height: 16px;
  color: var(--text-muted);
  transition: transform var(--t-fast), color var(--t-fast);
}
.faq-item.open .faq-icon { transform: rotate(45deg); color: var(--accent); }

.faq-a {
  display: none;
  padding: 0 16px 14px;
  font-size: .88rem;
  color: var(--text-sec);
  line-height: 1.7;
  background: var(--surface);
}
.faq-item.open .faq-a { display: block; }

/* faq-section wrapper (text-compare/tone/grammar style) */
.faq-section { margin-top: 40px; }
.faq-section h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-pri);
  margin-bottom: 14px;
  letter-spacing: -.01em;
}
.faq-section .faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: none;
  border-radius: 0;
  overflow: visible;
}
.faq-section .faq-item {
  background: var(--surface);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius);
  overflow: hidden;
}
.faq-section .faq-q {
  padding: 14px 18px;
}
.faq-section .faq-a {
  padding: 0 18px 14px;
  font-size: .85rem;
  line-height: 1.72;
}

/* ── Breadcrumb (tool pages) ── */
.breadcrumb {
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
