/* ==========================================================================
   Features page
   ========================================================================== */

.page-hero {
  padding: clamp(4rem, 8vw, 7rem) 0 clamp(2rem, 4vw, 4rem);
  text-align: center;
}
.page-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin: 0.5rem auto 1.5rem;
  max-width: 18ch;
}
.page-hero p.lead {
  margin: 0 auto;
  font-size: 1.2rem;
  color: var(--text-secondary);
}

/* ──────────────────────────────────────────────────────────────────────────
   Feature index — TOC
   ────────────────────────────────────────────────────────────────────────── */
.feature-index {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.5rem;
  margin: 3rem 0 5rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}
.feature-index a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  transition: background var(--d-fast) var(--ease-out), color var(--d-fast) var(--ease-out);
}
.feature-index a:hover {
  background: var(--bg-hover);
  color: var(--accent-teal);
}
.feature-index a .num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ──────────────────────────────────────────────────────────────────────────
   Deep-dive feature section
   ────────────────────────────────────────────────────────────────────────── */
.feature-section {
  padding: clamp(3rem, 6vw, 5rem) 0;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 100px;
}
.feature-section:last-of-type { border-bottom: none; }

.feature-section-head {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  align-items: flex-start;
}
.feature-section-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-teal);
  background: rgba(94, 234, 212, 0.08);
  border: 1px solid rgba(94, 234, 212, 0.2);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-top: 0.5rem;
  flex-shrink: 0;
}
.feature-section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1.1;
}

.feature-section-body {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: flex-start;
}
@media (max-width: 880px) {
  .feature-section-body { grid-template-columns: 1fr; }
}

.feature-section-text > p {
  font-size: 1.05rem;
  line-height: 1.65;
  margin: 0 0 1.25rem;
}
.feature-section-text > p:first-child {
  color: var(--text-primary);
  font-size: 1.15rem;
}

.feature-section-bullets {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: grid;
  gap: 0.85rem;
}
.feature-section-bullets li {
  display: flex;
  gap: 0.85rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.feature-section-bullets li strong {
  color: var(--text-primary);
  font-weight: 600;
  margin-right: 0.25rem;
}
.feature-section-bullets li::before {
  content: '';
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  margin-top: 0.65em;
  border-radius: 50%;
  background: var(--accent-teal);
  box-shadow: 0 0 8px var(--accent-teal);
}

/* Feature visual frame on the right */
.feature-visual {
  position: sticky;
  top: 100px;
}
@media (max-width: 880px) {
  .feature-visual { position: static; }
}

/* ──────────────────────────────────────────────────────────────────────────
   Stats inside feature sections
   ────────────────────────────────────────────────────────────────────────── */
.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}
.metric {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}
.metric-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
}
.metric-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* ==========================================================================
   Comparison matrix (added to /features page)
   ========================================================================== */

.compare-section {
  padding: clamp(3rem, 6vw, 5rem) 0;
  border-top: 1px solid var(--border);
}

.compare-intro {
  max-width: 70ch;
  margin: 0 auto 3rem;
  text-align: center;
}
.compare-intro h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  margin: 0.5rem 0 1rem;
}
.compare-intro p {
  font-size: 1.05rem;
  line-height: 1.65;
}

/* Tool summary cards above the matrix */
.compare-tools {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 3rem;
}
@media (max-width: 880px) {
  .compare-tools { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .compare-tools { grid-template-columns: 1fr; }
}
.compare-tool {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}
.compare-tool.is-self {
  border-color: var(--border-accent);
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.06), rgba(34, 197, 94, 0.04));
}
.compare-tool-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.compare-tool.is-self .compare-tool-name { color: var(--accent-teal); }
.compare-tool-kind {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  align-self: flex-start;
}
.compare-tool-desc {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

/* The matrix table */
.compare-matrix-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
}

/* Horizontal scroll only when needed */
.compare-matrix-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.compare-matrix {
  width: 100%;
  min-width: 640px;  /* triggers horizontal scroll on phones */
  border-collapse: collapse;
  font-size: 0.92rem;
}

.compare-matrix thead th {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  padding: 1rem 1.25rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  z-index: 1;
}
.compare-matrix thead th:first-child {
  text-align: left;
  padding-left: 1.5rem;
  background: var(--bg-elevated);
}
.compare-matrix thead th.is-self {
  color: var(--accent-teal);
  background: linear-gradient(180deg, rgba(94, 234, 212, 0.08), var(--bg-elevated));
}

/* Section header row */
.compare-matrix .row-section td {
  padding: 1.5rem 1.5rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-teal);
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.compare-matrix .row-section td::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 1px;
  background: var(--accent-teal);
  vertical-align: middle;
  margin-right: 0.6rem;
  opacity: 0.6;
}
.compare-matrix .row-section + tr td { border-top: none; }

/* Feature rows */
.compare-matrix tbody tr.row-feature td {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
  vertical-align: middle;
}
.compare-matrix tbody tr.row-feature td:first-child {
  text-align: left;
  padding-left: 1.5rem;
  color: var(--text-primary);
  font-weight: 400;
}
.compare-matrix tbody tr.row-feature:hover td {
  background: rgba(94, 234, 212, 0.025);
}
.compare-matrix td.is-self {
  background: rgba(94, 234, 212, 0.04);
}
.compare-matrix tbody tr:hover td.is-self {
  background: rgba(94, 234, 212, 0.08);
}

/* Cell icons */
.cmp-yes,
.cmp-no,
.cmp-partial,
.cmp-na {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.cmp-yes {
  background: rgba(34, 197, 94, 0.12);
  color: var(--accent-green-bright);
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.cmp-no {
  background: rgba(248, 113, 113, 0.08);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.22);
}
.cmp-partial {
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.28);
}
.cmp-na {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Inline detail text after icon (e.g. "✓ 612 tokens") */
.cmp-detail {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* Matrix legend */
.compare-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 2rem;
  padding: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.compare-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Footnote */
.compare-footnote {
  max-width: 70ch;
  margin: 2rem auto 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.compare-footnote a { color: var(--accent-teal); }
