/* ========================================
   Topic Explorer Hub - Main Stylesheet
   ======================================== */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@400;500;600;700&display=swap');

/* CSS Variables */
:root {
    --primary: #1a1a2e;
    --accent: #e94560;
    --accent-hover: #d63d56;
    --background: #f8f9fa;
    --text: #2d3436;
    --text-light: #636e72;
    --card-bg: #ffffff;
    --border: #e0e0e0;
    --shadow: rgba(0, 0, 0, 0.08);
    --header-bg: rgba(248, 249, 250, 0.95);
    
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: 'Playfair Display', Georgia, serif;
    
    --max-width: 1200px;
    --header-height: 70px;
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --transition: all 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    color: var(--text);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

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

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    color: var(--primary);
}

h1 { font-size: 2.75rem; }
h2 { font-size: 2.25rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.35rem; }

p {
    margin-bottom: 1.25rem;
}

ul, ol {
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
}

/* Container */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ========================================
   Header
   ======================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    transition: var(--transition);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

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

.nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: var(--transition);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent);
}

/* Mobile Menu */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
    padding: calc(var(--header-height) + 4rem) 0 4rem;
    background: linear-gradient(135deg, var(--primary) 0%, #16213e 100%);
    color: white;
    text-align: center;
}

.hero h1 {
    color: white;
    font-size: 3.25rem;
    margin-bottom: 1rem;
}

.hero-tagline {
    font-size: 1.25rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero-search {
    max-width: 500px;
    margin: 0 auto 3rem;
}

.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-form input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: var(--font-body);
}

