:root {
    --bg: #0F0D0C;
    --primary: #A8C3D9;
    --muted: #A99C8A;
    --accent: #C2D8EA;
    --text: #F2EBDD;
    --surface: #171310;
    --border: #312A23;
    --font-heading: 'Instrument Serif', serif;
    --font-body: "Fira Code", monospace;
    --container-width: 720px;
    --gutter: 24px;
}

/* Global CSS */
* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #3E362D var(--bg);
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
    background: #3E362D;
    border-radius: 10px;
    border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: #524738; }

body {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    background-color: var(--bg);
    color: var(--text);
    padding-inline: var(--gutter);
    font-family: var(--font-body);
    font-feature-settings: "liga" 1, "calt" 1;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

main {
    flex: 1;
}

h1, h2, h3 { font-family: var(--font-heading); font-weight: 400;}

h1 { font-size: clamp(2rem, 9vw, 3.5rem); line-height: 1.05; }
h2 { font-size: 2rem;  line-height: 1.2; }
h3 { font-size: 1.5rem; line-height: 1.2; }

h4, h5, h6 {
    font-family: var(--font-body);
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}
h4 { font-size: 0.9rem; }
h5 { font-size: 0.8rem; color: var(--muted); }
h6 { font-size: 0.75rem; color: var(--muted); letter-spacing: 0.12em; }

/* Fenced multi-line code block */
/* This is generated by chroma + goldmark highlighting */
.chroma {
    background: var(--surface);
    color: var(--text);         /* Code highlighting will be defined in chroma.css */
    border: 1px solid var(--border);
    border-radius: 0.5em;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    font-family: var(--font-body);
    font-size: 0.875rem;
    line-height: 1.7;
    tab-size: 4;
}
.chroma code { font-family: inherit; font-size: inherit; }

/* Inline code */
:not(pre) > code {
    font-family: var(--font-body);
    font-size: 0.875em;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.3125rem;
    padding: 0.1em 0.4em;
    color: var(--accent);
    white-space: nowrap;
}

/* Everything related to content and main Container of a page */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 1.875rem 0;
}

.content > * + * { margin-top: 1.125rem; }
.content p + ul,
.content p + ol { margin-top: 0.5rem; }
.content h2, .content h3 { margin-top: 2rem; }

.content a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.content a:hover {
    color: var(--accent);
}

.content ul, .content ol { padding-inline-start: 1.5rem; }
/* .content li + li { margin-top: 0.375rem; } */

/* Navigation Bar on top */
nav {
    max-width: var(--container-width);
    margin: 0 auto;
    width: 100%;
    padding: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    border-bottom: 1px solid var(--border);
    line-height: 1;
}

nav > .brand {
    all: unset;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--text);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.nav-links > .site {
    color: var(--muted);
    text-decoration: none;
}
.nav-links > .site:hover { color: var(--text); }


.nav-links .divider {
    width: 1px;
    height: 0.9em;
    background: var(--border);
}

.nav-links > .socials {
    color: var(--primary);
    text-decoration: none;
}

.nav-links > .socials:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Everything related to Footer */
footer {
    width: 100%;
    max-width: var(--container-width);
    margin: 3rem auto 0;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.4;
}

/* hero-photo.html shortcode CSS */
.hero-photo {
    margin-block: 2.5rem;
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 0.875rem;
}

.hero-photo__img {
    display: block;
    width: 100%;
    height: auto;
}

.hero-photo__info {
    display: flex;
    justify-content: space-between;
    padding-top: 0.75rem;
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}
.hero-photo__info .date { color: var(--primary); }
.hero-photo__meta      { color: var(--primary); }
.hero-photo__meta .sep { color: var(--muted); }

/* listing.html */
.listing {
    list-style: none;
    padding: 0;
    margin-top: 0.75rem;
}

.listing__item {
    padding: 1.125rem 0;
    border-bottom: 1px solid var(--border);
}

.listing__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    text-decoration: none;
    color: var(--primary);
}

.listing__row:hover .listing__title {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.listing__desc {
    margin-top: 0.375rem;
    color: var(--muted);
    font-size: 0.875rem;
}

.listing__date { flex: none; color: var(--muted); font-size: 0.75rem; }

/* ── Responsive ──────────────────────────────────────────────
   base sizes are desktop; these tighten things for tablet & phone */

/* tablet / small laptop */
@media (max-width: 720px) {
    :root { --gutter: 20px; }
    .container { padding: 1.5rem 0; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.375rem; }
}

/* phone */
@media (max-width: 520px) {
    :root { --gutter: 16px; }

    /* nav: brand on its own line, links wrap beneath it */
    nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.875rem 0;
    }
    .nav-links {
        width: 100%;
        gap: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }
    /* the | divider reads oddly once links wrap to multiple rows */
    .nav-links .divider { display: none; }

    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    /* long inline-code tokens must wrap, not overflow the screen */
    :not(pre) > code { white-space: normal; overflow-wrap: anywhere; }

    .chroma { font-size: 0.8125rem; padding: 0.875rem 1rem; }

    /* listing rows: title stacks over date/desc instead of squeezing */
    .listing__row { flex-direction: column; gap: 0.25rem; }

    /* footer stacks so the two halves don't collide */
    footer { flex-direction: column; gap: 0.5rem; }
}

/* Masonry Image grid shortcode */
.masonry-container {
    column-count: 2;
    column-gap: 12px;
}

.masonry-container img {
    width: 100%;
    margin-bottom: 12px;
    display: block;
    break-inside: avoid;
}

/* drop to a single column once 2 gets too cramped on phones */
@media (max-width: 480px) {
    .masonry-container {
        column-count: 1;
    }
}