/**
 * GUIDES-HUB.CSS
 * Styles for /guides/ hub pages
 * Extends patterns from /calculators/hub.css
 */

/* ============================================
   1. HUB CONTAINER (inherits from main-wrapper)
   ============================================ */

.hub-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}

/* ============================================
   2. GUIDES HERO SECTION
   ============================================ */

.guides-hero {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  background: linear-gradient(135deg, var(--surface) 0%, var(--background) 100%);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-xl);
}

.guides-hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
  color: var(--text);
}

.guides-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* Pillar-specific hero */
.pillar-hero {
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
  margin-bottom: var(--space-xl);
}

.pillar-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: var(--space-md);
}

.pillar-description {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto var(--space-sm);
}

.guide-count {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ============================================
   3. GUIDES GRID
   ============================================ */

.guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.guides-grid--featured {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

/* ============================================
   4. GUIDE CARD
   ============================================ */

.guide-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.guide-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

.guide-card:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.guide-card__pillar {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--primary-light, rgba(59, 130, 246, 0.1));
  color: var(--primary);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
  width: fit-content;
}

.guide-card__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text);
}

.guide-card__description {
  font-size: 0.95rem;
  color: var(--text-secondary);
  flex-grow: 1;
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

.guide-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.guide-card__calculator-link {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: auto;
}

.guide-card__calculator-link::before {
  content: "From: ";
}

.guide-card__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-md);
  font-weight: 600;
  color: var(--primary);
}

.guide-card__cta::after {
  content: " ->";
}

/* ============================================
   5. PILLAR GRID (Main Hub)
   ============================================ */

.pillar-grid-section {
  margin-bottom: var(--space-xl);
}

.pillar-grid-section h2 {
  margin-bottom: var(--space-lg);
}

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.pillar-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.pillar-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

.pillar-card:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.pillar-card__icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
}

.pillar-card__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--text);
}

.pillar-card__description {
  font-size: 0.95rem;
  color: var(--text-secondary);
  flex-grow: 1;
  margin-bottom: var(--space-md);
}

.pillar-card__count {
  font-size: 0.875rem;
  color: var(--primary);
  font-weight: 500;
}

.pillar-card__cta {
  margin-top: var(--space-sm);
  font-size: 0.875rem;
  color: var(--primary);
  font-weight: 600;
}

/* ============================================
   6. FEATURED GUIDES SECTION
   ============================================ */

.featured-guides {
  margin-bottom: var(--space-xl);
}

.featured-guides h2 {
  margin-bottom: var(--space-lg);
}

/* ============================================
   7. RELATED SECTIONS
   ============================================ */

.related-calculators,
.other-topics {
  margin-bottom: var(--space-xl);
  padding: var(--space-xl);
  background: var(--surface);
  border-radius: var(--radius-md);
  text-align: center;
}

.related-calculators h2,
.other-topics h2 {
  margin-bottom: var(--space-md);
}

.related-calculators p {
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.btn-secondary {
  display: inline-block;
  padding: var(--space-sm) var(--space-lg);
  background: var(--background);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.btn-secondary:hover {
  background: var(--primary);
  color: white;
}

.calculator-links,
.pillar-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.calculator-links a,
.pillar-links a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-size: 0.95rem;
  transition: background 0.2s, border-color 0.2s;
}

.calculator-links a:hover,
.pillar-links a:hover {
  background: var(--primary-light, rgba(59, 130, 246, 0.1));
  border-color: var(--primary);
}

/* ============================================
   8. FAQ SECTION
   ============================================ */

.faq-section {
  margin-bottom: var(--space-xl);
}

.faq-section h2 {
  margin-bottom: var(--space-lg);
}

.faq-container {
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-item h3 {
  font-size: 1.125rem;
  margin-bottom: var(--space-sm);
  color: var(--text);
}

.faq-item p {
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ============================================
   9. DARK MODE OVERRIDES
   ============================================ */

[data-theme="dark"] .guide-card {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="dark"] .guide-card:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .pillar-card {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="dark"] .pillar-card:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .guide-card__pillar {
  background: rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .guides-hero {
  background: linear-gradient(135deg, var(--surface) 0%, var(--background) 100%);
}

/* Text readability enhancements for dark mode */
[data-theme="dark"] .guide-card__title,
[data-theme="dark"] .pillar-card__title {
  color: var(--text-primary);
}

[data-theme="dark"] .guide-card__description,
[data-theme="dark"] .pillar-card__description {
  color: var(--text-secondary);
}

[data-theme="dark"] .guide-card__meta,
[data-theme="dark"] .guide-card__calculator-link,
[data-theme="dark"] .guide-count {
  color: var(--text-tertiary);
}

[data-theme="dark"] .pillar-description {
  color: var(--text-secondary);
}

[data-theme="dark"] .guides-subtitle {
  color: var(--text-secondary);
}

[data-theme="dark"] .faq-item h3 {
  color: var(--text-primary);
}

[data-theme="dark"] .faq-item p {
  color: var(--text-secondary);
}

[data-theme="dark"] .related-calculators,
[data-theme="dark"] .other-topics {
  background: var(--surface);
}

[data-theme="dark"] .related-calculators p {
  color: var(--text-secondary);
}

[data-theme="dark"] .calculator-links a,
[data-theme="dark"] .pillar-links a {
  background: var(--background);
  border-color: var(--border);
  color: var(--text-primary);
}

[data-theme="dark"] .calculator-links a:hover,
[data-theme="dark"] .pillar-links a:hover {
  background: rgba(59, 130, 246, 0.15);
}

/* ============================================
   10. RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
  .guides-hero h1 {
    font-size: 2rem;
  }

  .guides-subtitle {
    font-size: 1.1rem;
  }

  .guides-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .guides-grid--featured {
    grid-template-columns: 1fr;
  }

  .pillar-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .pillar-hero {
    padding: var(--space-lg);
  }

  .pillar-icon {
    font-size: 2.5rem;
  }
}

@media (max-width: 480px) {
  .hub-container {
    padding: var(--space-md) var(--space-sm);
  }

  .guides-hero {
    padding: var(--space-lg) var(--space-md);
  }

  .guides-hero h1 {
    font-size: 1.75rem;
  }

  .guide-card,
  .pillar-card {
    padding: var(--space-md);
  }

  .related-calculators,
  .other-topics {
    padding: var(--space-lg);
  }
}

/* ============================================
   11. ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .guide-card,
  .pillar-card,
  .btn-secondary,
  .calculator-links a,
  .pillar-links a {
    transition: none;
  }

  .guide-card:hover,
  .pillar-card:hover {
    transform: none;
  }
}

@media (prefers-contrast: high) {
  .guide-card,
  .pillar-card {
    border-width: 2px;
  }

  .guide-card:focus-visible,
  .pillar-card:focus-visible {
    outline-width: 4px;
  }
}

/* Screen reader only class */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
