/* CSS Updated: 2025-12-19 11:15 - Button Size Fix */
:root {
    color-scheme: light;
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'Plus Jakarta Sans', 'Inter', sans-serif;
    /* Premium heading font if available, fallback to Inter */

    /* HSL Color System */
    --hue-primary: 225;
    --hue-secondary: 260;
    --hue-accent: 330;

    /* Light Theme */
    --bg-page: #f1f5f9;
    /* Slightly darker slate base */
    --bg-card: rgba(255, 255, 255, 0.4);
    /* More transparent */
    --bg-glass: rgba(255, 255, 255, 0.3);

    --text-main: #0f172a;
    --text-muted: #475569;
    --text-light: #94a3b8;

    --primary: hsl(var(--hue-primary), 80%, 50%);
    --primary-glow: hsla(var(--hue-primary), 80%, 50%, 0.15);

    --card-border: rgba(255, 255, 255, 0.6);
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

    --link: hsl(var(--hue-primary), 70%, 45%);
    --link-hover: hsl(var(--hue-primary), 80%, 40%);

    --article-width: min(920px, 94vw);

    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

/* Dark Theme Variables */
.theme-dark {
    --bg-page: #020617;
    /* Deep slate/black */
    --bg-card: rgba(30, 41, 59, 0.6);
    --bg-glass: rgba(15, 23, 42, 0.6);

    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-light: #64748b;

    --card-border: rgba(255, 255, 255, 0.08);
    /* Faint border for dark mode */
    --card-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);

    --link: hsl(var(--hue-primary), 90%, 75%);
    --link-hover: hsl(var(--hue-primary), 90%, 85%);
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Richer, visible mesh gradient background */
    background-image:
        radial-gradient(at 0% 0%, hsla(225, 85%, 82%, 0.7) 0px, transparent 55%),
        radial-gradient(at 100% 0%, hsla(260, 85%, 82%, 0.6) 0px, transparent 55%),
        radial-gradient(at 0% 60%, hsla(330, 85%, 88%, 0.5) 0px, transparent 55%),
        radial-gradient(at 80% 80%, hsla(180, 80%, 85%, 0.5) 0px, transparent 55%);
    background-attachment: fixed;
}

.theme-dark body {
    /* Deeper, more glowing dark mode background */
    background-image:
        radial-gradient(circle at 10% 10%, rgba(56, 189, 248, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 50% 90%, rgba(236, 72, 153, 0.1) 0%, transparent 40%);
}

a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 1.5rem;
    max-width: 1100px;
}

/* Large Screen Extensions */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

@media (min-width: 1800px) {
    .container {
        max-width: 1600px;
    }
}

/* Utility */
.hidden {
    display: none !important;
}

/* ------------------
   HERO SECTION
   ------------------ */
.hero {
    position: relative;
    padding: 6rem 0 4rem;
    overflow: hidden;
}

.hero--landing {
    padding-bottom: 5rem;
}

.hero--compact {
    padding: 6rem 0 4rem;
}

.hero .article-hero-title {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    line-height: 1.3;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.hero--compact .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    align-items: center;
}

.hero--compact .meta li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.hero--compact .meta li:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 12px;
    background: rgba(0, 0, 0, 0.1);
}

.theme-dark .hero--compact .meta li:not(:last-child)::after {
    background: rgba(255, 255, 255, 0.1);
}

.hero--compact .meta a {
    color: var(--link);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
}

.hero--compact .meta a:hover {
    border-bottom-color: var(--link);

    /* Dynamic Gradient Background for Hero */
    .hero::before {
        content: '';
        position: absolute;
        top: -20%;
        left: -10%;
        width: 120%;
        height: 140%;
        background:
            conic-gradient(from 180deg at 50% 50%, #dbeafe 0deg, #e0e7ff 120deg, #f3e8ff 240deg, #dbeafe 360deg);
        filter: blur(80px);
        opacity: 0.6;
        z-index: -1;
        transform: translateZ(0);
        /* Hardware accelerate */
    }

    .theme-dark .hero::before {
        background:
            conic-gradient(from 180deg at 50% 50%, #172554 0deg, #1e1b4b 120deg, #312e81 240deg, #172554 360deg);
        opacity: 0.5;
    }
}

.hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 3rem;
    align-items: center;
}

.hero-copy {
    z-index: 2;
}

.eyebrow {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--link);
    margin-bottom: 0.75rem;
    display: inline-block;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.theme-dark .eyebrow {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin: 0 0 1.2rem;
    background: linear-gradient(135deg, var(--text-main) 30%, var(--text-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.hero .subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 580px;
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* Hero Actions */
.hero-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.primary-link,
.ghost-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 99px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.primary-link {
    background: linear-gradient(135deg, hsl(230, 85%, 60%), hsl(260, 85%, 60%));
    color: white;
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4);
    border: none;
}

.primary-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(79, 70, 229, 0.5);
    color: white;
    text-decoration: none;
}

.ghost-link {
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-main);
    border: 1px solid rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(4px);
}

.theme-dark .ghost-link {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.1);
}

