:root {
    --primary: #4a448c;
    --primary-dark: #38326f;
    --primary-light: #5d57a3;
    --secondary: #f8b62d;
    --accent: #f8b62d;
    --accent-soft: rgba(248, 182, 45, 0.14);
    --bg: #EEEAF5;
    --surface: #F5F3FA;
    --surface-elevated: #FAF8FD;
    --text: #1F1A33;
    --text-muted: #5C5678;
    --border: #C5C0DC;
    --shadow: 0 4px 20px rgba(74, 68, 140, 0.12);
    --shadow-hover: 0 12px 32px rgba(74, 68, 140, 0.2);
    --radius: 16px;
    --radius-sm: 10px;
    --site-header-height: 52px;
    --dock-width: 58px;
    --mobile-dock-bar: 58px;
    --progress-height: 4px;
    --z-footer: 1001;
    --z-header: 1002;
    --z-dock: 10020;
    --z-progress: 10030;
    --z-loader: 10040;
    --z-toast: 10050;
    --z-lightbox: 100000;
    /* legacy aliases */
    --primary-color: var(--primary);
    --secondary-color: var(--secondary);
    --accent-color: var(--accent-soft);
    --light-bg: var(--bg);
    --white: var(--surface);
    --text-dark: var(--text);
    --text-light: var(--text-muted);
    --border-color: var(--border);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', 'Fredoka', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
}

.site-header,
.site-footer {
    width: 100%;
}

#header-placeholder {
    height: var(--site-header-height);
}

body[data-page="article"] #header-placeholder {
    height: calc(var(--site-header-height) + var(--progress-height));
}

.home-page,
.article-page {
    padding-left: calc(var(--dock-width) + 12px);
    padding-right: calc(var(--dock-width) + 12px);
}

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

a {
    color: var(--primary);
}

/* ========== LOADER ========== */
.loader {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: var(--z-loader);
    gap: 1rem;
    transition: opacity 0.25s ease;
}

.loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loader p {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== READING PROGRESS ========== */
.reading-progress-track {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--progress-height);
    background: linear-gradient(90deg, var(--primary-dark), var(--primary));
    z-index: var(--z-progress);
}

.reading-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--secondary);
    transition: width 0.1s linear;
    box-shadow: 0 0 6px rgba(248, 182, 45, 0.35);
}

/* ========== CTA BUTTONS ========== */
.cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.35rem;
    background: var(--secondary);
    color: var(--primary-dark);
    border: 1px solid var(--secondary);
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cta-btn:hover {
    background: #f9c24a;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.cta-btn-sm {
    padding: 0.45rem 0.95rem;
    font-size: 0.8rem;
}

.cta-btn-outline {
    background: transparent;
    color: var(--secondary);
    border-color: var(--secondary);
}

.cta-btn-outline:hover {
    background: var(--secondary);
    color: var(--primary-dark);
}

.header-actions,
.footer-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.header-actions .cta-btn-outline {
    background: transparent;
    color: var(--secondary);
    border-color: var(--secondary);
}

.header-actions .cta-btn-outline:hover {
    background: var(--secondary);
    color: var(--primary-dark);
}

/* ========== HEADER ========== */
.site-header {
    background: linear-gradient(90deg, var(--primary-dark), var(--primary));
    color: #fff;
    padding: 0.55rem 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: var(--z-header);
    border-bottom: 2px solid var(--secondary);
    box-shadow: 0 4px 16px rgba(74, 68, 140, 0.18);
}

body[data-page="article"] .site-header {
    top: var(--progress-height);
}

.header-inner {
    position: relative;
    z-index: 1;
    max-width: none;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.75rem;
    min-height: 44px;
}

.logo-link {
    grid-column: 2;
    justify-self: center;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: #fff;
    min-width: 0;
}

.logo-img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(248, 182, 45, 0.5);
}

.logo-text {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    flex-shrink: 0;
}

.header-actions-left {
    grid-column: 1;
    justify-self: start;
}

.header-actions-right,
#header-actions {
    grid-column: 3;
    justify-self: end;
}

