/* ============================================================
   Tiny-Dev — Shared Stylesheet
   All pages import this file. Page-specific overrides go in
   their own CSS files (index.css / article-page.css).
   ============================================================ */

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

/* ---------- Design Tokens ---------- */
:root {
    --primary:      #2563eb;
    --primary-dark: #1e40af;
    --accent:       #3b82f6;
    --dark-bg:      #0f172a;
    --light-bg:     #f8fafc;

    /* Semantic surface / text tokens */
    --surface:      #ffffff;
    --surface-alt:  #f1f5f9;
    --text-primary: #1e293b;
    --text-body:    #475569;
    --text-muted:   #64748b;
    --border:       #e2e8f0;

    /* Navbar */
    --navbar-bg:    linear-gradient(135deg, var(--dark-bg) 0%, var(--primary-dark) 100%);

    /* Transitions */
    --t-fast:  0.2s ease;
    --t-base:  0.3s ease;
    --t-slow:  0.5s ease;
}

/* ---------- Dark Mode Tokens ---------- */
@media (prefers-color-scheme: dark) {
    :root {
        --surface:      #1e293b;
        --surface-alt:  #0f172a;
        --text-primary: #f1f5f9;
        --text-body:    #cbd5e1;
        --text-muted:   #94a3b8;
        --border:       #334155;
        --light-bg:     #0f172a;
    }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

/* ---------- Reading Progress Bar ---------- */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    z-index: 9999;
    transition: width 0.1s linear;
}

/* ---------- Navbar ---------- */
.navbar {
    background: var(--navbar-bg);
    padding: 0.75rem 0;
    box-shadow: 0 2px 20px rgba(0,0,0,0.15);
    transition: background var(--t-base), box-shadow var(--t-base);
}

/* Solid/frosted look after scrolling */
.navbar.scrolled {
    background: rgba(15, 23, 42, 0.97) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 2px 24px rgba(0,0,0,0.3);
}

.navbar-brand {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff !important;
    letter-spacing: -0.5px;
    transition: opacity var(--t-fast);
}
.navbar-brand:hover { opacity: 0.85; }
.navbar-brand i { color: var(--accent); margin-right: 0.35rem; }

.nav-link {
    color: rgba(255,255,255,0.85) !important;
    font-weight: 500;
    font-size: 0.93rem;
    margin: 0 0.25rem;
    padding: 0.5rem 0.75rem !important;
    border-radius: 6px;
    transition: color var(--t-fast), background var(--t-fast);
}
.nav-link:hover {
    color: #fff !important;
    background: rgba(255,255,255,0.1);
}
/* Active page highlight */
.nav-link.active-page {
    color: #fff !important;
    background: rgba(59,130,246,0.25);
}

.dropdown-menu-dark {
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    overflow: hidden;
    padding: 0.4rem;
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.dropdown-item {
    border-radius: 6px;
    padding: 0.5rem 0.85rem;
    font-size: 0.9rem;
    transition: background var(--t-fast);
}

/* ---------- Hero Section ---------- */
.hero-section {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 50%, #2563eb 100%);
    color: white;
    padding: 5rem 0;
    margin-bottom: 3rem;
}

/* Animated gradient blobs */
.hero-section::before,
.hero-section::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    opacity: 0.18;
    animation: heroFloat 8s ease-in-out infinite;
    pointer-events: none;
}
.hero-section::before {
    width: 600px; height: 600px;
    background: radial-gradient(circle, #60a5fa, transparent 70%);
    top: -200px; right: -150px;
    animation-delay: 0s;
}
.hero-section::after {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #a78bfa, transparent 70%);
    bottom: -150px; left: -100px;
    animation-delay: 4s;
}

@keyframes heroFloat {
    0%,100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(30px, -20px) scale(1.05); }
}

/* Grid-dot overlay */
.hero-section .hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(rgba(255,255,255,0.07) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
}

.hero-content { position: relative; z-index: 1; }

.hero-content h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -1px;
    line-height: 1.15;
    animation: fadeUp 0.7s var(--t-base) both;
}
.hero-content p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 560px;
    margin: 0 auto 1.75rem;
    animation: fadeUp 0.7s 0.15s var(--t-base) both;
}
.hero-cta {
    animation: fadeUp 0.7s 0.3s var(--t-base) both;
}
.hero-cta .btn {
    padding: 0.75rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.hero-cta .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

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

/* ---------- Section Headers ---------- */
.section-header {
    margin: 3rem 0 2rem;
    padding-bottom: 1rem;
}
.section-header h2 {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}
.section-header h2::after {
    content: '';
    display: block;
    height: 4px;
    width: 50px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    margin-top: 0.6rem;
}
/* Keep the after on a new line */
.section-header h2 {
    display: block;
}

/* ---------- Featured Article Card ---------- */
.featured-card {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,0.1);
    transition: transform var(--t-base), box-shadow var(--t-base);
    background: var(--surface);
}
.featured-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
}
.featured-card .img-wrapper {
    position: relative;
    overflow: hidden;
    height: 420px;
}
.featured-card .img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.featured-card:hover .img-wrapper img { transform: scale(1.04); }

