/* Vellum & Blood — Cryptic Codex. Warm paper, brown-black ink, dried-blood red, verdigris for membership only. */
@font-face { font-family: "Junicode"; font-style: normal; font-weight: 300 700; font-display: block; src: url("../fonts/junicode-roman.woff2") format("woff2"); }
@font-face { font-family: "Junicode"; font-style: italic; font-weight: 300 700; font-display: block; src: url("../fonts/junicode-italic.woff2") format("woff2"); }
@font-face { font-family: "Texturina"; font-style: normal; font-weight: 100 900; font-display: block; src: url("../fonts/texturina.woff2") format("woff2"); }
/* Autumn (Creative Market, webfont licence): one weight, used as-is for the display sizes; keep the repo private, see README */
@font-face { font-family: "Autumn"; font-style: normal; font-weight: 400 700; font-display: block; src: url("../fonts/autumn.woff2") format("woff2"); }
@font-face { font-family: "UnifrakturCook"; font-style: normal; font-weight: 700; font-display: block; src: url("../fonts/unifrakturcook-bold.woff2") format("woff2"); }

:root {
  --bg: #F3ECE0; --surface: #EAE1D1; --text: #1E1916; --muted: #6B5F55; --accent: #7A1E1A; --member: #345C66; --rule: #D8CDBB;
  --font-body: "Junicode", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-head: "Texturina", Georgia, serif;
  --font-display: "Autumn", "UnifrakturCook", "Old English Text MT", serif;
  --measure: 70ch;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #17130F; --surface: #221C17; --text: #E6DCCB; --muted: #A39684; --accent: #D0645A; --member: #7FA9B3; --rule: #3A3129; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #17130F; --surface: #221C17; --text: #E6DCCB; --muted: #A39684; --accent: #D0645A; --member: #7FA9B3; --rule: #3A3129; color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--gh-font-body, var(--font-body)); font-size: 1.1875rem; line-height: 1.5; font-feature-settings: "kern", "liga", "onum", "pnum"; font-optical-sizing: auto; }
body.has-grain:not(.post-template):not(.page-template)::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .07; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] body.has-grain::before { mix-blend-mode: screen; opacity: .05; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.has-grain::before { mix-blend-mode: screen; opacity: .05; } }
.site-head, .site-main, .site-foot { position: relative; z-index: 1; }

a { color: var(--accent); text-decoration: underline; text-underline-offset: .15em; text-decoration-thickness: .06em; }
a:hover { text-decoration-thickness: .12em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--bg); }
img { max-width: 100%; height: auto; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--bg); padding: .5em 1em; }
.skip:focus { left: 1em; z-index: 10; }

.wrap { width: min(100% - 2.5rem, 46rem); margin-inline: auto; }
.wrap--wide { width: min(100% - 2.5rem, 60rem); }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.smallcaps { font-variant-caps: small-caps; font-variant-numeric: oldstyle-nums; letter-spacing: .06em; font-size: .95rem; }

/* Rules and ornaments: thick-over-thin, fleurons. No borders around pages. */
.rule--double { height: 5px; border-top: 3px solid var(--text); border-bottom: 1px solid var(--text); margin: 0 0 1.5rem; }
.site-head .rule--double { width: min(100% - 2.5rem, 60rem); margin: .75rem auto 0; }
.site-foot .rule--double { width: min(100% - 2.5rem, 60rem); margin: 3rem auto 1.5rem; }
.fleuron { text-align: center; color: var(--accent); font-size: 1.6rem; margin: 1.5rem 0 2rem; line-height: 1; }
.fleuron::before, .fleuron::after { content: ""; display: inline-block; width: 4rem; border-top: 1px solid var(--rule); vertical-align: middle; margin: 0 .8em; }
hr { border: 0; text-align: center; margin: 2.5rem 0; }
hr::after { content: "⁂"; color: var(--accent); font-size: 1.3rem; }

