:root {
    --paper: #f5efe6;
    --paper-bright: #fbf8f2;
    --ink: #161413;
    --forest: #26473e;
    --rust: #c85c3a;
    --terracotta: #b84a2c;
    --mustard: #d9a12c;
    --dusty-rose: #d88a7a;
    --cobalt: #2f5fea;
    --border: rgba(22, 20, 19, 0.12);
    --line: rgba(22, 20, 19, 0.08);
    --shadow-sm: 0 14px 36px rgba(22, 20, 19, 0.08);
    --shadow-md: 0 24px 64px rgba(22, 20, 19, 0.11);
    --shadow-lg: 0 34px 88px rgba(22, 20, 19, 0.14);
    --font-display: "Bricolage Grotesque", sans-serif;
    --font-sans: "Instrument Sans", sans-serif;
    --font-mono: "IBM Plex Mono", monospace;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--ink);
    background: var(--paper);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

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

main, section, article, header, footer, nav, aside {
    min-width: 0;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: 16px;
    z-index: 60;
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    transform: translateY(-140%);
    transition: transform 0.2s ease;
}

.skip-link:focus {
    transform: translateY(0);
}

.hidden {
    display: none !important;
}


/* ── Nav ── */

.page-shell {
    max-width: 860px;
    margin: 0 auto;
    padding: 28px 24px 80px;
    padding-top: 116px;
}

.nav {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: min(860px, calc(100% - 32px));
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(245, 239, 230, 0.72);
    border: 1px solid rgba(22, 20, 19, 0.06);
    border-radius: 999px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background-color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.nav.scrolled {
    background-color: rgba(245, 239, 230, 0.94);
    border-color: rgba(22, 20, 19, 0.1);
    box-shadow: var(--shadow-sm);
}

.nav-logo {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--ink);
    min-height: 44px;
    padding: 6px 0;
}

.nav-logo svg {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 4px;
    font-size: 15px;
    font-weight: 500;
    color: var(--ink);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.nav-link:hover {
    opacity: 1;
}

.nav-mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    color: var(--ink);
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.nav-mobile-toggle svg {
    width: 24px;
    height: 24px;
}


/* ── Journal listing page ── */

.page-hero-clean {
    margin-bottom: 48px;
}

.hero-title-clean {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: clamp(36px, 5vw, 56px);
    line-height: 1;
    letter-spacing: -0.03em;
}

.hero-lede-clean {
    margin: 0;
    font-size: 17px;
    color: rgba(22, 20, 19, 0.6);
}


/* Journal cards grid */

.journal-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 24px;
}

.journal-card-clean {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 20px;
    padding: 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(22, 20, 19, 0.06);
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.journal-card-clean:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-sm);
}

.card-cover {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    background: linear-gradient(160deg, var(--entry-accent), var(--entry-accent-alt));
    aspect-ratio: 4 / 3;
}

.card-cover-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.3;
    mix-blend-mode: screen;
}

.card-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.card-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(20px, 2.5vw, 26px);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.card-excerpt {
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    color: rgba(22, 20, 19, 0.6);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(22, 20, 19, 0.45);
    margin-top: 4px;
}

.meta-dot {
    opacity: 0.5;
}


/* ── Post page ── */

.post-shell {
    display: grid;
    gap: 32px;
}


/* Cover */

.post-cover {
    width: 100%;
    aspect-ratio: 21 / 9;
    border-radius: 20px;
    background: linear-gradient(160deg, var(--entry-accent, var(--rust)), var(--entry-accent-alt, var(--mustard)));
    overflow: hidden;
    position: relative;
}

.post-cover.has-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,0.12));
    pointer-events: none;
}

.post-cover-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.35;
    mix-blend-mode: screen;
}


/* Header */

.post-header-clean {
    max-width: 640px;
}

