/**
 * Minimalist Template — Editorial Serenity
 * Design: Manrope (headings/UI) + Literata (body/reading)
 * Palette: Off-white (#f9f9f7), charcoal (#1a1c1b), sage green (#456463)
 */

/* ── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Colors */
    --bg:           #f9f9f7;
    --surface:      #f4f4f2;
    --surface-low:  #eeeeec;
    --card:         #ffffff;
    --border:       #c4c7c3;
    --border-light: #e2e3e1;
    --text:         #1a1c1b;
    --text-muted:   #444844;
    --text-faint:   #747874;
    --accent:       #456463;
    --accent-bg:    #c7e9e8;
    --accent-dim:   #accdcc;

    /* Typography */
    --font-heading: 'Manrope', system-ui, -apple-system, sans-serif;
    --font-body:    'Literata', Georgia, 'Times New Roman', serif;
    --font-ui:      'Manrope', system-ui, -apple-system, sans-serif;

    /* Spacing (8px grid) */
    --sp-xs:  4px;
    --sp-sm:  8px;
    --sp-md:  16px;
    --sp-lg:  24px;
    --sp-xl:  32px;
    --sp-2xl: 48px;
    --sp-3xl: 64px;

    /* Layout */
    --container-max: 1120px;
    --article-max:   720px;
    --gutter:        24px;
}

html {
    font-size: 18px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

::selection {
    background: var(--accent-bg);
    color: var(--text);
}

a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

img { max-width: 100%; height: auto; display: block; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.container.has-sidebar {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: var(--sp-2xl);
    align-items: start;
}

.article-column {
    max-width: var(--article-max);
    margin: 0 auto;
}

/* ── Reading Progress Bar ────────────────────────────────────────────────── */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: var(--accent-dim);
    z-index: 100;
    transition: width 0.15s ease-out;
}

/* ── Site Header ─────────────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    border-bottom: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.site-header.scrolled {
    background: rgba(249, 249, 247, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    transition: height 0.3s ease;
}

.site-header.scrolled .nav { height: 64px; }

.nav-brand { display: flex; align-items: center; }

.brand-text {
    font-family: var(--font-heading);
    font-size: 1.33rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}

.nav-links {
    display: flex;
    gap: var(--sp-md);
}

.nav-link {
    font-family: var(--font-ui);
    font-size: 0.778rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
    border-bottom-color: var(--text);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
}

.search-form { display: flex; }

.search-input {
    font-family: var(--font-body);
    font-size: 0.833rem;
    border: none;
    border-bottom: 1px solid var(--border-light);
    background: transparent;
    padding: var(--sp-sm) 0;
    width: 160px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus { border-bottom-color: var(--accent); }
.search-input::placeholder { color: var(--text-faint); }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--sp-sm);
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    transition: transform 0.2s;
}

/* ── Site Main ───────────────────────────────────────────────────────────── */
.site-main { padding: var(--sp-3xl) 0; }

/* ── Hero Section ────────────────────────────────────────────────────────── */
.hero-section {
    text-align: center;
    margin-bottom: var(--sp-3xl);
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 2.667rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: var(--sp-md);
}

.hero-desc {
    font-family: var(--font-body);
    font-size: 1.111rem;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 600px;
    margin: 0 auto;
}

/* ── Section Divider ─────────────────────────────────────────────────────── */
.section-divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--sp-3xl) 0;
}

/* ── Section Header ──────────────────────────────────────────────────────── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: var(--sp-xl);
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.778rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

/* ── Featured Post ───────────────────────────────────────────────────────── */
.featured-card {
    display: grid;
    grid-template-columns: 7fr 5fr;
    gap: var(--sp-xl);
    align-items: center;
}

.featured-image {
    display: block;
    aspect-ratio: 16/9;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}

.featured-card:hover .featured-image img { transform: scale(1.05); }

.featured-body .post-label { margin-bottom: var(--sp-md); }

.featured-title {
    font-family: var(--font-heading);
    font-size: 2.667rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: var(--sp-md);
}

.featured-title a { color: var(--text); }
.featured-title a:hover { color: var(--accent); }

.featured-excerpt {
    font-size: 1.111rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: var(--sp-xl);
}

