/* Sojourn — a quiet typographic theme for keanuheydari.com
   Headings: Source Serif 4 (variable, optical size)
   Body:     Source Sans 3 (variable)                                  */

/* ---------- Fonts ---------- */

@font-face {
    font-family: "Source Serif 4";
    src: url("../fonts/source-serif-4-latin-opsz-normal.woff2") format("woff2");
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Source Serif 4";
    src: url("../fonts/source-serif-4-latin-opsz-italic.woff2") format("woff2");
    font-weight: 200 900;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: "Source Sans 3";
    src: url("../fonts/source-sans-3-latin-wght-normal.woff2") format("woff2");
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Source Sans 3";
    src: url("../fonts/source-sans-3-latin-wght-italic.woff2") format("woff2");
    font-weight: 200 900;
    font-style: italic;
    font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
    --serif: var(--gh-font-heading, "Source Serif 4", Georgia, serif);
    --sans: var(--gh-font-body, "Source Sans 3", -apple-system, "Segoe UI", sans-serif);
    --ink: #1c1b1a;
    --ink-soft: #55524e;
    --ink-faint: #8a8680;
    --paper: #fbfaf8;
    --rule: color-mix(in srgb, var(--ink) 11%, var(--paper));
    --tint: color-mix(in srgb, var(--ink) 6%, var(--paper));
    --accent: var(--ghost-accent-color, #5c4a3a);
    --measure: 42rem;      /* ~672px reading column */
    --measure-wide: 56rem;
    --gutter: 1.25rem;
    --sn-width: 15rem;     /* sidenote column */
    --title-size: clamp(1.9rem, 4.5vw, 2.25rem);   /* all page titles */
    --sn-gap: 3rem;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 106.25%; /* 17px */ -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--sans);
    font-weight: 400;
    line-height: 1.65;
    color: var(--ink);
    background: var(--paper);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-main { flex: 1; }

.wrap {
    max-width: calc(var(--measure) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 0 var(--gutter);
}
.wrap-wide { max-width: calc(var(--measure-wide) + 2 * var(--gutter)); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--serif);
    font-weight: 560;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin: 2.2em 0 0.6em;
}
h1 { font-size: 2.1rem; font-weight: 600; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }

a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--rule);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    transition: text-decoration-color 120ms ease, color 120ms ease;
}
a:hover { text-decoration-color: var(--accent); color: var(--accent); }

.eyebrow {
    display: block;
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0 0 0.8rem;
}
.eyebrow a { text-decoration: none; color: inherit; }
.eyebrow a:hover { color: var(--accent); }

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

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Header / footer ---------- */

.site-header { border-bottom: 1px solid var(--rule); }
.site-header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    padding-top: 1.4rem;
    padding-bottom: 1.4rem;
}
.site-title {
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 620;
    text-decoration: none;
}
.site-logo { max-height: 2rem; width: auto; display: block; }

.site-nav ul, .footer-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.35rem;
}
.site-nav a, .footer-nav a {
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--ink-soft);
}
.site-nav a:hover, .footer-nav a:hover { color: var(--accent); }
.site-nav .nav-current a { color: var(--ink); font-weight: 600; }

.site-footer { border-top: 1px solid var(--rule); margin-top: 5rem; }
.site-footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem 1.5rem;
    padding-top: 1.5rem;
    padding-bottom: 2.2rem;
}
.footer-nav-label { margin-bottom: 0.5rem; font-size: 0.66rem; }

.footer-meta {
    margin: 0;
    font-size: 0.82rem;
    color: var(--ink-faint);
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
}
.footer-meta a { text-decoration: none; color: inherit; }
.footer-meta a:hover { color: var(--accent); }

/* ---------- Homepage ---------- */

.home { padding-top: 4.5rem; padding-bottom: 3rem; }

.home-name {
    font-size: clamp(2.2rem, 6vw, 3rem);
    font-weight: 640;
    margin: 0;
}
.home-tagline {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--ink-soft);
    margin: 0.6rem 0 0;
}

.home-intro { margin-top: 2.6rem; }
.home-intro p {
    font-size: 1.12rem;
    line-height: 1.7;
    margin: 0;
}

.home-current {
    margin-top: 2.8rem;
    padding: 1.1rem 1.25rem;
    border-left: 2px solid var(--accent);
    background: color-mix(in srgb, var(--accent) 4%, transparent);
}
.home-current .eyebrow { margin-bottom: 0.35rem; }
.home-current p { margin: 0; font-size: 0.97rem; color: var(--ink-soft); }
.home-current-link { white-space: nowrap; font-size: 0.88rem; }