/* Gradient overlay on image */
.featured-card .img-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, transparent 60%, rgba(15,23,42,0.15));
    pointer-events: none;
}

.featured-badge {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
    animation: pulse-badge 2.5s ease-in-out infinite;
}
@keyframes pulse-badge {
    0%,100% { box-shadow: 0 0 0 0 rgba(37,99,235,0.4); }
    50%      { box-shadow: 0 0 0 8px rgba(37,99,235,0); }
}

/* ---------- Article Cards ---------- */
.article-card {
    border: none;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.07);
    transition: transform var(--t-base), box-shadow var(--t-base);
    height: 100%;
    background: var(--surface);
    position: relative;
}
/* Coloured top accent bar, revealed on hover */
.article-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--t-base);
    z-index: 1;
}
.article-card:hover::before { transform: scaleX(1); }
.article-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.13);
}

/* Image zoom on hover */
.article-card .img-wrapper {
    overflow: hidden;
    height: 220px;
    position: relative;
}
.article-card .img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.45s ease;
}
.article-card:hover .img-wrapper img { transform: scale(1.06); }

/* Read-time badge overlaid on image */
.read-time-badge {
    position: absolute;
    bottom: 0.6rem;
    right: 0.6rem;
    background: rgba(15,23,42,0.75);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.2rem 0.55rem;
    border-radius: 50px;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.article-category {
    background: var(--accent);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 0.5rem;
}
.article-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}
.article-excerpt {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}
.article-meta {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.read-more {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.75rem;
    transition: gap var(--t-fast), color var(--t-fast);
}
.read-more:hover { color: var(--primary-dark); gap: 0.6rem; }

/* ---------- Footer ---------- */
footer {
    background: var(--dark-bg);
    color: rgba(255,255,255,0.75);
    padding: 3.5rem 0 1.25rem;
    margin-top: 5rem;
}
footer h5 {
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 1.25rem;
    letter-spacing: 0.02em;
}
footer p { font-size: 0.9rem; line-height: 1.7; }
footer a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--t-fast);
}
footer a:hover { color: var(--accent); }
footer ul.list-unstyled li { margin-bottom: 0.5rem; }
footer hr { border-color: rgba(255,255,255,0.08); margin: 2rem 0 1.25rem; }
.footer-copy { font-size: 0.85rem; color: rgba(255,255,255,0.45); }

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
    color: rgba(255,255,255,0.7);
    margin-right: 0.4rem;
    transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.social-links a:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-2px);
}

/* ---------- Cookie Banner ---------- */
.cookie-banner {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #1e293b;
    color: #f1f5f9;
    padding: 1rem 1.5rem;
    z-index: 9998;
    border-top: 3px solid var(--accent);
}
.cookie-banner__inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}
.cookie-banner p { margin: 0; flex: 1; min-width: 200px; font-size: 0.92rem; }
.cookie-banner a { color: var(--accent); }
.cookie-banner__actions { display: flex; gap: 0.75rem; flex-shrink: 0; }
.cookie-btn-accept {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--t-fast);
}
.cookie-btn-accept:hover { background: var(--primary-dark); }
.cookie-btn-decline {
    background: transparent;
    color: #94a3b8;
    border: 1px solid #475569;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--t-fast), color var(--t-fast);
}
.cookie-btn-decline:hover { border-color: #94a3b8; color: #f1f5f9; }

/* ---------- Table of Contents (article pages) ---------- */
.toc-sidebar {
    position: sticky;
    top: 80px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    font-size: 0.88rem;
}
.toc-sidebar h4 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.85rem;
}
.toc-sidebar ol {
    list-style: none;
    padding: 0; margin: 0;
    counter-reset: toc;
}
.toc-sidebar li { counter-increment: toc; margin-bottom: 0.5rem; }
.toc-sidebar li a {
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    transition: color var(--t-fast);
    line-height: 1.4;
}
.toc-sidebar li a::before {
    content: counter(toc, decimal-leading-zero);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 22px;
}
.toc-sidebar li a:hover,
.toc-sidebar li a.toc-active { color: var(--primary); }

/* ---------- Shared Navbar JS (added via attribute selector) ---------- */
/* Utility: visually hide but keep accessible */
.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;
}
