/* ==========================================================================
   Design System Variables
   ========================================================================== */
   :root {
    /* Colors */
    --bg-color: #ffffff; /* Clean white */
    --text-main: #111111;
    --text-muted: #666666;
    --accent-color: #000000; /* High contrast black */
    --accent-hover: #333333;
    --border-color: #eaeaea;
    --card-bg: #ffffff;
    --card-border: #eaeaea;
    --hover-bg: #f5f5f5;
    
    /* Typography */
    --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
    --font-serif: 'Lora', Georgia, serif;
    
    /* Layout */
    --container-width: 1200px;
    --container-wide: 1280px;
    --header-height: 80px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-ui);
    color: var(--text-main);
    background-color: var(--bg-color);
    line-height: 1.6;
    font-size: 1.05rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-ui);
    color: var(--text-main);
    line-height: 1.2;
    margin-bottom: 1rem;
    font-weight: 700;
}

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

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

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

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

.site-main {
    min-height: calc(100vh - var(--header-height) - 150px);
    padding: 3rem 0;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-family: var(--font-ui);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.04em;
    text-transform: lowercase;
}

.site-title:hover {
    text-decoration: none;
    color: var(--accent-color);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    padding: 0.5rem;
}

.nav-list {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 2.5rem;
}

.page-link {
    font-family: var(--font-ui);
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-decoration: none;
    letter-spacing: 0.01em;
    transition: color var(--transition-fast);
}

.page-link:hover {
    color: var(--text-main);
    text-decoration: none;
}

.nav-has-children {
    position: relative;
    cursor: pointer;
}

.nav-has-children:hover .sub-menu {
    display: block;
}

.sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    list-style: none;
    min-width: 150px;
    padding: 0.5rem 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.sub-menu li a {
    display: block;
    padding: 0.5rem 1rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
}

.sub-menu li a:hover {
    background: var(--bg-color);
    color: var(--accent-color);
}

.search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: color var(--transition-fast);
}

.search-toggle:hover {
    color: var(--accent-color);
}

/* ==========================================================================
   Home & Components
   ========================================================================== */
.home-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.hero {
    text-align: center;
    padding: 6rem 2rem 5rem;
    background: linear-gradient(180deg, var(--hover-bg) 0%, var(--bg-color) 100%);
    border-radius: 24px;
    margin: 2rem 0 4rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.hero-title {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
    font-weight: 800;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    font-weight: 400;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* Category Filter Buttons */
.category-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 100px;
    background: var(--card-bg);
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn:hover {
    border-color: var(--text-color);
    color: var(--text-color);
}

.filter-btn.active {
    background: var(--text-color);
    color: var(--bg-color);
    border-color: var(--text-color);
}

/* Vertical Post List */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.post-list-item {
    width: 100%;
}

/* All post cards in list mode: horizontal layout */
.post-list-item .post-card.has-cover {
    flex-direction: row;
}

.post-list-item .post-card-image {
    width: 280px;
    min-width: 280px;
    max-height: none;
    border-bottom: none;
    border-right: 1px solid var(--border-color);
}

@media (max-width: 640px) {
    .post-list-item .post-card.has-cover {
        flex-direction: column;
    }
    .post-list-item .post-card-image {
        width: 100%;
        min-width: 100%;
        aspect-ratio: 16 / 9;
        border-bottom: 1px solid var(--border-color);
        border-right: none;
    }
}

.post-card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.06);
    border-color: #d1d5db;
}

/* Cards without images — keep padding on the body */
.post-card .post-card-body {
    padding: 2rem;
}

/* Cards WITH cover images */
.post-card.has-cover {
    display: flex;
    flex-direction: column;
}

.post-card-image {
    flex-shrink: 0;
    width: 100%;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
    background: #f8f8f8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-card-image a {
    display: block;
    height: 100%;
}

.post-card-image img {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    transition: transform 0.3s ease;
    padding: 0.5rem;
}

.post-card:hover .post-card-image img {
    transform: scale(1.03);
}

