@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500&display=swap');

:root {
    --bg: #f8fafc;
    --bg2: #f1f5f9;
    --ink: #0a0a0a;
    --ink2: #0a0a0a;
    --ink3: #334155;
    --accent: #2563eb;
    --accent2: #0ea5e9;
    --white: #ffffff;
    --border: #000000;
    --card-bg: rgba(255, 255, 255, 0.82);
    --shadow: 0 2px 12px rgba(31,41,55,0.08);
    --radius: 8px;
}

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

body {
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(14,165,233,0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(37,99,235,0.05) 0%, transparent 55%);
    color: var(--ink);
    font-family: 'IBM Plex Sans', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ── Header ── */
header {
    width: 100%;
    background-color: var(--bg2);
    border-bottom: 3px solid var(--accent);
    padding: 0 5%;
    color: #000;
}

nav {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 16px;
}

.nav-brand {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

nav ul li a {
    color: #000;
    text-decoration: none;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 6px 10px;
    transition: color 0.2s, background 0.2s;
}

nav ul li a:hover {
    color: var(--accent2);
    background: rgba(37, 99, 235, 0.08);
}

nav ul li a.active {
    color: var(--accent);
}

/* ── Page wrapper ── */
.page-wrapper {
    width: min(1100px, 100%);
    max-width: 1100px;
    margin: 0 auto;
    flex: 1;
    padding: 40px 20px 60px;
}

body {
    min-width: 320px;
}

.posts-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.post-card {
    word-break: break-word;
}

.post-preview {
    white-space: pre-wrap;
    overflow-wrap: break-word;
    max-height: 4.6em;
    overflow: hidden;
}


/* ── Page header ── */
.page-header {
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.page-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.6rem;
    font-weight: 900;
    line-height: 1;
    color: var(--ink);
}

.page-header .post-count {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: var(--ink3);
}

/* ── Post grid ── */
.posts-grid {
    display: grid;
    gap: 16px;
}

/* ── Post card ── */
.post-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 3px solid transparent;
    padding: 24px;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    position: relative;
}

.post-card:hover {
    border-left-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateX(2px);
}

.post-card__heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.post-card__title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--ink);
}

.post-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
}

.post-badge {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid var(--border);
    padding: 2px 8px;
    color: var(--ink2);
    background: var(--bg2);
}

.post-badge--highlight {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(192,57,43,0.06);
}

.post-preview {
    font-size: 0.95rem;
    color: #000;
    line-height: 1.6;
    white-space: pre-wrap;
    margin-bottom: 16px;
    overflow-wrap: break-word;
    max-height: 4.8em;
    overflow: hidden;
}

.post-full {
    margin-bottom: 16px;
}

.post-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.post-modal__content {
    background: var(--white);
    width: min(900px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    box-shadow: 0 8px 22px rgba(0,0,0,0.25);
    border-radius: 10px;
    padding: 22px;
    position: relative;
}

.post-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: 0;
    background: var(--ink);
    color: var(--white);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
}

.post-modal__content h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.post-modal__content .post-meta {
    color: var(--ink3);
    margin-bottom: 14px;
    font-size: 0.85rem;
}

.post-modal__content .post-content {
    white-space: pre-wrap;
    line-height: 1.65;
    color: var(--ink2);
    margin-top: 14px;
}

.post-content {
    font-size: 0.95rem;
    color: var(--ink2);
    line-height: 1.7;
    white-space: pre-wrap;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.post-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.post-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--ink3);
}

.read-more-btn {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s;
}

.read-more-btn:hover {
    color: var(--accent2);
}

/* ── Empty state ── */
.empty-state {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    color: var(--ink3);
    border: 1px dashed var(--border);
    padding: 32px;
    text-align: center;
    background: rgba(255,255,255,0.4);
}

/* ── Loading ── */
.loading-state {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: var(--ink3);
    padding: 32px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── About / Contact static content ── */
.static-content {
    max-width: 680px;
}

.static-content p {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--ink2);
    margin-bottom: 16px;
}

.static-content h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    margin: 28px 0 12px;
    color: var(--ink);
}

/* ── Responsive ── */
@media (max-width: 700px) {
    nav {
        height: auto;
        padding: 14px 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    nav ul {
        gap: 2px;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .post-card__heading {
        flex-direction: column;
        gap: 8px;
    }
}
