/*
 * PENTOL - Mobile First SEO Theme
 * Ultra-fast, Google Discover Optimized
 * 
 * Author: Mak
 * Version: 1.0.0
 */

/* ===================================
   CSS RESET & BASE
   =================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    /* System fonts first to prevent CLS, Inter loads as enhancement */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    /* Prevent CLS from font loading */
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

/* ===================================
   CSS VARIABLES (Mobile First)
   =================================== */
:root {
    /* Colors - Light Mode */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --accent: #f59e0b;
    --accent-dark: #d97706;

    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-inverse: #ffffff;

    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Typography */
    --font-display: 'Inter', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --header-height: 56px;
    --bottom-nav-height: 64px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #64748b;

    --border-color: #334155;
    --border-light: #1e293b;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* Dark mode overrides for fixed contrast colors */
[data-theme="dark"] .article-meta {
    color: #d1d5db;
}

[data-theme="dark"] .article-meta span,
[data-theme="dark"] .article-meta time {
    color: #d1d5db;
}

[data-theme="dark"] .article-author-date {
    color: #9ca3af;
}

[data-theme="dark"] .ad-label {
    color: #9ca3af;
}

[data-theme="dark"] .related-item-date {
    color: #9ca3af;
}

[data-theme="dark"] .nav-item {
    color: #9ca3af;
}

[data-theme="dark"] .footer-copyright {
    color: #9ca3af;
}

/* ===================================
   TYPOGRAPHY
   =================================== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.25;
    color: var(--text-primary);
}

h1 {
    font-size: 1.75rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1.125rem;
}

@media (min-width: 768px) {
    h1 {
        font-size: 2.25rem;
    }

    h2 {
        font-size: 1.875rem;
    }

    h3 {
        font-size: 1.5rem;
    }
}

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===================================
   LAYOUT COMPONENTS
   =================================== */

/* Container */
.container {
    width: 100%;
    max-width: 100%;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
    margin: 0 auto;
}

@media (min-width: 768px) {
    .container {
        max-width: 768px;
        padding-left: var(--space-lg);
        padding-right: var(--space-lg);
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1024px;
    }
}

/* Main Content Area */
.main-content {
    min-height: 100vh;
    padding-top: var(--header-height);
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + var(--space-lg));
}

/* ===================================
   HEADER - Mobile Optimized
   =================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 var(--space-md);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header-logo img {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
}

.header-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.header-btn svg {
    width: 20px;
    height: 20px;
}

/* ===================================
   BOTTOM NAVIGATION - Mobile
   =================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    padding-bottom: var(--safe-area-bottom);
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-around;
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none;
    }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    height: 100%;
    padding: var(--space-sm);
    color: #4b5563;
    text-decoration: none;
    transition: color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.nav-item.active,
.nav-item:hover {
    color: var(--primary);
}

.nav-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
}

.nav-item span {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===================================
   FEED CARDS - Social Media Style
   =================================== */
.feed {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md) 0;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: all var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Card Image - Discover Optimized (16:9) */
.card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.card:hover .card-image img {
    transform: scale(1.03);
}

.card-image-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    color: var(--text-inverse);
    font-size: 2rem;
}

/* Card Category Badge */
.card-category {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background: var(--primary);
    color: var(--text-inverse);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--radius-sm);
}

/* Card Content */
.card-content {
    padding: var(--space-md);
}

.card-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.card-meta svg {
    width: 14px;
    height: 14px;
}

.card-meta-divider {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-tertiary);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-title a {
    color: inherit;
}

.card-title a:hover {
    color: var(--primary);
}

.card-excerpt {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card Footer */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid var(--border-light);
}

.card-author {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.card-author-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    font-size: 0.75rem;
    font-weight: 700;
}

.card-author-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.card-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
}

.card-action-btn:hover {
    background: var(--bg-secondary);
    color: var(--primary);
}

.card-action-btn svg {
    width: 18px;
    height: 18px;
}

/* ===================================
   FEATURED CARD - Large Hero Style
   =================================== */
.card-featured {
    position: relative;
    aspect-ratio: 4 / 5;
    border-radius: var(--radius-xl);
    overflow: hidden;
}

@media (min-width: 768px) {
    .card-featured {
        aspect-ratio: 16 / 9;
    }
}

.card-featured .card-image {
    position: absolute;
    inset: 0;
    aspect-ratio: unset;
}

.card-featured .card-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.3) 50%, transparent 100%);
}

.card-featured .card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-lg);
    color: var(--text-inverse);
}

.card-featured .card-category {
    background: var(--accent);
}

.card-featured .card-meta {
    color: rgba(255, 255, 255, 0.8);
}