.post-card.has-cover .post-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.post-card-meta {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.post-card-category {
    color: var(--accent-color);
    font-weight: 600;
}

.post-card-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.post-card-title a {
    color: var(--text-main);
    text-decoration: none;
}

.post-card-title a:hover {
    color: var(--accent-color);
}

.post-card-excerpt {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.post-card-footer .read-time {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.view-all {
    text-align: center;
    margin-top: 3rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--text-main);
    color: #fff;
    font-family: var(--font-ui);
    font-weight: 500;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color var(--transition-fast);
}

.btn:hover {
    background-color: var(--accent-color);
    text-decoration: none;
    color: #fff;
}

/* ==========================================================================
   Post & Page Layouts
   ========================================================================== */
.post, .page {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.post-header, .page-header {
    margin-bottom: 3rem;
    text-align: center;
}

.post-meta {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.post-title, .page-title {
    font-size: 2.5rem;
    line-height: 1.3;
}

/* Cover image in full post */
.post-cover {
    margin: 0 -2rem 2.5rem;
    border-radius: 8px;
    overflow: hidden;
}

.post-cover img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.post-cover figcaption {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.75rem;
    font-style: italic;
}

.post-content, .page-content {
    font-size: 1.125rem;
}

/* Inline images in post content */
.post-content img, .page-content img {
    border-radius: 6px;
    margin: 2rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.post-content h2, .page-content h2 {
    margin-top: 2.5rem;
}

.post-content p, .page-content p {
    margin-bottom: 1.5rem;
}

.post-content ul, .post-content ol, .page-content ul, .page-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.post-content li, .page-content li {
    margin-bottom: 0.5rem;
}

.post-content blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--text-muted);
}

.post-content pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1.5rem;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-family: monospace;
}

.post-content code {
    background: #e5e7eb;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: monospace;
}

.post-content pre code {
    background: none;
    padding: 0;
}

.post-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.back-link {
    font-family: var(--font-ui);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

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

/* ==========================================================================
   Archive
   ========================================================================== */
.archive-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.page-subtitle {
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 1.1rem;
}

.archive-year {
    font-size: 1.5rem;
    margin: 3rem 0 1.5rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.archive-item {
    display: flex;
    margin-bottom: 1.5rem;
    align-items: baseline;
}

.archive-date {
    font-family: var(--font-ui);
    color: var(--text-muted);
    min-width: 100px;
    font-size: 0.95rem;
}

.archive-title {
    font-size: 1.25rem;
    margin: 0;
}

.archive-title a {
    color: var(--text-main);
    text-decoration: none;
}

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

.archive-category {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-top: 0.25rem;
    display: inline-block;
}

/* ==========================================================================
   Contact Page
   ========================================================================== */
.contact-container {
    max-width: var(--container-wide);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.contact-container .page-header {
    text-align: center;
    margin-bottom: 3rem;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 3rem;
    align-items: start;
}

.contact-card {
    display: flex;
    gap: 1rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border-color);
}

.contact-card:first-child {
    padding-top: 0;
}

.contact-card-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: var(--bg-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
}

.contact-card-content h3 {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.contact-card-content a,
.contact-card-content p {
    display: block;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--text-main);
    margin: 0;
    line-height: 1.6;
}

.contact-card-content a:hover {
    color: var(--accent-color);
    text-decoration: none;
}

.contact-social {
    margin-top: 2rem;
}

.contact-social h3 {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.contact-social-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.social-link-item {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--text-main);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.social-link-item svg {
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.social-link-item:hover {
    color: var(--accent-color);
    text-decoration: none;
}

.social-link-item:hover svg {
    color: var(--accent-color);
}

/* Contact form */
.contact-form-wrapper {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.contact-form-wrapper h2 {
    font-size: 1.4rem;
    margin-bottom: 1.75rem;
}

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

.form-group label {
    display: block;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.4rem;
    letter-spacing: 0.02em;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--text-main);
    background: var(--bg-color);
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.08);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #9ca3af;
}

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

.btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 2rem;
    background-color: var(--accent-color);
    color: #fff;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
}

.btn-submit:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    background: var(--surface-bg);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.btn-submit:active {
    transform: translateY(0);
}

/* ==========================================================================
   Ad Slot
   ========================================================================== */
.ad-container {
    margin: 2.5rem 0;
    text-align: center;
}

.ad-label {
    display: block;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.ad-banner {
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.ad-banner a {
    display: block;
}

.ad-banner img {
    width: 100%;
    max-height: 250px;
    object-fit: cover;
    display: block;
    transition: opacity var(--transition-fast);
}

.ad-banner img:hover {
    opacity: 0.92;
}

/* ==========================================================================
   Search Overlay
   ========================================================================== */
.search-overlay {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

.search-overlay.active {
    display: block;
}

.search-container {
    display: flex;
    align-items: center;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 1rem 3rem 1rem 1rem;
    font-family: var(--font-ui);
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    outline: none;
    transition: border-color var(--transition-fast);
}

.search-input:focus {
    border-color: var(--accent-color);
}

.close-search {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
}

.search-results {
    list-style: none;
    margin-top: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.search-results li {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.search-results li:last-child {
    border-bottom: none;
}

.search-results a {
    display: block;
    font-family: var(--font-ui);
    font-size: 1.1rem;
    color: var(--text-main);
    font-weight: 500;
}

.search-results a:hover {
    color: var(--accent-color);
    text-decoration: none;
}

.search-results p {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    background-color: var(--text-main);
    color: #d1d5db;
    padding: 3.5rem 0 0;
    font-family: var(--font-ui);
    font-size: 0.9rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-brand {
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 1.3rem;
    color: #ffffff;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 0.75rem;
}

.footer-brand:hover {
    color: #ffffff;
    text-decoration: none;
}

.footer-tagline {
    color: #9ca3af;
    line-height: 1.6;
    font-size: 0.9rem;
    margin: 0;
}

.footer-heading {
    color: #ffffff;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
    font-weight: 600;
}

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

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

.footer-links a {
    color: #9ca3af;
    text-decoration: none;
    transition: color var(--transition-fast);
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: #ffffff;
    text-decoration: none;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
}

.copyright {
    color: #9ca3af;
    font-size: 0.85rem;
    margin: 0;
}

.footer-note {
    color: #6b7280;
    font-size: 0.8rem;
    margin: 0;
}

/* ==========================================================================
   Scroll to Top
   ========================================================================== */
.scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background-color var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 50;
    color: var(--text-main);
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top:hover {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    padding: 0.5rem;
    align-items: center;
}

/* ==========================================================================
   Media Queries
   ========================================================================== */
@media (max-width: 768px) {
    .menu-toggle, .mobile-menu-toggle {
        display: flex;
    }
    
    .site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--card-bg);
        border-bottom: 1px solid var(--border-color);
        padding: 1.5rem 0;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    }
    
    .site-nav.active {
        display: block;
    }
    
    .nav-list {
        flex-direction: column;
        align-items: flex-start;
        padding: 0 2rem 2rem 2rem !important; /* Ensure padding applies */
        gap: 1.5rem; /* Better vertical spacing for mobile touch targets */
    }
    
    .sub-menu {
        position: static;
        box-shadow: none;
        border: none;
        border-left: 2px solid var(--border-color);
        margin-left: 1rem;
        display: block;
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    .footer-about {
        grid-column: 1 / -1;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .post-title, .page-title {
        font-size: 2rem;
    }
    
    .archive-item {
        flex-direction: column;
    }
    
    .archive-date {
        margin-bottom: 0.25rem;
    }

    /* Post card images stack on mobile */
    .post-card.has-cover {
        flex-direction: column;
    }

    .post-card-image {
        width: 100%;
        height: 200px;
    }

    .post-cover {
        margin: 0 -1rem 2rem;
    }

    /* Contact page */
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .contact-form-wrapper {
        padding: 1.5rem;
    }
}

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

    .post-card-title {
        font-size: 1.25rem;
    }
}

/* ==========================================================================
   Firebase & Authentication
   ========================================================================== */
.auth-container {
    max-width: 400px;
    margin: 4rem auto;
    padding: 0 1rem;
}

.auth-card {
    background: #fff;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    text-align: center;
    border: 1px solid var(--border-color);
}

.auth-title {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.btn-google {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
}

.btn-google:hover {
    background: #f8f9fa;
    color: #3c4043;
    transform: translateY(-1px);
    box-shadow: 0 1px 3px rgba(60,64,67,0.1);
}

.auth-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1.5rem;
}

/* Auth state classes */
body.logged-out .logged-in-show,
body.logged-out .logged-in-only {
    display: none !important;
}

body.logged-in .logged-out-show,
body.logged-in .logged-out-only {
    display: none !important;
}

body.logged-in .logged-in-show {
    display: inline-flex !important;
}

body.logged-in .logged-in-only {
    display: block !important;
}

/* Profile */
.profile-container {
    max-width: 680px;
    margin: 3rem auto;
    padding: 0 1rem;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-info {
    flex-grow: 1;
}

.profile-info h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.profile-info p {
    color: var(--text-muted);
    margin: 0;
}

.nav-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.nav-auth-item {
    display: flex;
    align-items: center;
}

/* Interactive Elements (Likes, Votes, Bookmarks) */
.fb-interactions {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin: 2rem 0;
}

.fb-interaction-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-ui);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.fb-votes {
    background: #f3f4f6;
    border-radius: 20px;
    padding: 2px 4px;
}

.fb-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.fb-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-main);
}

.fb-btn.active.fb-like {
    color: #e11d48;
}

.fb-btn.active.fb-like svg {
    fill: #e11d48;
}

.fb-btn.active.fb-upvote {
    color: #2563eb;
}

.fb-btn.active.fb-downvote {
    color: #ea580c;
}

.fb-btn.active.fb-bookmark {
    color: #059669;
}

.fb-btn.active.fb-bookmark svg {
    fill: #059669;
}

/* Comments Section */
.fb-comments-section {
    margin-top: 3rem;
}

.fb-comments-section h3 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.fb-comment-form {
    margin-bottom: 2.5rem;
}

.fb-comment-form textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
    margin-bottom: 1rem;
    transition: border-color var(--transition-fast);
}

.fb-comment-form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.fb-comment {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.fb-comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.fb-comment-content {
    background: #f9fafb;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    flex-grow: 1;
}

.fb-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.85rem;
}

.fb-comment-header strong {
    color: var(--text-main);
    font-weight: 600;
}

.fb-comment-date {
    color: var(--text-muted);
}

.fb-comment-body {
    color: var(--text-light);
    line-height: 1.5;
    font-size: 0.95rem;
}

.no-comments {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 2rem 0;
}

/* ==========================================================================
   Auth Popup Modal
   ========================================================================== */
.auth-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.auth-popup-overlay.show {
    display: flex;
    opacity: 1;
}

.auth-popup-modal {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform var(--transition-normal);
}

.auth-popup-overlay.show .auth-popup-modal {
    transform: translateY(0);
}

.auth-popup-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
    transition: color var(--transition-fast);
}

.auth-popup-close:hover {
    color: var(--accent-color);
}

.auth-popup-modal h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: var(--text-main);
}

.auth-popup-quote {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.auth-popup-actions .btn {
    width: 100%;
}

/* ==========================================================================
   Distribution Engine UI
   ========================================================================== */

/* 1. Newsletter Inline Form */
.newsletter-inline {
    grid-column: 1 / -1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 1rem 0 0 0;
}

@media (min-width: 768px) {
    .newsletter-inline {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 1.5rem 2rem;
    }
}

.newsletter-inline-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.95rem;
    color: #e5e7eb;
    flex: 1;
}

.newsletter-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.newsletter-inline-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

@media (min-width: 480px) {
    .newsletter-inline-form {
        flex-direction: row;
        max-width: 400px;
    }
}

.newsletter-inline-form input {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.newsletter-inline-form input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.newsletter-inline-form input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.newsletter-inline-form button {
    white-space: nowrap;
    border-radius: 8px;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    background: #ffffff;
    color: #000000;
    border: none;
}

.newsletter-inline-form button:hover {
    background: #e5e7eb;
}

.newsletter-status {
    grid-column: 1 / -1;
    margin-top: -0.5rem;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    text-align: center;
    width: 100%;
}

.status-success {
    background: rgba(34, 197, 94, 0.1);
    color: #166534;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-error {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

@media (prefers-color-scheme: dark) {
    .status-success { color: #4ade80; }
    .status-error { color: #f87171; }
}

/* 2. Push Notification Banner */
.push-prompt-banner {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    position: relative;
    z-index: 90;
}

@media (min-width: 768px) {
    .push-prompt-banner {
        flex-direction: row;
        justify-content: space-between;
        padding: 0.75rem 2rem;
    }
}

.push-banner-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 500;
}

.push-banner-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.25rem;
    transition: color 0.2s;
}

.btn-close:hover {
    color: var(--text-main);
}

/* 3. Website Notification Center */
.notif-container {
    position: relative;
    display: flex;
    align-items: center;
}

.notif-toggle {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    position: relative;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.notif-toggle:hover {
    background: var(--hover-bg);
    color: var(--accent-color);
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-color);
}

.notif-panel {
    position: absolute;
    top: calc(100% + 15px);
    right: -60px; /* Mobile alignment */
    width: 340px;
    max-width: calc(100vw - 2rem);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.12);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.98);
    transform-origin: top right;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.25s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (min-width: 768px) {
    .notif-panel {
        right: 0;
    }
}

.notif-panel.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.notif-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-color);
}

.notif-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.notif-mark-read {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: color 0.2s, background-color 0.2s;
}

.notif-mark-read:hover {
    color: var(--accent-color);
    background: var(--hover-bg);
}

.notif-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
}

.notif-empty {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.notif-empty .empty-icon {
    font-size: 2.5rem;
    opacity: 0.7;
}

.notif-empty p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.notif-item {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s;
    position: relative;
}

.notif-item:hover {
    background: var(--hover-bg);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item.unread {
    background: rgba(37, 99, 235, 0.03); /* Subtle blue tint */
}

@media (prefers-color-scheme: dark) {
    .notif-item.unread {
        background: rgba(59, 130, 246, 0.08);
    }
}

.notif-item.unread::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0.4rem;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-color);
}

.notif-img {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--border-color);
}

.notif-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.notif-category {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-color);
    margin-bottom: 0.35rem;
    display: block;
    letter-spacing: 0.5px;
}

