/* ==========================================================================
   RailTrack Editorial Design System (Anti-AI-Slop, Publication Grade)
   Inspired by Wirecutter, Stripe Documentation & Substack
   Clean Typography • Human Editorial Rhythm • Zero Neon • Zero Emojis
   ========================================================================== */

:root,
[data-theme='dark'] {
  --bg-page: #0d1117;
  --bg-surface: #161b22;
  --bg-surface-hover: #1c2128;
  --bg-subtle: #21262d;

  --border: #30363d;
  --border-subtle: #21262d;
  --border-accent: #388bfd;

  --accent-primary: #58a6ff;
  --accent-primary-hover: #79b8ff;

  --text-title: #f0f6fc;
  --text-body: #c9d1d9;
  --text-muted: #8b949e;
  --text-caption: #6e7681;
  --text-link: #58a6ff;

  --table-header: #161b22;
  --table-border: #30363d;
  --table-zebra: #0f141c;

  --header-bg: rgba(13, 17, 23, 0.94);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

[data-theme='light'] {
  --bg-page: #ffffff;
  --bg-surface: #f6f8fa;
  --bg-surface-hover: #f0f2f5;
  --bg-subtle: #eaeef2;

  --border: #d0d7de;
  --border-subtle: #e1e4e8;
  --border-accent: #0969da;

  --accent-primary: #0969da;
  --accent-primary-hover: #0550ae;

  --text-title: #1f2328;
  --text-body: #24292f;
  --text-muted: #656d76;
  --text-caption: #8c959f;
  --text-link: #0969da;

  --table-header: #f6f8fa;
  --table-border: #d0d7de;
  --table-zebra: #fcfcfd;

  --header-bg: rgba(255, 255, 255, 0.94);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

/* Base Reset & Typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.72;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-page);
  color: var(--text-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* Minimalist Editorial Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-title);
}

.brand-logo {
  width: 26px;
  height: 26px;
  border-radius: 4px;
}

.brand-text-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-title);
  letter-spacing: -0.01em;
}

.brand-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}

.header-nav-link:hover {
  color: var(--text-title);
}

.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle-btn:hover {
  color: var(--text-title);
  border-color: var(--text-muted);
}

.header-cta-btn {
  background: var(--text-title);
  color: var(--bg-page);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.15s ease;
}

.header-cta-btn:hover {
  opacity: 0.88;
}

/* Master Layout */
.article-layout {
  max-width: 1140px;
  margin: 32px auto 64px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: minmax(0, 710px) 300px;
  justify-content: space-between;
  gap: 48px;
  align-items: start;
}

.article-main {
  min-width: 0;
}

/* Breadcrumbs */
.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-caption);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

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

.breadcrumb-nav a:hover {
  color: var(--text-title);
  text-decoration: underline;
}

.breadcrumb-sep {
  opacity: 0.4;
}

.breadcrumb-current {
  color: var(--text-body);
}

/* Article Header */
.article-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.pillar-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-primary);
  margin-bottom: 10px;
}

.article-title {
  font-size: 2.1rem;
  line-height: 1.25;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--text-title);
  margin-bottom: 14px;
}

.article-lead {
  font-size: 1.08rem;
  line-height: 1.62;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Clean Editorial Byline (NO emojis) */
.article-meta-row,
.article-byline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.byline-dot {
  opacity: 0.4;
}

.meta-item {
  display: inline-flex;
  align-items: center;
}

/* Editorial Body Typography */
.article-body {
  font-size: 1.025rem;
  line-height: 1.76;
  color: var(--text-body);
}

.article-body h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-title);
  margin: 36px 0 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.article-body h3 {
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text-title);
  margin: 26px 0 10px;
}

.article-body p {
  margin-bottom: 18px;
}

.article-body ul,
.article-body ol {
  margin: 0 0 22px 20px;
}

.article-body li {
  margin-bottom: 7px;
  padding-left: 2px;
}

.article-body strong {
  color: var(--text-title);
  font-weight: 650;
}

.article-body em {
  font-style: italic;
}

.article-body a {
  color: var(--text-link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-body a:hover {
  opacity: 0.85;
}

/* Clean Editorial Key Takeaways Callout (NO neon glow, NO AI slop) */
.verdict-box,
.key-takeaways {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-accent);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin: 24px 0 28px;
}

.verdict-header,
.takeaways-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-title);
  margin-bottom: 8px;
}

