/* xjoro.com
   Three subjects, three colours. Everything else stays quiet so the colours carry meaning:
   violet = philosophy, teal = science, amber = strategy. */

:root {
    --paper: #f1f3f0;
    --surface: #ffffff;
    --ink: #1a1d29;
    --ink-soft: #555b6b;
    --rule: #d5d9d3;
    --philosophy: #5a3d97;
    --science: #0a746f;
    --strategy: #9a5b00;
    --danger: #a3261d;
    --topic: var(--ink);

    --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
    --text: "Source Serif 4", Georgia, "Times New Roman", serif;

    --measure: 40rem;
    --wide: 70rem;
}

.t-philosophy { --topic: var(--philosophy); }
.t-science { --topic: var(--science); }
.t-strategy { --topic: var(--strategy); }

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--text);
    font-size: 1.125rem;
    line-height: 1.65;
}

h1, h2, h3 {
    font-family: var(--display);
    line-height: 1.1;
    letter-spacing: -0.015em;
    margin: 0 0 0.5em;
    text-wrap: balance;
}
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 700; }
h2 { font-size: 1.6rem; font-weight: 650; }
h3 { font-size: 1.3rem; font-weight: 600; }
p { margin: 0 0 1em; }

a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

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

.wrap { max-width: var(--wide); margin-inline: auto; padding-inline: 1.25rem; }

.skip { position: absolute; left: -999rem; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: 0.5rem 1rem; z-index: 10; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
}

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--rule); background: var(--paper); }
.header-row {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 0.5rem 1.75rem; padding-block: 0.9rem;
    font-family: var(--display); font-size: 1rem;
}
.brand {
    font-family: var(--display); font-weight: 800; font-size: 1.6rem;
    letter-spacing: -0.04em; text-decoration: none;
}
.main-nav, .header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1.25rem; }
.main-nav { flex: 1; }
.main-nav a, .header-actions a { text-decoration: none; }
.main-nav a:hover, .header-actions a:hover { text-decoration: underline; }
.nav-topic { color: var(--topic); font-weight: 650; }
.inline-form { display: inline; margin: 0; }
.link-button {
    background: none; border: 0; padding: 0; color: inherit; cursor: pointer;
    font: inherit;
}
.link-button:hover { text-decoration: underline; }

/* ---------- Buttons ---------- */
.button {
    display: inline-block; background: var(--ink); color: var(--paper);
    font-family: var(--display); font-weight: 600; font-size: 1.05rem;
    padding: 0.7rem 1.3rem; border: 2px solid var(--ink); border-radius: 999px;
    text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--paper); color: var(--ink); }