.post-title-clean {
    margin: 0 0 12px;
    font-family: var(--font-display);
    font-size: clamp(32px, 5vw, 48px);
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.post-excerpt-clean {
    margin: 0 0 12px;
    font-size: 17px;
    line-height: 1.6;
    color: rgba(22, 20, 19, 0.65);
}

.post-meta-clean {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(22, 20, 19, 0.45);
}


/* Body */

.post-body-clean {
    max-width: 640px;
    display: grid;
    gap: 22px;
}

.post-body-clean p {
    margin: 0;
    font-size: 18px;
    line-height: 1.85;
    color: rgba(22, 20, 19, 0.82);
}

.post-body-clean h2 {
    margin: 12px 0 0;
    font-family: var(--font-display);
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.12;
    letter-spacing: -0.02em;
}

.post-body-clean blockquote {
    margin: 0;
    padding: 18px 22px;
    border-left: 3px solid var(--rust);
    border-radius: 0 14px 14px 0;
    background: rgba(22, 20, 19, 0.03);
    font-family: var(--font-display);
    font-size: clamp(20px, 2.4vw, 28px);
    line-height: 1.35;
}

.post-body-clean figure {
    margin: 0;
    display: grid;
    gap: 8px;
}

.post-body-clean img {
    width: 100%;
    border-radius: 16px;
}

.post-body-clean figcaption {
    font-size: 13px;
    color: rgba(22, 20, 19, 0.5);
}


/* Takeaway */

.post-takeaway-clean {
    max-width: 640px;
    margin: 0;
    padding: 18px 22px;
    border-left: 3px solid var(--forest);
    border-radius: 0 14px 14px 0;
    background: rgba(38, 70, 62, 0.05);
    font-family: var(--font-display);
    font-size: clamp(20px, 2.4vw, 28px);
    line-height: 1.35;
}


/* Missing body */

.post-missing-body {
    padding: 20px;
    border: 1px dashed rgba(22, 20, 19, 0.14);
    border-radius: 16px;
    color: rgba(22, 20, 19, 0.5);
    font-size: 15px;
}


/* Post not found */

.post-empty {
    padding: 24px;
    border: 1px dashed rgba(22, 20, 19, 0.14);
    border-radius: 16px;
    color: rgba(22, 20, 19, 0.6);
}

.post-loading {
    padding: 24px;
    color: rgba(22, 20, 19, 0.5);
    font-size: 15px;
}


/* ── Next / Prev navigation ── */

.post-nav-clean {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.post-nav-card {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(22, 20, 19, 0.06);
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.post-nav-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-sm);
}

.nav-card-art {
    width: 80px;
    height: 60px;
    border-radius: 10px;
    background: linear-gradient(160deg, var(--entry-accent), var(--entry-accent-alt));
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.nav-card-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.3;
    mix-blend-mode: screen;
}

.nav-card-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.nav-card-label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(22, 20, 19, 0.45);
}

.nav-card-title {
    font-family: var(--font-display);
    font-size: 16px;
    line-height: 1.2;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ── Text link ── */

.text-link {
    color: var(--ink);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.text-link:hover {
    color: var(--rust);
}


/* ── Archive empty ── */

.archive-empty {
    padding: 20px;
    border: 1px dashed rgba(22, 20, 19, 0.14);
    border-radius: 16px;
    color: rgba(22, 20, 19, 0.5);
    font-size: 15px;
}


/* ── Footer ── */

.journal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-top: 36px;
    margin-top: 52px;
    border-top: 1px solid var(--line);
}

.footer-copy {
    margin: 0;
    font-size: 13px;
    color: rgba(22, 20, 19, 0.45);
}

.footer-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 4px;
    font-size: 13px;
    color: rgba(22, 20, 19, 0.5);
}

.footer-links a:hover {
    color: var(--ink);
}


/* ── Focus ── */

a:focus-visible,
button:focus-visible {
    outline: 3px solid rgba(47, 95, 234, 0.24);
    outline-offset: 4px;
}


/* ── Mobile ── */

@media (max-width: 720px) {
    .page-shell {
        padding: 20px 16px 64px;
        padding-top: 92px;
    }

    .nav {
        top: 16px;
        width: calc(100% - 32px);
        padding: 12px 18px;
    }

    .nav-logo {
        font-size: 20px;
    }

    .nav-logo svg {
        width: 28px;
        height: 28px;
    }

    .nav-links {
        display: none;
    }

    .nav-links.open {
        display: flex;
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        min-width: 220px;
        padding: 16px;
        background: rgba(245, 239, 230, 0.97);
        border: 1px solid rgba(22, 20, 19, 0.08);
        border-radius: 20px;
        box-shadow: var(--shadow-lg);
    }

    .nav-link {
        justify-content: center;
    }

    .nav-mobile-toggle {
        display: inline-flex;
    }

    .nav-links.open .nav-link {
        min-height: 44px;
        padding: 10px 14px;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.72);
    }

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

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

    .post-cover {
        aspect-ratio: 16 / 9;
        border-radius: 16px;
    }

    .post-nav-clean {
        grid-template-columns: 1fr;
    }

    .post-nav-card {
        grid-template-columns: 64px 1fr;
    }

    .nav-card-art {
        width: 64px;
        height: 48px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
