/* ============================================================
   Cantoworks — Thomas Woodrow
   Paper-and-ink design system, ported from the
   "New Adventures in Hi-Fi" reference page.

   Palette:   paper rgb(247,247,247) / ink rgb(25,25,25)
   Accent:    cyan rgb(26,195,255) — hover only
   Type:      Atkinson Hyperlegible Next (body/UI, self-hosted)
              Amiri 700 (display / h1)
              Cormorant Garamond (audio labels, track names)
   ============================================================ */

/* ---- Self-hosted body face -------------------------------- */
/* Atkinson Hyperlegible (the original family). The reference page
   used "Atkinson Hyperlegible Next"; these are the classic release
   you provided — visually near-identical, same name table here. */
@font-face {
    font-family: 'Atkinson Hyperlegible';
    src: url('../fonts/atkinson-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Atkinson Hyperlegible';
    src: url('../fonts/atkinson-bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Atkinson Hyperlegible';
    src: url('../fonts/atkinson-italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Atkinson Hyperlegible';
    src: url('../fonts/atkinson-bolditalic.woff2') format('woff2');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

/* ---- Design tokens ---------------------------------------- */
:root {
    --paper: rgb(247, 247, 247);
    --ink: rgb(25, 25, 25);
    --ink-soft: rgb(85, 85, 85);
    --ink-faint: rgb(140, 140, 140);
    --rule: rgb(200, 200, 200);
    --rule-soft: rgb(215, 215, 215);
    --panel: rgb(240, 240, 240);
    --panel-hover: rgb(228, 228, 228);
    --panel-active: rgb(225, 225, 225);
    --accent: rgb(26, 195, 255);

    --display: 'Amiri', 'Adobe Garamond Pro', Georgia, serif;
    --serif: 'Cormorant Garamond', 'Adobe Garamond Pro', Georgia, serif;
    --body: 'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, sans-serif;

    --measure: 38em;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: rgb(26, 26, 26);
        --ink: rgb(204, 204, 204);
        --ink-soft: rgb(170, 170, 170);
        --ink-faint: rgb(120, 120, 120);
        --rule: rgb(68, 68, 68);
        --rule-soft: rgb(55, 55, 55);
        --panel: rgb(34, 34, 34);
        --panel-hover: rgb(42, 42, 42);
        --panel-active: rgb(45, 45, 45);
        /* h1 + byline lift slightly in dark mode, matching source */
        --ink-display: rgb(240, 240, 240);
    }
    .title-block h1,
    .post-title { color: var(--ink-display); }
    .title-block .byline { color: var(--ink-display); }
}

/* ---- Base ------------------------------------------------- */
* { box-sizing: border-box; }
html { font-size: 18px; }
@media (max-width: 600px) { html { font-size: 22px; } }

body {
    font-family: var(--body);
    font-size: 1.15rem;
    line-height: 1.4;
    color: var(--ink);
    background: var(--paper);
    max-width: var(--measure);
    margin: 0 auto;
    padding: 2rem 1.5rem;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

p { margin: 0 0 1em 0; }

a { color: var(--ink); text-decoration: underline; }
a:hover { color: var(--accent); }

img { max-width: 100%; height: auto; }

/* ---- Site header / nav ------------------------------------ */
.site-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1em;
    padding-bottom: 1.4em;
    margin-bottom: 1.6em;
    border-bottom: 1px solid var(--rule);
    flex-wrap: wrap;
}
@media (prefers-color-scheme: dark) {
    .site-head { border-bottom-color: var(--rule); }
}

.site-head .wordmark {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1;
    text-decoration: none;
    color: var(--ink);
}
.site-head .wordmark:hover { color: var(--accent); }

.site-nav {
    display: flex;
    gap: 1.1em;
    font-size: 0.82rem;
    letter-spacing: 0.01em;
}
.site-nav a { text-decoration: none; }
.site-nav a:hover { color: var(--accent); }

/* ---- Title block (post + reference parity) ---------------- */
.title-block {
    padding: 2.5em 0 1.2em 0;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 0.8em;
}
.title-block h1,
.post-title {
    font-family: var(--display);
    font-weight: 700;
    font-size: 2rem;
    line-height: 1.15;
    color: var(--ink);
    margin: 0 0 0.5em 0;
}
.title-block .byline {
    font-family: var(--body);
    font-size: 0.9rem;
    color: var(--ink);
    margin: 0;
}
@media (max-width: 600px) {
    .title-block h1,
    .post-title { font-size: 7.8vw; }
}

/* ---- Post body ------------------------------------------- */
.post-content h2 { font-family: var(--display); font-weight: 700; font-size: 1.5rem; margin: 1.4em 0 0.4em; }
.post-content h3 { font-family: var(--display); font-weight: 700; font-size: 1.2rem; margin: 1.3em 0 0.3em; }
.post-content blockquote {
    margin: 1.2em 0;
    padding-left: 1em;
    border-left: 2px solid var(--rule);
    color: var(--ink-soft);
    font-style: italic;
}
.post-content figure { margin: 1.5em 0; }
.post-content figcaption {
    font-size: 0.8rem;
    color: var(--ink-faint);
    text-align: center;
    margin-top: 0.5em;
}

/* ---- Audio player (verbatim port; class-scoped) ----------- */
.audio-player {
    margin: 1.5em 0.75em 1.5em 0;
    padding: 1em 1.2em;
    border: 1px solid var(--rule);
    border-radius: 10px;
    background: var(--panel);
}
.audio-player .track-label {
    font-family: var(--serif);
    font-weight: 500;
    font-style: normal;
    font-size: 1.15rem;
    color: var(--ink-soft);
    margin-bottom: 0.6em;
}
.playlist { margin-bottom: 0.8em; }
.playlist-track {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--ink);
    cursor: pointer;
    padding: 0.5em 0.2em;
    border-bottom: 1px solid var(--rule-soft);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    transition: background 0.12s ease;
}
.playlist-track:first-child { border-top: 1px solid var(--rule-soft); }
.playlist-track:hover { background: var(--panel-hover); }
.playlist-track.active { background: var(--panel-active); }
.playlist-track .track-dur {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
}
.audio-player .controls { display: flex; align-items: center; gap: 0.75em; }
.audio-player .play-btn {
    width: 36px; height: 36px;
    border: 1px solid rgb(160, 160, 160);
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.audio-player .play-btn:hover { border-color: var(--accent); color: var(--accent); }
.audio-player .play-btn svg { width: 14px; height: 14px; fill: currentColor; }
.audio-player .progress-wrap { flex: 1; display: flex; align-items: center; gap: 0.6em; }
.audio-player .progress-bar {
    flex: 1; height: 24px;
    background: transparent;
    cursor: pointer;
    position: relative;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}
.audio-player .progress-bar::before {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 50%;
    transform: translateY(-50%);
    height: 3px;
    background: rgb(180, 180, 180);
    border-radius: 2px;
    pointer-events: none;
}
.audio-player .progress-fill {
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    height: 3px;
    background: var(--ink);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
    pointer-events: none;
}
.audio-player .time {
    font-size: 0.7rem;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
    min-width: 3.2em;
    text-align: right;
    font-family: var(--body);
}
@media (prefers-color-scheme: dark) {
    .audio-player .play-btn { border-color: rgb(100, 100, 100); }
    .audio-player .progress-bar::before { background: var(--rule); }
}

/* ---- Homepage splash -------------------------------------- */
.splash {
    padding: 3em 0 2em;
    text-align: left;
}
.splash .splash-mark {
    font-family: var(--display);
    font-weight: 700;
    font-size: 3.2rem;
    line-height: 1.05;
    margin: 0 0 0.4em;
    color: var(--ink);
}
@media (prefers-color-scheme: dark) { .splash .splash-mark { color: var(--ink-display); } }
@media (max-width: 600px) { .splash .splash-mark { font-size: 12vw; } }

.splash .splash-lede {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 1.5rem;
    line-height: 1.3;
    color: var(--ink-soft);
    margin: 0 0 1.6em;
    max-width: 30em;
}

/* ---- Members signup --------------------------------------- */
.signup {
    margin: 1.8em 0 2.4em;
    padding: 1.4em 1.4em 1.5em;
    border: 1px solid var(--rule);
    border-radius: 10px;
    background: var(--panel);
}
.signup .signup-label {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 1.2rem;
    color: var(--ink-soft);
    margin: 0 0 0.8em;
}
.signup form { display: flex; gap: 0.6em; flex-wrap: wrap; }
.signup input[type="email"] {
    flex: 1 1 14em;
    font-family: var(--body);
    font-size: 1rem;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 0.6em 0.8em;
}
.signup input[type="email"]:focus {
    outline: none;
    border-color: var(--accent);
}
.signup button {
    font-family: var(--body);
    font-size: 1rem;
    color: var(--ink);
    background: transparent;
    border: 1px solid rgb(160, 160, 160);
    border-radius: 6px;
    padding: 0.6em 1.2em;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.signup button:hover { border-color: var(--accent); color: var(--accent); }
.signup .signup-note {
    font-size: 0.78rem;
    color: var(--ink-faint);
    margin: 0.9em 0 0;
}
.signup .signup-message { font-size: 0.85rem; margin: 0.8em 0 0; min-height: 1em; }
@media (prefers-color-scheme: dark) {
    .signup button { border-color: rgb(100, 100, 100); }
}

/* ---- Notes index ------------------------------------------ */
.section-head {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.6rem;
    margin: 1.6em 0 0.6em;
    color: var(--ink);
}
@media (prefers-color-scheme: dark) { .section-head { color: var(--ink-display); } }

.note-list { list-style: none; margin: 0; padding: 0; }
.note-item {
    padding: 1.1em 0;
    border-bottom: 1px solid var(--rule-soft);
}
.note-item:first-child { border-top: 1px solid var(--rule-soft); }
.note-item a { text-decoration: none; display: block; }
.note-item a:hover .note-title { color: var(--accent); }
.note-title {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.3rem;
    line-height: 1.2;
    margin: 0 0 0.2em;
    color: var(--ink);
    transition: color 0.15s ease;
}
@media (prefers-color-scheme: dark) { .note-title { color: var(--ink-display); } }
.note-meta {
    font-size: 0.78rem;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
}
.note-excerpt {
    font-size: 0.95rem;
    color: var(--ink-soft);
    margin: 0.4em 0 0;
}

/* ---- Pagination ------------------------------------------- */
.pagination {
    display: flex;
    justify-content: space-between;
    margin: 2em 0 1em;
    font-size: 0.85rem;
}
.pagination a { text-decoration: none; }
.pagination a:hover { color: var(--accent); }
.pagination .page-number { color: var(--ink-faint); }

/* ---- Footer ----------------------------------------------- */
.site-foot {
    margin-top: 3em;
    padding-top: 1.4em;
    border-top: 1px solid var(--rule);
    font-size: 0.78rem;
    color: var(--ink-faint);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6em;
}
.site-foot a { color: var(--ink-faint); text-decoration: none; }
.site-foot a:hover { color: var(--accent); }

/* ---- Koenig editor cards ---------------------------------- */
/* Width classes the editor applies to images, embeds, galleries. */
.kg-width-wide {
    position: relative;
    width: 75vw;
    min-width: 100%;
    margin-left: 50%;
    transform: translateX(-50%);
    max-width: 50em;
}
.kg-width-full {
    position: relative;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}
.kg-width-full img { width: 100%; }

figure.kg-card { margin: 1.5em 0; }
.kg-image { display: block; margin-left: auto; margin-right: auto; }
.kg-image-card img { margin: 0 auto; }

.kg-gallery-container { display: flex; flex-direction: column; margin: 1.5em 0; max-width: 100%; }
.kg-gallery-row { display: flex; flex-direction: row; justify-content: center; }
.kg-gallery-image { margin: 0.4em; }
.kg-gallery-image img { display: block; width: 100%; height: 100%; }

.kg-embed-card { display: flex; flex-direction: column; align-items: center; width: 100%; margin: 1.5em 0; }

.kg-bookmark-card { width: 100%; margin: 1.5em 0; }
.kg-bookmark-container {
    display: flex;
    border: 1px solid var(--rule);
    border-radius: 8px;
    text-decoration: none;
    color: var(--ink);
    overflow: hidden;
}
.kg-bookmark-content { padding: 1em; flex: 1; }
.kg-bookmark-title { font-weight: 700; }
.kg-bookmark-description { color: var(--ink-soft); font-size: 0.9rem; }

.kg-callout-card {
    margin: 1.5em 0;
    padding: 1em 1.2em;
    border-radius: 8px;
    border: 1px solid var(--rule);
    background: var(--panel);
    display: flex;
    gap: 0.6em;
}

.kg-toggle-card { margin: 1.5em 0; border: 1px solid var(--rule); border-radius: 8px; padding: 0.8em 1.2em; }

.kg-btn {
    display: inline-block;
    padding: 0.6em 1.2em;
    border: 1px solid rgb(160, 160, 160);
    border-radius: 6px;
    text-decoration: none;
    color: var(--ink);
    transition: border-color 0.15s ease, color 0.15s ease;
}
.kg-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Audio + file cards Ghost generates natively (in case you use them
   instead of the custom .audio-player markup). */
.kg-audio-card, .kg-file-card { margin: 1.5em 0; }

/* ---- Custom font support ---------------------------------- */
/* Honour the font choices Ghost exposes in Admin → Design, while
   keeping our display + serif faces as the deliberate defaults. */
:root {
    --gh-font-heading: var(--display);
    --gh-font-body: var(--body);
}
body { font-family: var(--gh-font-body, var(--body)); }
.post-title, .note-title, .section-head, .site-head .wordmark, .splash-mark {
    font-family: var(--gh-font-heading, var(--display));
}
:is(.gh-font-heading-serif) .post-title,
:is(.gh-font-heading-serif) .note-title { font-family: var(--display); }
body.gh-font-body-serif { font-family: var(--serif); }
body.gh-font-body-sans { font-family: var(--body); }