.button.small { font-size: 0.95rem; padding: 0.35rem 0.9rem; }
.button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.button.danger:hover { background: var(--danger); color: #fff; }

/* ---------- Home: the three lenses ---------- */
.hero { padding-block: clamp(2.5rem, 7vw, 5rem) 0; }
.hero h1 { max-width: 16ch; }
.lede { font-size: 1.3rem; line-height: 1.5; max-width: 38rem; color: var(--ink-soft); }

.lenses { list-style: none; margin: 2.5rem 0 0; padding: 0; border-top: 2px solid var(--ink); }
.lenses li { border-bottom: 1px solid var(--rule); }
.lenses a {
    display: grid; grid-template-columns: auto minmax(12rem, 1fr);
    align-items: end; gap: 0.25rem 2rem;
    padding-block: 0.6rem 0.9rem; text-decoration: none; color: var(--topic);
}
.lens-name {
    font-family: var(--display); font-weight: 800;
    font-size: clamp(3rem, 11vw, 7.5rem); line-height: 0.95; letter-spacing: -0.05em;
    transition: letter-spacing 0.25s ease;
}
.lens-question {
    font-size: clamp(1.15rem, 2.2vw, 1.6rem); font-style: italic; color: var(--ink);
    text-align: right; padding-bottom: 0.35em;
}
.lenses a:hover .lens-name, .lenses a:focus-visible .lens-name { letter-spacing: -0.02em; }
@media (max-width: 52rem) {
    .lenses a { grid-template-columns: 1fr; }
    .lens-question { text-align: left; padding-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .lens-name { transition: none; }
}

/* ---------- Sections ---------- */
.band { padding-block: 3rem; }
.band + .band { padding-top: 0; }
.section-head {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline;
    gap: 0.5rem 1.5rem; border-bottom: 2px solid var(--ink);
    padding-bottom: 0.5rem; margin-bottom: 0.5rem;
    font-family: var(--display); font-size: 1rem;
}
.section-head h1, .section-head h2 { margin: 0; }
.section-head a + a { margin-left: 1rem; }

.page-head { padding-block: 3rem 0; }
.topic-title { color: var(--topic); font-size: clamp(3rem, 10vw, 6.5rem); font-weight: 800; letter-spacing: -0.05em; }

/* ---------- Lists of posts ---------- */
.post-list {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); column-gap: 3.5rem;
}
.post-item { padding-block: 1.5rem; border-bottom: 1px solid var(--rule); }
.post-item h3 { font-size: 1.6rem; margin-bottom: 0.3em; }
.post-item h3 a { text-decoration: none; }
.post-item h3 a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.post-item p { margin-bottom: 0.4em; }
.post-topic {
    display: inline-block; font-family: var(--display); font-weight: 650; font-size: 0.95rem;
    color: var(--topic); text-decoration: none; margin-bottom: 0.3rem;
}
.post-topic:hover { text-decoration: underline; }
.meta {
    display: flex; flex-wrap: wrap; gap: 0.2rem 1.25rem;
    font-family: var(--display); font-size: 0.9rem; color: var(--ink-soft);
}
.tag {
    font-family: var(--display); font-size: 0.85rem; font-weight: 600;
    border: 1px solid currentColor; border-radius: 999px; padding: 0 0.6rem; color: var(--ink);
}
.empty { color: var(--ink-soft); padding-block: 1.5rem; }

/* ---------- Reading ---------- */
.reading { max-width: calc(var(--measure) + 2.5rem); margin-inline: auto; padding: 3rem 1.25rem; }
.reading-head { border-bottom: 2px solid var(--topic); padding-bottom: 1.25rem; margin-bottom: 2rem; }
.standfirst { font-size: 1.35rem; line-height: 1.45; color: var(--ink-soft); }
.prose { font-size: 1.2rem; line-height: 1.7; }
.prose h2 { margin-top: 2em; }
.prose h3 { margin-top: 1.6em; }
.prose a { color: var(--topic); }
.prose blockquote {
    margin: 1.5em 0; padding-left: 1.25rem; border-left: 3px solid var(--topic);
    font-style: italic; color: var(--ink-soft);
}
.prose pre { overflow-x: auto; background: var(--surface); padding: 1rem; font-size: 0.95rem; }
.prose table { display: block; overflow-x: auto; }
.prose li { margin-bottom: 0.4em; }

.gate {
    background: var(--surface); border-top: 6px solid var(--topic);
    padding: 2rem 1.75rem;
}
.gate h2 { max-width: 22ch; }
.gate-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin: 1.5rem 0 0; font-family: var(--display); }

.join { background: var(--ink); color: var(--paper); padding-block: 4rem; margin-top: 2rem; }
.join h2 { font-size: clamp(2rem, 5vw, 3rem); }
.join p { max-width: 34rem; font-size: 1.2rem; }
.join .button { background: var(--paper); color: var(--ink); border-color: var(--paper); margin-top: 0.5rem; }
.join .button:hover { background: var(--ink); color: var(--paper); }
.join :focus-visible { outline-color: var(--paper); }