.notif-title {
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.notif-footer {
    padding: 1rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

.notif-view-all {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.2s;
}

.notif-view-all:hover {
    color: var(--accent-color);
}

/* ==========================================================================
   Homepage Newsletter Section
   ========================================================================== */
.home-newsletter-section {
    margin: 4rem 0;
}

.home-newsletter-container {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(16, 185, 129, 0.05));
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
    text-align: center;
}

@media (min-width: 900px) {
    .home-newsletter-container {
        flex-direction: row;
        text-align: left;
        justify-content: space-between;
        padding: 4rem;
    }
}

.home-newsletter-text {
    flex: 1;
    max-width: 600px;
}

.home-newsletter-text h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.home-newsletter-text p {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.home-newsletter-form-wrapper {
    flex: 1;
    width: 100%;
    max-width: 500px;
}

.home-newsletter-form-wrapper .newsletter-inline {
    margin: 0;
    background: var(--card-bg);
    flex-direction: column !important; /* Force column layout to prevent squishing in split view */
    align-items: stretch !important;
}

.home-newsletter-form-wrapper .newsletter-inline-content {
    color: var(--text-main);
}

.home-newsletter-form-wrapper .newsletter-icon {
    background: var(--hover-bg);
    color: var(--text-main);
}

.home-newsletter-form-wrapper .newsletter-inline-form {
    max-width: 100% !important;
    flex-direction: column !important;
}

@media (min-width: 400px) {
    .home-newsletter-form-wrapper .newsletter-inline-form {
        flex-direction: row !important;
    }
}

.home-newsletter-form-wrapper .newsletter-inline-form input {
    background: var(--bg-color);
    color: var(--text-main);
    border-color: var(--border-color);
}

.home-newsletter-form-wrapper .newsletter-inline-form input::placeholder {
    color: var(--text-muted);
}

.home-newsletter-form-wrapper .newsletter-inline-form button {
    background: var(--text-main);
    color: var(--bg-color);
}

/* ==========================================================================
   PWA Install Banner
   ========================================================================== */
.pwa-install-banner,
.notif-permission-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-install-inner,
.notif-prompt-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    max-width: 800px;
    width: 100%;
}

.pwa-install-icon img {
    border-radius: 12px;
    flex-shrink: 0;
}

.pwa-install-text,
.notif-prompt-text {
    flex: 1;
    min-width: 0;
}

.pwa-install-text strong,
.notif-prompt-text strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.15rem;
}

