/* Custom CSS for HistoryPunk */

:root {
    --bs-burgundy: #800020;
    --bs-gold: #FFD700;
    --bs-off-white: #FAFAFA;
    --bs-dark-gray: #333333;
}

/* Custom Bootstrap Classes */
.bg-burgundy {
    background-color: var(--bs-burgundy) !important;
}

.text-burgundy {
    color: var(--bs-burgundy) !important;
}

.text-gold {
    color: var(--bs-gold) !important;
}

/* Typography */
body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
}

/* Navigation */
.navbar-brand {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: var(--bs-gold) !important;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--bs-burgundy) 0%, #A0522D 100%);
    color: white;
    padding: 4rem 0;
    margin-bottom: 3rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* Article Cards */
.article-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    background: var(--surface-muted);
}

.article-card .card-img-top {
    height: 200px;
    object-fit: cover;
}

.article-card .card-title {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    color: var(--bs-burgundy);
}

.article-card .card-text {
    color: var(--bs-dark-gray);
    font-size: 0.9rem;
}

.article-meta {
    font-size: 0.8rem;
    color: #6c757d;
}

/* Category Badges */
.category-badge {
    background-color: var(--bs-burgundy);
    color: white;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.category-badge:hover {
    background-color: #660019;
    color: white;
}

/* Buttons */
.btn-primary {
    background-color: var(--bs-burgundy);
    border-color: var(--bs-burgundy);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #660019;
    border-color: #660019;
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--bs-burgundy);
    border-color: var(--bs-burgundy);
}

.btn-outline-primary:hover {
    background-color: var(--bs-burgundy);
    border-color: var(--bs-burgundy);
}

/* Article Content */
.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--bs-dark-gray);
}

.article-content h2, .article-content h3, .article-content h4 {
    color: var(--bs-burgundy);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1.5rem 0;
}

/* Comments Section */
.comment-card {
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.comment-header {
    background-color: #f8f9fa;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e9ecef;
}

/* Search Bar */
.search-form {
    max-width: 500px;
}

.search-form .form-control {
    border-radius: 2rem 0 0 2rem;
    border-right: none;
}

.search-form .btn {
    border-radius: 0 2rem 2rem 0;
    border-left: none;
}

/* Theme Toggle */
#theme-toggle {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#theme-toggle:hover {
    background-color: var(--bs-gold);
    color: var(--bs-burgundy);
}

/* Dark Theme Overrides */
[data-bs-theme="dark"] {
    --bs-burgundy: #A0522D;
    --bs-off-white: #1a1a1a;
    --bs-dark-gray: #e0e0e0;
}

[data-bs-theme="dark"] .article-card {
    background-color: #2d2d2d;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .article-content {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .comment-card {
    background-color: #2d2d2d;
    border-color: #444;
}

[data-bs-theme="dark"] .comment-header {
    background-color: #3d3d3d;
    border-color: #444;
}

/* Footer */
footer {
    background-color: var(--bs-dark) !important;
    color: #f8f9fa;
}

footer .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

footer a {
    color: #f8f9fa;
}

footer a.text-light {
    color: #f8f9fa !important;
}

footer .social-links a {
    color: #f8f9fa;
}

footer hr {
    border-color: rgba(255, 255, 255, 0.2);
}