@keyframes headerSlideInLeft {
    from {
        opacity: 0;
        transform: translateX(-14px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes headerSlideInRight {
    from {
        opacity: 0;
        transform: translateX(14px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

body[data-page="article"] .header-actions-left .cta-btn {
    animation: headerSlideInLeft 0.45s cubic-bezier(0.4, 0, 0.2, 1) both;
}

body[data-page="article"] .header-actions-right .cta-btn {
    animation: headerSlideInRight 0.45s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.footer-actions .cta-btn {
    background: rgba(248, 182, 45, 0.15);
    color: var(--secondary);
    border-color: var(--secondary);
}

.site-footer--article .footer-article-cta .footer-actions .cta-btn {
    background: var(--secondary);
    color: var(--primary-dark);
    border-color: var(--secondary);
    opacity: 1;
}

.site-footer--article .footer-article-cta .footer-actions .cta-btn:hover {
    background: #f9c24a;
    color: var(--primary-dark);
}

.site-footer--article .footer-article-cta .footer-actions .cta-btn-outline {
    background: #fff;
    color: var(--primary-dark);
    border-color: #fff;
    opacity: 1;
}

.site-footer--article .footer-article-cta .footer-actions .cta-btn-outline:hover {
    background: var(--secondary);
    color: var(--primary-dark);
    border-color: var(--secondary);
}

.footer-actions .cta-btn:hover {
    background: var(--secondary);
    color: var(--primary-dark);
}

.footer-actions .cta-btn-outline {
    background: transparent;
    color: var(--secondary);
    border-color: rgba(248, 182, 45, 0.55);
}

.article-end-cta {
    padding: 2rem 0 0.5rem;
    margin-top: 0.5rem;
}

.article-end-cta-inner {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    border: 2px solid var(--secondary);
    border-radius: var(--radius);
    padding: 1.75rem 1.5rem;
    text-align: center;
}

.article-cta-text {
    color: rgba(255, 255, 255, 0.92);
    font-size: 1rem;
    margin-bottom: 1.1rem;
    line-height: 1.6;
}

.article-cta-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.article-end-cta .cta-btn-outline {
    background: transparent;
    color: var(--secondary);
    border-color: var(--secondary);
}

.article-end-cta .cta-btn-outline:hover {
    background: var(--secondary);
    color: var(--primary-dark);
}

/* ========== HOMEPAGE ========== */
.home-page {
    max-width: none;
    width: 100%;
}

.home-hero {
    position: relative;
    width: 100%;
    min-height: clamp(480px, 68vh, 700px);
    display: flex;
    align-items: stretch;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface-elevated) 0%, var(--bg) 100%);
}

.home-hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 50% at 10% 0%, rgba(248, 182, 45, 0.1), transparent 55%),
        radial-gradient(ellipse 60% 40% at 90% 100%, rgba(0, 0, 0, 0.04), transparent 50%);
    z-index: 0;
}

.home-hero-bg::after {
    display: none;
}

.home-hero-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: clamp(2.5rem, 5vw, 4rem) clamp(1.5rem, 4vw, 2.5rem) clamp(1.75rem, 3vw, 2.5rem);
    display: flex;
    flex-direction: column;
    gap: clamp(1.5rem, 3vw, 2.25rem);
}

.home-hero-top {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    gap: clamp(1.5rem, 3vw, 2.5rem);
    align-items: end;
}

.home-hero-copy {
    max-width: 720px;
}

.home-hero-eyebrow {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 0.85rem;
}

.home-hero-copy h1 {
    font-family: 'Fredoka', sans-serif;
    font-size: clamp(2rem, 4.8vw, 3.35rem);
    color: var(--primary-dark);
    margin-bottom: 0.75rem;
    line-height: 1.15;
    text-wrap: balance;
}

.home-hero-copy p {
    color: var(--text-muted);
    font-size: clamp(0.98rem, 1.6vw, 1.08rem);
    line-height: 1.7;
    margin-bottom: 1.15rem;
    max-width: 58ch;
}

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.stat-pill {
    background: rgba(74, 68, 140, 0.08);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.45rem 0.95rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.stat-pill strong {
    color: var(--primary);
    font-weight: 700;
}

.search-container {
    display: flex;
    width: 100%;
    max-width: 460px;
    justify-self: end;
    align-self: end;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(248, 182, 45, 0.45);
    background: rgba(255, 255, 255, 0.98);
}

.search-container input {
    flex: 1;
    padding: 1rem 1.2rem;
    border: none;
    font-size: 0.95rem;
    font-family: inherit;
    background: transparent;
    color: var(--text);
    min-width: 0;
}

.search-container input::placeholder {
    color: var(--text-muted);
}

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

.search-container button {
    padding: 1rem 1.5rem;
    border: none;
    background: var(--secondary);
    color: var(--primary-dark);
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    font-size: 0.9rem;
    transition: background 0.2s;
    flex-shrink: 0;
}

.search-container button:hover {
    background: #f9c24a;
}

.magazine {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.9fr);
    gap: 1.25rem;
    width: 100%;
}

.featured-article {
    min-width: 0;
}

.featured-article-card {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    height: 100%;
    min-height: 320px;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    transition: transform 0.25s, box-shadow 0.25s;
}

.featured-article-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.featured-article-card img {
    width: 100%;
    height: 100%;
    min-height: 240px;
    object-fit: cover;
}

.featured-article-body {
    padding: 1.6rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.featured-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.featured-article-body h2 {
    font-family: 'Fredoka', sans-serif;
    font-size: clamp(1.15rem, 2vw, 1.5rem);
    color: var(--text);
    margin-bottom: 0.65rem;
    line-height: 1.35;
}

.featured-article-body p {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.featured-meta {
    margin-top: 1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.home-hero .more-articles h2 {
    color: var(--primary-dark);
}

.home-hero .featured-article-card,
.home-hero .compact-article {
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.more-articles {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

.more-articles h2 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    color: var(--primary-dark);
    margin: 0 0 0.15rem;
}

.compact-article {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 0.85rem;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem;
    text-decoration: none;
    color: inherit;
    flex: 1;
    min-height: 88px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.compact-article:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.compact-article img {
    width: 92px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    background: var(--bg);
}

.compact-article h3 {
    font-size: 0.92rem;
    line-height: 1.35;
    margin: 0.3rem 0 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-about {
    width: 100%;
    padding: 0 clamp(1.5rem, 4vw, 2.5rem) 2.5rem;
    scroll-margin-top: calc(var(--site-header-height) + 1rem);
}

.home-about-inner {
    width: 100%;
    max-width: none;
    margin: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 1.6rem;
    box-shadow: var(--shadow);
}

.home-about-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.85fr);
    gap: 1.5rem 2.25rem;
    align-items: start;
}

.home-about-copy h2 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.2rem;
    color: var(--primary-dark);
    margin-bottom: 0.65rem;
}

.home-about-copy p {
    color: var(--text-muted);
    line-height: 1.7;
    font-size: 0.94rem;
    margin-bottom: 0.85rem;
}

.home-about-copy p:last-child {
    margin-bottom: 0;
}

.home-about-topics-wrap {
    border-left: 1px solid var(--border);
    padding-left: 1.5rem;
}

.home-about-topics-wrap h3 {
    font-size: 0.95rem;
    color: var(--primary);
    margin: 0 0 0.65rem;
}

.home-about-topics {
    margin: 0;
    padding-left: 1.15rem;
    color: var(--text-muted);
    line-height: 1.65;
    font-size: 0.92rem;
}

.home-about a {
    color: var(--primary);
    font-weight: 600;
}

.home-content {
    width: 100%;
    max-width: none;
    display: block;
    padding: 1.5rem clamp(1.5rem, 4vw, 2.5rem) 1.25rem;
    scroll-margin-top: calc(var(--site-header-height) + 1rem);
}

.feed-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem 1rem;
    margin-bottom: 1.15rem;
    padding-bottom: 0.85rem;
    border-bottom: 2px solid var(--border);
}

.latest-articles h2 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.2rem;
    color: var(--text);
    margin: 0;
    padding: 0;
    border: none;
}

.category-chips ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.category-chips .category-link {
    text-decoration: none;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s;
}

.category-chips .category-link:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.category-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.category-chips .active-category-filter {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--secondary) !important;
}

.category-chips .active-category-filter .category-count {
    color: rgba(248, 182, 45, 0.85);
}

#articles-container {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.15rem;
}

.article-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s, box-shadow 0.25s;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.article-link {
    text-decoration: none;
    color: inherit;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-cover {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--bg);
}

.article-preview-content {
    padding: 1.25rem;
    flex: 1;
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.article-tag {
    background: var(--primary);
    color: var(--secondary);
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.article-date {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.article-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card p {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-actions {
    display: flex;
    padding: 0 1.25rem 1.25rem;
    gap: 0.5rem;
    position: relative;
    z-index: 2;
}

.article-like-bar-wrap .article-like-bar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.article-like-bar-wrap {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.article-engagement--bottom {
    margin: 2rem clamp(1.25rem, 4vw, 3rem) 2.5rem;
    padding: 1.5rem;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
}

.article-engagement-label {
    margin: 0 0 1rem;
    font-weight: 600;
    color: var(--text);
    font-size: 1rem;
}

.article-engagement--bottom .article-like-bar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.article-engagement--bottom .like-btn,
.article-engagement--bottom .share-btn {
    padding: 0.6rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--primary);
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    position: relative;
    z-index: 2;
    pointer-events: auto;
    touch-action: manipulation;
}

.article-engagement--bottom .like-btn:hover,
.article-engagement--bottom .share-btn:hover {
    background: var(--bg);
    transform: translateY(-1px);
}

.article-engagement--bottom .like-btn.liked {
    background: var(--primary);
    color: var(--secondary);
    border-color: var(--primary);
}

.article-engagement--bottom .like-btn:disabled,
.article-engagement--bottom .share-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

/* Header engagement bar (on purple background) */
.article-like-bar-wrap .article-like-bar .like-btn,
.article-like-bar-wrap .article-like-bar .share-btn {
    padding: 0.55rem 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    font-size: 0.88rem;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.article-like-bar-wrap .article-like-bar .like-btn:hover,
.article-like-bar-wrap .article-like-bar .share-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

.article-like-bar-wrap .article-like-bar .like-btn.liked {
    background: var(--secondary);
    color: var(--primary-dark);
    border-color: var(--secondary);
}

.article-like-bar-wrap .article-like-bar .like-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

.article-actions button {
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    font-size: 0.8rem;
    background: transparent;
    color: var(--primary);
    transition: all 0.2s;
    position: relative;
    z-index: 3;
    pointer-events: auto;
    touch-action: manipulation;
}

.article-actions button:hover {
    background: var(--bg);
}

.like-btn.liked {
    background: var(--primary);
    color: var(--secondary);
    border-color: var(--secondary);
}

.like-btn:disabled,
.article-actions button:disabled {
    opacity: 0.65;
    cursor: wait;
}

.no-articles-message {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    grid-column: 1 / -1;
}

/* ========== FOOTER ========== */
.site-footer {
    background: linear-gradient(90deg, var(--primary-dark), var(--primary));
    color: rgba(255,255,255,0.92);
    padding: 0;
    margin-top: auto;
    border-top: 2px solid var(--secondary);
    position: relative;
    z-index: var(--z-footer);
}

.site-footer--article {
    margin-top: 0;
}

.site-footer--article .footer-article-cta {
    padding-top: 2rem;
}

.footer-article-cta {
    text-align: center;
    padding: 1.75rem 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(248, 182, 45, 0.28);
}

.footer-cta-text {
    color: rgba(255, 255, 255, 0.92);
    font-size: 1rem;
    margin-bottom: 1rem;
    line-height: 1.6;
    max-width: 52ch;
    margin-left: auto;
    margin-right: auto;
}

.footer-inner {
    max-width: none;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.footer-meta {
    justify-content: center;
}

#footer-actions-left {
    display: none;
}

.footer-actions--left,
.footer-actions--home {
    gap: 0.5rem;
}

body[data-page="article"] .article-page {
    padding-bottom: 0;
}

body[data-page="article"] .author-section {
    margin-top: 2rem;
    margin-bottom: 2.5rem;
}

body[data-page="article"] .article-main {
    display: flex;
    flex-direction: column;
}

body[data-page="article"] .related-section {
    margin-bottom: 0;
    padding-bottom: 1.5rem;
}

.footer-copy {
    font-size: 0.8rem;
    opacity: 0.8;
    margin: 0;
}

.footer-actions {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.site-footer--article .footer-article-cta .footer-actions {
    margin-bottom: 0;
}

.footer-actions .cta-btn-outline:hover {
    background: var(--secondary);
    color: var(--primary-dark);
}

.article-end-cta {
    display: none;
}

.social-dock[hidden],
.social-dock.social-dock--inactive {
    display: none !important;
    pointer-events: none;
}

/* ========== SOCIAL DOCK ========== */
.social-dock {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: var(--z-dock);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--primary-dark), var(--primary));
    border: 2px solid var(--secondary);
    box-shadow: var(--shadow-hover);
    padding: 0.35rem 0;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    opacity: 0.38;
    transition: opacity 0.28s ease, box-shadow 0.28s ease, transform 0.28s ease;
    pointer-events: auto;
    isolation: isolate;
}

.social-dock-panel {
    display: flex;
    flex-direction: column;
}

.social-dock-toggle {
    display: none;
}

/* Article page — desktop: subtle side docks, full visibility on hover or near footer */
@media (min-width: 1025px) {
    body[data-page="article"] .social-dock {
        opacity: 0.18;
    }

    body[data-page="article"] .social-dock:hover,
    body[data-page="article"] .social-dock:focus-within,
    body[data-page="article"] .social-dock.is-near-footer,
    body[data-page="article"] .social-dock.is-solid {
        opacity: 1;
    }
}

.social-dock-toggle-icon {
    display: block;
    width: 0;
    height: 0;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
    transition: transform 0.25s ease;
}

@media (prefers-reduced-motion: reduce) {
    body[data-page="article"] .header-actions-left .cta-btn,
    body[data-page="article"] .header-actions-right .cta-btn {
        animation: none;
    }
}

.social-dock:hover {
    opacity: 1;
    box-shadow: 0 12px 36px rgba(74, 68, 140, 0.35);
}

.social-dock.is-solid {
    opacity: 1 !important;
}

.social-dock-left:hover {
    transform: translateY(-50%) translateX(2px);
}

.social-dock-right:hover {
    transform: translateY(-50%) translateX(-2px);
}

.social-dock-left {
    left: 0;
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.social-dock-right {
    right: 0;
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.dock-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.65rem 0.55rem;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.88);
    transition: all 0.2s;
    min-width: var(--dock-width);
}

.dock-link:hover {
    background: var(--secondary);
    color: var(--primary-dark);
}

.dock-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.dock-icon img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    display: block;
}

.dock-label {
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* ========== ARTICLE PAGE ========== */
.article-page {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 1.25rem 1.5rem 3rem;
}

.article-page-header {
    position: relative;
    width: calc(100% + 3rem);
    max-width: none;
    margin: 0 -1.5rem 1.5rem;
    min-height: clamp(280px, 42vh, 480px);
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    border-radius: 0 0 var(--radius) var(--radius);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    box-shadow: var(--shadow);
}

.article-page-hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transform: scale(1.02);
}

.article-page-header--has-cover .article-page-hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(18, 16, 42, 0.55) 0%,
        rgba(18, 16, 42, 0.72) 50%,
        rgba(18, 16, 42, 0.88) 100%
    );
}

.article-page-header:not(.article-page-header--has-cover) .article-page-hero-bg {
    display: none;
}

.article-page-hero-inner {
    position: relative;
    z-index: 1;
    width: 100%;
}

.article-page-header .full-article-header {
    background: transparent;
    border-bottom: none;
    border-radius: 0;
    box-shadow: none;
    padding: clamp(2rem, 5vw, 3rem) clamp(1.5rem, 4vw, 2.5rem) clamp(1.5rem, 3vw, 2rem);
}

.article-page-header--has-cover .full-article-header h1,
.article-page-header--has-cover .full-article-header .subtitle,
.article-page-header--has-cover .full-article-header .article-meta {
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
}

.article-layout {
    display: grid;
    grid-template-columns: minmax(200px, 17%) minmax(0, 1fr) minmax(240px, 22%);
    grid-template-areas: "toc content recommend";
    gap: 1.5rem;
    align-items: start;
    width: 100%;
}

.article-sidebar-left {
    grid-area: toc;
}

.article-main {
    grid-area: content;
    min-width: 0;
}

.article-sidebar-right {
    grid-area: recommend;
}

.article-sidebar {
    position: sticky;
    top: calc(var(--site-header-height) + var(--progress-height) + 1rem);
    align-self: start;
}

.toc-box {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--progress-height) - 2rem);
}

