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

/* ─── TOKENS — LIGHT MODE ───────────────────────────────── */
:root {
    --bg: #FFFFFF;
    --bg-deep: #F5F5F5;
    --bg-hero-cap: #EFEFEF;
    --text: #0D0D0D;
    --text-muted: #666666;
    --accent: #000000;
    --accent-dark: #0D0D0D;
    --rule: #DDDDDD;
    --stamp-red: #B22222;
    --toggle-bg: #E8E8E8;
    --toggle-fg: #0D0D0D;

    --font-sans: 'Noto Sans', 'Inter', system-ui, sans-serif;
    --font-mono: 'Space Mono', 'Courier New', monospace;

    --col-width: 600px;
    --side-pad: 2rem;
}

/* ─── TOKENS — DARK MODE ────────────────────────────────── */
[data-theme="dark"] {
    --bg: #000000;
    --bg-deep: #0A0A0A;
    --bg-hero-cap: #0D0D0D;
    --text: #F0F0F0;
    --text-muted: #888888;
    --accent: #FFFFFF;
    --accent-dark: #E0E0E0;
    --rule: #2A2A2A;
    --stamp-red: #E05252;
    --toggle-bg: #2A2A2A;
    --toggle-fg: #F0F0F0;
}

html {
    scroll-behavior: smooth;
    font-size: 18px;
}

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

/* ─── TYPOGRAPHY ────────────────────────────────────────── */
h1,
h2,
h3 {
    font-family: var(--font-sans);
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.mono {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.05em;
}

/* ─── LAYOUT ────────────────────────────────────────────── */
.rule-full {
    border: none;
    border-top: 1px solid var(--rule);
    margin: 0;
    transition: border-color 0.3s ease;
}

.rule-section {
    border: none;
    border-top: 1px solid var(--rule);
    max-width: var(--col-width);
    margin-inline: auto;
    margin-block: 4rem;
    transition: border-color 0.3s ease;
}

/* ─── DARK MODE TOGGLE ──────────────────────────────────── */
.theme-toggle {
    position: fixed;
    top: 1.25rem;
    right: 1.5rem;
    z-index: 100;
    background: transparent;
    border: none;
    color: var(--text);
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    opacity: 0.6;
}

.icon-sun,
.icon-moon {
    width: 20px;
    height: 20px;
    display: none;
}

[data-theme="dark"] .icon-sun {
    display: block;
}

html:not([data-theme="dark"]) .icon-moon {
    display: block;
}

/* ─── HEADER ────────────────────────────────────────────── */
.site-header {
    max-width: var(--col-width);
    margin-inline: auto;
    padding: 3.5rem var(--side-pad) 2rem;
    position: relative;
}

.header-stamp {
    position: absolute;
    top: 3rem;
    right: var(--side-pad);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.stamp-label {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    letter-spacing: 0.18em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stamp-code {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    border: 1px solid var(--rule);
    padding: 1px 5px;
    transition: border-color 0.3s ease;
}

.site-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text);
    margin-bottom: 0.3rem;
    font-weight: 700;
}

.site-subtitle {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 2rem;
    letter-spacing: 0;
}

/* ─── NAVIGATION ────────────────────────────────────────── */
.site-nav {
    display: flex;
    gap: 2rem;
}

.site-nav a {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text);
    text-decoration: none;
    position: relative;
    padding-bottom: 2px;
    transition: color 0.2s ease;
}

.site-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--text);
    transition: width 0.22s ease;
}

.site-nav a:hover::after {
    width: 100%;
}

/* ─── HERO ──────────────────────────────────────────────── */
.hero {
    max-width: var(--col-width);
    margin-inline: auto;
    padding-inline: var(--side-pad);
    padding-block: 2rem 0;
    display: flex;
    justify-content: center;
}

