/* CSOH.org Website */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --text-color: #333;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --border-color: #dee2e6;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-bg);
    /* Optimize font rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Skip to content link (accessibility) */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: var(--white);
    text-decoration: none;
    border-radius: 0 0 6px 6px;
    font-weight: 600;
}

.skip-link:focus {
    top: 0;
}

/* Visually hidden (accessible to screen readers) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Hamburger button (hidden on desktop) */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--white);
    font-size: 1.5rem;
    line-height: 1;
}

/* Header & Navigation */
header {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 1rem 0;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 1000;
    /* Performance optimization */
    contain: layout style;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.logo p {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

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

nav a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
}

nav a:hover {
    opacity: 0.8;
}

/* Header tweaks: logo layout, active link, and focus states */
.logo {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.logo-link {
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
}

.header-content .logo h1 {
    margin: 0;
    line-height: 1;
}



nav a {
    transition: opacity 0.3s, background-color 0.15s, transform 0.12s;
}

nav a.active,
nav a[aria-current="page"] {
    background-color: rgba(255, 255, 255, 0.08);
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
}

nav a:focus {
    outline: 3px solid rgba(52, 152, 219, 0.18);
    outline-offset: 2px;
    border-radius: 6px;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #ffffff;
    padding: 4rem 2rem;
    text-align: center;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #ffffff;
}

.hero p {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto 2rem;
    opacity: 0.95;
    color: #ffffff;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-block;
}

.btn-primary {
    background-color: var(--accent-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--white);
    color: var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--light-bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Main Content */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.section {
    margin-bottom: 4rem;
}

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

.section h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 2rem 0 1rem;
}


/* Filter/Search Bar */

.filter-bar {
    padding: 1.25rem 1.5rem;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.search-box {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Primary search input */
#searchInput {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.75rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-color);
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#searchInput::placeholder {
    color: var(--text-muted, #94a3b8);
    font-size: 0.95rem;
}

#searchInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.14);
    background: var(--white);
}

/* Search icon injected via the .search-wrapper div that main.js creates */
.search-wrapper::before {
    content: '';
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    width: 17px;
    height: 17px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath fill-rule='evenodd' d='M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    pointer-events: none;
    z-index: 1;
}

/* Dark mode: search bar */
[data-theme="dark"] .filter-bar {
    background: #1a2535;
    border-color: #2d3f55;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] #searchInput {
    background: #1e2a3a;
    border-color: #2d3f55;
    color: var(--text-color);
}

[data-theme="dark"] #searchInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    background: #162030;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-buttons h4 {
    flex-basis: 100%;
    width: 100%;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.filter-buttons h4:first-child {
    margin-top: 0;
}

#topContributors,
#allContributors {
    display: contents;
}

#allContributors[style*="display: none"] {
    display: none !important;
}

#allContributors[style*="display: none"] .filter-btn {
    display: none !important;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background-color: var(--white);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.filter-btn:hover,
.filter-btn.active {
    background-color: var(--secondary-color);
    color: var(--white);
    border-color: var(--secondary-color);
}

.show-all-btn {
    padding: 0.6rem 1.5rem;
    border: 2px solid var(--primary-color);
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0.5rem 0;
}

.show-all-btn:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Search Filter Container Layout */
.search-filter-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.search-filter-container #searchInput {
    flex: 1;
    min-width: min(300px, 100%);
}

.search-filter-container .show-all-btn {
    margin: 0;
}

/* Force hide date filter containers when not in use */
#startDateContainer,
#endDateContainer,
#singleDateContainer {
    transition: all 0.2s ease;
}

#startDateContainer[style*="display: none"],
#endDateContainer[style*="display: none"],
#singleDateContainer[style*="display: none"] {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
}

/* Resource Cards Grid */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Resources page: use flex layout to avoid empty grid slots */
.category-section .resource-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 2rem;
    font-size: 0;
}

.category-section .card-link {
    display: block;
    flex: 0 0 min(350px, 100%);
    font-size: 1rem;
}

.presentations-page .resource-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 2rem;
}

.presentations-page .card-link {
    display: block;
    flex: 0 0 min(350px, 100%);
}

/* No results message for empty search/filter */
.no-results {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #666;
    font-size: 1.1rem;
}

.no-results p {
    margin: 0;
}

.clear-search-btn {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    font-size: inherit;
    text-decoration: underline;
    padding: 0;
}

.clear-search-btn:hover {
    color: var(--primary-color);
}

.resource-card {
    background-color: var(--white);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    border-left: 4px solid var(--secondary-color);
    position: relative;
    /* Block layout: content stacks vertically inside card */
    display: block;
    /* Performance optimization: contain layout and paint */
    contain: layout style paint;
}

.resource-card .resource-preview {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 6px;
    margin: 0 0 1rem 0;
    border: 1px solid var(--border-color);
    display: block;
    /* Optimize image rendering */
    image-rendering: -webkit-optimize-contrast;
}

/* News page: use the same card sizing as the rest of the site */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* News page: use flex layout for fixed-width cards like Resources and Presentations */
.news-page .resources-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 2rem;
    font-size: 0;
}

.news-page .card-link {
    display: block;
    flex: 0 0 min(350px, 100%);
    font-size: 1rem;
}

