/*
Theme Name: Monocultured Blog
Theme URI: https://monocultured.com/blog
Author: Mateusz Pozar
Description: Custom blog theme for monocultured.com — left-sidebar classic layout
Version: 1.4.0
*/

/* ── Variables ────────────────────────────────── */
:root {
    --bg:           #fbf5e9;
    --bg-outer:     #ece7d8;
    --ink:          #181715;
    --ink-light:    #4a4845;
    --ink-muted:    #5e5b58;   /* 6.21:1 on --bg — passes WCAG AA */
    --accent:       #0c11a6;
    --accent-hover: #a31515;
    --border:       #d4cfc8;
    --font:         Georgia, 'Times New Roman', serif;
    --sidebar-w:    280px;
    --sp:           8px;
}

/* ── Reset ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, h4, p, ul, ol, li, figure, blockquote { margin: 0; padding: 0; }
img, video { display: block; max-width: 100%; height: auto; }
ul, ol { list-style: none; }

/* ── Base ─────────────────────────────────────── */
html { font-size: 18px; scroll-behavior: smooth; }
body {
    background: var(--bg-outer);
    color: var(--ink);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: underline; }
a:hover { color: var(--accent-hover); }
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 1px;
}

/* ── Skip link ────────────────────────────────── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    background: var(--ink);
    color: var(--bg);
    font-size: .8rem;
    padding: .4rem .8rem;
    text-decoration: none;
    z-index: 9999;
}
.skip-link:focus { top: .5rem; }

/* ── Site layout ──────────────────────────────── */
.site-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
    max-width: 1280px;
    margin: 0 auto;
    background: var(--bg);
}

/* ── Sidebar ──────────────────────────────────── */
.site-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: calc(var(--sp) * 4) calc(var(--sp) * 3) calc(var(--sp) * 1.5);
    flex-shrink: 0;
}

.sidebar-logo {
    font-size: .88rem;
    font-weight: bold;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink);
    text-decoration: none;
    line-height: 1.3;
    white-space: nowrap;
}
.sidebar-logo:hover { color: var(--accent-hover); }

.sidebar-tagline {
    font-size: .72rem;
    color: var(--ink-muted);
    line-height: 1.45;
    padding: 0 calc(var(--sp) * 3) calc(var(--sp) * 3);
    font-style: italic;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    cursor: pointer;
    padding: .2rem .5rem;
    font-family: var(--font);
    font-size: .7rem;
    color: var(--ink-muted);
    line-height: 1.4;
    flex-shrink: 0;
    margin-top: .1rem;
}
.nav-toggle:hover { color: var(--ink); }

.sidebar-body {
    padding: calc(var(--sp) * 3) calc(var(--sp) * 3) calc(var(--sp) * 4);
    display: flex;
    flex-direction: column;
    gap: calc(var(--sp) * 3.5);
    flex: 1;
}

/* Date picker */
.date-picker select {
    width: 100%;
    font-family: var(--font);
    font-size: .82rem;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: .4rem .5rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235e5b58'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .5rem center;
    padding-right: 1.5rem;
    line-height: 1.4;
}
.date-picker select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Search */
.sidebar-search { display: flex; gap: 4px; }
.sidebar-search input {
    flex: 1;
    font-family: var(--font);
    font-size: .82rem;
    border: 1px solid var(--border);
    background: var(--bg);
    padding: .4rem .5rem;
    color: var(--ink);
    min-width: 0;
}
.sidebar-search input::placeholder { color: var(--ink-muted); }
.sidebar-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.sidebar-search button {
    background: none;
    border: 1px solid var(--border);
    cursor: pointer;
    padding: .4rem .6rem;
    font-size: .78rem;
    color: var(--ink-muted);
    font-family: var(--font);
}
.sidebar-search button:hover { color: var(--ink); }

/* Sidebar section — per-link structure (head + desc + link) */
.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: .18rem;
}
.sidebar-section__head {
    font-size: .6rem;
    font-variant: small-caps;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--ink-muted);
}
.sidebar-section__desc {
    font-size: .72rem;
    color: var(--ink-muted);
    line-height: 1.35;
    font-style: italic;
    margin: 0;
    margin-bottom: .1rem;
}
.sidebar-section__link {
    font-size: .8rem;
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    display: inline;
}
.sidebar-section__link:hover {
    color: var(--accent-hover);
    text-decoration-color: var(--accent-hover);
}

/* Feeds row — RSS · Atom inline */
.sidebar-feeds-row {
    font-size: .8rem;
    color: var(--ink-muted);
    margin: 0;
}

/* Bottom — main site link + Est. */
.sidebar-bottom {
    display: flex;
    flex-direction: column;
    gap: calc(var(--sp) * 3);
    margin-top: auto;
    padding-top: calc(var(--sp) * 3);
    border-top: 1px solid var(--border);
}
.sidebar-est {
    font-size: .88rem;
    font-weight: bold;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink);
    text-align: center;
    margin: 0;
}