/* ---------- Books ---------- */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 2.5rem 2rem; padding-top: 1.5rem; }
.book-card { display: flex; flex-direction: column; gap: 0.3rem; text-decoration: none; }
.cover { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; margin-bottom: 0.6rem; }
.cover-type {
    display: flex; flex-direction: column; justify-content: space-between;
    background: var(--topic); color: #fff; padding: 1.25rem 1.1rem;
    font-family: var(--display);
}
.cover-title { font-weight: 800; font-size: 1.7rem; line-height: 1; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.cover-author { font-size: 0.95rem; }
.book-title { font-family: var(--display); font-weight: 650; font-size: 1.2rem; line-height: 1.2; }
.book-card:hover .book-title { text-decoration: underline; }
.book-summary { font-size: 1rem; line-height: 1.45; color: var(--ink-soft); }
.book-price { font-family: var(--display); font-size: 0.95rem; }
.book-detail-grid { display: grid; grid-template-columns: minmax(0, 16rem) minmax(0, var(--measure)); gap: 2.5rem 3.5rem; }
.buy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-block: 1.5rem; font-family: var(--display); }
@media (max-width: 44rem) {
    .book-detail-grid { grid-template-columns: 1fr; }
    .book-detail-grid .cover { max-width: 14rem; }
}

/* ---------- Forms ---------- */
.form-page { max-width: 30rem; margin-inline: auto; padding: 3rem 1.25rem; }
.form-page h2 { margin-top: 2.5rem; }
.form { display: flex; flex-direction: column; gap: 0.35rem; margin-block: 1.5rem; font-family: var(--display); font-size: 1rem; }
.form.wide { max-width: 48rem; }
.form label { font-weight: 600; margin-top: 0.9rem; }
.form input:not([type="checkbox"]), .form select, .form textarea, .search-form input {
    font: inherit; color: var(--ink); background: var(--surface);
    border: 1px solid var(--ink-soft); border-radius: 6px;
    padding: 0.6rem 0.75rem; width: 100%;
}
.form textarea { font-family: var(--text); font-size: 1.05rem; line-height: 1.5; resize: vertical; }
.form textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: 0.95rem; }
.form .check { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 400; }
.form .check input { width: 1.15rem; height: 1.15rem; margin-top: 0.3rem; flex: none; accent-color: var(--ink); }
.form .button { align-self: flex-start; margin-top: 1.25rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0 1.25rem; }
.form-row > div { display: flex; flex-direction: column; gap: 0.35rem; }
.form-actions { display: flex; align-items: center; gap: 1.5rem; margin: 0; }
.form-actions .button { margin-top: 1.25rem; }
.form-actions a { margin-top: 1.25rem; }
.hint { font-size: 0.9rem; color: var(--ink-soft); }
.field-error, .form-error { color: var(--danger); font-size: 0.95rem; font-weight: 600; }
.form-error ul { margin: 0; padding-left: 1.1rem; }
.field-error:empty, .form-error:empty { display: none; }
.validation-summary-valid { display: none; }
.notice { background: var(--surface); border-left: 4px solid var(--science); padding: 0.6rem 1rem; font-family: var(--display); }
.search-form { display: flex; gap: 0.75rem; max-width: 36rem; margin-top: 1rem; font-family: var(--display); }

/* ---------- Admin ---------- */
.admin { padding-block: 2rem 4rem; font-family: var(--display); font-size: 1rem; line-height: 1.5; }
.admin h1 { font-size: 2.2rem; }
.admin h2 { margin-top: 2.5rem; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; border-bottom: 1px solid var(--rule); padding-bottom: 0.75rem; margin-bottom: 2rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1.5rem; margin: 0; }
.stats div { border-top: 2px solid var(--ink); padding-top: 0.5rem; }
.stats dt { color: var(--ink-soft); font-size: 0.95rem; }
.stats dd { margin: 0; font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.55rem 1rem 0.55rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 650; border-bottom-color: var(--ink); white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pager { display: flex; gap: 1.5rem; margin-top: 1rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); margin-top: 3rem; padding-block: 2.5rem 1.5rem; font-family: var(--display); font-size: 1rem; }
.join + .site-footer { margin-top: 0; border-top: 0; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem 3rem; }
.footer-row p { max-width: 24rem; color: var(--ink-soft); margin: 0.25rem 0 0; }
.footer-row nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; align-items: flex-start; }
.footer-note { color: var(--ink-soft); font-size: 0.9rem; margin-top: 2rem; }