/* ── Post Label ──────────────────────────────────────────────────────────── */
.post-label {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: 0.778rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-decoration: none;
}

.post-label:hover { color: var(--text); }

/* ── Post Meta ───────────────────────────────────────────────────────────── */
.post-meta {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    font-family: var(--font-ui);
    font-size: 0.722rem;
    color: var(--text-faint);
}

.meta-sep { opacity: 0.5; }

/* ── Posts Grid ───────────────────────────────────────────────────────────── */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-xl);
}

.posts-grid-sm { grid-template-columns: repeat(3, 1fr); }

/* ── Post Card ───────────────────────────────────────────────────────────── */
.post-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.post-card:hover { transform: translateY(-2px); }

.post-card-image {
    display: block;
    aspect-ratio: 4/3;
    overflow: hidden;
    margin-bottom: var(--sp-md);
    position: relative;
    border: 1px solid var(--border-light);
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.post-card:hover .post-card-image img { transform: scale(1.05); }

.post-card-body .post-label { margin-bottom: var(--sp-sm); }

.post-card-title {
    font-family: var(--font-heading);
    font-size: 1.333rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: var(--sp-sm);
}

.post-card-title a { color: var(--text); }
.post-card:hover .post-card-title a { color: var(--accent); }

.post-card-excerpt {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Archive Header ──────────────────────────────────────────────────────── */
.archive-header {
    padding: var(--sp-3xl) 0;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: var(--sp-3xl);
}

.archive-title {
    font-family: var(--font-heading);
    font-size: 2.667rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: var(--sp-md) 0;
}

.archive-desc {
    font-size: 1.111rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.archive-count {
    font-family: var(--font-ui);
    font-size: 0.833rem;
    color: var(--text-faint);
}

/* ── Search ──────────────────────────────────────────────────────────────── */
.search-form-wrap {
    max-width: 480px;
    margin: 0 auto var(--sp-xl);
}

.search-form-lg .search-input {
    width: 100%;
    font-size: 1rem;
    padding: var(--sp-md) 0;
}

/* ── Post List (Search) ──────────────────────────────────────────────────── */
.posts-list { display: flex; flex-direction: column; }

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

.post-list-title {
    font-family: var(--font-heading);
    font-size: 1.333rem;
    font-weight: 600;
    margin-bottom: var(--sp-sm);
}

.post-list-title a:hover { color: var(--accent); }

.post-list-excerpt {
    color: var(--text-muted);
    margin-bottom: var(--sp-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Single Post ─────────────────────────────────────────────────────────── */
.single-post .post-header {
    margin-bottom: var(--sp-xl);
    text-align: center;
}

.post-title {
    font-family: var(--font-heading);
    font-size: 2.667rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: var(--sp-md) 0;
}

.post-featured-image {
    margin-bottom: var(--sp-xl);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.post-featured-image img {
    width: 100%;
    display: block;
}

/* ── Prose / Content ─────────────────────────────────────────────────────── */
.prose {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
}

.prose h2 {
    font-family: var(--font-heading);
    font-size: 1.778rem;
    font-weight: 600;
    line-height: 1.3;
    margin: var(--sp-3xl) 0 var(--sp-md);
    color: var(--text);
}

.prose h3 {
    font-family: var(--font-heading);
    font-size: 1.333rem;
    font-weight: 600;
    line-height: 1.4;
    margin: var(--sp-2xl) 0 var(--sp-md);
}

.prose p { margin-bottom: var(--sp-xl); }

.prose ul, .prose ol {
    margin: var(--sp-xl) 0;
    padding-left: 0;
}

.prose ul { list-style: none; }

.prose ul li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: var(--sp-md);
}

.prose ul li::before {
    content: "—";
    position: absolute;
    left: 0;
    color: var(--text-faint);
}

.prose ol { padding-left: 1.5rem; }
.prose ol li { margin-bottom: var(--sp-md); }

.prose blockquote {
    padding: var(--sp-xl) 0;
    margin: var(--sp-2xl) 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    text-align: center;
}

.prose blockquote p {
    font-size: 1.111rem;
    font-style: italic;
    color: var(--accent);
    line-height: 1.7;
    margin: 0;
    padding: 0 var(--sp-xl);
}

.prose a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.prose img {
    margin: var(--sp-xl) 0;
    border: 1px solid var(--border-light);
}

.prose code {
    font-size: 0.889rem;
    background: var(--surface-low);
    padding: 2px 6px;
    border-radius: 2px;
}

.prose pre {
    background: var(--text);
    color: var(--bg);
    padding: var(--sp-lg);
    overflow-x: auto;
    margin: var(--sp-xl) 0;
    font-size: 0.833rem;
    line-height: 1.5;
}

.prose pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* ── Share Buttons ───────────────────────────────────────────────────────── */
.post-share {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
    padding-top: var(--sp-xl);
    margin-top: var(--sp-3xl);
    border-top: 1px solid var(--border-light);
}

.share-label {
    font-family: var(--font-ui);
    font-size: 0.778rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.share-buttons { display: flex; gap: var(--sp-sm); }

.share-btn {
    font-family: var(--font-ui);
    font-size: 0.722rem;
    font-weight: 600;
    padding: var(--sp-sm) var(--sp-md);
    border: 1px solid var(--border);
    color: var(--text-muted);
    transition: all 0.2s;
}

.share-btn:hover {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: 0.778rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: var(--sp-md) var(--sp-xl);
    background: var(--text);
    color: var(--bg);
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-primary:hover { opacity: 0.9; color: var(--bg); }

/* ── Error Page ──────────────────────────────────────────────────────────── */
.error-page {
    text-align: center;
    padding: var(--sp-3xl) 0;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.error-code {
    font-family: var(--font-heading);
    font-size: 6rem;
    font-weight: 700;
    color: var(--border);
    line-height: 1;
    margin-bottom: var(--sp-md);
}

.error-title {
    font-family: var(--font-heading);
    font-size: 1.778rem;
    font-weight: 600;
    margin-bottom: var(--sp-md);
}

.error-desc {
    color: var(--text-muted);
    margin-bottom: var(--sp-xl);
}

/* ── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: var(--sp-3xl) 0;
    color: var(--text-muted);
}

.empty-state h2 {
    font-family: var(--font-heading);
    font-size: 1.778rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--sp-md);
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.site-sidebar {
    position: sticky;
    top: 100px;
}

.site-sidebar .widget {
    padding: var(--sp-lg);
    border: 1px solid var(--border-light);
    margin-bottom: var(--sp-xl);
    background: var(--card);
}

.site-sidebar .widget-title {
    font-family: var(--font-ui);
    font-size: 0.722rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text);
    margin-bottom: var(--sp-md);
    padding-bottom: var(--sp-sm);
    border-bottom: 1px solid var(--border-light);
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border-light);
    padding: var(--sp-3xl) 0;
    margin-top: var(--sp-3xl);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--sp-xl);
    margin-bottom: var(--sp-xl);
}

.footer-heading {
    font-family: var(--font-heading);
    font-size: 1.333rem;
    font-weight: 600;
    margin-bottom: var(--sp-sm);
}

.footer-desc {
    font-size: 0.833rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--sp-xl);
    border-top: 1px solid var(--border-light);
    font-size: 0.722rem;
    color: var(--text-faint);
}

.footer-powered { color: var(--text-faint); }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--sp-md);
    padding: var(--sp-xl) 0;
    margin-top: var(--sp-xl);
    border-top: 1px solid var(--border-light);
    font-family: var(--font-ui);
    font-size: 0.778rem;
}

.pagination a {
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.pagination a:hover { color: var(--text); }

.pagination .current {
    font-weight: 600;
    color: var(--text);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .container.has-sidebar {
        grid-template-columns: 1fr;
    }

    .site-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    html { font-size: 16px; }

    .nav-links { display: none; }
    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border-light);
        padding: var(--sp-lg);
        gap: var(--sp-md);
    }

    .nav-toggle { display: flex; }

    .featured-card {
        grid-template-columns: 1fr;
    }

    .hero-title,
    .featured-title,
    .archive-title,
    .post-title {
        font-size: 2rem;
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: var(--sp-xl);
    }

    .posts-grid-sm {
        grid-template-columns: 1fr;
    }

    .post-card-image { aspect-ratio: 16/9; }

    .search-input { width: 120px; }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: var(--sp-sm);
    }
}

@media (max-width: 480px) {
    :root { --gutter: 20px; }
}