/* Newsletter subscribe form */
.sidebar-subscribe {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sidebar-subscribe input[type="email"] {
    font-family: var(--font);
    font-size: .8rem;
    border: 1px solid var(--border);
    background: var(--bg);
    padding: .35rem .5rem;
    color: var(--ink);
}
.sidebar-subscribe input[type="email"]::placeholder { color: var(--ink-muted); }
.sidebar-subscribe input[type="email"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.sidebar-subscribe button {
    align-self: flex-start;
    font-family: var(--font);
    font-size: .78rem;
    background: none;
    border: 1px solid var(--border);
    padding: .3rem .65rem;
    cursor: pointer;
    color: var(--ink-muted);
}
.sidebar-subscribe button:hover { color: var(--ink); }
.sidebar-subscribe button:disabled { opacity: .5; cursor: default; }
.sidebar-subscribe-success {
    font-size: .78rem;
    color: var(--ink-muted);
    font-style: italic;
    margin: 0;
}

/* ── Main content ─────────────────────────────── */
.site-main {
    padding: calc(var(--sp) * 6) calc(var(--sp) * 7);
    min-width: 0;
}

/* ── Post list + single post (shared structure) ── */
.post-list { display: flex; flex-direction: column; }

.post-item {
    padding-bottom: calc(var(--sp) * 9);
    margin-bottom: calc(var(--sp) * 9);
    border-bottom: 1px solid var(--border);
}
.post-list .post-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
.single .post-item {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.post-item__header { margin-bottom: calc(var(--sp) * 2.5); }

.post-item__title {
    font-size: 1.55rem;
    font-weight: bold;
    line-height: 1.2;
    margin-bottom: .4rem;
}
.post-item__title a {
    color: var(--ink);
    text-decoration: none;
}
.post-item__title a:hover { color: var(--accent); }

.post-item__meta {
    font-size: .78rem;
    color: var(--ink-muted);
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: baseline;
}
.post-item__tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.post-item__tag {
    color: var(--ink-muted);
    text-decoration: none;
    font-size: .72rem;
}
.post-item__tag::before { content: '#'; }
.post-item__tag:hover { color: var(--ink); }

/* ── Entry content ────────────────────────────── */
.entry-content { font-size: 1rem; line-height: 1.75; }
.entry-content p { margin-bottom: 1.3rem; }
.entry-content h2 { font-size: 1.2rem; margin: 2.5rem 0 .75rem; }
.entry-content h3 { font-size: 1.05rem; margin: 2rem 0 .5rem; }
.entry-content ul, .entry-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1.3rem;
}
.entry-content ul { list-style: disc; }
.entry-content ol { list-style: decimal; }
.entry-content li { margin-bottom: .3rem; }
.entry-content blockquote {
    border-left: 2px solid var(--border);
    padding-left: 1.25rem;
    margin: 1.75rem 0;
    color: var(--ink-light);
    font-style: italic;
}

/* Editorial link style — dark text, accent-coloured underline */
.entry-content a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}
.entry-content a:hover {
    color: var(--accent-hover);
    text-decoration-color: var(--accent-hover);
}

.entry-content img { max-width: 100%; height: auto; margin: 2rem 0; }
.entry-content figure { margin: 2rem 0; }
.entry-content figcaption {
    font-size: .78rem;
    color: var(--ink-muted);
    margin-top: .5rem;
}
.entry-content pre {
    background: var(--bg-outer);
    border: 1px solid var(--border);
    padding: 1.25rem;
    overflow-x: auto;
    font-size: .82rem;
    line-height: 1.5;
    margin-bottom: 1.3rem;
}
.entry-content code {
    font-size: .86em;
    background: var(--bg-outer);
    padding: .1em .3em;
    border-radius: 2px;
}
.entry-content pre code { background: none; padding: 0; }
.entry-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

.more-link {
    display: inline-block;
    margin-top: .5rem;
    font-size: .85rem;
    color: var(--ink-muted);
    text-decoration: none;
}
.more-link:hover { color: var(--accent); }

/* ── Pagination ───────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: calc(var(--sp) * 5) 0 calc(var(--sp) * 2);
    font-size: .85rem;
    border-top: 1px solid var(--border);
}
.pagination a { color: var(--ink-muted); text-decoration: none; }
.pagination a:hover { color: var(--ink); text-decoration: underline; }
.pagination .current { color: var(--ink-muted); }

/* ── Archive header ───────────────────────────── */
.archive-header {
    padding-bottom: calc(var(--sp) * 4);
    margin-bottom: calc(var(--sp) * 2);
    border-bottom: 1px solid var(--border);
}
.archive-label {
    font-size: .72rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: .35rem;
}
.archive-title { font-size: 1.6rem; font-weight: bold; color: var(--ink); }

/* ── Post nav (prev / next) ───────────────────── */
.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    padding: calc(var(--sp) * 5) 0 calc(var(--sp) * 2);
    border-top: 1px solid var(--border);
    font-size: .85rem;
    margin-top: calc(var(--sp) * 6);
}
.post-nav a { color: var(--ink-muted); text-decoration: none; }
.post-nav a:hover { color: var(--ink); text-decoration: underline; }
.post-nav__prev { text-align: left; }
.post-nav__next { text-align: right; }
.post-nav__label {
    display: block;
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: .3rem;
}

