/**
 * Back Bay Boats — Site Stylesheet
 * Based on soft-ui design tokens (light theme)
 * Optimized for SEO content readability
 */

/* ===== Design Tokens (from soft-ui) ===== */
:root {
  /* Accent */
  --accent: #2563eb;
  --accent-light: #3b82f6;
  --accent-muted: rgba(37, 99, 235, 0.1);
  --accent-glow: rgba(37, 99, 235, 0.2);

  /* Surfaces — light theme */
  --bg: #f8fafc;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;

  /* Text */
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  /* Borders */
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);

  /* Radius (from soft-ui tokens) */
  --radius: 12px;
  --radius-lg: 16px;
  --radius-sm: 8px;

  /* Shadows (soft-ui light mode) */
  --shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 8px 32px -8px rgba(0, 0, 0, 0.15), 0 4px 8px -4px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.08);

  /* Transitions (from motion-system timing scale) */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 150ms var(--ease);
  --transition: 200ms var(--ease);
  --transition-slow: 300ms var(--ease);

  /* Spacing (from layout-system 4px base) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Content width */
  --content-width: 720px;
  --page-width: 1200px;
}

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

/* ===== Base ===== */
html {
  font-size: 18px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--accent-light); }

/* ===== Layout ===== */
.container {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.content-container {
  max-width: var(--content-width);
  margin: 0 auto;
}

/* ===== Header ===== */
.site-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.92);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.site-logo:hover { color: var(--text); }

.site-logo span {
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.site-nav a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.site-nav a:hover { color: var(--text); }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
}

.nav-toggle svg { width: 24px; height: 24px; stroke: var(--text); }

/* ===== Footer ===== */
.site-footer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: var(--space-2xl) 0;
  margin-top: var(--space-3xl);
}

.footer-content {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.8;
}

.footer-content a { color: var(--text-secondary); }
.footer-content a:hover { color: var(--accent); }

/* ===== Homepage Hero ===== */
.hero {
  position: relative;
  padding: 120px 0 100px;
  text-align: center;
  background: url('/images/hero-bay.png') center/cover no-repeat;
  margin: 0 0 var(--space-xl);
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0.55) 0%,
    rgba(15, 23, 42, 0.7) 60%,
    rgba(15, 23, 42, 0.85) 100%
  );
  z-index: 1;
}

.hero > * {
  position: relative;
  z-index: 2;
}

.hero h1 {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: #ffffff;
  margin-bottom: var(--space-md);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hero .subtitle {
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.85);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* ===== Article Cards (Homepage) ===== */
.article-grid {
  display: grid;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  transition: all var(--transition-slow);
  text-decoration: none;
  color: inherit;
  display: block;
}

.article-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 8px 32px -8px rgba(0, 0, 0, 0.15), 0 4px 8px -4px rgba(0, 0, 0, 0.08);
  transform: translateY(-4px) scale(1.01);
  color: inherit;
}

.article-card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.article-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.article-card:hover .article-card-image img {
  transform: scale(1.05);
}

.article-card-body {
  padding: var(--space-lg) var(--space-xl) var(--space-xl);
}

.article-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.article-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: var(--space-md);
}

.article-card .meta {
  display: flex;
  gap: var(--space-md);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.article-card .tag {
  background: var(--accent-muted);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ===== Article Hero Image ===== */
.article-hero-image {
  width: 100%;
  max-height: 400px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-xl);
  box-shadow: var(--shadow);
}

.article-hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ===== Article Page ===== */
.article-header {
  padding: var(--space-xl) 0 var(--space-lg);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-xl);
}

.article-header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

.article-meta {
  display: flex;
  gap: var(--space-md);
  color: var(--text-muted);
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.article-body {
  padding-bottom: var(--space-3xl);
}

/* Article typography */
.article-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: var(--space-2xl) 0 var(--space-md);
  letter-spacing: -0.02em;
  color: var(--text);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.article-body h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: var(--space-xl) 0 var(--space-sm);
  color: var(--text);
}

.article-body h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: var(--space-lg) 0 var(--space-sm);
  color: var(--text);
}

.article-body p {
  margin-bottom: var(--space-md);
  color: var(--text);
}

.article-body ul, .article-body ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-lg);
}

.article-body li {
  margin-bottom: var(--space-xs);
}

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

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

.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-muted);
  text-underline-offset: 2px;
  transition: text-decoration-color var(--transition-fast);
}

.article-body a:hover {
  text-decoration-color: var(--accent);
}

/* Blockquote — affiliate disclosure */
.article-body blockquote {
  background: var(--accent-muted);
  border-left: 4px solid var(--accent);
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-lg) 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.article-body blockquote p { margin-bottom: 0; color: var(--text-secondary); }
.article-body blockquote strong { color: var(--text); }

/* Tables */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-lg) 0;
  font-size: 0.85rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.article-body th {
  background: var(--surface-hover);
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  font-weight: 700;
  color: var(--text);
  border-bottom: 2px solid var(--border-strong);
}

.article-body td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}

.article-body tr:last-child td { border-bottom: none; }
.article-body tr:nth-child(even) td { background: rgba(248, 250, 252, 0.5); }

/* Horizontal rules */
.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-xl) 0;
}

/* Product Figures (images wrapped via marked renderer) */
.product-figure {
  margin: var(--space-lg) 0;
  text-align: center;
}

.product-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  margin: 0 auto;
  border-radius: var(--radius);
  background: var(--surface-hover);
  box-shadow: var(--shadow);
}