.ghost-link:hover {
    background: rgba(255, 255, 255, 0.7);
    color: var(--link);
    text-decoration: none;
    transform: translateY(-1px);
}

.theme-dark .ghost-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Pills */
.hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.pill {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--text-muted);
}

.theme-dark .pill {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}

/* Domain Colors */
.pill--physics {
    background: hsla(230, 85%, 96%, 0.6);
    color: hsl(230, 70%, 50%);
    border-color: hsla(230, 85%, 85%, 0.8);
}

.pill--math {
    background: hsla(260, 85%, 96%, 0.6);
    color: hsl(260, 70%, 50%);
    border-color: hsla(260, 85%, 85%, 0.8);
}

.pill--cs {
    background: hsla(330, 85%, 96%, 0.6);
    color: hsl(330, 70%, 50%);
    border-color: hsla(330, 85%, 85%, 0.8);
}

.pill--q-bio {
    background: hsla(150, 85%, 96%, 0.6);
    color: hsl(150, 70%, 40%);
    border-color: hsla(150, 85%, 85%, 0.8);
}

.pill--econ {
    background: hsla(30, 85%, 96%, 0.6);
    color: hsl(30, 85%, 45%);
    border-color: hsla(30, 85%, 85%, 0.8);
}

.pill--astro-ph {
    background: hsla(280, 85%, 96%, 0.6);
    color: hsl(280, 70%, 50%);
    border-color: hsla(280, 85%, 85%, 0.8);
}

/* Dark Mode Domain Colors */
.theme-dark .pill--physics {
    background: hsla(230, 85%, 15%, 0.4);
    color: hsl(230, 90%, 80%);
    border-color: hsla(230, 50%, 30%, 0.5);
}

.theme-dark .pill--math {
    background: hsla(260, 85%, 15%, 0.4);
    color: hsl(260, 90%, 80%);
    border-color: hsla(260, 50%, 30%, 0.5);
}

.theme-dark .pill--cs {
    background: hsla(330, 85%, 15%, 0.4);
    color: hsl(330, 90%, 80%);
    border-color: hsla(330, 50%, 30%, 0.5);
}

.theme-dark .pill--q-bio {
    background: hsla(150, 85%, 15%, 0.4);
    color: hsl(150, 90%, 80%);
    border-color: hsla(150, 50%, 30%, 0.5);
}

.theme-dark .pill--econ {
    background: hsla(30, 85%, 15%, 0.4);
    color: hsl(30, 90%, 80%);
    border-color: hsla(30, 50%, 30%, 0.5);
}

.theme-dark .pill--astro-ph {
    background: hsla(280, 85%, 15%, 0.4);
    color: hsl(280, 90%, 80%);
    border-color: hsla(280, 50%, 30%, 0.5);
}

/* Active State Overrides for colored pills */
.pill.pill--active.pill--physics {
    background: hsl(230, 70%, 55%);
    color: white;
    border-color: hsl(230, 70%, 55%);
}

.pill.pill--active.pill--math {
    background: hsl(260, 70%, 55%);
    color: white;
    border-color: hsl(260, 70%, 55%);
}

.pill.pill--active.pill--cs {
    background: hsl(330, 70%, 55%);
    color: white;
    border-color: hsl(330, 70%, 55%);
}

.pill.pill--active.pill--q-bio {
    background: hsl(150, 70%, 45%);
    color: white;
    border-color: hsl(150, 70%, 45%);
}

.pill.pill--active.pill--econ {
    background: hsl(30, 80%, 55%);
    color: white;
    border-color: hsl(30, 80%, 55%);
}

.pill.pill--active.pill--astro-ph {
    background: hsl(280, 70%, 55%);
    color: white;
    border-color: hsl(280, 70%, 55%);
}

/* Hero Card - Glassmorphism */
.hero-card {
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    transition: transform 0.4s ease;
}