.verdict-quote,
.takeaways-content {
  font-size: 0.95rem;
  line-height: 1.62;
  color: var(--text-body);
  margin: 0;
}

.takeaways-list {
  margin: 0 0 0 16px;
  padding: 0;
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--text-body);
}

.takeaways-list li {
  margin-bottom: 6px;
}

.takeaways-list li:last-child {
  margin-bottom: 0;
}

/* Clean, Publication-Grade Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin: 28px 0;
  border: 1px solid var(--table-border);
  border-radius: var(--radius-md);
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.comparison-table th {
  background: var(--table-header);
  color: var(--text-title);
  font-weight: 650;
  padding: 11px 15px;
  border-bottom: 1px solid var(--table-border);
  white-space: nowrap;
}

.comparison-table td {
  padding: 11px 15px;
  border-bottom: 1px solid var(--table-border);
  color: var(--text-body);
  vertical-align: top;
}

.comparison-table tr:nth-child(even) td {
  background: var(--table-zebra);
}

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

.comparison-table th.highlight-col,
.comparison-table td.highlight-col {
  background: var(--bg-surface);
  font-weight: 600;
  color: var(--text-title);
}

/* Step-by-Step Instructions */
.steps-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0 28px;
}

.step-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.step-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-subtle);
  color: var(--text-title);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-content h4 {
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--text-title);
  margin-bottom: 3px;
}

.step-content p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.52;
  margin: 0;
}

/* Pros & Cons */
.pros-cons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 22px 0 28px;
}

.pros-card, .cons-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.pros-card h4 {
  color: var(--text-title);
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.cons-card h4 {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.pros-card ul, .cons-card ul {
  margin: 0 0 0 16px;
  font-size: 0.88rem;
  line-height: 1.55;
}

/* Clean FAQ Accordions */
.faq-section {
  margin: 32px 0;
}

.faq-accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg-surface);
}

.faq-question {
  padding: 13px 16px;
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--text-title);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  user-select: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-chevron {
  transition: transform 0.15s ease;
  color: var(--text-muted);
  flex-shrink: 0;
}

details[open] .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 16px 14px;
  font-size: 0.9rem;
  color: var(--text-body);
  line-height: 1.62;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}

/* Restrained, Tasteful In-Article Product Box */
.in-article-cta {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin: 32px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cta-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cta-app-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.cta-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-title);
  margin-bottom: 2px;
}

.cta-sub {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.btn-playstore-large {
  background: var(--text-title);
  color: var(--bg-page);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.84rem;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-playstore-large:hover {
  opacity: 0.88;
}

/* Minimalist Editorial Sidebar */
.article-sidebar {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.sidebar-card-title {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.sidebar-app-promo {
  text-align: left;
}

.promo-app-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.promo-app-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
}

.promo-app-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-title);
  line-height: 1.2;
}

.promo-app-desc {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.48;
  margin-bottom: 12px;
}

.sidebar-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
}

.sidebar-nav-item a {
  display: block;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.84rem;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background-color 0.15s ease;
  line-height: 1.35;
}

.sidebar-nav-item a:hover {
  color: var(--text-title);
  background: var(--bg-subtle);
}

.sidebar-nav-item.active a {
  color: var(--text-title);
  background: var(--bg-subtle);
  font-weight: 600;
}

/* Minimal Footer */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-page);
  padding: 28px 24px;
  font-size: 0.82rem;
  color: var(--text-caption);
}

.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links {
  display: flex;
  gap: 16px;
}

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

.footer-links a:hover {
  color: var(--text-title);
}

.footer-disclaimer {
  font-size: 0.75rem;
  line-height: 1.48;
  color: var(--text-caption);
}

/* Responsive */
@media (max-width: 960px) {
  .article-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .article-sidebar {
    position: static;
  }
  .article-title {
    font-size: 1.8rem;
  }
}

@media (max-width: 640px) {
  .pros-cons-grid {
    grid-template-columns: 1fr;
  }
  .article-title {
    font-size: 1.5rem;
  }
  .in-article-cta {
    flex-direction: column;
    text-align: left;
    align-items: flex-start;
  }
  .cta-left {
    flex-direction: row;
  }
}