.toc-box .article-toc {
    overflow-y: auto;
    max-height: calc(100vh - var(--progress-height) - 6.5rem);
    padding-right: 0.35rem;
    scrollbar-width: thin;
    scrollbar-color: var(--secondary) transparent;
}

.toc-box .article-toc::-webkit-scrollbar {
    width: 5px;
}

.toc-box .article-toc::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 999px;
}

.sidebar-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.sidebar-box h3 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.article-toc {
    list-style: none;
    font-size: 0.82rem;
}

.article-toc li {
    margin-bottom: 0.35rem;
}

.article-toc a {
    color: var(--text-muted);
    text-decoration: none;
    display: block;
    padding: 0.3rem 0;
    border-left: 2px solid transparent;
    padding-left: 0.5rem;
    transition: all 0.2s;
    line-height: 1.35;
}

.article-toc a:hover,
.article-toc a.active {
    color: var(--primary);
    border-left-color: var(--secondary);
}

.article-toc .level-2 { padding-left: 0.85rem; }
.article-toc .level-3 { padding-left: 1.25rem; font-size: 0.78rem; }

.related-list {
    list-style: none;
}

.related-list li {
    margin-bottom: 0.65rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border);
}

.related-list li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.related-list a {
    text-decoration: none;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.4;
    display: block;
}

