/* ==========================================================================
   Leo Paul Marcel — site.css
   Layered on top of vendored bootstrap.min.css (grid + utilities only; the
   theme below overrides essentially all of Bootstrap's visual language).

   Ported from mockup/index.html and mockup/marginalia.html, which remain the
   visual reference. Two registers carry the whole site:

     photo-led   stories and essays — a picture, a title, prose
     text-first  reference articles — the type does the work, no hero art

   Brutalist rules that are load-bearing, not decoration: no rounded corners
   anywhere, hairline rules instead of cards, mono for every label.
   ========================================================================== */

/* ---------------------------------------------------------------- fonts --
   Self-hosted latin-subset woff2 (Fontsource builds). Zero third-party
   requests; keep it that way. Fraunces and Newsreader are variable. */

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-wght-italic.woff2") format("woff2-variations");
  font-weight: 100 900; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-latin-wght-italic.woff2") format("woff2-variations");
  font-weight: 200 800; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

/* --------------------------------------------------------------- tokens -- */

:root {
  --ground: #15110D;      /* warm near-black */
  --ground-2: #1C1712;    /* elevated */
  --ground-3: #241C15;    /* image base, and the colour behind a missing photo */
  --ink: #ECE3D2;         /* bone text */
  --ink-strong: #F7F0E1;
  --muted: #9A8B76;       /* warm gray */
  --line: #392E22;        /* warm hairline */
  --accent: #CB8272;      /* clay rose — the romantic accent */
  --accent-strong: #E3A491;
  --felt: #7C8A6A;        /* used once, sparingly */

  --serif: "Newsreader", Georgia, serif;
  --display: "Fraunces", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;

  --measure: 66ch;
  --bs-body-bg: var(--ground);
  --bs-body-color: var(--ink);
  --bs-border-color: var(--line);
}

* { border-radius: 0 !important; }   /* brutalist: no soft corners anywhere */

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.433rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Keyboard escape hatch — visually hidden until focused. */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  font-family: var(--mono); font-size: .95rem; letter-spacing: .12em;
  text-transform: uppercase; background: var(--accent); color: var(--ground);
  padding: .75rem 1.25rem;
}
.skip:focus { left: 0; }

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

/* ---- brutalist labels / metadata ---- */
.kicker, .meta, .tag {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 0.96rem;
  font-weight: 500;
  color: var(--muted);
}
.kicker { color: var(--accent); }

/* ---- display type ---- */
h1, h2, h3, .display {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -.01em;
  color: var(--ink-strong);
  font-variation-settings: "SOFT" 60, "WONK" 0, "opsz" 120;
}
.huge { font-size: clamp(3.05rem, 8.2vw, 6.5rem); font-weight: 900; line-height: .98; }
.em {
  font-style: italic; font-weight: 400; color: var(--accent-strong);
  font-variation-settings: "SOFT" 80, "WONK" 1;
}
.section-h { font-size: clamp(1.85rem, 3.5vw, 2.8rem); }

a { color: var(--ink); text-decoration: none; }
p a, .prose a {
  color: var(--accent-strong); text-decoration: underline;
  text-underline-offset: 3px; text-decoration-thickness: 1px;
}

hr.rule { border: 0; border-top: 1px solid var(--line); opacity: 1; margin: 0; }
hr.rule-heavy { border: 0; border-top: 2px solid var(--ink); opacity: 1; margin: 0; }

/* ================= MASTHEAD ================= */
.wordmark {
  font-family: var(--mono); font-weight: 600; letter-spacing: .28em;
  text-transform: uppercase; font-size: 1.093rem; color: var(--ink-strong);
}
/* Over the hero the masthead floats; everywhere else it is a ruled bar. */
.masthead {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  padding-top: clamp(1.25rem, 3vw, 2rem);
}
.masthead-solid {
  position: static; border-bottom: 1px solid var(--line);
  padding: 1.25rem 0; margin-bottom: 0;
}
.langpill {
  font-family: var(--mono); font-size: 0.933rem; letter-spacing: .12em;
  color: var(--ink); border: 1px solid rgba(236, 227, 210, .35); padding: .15rem .5rem;
}
.langpill .off { opacity: .35; }

/* ================= PHOTOS =================
   .ph is the frame; the image rides as a background so every crop is a
   centred cover crop regardless of the plate's aspect. Posts without a
   resolved image keep the gradient underneath — a designed absence, never a
   broken <img>. */
