/* Mickey Chandler v2: a small literary quarterly, set in type.
   Century Supra A for text, Century Supra A Caps for small-cap labels, Triplicate A Code
   for code and the colophon. Iron-gall ink on laid paper, oxblood for marks.
   No external requests, no scripts. */

/* ---- Fonts ----------------------------------------------------------------------------- */
@font-face { font-family: "Century Supra A"; src: url("fonts/century-supra-a-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Century Supra A"; src: url("fonts/century-supra-a-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Century Supra A"; src: url("fonts/century-supra-a-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Century Supra A"; src: url("fonts/century-supra-a-bold-italic.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Century Supra A Caps"; src: url("fonts/century-supra-a-caps-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Triplicate A Code"; src: url("fonts/triplicate-a-code-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

/* ---- Tokens ---------------------------------------------------------------------------- */
:root {
  /* Theme-contract tokens */
  --color-bg: #f3ecdc;          /* laid paper */
  --color-text: #1c2433;        /* iron-gall ink */
  --color-accent: #8b2e1f;      /* oxblood */
  --color-muted: #6e6250;
  --font-body: "Century Supra A", "Century Schoolbook", Georgia, serif;
  --font-heading: "Century Supra A", "Century Schoolbook", Georgia, serif;
  --space-unit: 1rem;

  /* Theme's own */
  --ink-soft: #4a4234;
  --rule: #d2c6ad;
  --leader: #b3a68c;
  --ghost: #c9bb9f;             /* oversized year numerals */
  --accent-hover: #5c1c12;
  --grain: rgba(28, 36, 51, 0.028);
  --code-bg: #e9e0cc;
  --foot-bg: #1c2433;
  --foot-text: #e9e1cf;
  --foot-muted: #b8ad97;
  --foot-accent: #e3907a;
  --foot-rule: #3a4459;

  --caps: "Century Supra A Caps", "Century Supra A", Georgia, serif;
  --mono: "Triplicate A Code", ui-monospace, Menlo, Consolas, monospace;

  --wrap: 70rem;
  --gutter: clamp(var(--space-unit), 4vw, calc(var(--space-unit) * 2));
  --col-gap: 3.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #14171e;
    --color-text: #e6dfd0;
    --color-accent: #e3907a;
    --color-muted: #a59a88;
    --ink-soft: #cdc4b3;
    --rule: #343b49;
    --leader: #4f586a;
    --ghost: #353d4c;
    --accent-hover: #f2b8a6;
    --grain: rgba(230, 223, 208, 0.018);
    --code-bg: #1f2430;
    --foot-bg: #0c0f14;
    --foot-rule: #2a3140;
  }
}

/* ---- Base ------------------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--color-bg);
  background-image: repeating-linear-gradient(0deg, var(--grain) 0, var(--grain) 1px, transparent 1px, transparent 5px);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: clamp(1.125rem, 1.05rem + 0.3vw, 1.3125rem);
  line-height: 1.62;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--font-heading); }
img, svg, video { max-width: 100%; height: auto; }
img, video { display: block; }
a { color: var(--color-accent); text-decoration-thickness: 0.06em; text-underline-offset: 0.18em; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 0.1em; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--color-accent); color: var(--color-bg); }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--gutter); top: -4rem; background: var(--color-text); color: var(--color-bg); padding: 0.5rem 1rem; z-index: 10; }
.skip-link:focus { top: 0.5rem; }

/* Small caps: the Caps cut renders lowercase as true small capitals. */
.sc { font-family: var(--caps); text-transform: lowercase; letter-spacing: 0.09em; font-weight: 400; }
.accent { color: var(--color-accent); }

/* Margin column + reading column; the margin stacks above on narrow screens. */
.row { display: flex; flex-wrap: wrap; gap: 1.5rem var(--col-gap); }
.col-margin { flex: 1 1 12.5rem; max-width: 15rem; }
.col-main { flex: 999 1 35rem; min-width: 0; max-width: 45rem; }

/* ---- Masthead: full (home page 1) ------------------------------------------------------ */
.running-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem;
  padding-top: 1.4rem; font-size: 0.95rem; color: var(--color-muted);
}
.nameplate { padding-top: 1.75rem; text-align: center; }
.nameplate-inner {
  border-top: 3px double var(--color-text);
  padding-top: 2.75rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
}
.nib { color: var(--color-accent); display: block; }
.nameplate-title {
  margin: 0;
  font-size: clamp(3.5rem, 10vw, 8rem);
  line-height: 0.95;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.nameplate-tagline { margin: 0.4rem 0 0; font-size: clamp(1.25rem, 2.2vw, 1.65rem); color: var(--ink-soft); }
.nameplate-nav {
  margin-top: 2.5rem;
  border-top: 1px solid var(--color-text);
  border-bottom: 3px double var(--color-text);
  padding: 0.75rem 0;
  display: flex; justify-content: center; flex-wrap: wrap; gap: 0.4rem 2.5rem;
  font-size: 1.05rem;
}
.nameplate-nav a, .compact-nav a { color: var(--color-text); text-decoration: none; }
.nameplate-nav a:hover, .compact-nav a:hover { color: var(--color-accent); }

/* ---- Masthead: compact (everywhere else) ----------------------------------------------- */
.masthead-compact { padding-top: 1.6rem; }
.masthead-compact-inner {
  border-bottom: 3px double var(--color-text);
  padding-bottom: 0.9rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.5rem 2rem;
}
.compact-title { font-size: 1.9rem; font-style: italic; line-height: 1; color: var(--color-text); text-decoration: none; }
.compact-title:hover { color: var(--color-accent); }
.compact-nav { display: flex; flex-wrap: wrap; gap: 0.4rem 2rem; font-size: 1rem; }

/* ---- Marginalia ------------------------------------------------------------------------ */
.marginalia {
  display: flex; flex-direction: column; gap: 0.6rem;
  padding-top: 0.6rem; font-size: 0.95rem; line-height: 1.45; color: var(--color-muted);
}
.marginalia .accent { font-size: 1rem; }
.marginalia-terms { font-style: italic; }
.marginalia-terms a { color: inherit; }
.marginalia-terms a:hover { color: var(--color-accent); }
.marginalia--post { gap: 1.1rem; padding-top: 0.35rem; }
.marginalia-label { display: block; color: var(--color-text); }
@media (min-width: 52rem) {
  .marginalia--post { position: sticky; top: 1.5rem; align-self: flex-start; }
}

/* ---- Lead essay ------------------------------------------------------------------------ */
.lead { padding-top: 4.5rem; }
.lead-title {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 3.75rem);
  line-height: 1.04; font-weight: 700; letter-spacing: -0.015em;
  text-wrap: balance;
}
.lead-title a { color: var(--color-text); text-decoration: none; }
.lead-title a:hover { color: var(--color-accent); }
.lead-excerpt { margin: 1.75rem 0 0; font-size: 1.15em; line-height: 1.62; }
.lead-excerpt::first-letter,
.prose--essay > p:first-of-type::first-letter {
  float: left;
  font-size: 4.2em;
  line-height: 0.8;
  padding: 0.08em 0.1em 0 0;
  font-weight: 700;
  color: var(--color-accent);
}
.continue { margin: 1.4rem 0 0; }
.continue a { font-style: italic; }

.fleuron { text-align: center; color: var(--color-accent); font-size: 1.6rem; line-height: 1; }
.fleuron--spaced { margin-top: 4.5rem; letter-spacing: 0.6em; }
.fleuron--end { margin: 3.5rem 0 0; }

/* ---- Contents -------------------------------------------------------------------------- */
.contents { padding-top: 3rem; }
.contents-heading { margin: 0 0 0.5rem; font-size: 1.1rem; text-align: center; color: var(--color-muted); }
.contents-intro { margin: 0 auto 2.5rem; max-width: 40rem; text-align: center; font-style: italic; color: var(--ink-soft); }
.contents-year + .contents-year { margin-top: 3rem; }
.year-numeral {
  font-size: clamp(3rem, 6vw, 4.5rem); line-height: 1;
  font-style: italic; color: var(--ghost);
  font-variant-numeric: oldstyle-nums;
}
.toc { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.1rem; }
.toc-row { display: flex; align-items: baseline; gap: 0.75rem; }
.toc-row a { flex: 0 1 auto; font-size: 1.12em; line-height: 1.3; color: var(--color-text); text-decoration: none; }
.toc-row a:hover { color: var(--color-accent); text-decoration: underline; text-decoration-thickness: 1px; }
.leader { flex: 1 1 2rem; min-width: 1.5rem; border-bottom: 1.5px dotted var(--leader); transform: translateY(-0.3em); }
.toc-row time { flex: none; white-space: nowrap; font-size: 0.9rem; color: var(--color-muted); }
.empty { color: var(--color-muted); font-style: italic; }

.pagination { margin-top: 3rem; }
.pagination-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; font-size: 1rem; color: var(--color-muted); }
.pagination-inner a { font-style: italic; }

/* ---- Shelf sections: subjects, about --------------------------------------------------- */
.shelf { padding-top: 6rem; }
.shelf-inner { border-top: 1px solid var(--color-text); padding-top: 2.5rem; }
.shelf-title { margin: 0; font-size: 2.1rem; line-height: 1.1; font-style: italic; font-weight: 400; }
.subject-index { list-style: none; margin: 0; padding: 0; columns: 2 13.75rem; column-gap: 3rem; }
.subject-index li { break-inside: avoid; padding: 0.25rem 0; }
.subject-index a { color: var(--color-text); text-decoration: none; }
.subject-index a:hover { color: var(--color-accent); text-decoration: underline; }
.initial { color: var(--color-accent); font-weight: 700; margin-right: 0.6rem; display: inline-block; min-width: 0.8em; }
.about { padding-top: 4.5rem; }
.about-blurb { margin: 0; font-size: 1.05em; }

/* ---- Single post / page / archive ------------------------------------------------------ */
.post-head { padding-top: clamp(3rem, 7vw, 5.5rem); }
.kicker { margin: 0 0 0.9rem; font-size: 1rem; }
.post-title {
  margin: 0;
  font-size: clamp(2.75rem, 6vw, 4.75rem);
  line-height: 1.02; font-weight: 700; letter-spacing: -0.02em;
  text-wrap: balance;
}
.ink-stroke { display: block; margin-top: 2rem; color: var(--color-accent); }
.post-body-row { padding-top: 2.5rem; }
.post-image { margin: 0 0 2.5rem; }
.post-image img { width: 100%; }
.archive { padding-bottom: 0; }
.archive-head { margin-bottom: 3rem; }
.archive-intro { color: var(--ink-soft); font-style: italic; margin: 1rem 0 0; }
.page { padding-bottom: 1rem; }
.post .comments, .post #comments { margin-top: 4rem; }

/* ---- Prose ----------------------------------------------------------------------------- */
.prose { overflow-wrap: break-word; hanging-punctuation: first; }
.prose > * { margin-block: 0; }
.prose > * + * { margin-top: 1.15em; }
.prose h2, .prose h3, .prose h4 { line-height: 1.2; font-weight: 700; text-wrap: balance; }
.prose h2 { font-size: 1.5em; margin-top: 2.2em; }
.prose h3 { font-size: 1.2em; margin-top: 1.8em; }
.prose h4 { font-family: var(--caps); text-transform: lowercase; font-weight: 400; letter-spacing: 0.08em; font-size: 1em; margin-top: 1.8em; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: 0.6em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.35em; }
.prose li::marker { color: var(--color-muted); }
.prose blockquote {
  margin-inline: 0;
  padding: 0 0 0 1.75rem;
  border-left: 1px solid var(--color-accent);
  font-style: italic;
  font-size: 1.12em;
  line-height: 1.5;
  color: var(--ink-soft);
}
.prose blockquote > * + * { margin-top: 0.8em; }
.prose blockquote p { margin: 0; }
.prose blockquote cite { display: block; margin-top: 0.6em; font-style: normal; font-family: var(--caps); text-transform: lowercase; letter-spacing: 0.08em; font-size: 0.75em; }
.prose hr { border: 0; text-align: center; margin-block: 2.5em; height: auto; }
.prose hr::after { content: "\2042"; color: var(--color-muted); font-size: 1.2em; }
.prose figure { margin-inline: 0; }
.prose figure img { margin-inline: auto; }
.prose figcaption { font-size: 0.85em; color: var(--color-muted); font-style: italic; margin-top: 0.6em; text-align: center; }
.prose abbr[title] { font-family: var(--caps); text-transform: lowercase; letter-spacing: 0.04em; text-decoration: none; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.9em; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 0.5em 0.75em 0.5em 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th { font-family: var(--caps); text-transform: lowercase; font-weight: 400; letter-spacing: 0.06em; color: var(--color-muted); }

code, kbd, samp, pre { font-family: var(--mono); font-size: 0.8em; }
:not(pre) > code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 3px; }
pre { background: var(--code-bg); padding: 1rem 1.25rem; border-radius: 3px; overflow-x: auto; line-height: 1.5; tab-size: 4; }
pre code { background: none; padding: 0; font-size: 1em; }

/* ---- Footer ---------------------------------------------------------------------------- */
.site-footer { margin-top: 7rem; background: var(--foot-bg); color: var(--foot-text); font-size: 1.05rem; }
.site-footer .wrap { padding-top: 4rem; padding-bottom: 2.5rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13.75rem, 1fr)); gap: 2.5rem; }
.footer-name { margin: 0; font-size: 2.1rem; font-style: italic; line-height: 1; }
.footer-muted { margin: 0.75rem 0 0; color: var(--foot-muted); }
.footer-head { margin: 0 0 0.75rem; font-size: 0.95rem; color: var(--foot-accent); }
.footer-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.site-footer a { color: var(--foot-text); }
.site-footer a:hover { color: var(--foot-accent); }
.footer-note { display: block; font-style: italic; color: var(--foot-muted); font-size: 0.9rem; }
.footer-base {
  margin-top: 3.5rem; padding-top: 1.25rem; border-top: 1px solid var(--foot-rule);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem;
  font-size: 0.875rem; color: var(--foot-muted);
}
.footer-base a { color: var(--foot-muted); }
.colophon { font-family: var(--mono); }

/* ---- Motion & print -------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

@media print {
  .running-head, .nameplate-nav, .compact-nav, .shelf, .site-footer, .skip-link, .pagination, .comments, #comments, .marginalia--post { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: inherit; text-decoration: none; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
}