.related-list a:hover {
    color: var(--primary);
}

.related-list .rel-cat {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.related-sidebar-box {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--progress-height) - 2rem);
}

.related-sidebar-list {
    list-style: none;
    overflow-y: auto;
    max-height: calc(100vh - var(--progress-height) - 6.5rem);
    padding-right: 0.2rem;
    scrollbar-width: thin;
    scrollbar-color: var(--secondary) transparent;
}

.related-sidebar-list::-webkit-scrollbar {
    width: 5px;
}

.related-sidebar-list::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 999px;
}

.related-sidebar-item {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
    transition: opacity 0.2s;
}

.related-sidebar-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.related-sidebar-item:hover {
    opacity: 0.85;
}

.related-sidebar-item img {
    flex-shrink: 0;
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
}

.related-sidebar-body {
    min-width: 0;
    flex: 1;
}

.related-sidebar-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
}

.related-sidebar-item:hover .related-sidebar-title {
    color: var(--primary);
}

.related-sidebar-meta {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.full-article {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    min-width: 0;
}

.full-article-header {
    text-align: center;
    padding: 2.5rem 2rem;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
    border-bottom: 3px solid var(--secondary);
}

.full-article-header h1 {
    font-family: 'Fredoka', sans-serif;
    font-size: clamp(1.5rem, 3.5vw, 2.1rem);
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.full-article-header .subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 1rem;
}

.article-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    font-size: 0.85rem;
    opacity: 0.9;
}