/* Type */
h1, h2, h3, h4 { font-family: var(--gh-font-heading, var(--font-head)); font-weight: 600; line-height: 1.15; margin: 1.6em 0 .5em; color: var(--text); font-optical-sizing: auto; }
h1 { font-size: 2.4rem; } h2 { font-size: 1.7rem; } h3 { font-size: 1.3rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; }
.logo { display: block; width: 56px; height: auto; }

.hero__logo { display: block; width: 200px; height: auto; margin: 0 auto .75rem; }
.wordmark-img { height: 2.1rem; width: auto; display: block; }
.wordmark-img--small { height: 1.4rem; margin-bottom: .6rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wordmark { font-family: var(--font-display); font-weight: 700; font-size: 2.1rem; color: var(--text); text-decoration: none; line-height: 1; }
.wordmark--small { font-size: 1.4rem; margin: 0 0 .5rem; }
/* page titles (pages, posts, tag and error pages) are set in the display face; h2–h4 stay in the heading face */
.article__title, .page-title { font-family: var(--font-display); font-weight: 400; letter-spacing: .01em; }
.lede { font-size: 1.25rem; color: var(--muted); font-style: italic; }
p { margin: 0 0 1em; }

/* Header */
.site-head__row { width: min(100% - 2.5rem, 60rem); display: flex; align-items: center; gap: 1.5rem; padding-top: 1.25rem; flex-wrap: wrap; }
.site-nav ul, .foot-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.25rem; flex-wrap: wrap; }
.site-nav a, .foot-nav a { font-family: var(--font-head); font-size: 1.05rem; color: var(--text); text-decoration: none; }
.site-nav a:hover, .site-nav .nav-current a { color: var(--accent); text-decoration: underline; }
.nav-soon span { font-family: var(--font-head); font-size: 1.05rem; color: var(--muted); cursor: default; }
.nav-soon small { font-family: var(--font-body); font-size: .8rem; font-style: italic; }
.site-head__member { margin-left: auto; display: flex; gap: .6rem; align-items: center; }
.theme-toggle { background: none; border: 1px solid var(--rule); color: var(--muted); border-radius: 50%; width: 2rem; height: 2rem; cursor: pointer; font-size: 1rem; line-height: 1; }
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* Buttons */
.btn { display: inline-block; font-family: var(--font-head); font-size: 1rem; font-weight: 600; padding: .5em 1.1em; border-radius: 3px; text-decoration: none; background: var(--accent); color: var(--bg); border: 1px solid transparent; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn--member { background: var(--member); color: var(--bg); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--rule); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.badge { font-family: var(--font-head); font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: .15em .5em; border-radius: 2px; vertical-align: middle; }
.badge--member { background: var(--member); color: var(--bg); }

/* Hero */
.hero { padding: 2.5rem 0 2rem; text-align: center; }
.hero__kicker { font-family: var(--font-head); font-weight: 600; font-size: clamp(1.3rem, 3vw, 1.8rem); letter-spacing: .04em; color: var(--accent); margin: 0; }
.hero__title { font-family: var(--font-head); font-weight: 500; font-style: italic; font-size: clamp(1.25rem, 2.6vw, 1.6rem); margin: .6em 0 .4em; color: var(--muted); }
.hero__lede { font-size: 1.25rem; color: var(--muted); max-width: 40rem; margin-inline: auto; }
.hero__cta { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }
.section-title { font-size: 1.1rem; font-variant-caps: small-caps; letter-spacing: .1em; color: var(--muted); margin: 0 0 1.2rem; font-family: var(--font-body); font-weight: 400; }

/* Cards */
.cards { display: grid; gap: 2rem 2.5rem; grid-template-columns: 1fr; }
@media (min-width: 46rem) { .cards { grid-template-columns: 1fr 1fr; } }
.card { display: flex; flex-direction: column; gap: .6rem; }
.card__image img { width: 100%; aspect-ratio: 5 / 7; object-fit: cover; background: var(--surface); border: 1px solid var(--rule); }
.card__kicker { margin: 0; }
.card__title { font-size: 1.45rem; margin: 0; }
.card__title a { color: var(--accent); text-decoration: none; }
.card__title a:hover { text-decoration: underline; }
.card__excerpt { margin: 0; }

/* Article */
.article__head { padding-top: 2.5rem; margin-bottom: 2rem; }
.article__title { font-size: clamp(2rem, 5vw, 2.8rem); margin: .2em 0 .4em; }
.article__title--issue { font-size: clamp(2.4rem, 6vw, 3.6rem); }
.article__figure { margin: 1.5rem auto; text-align: center; }
.article__figure img { border: 1px solid var(--rule); }
.content > * { max-width: var(--measure); }
.content h2, .content h3 { margin-top: 1.8em; }
.content blockquote { margin: 1.5em 0; padding: .2em 0 .2em 1.2em; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic; }
.content pre, .content code { background: var(--surface); font-size: .9em; }
.content pre { padding: 1em; overflow-x: auto; border: 1px solid var(--rule); }
.content code { padding: .1em .3em; }
.content table { border-collapse: collapse; width: 100%; font-size: .95rem; font-variant-numeric: tabular-nums; }
.content th, .content td { border-top: 1px solid var(--rule); padding: .4em .6em; text-align: left; }
.content thead th { border-top: 3px solid var(--text); border-bottom: 1px solid var(--text); font-family: var(--font-head); }
.content figure { margin: 1.5em 0; }
.content figcaption { color: var(--muted); font-size: .9rem; text-align: center; }
.content .kg-width-wide, .content .kg-width-full { max-width: none; }
.content .kg-signup-card, .content .kg-callout-card { background: var(--surface); border: 1px solid var(--rule); }
/* Bookmark cards (the Downloads list): the theme's paper and faces instead of Ghost's white box in the system sans, which
   also stayed white in dark mode. The site/author line is hidden: on links to our own pages it says nothing new. */
.content .kg-bookmark-card a.kg-bookmark-container, .content .kg-bookmark-card a.kg-bookmark-container:hover { background: var(--surface); color: var(--text); border: 1px solid var(--rule); border-radius: 0; }
.content .kg-bookmark-card a.kg-bookmark-container:hover, .content .kg-bookmark-card a.kg-bookmark-container:focus-visible { border-color: var(--accent); }
.content .kg-bookmark-card a.kg-bookmark-container:hover .kg-bookmark-title { color: var(--accent); }
.content .kg-bookmark-content { font-family: var(--font-body); padding: 1.1rem 1.3rem; }
.content .kg-bookmark-title { font-family: var(--font-head); font-size: 1.3rem; font-weight: 600; line-height: 1.2; }
.content .kg-bookmark-description { font-size: 1.0625rem; line-height: 1.45; margin-top: .35rem; opacity: 1; color: var(--muted); max-height: none; -webkit-line-clamp: 3; }
.content .kg-bookmark-metadata { display: none; }
.content .kg-bookmark-thumbnail img { border-radius: 0; }
/* Signup cards: Ghost writes its grey background and black/white text colours inline on the card, so those need
   !important to follow the theme (and dark mode). The button is verdigris, like every other membership control. */
.content .kg-signup-card { background: var(--surface) !important; }
.content .kg-signup-card-text { padding: 1.5rem 1.7rem 1.6rem; }
.content .kg-signup-card h2.kg-signup-card-heading { font-family: var(--font-head); font-size: 1.5rem; font-weight: 600; line-height: 1.2; letter-spacing: 0; margin: 0; color: var(--text) !important; }
.content .kg-signup-card .kg-signup-card-subheading { font-family: var(--font-body); font-size: 1.125rem; font-weight: 400; line-height: 1.45; margin-top: .35rem; color: var(--muted) !important; }
.content .kg-signup-card-heading + .kg-signup-card-form, .content .kg-signup-card-subheading + .kg-signup-card-form { margin-top: 1.1rem; }
.content .kg-signup-card-fields { max-width: 30rem; padding: 3px; background: var(--bg); border: 1px solid var(--rule); border-radius: 3px; }
.content .kg-signup-card-fields:focus-within { border-color: var(--member); box-shadow: 0 0 0 1px var(--member); }
.content .kg-signup-card-input { background: transparent; color: var(--text); font-family: var(--font-body); font-size: 1.0625rem; }
.content .kg-signup-card-input::placeholder { color: var(--muted); opacity: .8; }
.content .kg-signup-card .kg-signup-card-button { background: var(--member); color: var(--bg) !important; font-family: var(--font-head); font-size: 1rem; font-weight: 600; letter-spacing: 0; border-radius: 2px; cursor: pointer; }
.content .kg-signup-card .kg-signup-card-button:hover { opacity: 1; filter: brightness(1.08); }
.content .kg-signup-card-disclaimer { margin-top: .7rem; font-size: .95rem; color: var(--muted) !important; }
.content .kg-signup-card-success { color: var(--text) !important; }
.content .kg-signup-card-error { color: var(--accent) !important; }
.downloads { margin-top: 2rem; }
.article__foot { margin-top: 2rem; }

/* Members CTA + tiers */
.cta { margin: 1.5rem 0; padding: 0 0 1rem; }
.cta__title { margin-top: .5rem; }
.tiers { margin-top: 2rem; }
.tier-grid { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 46rem) { .tier-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 62rem) { .tier-grid { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); } }
.tier { background: var(--surface); border: 1px solid var(--rule); padding: 1.4rem 1.3rem; display: flex; flex-direction: column; gap: .6rem; }
.tier--paid { border-top: 3px solid var(--member); }
.tier__name { margin: 0; font-size: 1.4rem; }
.tier__desc { margin: 0; color: var(--muted); }
.tier__price { margin: .3rem 0 0; }
.tier__amount { font-family: var(--font-head); font-size: 1.9rem; font-weight: 600; margin-right: .2em; }
.tier__benefits { margin: .3rem 0 .8rem; padding-left: 1.1em; }
.tier .btn { align-self: flex-start; }