.pwa-install-text span,
.notif-prompt-text span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.pwa-install-actions,
.notif-prompt-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.pwa-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.25rem;
    transition: color 0.2s;
}

.pwa-dismiss:hover {
    color: var(--text-main);
}

.notif-prompt-icon {
    font-size: 2.25rem;
    flex-shrink: 0;
}

/* PWA Slide Animations */
@keyframes pwaSlideIn {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes pwaSlideOut {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(100%); opacity: 0; }
}

.pwa-slide-in {
    animation: pwaSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.pwa-slide-out {
    animation: pwaSlideOut 0.35s ease-in forwards;
}

/* ==========================================================================
   iOS Install Modal (Bottom Sheet)
   ========================================================================== */
.ios-install-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.ios-install-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.ios-install-sheet {
    position: relative;
    background: var(--card-bg);
    border-radius: 20px 20px 0 0;
    padding: 1.25rem 1.5rem 2rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15);
    animation: pwaSlideIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.ios-install-handle {
    width: 40px;
    height: 5px;
    border-radius: 100px;
    background: var(--border-color);
    margin: 0 auto 1.25rem;
}

.ios-install-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ios-install-header strong {
    display: block;
    font-size: 1.1rem;
    color: var(--text-main);
    font-weight: 700;
}

.ios-install-header span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.ios-install-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ios-step {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.5;
}

.ios-step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #0f4c81;
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .pwa-install-inner,
    .notif-prompt-inner {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 1rem;
    }

    .pwa-install-text span,
    .notif-prompt-text span {
        font-size: 0.75rem;
    }

    .pwa-install-actions,
    .notif-prompt-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ==========================================================================
   DSA Lab — Hub Page
   ========================================================================== */
.dsa-hub {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.dsa-hero {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2.5rem 1rem;
}

.dsa-hero-badge {
    display: inline-block;
    padding: 0.3rem 0.9rem;
    border-radius: 100px;
    background: #0f4c81;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.dsa-hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.dsa-hero p {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

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

.dsa-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--card-bg);
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.25s ease;
    overflow: hidden;
}

.dsa-card:hover {
    border-color: #0f4c81;
    box-shadow: 0 8px 30px rgba(15, 76, 129, 0.08);
    transform: translateY(-3px);
}

.dsa-card-coming {
    opacity: 0.55;
    cursor: default;
    pointer-events: none;
}

.dsa-card-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #f0f4f8;
    color: #0f4c81;
}