.article-meta .category-tag {
    background: rgba(248, 182, 45, 0.25) !important;
    color: var(--secondary) !important;
    padding: 0.3rem 0.75rem !important;
    border-radius: 999px;
    font-size: 0.8rem !important;
}

.article-body-wrap {
    padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1.25rem, 4vw, 3rem);
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Legacy articles: content without body-wrap until JS runs */
.full-article > .article-content {
    padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1.25rem, 4vw, 3rem);
    box-sizing: border-box;
}

.article-body-wrap > .article-content {
    padding: 0;
}

.article-body-wrap > .image-gallery-container {
    margin: 0 0 1.5rem;
    padding: 0;
}

/* ========== GALLERY / CAROUSEL ========== */
.image-gallery-container {
    width: 100%;
}

.article-carousel {
    position: relative;
    width: 100%;
}

.article-carousel-viewport {
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    box-shadow: var(--shadow);
}

.article-carousel-track {
    display: flex;
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.article-carousel-slide {
    flex: 0 0 100%;
    min-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-elevated);
}

.article-carousel-slide img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: min(72vh, 640px);
    object-fit: contain;
    margin: 0 auto;
    user-select: none;
    -webkit-user-drag: none;
}

.article-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 2.5rem;
    height: 2.5rem;
    border: 2px solid var(--secondary);
    border-radius: 50%;
    background: rgba(74, 68, 140, 0.88);
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s, transform 0.2s;
    box-shadow: var(--shadow);
}

.article-carousel-btn:hover {
    background: var(--primary);
    transform: translateY(-50%) scale(1.06);
}

.article-carousel-prev { left: 0.65rem; }
.article-carousel-next { right: 0.65rem; }

.article-carousel-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.85rem;
    flex-wrap: wrap;
}

.article-carousel-dots {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.article-carousel-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: var(--border);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.article-carousel-dot.active {
    background: var(--primary);
    transform: scale(1.25);
}

.article-carousel-dot:hover {
    background: var(--primary-light);
}

.article-carousel-counter {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 3.5rem;
    text-align: center;
}

.article-carousel--single .article-carousel-btn,
.article-carousel--single .article-carousel-footer {
    display: none;
}

/* Legacy gallery fallback (upgraded by JS) */
.article-images-gallery,
.image-gallery {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.article-images-gallery.image-gallery--single,
.image-gallery.image-gallery--single {
    display: block;
}

.article-images-gallery.image-gallery--single img,
.image-gallery.image-gallery--single img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: min(72vh, 640px);
    object-fit: contain;
    margin: 0 auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    box-shadow: var(--shadow);
}

.article-zoomable,
.article-content img {
    cursor: zoom-in;
}

.article-content img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 1rem auto;
    border: 1px solid var(--border);
    background: var(--bg);
}

