/* ClerkFinch Tools — Modern Static UI (Cloudflare Pages Ready) */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --surface-elevated: #ffffff;
  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --accent-hover: #1d4ed8;
  --accent-contrast: #ffffff;
  --highlight-bg: #f0f7ff;
  --highlight-border: #3b82f6;
  --highlight-text: #1d4ed8;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --card-shadow-hover: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  line-height: 1.7;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

/* Reading Progress Bar */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  z-index: 1000;
  transition: width 0.1s linear;
}

/* Site Header */
header.site {
  position: sticky;
  top: 0;
  z-index: 900;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

header.site .wrap,
main.wrap,
footer.site .wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
}

nav.top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: center;
  padding: 16px 0;
  font-size: 15px;
}

nav.top .brand {
  font-weight: 700;
  font-size: 19px;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

nav.top .brand-icon {
  width: 22px;
  height: 22px;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
}

nav.top a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  transition: color 0.15s ease;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}

nav.top a:hover {
  color: var(--accent);
}

/* Main Content */
main.wrap {
  padding: 40px 24px 72px;
}

h1, h2, h3, h4 {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

h1 {
  font-size: 34px;
  margin: 0 0 16px;
}

h2 {
  font-size: 24px;
  margin: 44px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

h3 {
  font-size: 20px;
  margin: 32px 0 10px;
}

p, li {
  font-size: 17px;
  color: var(--ink-secondary);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

.lede {
  font-size: 20px;
  line-height: 1.6;
  color: var(--ink-secondary);
  margin-bottom: 16px;
}

.small {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.small a {
  color: var(--muted);
  text-decoration: none;
}

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

/* Hero Section */
.hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  margin: 12px 0 36px;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #60a5fa, #38bdf8);
}

.hero h1 {
  margin-top: 0;
  font-size: 36px;
}

/* Stat & Metrics Counters */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 28px 0 36px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px 18px;
  text-align: center;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}

.metric-num {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
  display: block;
  font-variant-numeric: tabular-nums;
}

.metric-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-top: 6px;
  display: block;
}

/* Tiles (Grid Cards) */
.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0 32px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
}

.tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--line-strong);
}

.tile h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--ink);
}

.tile p {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.55;
}

/* Comparison Articles List */
ul.article-list {
  list-style: none;
  padding: 0;
  margin: 20px 0 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

ul.article-list li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--card-shadow);
  transition: all 0.2s ease;
}

ul.article-list li:hover {
  border-color: var(--accent);
  transform: translateX(4px);
  box-shadow: var(--card-shadow-hover);
}

ul.article-list li a {
  text-decoration: none;
  font-weight: 600;
  font-size: 17px;
  display: block;
}

/* Method / Callout Box */
.method {
  border-left: 4px solid var(--accent);
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 24px 28px;
  margin: 32px 0;
  box-shadow: var(--card-shadow);
}

.method h2 {
  border-bottom: none;
  padding-bottom: 0;
}

/* Notice / Disclosure Banner */
.disclosure-note {
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 16px 0 28px;
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.5;
}

/* Table of Contents Chips */
.toc-container {
  margin: 24px 0 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--card-shadow);
}

.toc-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 10px;
  display: block;
}

.toc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-chips a {
  display: inline-block;
  padding: 6px 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
}

.toc-chips a:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* Interactive Recommendation Widget ("Which one is right for you?") */
.decision-helper {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin: 32px 0;
  box-shadow: var(--card-shadow);
}

.decision-helper h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 20px;
}

.decision-helper p.helper-desc {
  font-size: 15px;
  color: var(--muted);
  margin-top: 0;
  margin-bottom: 16px;
}

.helper-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.helper-btn {
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.helper-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.helper-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.helper-output {
  background: var(--highlight-bg);
  border: 1px solid var(--highlight-border);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.helper-output.visible {
  display: block;
}

.helper-output-title {
  font-weight: 700;
  font-size: 17px;
  color: var(--highlight-text);
  margin: 0 0 6px;
}

.helper-output-body {
  margin: 0;
  font-size: 15px;
  color: var(--ink-secondary);
  line-height: 1.6;
}

/* Comparison Table */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 28px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  background: var(--surface);
}

.table-instruction {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 16px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 6px;
}

table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 15px;
  text-align: left;
}

th, td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

tr:last-child td {
  border-bottom: none;
}

thead th {
  background: var(--surface-subtle);
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  border-bottom: 2px solid var(--line-strong);
  user-select: none;
}

thead th.sortable-tool {
  cursor: pointer;
  position: relative;
}

thead th.sortable-tool:hover {
  background: var(--line);
  color: var(--accent);
}

thead th.sortable-tool::after {
  content: " (tap to highlight)";
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  display: block;
}

/* Column Highlight State */
th.highlight-col,
td.highlight-col {
  background-color: var(--highlight-bg) !important;
  color: var(--ink);
  border-left: 2px solid var(--highlight-border);
  border-right: 2px solid var(--highlight-border);
}

thead th.highlight-col {
  border-top: 2px solid var(--highlight-border);
  color: var(--highlight-text);
}

tr:last-child td.highlight-col {
  border-bottom: 2px solid var(--highlight-border);
}

/* Details / Collapsible Sources */
details.sources-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  margin: 32px 0;
  box-shadow: var(--card-shadow);
  transition: all 0.2s ease;
}

details.sources-box[open] {
  padding-bottom: 20px;
}

details.sources-box summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  outline: none;
}

details.sources-box summary:hover {
  color: var(--accent);
}

details.sources-box summary::marker,
details.sources-box summary::-webkit-details-marker {
  display: none;
}

details.sources-box summary::before {
  content: "▶";
  font-size: 11px;
  transition: transform 0.2s ease;
  color: var(--accent);
}

details.sources-box[open] summary::before {
  transform: rotate(90deg);
}

details.sources-box ul {
  margin: 16px 0 0;
  padding-left: 20px;
}

details.sources-box li {
  margin-bottom: 8px;
  font-size: 14px;
}

/* Scroll Reveal Animations */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Footer */
footer.site {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 32px 0 48px;
  font-size: 14px;
  color: var(--muted);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

footer.site nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-bottom: 14px;
}

footer.site a {
  color: var(--muted);
  text-decoration: none;
}

footer.site a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Keyframes */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Mobile Responsive */
@media (max-width: 640px) {
  header.site .wrap,
  main.wrap,
  footer.site .wrap {
    padding: 0 16px;
  }
  
  main.wrap {
    padding: 24px 16px 48px;
  }

  h1 {
    font-size: 26px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .hero {
    padding: 24px 20px;
  }

  .tiles {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .metrics-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  nav.top {
    gap: 6px 14px;
  }

  th, td {
    padding: 10px 12px;
    font-size: 14px;
  }
}

/* Hero illustration (added by Muse, 2026-11-20, refined by Gemini) */
.hero-art {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin: 28px auto 0;
}

/* Accessibility Focus States */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
