/* Shared styles for the homepage and blog.
   The optional 1994 look is at the bottom, under .retro (a class on <html>
   that the "The beginning..." button switches on and off). */

: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;
    --mono: 'Courier New', monospace;
    --comic: 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', cursive;
    --measure: 680px;
    --gutter: 1.5rem;
    /* Lines full-width bars (header, footer) up with the centred column. */
    --edge: max(var(--gutter), calc((100% - var(--measure)) / 2 + var(--gutter)));
}

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

[hidden] {
    display: none !important;
}

@media (prefers-reduced-motion: no-preference) {
    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;
}

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

/* --- HEADER --- */
.site-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem 1.5rem;
    padding: 2rem var(--edge) 0;
}

.site-header .name {
    font-family: var(--serif);
    font-size: 1.35rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.site-header nav {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 1.25rem;
}

.site-header nav a,
.world-toggle {
    font-family: var(--sans);
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease;
}

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

/* The 1994 switch is an optional extra, so it sits quietly with the links. */
.world-toggle {
    background: none;
    border: none;
    padding: 0;
    font-style: italic;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* --- HOMEPAGE --- */
.home {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.home > section + section {
    margin-top: 4.5rem;
}

.intro {
    padding-top: 4.5rem;
}

.portrait {
    display: block;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 2rem;
}

.portrait-1994 {
    display: none;
}

.intro h1 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(2.6rem, 7vw, 3.5rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 1.25rem;
}

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

.intro p {
    font-size: 1.15rem;
    color: var(--text-secondary);
}

/* Small uppercase labels above each section. */
.label {
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.entries {
    list-style: none;
}

.entries li {
    padding: 1.1rem 0;
    border-top: 1px solid var(--border);
}

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

.entries h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 1.3rem;
    line-height: 1.3;
}

.entries p {
    margin-top: 0.3rem;
    color: var(--text-secondary);
}

.entries a,
.contact-links a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: color 0.2s ease;
}

.entries a:hover,
.contact-links a:hover {
    color: var(--accent-hover);
}

.entry-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    font-size: 0.92rem;
}

/* Writing: title and date on one line. */
.writing li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.25rem 1rem;
}

.writing a {
    font-family: var(--serif);
    font-size: 1.3rem;
    line-height: 1.3;
    color: var(--text);
    text-decoration: none;
}

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