.article-content {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--text);
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-wrap: break-word;
    overflow-x: clip;
}

.article-content h2,
.article-content h3,
.article-content h4 {
    font-family: 'Fredoka', sans-serif;
    color: var(--text);
    margin: 1.75rem 0 0.75rem;
    scroll-margin-top: 1.5rem;
    overflow-wrap: anywhere;
}

.article-content h2 { font-size: 1.45rem; }
.article-content h3 { font-size: 1.2rem; }
.article-content p {
    margin-bottom: 1rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.article-content a {
    color: var(--primary);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.article-content ul,
.article-content ol {
    margin: 0 0 1rem;
    padding-left: 1.65rem;
    padding-right: 0;
    max-width: 100%;
    box-sizing: border-box;
    list-style-position: outside;
}

.article-content ul { list-style-type: disc; }
.article-content ol {
    list-style-type: decimal;
    padding-left: 2rem;
}

.article-content li {
    margin-bottom: 0.5rem;
    padding-left: 0.2rem;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.article-content li:last-child {
    margin-bottom: 0;
}

.article-content li > ul,
.article-content li > ol {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.article-content li > p {
    margin-bottom: 0.35rem;
}

.article-content li > p:last-child {
    margin-bottom: 0;
}

.article-content blockquote {
    border-left: 4px solid var(--accent);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    background: var(--bg);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-muted);
}

.related-section {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    width: 100%;
}

.author-section {
    margin-top: 2rem;
    width: 100%;
    padding: 0;
}

.author-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--secondary);
    border-radius: var(--radius);
    padding: 1.1rem 1.15rem;
    box-shadow: var(--shadow);
}

.author-avatar {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    border: 2px solid var(--secondary);
    overflow: hidden;
}

.author-avatar--image {
    background: #fff;
    padding: 4px;
}

.author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.author-info {
    flex: 1;
    min-width: 0;
}

.author-label {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
    margin-bottom: 0.35rem;
}

.author-name {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.05rem;
    color: var(--text);
    margin-bottom: 0.15rem;
    line-height: 1.3;
}

.author-role {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.author-bio {
    font-size: 0.86rem;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 0.85rem;
}

.author-link {
    display: inline-flex;
    background: var(--secondary);
    color: var(--primary-dark);
    border-color: var(--secondary);
    opacity: 1;
}

.author-link:hover {
    background: #f9c24a;
    color: var(--primary-dark);
}

.related-section h2 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
    color: var(--text);
}

/* Hide bottom related grid on tablet/desktop when right sidebar is used */
@media (min-width: 768px) {
    #related-bottom {
        display: none !important;
    }
}

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

.related-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}

.related-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.related-card img {
    display: block;
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: var(--bg);
}

.related-card-body {
    padding: 0.85rem;
}

.related-card-body h3 {
    font-size: 0.88rem;
    line-height: 1.4;
    margin-bottom: 0.35rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-card-body span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========== LIGHTBOX ========== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: var(--z-lightbox);
    animation: lightboxFadeIn 0.25s ease;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    opacity: 0.85;
    line-height: 1;
}

@keyframes lightboxFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-50px) scale(0.5); }
}

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

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

/* ========== RESPONSIVE ========== */
@media (max-width: 1200px) {
    #articles-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1279px) {
    .article-layout {
        grid-template-columns: minmax(170px, 19%) minmax(0, 1fr) minmax(210px, 25%);
        gap: 1.25rem;
    }

    .related-sidebar-item img {
        width: 56px;
        height: 42px;
    }
}