.ph {
  position: relative; background: var(--ground-3);
  background-size: cover; background-position: center; overflow: hidden;
}
.ph::after {  /* grain */
  content: ""; position: absolute; inset: 0; opacity: .16; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.ph-a { background-image: linear-gradient(155deg, #3a2418 0%, #6e3f2e 42%, #241812 100%); }
.ph-b { background-image: linear-gradient(160deg, #20242b 0%, #3f4a3a 55%, #14120e 100%); }
.ph-c { background-image: linear-gradient(150deg, #432129 0%, #8a4f45 50%, #1c1410 100%); }
.ph-d { background-image: linear-gradient(165deg, #2a2622 0%, #4a3b2c 60%, #12100c 100%); }
.ph-scrim::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(10, 8, 6, .82) 0%, rgba(10, 8, 6, .15) 55%, rgba(10, 8, 6, .35) 100%);
}

/* ================= HERO ================= */
.hero { position: relative; min-height: 86vh; display: flex; align-items: flex-end; }
.hero .ph { position: absolute; inset: 0; }
.hero-inner { position: relative; z-index: 4; padding-bottom: clamp(2rem, 6vw, 5rem); }
.hero .sub { max-width: 44ch; color: var(--ink); font-size: 1.533rem; }

/* ================= SECTIONS ================= */
.section { padding: clamp(3.5rem, 7vw, 6rem) 0; }
.section-label { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 2.25rem; }
.section-note { color: var(--muted); max-width: 60ch; }

/* pillar tiles — container draws top+left, cells draw right+bottom,
   so the grid stays seamless however the columns wrap */
.pillar-grid { border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.pillar-grid > [class*="col-"] { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pillar {
  display: block; padding: 1.5rem 1.4rem 1.7rem; height: 100%;
  background: var(--ground); transition: none;
}
.pillar:hover { background: var(--ground-2); outline: 1px solid var(--accent); outline-offset: -1px; }
.pillar h3 { font-size: 1.75rem; margin: 0 0 .5rem; }
.pillar p { color: var(--muted); font-size: 1.267rem; margin: 0; line-height: 1.5; }

/* feature (photo-led register) */
.feature { border: 1px solid var(--line); }
.feature-img { min-height: 340px; height: 100%; }
.feature-body { padding: 2.25rem clamp(1.25rem, 3vw, 2.75rem); }
.feature-body h2 { font-size: clamp(2.2rem, 4vw, 3.5rem); margin: .75rem 0 1rem; }
.feature-body p { color: var(--ink); max-width: 52ch; }
.feature-body .story-lede { font-style: italic; color: var(--ink); }

/* reference (text-first register) */
.ref {
  border-top: 1px solid var(--line); padding: 1.6rem 0;
  display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: baseline;
}
.ref:last-child { border-bottom: 1px solid var(--line); }
.ref .q { font-family: var(--display); font-weight: 600; font-size: 1.65rem; color: var(--ink-strong); }
.ref .a { color: var(--muted); font-size: 1.307rem; max-width: 60ch; }

.arrow {
  font-family: var(--mono); color: var(--accent); font-size: 1.067rem;
  letter-spacing: .1em; white-space: nowrap;
}
.arrow:hover { color: var(--accent-strong); }

/* ================= MARGINALIA =================
   Colour is the category (unlabelled); lions are the Leo score. The quote is
   set in mono and the annotation in a hand — machine transcript vs. margin
   note. Shared by the homepage card and the /marginalia/ feed. */
.mg {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--cat, var(--muted));
  padding: 1.75rem 0 2rem 1.5rem;
}
.mg-head { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.score { display: inline-flex; gap: .18rem; flex: none; }
.lion { width: 1.15rem; height: 1.15rem; color: var(--cat, var(--muted)); }
.lion.off { opacity: .16; }

.mg .hl {
  font-family: var(--mono); font-weight: 400; color: var(--ink-strong);
  font-size: 1.15rem; line-height: 1.65; max-width: 56ch;
}
/* mono sets wide, so the measure tightens as the type grows */
.mg.q-s .hl { font-size: 1.35rem; line-height: 1.55; max-width: 42ch; }
.mg.q-l .hl { font-size: 1.02rem; line-height: 1.7; max-width: 64ch; }

.mg .src {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .14em;
  font-size: 0.9rem; color: var(--muted); margin-top: 1rem;
}
.mg .mg-note {
  display: flex; align-items: flex-start; gap: .65rem;
  font-family: var(--sans); color: var(--muted);
  font-size: 1.12rem; line-height: 1.55; max-width: 56ch; margin-top: 1.25rem;
}
.mg .mg-note .ico { width: 1.05rem; height: 1.05rem; flex: none; margin-top: .35rem; opacity: .75; }

/* the /marginalia/ feed proper */
.mg-wrap { max-width: 46rem; margin: 0 auto; padding: 0 1.25rem; }
.card {
  border-top: 1px solid var(--line);
  border-left: var(--rulew, 3px) var(--rule, solid) var(--cat, var(--muted));
  background: var(--wash, transparent);
  padding: 1.75rem 1.25rem 2.25rem 1.5rem;
}
.card-head { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.quote { font-family: var(--mono); font-weight: 400; color: var(--ink-strong); margin: 0; }
/* highlights run 6-114 words (median 25); mono sets wide, so the measure
   widens as the type shrinks */
.q-s .quote { font-size: 1.35rem; line-height: 1.55; max-width: 42ch; }
.q-m .quote { font-size: 1.15rem; line-height: 1.65; max-width: 56ch; }
.q-l .quote { font-size: 1.02rem; line-height: 1.7; max-width: 64ch; }
.card .src {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .14em;
  font-size: .9rem; color: var(--muted); margin-top: 1rem;
}
.card .mg-note {
  display: flex; align-items: flex-start; gap: .65rem;
  font-family: var(--sans); color: var(--muted);
  font-size: 1.12rem; line-height: 1.55; max-width: 56ch; margin-top: 1.25rem;
}
.card .mg-note .ico { width: 1.05rem; height: 1.05rem; flex: none; margin-top: .35rem; opacity: .75; }

.reveal { opacity: 0; transform: translateY(12px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

.status {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .14em;
  font-size: .9rem; color: var(--muted); text-align: center; padding: 3.5rem 0 6rem;
}
.status .top-link { color: var(--accent); }

/* category colours — hue + rule + a faint wash, no legend */
.g-fiction  { --cat: #CB8272; --wash: rgba(203,130,114,.055); --rule: solid;  --rulew: 3px; }
.g-craft    { --cat: #7C8A6A; --wash: rgba(124,138,106,.055); --rule: double; --rulew: 4px; }
.g-business { --cat: #B99A5E; --wash: rgba(185,154,94,.055);  --rule: dashed; --rulew: 3px; }
.g-tech     { --cat: #7E93A6; --wash: rgba(126,147,166,.055); --rule: dotted; --rulew: 3px; }
.g-general  { --cat: #9A8B76; --wash: rgba(154,139,118,.055); --rule: solid;  --rulew: 3px; }
.g-psych    { --cat: #A08AA6; --wash: rgba(160,138,166,.055); --rule: double; --rulew: 4px; }
.g-phil     { --cat: #C08A9E; --wash: rgba(192,138,158,.055); --rule: dashed; --rulew: 3px; }
.g-geo      { --cat: #B07A6A; --wash: rgba(176,122,106,.055); --rule: dotted; --rulew: 3px; }
.g-health   { --cat: #7FA08C; --wash: rgba(127,160,140,.055); --rule: solid;  --rulew: 3px; }
.g-science  { --cat: #6F9AA0; --wash: rgba(111,154,160,.055); --rule: double; --rulew: 4px; }

/* ================= CONVERSION ================= */
.cta { position: relative; min-height: 60vh; display: flex; align-items: center; }
.cta .ph { position: absolute; inset: 0; }
.cta-inner { position: relative; z-index: 4; }
.cta-title { font-size: clamp(2.55rem, 6.4vw, 4.65rem); }
.cta-body { max-width: 46ch; font-size: 1.533rem; }

.btn-brand, .btn-ghost {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .14em;
  font-size: 1.04rem; font-weight: 500; padding: .85rem 1.6rem; display: inline-block;
}
.btn-brand { color: var(--ground); background: var(--accent); border: 1px solid var(--accent); }
.btn-brand:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--ground); }
.btn-ghost { color: var(--ink); background: transparent; border: 1px solid var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--ground); }

/* ================= THE LEDGER (index listings) ================= */
.entry {
  border-top: 1px solid var(--line); padding: 1.75rem 0;
  display: grid; grid-template-columns: 1fr auto; gap: 1.5rem 2rem; align-items: baseline;
}
.entry:last-child { border-bottom: 1px solid var(--line); }
.entry h3 { font-size: 1.85rem; margin: .4rem 0 .5rem; }
.entry h3 a:hover { color: var(--accent-strong); }
.entry p { color: var(--muted); font-size: 1.267rem; margin: 0; max-width: 62ch; line-height: 1.5; }
.entry-meta { display: flex; gap: 1rem; align-items: baseline; flex-wrap: wrap; }

.pager {
  display: flex; justify-content: space-between; gap: 1rem;
  padding-top: 2.5rem; font-family: var(--mono); font-size: 1.04rem;
  letter-spacing: .12em; text-transform: uppercase;
}
.pager a { color: var(--accent); }
.pager .off { color: var(--muted); opacity: .4; }

/* ================= THE POST PAGE ================= */
.post-hero { position: relative; min-height: 64vh; display: flex; align-items: flex-end; }
.post-hero .ph { position: absolute; inset: 0; }
.post-hero-inner { position: relative; z-index: 4; padding-bottom: clamp(2rem, 5vw, 4rem); }
.post-title { font-size: clamp(2.4rem, 6vw, 4.6rem); }
.post-sub { color: var(--ink); max-width: 46ch; font-size: 1.4rem; font-style: italic; }

/* A post with no resolved image gets a typographic plate instead — the rule
   above the title does the work the photograph would have. */
.post-head-ink { border-top: 2px solid var(--ink); padding-top: clamp(2rem, 5vw, 3.5rem); }

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1.4rem; }
.prose h2 {
  font-size: clamp(1.7rem, 3vw, 2.35rem); margin-top: 3.25rem; margin-bottom: 1rem;
  padding-top: 1.25rem; border-top: 1px solid var(--line);
}
.prose h3 { font-size: 1.5rem; margin-top: 2.25rem; margin-bottom: .75rem; }
.prose strong { color: var(--ink-strong); font-weight: 600; }
.prose em { font-style: italic; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: .5rem; }
.prose li::marker { color: var(--accent); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.75rem 0; opacity: 1; }

/* Pull quote. The stories lean on this hard; the articles almost never use it. */
.prose blockquote {
  border-left: 3px solid var(--accent); padding: .25rem 0 .25rem 1.5rem;
  margin: 2.5rem 0; font-family: var(--display); font-style: italic;
  font-size: 1.6rem; line-height: 1.3; color: var(--ink-strong); max-width: 44ch;
}
.prose blockquote p { margin: 0; }

/* The articles carry ASCII diagrams in fenced blocks — they must not wrap, so
   they scroll inside their own box rather than forcing the page sideways. */
.prose pre {
  font-family: var(--mono); font-size: .92rem; line-height: 1.5;
  background: var(--ground-2); border: 1px solid var(--line);
  padding: 1.25rem; overflow-x: auto; color: var(--ink);
}
.prose code {
  font-family: var(--mono); font-size: .92em; color: var(--accent-strong);
  background: var(--ground-2); padding: .1em .35em;
}
.prose pre code { background: none; padding: 0; color: inherit; }

.prose table { width: 100%; border-collapse: collapse; font-size: 1.15rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: .65rem .85rem; text-align: left; }
.prose th { font-family: var(--mono); font-size: .9rem; text-transform: uppercase;
            letter-spacing: .1em; color: var(--muted); font-weight: 500; }
.table-scroll { overflow-x: auto; }

/* Stories read as one column of prose with no headings; give them air. */
.prose-story { font-size: 1.5rem; line-height: 1.72; max-width: 60ch; }
.prose-story > * + * { margin-top: 1.75rem; }

.margin-note {
  border-left: 3px solid var(--felt); padding-left: 1.25rem; margin: 2.5rem 0;
  font-family: var(--sans); font-size: 1.1rem; line-height: 1.55;
  color: var(--muted); max-width: 40ch;
}

.post-foot { border-top: 1px solid var(--line); margin-top: 4rem; padding-top: 2rem; }
.tag-link {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .14em;
  font-size: .96rem; color: var(--muted); border: 1px solid var(--line);
  padding: .3rem .7rem; display: inline-block;
}
.tag-link:hover { color: var(--accent); border-color: var(--accent); }

figure.plate { margin: 0; }
figure.plate img { width: 100%; height: auto; display: block; }
figure.plate figcaption { font-family: var(--mono); font-size: .85rem; letter-spacing: .1em;
                          text-transform: uppercase; color: var(--muted); padding-top: .6rem; }

/* ================= FOOTER ================= */
footer { border-top: 2px solid var(--ink); padding: 3.5rem 0 2.5rem; margin-top: 4rem; }
footer a { color: var(--ink); display: block; padding: .2rem 0; font-size: 1.307rem; }
footer a:hover { color: var(--accent); }
footer .blurb { color: var(--muted); max-width: 32ch; font-size: 1.267rem; }
.note {
  font-family: var(--mono); font-size: 0.827rem; letter-spacing: .1em;
  color: var(--muted); text-transform: uppercase;
}

/* ================= SMALL SCREENS ================= */
@media (max-width: 575.98px) {
  body { font-size: 1.25rem; }
  .hero { min-height: 78vh; }
  .ref { grid-template-columns: 1fr; }
  .entry { grid-template-columns: 1fr; }
  .prose-story { font-size: 1.32rem; }
}