/* ── Static pages ─────────────────────────────── */
.page-title {
    font-size: 1.55rem;
    font-weight: bold;
    margin-bottom: calc(var(--sp) * 4);
    padding-bottom: calc(var(--sp) * 3);
    border-bottom: 1px solid var(--border);
}

/* ── Search results ───────────────────────────── */
.search-header { margin-bottom: calc(var(--sp) * 3); }
.search-title { font-size: 1.2rem; font-weight: bold; }
.search-form { display: flex; gap: .5rem; margin-top: calc(var(--sp) * 2); }
.search-form input {
    flex: 1;
    font-family: var(--font);
    font-size: .9rem;
    border: 1px solid var(--border);
    background: var(--bg);
    padding: .4rem .75rem;
    color: var(--ink);
}
.search-form input::placeholder { color: var(--ink-muted); }
.search-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-form button {
    font-family: var(--font);
    font-size: .85rem;
    border: 1px solid var(--border);
    background: none;
    padding: .4rem 1rem;
    cursor: pointer;
    color: var(--ink-muted);
}
.search-form button:hover { color: var(--ink); background: var(--bg-outer); }

/* ── 404 ──────────────────────────────────────── */
.error-404__title {
    font-size: 1.55rem;
    font-weight: bold;
    margin-bottom: calc(var(--sp) * 2);
}
.error-404__text { margin-bottom: calc(var(--sp) * 3); color: var(--ink-light); }

/* ── Footer ───────────────────────────────────── */
.site-footer {
    background: var(--bg-outer);
    border-top: 1px solid var(--border);
    padding: calc(var(--sp) * 2.5) calc(var(--sp) * 7);
    font-size: .75rem;
    color: var(--ink-muted);
}
.site-footer a { color: var(--ink-muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }

/* ── Gutenberg block compatibility ────────────── */
.wp-block-image { margin: 2rem 0; }
.wp-block-image img { max-width: 100%; height: auto; }
.wp-block-quote {
    border-left: 2px solid var(--border);
    padding-left: 1.25rem;
    margin: 1.75rem 0;
    font-style: italic;
    color: var(--ink-light);
}
.wp-block-code {
    background: var(--bg-outer);
    border: 1px solid var(--border);
    padding: 1rem;
    overflow-x: auto;
    font-size: .82rem;
}
.wp-block-separator { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.wp-block-embed { margin: 2rem 0; }
.wp-block-embed iframe { max-width: 100%; }
.alignwide, .alignfull { max-width: 100%; }
.alignleft { float: left; margin-right: 1.75rem; margin-bottom: 1rem; }
.alignright { float: right; margin-left: 1.75rem; margin-bottom: 1rem; }
.aligncenter { margin-left: auto; margin-right: auto; display: block; }
.wp-caption-text, .wp-element-caption {
    font-size: .78rem;
    color: var(--ink-muted);
    margin-top: .5rem;
}

/* ── Mobile ───────────────────────────────────── */
@media (max-width: 768px) {
    .site-layout { display: block; }
    .site-sidebar {
        position: static;
        height: auto;
        overflow: visible;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .sidebar-header {
        padding: calc(var(--sp) * 3) calc(var(--sp) * 3) calc(var(--sp) * 1.5);
    }
    .sidebar-tagline {
        padding: 0 calc(var(--sp) * 3) calc(var(--sp) * 2.5);
    }
    .sidebar-body {
        display: none;
        padding: calc(var(--sp) * 3) calc(var(--sp) * 3) calc(var(--sp) * 4);
    }
    .sidebar-body.is-open { display: flex; }
    .nav-toggle { display: inline-block; }
    .site-main { padding: calc(var(--sp) * 4) calc(var(--sp) * 3); }
    .post-item__title { font-size: 1.25rem; }
    .post-item {
        padding-bottom: calc(var(--sp) * 6);
        margin-bottom: calc(var(--sp) * 6);
    }
    .sidebar-bottom { margin-top: 0; border-top: none; padding-top: 0; }
}

/* ── Reduced motion ───────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
    html { scroll-behavior: auto; }
}
