:root {
    --bg: #3a362e;
    --text: #e8e0cd;
    --accent-1: #7c8a72;
    --accent-2: #b5876a;
    --border: #ddd2ba;
}

[data-theme="light"] {
    --bg: #e8e0cd;
    --text: #3a362e;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Karla', sans-serif;
    font-size: 17px;
    line-height: 1.6;
    margin: 0;
}

h1, h2, h3, h4 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    line-height: 1.2;
}

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

a:hover {
    text-decoration: underline;
}

.wrapper {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Site header */
.site-header {
    border-bottom: 1px solid var(--border);
    padding: 32px 0;
    margin-bottom: 40px;
}

/* Hero background image — public-facing pages only (opt-in via $page_hero_bg
   in the calling page), never the admin panel. Text is fixed to a light color
   here regardless of the site's light/dark toggle, since the darkened photo
   needs reliable contrast in both cases rather than following the page theme. */
.site-header.has-hero-bg {
    background-image: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)), url('/assets/img/header-bg.webp');
    background-size: cover;
    background-position: center;
    padding: 56px 0 32px;
}

.site-header.has-hero-bg .site-title a,
.site-header.has-hero-bg .nav-list > li > a,
.site-header.has-hero-bg .nav-dropdown-toggle {
    color: #e8e0cd;
}

.site-header.has-hero-bg .theme-toggle {
    border-color: rgba(232, 224, 205, 0.4);
    color: #e8e0cd;
}

.site-header.has-hero-bg .theme-toggle:hover {
    border-color: #e8e0cd;
}

/* The moon-icon darkening filter (added earlier so it's visible against a
   light page background) doesn't apply here — the hero header is always
   dark, in either theme, so the icon stays visible in its natural color. */
[data-theme="light"] .site-header.has-hero-bg .theme-toggle {
    filter: none;
}

.site-header-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.site-title {
    font-size: 2.2rem;
    margin: 0;
}

.site-title a {
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

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

/* Site nav */
.site-nav {
    margin-top: 20px;
}

.nav-list {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 28px;
    margin: 0;
    padding: 0;
}

.nav-list > li > a {
    color: var(--text);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.nav-list > li > a:hover {
    color: var(--accent-1);
    text-decoration: none;
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    background: none;
    border: none;
    padding: 0;
    color: var(--text);
    font-family: 'Karla', sans-serif;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    cursor: pointer;
}

.nav-dropdown-toggle::after {
    content: ' ▾';
    font-size: 0.7em;
}

.nav-dropdown-toggle:hover,
.nav-dropdown.is-open .nav-dropdown-toggle {
    color: var(--accent-1);
}

.nav-dropdown-menu {
    list-style: none;
    margin: 0;
    padding: 10px 0;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 10;
}

.nav-dropdown.is-open .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu li a {
    display: block;
    padding: 8px 18px;
    color: var(--text);
    font-size: 0.9rem;
}

.nav-dropdown-menu li a:hover {
    color: var(--accent-1);
    text-decoration: none;
    background: rgba(124, 138, 114, 0.1);
}

@media (max-width: 700px) {
    .nav-list {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .nav-dropdown {
        width: 100%;
    }

    .nav-dropdown-menu {
        display: none;
        position: static;
        border: none;
        box-shadow: none;
        background: none;
        padding: 6px 0 0 0;
        min-width: 0;
    }

    .nav-dropdown.is-open .nav-dropdown-menu {
        display: block;
    }

    .nav-dropdown-menu li a {
        padding: 6px 0 6px 12px;
    }

    /* On a hero-bg header, the expanded dropdown can grow tall enough to sit
       over a bright/busy part of the photo — give it its own solid backing
       so the category list stays legible no matter what's behind it. */
    .site-header.has-hero-bg .nav-dropdown-menu {
        background: rgba(0, 0, 0, 0.55);
        border-radius: 3px;
        padding: 10px 14px;
        margin-top: 4px;
    }

    .site-header.has-hero-bg .nav-dropdown-menu li a {
        color: #e8e0cd;
    }
}

.page-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.3rem;
    color: var(--accent-2);
    margin: 4px 0 0 0;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 32px;
}

.pagination-pages {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pagination a,
.pagination .pagination-current,
.pagination .pagination-disabled {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 0.9rem;
    color: var(--text);
}

.pagination a:hover {
    border-color: var(--accent-1);
    color: var(--accent-1);
    text-decoration: none;
}

.pagination .pagination-current {
    background: var(--accent-1);
    border-color: var(--accent-1);
    color: #fff;
}

.pagination .pagination-disabled {
    color: var(--accent-2);
    opacity: 0.5;
}

/* Category filter indicator (index.php) */
.category-filter-notice {
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 10px 16px;
    margin-bottom: 28px;
    font-size: 0.9rem;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text);
    font-size: 1.1rem;
    line-height: 1;
    padding: 6px 10px;
    cursor: pointer;
}

.theme-toggle:hover {
    border-color: var(--accent-1);
}

[data-theme="light"] .theme-toggle {
    filter: brightness(0);
}

/* Post list (index.php) */
.post-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.post-list-item {
    border-bottom: 1px solid var(--border);
    padding: 28px 0;
}

.post-list-item:first-child {
    padding-top: 0;
}

.post-title {
    margin: 0 0 8px 0;
    font-size: 1.7rem;
}

.post-meta {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: var(--accent-2);
}

.category-tag {
    display: inline-block;
    border: 1px solid var(--border);
    color: var(--accent-2);
    border-radius: 3px;
    padding: 2px 10px;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.post-date {
    color: var(--accent-2);
}

.post-excerpt {
    margin: 0;
}

/* Single post (post.php) */
.article-header {
    margin-bottom: 24px;
}

.article-title {
    font-size: 2.4rem;
    margin: 0 0 8px 0;
}

.post-body {
    font-size: 1.05rem;
}

.post-body p {
    margin: 0 0 1.2em 0;
}

.video-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 0 0 1.2em 0;
}

.video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 3px;
}

.hero-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 0 28px 0;
    border-radius: 3px;
}

.post-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 1.2em auto;
}

.post-body figcaption {
    text-align: center;
    font-style: italic;
    color: var(--accent-2);
    font-size: 0.9rem;
    margin-top: -0.8em;
    margin-bottom: 1.2em;
}

/* Comments */
.comments {
    border-top: 1px solid var(--border);
    margin-top: 48px;
    padding-top: 32px;
}

.comments h3, .comments h4 {
    font-size: 1.4rem;
}

.comment {
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}

.comment strong {
    color: var(--accent-1);
}

.comment-form {
    margin-top: 24px;
}

.comment-form label {
    display: block;
    margin-bottom: 14px;
    font-size: 0.95rem;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form textarea {
    display: block;
    width: 100%;
    max-width: 480px;
    padding: 8px 10px;
    margin-top: 4px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: #fff;
    color: var(--text);
    font-family: 'Karla', sans-serif;
    font-size: 1rem;
}

.comment-form textarea {
    min-height: 120px;
}

.comment-form button {
    background: var(--accent-1);
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: 3px;
    font-family: 'Karla', sans-serif;
    font-size: 1rem;
    cursor: pointer;
}

.comment-form button:hover {
    opacity: 0.9;
}

.form-message {
    color: var(--accent-2);
}

.form-error {
    color: #a5493a;
}

.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Site footer */
.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 48px;
    padding: 24px 0;
    font-size: 0.85rem;
    color: var(--accent-2);
}