.dsa-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
}

.dsa-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.dsa-card-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.dsa-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: 100px;
    background: #e8f0fe;
    color: #0f4c81;
    font-weight: 600;
}

.dsa-card-status {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.5rem;
    border-radius: 100px;
}

.dsa-card-status.live {
    background: #d1fae5;
    color: #059669;
}

.dsa-card-status.soon {
    background: #fef3c7;
    color: #d97706;
}

/* ==========================================================================
   DSA Lab — Visualizer Pages
   ========================================================================== */
.dsa-visualizer {
    max-width: var(--container-wide);
    margin: 0 auto;
    padding: 1.5rem 1.5rem 4rem;
}

.dsa-viz-header {
    margin-bottom: 1.5rem;
}

.dsa-back {
    display: inline-block;
    font-size: 0.85rem;
    color: #0f4c81;
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 0.75rem;
    transition: opacity 0.2s;
}

.dsa-back:hover { opacity: 0.7; }

.dsa-viz-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.4rem;
}

.dsa-viz-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.dsa-viz-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 900px) {
    .dsa-viz-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .dsa-code-panel {
        position: static; /* Remove sticky on mobile to prevent layout bugs */
        max-height: 50vh;
    }
}

@media (max-width: 768px) {
    .dsa-viz-header h1 {
        font-size: 1.6rem;
    }
    .dsa-visualizer {
        padding: 1rem 0 3rem;
        overflow-x: hidden;
        width: 100%;
    }
    .dsa-viz-main {
        min-width: 0;
        width: 100%;
    }
    .dsa-controls {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
    }
    .dsa-control-group {
        width: 100%;
        min-width: 100%;
    }
    .dsa-control-group input[type="range"],
    .dsa-control-group input[type="number"],
    .dsa-control-group input[type="text"],
    .dsa-control-group select {
        width: 100%;
        box-sizing: border-box;
    }
    .dsa-control-buttons {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    .dsa-control-buttons .btn {
        width: 100%;
    }
    .dsa-canvas-wrap {
        width: 100%;
        box-sizing: border-box;
    }
    .dsa-canvas-stats {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    .dsa-complexity table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        width: 100%;
    }
    .dsa-code-panel {
        margin-top: 1rem;
    }
}

/* Controls */
.dsa-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1rem;
}

