:root {
    --bg: #F5F0EB;
    --bg-card: #EFEBE5;
    --text: #1A1A1A;
    --text-secondary: #5C5650;
    --accent: #8B4513;
    --accent-hover: #A0522D;
    --border: #D9D2CA;
    --serif: 'Instrument Serif', Georgia, serif;
    --sans: 'DM Sans', -apple-system, sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--sans);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- NAV --- */
nav {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(245, 240, 235, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

nav.scrolled {
    border-bottom-color: var(--border);
}

nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.4;
}

nav .name {
    font-family: var(--serif);
    font-size: 1.25rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.01em;
}

nav .links {
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: 0.5rem;
}

nav .links a {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    transition: color 0.2s;
}

nav .links a:hover,
nav .links a[aria-current="page"] {
    color: var(--text);
}

/* --- WORLD TOGGLE (1994 / Now) --- */
.world-toggle {
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.42rem 0.9rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
    line-height: 1;
}

.world-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(139, 69, 19, 0.04);
}

.world-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- PAGE HEADER (blog index) --- */
.page-header {
    max-width: 720px;
    margin: 0 auto;
    padding: 6rem 2rem 3rem;
}

.page-header .label {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1rem;
    font-weight: 500;
    font-family: 'Courier New', monospace;
}

.page-header .label::before { content: '[ '; opacity: 0.4; }
.page-header .label::after  { content: ' ]'; opacity: 0.4; }

.page-header h1 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(2.4rem, 5vw, 3.6rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 1.25rem;
}

.page-header h1 em {
    font-style: italic;
    color: var(--accent);
}

.page-header .intro {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 620px;
    line-height: 1.7;
}

/* --- POST LIST (blog index) --- */
.post-list {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 2rem 6rem;
    list-style: none;
}

.post-list li {
    padding: 2rem 0;
    border-top: 1px solid var(--border);
}

.post-list li:last-child {
    border-bottom: 1px solid var(--border);
}

.post-list time {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    margin-bottom: 0.6rem;
}

.post-list h2 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(1.5rem, 3vw, 2rem);
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin-bottom: 0.6rem;
}

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

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

.post-list .excerpt {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.post-list-empty {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* --- POST (article page) --- */
.post {
    max-width: 680px;
    margin: 0 auto;
    padding: 5rem 2rem 4rem;
}

.post-header {
    margin-bottom: 3rem;
}

.post-meta {
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    margin-bottom: 1rem;
}

.post-header h1 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--text);
}

.post-header h1 em {
    font-style: italic;
    color: var(--accent);
}

.post-subtitle {
    margin-top: 0.85rem;
    font-family: var(--serif);
    font-size: 1.25rem;
    line-height: 1.4;
    color: var(--text-secondary);
    font-style: italic;
}

.post-body {
    font-size: 1.075rem;
    line-height: 1.75;
    color: var(--text);
}

.post-body > * + * {
    margin-top: 1.35rem;
}

.post-body h2 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(1.5rem, 3.2vw, 2rem);
    line-height: 1.25;
    letter-spacing: -0.015em;
    margin-top: 3rem;
    color: var(--text);
}

.post-body h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 1.35rem;
    line-height: 1.3;
    margin-top: 2.25rem;
    color: var(--text);
}

.post-body p {
    color: var(--text);
}

.post-body em {
    font-style: italic;
}

.post-body strong {
    font-weight: 600;
}

.post-body a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    transition: color 0.2s;
}

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

.post-body blockquote {
    margin: 2rem 0;
    padding: 0.25rem 0 0.25rem 1.5rem;
    border-left: 3px solid var(--accent);
    color: var(--text-secondary);
    font-family: var(--serif);
    font-size: 1.15rem;
    font-style: italic;
    line-height: 1.6;
}

.post-body blockquote p + p {
    margin-top: 0.75rem;
}

.post-body ul,
.post-body ol {
    padding-left: 1.4rem;
}

.post-body li + li {
    margin-top: 0.4rem;
}