.product-figure figcaption {
  margin-top: var(--space-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Code (for schema/technical content) */
.article-body code {
  background: var(--surface-hover);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ===== About Page ===== */
.about-header {
  padding: var(--space-2xl) 0 var(--space-lg);
}

.about-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.about-content {
  font-size: 1rem;
  line-height: 1.8;
}

.about-content p {
  margin-bottom: var(--space-md);
}

/* ===== CTA Section ===== */
.cta-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  text-align: center;
  margin: var(--space-2xl) 0;
}

.cta-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.cta-section p {
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

/* ===== Table of Contents ===== */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
  margin: var(--space-lg) 0;
}

.toc h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.toc ul {
  list-style: none;
  padding: 0;
}

.toc li {
  margin-bottom: var(--space-xs);
}

.toc a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-decoration: none;
}

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

/* ===== Grain Texture (from soft-ui premium effects) ===== */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* ===== Gradient Accent Bar ===== */
.article-header {
  border-bottom: none;
  position: relative;
}

.article-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #06b6d4);
  border-radius: 2px;
}

/* ===== About Page Image ===== */
.about-image {
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-xl);
  box-shadow: var(--shadow);
  max-height: 360px;
}

.about-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ===== Breadcrumbs ===== */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: var(--space-md) 0;
}

.breadcrumbs a {
  color: var(--text-secondary);
  text-decoration: none;
}

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

/* ===== Author Link & Avatar ===== */
.author-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
}

.author-link:hover { color: var(--accent); }

.author-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

/* ===== Methodology Box ===== */
.methodology-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: var(--space-xl);
  margin: var(--space-2xl) 0;
}

.methodology-box h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 var(--space-md) 0;
  padding: 0;
  border: none;
  color: var(--text);
}

.methodology-box p {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.methodology-box p:last-child { margin-bottom: 0; }

/* ===== Author Bio Box ===== */
.author-bio-box {
  display: flex;
  gap: var(--space-lg);
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin: var(--space-xl) 0 0;
  box-shadow: var(--shadow-sm);
}

.author-bio-photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}

.author-bio-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: var(--space-xs);
  color: var(--text);
}

.author-bio-text p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.author-bio-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.author-bio-link:hover { color: var(--accent-light); }

/* ===== Pros / Cons Boxes (soft-ui semantic colors) ===== */
.pros-cons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}

.pros-box, .cons-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
}

.pros-box::before, .cons-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.pros-box::before { background: #34d399; }
.cons-box::before { background: #f87171; }

.pros-box h4, .cons-box h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.pros-box h4 { color: #059669; }
.cons-box h4 { color: #dc2626; }

.pros-box ul, .cons-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pros-box li, .cons-box li {
  font-size: 0.88rem;
  line-height: 1.5;
  padding: var(--space-xs) 0;
  padding-left: var(--space-lg);
  position: relative;
  color: var(--text-secondary);
}

.pros-box li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: #34d399;
  font-weight: 700;
}

.cons-box li::before {
  content: '\2717';
  position: absolute;
  left: 0;
  color: #f87171;
  font-weight: 700;
}

/* ===== Verdict Box (soft-ui gradient accent) ===== */
.verdict-box {
  display: flex;
  align-items: flex-start;
  gap: var(--space-lg);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.04) 0%, rgba(6, 182, 212, 0.04) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin: var(--space-md) 0 var(--space-xl);
}

.verdict-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  min-width: 64px;
}

.verdict-score .score {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.verdict-score .out-of {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.verdict-text h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
  color: var(--text);
}

.verdict-text p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* ===== Quick Answer Box (GEO optimization) ===== */
.quick-answer {
  background: var(--accent-muted);
  border-left: 4px solid var(--accent);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  margin: var(--space-lg) 0;
  font-size: 1.05rem;
  line-height: 1.6;
}
.quick-answer strong {
  color: var(--accent);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  html { font-size: 16px; }

  .container { padding: 0 var(--space-md); }

  .hero { padding: 80px 0 64px; }
  .hero h1 { font-size: 1.75rem; }
  .hero .subtitle { font-size: 1rem; }

  .article-hero-image { max-height: 240px; border-radius: var(--radius); }

  .article-card-body { padding: var(--space-md) var(--space-lg) var(--space-lg); }

  .article-header h1 { font-size: 1.5rem; }

  .article-body table { font-size: 0.8rem; }
  .article-body th, .article-body td { padding: var(--space-xs) var(--space-sm); }

  /* Table scroll on mobile */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: var(--space-lg) calc(-1 * var(--space-md));
    padding: 0 var(--space-md);
  }

  .nav-toggle { display: block; }

  .site-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: var(--space-md);
    gap: var(--space-md);
  }

  .site-nav.open { display: flex; }

  .article-card { padding: var(--space-lg); }

  .pros-cons { grid-template-columns: 1fr; }

  .author-bio-box {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .verdict-box {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.5rem; }
  .article-header h1 { font-size: 1.35rem; }
  .article-body h2 { font-size: 1.25rem; }
}

/* ===== Print ===== */
@media print {
  .site-header, .site-footer, .toc { display: none; }
  body { font-size: 12pt; }
  .article-body a { color: inherit; text-decoration: underline; }
}

/* ===== Animations (from motion-system) ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.article-card {
  animation: fadeInUp 0.4s var(--ease) backwards;
}

.article-card:nth-child(1) { animation-delay: 0ms; }
.article-card:nth-child(2) { animation-delay: 80ms; }
.article-card:nth-child(3) { animation-delay: 160ms; }
.article-card:nth-child(4) { animation-delay: 240ms; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