.dsa-control-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
    min-width: 120px;
}

.dsa-control-group label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.dsa-control-group select,
.dsa-control-group input[type="range"],
.dsa-control-group input[type="number"],
.dsa-control-group input[type="text"] {
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--card-bg);
    color: var(--text-main);
    width: 100%;
}

.dsa-control-group input[type="range"] {
    accent-color: #0f4c81;
}

.dsa-control-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.dsa-control-buttons .btn {
    flex: 1;
    min-width: 80px;
    text-align: center;
}

.btn-secondary {
    display: inline-block;
    padding: 0.45rem 0.9rem;
    background: var(--hover-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* Canvas */
.dsa-canvas-wrap {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: #0d1117;
}

.dsa-canvas-wrap canvas,
.dsa-canvas-wrap svg {
    display: block;
    width: 100%;
}

.dsa-canvas-stats {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
    background: #161b22;
    color: #8b949e;
    font-size: 0.8rem;
    border-top: 1px solid #21262d;
}

.dsa-canvas-stats strong {
    color: #e6edf3;
}

/* Complexity Table */
.dsa-complexity {
    margin-top: 1.25rem;
}

.dsa-complexity h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.dsa-complexity table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.dsa-complexity th,
.dsa-complexity td {
    padding: 0.55rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.dsa-complexity th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dsa-complexity tr.active {
    background: #e8f0fe;
    font-weight: 600;
}

/* ==========================================================================
   DSA Lab — Code Panel
   ========================================================================== */
.dsa-code-panel {
    border: 1px solid #21262d;
    border-radius: 12px;
    overflow: hidden;
    background: #0d1117;
    position: sticky;
    top: 100px;
}

.dsa-code-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: #161b22;
    border-bottom: 1px solid #21262d;
}

.dsa-code-dots {
    display: flex;
    gap: 6px;
}

.dsa-code-dots .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }

.dsa-code-lang {
    flex: 1;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: #8b949e;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.dsa-code-copy {
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    transition: color 0.2s;
}

.dsa-code-copy:hover {
    color: #e6edf3;
}

.dsa-code-block {
    margin: 0;
    padding: 1.25rem 1rem;
    overflow-x: auto;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.65;
    color: #e6edf3;
    white-space: pre;
    tab-size: 4;
    max-height: 600px;
    overflow-y: auto;
}

/* ==========================================================================
   DSA Lab — Homepage Card
   ========================================================================== */
.dsa-home-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--card-bg);
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.25s ease;
    margin-bottom: 2rem;
}