.writing time {
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* --- CONTACT --- */
.contact .lede {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.contact-form label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.contact-form input,
.contact-form textarea {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-family: var(--sans);
    font-size: 1rem;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.15);
}

.contact-form textarea {
    min-height: 140px;
    resize: vertical;
}

.contact-form button {
    font-family: var(--sans);
    font-size: 0.95rem;
    font-weight: 500;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 6px;
    padding: 0.8rem 1.75rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.contact-form button:hover {
    background: var(--accent-hover);
}

.form-success {
    color: var(--accent);
    font-size: 1.05rem;
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin-top: 2.5rem;
}

/* --- FOOTER --- */
.site-footer {
    padding: 3rem var(--edge);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* --- BLOG INDEX --- */
.page-header {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 4.5rem var(--gutter) 2.5rem;
}

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

.page-header .lede {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.post-list {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 var(--gutter);
    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-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    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 {
    color: var(--text-secondary);
}

/* --- POST --- */
.post {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 4.5rem var(--gutter) 3rem;
}

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

.post-meta {
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    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-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;
}

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

.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 ease;
}

.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: var(--mono);
    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 {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 2rem var(--gutter) 0;
    border-top: 1px solid var(--border);
}

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

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

/* --- SMALL SCREENS --- */
@media (max-width: 600px) {
    :root {
        --gutter: 1.25rem;
    }

    .site-header {
        padding-top: 1.5rem;
    }

    .intro,
    .page-header,
    .post {
        padding-top: 3rem;
    }

    .portrait {
        width: 96px;
        height: 96px;
    }

    .home > section + section {
        margin-top: 3.5rem;
    }
}

/* ============================
   1994 MODE: same words, different decade.
   ============================ */
.retro body {
    background: #000080 repeating-conic-gradient(#000080 0% 25%, #000070 0% 50%) 0 0 / 20px 20px;
    color: #00ff00;
    font-family: var(--mono);
    -webkit-font-smoothing: auto;
}

.retro :focus-visible {
    outline: 2px dotted #ffff00;
}

.retro .site-header {
    position: relative;
    padding-bottom: 1rem;
    padding-top: 1.25rem;
    background: #c0c0c0;
    border-bottom: 3px solid #808080;
}

.retro .site-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff0000, #ff7700, #ffff00, #00ff00, #0000ff, #8b00ff);
}

.retro .site-header .name {
    font-family: var(--comic);
    font-weight: 700;
    letter-spacing: 0;
    animation: rainbowText 3s linear infinite;
}

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

.retro .site-header nav a {
    font-family: var(--mono);
    color: #0000ff;
    text-decoration: underline;
}

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

.retro .world-toggle {
    font-family: var(--mono);
    font-style: normal;
    color: #000;
    background: #c0c0c0;
    border: 2px outset #fff;
    padding: 0.1rem 0.6rem;
}

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

.retro .intro h1,
.retro .page-header h1 {
    font-family: var(--comic);
    color: #ffff00;
    text-shadow: 3px 3px #ff0000;
    letter-spacing: 0;
}

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

.retro .intro p,
.retro .entries p,
.retro .contact .lede,
.retro .page-header .lede,
.retro .post-list .excerpt {
    color: #00ff00;
}

.retro .portrait-now {
    display: none;
}

.retro .portrait-1994 {
    display: block;
    width: 150px;
    height: 150px;
    border-radius: 0;
    border: 4px solid #ffff00;
    box-shadow: 6px 6px 0 #ff00ff;
    transform: rotate(-3deg);
}

.retro .label {
    color: #ff00ff;
    letter-spacing: 0.05em;
}

.retro .label::before {
    content: '>>> ';
}

.retro .label::after {
    content: ' <<<';
}

.retro .home > section + section::before {
    content: '';
    display: block;
    height: 4px;
    margin-bottom: 2.5rem;
    background: repeating-linear-gradient(90deg,
        #ff0000 0 8px, #ffff00 8px 16px, #00ff00 16px 24px,
        #00ffff 24px 32px, #0000ff 32px 40px, #ff00ff 40px 48px);
}

.retro .entries li,
.retro .post-list li {
    border-top-style: dashed;
    border-color: #00ff00;
}

.retro .entries li:last-child,
.retro .post-list li:last-child {
    border-bottom-style: dashed;
}

.retro .entries h3 {
    font-family: 'Times New Roman', Times, serif;
    color: #ffff00;
}

.retro .entries a,
.retro .contact-links a,
.retro .post-footer a {
    color: #00ffff;
    text-decoration: underline;
}

.retro .entries a:hover,
.retro .contact-links a:hover,
.retro .post-footer a:hover,
.retro .writing a:hover,
.retro .post-list h2 a:hover {
    color: #ff00ff;
}

.retro .writing a,
.retro .post-list h2 a {
    font-family: var(--comic);
    color: #00ffff;
    text-decoration: underline;
}

.retro .writing time,
.retro .post-list time {
    color: #ffff00;
}

.retro .contact-form label {
    color: #ffff00;
    font-family: var(--mono);
    text-transform: none;
    letter-spacing: 0;
}

.retro .contact-form input,
.retro .contact-form textarea {
    color: #000;
    background: #fff;
    border: 2px inset #808080;
    border-radius: 0;
    font-family: var(--mono);
}

.retro .contact-form input:focus,
.retro .contact-form textarea:focus {
    box-shadow: none;
    outline: 2px dotted #ffff00;
}

.retro .contact-form button {
    color: #000;
    background: #c0c0c0;
    border: 3px outset #fff;
    border-radius: 0;
    font-family: var(--mono);
    font-weight: 700;
}

.retro .contact-form button:hover {
    background: #a0a0a0;
}

.retro .contact-form button:active {
    border-style: inset;
}

.retro .form-success {
    color: #ffff00;
}

.retro .site-footer {
    color: #c0c0c0;
    font-family: var(--mono);
    border-top: 2px dashed #00ff00;
}

.retro .site-footer::before {
    content: 'You are visitor #' attr(data-visitors) ' | Best viewed in Netscape Navigator at 640x480';
    display: block;
    color: #ffff00;
    margin-bottom: 0.5rem;
}

/* Blog posts sit in a grey 1994 window. */
.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;
}

.retro .post-meta {
    color: #000080;
}

.retro .post-header h1 {
    font-family: var(--comic);
    color: #000080;
    text-decoration: underline;
}

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

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

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

.retro .post-body h2,
.retro .post-body h3 {
    color: #000080;
    font-family: var(--comic);
}

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

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

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

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

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

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

@media (max-width: 600px) {
    .retro .portrait-1994 {
        width: 128px;
        height: 128px;
    }

    .retro .post {
        margin: 1.5rem 0.75rem;
        padding: 1.5rem 1.25rem 2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .retro .site-header .name {
        animation: none;
        color: #ff0000;
    }
}