.search-form button {
    padding: 0.875rem 1.5rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.search-form button:hover {
    background: var(--accent-hover);
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
}

.stat-number {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ========================================
   Categories Section
   ======================================== */
.section {
    padding: 5rem 0;
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title h2 {
    margin-bottom: 0.5rem;
}

.section-title p {
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 20px var(--shadow);
    transition: var(--transition);
    cursor: pointer;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.category-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.25rem;
    background: linear-gradient(135deg, var(--accent), #ff6b6b);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.category-card h3 {
    margin-bottom: 0.75rem;
}

.category-card p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 0;
}

/* ========================================
   Articles Grid
   ======================================== */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 2rem;
}

.article-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 20px var(--shadow);
    transition: var(--transition);
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.article-image {
    height: 200px;
    background: linear-gradient(135deg, var(--primary), #16213e);
    position: relative;
    overflow: hidden;
}

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

.article-image .placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.3);
}

.article-category {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.35rem 0.85rem;
    background: var(--accent);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 20px;
}

.article-content {
    padding: 1.5rem;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.article-content h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.article-content h3 a {
    color: var(--primary);
}

.article-content h3 a:hover {
    color: var(--accent);
}

.article-excerpt {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.read-more {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
}

.read-time {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ========================================
   Newsletter Section
   ======================================== */
.newsletter {
    background: var(--primary);
    color: white;
    padding: 4rem 0;
}

.newsletter-inner {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.newsletter h2 {
    color: white;
    margin-bottom: 0.75rem;
}

.newsletter p {
    opacity: 0.85;
    margin-bottom: 2rem;
}

.newsletter-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.newsletter-form input {
    flex: 1;
    min-width: 250px;
    padding: 0.875rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
}

.newsletter-form button {
    padding: 0.875rem 2rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.newsletter-form button:hover {
    background: var(--accent-hover);
}

/* ========================================
   Footer
   ======================================== */
.footer {
    background: #111;
    color: rgba(255, 255, 255, 0.7);
    padding: 4rem 0 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-about h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: white;
    margin-bottom: 1rem;
}

.footer-links h4 {
    color: white;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
}

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

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 2rem;
    text-align: center;
    font-size: 0.9rem;
}

/* ========================================
   About Page
   ======================================== */
.page-hero {
    padding: calc(var(--header-height) + 4rem) 0 3rem;
    background: linear-gradient(135deg, var(--primary) 0%, #16213e 100%);
    color: white;
    text-align: center;
}

.page-hero h1 {
    color: white;
    margin-bottom: 1rem;
}

.page-hero p {
    font-size: 1.15rem;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto;
}

.content-section {
    padding: 4rem 0;
}

.content-section h2 {
    margin-bottom: 1.5rem;
}

.content-section h3 {
    margin-bottom: 1rem;
}

.story-block {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 4px 20px var(--shadow);
    margin-bottom: 2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature-item {
    padding: 1.5rem;
    background: var(--background);
    border-radius: var(--radius-md);
}

.feature-item h4 {
    margin-bottom: 0.75rem;
    color: var(--accent);
}

.feature-item p {
    margin-bottom: 0;
    font-size: 0.95rem;
}

/* ========================================
   Contact Page
   ======================================== */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 3rem;
}

.contact-info {
    background: var(--primary);
    color: white;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
}

.contact-info h3 {
    color: white;
    margin-bottom: 1.5rem;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.contact-icon {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.contact-form {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px var(--shadow);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font-body);
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.form-group textarea {
    min-height: 150px;
    resize: vertical;
}

.btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

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

/* ========================================
   Legal Pages
   ======================================== */
.legal-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0 5rem;
}

.legal-content h2 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.legal-content h3 {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}

.legal-content p {
    margin-bottom: 1rem;
}

.legal-content ul {
    margin-bottom: 1rem;
}

.legal-content li {
    margin-bottom: 0.5rem;
}

/* ========================================
   Category Pages
   ======================================== */
.category-header {
    padding: calc(var(--header-height) + 3rem) 0 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, #16213e 100%);
    color: white;
    text-align: center;
}

.category-header h1 {
    color: white;
    margin-bottom: 0.75rem;
}

.category-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

.category-articles {
    padding: 4rem 0;
}

/* ========================================
   Article Page (Single)
   ======================================== */
.article-page {
    padding-top: calc(var(--header-height) + 2rem);
}

.article-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 3rem;
    padding: 0 1.5rem;
}

.breadcrumb {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: var(--text-light);
}

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

.article-category-tag {
    display: inline-block;
    padding: 0.35rem 1rem;
    background: var(--accent);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 20px;
    margin-bottom: 1rem;
}

.article-header h1 {
    font-size: 2.75rem;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.article-info {
    display: flex;
    justify-content: center;
    gap: 2rem;
    color: var(--text-light);
    font-size: 0.95rem;
}

.article-featured-image {
    max-width: 900px;
    margin: 0 auto 3rem;
    padding: 0 1.5rem;
}

.article-featured-image img {
    width: 100%;
    border-radius: var(--radius-lg);
}

.article-body {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
}

.article-body h2 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-size: 1.75rem;
}

.article-body h3 {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    font-size: 1.35rem;
}

.article-body p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.8;
}

.article-body ul,
.article-body ol {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.article-body li {
    margin-bottom: 0.5rem;
}

/* Blockquote */
.article-body blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    border-left: 4px solid var(--accent);
    background: var(--card-bg);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-style: italic;
    font-size: 1.15rem;
    color: var(--text);
    box-shadow: 0 4px 20px var(--shadow);
}

.article-body blockquote cite {
    display: block;
    margin-top: 1rem;
    font-size: 0.9rem;
    font-style: normal;
    color: var(--text-light);
}

/* Code */
.article-body code {
    background: #f1f1f1;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--accent);
}

.article-body pre {
    background: var(--primary);
    color: #f8f8f2;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 2rem 0;
}

.article-body pre code {
    background: none;
    color: inherit;
    padding: 0;
}

/* Table */
.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.95rem;
}

.article-body th,
.article-body td {
    padding: 1rem;
    border: 1px solid var(--border);
    text-align: left;
}

.article-body th {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.article-body tr:nth-child(even) {
    background: var(--background);
}

/* TOC */
.toc {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin: 2rem 0;
}

.toc h4 {
    margin-bottom: 1rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.toc li {
    margin-bottom: 0.5rem;
}

.toc a {
    color: var(--text);
    font-size: 0.95rem;
}

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

/* Reading Progress */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--accent);
    z-index: 1001;
    transition: width 0.1s linear;
}

/* ========================================
   Back to Top
   ======================================== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.3);
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--accent-hover);
    transform: translateY(-3px);
}

/* ========================================
   Animations
   ======================================== */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease forwards;
}

/* ========================================
   Search Results
   ======================================== */
.search-results {
    padding: 3rem 0;
    min-height: 50vh;
}

.search-result-item {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px var(--shadow);
}

.search-result-item h3 {
    margin-bottom: 0.5rem;
}

.search-result-item h3 a {
    color: var(--primary);
}

.search-result-item p {
    color: var(--text-light);
    margin-bottom: 0;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    h1 { font-size: 2.25rem; }
    h2 { font-size: 1.75rem; }
    
    .nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--card-bg);
        flex-direction: column;
        padding: 1.5rem;
        gap: 1rem;
        box-shadow: 0 10px 30px var(--shadow);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition);
    }
    
    .nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero-stats {
        gap: 1.5rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .article-header h1 {
        font-size: 2rem;
    }
    
    .article-body h2 {
        font-size: 1.5rem;
    }
    
    .article-body p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    .newsletter-form input {
        min-width: 100%;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 1rem;
    }
}