/* Pagination */
.pagination { display: flex; justify-content: space-between; margin: 2.5rem 0; font-family: var(--font-head); }
.pagination .page-number { color: var(--muted); }

/* Footer: wordmark + copyright left, tiny legal links and socials right, like the print colophon */
.site-foot__row { width: min(100% - 2.5rem, 60rem); display: grid; gap: 1.5rem 3rem; grid-template-columns: 1fr; padding-bottom: 2.5rem; align-items: end; }
@media (min-width: 46rem) { .site-foot__row { grid-template-columns: 1.4fr 1fr; } .site-foot__links { text-align: right; } }
.site-foot__brand p { margin: 0 0 .3rem; }
.foot-legal ul, .foot-social { list-style: none; margin: 0 0 .6rem; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem .9rem; }
@media (min-width: 46rem) { .foot-legal ul, .foot-social { justify-content: flex-end; } }
/* legal and social links: inline items with balanced wrapping, so the lines come out even rather than 5 + 1 */
.foot-legal ul, .foot-social { display: block; text-wrap: balance; margin-inline: -.45rem; }
.foot-legal li, .foot-social a { display: inline-block; margin: 0 .45rem .25rem; }
.foot-legal a, .foot-social a { font-family: var(--font-head); font-size: .85rem; color: var(--muted); text-decoration: none; letter-spacing: .02em; }
.foot-legal a:hover, .foot-social a:hover { color: var(--accent); text-decoration: underline; }
.foot-social { margin-top: .4rem; }
/* footer menus: "Privacy & policies" and "Follow us" are closed <details>; the links appear underneath when opened */
.foot-menu { margin: 0 0 .35rem; }
.foot-menu summary { display: inline-block; list-style: none; cursor: pointer; padding: .2rem 0; font-family: var(--font-head); font-size: .9rem; color: var(--muted); letter-spacing: .02em; }
.foot-menu summary::-webkit-details-marker { display: none; }
.foot-menu summary::after { content: "+"; display: inline-block; width: 1em; margin-left: .35em; text-align: center; }
.foot-menu[open] summary::after { content: "\2212"; }
.foot-menu summary:hover, .foot-menu[open] summary { color: var(--accent); }
.foot-menu summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.foot-menu .foot-legal ul, .foot-menu .foot-social { margin-top: .3rem; margin-bottom: .5rem; }