.card-featured .card-title {
    font-size: 1.5rem;
    color: var(--text-inverse);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.card-featured .card-title a {
    color: inherit;
}

.card-featured .card-excerpt {
    color: rgba(255, 255, 255, 0.9);
}

/* ===================================
   ARTICLE PAGE - Single Post
   =================================== */
.article {
    padding-bottom: var(--space-2xl);
}

.article-header {
    margin-bottom: var(--space-lg);
}

.article-image {
    width: calc(100% + var(--space-md) * 2);
    margin-left: calc(var(--space-md) * -1);
    aspect-ratio: 1200 / 630;
    overflow: hidden;
    background: var(--bg-tertiary);
    /* Prevent CLS with contain and intrinsic sizing */
    contain: layout style;
    contain-intrinsic-size: 100vw calc(100vw * 630 / 1200);
}

@media (min-width: 768px) {
    .article-image {
        width: 100%;
        margin-left: 0;
        border-radius: var(--radius-lg);
    }
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Prevent CLS by ensuring image doesn't reflow */
    aspect-ratio: 1200 / 630;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) 0;
    font-size: 0.875rem;
    color: #374151;
    min-height: 32px;
}

.article-category-tag {
    padding: var(--space-xs) var(--space-md);
    background: #4f46e5;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: var(--radius-full);
}

.article-title {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: var(--space-md);
}

@media (min-width: 768px) {
    .article-title {
        font-size: 2.5rem;
    }
}

/* Fix H1UserAgentFontSizeInSection deprecation */
article h1,
section h1,
aside h1,
nav h1 {
    font-size: 1.75rem;
}

/* Article Subtitle / Excerpt */
.article-subtitle {
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--text-secondary);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-bottom: var(--space-lg);
}

.article-author {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.article-author-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    font-size: 1.25rem;
    font-weight: 700;
}

.article-author-info {
    flex: 1;
}

.article-author-name {
    font-weight: 700;
    color: var(--text-primary);
}

.article-author-date {
    font-size: 0.875rem;
    color: #4b5563;
}

/* Article Content - with CLS prevention */
.article-content {
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--text-secondary);
    contain: layout style;
}

.article-content h2 {
    margin-top: var(--space-xl);
    margin-bottom: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-light);
}

.article-content h3 {
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
}

.article-content p {
    margin-bottom: var(--space-md);
}

.article-content img {
    width: calc(100% + var(--space-md) * 2);
    margin-left: calc(var(--space-md) * -1);
    margin-top: var(--space-md);
    margin-bottom: var(--space-md);
    border-radius: 0;
}

@media (min-width: 768px) {
    .article-content img {
        width: 100%;
        margin-left: 0;
        border-radius: var(--radius-md);
    }
}

.article-content blockquote {
    margin: var(--space-lg) 0;
    padding: var(--space-md) var(--space-lg);
    border-left: 4px solid var(--primary);
    background: var(--bg-secondary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-style: italic;
}

.article-content ul,
.article-content ol {
    margin-bottom: var(--space-md);
    padding-left: var(--space-lg);
}

.article-content li {
    margin-bottom: var(--space-sm);
}

/* Lead Paragraph - First Paragraph Styling */
.lead-paragraph {
    font-size: 1.2rem;
    font-weight: 400;
    line-height: 1.7;
    color: var(--text-secondary);
    padding: var(--space-lg);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
    margin-bottom: var(--space-lg);
}

.lead-paragraph::first-letter {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    float: left;
    line-height: 1;
    margin-right: 8px;
    margin-top: 4px;
}

/* Content Box - Section with Header */
.content-box {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
    border: 1px solid var(--border-color);
}

.content-box h2 {
    font-size: 1.375rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--primary);
    border-top: none;
    padding-top: 0;
    color: var(--text-primary);
}

.content-box h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.content-box p {
    margin-bottom: 0;
    color: var(--text-secondary);
    line-height: 1.8;
}

.content-box p:not(:last-child) {
    margin-bottom: var(--space-md);
}

/* In-Content Image */
.in-content-image {
    margin: var(--space-xl) 0;
    text-align: center;
}

.in-content-image img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.in-content-image figcaption {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    font-style: italic;
    margin-top: var(--space-sm);
    padding: 0 var(--space-md);
}

/* Related Item Placeholder */
.related-item-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    color: var(--text-inverse);
    font-size: 1.5rem;
}

/* Reading Progress Bar */
.reading-progress {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 0;
    height: 3px;
    background: var(--primary);
    z-index: 999;
    transition: width 50ms linear;
}

/* ===================================
   AD CONTAINERS - Native Style
   =================================== */
.ad-block {
    margin: var(--space-lg) 0;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    text-align: center;
    position: relative;
    /* CLS prevention */
    min-height: 100px;
    contain: layout style;
}