.dsa-home-card:hover {
    border-color: #0f4c81;
    box-shadow: 0 8px 30px rgba(15, 76, 129, 0.08);
    transform: translateY(-2px);
}

.dsa-home-card-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: #0f4c81;
    color: #fff;
    flex-shrink: 0;
}

.dsa-home-card-text h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.dsa-home-card-text p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

@media (max-width: 500px) {
    .dsa-hero h1 { font-size: 1.75rem; }
    .dsa-grid { grid-template-columns: 1fr; }
    .dsa-home-card { flex-direction: column; text-align: center; }
}

/* ==========================================================================
   Daily DSA Problem Cards & Spotlight
   ========================================================================== */
.daily-dsa-spotlight {
    margin: 4rem 0;
    padding: 2rem;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(15, 76, 129, 0.1), rgba(37, 99, 235, 0.05));
    border: 1px solid rgba(37, 99, 235, 0.2);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .daily-dsa-spotlight {
        flex-direction: row;
        align-items: center;
        padding: 3rem;
        gap: 3rem;
    }
}

.daily-dsa-spotlight-content {
    flex: 1;
}

.daily-dsa-spotlight-content h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.daily-dsa-spotlight-content p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.daily-dsa-spotlight-image {
    flex: 1;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.daily-dsa-spotlight-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.daily-dsa-spotlight:hover .daily-dsa-spotlight-image img {
    transform: scale(1.05);
}

.dsa-problem-card {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text-main);
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
}

.dsa-problem-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    border-color: rgba(37, 99, 235, 0.5);
}

.dsa-problem-card h3 {
    font-size: 1.1rem;
    margin: 0.5rem 0;
    line-height: 1.4;
}

.dsa-problem-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 1rem 0;
    flex: 1;
}

.dsa-problem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.dsa-problem-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-ui);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.difficulty-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.difficulty-badge.easy {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.difficulty-badge.medium {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.difficulty-badge.hard {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.dsa-daily-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 2rem;
}

@media (min-width: 600px) {
    .dsa-daily-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 900px) {
    .dsa-daily-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}