.theme-dark .hero-card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.hero-card:hover {
    transform: translateY(-5px) scale(1.01);
}

.hero-card h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    /* Reduced from 1.5rem */
    margin: 0.5rem 0 1rem;
}

.hero-card-copy {
    color: var(--text-muted);
    font-size: 1.1rem;
    /* Increased from 1rem */
    margin-bottom: 1.5rem;
    display: block;
    overflow: visible;
    -webkit-line-clamp: none;
    line-clamp: none;
    /* Ensure full text is shown */
}

/* ------------------
   MAIN CONTENT
   ------------------ */
.toolbar {
    margin: 2rem 0;
}

.search-bar {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 6px;
    border-radius: 18px;
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
}

.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-main);
}

.search-bar input:focus {
    outline: none;
}

.search-bar button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0 1.5rem;
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.search-bar button:hover {
    background: var(--link-hover);
}

.search-bar .search-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.25rem;
    border-radius: 14px;
    font-weight: 600;
    border: 1px solid var(--card-border);
    color: var(--text-main);
    background: transparent;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.search-bar .search-clear:hover {
    background: rgba(255, 255, 255, 0.6);
    color: var(--link);
    text-decoration: none;
}

.theme-dark .search-bar .search-clear:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Category Filter */
.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.category-filter a {
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.category-filter a:hover {
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-main);
    text-decoration: none;
}

.category-filter a.active {
    background: var(--text-main);
    color: var(--bg-page);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.theme-dark .category-filter a.active {
    background: #f1f5f9;
    color: #0f172a;
}

/* Article Grid */
.article-list h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.article-card {
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(8px);
}

.article-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.article-card .thumb {
    height: 180px;
    background: #cbd5e1;
    position: relative;
    overflow: hidden;
}

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

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

.article-card .body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.article-card .meta {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.8rem;
    display: flex;
    justify-content: space-between;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.article-card .category {
    color: var(--link);
}

.article-card h3 {
    margin: 0 0 0.8rem;
    font-size: 1.15rem;
    /* Reduced to 1.15rem per request */
    line-height: 1.4;
    font-family: var(--font-heading);
}

.article-card h3 a {
    color: var(--text-main);
    background: linear-gradient(to right, var(--link), var(--link)) 0 100% / 0% 2px no-repeat;
    transition: background-size 0.3s;
    padding-bottom: 2px;
}

.article-card:hover h3 a {
    background-size: 100% 2px;
    text-decoration: none;
    color: var(--link);
}

.article-card .summary {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
    display: block;
    /* Removed flex/webkit-box to disable clamp */
    overflow: visible;
    /* Show full text */
    /* Removed line-clamp */
}

.article-card .tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
    list-style: none;
    padding: 0;
}

.article-card .tags li {
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.03);
    padding: 4px 8px;
    border-radius: 6px;
    color: var(--text-muted);
}

.theme-dark .article-card .tags li {
    background: rgba(255, 255, 255, 0.05);
}

.read-more {
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: auto;
    display: block;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 4rem 0;
}

.pagination a {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    font-weight: 600;
}

.pagination a:hover:not(.disabled) {
    background: white;
    color: var(--link);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    text-decoration: none;
}

.pagination a.active {
    background: var(--link);
    color: white;
    border-color: var(--link);
}

.pagination .arrow {
    width: auto;
    padding: 0 1.2rem;
}

/* ------------------
   ARTICLE DETAIL
   ------------------ */
.article-detail {
    background: rgba(255, 255, 255, 0.95);
    /* Opaque for readability */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 3rem;
    margin: 2rem auto;
    max-width: var(--article-width);
    box-shadow: var(--card-shadow);
}

.theme-dark .article-detail {
    background: rgba(30, 41, 59, 0.95);
}

.article-detail .hero-image {
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 2.5rem;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
}

.article-detail .content {
    font-size: 1.1rem;
    line-height: 1.8;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.article-detail .content img,
.article-detail .content video,
.article-detail .content iframe {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 12px;
    margin: 1rem 0;
}

mjx-container {
    overflow-x: auto;
    max-width: 100%;
}

.article-detail .content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.article-detail .content pre {
    white-space: pre-wrap;
    /* Wrap code if preferred, or use overflow-x */
    overflow-x: auto;
    max-width: 100%;
    border-radius: var(--radius-sm);
}

.article-detail .content h1 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    margin-top: 2.5rem;
    color: var(--text-main);
    line-height: 1.3;
}