.ad-label {
    position: absolute;
    top: var(--space-xs);
    right: var(--space-sm);
    font-size: 0.625rem;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.ad-block-native {
    background: var(--bg-card);
    border: none;
    box-shadow: var(--shadow-sm);
    /* CLS prevention for native ads */
    min-height: 250px;
    contain: layout style;
    contain-intrinsic-size: auto 250px;
}

/* In-Feed Ad Card */
.card-ad {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 2px dashed var(--border-color);
}

.card-ad .ad-label {
    position: static;
    margin-bottom: var(--space-sm);
    display: inline-block;
    padding: var(--space-xs) var(--space-sm);
    background: var(--text-tertiary);
    color: var(--text-inverse);
    border-radius: var(--radius-sm);
    font-weight: 600;
}

/* Banner Ad Sizes - with CLS prevention */
.ad-320x100 {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    contain: layout style;
    contain-intrinsic-size: auto 100px;
}

.ad-300x250 {
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    contain: layout style;
    contain-intrinsic-size: auto 250px;
}

.ad-728x90 {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    contain: layout style;
    contain-intrinsic-size: auto 90px;
}

@media (max-width: 767px) {
    .ad-728x90 {
        min-height: 100px;
        contain-intrinsic-size: auto 100px;
    }
}

/* ===================================
   GALLERY - Image Grid
   =================================== */
.gallery {
    margin: var(--space-lg) 0;
}

.gallery-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

@media (min-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--space-md);
    }
}

.gallery-item {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: var(--bg-tertiary);
    /* Button reset for accessibility */
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.gallery-item:focus-visible {
    box-shadow: 0 0 0 3px var(--primary), 0 0 0 5px var(--bg-primary);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
    pointer-events: none;
}

.gallery-item:hover img,
.gallery-item:focus img {
    transform: scale(1.1);
}

.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.3) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--transition-fast);
    pointer-events: none;
}

.gallery-item:hover::after,
.gallery-item:focus::after {
    opacity: 1;
}

/* ===================================
   RELATED POSTS
   =================================== */
.related-posts {
    margin-top: var(--space-2xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-color);
}

.related-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.related-grid {
    display: grid;
    gap: var(--space-md);
}

@media (min-width: 768px) {
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.related-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.related-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
}

.related-item-image {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

.related-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-item-content {
    flex: 1;
    min-width: 0;
}

.related-item-title {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: var(--space-xs);
}

.related-item-title a {
    color: inherit;
}

.related-item-title a:hover {
    color: var(--primary);
}

.related-item-date {
    font-size: 0.75rem;
    color: #4b5563;
}

/* ===================================
   SEARCH PAGE
   =================================== */
.search-header {
    padding: var(--space-lg) 0;
    text-align: center;
}

.search-form {
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    padding-right: 50px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

.search-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    background: var(--primary);
    color: var(--text-inverse);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.search-btn:hover {
    background: var(--primary-dark);
}

.search-btn svg {
    width: 18px;
    height: 18px;
}

.search-results-title {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: var(--space-lg);
    margin-bottom: var(--space-md);
}

/* ===================================
   LIGHTBOX
   =================================== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-image {
    max-width: 90%;
    max-height: 90vh;
    border-radius: var(--radius-md);
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: var(--radius-full);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===================================
   FOOTER
   =================================== */
.footer {
    padding: var(--space-xl) var(--space-md);
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + var(--space-xl));
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    text-align: center;
}

@media (min-width: 768px) {
    .footer {
        padding-bottom: var(--space-xl);
    }
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: var(--space-sm);
}

.footer-copyright {
    font-size: 0.875rem;
    color: #4b5563;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.footer-links a {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--primary);
}

/* ===================================
   UTILITIES
   =================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-sm {
    margin-top: var(--space-sm);
}

.mt-md {
    margin-top: var(--space-md);
}

.mt-lg {
    margin-top: var(--space-lg);
}

.mb-sm {
    margin-bottom: var(--space-sm);
}

.mb-md {
    margin-bottom: var(--space-md);
}

.mb-lg {
    margin-bottom: var(--space-lg);
}

.hidden {
    display: none !important;
}

@media (max-width: 767px) {
    .desktop-only {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .mobile-only {
        display: none !important;
    }
}

/* ===================================
   LOADING STATES
   =================================== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-image {
    aspect-ratio: 16 / 9;
}

.skeleton-text {
    height: 1em;
    margin-bottom: var(--space-sm);
}

.skeleton-text:last-child {
    width: 60%;
}

/* ===================================
   ANIMATIONS
   =================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease-out;
}

.animate-slideUp {
    animation: slideUp 0.4s ease-out;
}

/* Stagger animation for feed items */
.feed .card:nth-child(1) {
    animation-delay: 0s;
}

.feed .card:nth-child(2) {
    animation-delay: 0.05s;
}

.feed .card:nth-child(3) {
    animation-delay: 0.1s;
}

.feed .card:nth-child(4) {
    animation-delay: 0.15s;
}

.feed .card:nth-child(5) {
    animation-delay: 0.2s;
}

/* ===================================
   PRINT STYLES
   =================================== */
@media print {

    .header,
    .bottom-nav,
    .ad-block,
    .footer {
        display: none !important;
    }

    .main-content {
        padding: 0;
    }

    .article-image {
        break-inside: avoid;
    }
}