.home-selected { margin-top: 3.6rem; }
.home-selected-list { border-top: 1px solid var(--rule); }
.selected-item { padding: 1.35rem 0; border-bottom: 1px solid var(--rule); }
.selected-item-title { font-size: 1.25rem; margin: 0; }
.selected-item-title a { text-decoration: none; }
.selected-item-title a:hover { color: var(--accent); }
.selected-item-excerpt { margin: 0.4rem 0 0; color: var(--ink-soft); font-size: 0.97rem; }
.selected-item-meta { margin: 0.5rem 0 0; font-size: 0.8rem; color: var(--ink-faint); }
.home-all-link { margin-top: 1.4rem; font-size: 0.92rem; }
.home-all-link a { text-decoration: none; color: var(--ink-soft); }
.home-all-link a:hover { color: var(--accent); }

/* ---------- Archive / blog index ---------- */

.archive { padding-top: 3.5rem; padding-bottom: 3rem; }
.archive-title { margin: 0; font-size: var(--title-size); }
.archive-description { color: var(--ink-soft); margin: 0.8rem 0 0; }
.archive-header { margin-bottom: 2.4rem; }

.post-list { border-top: 1px solid var(--rule); }
.post-item {
    display: grid;
    grid-template-columns: 9.5rem 1fr;
    gap: 1.5rem;
    padding: 1.3rem 0;
    border-bottom: 1px solid var(--rule);
}
.post-item-date {
    font-size: 0.82rem;
    color: var(--ink-faint);
    padding-top: 0.35rem;
    font-variant-numeric: oldstyle-nums;
}
.post-item-title { font-size: 1.2rem; margin: 0; }
.post-item-title a { text-decoration: none; }
.post-item-title a:hover { color: var(--accent); }
.post-item-excerpt { margin: 0.35rem 0 0; color: var(--ink-soft); font-size: 0.95rem; }
.post-item-tag {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

@media (max-width: 620px) {
    .post-item { grid-template-columns: 1fr; gap: 0.2rem; }
    .post-item-date { padding-top: 0; }
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 2.2rem;
    font-size: 0.9rem;
}
.pagination-info { color: var(--ink-faint); font-size: 0.82rem; }
.pagination-link { text-decoration: none; color: var(--ink-soft); }
.pagination-link:hover { color: var(--accent); }

/* ---------- Post & page ---------- */

.post-article, .page-article { padding-top: 3.5rem; padding-bottom: 3rem; }

.post-header { margin-bottom: 2.2rem; }
.post-title { margin: 0; font-size: var(--title-size); }
.post-subtitle {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--ink-soft);
    margin: 0.7rem 0 0;
    line-height: 1.45;
}
.post-meta { margin: 1rem 0 0; font-size: 0.85rem; color: var(--ink-faint); }

.post-feature-image { margin: 0 0 2.4rem; }
.post-feature-image img { width: 100%; height: auto; display: block; }
.post-feature-image figcaption {
    font-size: 0.8rem;
    color: var(--ink-faint);
    margin-top: 0.5rem;
    text-align: center;
}

/* ---------- Post content ---------- */

.gh-content { font-size: 1.02rem; }
.gh-content > * + * { margin-top: 1.15em; }
.gh-content p { margin: 1.15em 0 0; }
.gh-content > :first-child { margin-top: 0; }

.gh-content blockquote {
    margin: 1.4em 0 0;
    padding-left: 1.25rem;
    border-left: 2px solid var(--rule);
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.02rem;
    color: var(--ink-soft);
}
.gh-content blockquote em { font-style: normal; }

.gh-content hr {
    border: 0;
    margin: 1.3em auto;
    text-align: center;
    height: auto;
    line-height: 1;
}
.gh-content hr::after {
    content: "· · ·";
    letter-spacing: 0.6em;
    color: var(--ink-faint);
    font-size: 0.9rem;
    line-height: 1;
}

.gh-content ul, .gh-content ol { padding-left: 1.4rem; }
.gh-content li + li { margin-top: 0.35em; }

.gh-content img { max-width: 100%; height: auto; }
.gh-content figcaption { font-size: 0.8rem; color: var(--ink-faint); text-align: center; margin-top: 0.5rem; }

.gh-content pre {
    background: var(--tint);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 1rem 1.1rem;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.55;
}
.gh-content code { font-size: 0.88em; background: var(--tint); padding: 0.1em 0.3em; border-radius: 3px; }
.gh-content pre code { background: none; padding: 0; }

.gh-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.gh-content th, .gh-content td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--rule);
}
.gh-content th { font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }

/* Ghost width cards inside a fixed column */
.kg-width-wide, .kg-width-full { margin-left: 0; margin-right: 0; }
@media (min-width: 1000px) {
    .kg-width-wide {
        margin-left: calc((var(--measure-wide) - var(--measure)) / -2);
        margin-right: calc((var(--measure-wide) - var(--measure)) / -2);
    }
}