.article-detail .content h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-top: 2rem;
    color: var(--text-main);
    line-height: 1.4;
}

.article-detail .content h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-top: 1.5rem;
    color: var(--text-main);
    line-height: 1.5;
}

.article-detail .content p {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    /* Softer reading black */
}

.theme-dark .article-detail .content p {
    color: #cbd5e1;
}

/* ------------------
   HOTSPOTS / ARCHIVE
   ------------------ */
.hotspot-hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}

.hotspot-hero-panel {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    color: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px -10px rgba(15, 23, 42, 0.4);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    height: fit-content;
    width: 100%;
    margin: 0;
}

.hotspot-hero-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hotspot-hero-panel-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.panel-toggle-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    transform: rotate(180deg);
    /* Expanded state (up arrow effectively if we use a triangle) or just rotated */
}

/* Collapsed State */
.hotspot-hero-panel.collapsed .hotspot-hero-panel-content {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.hotspot-hero-panel.collapsed .panel-toggle-icon {
    transform: rotate(0deg);
}

.hotspot-hero-panel-content {
    transition: max-height 0.4s cubic-bezier(0, 1, 0, 1), opacity 0.4s ease, margin-top 0.4s ease;
    max-height: 1500px;
    /* Arbitrary large height */
    opacity: 1;
    overflow: hidden;
    margin-top: 1.5rem;
}

.hotspot-hero-panel::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(45deg, transparent 40%, rgba(255, 255, 255, 0.05) 50%, transparent 60%);
    pointer-events: none;
}

/* --- Hotspot Cards (Premium Redesign) --- */


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