.post-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

.post-body code {
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
    background: var(--bg-card);
    padding: 0.1em 0.35em;
    border-radius: 3px;
}

.post-body pre {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    font-size: 0.92rem;
}

.post-body pre code {
    background: none;
    padding: 0;
}

/* --- POST FOOTER --- */
.post-footer {
    max-width: 680px;
    margin: 0 auto;
    padding: 2rem 2rem 5rem;
    border-top: 1px solid var(--border);
}

.post-footer a {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: color 0.2s ease;
}

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

/* --- SITE FOOTER --- */
footer.site-footer {
    text-align: center;
    padding: 2rem 2rem 5rem;
    font-size: 0.8rem;
    color: var(--border);
}

/* --- RESPONSIVE --- */
@media (max-width: 700px) {
    nav {
        padding: 1rem 1.25rem;
    }

    nav .links {
        gap: 1.25rem;
    }

    nav .links a {
        font-size: 0.75rem;
    }

    .page-header {
        padding: 4rem 1.25rem 2rem;
    }

    .post-list {
        padding: 1.5rem 1.25rem 4rem;
    }

    .post {
        padding: 3.5rem 1.25rem 3rem;
    }

    .post-footer {
        padding: 1.5rem 1.25rem 4rem;
    }
}

@supports (padding: env(safe-area-inset-bottom)) {
    nav {
        padding-left: max(2rem, env(safe-area-inset-left));
        padding-right: max(2rem, env(safe-area-inset-right));
    }

    footer.site-footer {
        padding-bottom: max(2rem, calc(env(safe-area-inset-bottom) + 3rem));
    }

    @media (max-width: 700px) {
        nav {
            padding-left: max(1.25rem, env(safe-area-inset-left));
            padding-right: max(1.25rem, env(safe-area-inset-right));
        }

        .page-header,
        .post-list,
        .post,
        .post-footer {
            padding-left: max(1.25rem, env(safe-area-inset-left));
            padding-right: max(1.25rem, env(safe-area-inset-right));
        }
    }
}