/* Portal: keep Ghost's popup roughly on-palette (it is Ghost JS, only the accent colour is themeable from Settings → Design). */
@media (max-width: 40rem) {
  .site-head__row { gap: .8rem 1.2rem; }
  .wordmark { font-size: 1.7rem; }
  .wordmark-img { height: 1.6rem; }
  .logo { width: 44px; }
  .site-head__member { margin-left: 0; width: 100%; justify-content: flex-start; }
}

/* light/dark logo swap: last, and on the img element, so size rules above cannot re-show the hidden one */
img.logo--dark { display: none; }
:root[data-theme="dark"] img.logo--dark { display: block; }
:root[data-theme="dark"] img.logo--light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) img.logo--dark { display: block; }
  :root:not([data-theme="light"]) img.logo--light { display: none; }
}
/* the filled dark logo carries a 12px parchment outline; absorb it so the book sits exactly where the light one does */
img.logo.logo--dark { margin: -1px 0; }
img.hero__logo.logo--dark { margin: -3px auto calc(.75rem - 3px); }
/* shop */
.store { display: grid; gap: 2rem; margin-top: 1rem; }
@media (min-width: 46rem) { .store { grid-template-columns: 1.6fr 1fr; align-items: start; } .store .section-title { grid-column: 1 / -1; } }
.store__products { grid-template-columns: 1fr; gap: 1.25rem; }
/* each item sits in its own card, matching the order panel: parchment surface, hairline rule */
.store__product { display: flex; flex-direction: column; gap: .4rem; background: var(--surface); border: 1px solid var(--rule); padding: 1.2rem 1.3rem 1.3rem; }
.store__product .card__title { font-size: 1.35rem; }
.store__product .btn { align-self: flex-start; margin-top: .3rem; }
.store__price { font-family: var(--font-head); font-size: 1.3rem; margin: .2rem 0 0; }
.store__cart { background: var(--surface); border: 1px solid var(--rule); padding: 1.2rem 1.3rem; position: sticky; top: 1rem; }
.store__cart .section-title { margin-bottom: .8rem; }
.cart__lines { list-style: none; margin: 0; padding: 0; }
.cart__lines li { display: grid; grid-template-columns: 1fr 3.6rem auto; gap: .6rem; align-items: center; padding: .4rem 0; border-bottom: 1px solid var(--rule); }
.cart__qty { width: 3.4rem; padding: .25em .4em; font: inherit; background: var(--bg); color: var(--text); border: 1px solid var(--rule); border-radius: 3px; }
.cart__ship { margin-top: .8rem; } .cart__ship label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .2rem; }
.cart__ship select { width: 100%; padding: .4em .5em; font: inherit; background: var(--bg); color: var(--text); border: 1px solid var(--rule); border-radius: 3px; }
.cart__total { font-family: var(--font-head); font-weight: 600; margin: .8rem 0 .4rem; }
.store__cart .btn { width: 100%; text-align: center; margin: .4rem 0 .8rem; }
.store__cart .btn:disabled { opacity: .5; cursor: not-allowed; }
