/* theme.css - ArkArk design system */
:root {
    --bg-site: #F5F2EB;
    --card-surface: #E7E1D6;
    --text-primary: #1F2529;
    --text-secondary: #5E666B;
    --border-color: #C8BFB0;
    --accent: #8C5A3C;
    --accent-dark: #734830;
    --footer-bg: #2E3539;
    --text-inverse: #F3EEE5;
    --transition: 0.2s ease;
}

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

body {
    background: var(--bg-site);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, sans-serif;
    line-height: 1.5;
}

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

/* Typography */
h1, h2, h3, h4, .brand-name {
    font-family: 'DM Serif Display', Georgia, 'Times New Roman', serif;
    font-weight: 500;
    letter-spacing: -0.01em;
}

h1 { font-size: 2.5rem; margin-bottom: 1rem; }
h2 { font-size: 2rem; margin: 1.5rem 0 1rem; }
h3 { font-size: 1.5rem; margin: 1rem 0; }

/* Header */
.main-header {
    background: var(--card-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background-color: rgba(231, 225, 214, 0.95);
    padding: 0.75rem 0;
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.brand-link {
    text-decoration: none;
    display: inline-flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.brand-accent {
    color: var(--accent);
}

.brand-sub {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.primary-nav .nav-menu {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-item {
    text-decoration: none;
    font-weight: 500;
    color: var(--text-primary);
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.nav-item:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
}

/* Hero section */
.hero-banner {
    background: linear-gradient(135deg, rgba(140,90,60,0.05) 0%, rgba(231,225,214,0.3) 100%);
    padding: 3rem 0 2rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.hero-title {
    font-size: 3rem;
    max-width: 800px;
}

.hero-description {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 720px;
    margin: 1rem 0;
}

.hero-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
    font-weight: 500;
    color: var(--accent);
}

/* Search card */
.search-section {
    margin-bottom: 2rem;
}

.search-card {
    background: var(--card-surface);
    border-radius: 1.5rem;
    padding: 1.8rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.search-filters {
    margin-top: 1rem;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-row input {
    flex: 1;
    min-width: 160px;
    background: var(--bg-site);
    border: 1px solid var(--border-color);
    padding: 0.7rem 1rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    transition: var(--transition);
}

.filter-row input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(140,90,60,0.2);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.6rem 1.2rem;
    border-radius: 2rem;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

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

/* Category tiles */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.8rem;
    margin: 2rem 0;
}

.category-tile {
    background: var(--card-surface);
    padding: 1.8rem;
    border-radius: 1.5rem;
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.05);
    border-color: var(--accent);
}

.category-icon {
    font-size: 2.8rem;
}

.category-tile h3 {
    margin: 0.5rem 0;
}

.category-link {
    margin-top: 0.5rem;
    font-weight: 500;
    color: var(--accent);
}

/* Project grid */
.project-grid, .item-grid, .blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.project-card, .item-card, .blog-card {
    background: var(--card-surface);
    border-radius: 1.2rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.project-card:hover, .item-card:hover, .blog-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
}

.project-img, .item-image, .blog-img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: #ddd2c0;
}

.img-placeholder, .item-image-placeholder, .blog-img-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 2rem;
}

.project-info, .item-content, .blog-card-content {
    padding: 1.2rem;
}

.project-info h3 a, .item-content h2 a, .blog-card-content h2 a {
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.project-meta, .item-meta {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin: 0.5rem 0;
}

/* Stats showcase */
.stats-showcase {
    background: var(--footer-bg);
    color: var(--text-inverse);
    border-radius: 2rem;
    margin: 3rem 0;
    padding: 2rem 0;
}

.stats-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2rem;
    text-align: center;
}

.stat-block {
    flex: 1;
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 700;
    display: block;
    font-family: 'DM Serif Display', serif;
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

.project-mission {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.2);
    font-style: italic;
}

/* Pagination */
.pagination-wrapper, .pagination-nav {
    margin: 2rem 0;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    flex-wrap: wrap;
}

.page-item a, .page-link {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    background: var(--card-surface);
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    text-decoration: none;
    color: var(--text-primary);
}

.page-item.active .page-link, .page-link:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Content tables */
.content-area table,
.markdown-body table {
    width: 100%;
    margin: 1.75rem 0;
    border-collapse: collapse;
    border-spacing: 0;
    background: var(--card-surface);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 8px 18px rgba(31, 37, 41, 0.05);
}

.content-area thead,
.markdown-body thead {
    background: rgba(140, 90, 60, 0.12);
}

.content-area th,
.content-area td,
.markdown-body th,
.markdown-body td {
    padding: 0.95rem 1rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid rgba(200, 191, 176, 0.8);
}

.content-area th,
.markdown-body th {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-primary);
}

.content-area td,
.markdown-body td {
    color: var(--text-secondary);
}

.content-area tbody tr:nth-child(even),
.markdown-body tbody tr:nth-child(even) {
    background: rgba(245, 242, 235, 0.65);
}

.content-area tbody tr:hover,
.markdown-body tbody tr:hover {
    background: rgba(140, 90, 60, 0.08);
}

.content-area tbody tr:last-child td,
.markdown-body tbody tr:last-child td {
    border-bottom: 0;
}

/* External links */
a[href^="http"]:not(.brand-link):not(.nav-item):not(.category-tile):not(.page-link) {
    color: var(--accent);
    text-decoration-line: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 0.16em;
    transition: color var(--transition), text-decoration-color var(--transition);
}

a[href^="http"]:not(.brand-link):not(.nav-item):not(.category-tile):not(.page-link)::after {
    content: " \2197";
    font-size: 0.9em;
}

a[href^="http"]:not(.brand-link):not(.nav-item):not(.category-tile):not(.page-link):hover,
a[href^="http"]:not(.brand-link):not(.nav-item):not(.category-tile):not(.page-link):focus-visible {
    color: var(--accent-dark);
    text-decoration-color: var(--accent-dark);
}

a[href^="http"]:not(.brand-link):not(.nav-item):not(.category-tile):not(.page-link):focus-visible {
    outline: 2px solid rgba(140, 90, 60, 0.28);
    outline-offset: 2px;
    border-radius: 0.2rem;
}

/* Footer */
.site-footer {
    background: var(--footer-bg);
    color: var(--text-inverse);
    margin-top: 3rem;
    padding: 2rem 0 1rem;
}

.footer-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
}

.footer-links ul {
    list-style: none;
    margin-top: 0.5rem;
}

.footer-links a, .footer-legal a {
    color: #ccc9c2;
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-stats {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .primary-nav {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 80%;
        height: calc(100vh - 70px);
        background: var(--card-surface);
        transition: left 0.3s;
        padding: 2rem;
        z-index: 99;
        box-shadow: 2px 0 12px rgba(0,0,0,0.1);
    }
    .primary-nav.open {
        left: 0;
    }
    .primary-nav .nav-menu {
        flex-direction: column;
        gap: 1.5rem;
    }
    .mobile-nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .mobile-nav-toggle span {
        width: 24px;
        height: 2px;
        background: var(--text-primary);
        position: relative;
    }
    .mobile-nav-toggle span::before, .mobile-nav-toggle span::after {
        content: '';
        position: absolute;
        width: 24px;
        height: 2px;
        background: var(--text-primary);
        transition: 0.2s;
    }
    .mobile-nav-toggle span::before { top: -8px; }
    .mobile-nav-toggle span::after { top: 8px; }
    .hero-title { font-size: 2rem; }
    .filter-row { flex-direction: column; }
    .stats-container { flex-direction: column; align-items: center; }
    .content-area table,
    .markdown-body table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        border-radius: 0.9rem;
    }
    .content-area th,
    .content-area td,
    .markdown-body th,
    .markdown-body td {
        min-width: 180px;
        padding: 0.85rem 0.9rem;
    }
}

/* Utility */
.section-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem auto;
    width: 80px;
}
.related-grid {
    margin: 2rem 0;
}
.related-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}
.related-card {
    background: var(--card-surface);
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.related-img, .related-img-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}
.related-info {
    padding: 1rem;
}
.related-info h4 a {
    text-decoration: none;
    color: var(--text-primary);
}