@media (max-width: 700px) {
    nav .links {
        gap: 0.9rem;
    }

    .world-toggle {
        padding: 0.4rem 0.7rem;
        font-size: 0.68rem;
        letter-spacing: 0.06em;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================
   1994 RETRO MODE — blog chrome only. Post prose is left alone.
   ============================ */
body.retro {
    background: #000080;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(255,0,255,0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(0,255,255,0.08) 0%, transparent 50%),
        repeating-conic-gradient(#000080 0% 25%, #000070 0% 50%) 0 0 / 20px 20px;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    -webkit-font-smoothing: auto;
}

body.retro nav {
    background: #c0c0c0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 3px solid #808080;
    box-shadow: inset -2px -2px #808080, inset 2px 2px #fff;
}

body.retro nav::before {
    background: linear-gradient(90deg, #ff0000, #ff7700, #ffff00, #00ff00, #0000ff, #8b00ff);
    height: 3px;
    opacity: 1;
}

body.retro nav .name {
    font-family: 'Comic Sans MS', 'Times New Roman', cursive;
    color: #000;
    font-weight: 700;
    animation: retroRainbowText 3s linear infinite;
}

@keyframes retroRainbowText {
    0% { color: #ff0000; }
    16% { color: #ff7700; }
    33% { color: #008800; }
    50% { color: #0000ff; }
    66% { color: #8b00ff; }
    83% { color: #ff00ff; }
    100% { color: #ff0000; }
}

body.retro nav .links a {
    font-family: 'Courier New', monospace;
    color: #0000ff;
    text-decoration: underline;
    text-transform: none;
    letter-spacing: 0;
}

body.retro nav .links a:hover,
body.retro nav .links a[aria-current="page"] {
    color: #ff00ff;
}

body.retro .world-toggle {
    background: #c0c0c0;
    color: #000;
    border: 2px outset #fff;
    border-radius: 0;
    font-family: 'Courier New', monospace;
    letter-spacing: 0;
    text-transform: none;
    box-shadow: inset -1px -1px #808080, inset 1px 1px #fff;
}

body.retro .world-toggle:hover {
    background: #a0a0a0;
    color: #000;
}

body.retro .world-toggle:active {
    border-style: inset;
}

body.retro .page-header .label {
    color: #ff00ff;
    font-family: 'Courier New', monospace;
    letter-spacing: 0;
}

body.retro .page-header .label::before { content: '>>> '; opacity: 1; }
body.retro .page-header .label::after  { content: ' <<<'; opacity: 1; }

body.retro .page-header h1 {
    font-family: 'Comic Sans MS', 'Times New Roman', cursive;
    color: #ffff00;
    text-shadow: 3px 3px #ff0000, -1px -1px #00ff00;
}

body.retro .page-header h1 em {
    color: #00ffff;
    font-style: normal;
    text-decoration: underline;
}

body.retro .page-header .intro {
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
}

body.retro .post-list li {
    border-color: #00ff00;
}

body.retro .post-list time {
    color: #ffff00;
    font-family: 'Courier New', monospace;
}

body.retro .post-list h2 a {
    color: #00ffff;
    font-family: 'Comic Sans MS', 'Times New Roman', cursive;
    text-decoration: underline;
}

body.retro .post-list h2 a:hover {
    color: #ff00ff;
}

body.retro .post-list .excerpt {
    color: #00ff00;
    font-family: 'Courier New', monospace;
}

body.retro .post {
    background: #c0c0c0;
    border: 3px outset #fff;
    box-shadow: inset -2px -2px #808080, inset 2px 2px #fff, 6px 6px 0 #000;
    color: #000;
    padding: 2rem 2rem 2.5rem;
    margin: 3rem auto;
}

body.retro .post-meta {
    color: #000080;
    font-family: 'Courier New', monospace;
}

body.retro .post-header h1 {
    font-family: 'Comic Sans MS', 'Times New Roman', cursive;
    color: #000080;
    text-decoration: underline;
}

body.retro .post-header h1 em {
    color: #ff00ff;
    font-style: normal;
}

body.retro .post-subtitle {
    color: #000;
    font-family: 'Times New Roman', serif;
}

body.retro .post-body {
    color: #000;
    font-family: 'Times New Roman', serif;
    font-size: 1.05rem;
}

body.retro .post-body h2,
body.retro .post-body h3 {
    color: #000080;
    font-family: 'Comic Sans MS', 'Times New Roman', cursive;
}

body.retro .post-body a {
    color: #0000ff;
    text-decoration: underline;
}

body.retro .post-body a:hover {
    color: #ff00ff;
}

body.retro .post-body blockquote {
    background: #ffff00;
    border-left: 4px solid #ff0000;
    color: #000;
    font-family: 'Times New Roman', serif;
}

body.retro .post-body code,
body.retro .post-body pre {
    background: #fff;
    border: 1px inset #808080;
    border-radius: 0;
    color: #000080;
    font-family: 'Courier New', monospace;
}

body.retro .post-body hr {
    border-top: none;
    height: 4px;
    background: repeating-linear-gradient(
        90deg,
        #ff0000 0px, #ff0000 8px,
        #ffff00 8px, #ffff00 16px,
        #00ff00 16px, #00ff00 24px,
        #00ffff 24px, #00ffff 32px,
        #0000ff 32px, #0000ff 40px,
        #ff00ff 40px, #ff00ff 48px
    );
}

body.retro .post-footer {
    border-top: 2px dashed #00ff00;
}

body.retro .post-footer a {
    color: #0000ff;
    font-family: 'Courier New', monospace;
    text-decoration: underline;
}

body.retro .post-footer a:hover {
    color: #ff00ff;
}

body.retro footer.site-footer {
    color: #ffff00;
    font-family: 'Courier New', monospace;
    border-top: 2px dashed #00ff00;
}