.footer-title { font-weight: 700; letter-spacing: .02em; }
.footer-link { color: #f8f9fa; text-decoration: none; display: inline-block; padding: .15rem 0; }
.footer-link:hover { color: var(--bs-gold) !important; text-decoration: underline; }
.footer-newsletter .form-control { background: #1f1f1f; color: #f8f9fa; }
.footer-newsletter .form-control::placeholder { color: rgba(255,255,255,0.7); }
[data-bs-theme="light"] .footer-newsletter .form-control::placeholder { color: #6b7280; }
.footer-divider { border-color: rgba(255, 255, 255, 0.15) !important; }
[data-bs-theme="dark"] .footer-newsletter .form-control { background: #17181a; }
[data-bs-theme="light"] .footer-newsletter .form-control { background: #fff; color: #1f2937; }
[data-bs-theme="light"] .footer-link { color: #f8f9fa; }
[data-bs-theme="light"] footer .text-muted { color: rgba(255, 255, 255, 0.8) !important; }

.social-links a {
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--bs-gold) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .article-card .card-img-top {
        height: 150px;
    }
}

@media (max-width: 576px) {
    .hero-section {
        padding: 2rem 0;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .article-content {
        font-size: 1rem;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(128, 0, 32, 0.3);
    border-radius: 50%;
    border-top-color: var(--bs-burgundy);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Utility Classes */
.text-gold {
    color: var(--bs-gold) !important;
}

.bg-gold {
    background-color: var(--bs-gold) !important;
}

.border-burgundy {
    border-color: var(--bs-burgundy) !important;
}

/* Smooth Transitions */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Inline Images inside article content via [[image:ID]] */
.article-inline-image { margin: 1.5rem 0; text-align: center; }
.article-inline-image img { max-width: 100%; height: auto; }
.article-inline-image figcaption { font-size: 0.9rem; color: #6c757d; margin-top: 0.5rem; }

:root {
    --surface: #ffffff;
    --surface-muted: #f7f7f9;
    --text-muted: #6b7280;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
    --shadow-lg: 0 10px 24px rgba(0,0,0,0.12);
}

body { line-height: 1.7; color: #1f2937; background-color: #fff; }
h1, h2, h3, h4, h5, h6 { letter-spacing: .01em; }
.text-muted { color: var(--text-muted) !important; }
.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded-md { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.card-surface { background: var(--surface); border: 1px solid #e5e7eb; }
.pill { border-radius: 999px !important; }
.content-wrap { max-width: 960px; margin: 0 auto; }

.article-card { transition: transform 0.25s ease, box-shadow 0.25s ease; border: 1px solid #e5e7eb; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); background: var(--surface); }
.article-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.article-card .card-img-top { height: 220px; object-fit: cover; border-top-left-radius: var(--radius-lg); border-top-right-radius: var(--radius-lg); }
.article-meta { font-size: 0.85rem; color: var(--text-muted); }

.category-badge { background: rgba(128, 0, 32, 0.12); color: var(--bs-burgundy); font-size: 0.75rem; padding: 0.35rem 0.6rem; border-radius: 999px; text-decoration: none; border: 1px solid rgba(128,0,32,0.25); transition: all 0.2s ease; }
.category-badge:hover { background: rgba(128, 0, 32, 0.18); color: var(--bs-burgundy); border-color: rgba(128,0,32,0.35); }

.btn-primary { transition: all 0.2s ease; border-radius: var(--radius-md); }
.btn-outline-primary { border-radius: var(--radius-md); }
.btn { box-shadow: none !important; }
.form-control { border-radius: var(--radius-md); border-color: #e5e7eb; }
.form-control:focus { border-color: var(--bs-burgundy); box-shadow: 0 0 0 0.2rem rgba(128,0,32,0.15); }
.modal-content { border-radius: var(--radius-lg); border: 1px solid #e5e7eb; box-shadow: var(--shadow-lg); }
.modal-header { background: var(--surface-muted); border-bottom-color: #e5e7eb; }
.dropdown-menu { border-radius: var(--radius-md); border: 1px solid #e5e7eb; box-shadow: var(--shadow-md); }
.card { border-radius: var(--radius-lg); border: 1px solid #e5e7eb; box-shadow: var(--shadow-sm); }
.card-header { border-bottom: 1px solid #e5e7eb; background: var(--surface-muted); }
.table { border-color: #e5e7eb; }
.table thead th { color: var(--text-muted); border-bottom-color: #e5e7eb; }
.table tbody td { border-top-color: #f0f0f0; }

.article-content p { margin-bottom: 1.1rem; }
.article-content ul, .article-content ol { margin: 0.75rem 0 1.25rem 1.25rem; }
.article-content blockquote { border-left: 3px solid var(--bs-burgundy); padding-left: 1rem; color: #4b5563; }
.article-inline-image img { border-radius: var(--radius-md); }

.social-links a { transition: color 0.2s ease, transform 0.2s ease; }
.social-links a:hover { transform: translateY(-2px); }

[data-bs-theme="dark"] {
    --surface: #242424;
    --surface-muted: #2b2b2b;
    --text-muted: #9ca3af;
}
[data-bs-theme="dark"] .article-card { border-color: #3a3a3a; }

/* Navbar polish */
.navbar-dark.bg-burgundy { background: linear-gradient(135deg, var(--bs-burgundy) 0%, #6a001a 100%) !important; }
.navbar-nav .dropdown-menu { border: 1px solid #e5e7eb; border-radius: var(--radius-md); box-shadow: var(--shadow-md); }
.navbar-nav .dropdown-item { padding: .5rem .75rem; border-radius: var(--radius-sm); }
.navbar-nav .dropdown-item:hover { background: var(--surface-muted); }
.mega-dropdown { min-width: 680px; border: 1px solid #e5e7eb; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
[data-bs-theme="dark"] .mega-dropdown { border-color: #2a2d32; }
.mega-cat { padding: .5rem; border-radius: var(--radius-md); transition: background-color .2s ease, transform .2s ease; }
.mega-cat:hover { background: var(--surface-muted); transform: translateY(-2px); }
.mega-title { font-weight: 600; }
.mega-meta { margin-top: 2px; }
.mega-section-title { font-weight: 600; letter-spacing: .02em; margin-bottom: .25rem; }
.mega-group-title { font-weight: 700; margin-bottom: .5rem; color: var(--bs-burgundy); text-align: center; }
[data-bs-theme="dark"] .mega-group-title { color: var(--bs-burgundy); }
.mega-group { text-align: center; }
.mega-cat .mega-title { display: inline-block; }
[data-bs-theme="light"] .mega-cat .mega-title { color: #111 !important; }
[data-bs-theme="dark"] .mega-cat .mega-title { color: var(--bs-burgundy) !important; }

[data-bs-theme="dark"] .mega-group-title { color: #e5e7eb; }

/* Explore category cards hover */
.explore-card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.explore-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); background: var(--surface-muted); }
/* Explore by Category FX colors */
.explore-card { box-shadow: var(--shadow-sm), inset 0 0 0 1px #e5e7eb; }
[data-bs-theme="dark"] .explore-card { box-shadow: var(--shadow-sm), inset 0 0 0 1px #2a2d32; }
.explore-card:hover { box-shadow: var(--shadow-md), inset 0 0 0 2px var(--bs-burgundy); }
[data-bs-theme="dark"] .explore-card:hover { box-shadow: var(--shadow-md), inset 0 0 0 2px #5a1225; }
.explore-card:hover .card-title { color: var(--bs-burgundy); }
[data-bs-theme="dark"] .explore-card:hover .card-title { color: #e5e7eb; }
.explore-card:hover .bi { color: var(--bs-burgundy) !important; }
[data-bs-theme="dark"] .explore-card:hover .bi { color: #e5e7eb !important; }

.btn-primary { background: linear-gradient(135deg, var(--bs-burgundy) 0%, #6a001a 100%); border: none; color: #fff; }
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 0 12px rgba(128,0,32,0.35), 0 10px 24px rgba(0,0,0,0.18); }
[data-bs-theme="dark"] .btn-primary { background: linear-gradient(135deg, #7a0f2a 0%, #2a0a12 100%); border: none; color: #fff; }
[data-bs-theme="dark"] .btn-primary:hover { filter: brightness(1.08); box-shadow: 0 0 14px rgba(90,18,37,0.6), 0 10px 24px rgba(0,0,0,0.35); }
.btn-outline-primary:hover { background: linear-gradient(135deg, var(--bs-burgundy) 0%, #6a001a 100%); color: #fff; border-color: transparent; }
[data-bs-theme="dark"] .btn-outline-primary:hover { background: linear-gradient(135deg, #7a0f2a 0%, #2a0a12 100%); color: #fff; border-color: transparent; }
.btn-burgundy { background: linear-gradient(135deg, var(--bs-burgundy) 0%, #6a001a 100%); color: #fff; border: none; }
[data-bs-theme="dark"] .btn-burgundy { background: linear-gradient(135deg, #7a0f2a 0%, #2a0a12 100%); color: #fff; border: none; }
[data-bs-theme="light"] .card-header.bg-burgundy { background: linear-gradient(135deg, var(--bs-burgundy) 0%, #6a001a 100%) !important; color: #fff; border-bottom-color: transparent; }
[data-bs-theme="dark"] .card-header.bg-burgundy { background: linear-gradient(135deg, #7a0f2a 0%, #2a0a12 100%) !important; color: #fff; border-bottom-color: transparent; }

/* Comprehensive dark theme overrides */
[data-bs-theme="dark"] body { background-color: #0f1115; color: #e5e7eb; }
[data-bs-theme="dark"] a { color: #e5e7eb; }
[data-bs-theme="dark"] .hero-section { background: linear-gradient(135deg, #4b0e1e 0%, #2b2b2b 100%); }
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .card-surface { background: #1c1f24; border-color: #2a2d32; }
[data-bs-theme="dark"] .card-header { background: #22262b; border-bottom-color: #2a2d32; }
[data-bs-theme="dark"] .dropdown-menu,
[data-bs-theme="dark"] .modal-content { background: #1c1f24; color: #e5e7eb; border-color: #2a2d32; }
[data-bs-theme="dark"] .form-control { background: #181a1e; color: #e5e7eb; border-color: #2a2d32; }
[data-bs-theme="dark"] .form-control::placeholder { color: #9ca3af; }
[data-bs-theme="dark"] .article-content { color: #e5e7eb; }
[data-bs-theme="dark"] .article-content blockquote { color: #cbd5e1; border-left-color: var(--bs-burgundy); }
[data-bs-theme="dark"] footer { background-color: #0c0d0f !important; color: #e5e7eb; }
[data-bs-theme="dark"] footer .text-muted { color: rgba(229, 231, 235, 0.8) !important; }
[data-bs-theme="dark"] .navbar-dark.bg-burgundy { background: linear-gradient(135deg, #7a0f2a 0%, #2a0a12 100%) !important; }

/* Dark theme button and accent adjustments (remove orange/gold accents) */
[data-bs-theme="dark"] .btn-light { background-color: #2b2b2b; color: #e5e7eb; border-color: #3a3a3a; }
[data-bs-theme="dark"] .btn-light:hover { background-color: #34373c; color: #ffffff; }
[data-bs-theme="dark"] .btn-outline-light { color: #e5e7eb; border-color: #e5e7eb; }
[data-bs-theme="dark"] .btn-outline-light:hover { background-color: #e5e7eb; color: #1f2937; }
[data-bs-theme="dark"] #theme-toggle:hover { background-color: #2b2b2b; color: var(--bs-burgundy); }
[data-bs-theme="dark"] .social-links a:hover { color: var(--bs-burgundy) !important; }
[data-bs-theme="dark"] footer .list-unstyled a:hover { color: var(--bs-burgundy) !important; }
[data-bs-theme="dark"] .text-gold { color: #e5e7eb !important; }
[data-bs-theme="dark"] .bg-gold { background-color: #2b2b2b !important; }

/* Dark theme title accent: neutralize orange tones */
[data-bs-theme="dark"] .text-burgundy { color: #e5e7eb !important; }
[data-bs-theme="dark"] .article-card .card-title,
[data-bs-theme="dark"] .article-content h2,
[data-bs-theme="dark"] .article-content h3,
[data-bs-theme="dark"] .article-content h4,
[data-bs-theme="dark"] .hero-title,
[data-bs-theme="dark"] h1, [data-bs-theme="dark"] h2, [data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4, [data-bs-theme="dark"] h5, [data-bs-theme="dark"] h6 {
  color: #e5e7eb !important;
}

/* Accent color system */
:root { --accent: var(--bs-burgundy); }
[data-bs-theme="dark"] { --accent: #79c0ff; }
[data-bs-theme="dark"] .article-card .card-title,
[data-bs-theme="dark"] .article-content h2,
[data-bs-theme="dark"] .article-content h3,
[data-bs-theme="dark"] .article-content h4,
[data-bs-theme="dark"] .hero-title,
[data-bs-theme="dark"] .text-burgundy { color: var(--accent) !important; }
[data-bs-theme="dark"] .category-badge { color: var(--accent); border-color: rgba(121,192,255,0.5); background: rgba(121,192,255,0.12); }

/* Related articles hover */
.related-item { transition: background-color 0.2s ease, transform 0.2s ease; border-radius: var(--radius-md); }
.related-item:hover { background: var(--surface-muted); transform: translateY(-2px); }

/* Footer links hover */
footer .list-unstyled a { transition: color 0.2s ease, text-decoration-color 0.2s ease; text-decoration-thickness: 2px; }
footer .list-unstyled a:hover { color: var(--bs-gold) !important; text-decoration: underline; }

/* Article cards extra hover emphasis */
.article-card:hover .card-title { text-decoration: underline; text-decoration-thickness: 2px; }

/* Accessibility: skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--bs-burgundy);
  color: #fff;
  padding: 8px 12px;
  border-radius: 0 0 8px 0;
  z-index: 1000;
}
.skip-link:focus { top: 0; }

/* Reading progress bar */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, var(--bs-burgundy), #A0522D);
  transform-origin: 0 0;
  transform: scaleX(0);
  z-index: 2000;
}

/* Table of contents */
.toc { background: var(--surface-muted); border: 1px solid #e5e7eb; border-radius: var(--radius-md); padding: .75rem; }
[data-bs-theme="dark"] .toc { border-color: #2a2d32; }
.toc .toc-link { color: inherit; text-decoration: none; display: block; padding: .15rem 0; }
.toc .toc-link:hover { text-decoration: underline; }

/* Focus states for interactive elements */
.btn:focus, .nav-link:focus, .mega-cat:focus, .dropdown-item:focus, a:focus {
  outline: 2px solid var(--bs-burgundy);
  outline-offset: 2px;
}

/* Mobile full-screen categories menu */
@media (max-width: 768px) {
  .navbar .dropdown-menu.mega-dropdown {
    position: fixed !important;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw; height: 100vh;
    overflow-y: auto;
    border-radius: 0;
    min-width: 0;
    padding: 1rem;
    z-index: 1055;
    background: var(--surface);
  }
  .mega-header {
    position: sticky;
    top: 0;
    background: var(--surface);
    padding-bottom: .5rem;
    margin-bottom: .5rem;
    border-bottom: 1px solid #e5e7eb;
  }
}