.hero-globe-wrap {
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-globe {
    width: 100%;
    height: 100%;
    display: block;
}

[data-theme="light"] .hero-globe {
    filter: invert(1);
}

/* ─── SECTIONS ──────────────────────────────────────────── */
.main-content {
    max-width: var(--col-width);
    margin-inline: auto;
    padding-inline: var(--side-pad);
    padding-block: 2rem 5rem;
}

.section-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1.4rem;
    letter-spacing: -0.025em;
}

/* ─── ABOUT ─────────────────────────────────────────────── */
.lead {
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.65;
    color: var(--text);
    margin-bottom: 1.3rem;
}

.main-content p {
    font-size: 0.94rem;
    margin-bottom: 1.1rem;
    color: var(--text);
    line-height: 1.75;
    font-weight: 400;
}

.inline-link {
    color: var(--text);
    text-decoration-line: underline;
    text-decoration-style: solid;
    text-decoration-color: var(--rule);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s ease;
}

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

.about-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
    transition: border-color 0.3s ease;
}

.about-links .inline-link {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
}

.separator {
    color: var(--rule);
    font-family: var(--font-mono);
}

/* ─── WRITING ───────────────────────────────────────────── */
.section-preamble {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.writing-list {
    display: flex;
    flex-direction: column;
}

.writing-entry {
    padding-block: 1.8rem;
    border-bottom: 1px solid var(--rule);
    display: grid;
    grid-template-columns: 88px 1fr;
    grid-template-rows: auto auto;
    column-gap: 1.5rem;
    row-gap: 0.35rem;
    transition: border-color 0.3s ease;
}

.writing-entry:first-child {
    border-top: 1px solid var(--rule);
}

.writing-meta {
    grid-column: 1;
    grid-row: 1;
    padding-top: 0.15rem;
}

.writing-date {
    color: var(--text-muted);
    font-size: 0.64rem;
    letter-spacing: 0.06em;
    display: block;
}

.writing-title {
    grid-column: 2;
    grid-row: 1;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.3;
}

.writing-link {
    color: var(--text);
    text-decoration: none;
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
}

.writing-arrow {
    display: inline-block;
    font-size: 0.85em;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.writing-link:hover .writing-arrow {
    opacity: 1;
    transform: translateX(2px);
}

.writing-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.writing-desc {
    grid-column: 2;
    grid-row: 2;
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.65;
    margin-bottom: 0;
}

/* ─── FOOTER ────────────────────────────────────────────── */
.site-footer {
    max-width: var(--col-width);
    margin-inline: auto;
    padding: 2.5rem var(--side-pad) 5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.footer-stamp {
    color: var(--stamp-red);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-size: 0.6rem;
    opacity: 0.65;
    font-family: var(--font-mono);
}

.footer-copy {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--font-sans);
}

.footer-sig {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* ─── SELECTION ─────────────────────────────────────────── */
::selection {
    background: var(--text);
    color: var(--bg);
}

/* ─── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--rule);
    border-radius: 2px;
}

/* ─── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 640px) {
    html {
        font-size: 16px;
    }

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

    .header-stamp {
        display: none;
    }

    .section-title {
        font-size: 1.35rem;
    }

    .theme-toggle {
        top: 1rem;
        right: 1rem;
    }

    .writing-entry {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }

    .writing-meta {
        grid-column: 1;
        grid-row: 1;
    }

    .writing-title {
        grid-column: 1;
        grid-row: 2;
    }

    .writing-desc {
        grid-column: 1;
        grid-row: 3;
    }

    .hero {
        padding-block: 2rem 0;
    }

    .main-content {
        padding-block: 2.5rem 3rem;
    }

    .about-links {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .separator {
        display: none;
    }
}

/* ─── FOCUS ─────────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 3px;
}

/* ─── ENTRANCE ANIMATION ────────────────────────────────── */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.site-header {
    animation: fadeUp 0.45s ease both;
}

.hero {
    animation: fadeUp 0.45s ease 0.07s both;
}

.main-content {
    animation: fadeUp 0.45s ease 0.14s both;
}