.hotspot-card-portal {
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.2s ease;
    height: 100%;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.hotspot-card-portal:hover,
.hotspot-card-portal.active {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.theme-dark .hotspot-card-portal {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.08);
}

.hotspot-card-portal .meta {
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.hotspot-card-portal .meta span:not(:last-child)::after {
    content: "•";
    margin-left: 10px;
    opacity: 0.5;
}

.hotspot-card-portal h4 {
    margin: 0 0 12px;
    font-size: 1.15rem;
    line-height: 1.4;
    font-family: var(--font-heading);
}

.hotspot-card-portal h4 a {
    color: var(--text-main);
    text-decoration: none;
    background: linear-gradient(to right, var(--link), var(--link)) 0 100% / 0% 2px no-repeat;
    transition: background-size 0.3s;
    padding-bottom: 2px;
}

.hotspot-card-portal:hover h4 a,
.hotspot-card-portal.active h4 a {
    background-size: 100% 2px;
    color: var(--link);
}

.hotspot-summary {
    font-size: 1.05rem !important;
    /* Reduced to ~17px, smaller than title */
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
    /* Pushes footer down */
    overflow-x: auto;
    overflow-y: hidden;
    /* Ensure long formulas/words wrap */
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Custom scrollbar for summary horizontal scroll */
.hotspot-summary::-webkit-scrollbar {
    height: 6px;
    /* Horizontal scrollbar height */
}

.hotspot-summary::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.hotspot-summary::-webkit-scrollbar-thumb {
    background-color: #2563eb;
    /* Blue */
    border-radius: 4px;
}

/* Dark mode adjustment */
.theme-dark .hotspot-summary::-webkit-scrollbar-thumb {
    background-color: #3b82f6;
    /* Lighter blue */
}

mjx-container {
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
}

/* Apply to MathJax container directly */
mjx-container::-webkit-scrollbar {
    height: 6px;
}

mjx-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

mjx-container::-webkit-scrollbar-thumb {
    background-color: #2563eb;
    border-radius: 4px;
}

.theme-dark mjx-container::-webkit-scrollbar-thumb {
    background-color: #3b82f6;
}

.hotspot-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.hotspot-tags span {
    background: rgba(37, 99, 235, 0.08);
    color: var(--link);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.theme-dark .hotspot-tags span {
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
}

.hotspot-footer {
    border-top: 1px solid var(--card-border);
    padding-top: 20px;
    margin-top: auto;
}

.hotspot-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.hotspot-preview-btn,
.hotspot-actions .ghost-link {
    width: 100% !important;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px 16px !important;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #e2e8f0;
    /* Visible border */
    box-shadow: none;
}

.hotspot-preview-btn {
    display: inline-flex;
    align-items: center;
    line-height: 1.6;
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    border: 1px solid transparent;
    /* Match size with ghost-link */
}

.hotspot-preview-btn:hover {
    background: var(--link-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.4);
}

.hotspot-actions .ghost-link {
    background: rgba(37, 99, 235, 0.1);
    color: var(--link);
    border: 1px solid rgba(37, 99, 235, 0.3);
    /* Align sizing */
}

.theme-dark .hotspot-actions .ghost-link {
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
}

.hotspot-actions .ghost-link:hover {
    background: rgba(37, 99, 235, 0.2);
    text-decoration: none;
    transform: translateY(-2px);
}

.hotspot-score {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}


/* Calendar / Archive */
.calendar {
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--glass-shadow);
}

.calendar-cell {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    height: 80px;
    transition: all 0.2s;
}

.calendar-cell:hover {
    background: white;
    transform: scale(1.05);
    z-index: 2;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.theme-dark .calendar-cell {
    background: rgba(255, 255, 255, 0.15);
    /* Increased contrast */
    border-color: rgba(255, 255, 255, 0.2);
}

.theme-dark .calendar-cell:hover {
    background: rgba(255, 255, 255, 0.25);
}

.calendar-cell--today {
    border: 2px solid var(--primary) !important;
    position: relative;
}

.calendar-cell--active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(147, 197, 253, 0.2));
    border-color: var(--primary);
}

/* ------------------
   FLOATING ELEMENTS
   ------------------ */
.theme-toggle-icon,
.lang-toggle {
    position: fixed;
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s;
    font-size: 1.2rem;
    color: var(--text-main);
}

.theme-toggle-icon {
    top: 2rem;
}

.lang-toggle {
    top: calc(2rem + 60px);
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 12px;
}

.theme-toggle-icon:hover,
.lang-toggle:hover {
    transform: rotate(15deg) scale(1.1);
}

.theme-dark .theme-toggle-icon,
.theme-dark .lang-toggle {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Footer */
.footer {
    padding: 3rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: auto;
    border-top: 1px solid var(--card-border);
}

/* Reuse existing functional classes for safety */
.hotspot-preview-float {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    /* Optimized for reading: 650px allows ~70-80 chars per line, better than 800px */
    width: min(650px, 90vw);
    /* Wider desktop modal */
    max-height: 90vh;
    /* Taller */
    background: #ffffff;
    /* Solid white for clear layering */
    /* backdrop-filter: blur(24px); Removing blur for solid look */
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    /* Stronger shadow */
    padding: 1.5rem;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hotspot-preview-scroll {
    overflow-y: auto;
    flex: 1;
    /* Take remaining height */
    /* Space for scrollbar */
    min-height: 0;
    /* Important for flex child scrolling */
    overscroll-behavior: contain;
    /* Prevent scroll chaining */
}

/* Custom validation style for scrollbar */
.hotspot-preview-scroll::-webkit-scrollbar {
    width: 6px;
}

.hotspot-preview-scroll::-webkit-scrollbar-thumb {
    background-color: #2563eb !important;
    /* Explicit blue */
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hotspot-preview-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.theme-dark .hotspot-preview-scroll::-webkit-scrollbar-thumb {
    background-color: #3b82f6 !important;
    /* Lighter blue for dark mode */
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.theme-dark .hotspot-preview-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.hotspot-preview-content {
    background: #f1f5f9;
    /* Slate 100 for inner contrast */
    /* Distinct light background */
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    padding: 1.5rem;
    /* More padding for desktop */
    font-size: 1rem !important;
    /* Force large size 20px */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.theme-dark .hotspot-preview-content {
    background: rgba(15, 23, 42, 0.5);
    /* Darker background for contrast */
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Table of Contents sidebar */
.article-toc {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    padding: 1.5rem;
    position: fixed;
    right: 20px;
    top: 100px;
    width: 280px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    z-index: 40;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.article-toc.is-open {
    transform: translateX(0);
}

.article-toc-toggle {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 0.5rem;
    border-radius: 12px 0 0 12px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 50;
}

/* AI Digest Card */
.hotspot-digest {
    /* Light Mode Default */
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
    /* Separate from buttons */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.hotspot-duo {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    align-items: start;
    margin: 1.5rem 0 2rem;
}

.hotspot-duo .hotspot-digest {
    margin: 0;
}

@media (max-width: 960px) {
    .hotspot-duo {
        grid-template-columns: 1fr;
        margin: 1.2rem 0 1.6rem;
    }
}

.hotspot-digest summary {
    list-style: none;
}

.hotspot-digest summary::-webkit-details-marker {
    display: none;
}

.hotspot-digest-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    min-height: 32px;
}

.hotspot-digest-summary .eyebrow {
    margin-bottom: 0;
    font-size: 1rem;
    padding: 0.45rem 1rem;
}

.hotspot-digest-toggle {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
    position: relative;
    padding-right: 16px;
}

.hotspot-digest-toggle::after {
    content: attr(data-close);
}

.hotspot-digest[open] .hotspot-digest-toggle::after {
    content: attr(data-open);
}

.hotspot-digest-toggle::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-60%) rotate(45deg);
    transition: transform 0.2s ease;
}

.hotspot-digest[open] .hotspot-digest-toggle::before {
    transform: translateY(-40%) rotate(-135deg);
}

.theme-dark .hotspot-digest {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.hotspot-digest:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    border-color: rgba(255, 255, 255, 0.9);
}

.theme-dark .hotspot-digest:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.hotspot-digest .eyebrow {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.4rem 1rem;
    border-radius: 99px;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.hotspot-digest .eyebrow::before {
    content: '✨';
    margin-right: 6px;
    font-size: 1rem;
}

.hotspot-digest p:not(.eyebrow) {
    font-size: 1.05rem;
    line-height: 1.7;
    margin: 0;
    color: var(--text-main);
    /* Dark text for light mode */
}

.theme-dark .hotspot-digest p:not(.eyebrow) {
    color: rgba(255, 255, 255, 0.9);
}

.hotspot-digest-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.hotspot-digest-item {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.theme-dark .hotspot-digest-item {
    background: rgba(15, 23, 42, 0.45);
    border-color: rgba(148, 163, 184, 0.2);
}

.hotspot-digest-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

.hotspot-digest-head h4 {
    margin: 0;
    font-size: 1rem;
}

.hotspot-digest-meta {
    display: flex;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.hotspot-digest-body p {
    margin: 0 0 0.5rem;
}

.hotspot-digest-body ul {
    margin: 0;
    padding-left: 1.1rem;
}

.hotspot-digest-note {
    margin-top: 1.2rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 768px) {

    /* Base Typography adjustments */
    .hero h1 {
        font-size: 2rem;
        /* reduced from 2.5rem */
    }

    .hero .subtitle {
        font-size: 1rem;
    }

    /* Tighter Hero Spacing */
    .hero {
        padding: 4rem 0 2rem;
    }

    .container {
        padding: 0 0.5rem;
        /* Reduce global container padding on mobile */
    }

    .hero-grid,
    .hotspot-hero-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.8rem;
    }

    .primary-link,
    .ghost-link {
        width: 100%;
    }

    .hero-pills {
        margin-bottom: 1rem;
    }

    /* Hotspot Cards */
    .hotspot-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 1.5rem;
    }

    .hotspot-card-portal {
        padding: 1rem;
    }

    .hotspot-card-portal h4 {
        font-size: 1.1rem;
    }

    /* Floating Elements Repositioning */
    .theme-toggle-icon {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .lang-toggle {
        top: 1rem;
        right: 4rem;
        /* Next to theme toggle */
        font-size: 0.8rem;
    }

    .hotspot-preview-fab {
        bottom: 1.5rem;
        right: 1.5rem;
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    /* Adjust Hotspot Hero Panel */
    .hotspot-hero-panel {
        padding: 12px 16px;
        margin-top: 4px;
    }

    .hotspot-hero-panel-header h3 {
        font-size: 1rem;
    }

    .panel-toggle-icon {
        font-size: 1rem;
    }

    /* General Layout */
    /* General Layout */
    .article-detail {
        padding: 1.5rem;
        /* Restore padding inside card */
        margin: 0;
        width: 100%;
        /* background: transparent; Removed to keep solid card on mobile */
        /* box-shadow: none; */
        /* border: none; */
        border-radius: var(--radius-md);
        /* Slightly smaller radius for mobile */
    }
}

.search-bar {
    flex-direction: column;
    padding: 10px;
}

.search-bar button {
    width: 100%;
    padding: 0.8rem;
    margin-top: 0.5rem;
}

/* Hotspot Heading specific */
.hotspot-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

/* Move TOC Toggle to bottom right on mobile */
.article-toc-toggle {
    top: auto;
    bottom: 5rem;
    /* Above other potential floating buttons */
    right: 1.5rem;
    transform: none;
    border-radius: 99px;
    padding: 10px 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.article-toc-toggle svg {
    margin-right: 4px;
    /* Ensure icon spacing if text is present */
}

/* Mobile Calendar Nav - Compact Row */
.month-switcher {
    justify-content: center;
    /* Center them close together */
    width: 100%;
    gap: 16px;
    /* Explicit gap between arrows and title */
    margin-top: 0.5rem;
    /* Add some breathing room */
}

/* Force override any generic mobile link styles */
.month-switcher a.ghost-link {
    font-size: 0 !important;
    /* Backup hiding */
    color: transparent !important;
    /* Primary hiding */
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    margin: 0 !important;
    flex: 0 0 44px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    /* Anchor for pseudo-element */
    overflow: hidden;
}

/* First line trick to ensure text is goners */
.month-switcher a.ghost-link::first-line {
    color: transparent !important;
    font-size: 0 !important;
}

.month-switcher a.ghost-link::before {
    font-size: 1.4rem !important;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    display: block;
    position: absolute;
    /* Force centering ignoring text */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Previous Button Icon */
.month-switcher a.ghost-link:first-child::before {
    content: "←";
}

/* Next Button Icon */
.month-switcher a.ghost-link:last-child::before {
    content: "→";
}

.theme-dark .month-switcher a.ghost-link {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.month-title {
    font-size: 1rem;
    white-space: nowrap;
    flex: 1;
    text-align: center;
    margin: 0 8px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
}



/* Mobile Preview Panel Centering & Polish */
/* Mobile Preview Panel Centering & Polish */
.hotspot-preview-float {
    left: 50%;
    right: auto;
    bottom: 2rem;
    transform: translateX(-50%);
    width: min(92vw, 840px);
    max-height: 85vh;
    /* Increased from 70vh */

    /* Outer Glass Container - More Translucent for Depth */
    background: rgba(255, 255, 255, 0.65);
    /* More see-through */
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    box-shadow:
        0 30px 60px -10px rgba(0, 0, 0, 0.3),
        /* Deep shadow */
        0 0 0 1px rgba(255, 255, 255, 0.4) inset;
    /* Glass border dialled back */

    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    /* Slightly tighter padding */
    border-radius: 20px;
}



/* Inner Content - Distinct Layer */
.hotspot-preview-content {
    background: #f1f5f9 !important;
    /* Lighter background (Slate 50) */
    /* Slate 200 for distinct cool-gray contrast */
    border: 1px solid rgba(0, 0, 0, 0.04) !important;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
    padding: 1rem !important;
    margin-top: 0.5rem;
    font-size: 1rem !important;
    /* Reduced from 1.25rem to 1rem */
    /* Force readable text on mobile */
}

/* Force list items to match */
.hotspot-preview-content li {
    font-size: 1rem !important;
}

/* Header styling for mobile */
.hotspot-preview-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: 0.8rem;
    padding-bottom: 0.8rem;
}

/* Force visible scrollbar on mobile */
.hotspot-preview-scroll::-webkit-scrollbar {
    width: 6px;
    display: block !important;
    /* Force display on mobile */
    background: rgba(0, 0, 0, 0.05);
}

.hotspot-preview-scroll::-webkit-scrollbar-thumb {
    background-color: #2563eb !important;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.theme-dark .hotspot-preview-scroll::-webkit-scrollbar-thumb {
    background-color: #3b82f6 !important;
}

.theme-dark .hotspot-preview-float {
    background: rgba(15, 23, 42, 0.7);
    box-shadow:
        0 30px 60px -10px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.theme-dark .hotspot-preview-content {
    background: rgba(30, 41, 59, 1) !important;
    /* Solid dark card */
    border-color: rgba(255, 255, 255, 0.05) !important;
}


/* =========================================
   RESTORED COMPONENT STYLES
   (Adapted to new Design System)
   ========================================= */

/* --- Hotspot Preview & Floating Elements --- */
.hotspot-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.8rem;
    margin-bottom: 0.8rem;
}

.hotspot-preview-title {
    margin: 0;
    font-weight: 700;
    color: var(--text-main);
    font-size: 1.1rem;
}

.hotspot-preview-actions button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.hotspot-preview-actions button:hover {
    background: var(--link-hover);
}

.hotspot-preview-fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: var(--primary);
    color: white;
    padding: 12px 20px;
    border-radius: 99px;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
    font-weight: 700;
    cursor: pointer;
    z-index: 49;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s;
}

.hotspot-preview-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(37, 99, 235, 0.5);
}

.hotspot-preview-fab.hidden,
.hotspot-preview-float.hidden,
.hotspot-preview-error.hidden,
.hotspot-preview-default.hidden,
.hotspot-preview-skeleton.hidden {
    display: none !important;
}

.hotspot-preview-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

/* Skeleton Loader */
.skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, var(--bg-page), var(--bg-card), var(--bg-page));
    background-size: 200% 100%;
    border-radius: 4px;
    animation: shimmer 1.5s infinite;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 18px;
    width: 70%;
    margin-bottom: 12px;
}

@keyframes shimmer {
    0% {
        background-position: -120% 0;
    }

    100% {
        background-position: 120% 0;
    }
}

/* --- Archive / Calendar --- */
.archive-meta-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s;
}

.theme-dark .archive-meta-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.7));
}

.theme-dark .archive-meta-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.7));
}

.meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.meta-stat {
    background: var(--primary-glow);
    padding: 8px 16px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-dark .meta-stat {
    background: rgba(255, 255, 255, 0.1);
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    display: block;
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.month-switcher {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.month-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 700;
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.day-number {
    font-weight: 700;
    font-size: 1.1rem;
    display: block;
}

.day-count {
    font-size: 0.8rem;
    color: var(--text-light);
}

.theme-dark .day-count {
    color: rgba(255, 255, 255, 0.7);
    /* Improved visibility for dark mode */
}

.day-today-label {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.65rem;
    background: var(--primary);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    line-height: 1;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-dark .day-today-label {
    background: #38bdf8;
    color: #0f172a;
}

.calendar-link {
    position: relative;
    /* Needed for absolute positioning of label */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    color: var(--text-main);
}

.empty-slot {
    pointer-events: none;
}

/* --- Table of Contents (Inner) --- */
.article-toc__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.article-toc__close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.article-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.article-toc-link {
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: color 0.2s;
    display: block;
    padding: 2px 0;
}

.article-toc-link:hover,
.article-toc-link.is-active {
    color: var(--primary);
    font-weight: 500;
}

.article-toc-link.level-3 {
    padding-left: 1rem;
    font-size: 0.85rem;
}

/* --- Hotspot Trend Panel --- */
.hotspot-trend-panel {
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-top: 2rem;
}

.trend-row {
    display: grid;
    grid-template-columns: 1fr 2fr 50px;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.trend-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.theme-dark .trend-bar {
    background: rgba(255, 255, 255, 0.1);
}

.trend-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--hue-accent));
    border-radius: 4px;
}

.trend-value {
    font-weight: 700;
    text-align: right;
}

/* --- Hotspot Specific Layouts --- */
.hotspot-pill-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 1.5rem;
}

/* --- Admin / Misc --- */
.admin-entry {
    font-size: 0.8rem;
    padding: 2px 8px;
    border: 1px solid var(--link);
    border-radius: 12px;
    color: var(--link);
}

/* =========================================
   HOTSPOT PREVIEW MARKDOWN STYLES
   (Restores missing formatting for AI summaries)
   ========================================= */

.hotspot-preview-heading {
    font-weight: 700;
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-main);
    line-height: 1.4;
}

.hotspot-preview-heading--h1 {
    font-size: 1.25rem;
}

.hotspot-preview-heading--h2 {
    font-size: 1.15rem;
}

.hotspot-preview-heading--h3 {
    font-size: 1.05rem;
}

.hotspot-preview-heading--h4 {
    font-size: 1rem;
}

.hotspot-preview-list {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.hotspot-preview-list li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
    color: var(--text-main);
    font-size: 1rem !important;
    /* Ensure list items scale up */
}

.hotspot-preview-line {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: var(--text-main);
}

.hotspot-preview-content strong {
    font-weight: 700;
    color: var(--primary);
    /* Highlight key terms */
}

/* Ensure these work in dark mode via variables, but explicit overrides if needed */
.theme-dark .hotspot-preview-content strong {
    color: var(--hue-secondary);
    /* Lighter accent in dark mode */
}

/* Article Info Grid (New Metadata Area) */
.article-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1.5rem 1rem;
    background: var(--bg-glass);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-top: 2rem;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.theme-dark .article-info-grid {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.info-cell {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.info-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    opacity: 0.8;
}

.info-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    word-break: break-word;
    line-height: 1.4;
}

.info-value.link {
    color: var(--link);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s;
}

.info-value.link:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Specific responsiveness for the info grid */
@media (max-width: 600px) {
    .article-info-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1.25rem 1rem;
    }
}