.card-link .resource-card {
    height: 100%;
}

.card-link:hover .resource-card {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-left-color: var(--primary-color);
    cursor: pointer;
}

/* News page typography alignment */
.news-page .hero h2 {
    font-size: 2.5rem;
}

.news-page .hero p {
    font-size: 1.2rem;
}

.news-page .resource-card h3 {
    font-size: 1.25rem;
}

.news-page .resource-card p {
    font-size: 1rem;
}

.news-page .filter-btn {
    font-size: 0.9rem;
}

.resource-card-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
    font-size: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: white;
    pointer-events: none;
}

.resource-card-icon.ctf {
    background: linear-gradient(135deg, #e65100, #ff6f00);
}

.resource-card-icon.tool {
    background: linear-gradient(135deg, #6a1b9a, #8e24aa);
}

.resource-card-icon.certification {
    background: linear-gradient(135deg, #1565c0, #1976d2);
}

.resource-card-icon.lab {
    background: linear-gradient(135deg, #c2185b, #d81b60);
}

.resource-card-icon.ai {
    background: linear-gradient(135deg, #00796b, #009688);
}

.resource-card-icon.kubernetes {
    background: linear-gradient(135deg, #326ce5, #5e8ceb);
}

.resource-card h3 {
    font-size: 1.25rem;
    margin: 0 0 0.75rem 0;
    color: var(--primary-color);
    /* Better word wrapping for long URLs */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: none;
}

.resource-card h3 a {
    color: var(--primary-color);
    text-decoration: none;
}

.resource-card h3 a:hover {
    color: var(--secondary-color);
}

.article-date {
    font-size: 0.875rem;
    color: #666;
    margin: 0 0 1rem 0;
    font-weight: 500;
    flex-basis: 100%;
    width: 100%;
}

.resource-card p {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.resource-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.tag {
    background-color: var(--light-bg);
    color: var(--text-color);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 500;
}

.tag.new {
    background-color: #e8f5e9;
    color: #2e7d32;
    font-weight: 600;
}

.source {
    font-size: 0.9rem;
    color: var(--secondary-color);
    font-weight: 500;
}

.tag.ctf {
    background-color: #fff3e0;
    color: #e65100;
}

.tag.certification {
    background-color: #e3f2fd;
    color: #1565c0;
}

.tag.tool {
    background-color: #f3e5f5;
    color: #6a1b9a;
}

.tag.lab {
    background-color: #fce4ec;
    color: #c2185b;
}

/* Category Sections */
.category-section {
    margin-bottom: 3rem;
}

.category-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 1rem;
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.category-section h3:hover {
    background-color: var(--light-bg);
}

.category-section h3:focus {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}

.category-section h3:focus:not(:focus-visible) {
    outline: none;
}

.category-section h3:focus-visible {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}

.category-section h3::before {
    content: '▼';
    font-size: 0.8rem;
    transition: transform 0.3s;
}

.category-section.collapsed h3::before {
    transform: rotate(-90deg);
}

.category-content {
    margin-top: 1rem;
}

.category-section.collapsed .category-content {
    display: none;
}

/* Resource List (Alternative to Grid) */
.resource-list {
    list-style: none;
}

.resource-list li {
    background-color: var(--white);
    padding: 1rem 1.5rem;
    margin-bottom: 0.75rem;
    border-radius: 5px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--secondary-color);
    transition: all 0.3s;
}

.resource-list li:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-lg);
}

.resource-list a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.05rem;
}

.resource-list a:hover {
    color: var(--secondary-color);
}

.resource-list .description {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Stats/Info Boxes */
.info-boxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.info-box {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
}

.info-box h3 {
    font-size: 2.5rem;
    color: var(--secondary-color);
    margin: 0 0 0.5rem 0;
}

.info-box p {
    color: #666;
    font-size: 1rem;
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 3rem 2rem 1rem;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: var(--white);
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: var(--white);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

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

    /* Typography adjustments */
    body {
        font-size: 16px;
    }

    /* Header and Navigation - MINIMAL HEADER */
    header {
        padding: 0.5rem 0;
        position: static;
        /* Not sticky to save space */
    }

    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
        padding: 0 0.5rem;
        flex-wrap: nowrap;
    }

    /* Logo - TINY */
    .logo h1 {
        font-size: 1rem;
        margin: 0;
        line-height: 1.2;
    }

    .logo p {
        display: none;
        /* Hide tagline on mobile */
    }

    /* Navigation - HAMBURGER TOGGLE WITH NO-JS FALLBACK */
    .hamburger {
        display: block;
        order: 2;
    }

    .theme-toggle {
        order: 1;
    }

    /* Without JS: nav stays visible as fallback */
    header nav {
        display: block;
        width: 100%;
        order: 3;
    }

    /* With JS: nav hidden until hamburger toggled */
    /* Scoped to header nav so breadcrumb-nav & incident-tabs stay visible */
    .js-enabled header nav {
        display: none;
    }
    .js-enabled header .nav-open nav {
        display: block;
    }

    nav ul {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0.15rem 0;
        margin: 0;
    }

    nav ul li a {
        display: block;
        padding: 0.35rem 0.75rem;
        font-size: 0.85rem;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        white-space: nowrap;
        min-height: 32px;
    }

    /* Hero section - MINIMAL */
    .hero {
        padding: 1rem 1rem;
    }

    .hero h2 {
        font-size: 1.3rem;
        line-height: 1.2;
        margin-bottom: 0.5rem;
    }

    .hero p {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }

    /* Container padding - COMPACT */
    .container {
        padding: 0 0.75rem;
    }

    section {
        padding: 1.5rem 0;
    }

    /* Search and filters - COMPACT */
    .search-filter-container {
        padding: 0.75rem;
    }

    .search-box {
        flex-direction: column;
        gap: 1rem;
    }

    .search-box input,
    #searchInput {
        width: 100%;
        font-size: 16px;
        /* Prevents iOS zoom on focus */
    }

    .filter-buttons {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .filter-btn {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
        flex: 1 1 auto;
        min-width: fit-content;
    }

    /* Resource grid */
    .resource-grid,
    .resources-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }

    .resource-card {
        padding: 1.25rem;
        overflow: hidden;
    }

    /* News page responsive: hide images on mobile, show text only */
    .resources-grid .resource-card {
        display: block;
    }

    .resources-grid .resource-card .resource-preview {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        max-width: 0 !important;
        margin: 0 !important;
    }

    .resource-card h3 {
        font-size: 1.1rem;
    }

    .resource-card p {
        font-size: 0.95rem;
    }

    .resource-tags {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .tag {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
    }

    /* Buttons */
    .btn {
        width: 100%;
        text-align: center;
        padding: 1rem;
        font-size: 1rem;
    }

    .cta-buttons {
        flex-direction: column;
        gap: 1rem;
    }

    .cta-buttons .btn {
        width: 100%;
    }

    /* Statistics boxes */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-box h3 {
        font-size: 2rem;
    }

    /* Info boxes */
    .info-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .info-box {
        padding: 1.5rem;
    }

    /* Session cards */
    .sessions-grid {
        grid-template-columns: 1fr;
    }

    .session-card {
        padding: 1.25rem;
    }

    /* Footer */
    footer {
        padding: 2rem 1rem 1rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        text-align: center;
    }

    .footer-section ul {
        padding: 0;
    }

    /* Memorial page specific */
    .memorial-content {
        padding: 1rem;
    }

    .memorial-image {
        max-width: 100%;
        margin: 1rem 0;
    }

    iframe {
        max-width: 100%;
        height: 400px;
    }

    /* Tables */
    table {
        font-size: 0.9rem;
    }

    th,
    td {
        padding: 0.5rem;
    }

    /* Reduce whitespace */
    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.3rem;
    }

    /* Contribute page - mobile adjustments */
    .contribute-article {
        padding: 0 0.25rem;
    }

    .contribute-article h2 {
        font-size: 1.3rem;
        word-wrap: break-word;
    }

    .contribute-article h3 {
        font-size: 1.1rem;
    }

    .contribute-article ol,
    .contribute-article ul {
        padding-left: 1.25rem;
    }

    .contribute-article ol li,
    .contribute-article ul li {
        margin-bottom: 0.5rem;
        line-height: 1.5;
    }

    .highlight-box ol,
    .highlight-box ul {
        padding-left: 1.25rem;
    }

    .code-block {
        font-size: 0.8em;
        padding: 0.75rem;
        word-break: break-word;
        white-space: pre-wrap;
    }

    .contribution-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .contribution-type {
        padding: 1rem;
    }

    .reader-card {
        padding-top: 0;
    }

    .reader-preview {
        margin: 0 -1rem;
        width: calc(100% + 2rem);
    }

    .toc {
        padding: 1rem;
    }

    .highlight-box {
        padding: 0.75rem;
    }

    .faq-item {
        padding: 0.75rem;
    }
}

/* Extra small devices (phones in portrait, less than 576px) */
@media (max-width: 576px) {
    nav ul li a {
        font-size: 0.68rem;
        padding: 0.3rem 0.45rem;
    }

    .hero {
        padding: 0.75rem 0.75rem;
    }

    .hero h2 {
        font-size: 1.1rem;
    }

    .hero p {
        font-size: 0.85rem;
    }

    .filter-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    .tag {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    .resource-card h3 {
        font-size: 1rem;
    }

    /* News page phone: images still hidden */
    .resources-grid .resource-card .resource-preview {
        display: none !important;
    }

    .stat-box h3 {
        font-size: 1.5rem;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 1rem;
}

.mt-2 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 1rem;
}

.mb-2 {
    margin-bottom: 2rem;
}

.hidden {
    display: none;
}

/* Mobile touch improvements */
@media (hover: none) and (pointer: coarse) {

    /* Improve touch targets on mobile */
    a,
    button,
    .filter-btn,
    .btn {
        min-height: 44px;
        /* iOS recommended touch target */
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .resource-card:hover,
    .session-card:hover {
        transform: none;
    }

    /* But keep active state for feedback */
    .resource-card:active,
    .session-card:active {
        transform: scale(0.98);
    }

    .btn:active,
    .filter-btn:active {
        transform: scale(0.95);
    }
}

/* Prevent text selection issues on mobile */
@media (max-width: 768px) {

    .filter-btn,
    .tag {
        user-select: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Improve scrolling performance on mobile */
@media (max-width: 768px) {
    * {
        -webkit-overflow-scrolling: touch;
    }

    body {
        overflow-x: hidden;
    }
}

/* ==========================================================================
   Utility classes (replacing inline styles)
   ========================================================================== */

.hero--compact {
    padding: 3rem 2rem;
}

.steps-box {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.steps-box h3+h3,
.steps-box h3~h3 {
    margin-top: 2rem;
}

.btn--mt {
    margin-top: 1rem;
}

.link--accent {
    color: var(--secondary-color);
}

/* ==========================================================================
   Contribute page styles
   ========================================================================== */

.contribute-article {
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.8;
}

.contribute-article h2 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.contribute-article h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--secondary-color);
}

.contribute-article p {
    margin-bottom: 1rem;
}

.contribute-article ol,
.contribute-article ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.contribute-article ol li,
.contribute-article ul li {
    margin-bottom: 0.4rem;
}

.code-block {
    background-color: #f5f5f5;
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.highlight-box {
    background-color: #e8f4f8;
    border-left: 4px solid #0096d1;
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 4px;
    color: #1a232a;
    font-weight: 500;
}

.highlight-box strong {
    color: var(--primary-color);
}

.contribution-type {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    color: #1a232a;
    font-weight: 500;
}

.reader-card {
    padding-top: 0;
    overflow: hidden;
}

.reader-preview {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px 8px 0 0;
    margin: 0 -1.5rem;
    width: calc(100% + 3rem);
    margin-bottom: 1rem;
}

.contribution-type h4 {
    color: var(--primary-color);
    margin-top: 0;
    font-size: 1.1em;
}

.contribution-type .examples {
    background-color: #fffbea;
    padding: 0.75rem;
    border-radius: 4px;
    margin: 0.75rem 0;
}

.contribution-type .have-idea {
    background-color: #e8f4f8;
    padding: 0.75rem;
    border-radius: 4px;
    margin: 0.75rem 0;
}

.step-box {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.step-number {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    text-align: center;
    line-height: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.step-box h3 {
    margin-top: 0;
}

.link-box {
    background-color: #fffbea;
    border-left: 4px solid #ffc107;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

.link-box a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
}

.link-box a:hover {
    text-decoration: underline;
}

.faq-item {
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: #f9f9f9;
    border-left: 4px solid var(--primary-color);
}

.faq-item strong {
    color: var(--primary-color);
}

.breadcrumb {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.9em;
    color: #666;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    margin: 0 0.25rem;
}

.toc {
    background-color: #f0f7ff;
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 4px;
}

.toc h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.toc ol {
    margin-bottom: 0;
}

.toc li {
    margin-bottom: 0.5rem;
}

.toc a {
    text-decoration: none;
    color: var(--primary-color);
}

.toc a:hover {
    text-decoration: underline;
}

.contribution-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

/* =========================================================================
   UTILITY CLASSES (replaces inline style="" attributes for CSP compliance)
   ========================================================================= */

.mt-1 {
    margin-top: 1rem;
}

.mt-1\.5 {
    margin-top: 1.5rem;
}

.mt-2 {
    margin-top: 2rem;
}

.mt-3 {
    margin-top: 3rem;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 1rem;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: #666;
}

.font-up {
    font-size: 1.05em;
}

/* =========================================================================
   INDEX.HTML — Community section cards & grid
   ========================================================================= */

.community-card {
    background-color: var(--white);
    padding: 1rem;
    color: #1a232a;
    font-weight: 600;
    font-size: 1.05em;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.community-card .btn {
    margin-top: auto;
    align-self: flex-start;
}

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

.community-heading {
    color: var(--primary-color);
    margin-top: 0;
}

.info-list {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    list-style-position: inside;
}

.info-list li {
    margin-bottom: 1rem;
}

.hero-img {
    max-width: 100%;
    height: auto;
    margin-bottom: 20px;
    border-radius: 8px;
}

.memorial-link {
    color: var(--secondary-color);
}

/* =========================================================================
   KEVIN-MITNICK.HTML — Memorial page (moved from <style> block)
   ========================================================================= */

.memorial-content {
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.8;
}

.memorial-content p {
    margin-bottom: 1.5em;
}

.memorial-content h2 {
    margin-top: 2em;
    margin-bottom: 1em;
    color: var(--primary-color);
}

.memorial-image {
    width: 100%;
    max-width: 600px;
    margin: 2em auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.signature {
    font-style: italic;
    margin-top: 2em;
}

.date {
    color: var(--text-muted, #666);
    font-size: 0.9em;
}

.iframe-container {
    margin: 2em 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.iframe-container iframe {
    width: 100%;
    height: 800px;
    border: none;
    background-color: #ffffff;
}

.memorial-title {
    text-align: center;
    margin-bottom: 0.5em;
}

.memorial-subtitle {
    text-align: center;
    color: var(--text-muted, #666);
    font-size: 1.1em;
    margin-bottom: 2em;
}

/* Wired article card */
.wired-card-link {
    display: inline-block;
    width: 100%;
    text-decoration: none;
    margin: 20px 0;
}

.wired-card {
    background: linear-gradient(135deg, #f0f0f0 0%, #ffffff 100%);
    border: 2px solid #dd4814;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.wired-card:hover {
    box-shadow: 0 8px 24px rgba(221, 72, 20, 0.2);
    transform: translateY(-2px);
}

.wired-card-inner {
    display: flex;
    align-items: center;
    gap: 16px;
}

.wired-card-icon {
    font-size: 48px;
    min-width: 60px;
}

.wired-card-label {
    color: #1a232a;
    font-weight: 700;
    font-size: 1.08em;
    letter-spacing: 1px;
}

.wired-card-title {
    color: #333;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 8px;
}

.wired-card-desc {
    color: #666;
    font-size: 14px;
}

/* =========================================================================
   CONTRIBUTE-RESOURCES.HTML — Tutorial page (moved from <style> block)
   ========================================================================= */

.contribute-article {
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.8;
}

.contribute-article h2 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.contribute-article h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--secondary-color);
}

.contribute-article p {
    margin-bottom: 1rem;
}

.contribute-article ol,
.contribute-article ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.contribute-article ol li,
.contribute-article ul li {
    margin-bottom: 0.4rem;
}

.code-block {
    background-color: #f5f5f5;
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.highlight-box {
    background-color: #e8f4f8;
    border-left: 4px solid #0096d1;
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.highlight-box strong {
    color: var(--primary-color);
}

.step-box {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.step-number {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    text-align: center;
    line-height: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.step-box h3 {
    margin-top: 0;
}

.tag-example {
    display: inline-block;
    background-color: #ddd;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    margin: 0.25rem;
    font-size: 0.9em;
}

.tag-example.ctf {
    background-color: #20c997;
    color: white;
}

.tag-example.tool {
    background-color: #9c27b0;
    color: white;
}

.tag-example.lab {
    background-color: #4caf50;
    color: white;
}

.tag-example.certification {
    background-color: #2196f3;
    color: white;
}

.tag-example.job {
    background-color: #e91e63;
    color: white;
}

.link-box {
    background-color: #fffbea;
    border-left: 4px solid #ffc107;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

.link-box a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
}

.link-box a:hover {
    text-decoration: underline;
}

.faq-item {
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: #f9f9f9;
    border-left: 4px solid var(--primary-color);
}

.faq-item strong {
    color: var(--primary-color);
}

.breadcrumb {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.9em;
    color: #666;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    margin: 0 0.25rem;
}

.toc {
    background-color: #f0f7ff;
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 4px;
}

.toc h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.toc ol {
    margin-bottom: 0;
}

.toc li {
    margin-bottom: 0.5rem;
}

.toc a {
    text-decoration: none;
    color: var(--primary-color);
}

.toc a:hover {
    text-decoration: underline;
}

/* =========================================================================
   404.HTML / 403.HTML — Error pages (moved from <style> block)
   ========================================================================= */

.error-container {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.error-code {
    font-size: 6rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0;
    line-height: 1;
}

.error-message {
    font-size: 1.5rem;
    color: var(--text-color);
    margin: 1rem 0 2rem;
}

.error-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

/* =========================================================================
   SECURITY-POLICY.HTML & PRESENTATIONS.HTML — Info boxes
   ========================================================================= */

.info-box--blue {
    background-color: #e8f4f8;
    padding: 1.5rem;
    border-left: 4px solid #3498db;
    margin: 2rem 0;
}

.info-box--yellow {
    background-color: #fff3cd;
    padding: 1.5rem;
    border-left: 4px solid #ffc107;
    margin: 2rem 0;
}

.cta-buttons--spaced {
    margin: 1.5rem 0;
}

.cta-buttons--spaced-lg {
    margin: 2rem 0;
}

.presentation-card {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.presentation-list {
    list-style-position: inside;
    margin-top: 1rem;
}

/* CTA section (bottom of contribute-resources, etc.) */
.cta-section {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem;
    background-color: #f0f7ff;
    border-radius: 8px;
}

.cta-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}

/* =========================================================================
   MOBILE REDO (canonical overrides)
   ========================================================================= */

@media (max-width: 768px) {
    header {
        position: static;
        padding: 0.5rem 0;
    }

    .header-content {
        padding: 0 1rem;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .logo h1 {
        font-size: 1rem;
        line-height: 1.2;
        margin: 0;
    }

    .logo p {
        display: none;
    }

    .hamburger {
        display: block;
        order: 2;
    }

    .theme-toggle {
        order: 1;
    }

    header nav {
        display: block;
        width: 100%;
        order: 3;
    }

    .js-enabled header nav {
        display: none;
    }

    .js-enabled header .nav-open nav {
        display: block;
    }

    header nav ul {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0.5rem 0;
        margin: 0;
        overflow-x: visible;
    }

    header nav ul li a {
        display: block;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .container {
        padding: 0 0.75rem;
    }

    section {
        padding: 1.25rem 0;
    }

    .hero {
        padding: 1.25rem 0.9rem;
    }

    .hero h2 {
        font-size: 1.35rem;
        line-height: 1.2;
        margin-bottom: 0.6rem;
    }

    .hero p {
        font-size: 0.95rem;
        margin-bottom: 0.9rem;
    }

    .hero-img {
        margin-bottom: 0.75rem;
    }

    .resource-grid,
    .resources-grid {
        grid-template-columns: 1fr !important;
        gap: 0.9rem;
        padding: 0.75rem !important;
    }

    .resource-card {
        padding: 1rem;
    }

    .cta-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    nav ul li a {
        font-size: 0.75rem;
        padding: 0.28rem 0.5rem;
        min-height: 28px;
    }

    .hero h2 {
        font-size: 1.2rem;
    }

    .hero p {
        font-size: 0.88rem;
    }
}

/* =========================================================================
   DARK MODE
   ========================================================================= */

/* Dark mode toggle button in header */
.theme-toggle {
    background: none;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: var(--white);
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    font-size: 1.1rem;
    line-height: 1;
    transition: border-color 0.3s, background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    border-color: rgba(255, 255, 255, 0.6);
    background-color: rgba(255, 255, 255, 0.1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --primary-color: #c2d9ec;
        --secondary-color: #6fc3ff;
        --accent-color: #ff7b6b;
        --text-color: #e8ecf2;
        --light-bg: #0f1419;
        --white: #1c2530;
        --border-color: #30445a;
        --shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
        --shadow-lg: 0 4px 10px rgba(0, 0, 0, 0.5);
    }

    :root:not([data-theme]) body {
        background-color: var(--light-bg);
        color: var(--text-color);
    }

    :root:not([data-theme]) body a {
        color: #6fc3ff;
    }

    :root:not([data-theme]) body a:hover {
        color: #9dd5ff;
    }

    :root:not([data-theme]) header {
        background-color: #0b1018;
        color: #f5f7fa;
    }

    :root:not([data-theme]) .logo h1,
    :root:not([data-theme]) .logo p,
    :root:not([data-theme]) .logo-link {
        color: #f5f7fa;
    }

    :root:not([data-theme]) nav a {
        color: #f5f7fa;
    }

    :root:not([data-theme]) .hero,
    :root:not([data-theme]) .hero--compact {
        background: linear-gradient(135deg, #0a1628 0%, #122a4a 100%) !important;
        color: #ffffff !important;
    }

    :root:not([data-theme]) .hero h2,
    :root:not([data-theme]) .hero--compact h2 {
        color: #ffffff !important;
    }

    :root:not([data-theme]) .hero p,
    :root:not([data-theme]) .hero--compact p {
        color: #ffffff !important;
        opacity: 0.95;
    }

    :root:not([data-theme]) .hero .btn-primary,
    :root:not([data-theme]) .hero--compact .btn-primary {
        color: #ffffff !important;
    }

    :root:not([data-theme]) .hero .btn-secondary,
    :root:not([data-theme]) .hero--compact .btn-secondary {
        background-color: rgba(255, 255, 255, 0.15) !important;
        color: #ffffff !important;
        border: 1px solid rgba(255, 255, 255, 0.3);
    }

    :root:not([data-theme]) .hero .btn-secondary:hover,
    :root:not([data-theme]) .hero--compact .btn-secondary:hover {
        background-color: rgba(255, 255, 255, 0.25) !important;
        color: #ffffff !important;
    }

    :root:not([data-theme]) footer {
        background-color: #0b1018;
        color: #d8e0ea;
    }

    :root:not([data-theme]) .footer-section a {
        color: rgba(220, 230, 242, 0.9);
    }

    :root:not([data-theme]) .footer-bottom {
        border-top-color: rgba(255, 255, 255, 0.1);
        color: rgba(220, 230, 242, 0.7);
    }
}

/* Dark mode overrides */
[data-theme="dark"] {
    --primary-color: #c2d9ec;
    --secondary-color: #6fc3ff;
    --accent-color: #ff7b6b;
    --text-color: #e8ecf2;
    --light-bg: #0f1419;
    --white: #1c2530;
    --border-color: #30445a;
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 4px 10px rgba(0, 0, 0, 0.5);
}

/* --- Dark mode: base body ------------------------------------------------ */
[data-theme="dark"] body {
    background-color: var(--light-bg);
    color: var(--text-color);
}

[data-theme="dark"] body a {
    color: #6fc3ff;
}

[data-theme="dark"] body a:hover {
    color: #9dd5ff;
}

/* --- Dark mode: headings & titles ---------------------------------------- */
[data-theme="dark"] .resource-card h3,
[data-theme="dark"] .section h2,
[data-theme="dark"] .section h3,
[data-theme="dark"] .category-section h3,
[data-theme="dark"] .resource-card h3 a {
    color: var(--secondary-color);
}

[data-theme="dark"] .contribute-article h2 {
    color: #7dccff;
    border-bottom-color: #30445a;
}

[data-theme="dark"] .memorial-content h2 {
    color: #7dccff;
}

[data-theme="dark"] .contribution-type h4 {
    color: #7dccff;
}

/* --- Dark mode: text & descriptions -------------------------------------- */
[data-theme="dark"] .resource-card p,
[data-theme="dark"] .article-date,
[data-theme="dark"] .no-results {
    color: #c8cfd8;
}

[data-theme="dark"] .resource-list a {
    color: var(--secondary-color);
}

[data-theme="dark"] .resource-list .description {
    color: #b8c2cc;
}

[data-theme="dark"] .info-box p {
    color: #c8cfd8;
}

[data-theme="dark"] .text-muted {
    color: #a0adb8;
}

[data-theme="dark"] .date,
[data-theme="dark"] .memorial-subtitle {
    color: #a0adb8;
}

[data-theme="dark"] .highlight-box strong {
    color: #7dccff;
}

[data-theme="dark"] .faq-item strong {
    color: #7dccff;
}

[data-theme="dark"] .link-box a {
    color: var(--secondary-color);
}

[data-theme="dark"] .cta-link {
    color: var(--secondary-color);
}

/* --- Dark mode: error pages ---------------------------------------------- */
[data-theme="dark"] .error-code {
    color: var(--secondary-color);
}

[data-theme="dark"] .error-message {
    color: var(--text-color);
}

/* --- Dark mode: tags ----------------------------------------------------- */
[data-theme="dark"] .tag {
    background-color: #1e2e3e;
    color: #dce2e8;
}

[data-theme="dark"] .tag.ctf { background-color: #3d2200; color: #ffc964; }
[data-theme="dark"] .tag.certification { background-color: #0d2744; color: #7ecbff; }
[data-theme="dark"] .tag.tool { background-color: #2a0845; color: #dea8ee; }
[data-theme="dark"] .tag.lab { background-color: #3b0d1e; color: #ffa4c4; }
[data-theme="dark"] .tag.new { background-color: #1b3a1b; color: #95db98; }

/* --- Dark mode: buttons & filters ---------------------------------------- */
[data-theme="dark"] .filter-btn {
    background-color: var(--white);
    border-color: var(--border-color);
    color: var(--text-color);
}

[data-theme="dark"] .filter-btn:hover,
[data-theme="dark"] .filter-btn.active {
    background-color: var(--secondary-color);
    color: #fff;
    border-color: var(--secondary-color);
}

[data-theme="dark"] .btn-secondary {
    background-color: #1e2e3e;
    color: var(--text-color);
}

[data-theme="dark"] .btn-secondary:hover {
    background-color: #2a3d52;
}

[data-theme="dark"] .show-all-btn {
    background-color: #1a2535;
    border-color: var(--secondary-color);
    color: var(--text-color);
}

[data-theme="dark"] .show-all-btn:hover {
    background-color: var(--secondary-color);
    color: #fff;
}

/* --- Dark mode: hero & footer -------------------------------------------- */
[data-theme="dark"] header {
    background-color: #0b1018;
    color: #f5f7fa;
}

[data-theme="dark"] .logo h1,
[data-theme="dark"] .logo p,
[data-theme="dark"] .logo-link {
    color: #f5f7fa;
}

[data-theme="dark"] nav a {
    color: #f5f7fa;
}

[data-theme="dark"] .hamburger {
    color: #f5f7fa;
}

[data-theme="dark"] .hero,
[data-theme="dark"] .hero--compact {
    background: linear-gradient(135deg, #0a1628 0%, #122a4a 100%) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .hero h2,
[data-theme="dark"] .hero--compact h2 {
    color: #ffffff !important;
}

[data-theme="dark"] .hero p,
[data-theme="dark"] .hero--compact p {
    color: #ffffff !important;
    opacity: 0.95;
}

[data-theme="dark"] .hero .btn-primary,
[data-theme="dark"] .hero--compact .btn-primary {
    background-color: var(--accent-color);
    color: #ffffff !important;
}

[data-theme="dark"] .hero .btn-secondary,
[data-theme="dark"] .hero--compact .btn-secondary {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .hero .btn-secondary:hover,
[data-theme="dark"] .hero--compact .btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .btn-primary {
    background-color: var(--accent-color);
    color: #ffffff;
}

[data-theme="dark"] .btn-primary:hover {
    background-color: #e05545;
}

[data-theme="dark"] footer {
    background-color: #0b1018;
    color: #d8e0ea;
}

[data-theme="dark"] .footer-section h3 {
    color: #f0f3f7;
}

[data-theme="dark"] .footer-section a {
    color: rgba(220, 230, 242, 0.9);
}

[data-theme="dark"] .footer-section a:hover {
    color: #ffffff;
}

[data-theme="dark"] .footer-bottom {
    border-top-color: rgba(255, 255, 255, 0.1);
    color: rgba(220, 230, 242, 0.7);
}

[data-theme="dark"] .source {
    color: var(--secondary-color);
}

/* --- Dark mode: breadcrumbs (both old .breadcrumb and new .breadcrumb-nav) */
[data-theme="dark"] .breadcrumb {
    color: #a0adb8;
}

[data-theme="dark"] .breadcrumb a {
    color: var(--secondary-color);
}

[data-theme="dark"] .breadcrumb-nav ol {
    color: #a0adb8;
}

[data-theme="dark"] .breadcrumb-nav li + li::before {
    color: #7a8a98;
}

/* --- Dark mode: code blocks, TOC, boxes ---------------------------------- */
[data-theme="dark"] .code-block {
    background-color: #121c28;
    border-left-color: var(--secondary-color);
    color: #dce2e8;
}

[data-theme="dark"] .highlight-box {
    background-color: #152535;
    border-left-color: #3a8ec2;
    color: #eaf6ff;
    font-weight: 500;
}

[data-theme="dark"] .toc {
    background-color: #141e2a;
    border-left-color: var(--secondary-color);
}

[data-theme="dark"] .toc h3 {
    color: #7dccff;
}

[data-theme="dark"] .toc a {
    color: var(--secondary-color);
}

[data-theme="dark"] .contribution-type {
    color: #eaf6ff;
    font-weight: 500;
    background-color: #1a2535;
    border-color: #2a3d52;
}

[data-theme="dark"] .faq-item {
    background-color: #1a2535;
    border-left-color: var(--secondary-color);
}

[data-theme="dark"] .step-box {
    background-color: #1a2535;
    border-color: #2a3d52;
}

[data-theme="dark"] .contribution-type .examples {
    background-color: #2a2510;
}

[data-theme="dark"] .contribution-type .have-idea {
    background-color: #152535;
}

[data-theme="dark"] .link-box {
    background-color: #221e0e;
    border-left-color: #b8950a;
}

[data-theme="dark"] .tag-example {
    background-color: #2a3d52;
    color: #dce2e8;
}

/* --- Dark mode: info boxes ----------------------------------------------- */
[data-theme="dark"] .info-box--blue {
    background-color: #152535;
    border-left-color: #3a8ec2;
}

[data-theme="dark"] .info-box--yellow {
    background-color: #2a2510;
    border-left-color: #b8950a;
}

/* --- Dark mode: CTA section ---------------------------------------------- */
[data-theme="dark"] .cta-section {
    background-color: #141e2a;
}

/* --- Dark mode: wired card (kevin-mitnick.html) -------------------------- */
[data-theme="dark"] .wired-card {
    background: linear-gradient(135deg, #1a2535 0%, #1e2e3e 100%);
    border-color: #c04015;
}

[data-theme="dark"] .wired-card:hover {
    box-shadow: 0 8px 24px rgba(200, 60, 15, 0.25);
}

[data-theme="dark"] .wired-card-label {
    color: #e8763a;
}

[data-theme="dark"] .wired-card-title {
    color: #f0f3f7;
}

[data-theme="dark"] .wired-card-desc {
    color: #b8c2cc;
}

/* --- Dark mode: form controls -------------------------------------------- */
[data-theme="dark"] input[type="text"] {
    background-color: #1a2535;
    color: var(--text-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .category-section h3:hover {
    background-color: #1e2e3e;
}

/* =========================================================================
   BREADCRUMB NAVIGATION (visual UI)
   ========================================================================= */

.breadcrumb-nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 2rem 0;
}

.breadcrumb-nav ol {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: #666;
    margin: 0;
    padding: 0;
}

.breadcrumb-nav li {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.breadcrumb-nav li + li::before {
    content: '›';
    color: #999;
    margin-right: 0.25rem;
}

.breadcrumb-nav a {
    color: var(--secondary-color);
    text-decoration: none;
}

.breadcrumb-nav a:hover {
    text-decoration: underline;
}

.breadcrumb-nav [aria-current="page"] {
    color: var(--text-color);
    font-weight: 500;
}

@media (max-width: 768px) {
    .breadcrumb-nav {
        padding: 0.5rem 0.75rem 0;
        font-size: 0.8rem;
    }
}

/* =========================================================================
   SEARCH SUGGESTIONS / AUTOCOMPLETE
   ========================================================================= */

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: min(300px, 100%);
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-suggestions.visible {
    display: block;
}

.search-suggestion {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.search-suggestion:hover,
.search-suggestion.highlighted {
    background-color: var(--light-bg);
}

.search-suggestion .suggestion-type {
    font-size: 0.75rem;
    color: #999;
    background-color: var(--light-bg);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    white-space: nowrap;
}

[data-theme="dark"] .search-suggestions {
    background-color: #1c2530;
    border-color: #30445a;
}

[data-theme="dark"] .search-suggestion:hover,
[data-theme="dark"] .search-suggestion.highlighted {
    background-color: #243242;
}

[data-theme="dark"] .search-suggestion .suggestion-type {
    background-color: #243242;
    color: #b8c2cc;
}

/* =========================================================================
   SOCIAL SHARING BUTTONS (news articles)
   ========================================================================= */

.share-buttons {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    transition: opacity 0.2s, transform 0.2s;
}

.share-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.share-btn--linkedin {
    background-color: #0077b5;
}

.share-btn--twitter {
    background-color: #1da1f2;
}

.share-btn--bluesky {
    background-color: #0085ff;
}

.share-btn--reddit {
    background-color: #ff4500;
}

/* Prevent share buttons from triggering parent card-link navigation */
.card-link .share-buttons {
    position: relative;
    z-index: 2;
}

@media (max-width: 768px) {
    .share-btn {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
}

/* =========================================================================
   RESOURCE CARD TOOLTIPS
   ========================================================================= */

.resource-tooltip {
    position: fixed;
    z-index: 9000;
    max-width: 360px;
    width: max-content;
    padding: 0.75rem 1rem;
    background-color: var(--white);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-wrap: break-word;
    word-break: break-all;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
}

.resource-tooltip.visible {
    opacity: 1;
}

[data-theme="dark"] .resource-tooltip {
    background-color: #1c2530;
    color: #e8ecf2;
    border-color: #30445a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

@media (hover: none) and (pointer: coarse) {
    .resource-tooltip {
        display: none !important;
    }
}

/* end of stylesheet - v2 */