:root {
    color-scheme: light dark;
    --bg: #ffffff;
    --fg: #1a1a1a;
    --accent: #0b5fff;
    /* #767676, not #c7c7c7 — WCAG 1.4.11 Non-text Contrast needs 3:1 for UI
       component boundaries (e.g. the search input's border), and #c7c7c7 on
       white is only ~1.7:1. Same fix as public/assets/css/app.css. */
    --border: #767676;
    --muted: #5a5a5a;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14161a;
        --fg: #f2f2f2;
        --border: #6b6f78;
        --accent: #6ea8ff;
        --muted: #b7b9bd;
    }
}

* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--fg);
    margin: 0;
    line-height: 1.6;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    /* var(--bg), not #fff — see app.css's .skip-link for why. */
    color: var(--bg);
    padding: 0.75rem 1rem;
    z-index: 100;
}

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

a {
    color: var(--accent);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

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

.theme-site-name {
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--fg);
}

.theme-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0;
    margin: 0;
}

.theme-nav a {
    text-decoration: none;
    padding: 0.25rem 0;
}

.theme-nav a[aria-current="page"] {
    border-bottom: 2px solid var(--accent);
}

/* Nested menu items (parent/child, see MenuRepository::tree()) render as an
   indented sub-list — by default always-visible so every item stays
   reachable by tab order alone, unless the parent item is flagged
   "isCollapsible" (see layout.php's $renderMenuItems), in which case the
   sub-list instead sits inside a native <details>, closed by default. Both
   shapes nest the <ul> one level deeper than a plain <li>, so this targets
   any <ul> under an <li>, not just a direct child. */
.theme-nav li ul,
.theme-footer li ul {
    margin-left: 1rem;
    margin-top: 0.25rem;
}

.theme-nav li ul a,
.theme-footer li ul a {
    font-size: 0.9rem;
    opacity: 0.85;
}

.theme-nav summary,
.theme-footer summary {
    cursor: pointer;
    padding: 0.25rem 0;
    color: var(--fg);
}

.theme-search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-account-box {
    margin-left: auto;
}

.theme-account-box ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 0;
    margin: 0;
}

.theme-account-box a,
.theme-account-box .link-button {
    text-decoration: none;
}

.theme-search-box label {
    font-size: 0.9rem;
}

.theme-search-box input {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--fg);
}

.theme-body {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.theme-main {
    flex: 1 1 600px;
    max-width: 800px;
    margin: 0;
    padding: 2rem 0 4rem;
}

/* Only rendered at all when the 'sidebar' panel zone has at least one
   visible widget (see templates/themes/default/layout.php) — .theme-main
   alone inside a centered, max-width flex container reproduces the exact
   single-column look this theme had before the panel system existed, so a
   site that never places anything in the sidebar looks completely unchanged. */
.theme-sidebar {
    flex: 1 1 240px;
    max-width: 320px;
    padding: 2rem 0 4rem;
}

.panel-widget {
    margin-bottom: 2rem;
}

.panel-widget-title {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.panel-widget-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.panel-widget-list li {
    padding: 0.35rem 0;
}

.theme-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    margin-top: 3rem;
}

.theme-footer ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0;
    margin: 0;
}

.post-meta {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: -0.5rem;
}

.post-list-item {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border);
}

.post-list-item h2 {
    margin-bottom: 0.25rem;
}

.post-list-thumb-link {
    flex: 0 0 auto;
}

.post-list-thumb {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

/* min-width: 0 lets the text column actually shrink inside the flex row
   instead of overflowing past the thumbnail's fixed width. */
.post-list-content {
    flex: 1 1 300px;
    min-width: 0;
}

.post-featured-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1rem 0;
    display: block;
}

.pagination {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.category-description {
    color: var(--muted);
}

.post-keywords {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0;
    margin: 2rem 0 0;
}

.post-keywords li {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.2rem 0.75rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.flash-success { background: rgba(10, 110, 44, 0.15); }
.flash-error { background: rgba(179, 0, 0, 0.15); }

.newsletter-signup {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.newsletter-signup label {
    display: block;
    font-size: 0.9rem;
}

.newsletter-signup input {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--fg);
}

.comments {
    margin-top: 3rem;
    border-top: 1px solid var(--border);
    padding-top: 2rem;
}

.comment-list {
    list-style: none;
    padding: 0;
}

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

.comment-meta {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.comment-list-nested {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0 0 0 1.5rem;
    border-left: 2px solid var(--border);
}

.comment-list-nested .comment {
    padding: 0.75rem 0;
}

.comment-reply-toggle,
.comment-replies,
.comment-edit-toggle {
    margin-top: 0.5rem;
}

.comment-reply-toggle summary,
.comment-replies summary,
.comment-edit-toggle summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.9rem;
}

.comment-reply-toggle form,
.comment-edit-toggle form {
    margin-top: 0.75rem;
}

.smiley {
    height: 1.2em;
    width: auto;
    vertical-align: text-bottom;
}

.smiley-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0.5rem 0;
}

.smiley-picker-button {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.25rem;
    cursor: pointer;
    line-height: 0;
}

.smiley-picker-button:hover {
    border-color: var(--accent);
}

.smiley-picker-button img {
    height: 1.25rem;
    width: auto;
    display: block;
}

.comments textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--fg);
    font-family: inherit;
    font-size: 1rem;
}

.field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
}