@media (max-width: 1024px) {
    .magazine {
        grid-template-columns: 1fr;
    }

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

    .home-hero {
        min-height: auto;
    }

    .home-hero-top {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .search-container {
        max-width: none;
        justify-self: stretch;
        align-self: stretch;
    }

    .article-layout {
        grid-template-columns: minmax(0, 1.65fr) minmax(200px, 1fr);
        grid-template-areas:
            "toc toc"
            "content recommend";
        gap: 1rem;
    }

    .article-sidebar-left,
    .article-sidebar-right {
        position: static;
    }

    .toc-box,
    .related-sidebar-box {
        max-height: none;
    }

    .toc-box .article-toc {
        max-height: 200px;
    }

    .related-sidebar-list {
        max-height: 420px;
    }

    .related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body {
        padding-bottom: calc(var(--mobile-dock-bar) + env(safe-area-inset-bottom, 0px));
    }

    .home-page,
    .article-page {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .header-inner {
        padding: 0 0.85rem;
        gap: 0.5rem;
    }

    body[data-page="home"] #header-actions {
        justify-content: flex-end;
        max-width: 100%;
        gap: 0.35rem;
        flex-wrap: nowrap;
    }

    body[data-page="home"] #header-actions .cta-btn-sm {
        padding: 0.4rem 0.6rem;
        font-size: 0.72rem;
        white-space: nowrap;
        flex: 0 0 auto;
    }

    .footer-meta {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 0.5rem 0.75rem;
        text-align: center;
        justify-content: stretch;
    }

    #footer-actions-left {
        display: flex;
        justify-self: start;
        grid-column: 1;
        grid-row: 1;
    }

    .footer-meta .footer-copy {
        grid-column: 2;
        grid-row: 1;
        justify-self: center;
        text-align: center;
    }

    #footer-actions-home {
        display: flex;
        justify-self: end;
        grid-column: 3;
        grid-row: 1;
    }

    #footer-actions-left .cta-btn-sm,
    #footer-actions-home .cta-btn-sm {
        padding: 0.4rem 0.6rem;
        font-size: 0.72rem;
        white-space: nowrap;
    }

    .social-dock {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        max-height: none;
        min-height: var(--mobile-dock-bar);
        z-index: var(--z-dock);
        padding-bottom: env(safe-area-inset-bottom, 0);
        opacity: 1;
        flex-direction: row;
        align-items: stretch;
        justify-content: center;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    body[data-page="home"] .social-dock,
    body[data-page="home"] .social-dock-left.social-dock--unified {
        opacity: 1;
        visibility: visible;
    }

    .social-dock::-webkit-scrollbar {
        display: none;
    }

    .social-dock:hover {
        transform: none;
        opacity: 1;
    }

    .social-dock-left {
        left: 0;
        right: auto;
        width: 50%;
        max-width: 50%;
        border-radius: 0 var(--radius-sm) 0 0;
        border-left: none;
        border-bottom: none;
        border-top: 2px solid var(--secondary);
        border-right: 1px solid rgba(248, 182, 45, 0.3);
    }

    .social-dock-right {
        right: 0;
        left: auto;
        width: 50%;
        max-width: 50%;
        border-radius: var(--radius-sm) 0 0 0;
        border-right: none;
        border-bottom: none;
        border-top: 2px solid var(--secondary);
        border-left: none;
    }

    body[data-page="home"] .social-dock-left.social-dock--unified,
    body[data-page="article"] .social-dock-left.social-dock--unified {
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: 2px solid var(--secondary);
        justify-content: stretch;
        gap: 0;
        overflow-x: hidden;
        padding:
            0
            max(0.35rem, env(safe-area-inset-right, 0px))
            env(safe-area-inset-bottom, 0px)
            max(0.35rem, env(safe-area-inset-left, 0px));
    }

    body[data-page="article"] .social-dock-left.social-dock--unified:not(.is-near-footer) {
        opacity: 0.62;
    }

    body[data-page="article"] .social-dock-left.social-dock--unified.is-near-footer {
        opacity: 1;
        box-shadow: 0 -8px 28px rgba(74, 68, 140, 0.28);
    }

    body[data-page="home"] .social-dock-left.social-dock--unified ~ .social-dock-right,
    body[data-page="home"] .social-dock-right.social-dock--inactive,
    body[data-page="article"] .social-dock-left.social-dock--unified ~ .social-dock-right,
    body[data-page="article"] .social-dock-right.social-dock--inactive {
        display: none !important;
        pointer-events: none;
    }

    body[data-page="home"] .social-dock-left.social-dock--unified .dock-link,
    body[data-page="article"] .social-dock-left.social-dock--unified .dock-link {
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
        padding: 0.42rem 0.12rem;
    }

    body[data-page="home"] .social-dock-left.social-dock--unified .dock-icon img,
    body[data-page="article"] .social-dock-left.social-dock--unified .dock-icon img {
        width: clamp(20px, 4.8vw, 28px);
        height: clamp(20px, 4.8vw, 28px);
    }

    body[data-page="home"] .social-dock-left.social-dock--unified .dock-label,
    body[data-page="article"] .social-dock-left.social-dock--unified .dock-label {
        font-size: clamp(0.44rem, 2.1vw, 0.58rem);
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body[data-page="home"] .social-dock-left.social-dock--unified .dock-divider,
    body[data-page="article"] .social-dock-left.social-dock--unified .dock-divider {
        width: 1px;
        flex: 0 0 1px;
        align-self: stretch;
        margin: 0.4rem 0.05rem;
        background: rgba(248, 182, 45, 0.35);
        flex-shrink: 0;
    }

    .dock-link {
        min-width: 44px;
        flex: 0 0 auto;
        padding: 0.35rem 0.3rem;
        justify-content: center;
        align-items: center;
    }

    .dock-label {
        font-size: 0.58rem;
    }

    .site-footer--article .footer-article-cta .footer-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: 360px;
        margin: 0 auto;
    }

    .site-footer--article .footer-article-cta .footer-actions .cta-btn {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .header-inner,
    .footer-inner {
        padding: 0 0.75rem;
    }

    .header-inner {
        gap: 0.35rem;
        min-height: 42px;
    }

    .logo-text {
        font-size: 0.9rem;
        max-width: 7.5rem;
    }

    .header-actions {
        gap: 0.35rem;
        flex-wrap: nowrap;
    }

    .cta-btn-sm {
        padding: 0.38rem 0.65rem;
        font-size: 0.72rem;
    }

    body[data-page="article"] .header-actions-left .cta-btn,
    body[data-page="article"] .header-actions-right .cta-btn {
        padding: 0.38rem 0.55rem;
        font-size: 0.7rem;
        line-height: 1.2;
    }

    body[data-page="home"] #header-actions-left {
        display: flex;
        justify-self: start;
    }

    body[data-page="home"] #header-actions-left .cta-btn-sm {
        padding: 0.38rem 0.55rem;
        font-size: 0.7rem;
        white-space: nowrap;
    }

    body[data-page="home"] #header-actions {
        justify-content: flex-end;
    }

    body[data-page="home"] .social-dock-left.social-dock--unified .dock-label,
    body[data-page="article"] .social-dock-left.social-dock--unified .dock-label {
        display: none;
    }

    body[data-page="home"] .social-dock-left.social-dock--unified .dock-link,
    body[data-page="article"] .social-dock-left.social-dock--unified .dock-link {
        padding: 0.65rem 0.25rem;
        gap: 0;
    }

    body[data-page="home"] .social-dock-left.social-dock--unified .dock-icon img,
    body[data-page="article"] .social-dock-left.social-dock--unified .dock-icon img {
        width: 32px;
        height: 32px;
    }

    .footer-inner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 0.65rem;
        padding-top: 0.85rem;
        padding-bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    }

    .footer-meta.footer-inner {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
        flex-direction: row !important;
        gap: 0.45rem 0.5rem;
        text-align: center;
        width: 100%;
        padding-bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    }

    #footer-actions-left {
        display: flex !important;
        justify-self: start;
        grid-column: 1;
        grid-row: 1;
    }

    .footer-meta .footer-copy {
        grid-column: 2;
        grid-row: 1;
        justify-self: center;
        text-align: center;
        font-size: 0.72rem;
        line-height: 1.35;
        min-width: 0;
    }

    #footer-actions-home {
        display: flex !important;
        justify-self: end;
        grid-column: 3;
        grid-row: 1;
    }

    #footer-actions-left .cta-btn-sm,
    #footer-actions-home .cta-btn-sm {
        padding: 0.38rem 0.55rem;
        font-size: 0.68rem;
    }

    .footer-article-cta {
        padding: 1.25rem 0.75rem 1rem;
    }

    .footer-cta-text {
        font-size: 0.92rem;
        margin-bottom: 0.85rem;
    }

    .home-hero {
        min-height: auto;
    }

    .home-hero-inner {
        padding: 2rem 1rem 1.5rem;
    }

    .home-hero-top {
        gap: 1.25rem;
    }

    .search-container {
        flex-direction: row;
        align-items: stretch;
        border-radius: 999px;
        max-width: 100%;
    }

    .search-container input {
        flex: 1;
        min-width: 0;
        width: auto;
        padding: 0.8rem 0.9rem;
        font-size: 0.9rem;
        border-radius: 0;
    }

    .search-container button {
        flex-shrink: 0;
        width: auto;
        padding: 0.8rem 1rem;
        font-size: 0.85rem;
        border-radius: 0;
        border-left: 1px solid rgba(74, 68, 140, 0.12);
    }

    .magazine {
        gap: 1rem;
    }

    .home-content {
        padding: 1rem 1rem 1rem;
    }

    .home-about {
        padding: 0 1rem 2rem;
    }

    .home-about-inner {
        padding: 1.25rem 1.15rem;
    }

    .home-about-layout {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .home-about-topics-wrap {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid var(--border);
        padding-top: 1.15rem;
    }

    .feed-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    #articles-container {
        grid-template-columns: 1fr;
    }

    .article-page {
        padding: 1rem 0.75rem 1.5rem;
    }

    .article-page-header {
        width: calc(100% + 1.5rem);
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        min-height: clamp(240px, 38vh, 360px);
        border-radius: 0 0 calc(var(--radius) * 0.85) calc(var(--radius) * 0.85);
    }

    .article-page-header .full-article-header {
        padding: 1.75rem 1.25rem 1.5rem;
    }

    .article-body-wrap {
        padding: 1.25rem;
    }

    .full-article-header {
        padding: 1.75rem 1.25rem;
    }

    .article-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "toc"
            "content"
            "recommend";
    }

    .article-sidebar-right {
        display: none;
    }

    #related-bottom {
        display: block !important;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    .author-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1rem;
    }

    .author-link {
        justify-content: center;
    }

    .article-carousel-btn {
        width: 2.15rem;
        height: 2.15rem;
        font-size: 1.15rem;
    }

    .article-carousel-prev { left: 0.35rem; }
    .article-carousel-next { right: 0.35rem; }
}

@media (min-width: 769px) {
    body[data-page="home"] #header-actions-left:empty {
        display: none;
    }
}

@media (max-width: 520px) {
    .logo-text {
        display: none;
    }

    #header-actions {
        justify-content: flex-end;
    }

    body[data-page="article"] #header-actions .cta-btn-sm,
    body[data-page="article"] #header-actions-left .cta-btn-sm {
        padding: 0.35rem 0.5rem;
        font-size: 0.68rem;
    }

    .search-container input {
        padding: 0.72rem 0.75rem;
        font-size: 0.85rem;
    }

    .search-container input::placeholder {
        font-size: 0.82rem;
    }

    .search-container button {
        padding: 0.72rem 0.8rem;
        font-size: 0.8rem;
    }
}