/* ---------- Sidenotes ---------- */

.sn-ref {
    cursor: pointer;
    vertical-align: super;
    line-height: 0;
    font-size: 0.68em;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    padding: 0 0.1em;
}
.sn-ref:hover { text-decoration: underline; }

.sn-note {
    display: none;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--ink-soft);
}
.sn-note .sn-num { font-weight: 700; color: var(--accent); margin-right: 0.35em; }
.sn-note p { margin: 0 0 0.4em; display: inline; }
.sn-note a { overflow-wrap: anywhere; }

/* Wide: float notes into the right margin beside the centered column.
   Breakpoint = measure (42rem) + 2 x overhang (18rem each side, keeping
   the column centered) ~ 78rem ~ 1340px, so the notes never force a
   horizontal scrollbar and the column never moves off center. */
@media (min-width: 1340px) {
    body.has-sidenotes .sn-note {
        display: block;
        float: right;
        clear: right;
        width: var(--sn-width);
        margin-right: calc(-1 * (var(--sn-width) + var(--sn-gap)));
        margin-top: 0.2em;
        margin-bottom: 0.8rem;
    }
    body.has-sidenotes .footnotes,
    body.has-sidenotes .sn-source { display: none; }
}

/* Narrow: tap to reveal inline */
@media (max-width: 1339.98px) {
    .sn-note.is-open {
        display: block;
        margin: 0.6rem 0;
        padding: 0.7rem 0.9rem;
        border-left: 2px solid var(--accent);
        background: color-mix(in srgb, var(--accent) 4%, transparent);
    }
}

/* Endnote list styling (visible on narrow screens / no-JS) */
.footnotes, .sn-source {
    margin-top: 3rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--rule);
    font-size: 0.85rem;
    color: var(--ink-soft);
}
.footnotes hr, .sn-source hr { display: none; }

/* ---------- Post footer ---------- */

.post-footer {
    margin-top: 3rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--rule);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    font-size: 0.85rem;
}
.post-tags { margin: 0; }
.post-tags a { text-decoration: none; color: var(--ink-soft); text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.1em; font-weight: 600; }
.post-tags a:hover { color: var(--accent); }
.post-back { margin: 0; }
.post-back a { text-decoration: none; color: var(--ink-soft); }
.post-back a:hover { color: var(--accent); }

/* ---------- Now page ---------- */

.page-now .post-body { font-size: 1.02rem; }

/* ---------- Timeline page ----------
   Author the page as: H2 for each year/period, then paragraphs or lists. */

.timeline-body { position: relative; padding-left: 1.6rem; }
.timeline-body::before {
    content: "";
    position: absolute;
    left: 0.28rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 1px;
    background: var(--rule);
}
.timeline-body h2 {
    position: relative;
    font-size: 1.1rem;
    font-family: var(--sans);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 2.2em;
}
.timeline-body h2::before {
    content: "";
    position: absolute;
    left: -1.6rem;
    top: 0.42em;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: var(--paper);
    border: 2px solid var(--accent);
}
.timeline-body > :first-child, .timeline-body h2:first-child { margin-top: 0; }

/* ---------- CV page ---------- */

.cv-body h2 {
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 0.4rem;
    margin-top: 2.6em;
}
.cv-body h3 { font-size: 1.05rem; margin-top: 1.6em; }
.cv-body ul { list-style: none; padding-left: 0; }
.cv-body li + li { margin-top: 0.5em; }

@media print {
    .site-header, .site-footer, .post-back, .cv-print { display: none !important; }
    body { background: #fff; color: #000; font-size: 10.5pt; }
    .wrap, .wrap-wide { max-width: none; padding: 0; }
    a { text-decoration: none; color: inherit; }
    .post-article, .page-article { padding-top: 0; }
}

/* ---------- Error pages ---------- */

.error-page { padding-top: 5rem; padding-bottom: 4rem; }
.error-page .post-title { font-size: 4rem; margin-bottom: 0.5rem; }


/* ---------- Post template variants & options ---------- */

/* Wide template: broader measure, endnotes instead of margin notes */
.tpl-wide { --measure: var(--measure-wide); }

/* Serif body option (headings unchanged; notes stay in the sans) */
.body-serif .gh-content { font-family: var(--serif); font-size: 1.04rem; }
.body-serif .gh-content .sn-note,
.body-serif .footnotes, .body-serif .sn-source { font-family: var(--sans); }

/* Drop cap option */
.has-dropcap .gh-content > p:first-of-type::first-letter {
    font-family: var(--serif);
    float: left;
    font-size: 3.4em;
    line-height: 0.82;
    font-weight: 560;
    padding: 0.06em 0.1em 0 0;
}
