/*
Theme Name: Insight Labs — Field Notes
Theme URI: https://insight-labs.xyz
Author: Insight Labs
Description: Reading-first theme for insight-labs.xyz. Light and dark reading modes, a measured column with margin sidenotes, APA citations, and a knowledge-graph homepage.
Version: 0.1.0
Requires at least: 6.4
Tested up to: 6.8
Requires PHP: 8.0
License: GPL-2.0-or-later
Text Domain: insights-lab
*/

/* ============================================================
   TOKENS
   Scoped to .site[data-mode] so the reader's toggle is the only
   thing that switches them.
   ============================================================ */
.site {
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --radius: 4px;
  --rail: 200px;
  --col: 660px;
  --note: 210px;
  --gutter: 44px;
  --shell: 1220px;
}

/* Tokens live on the ROOT element, set by the inline script in wp_head before
   first paint. Putting them on .site would repaint after the body renders and
   flash the wrong mode. */
:root[data-il-mode="light"] {
  color-scheme: light;
  --bg: #FBFAFD; --sunken: #F4F2F9; --card: #FFFFFF;
  --ink: #17141F; --body: #2E2A3D; --muted: #6B6482; --faint: #8A849F;
  --hair: #E3E0EA; --hair-strong: #CFC8DD;
  --purple: #7B2FF7; --orange: #C85A21; --mark: rgba(232,166,106,.34);
  --chip-info-bg: #F0F9FF; --chip-info-text: #0369A1;
  --btn-bg: #7B2FF7; --btn-fg: #FFFFFF;
  --card-shadow: 0 1px 2px rgba(20,10,40,.04);
  --band-bg: #17141F; --band-border: transparent; --band-fg: #FFFFFF;
  --band-dim: rgba(255,255,255,.74);
  --band-btn-bg: #C85A21; --band-btn-fg: #FFFFFF;
  --band-input: rgba(255,255,255,.08); --band-input-b: rgba(255,255,255,.28);
}

:root[data-il-mode="dark"] {
  color-scheme: dark;
  --bg: #131019; --sunken: #1A1622; --card: #191621;
  --ink: #F2F0F7; --body: #C9C4D7; --muted: #948DA6; --faint: #6F6883;
  --hair: #2B2734; --hair-strong: #3E3849;
  --purple: #B37DF3; --orange: #E8A66A; --mark: rgba(232,166,106,.22);
  --chip-info-bg: rgba(14,165,233,.16); --chip-info-text: #7DD3FC;
  --btn-bg: #7B2FF7; --btn-fg: #FFFFFF;
  --card-shadow: none;
  --band-bg: #211A2E; --band-border: #3A3350; --band-fg: #F2F0F7;
  --band-dim: rgba(242,240,247,.70);
  --band-btn-bg: #E8A66A; --band-btn-fg: #2A1004;
  --band-input: rgba(255,255,255,.06); --band-input-b: rgba(255,255,255,.20);
}

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

.site {
  background: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 200ms ease, color 200ms ease;
}
.site :focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; border-radius: 2px; }
.shell { max-width: var(--shell); margin: 0 auto; padding: 0 32px; }
.screen-reader-text {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px,1px,1px,1px); white-space: nowrap;
}
.skip-link:focus {
  position: fixed; top: 8px; left: 8px; z-index: 100;
  background: var(--card); color: var(--ink); padding: 10px 16px;
  border: 1px solid var(--hair-strong); border-radius: var(--radius);
  width: auto; height: auto; clip: auto;
}

/* ---------- reading progress ---------- */
.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 50; pointer-events: none; }
.progress i { display: block; height: 100%; width: 0; background: var(--orange); transition: width 90ms linear; }

/* ---------- nav ---------- */
.nav { display: flex; align-items: center; gap: 12px; padding: 20px 0; border-bottom: 1px solid var(--hair); }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; color: var(--purple); text-decoration: none; }
.brand svg { display: block; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.mode-toggle {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  background: transparent; color: var(--muted);
  border: 1px solid var(--hair); border-radius: var(--radius);
  cursor: pointer; transition: color 140ms, border-color 140ms;
}
.mode-toggle:hover { color: var(--ink); border-color: var(--hair-strong); }
.mode-toggle svg { display: block; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 24px; font-size: 14.5px; font-weight: 600; font-family: inherit;
  border-radius: var(--radius); border: 0; cursor: pointer; text-decoration: none;
  background: var(--btn-bg); color: var(--btn-fg);
  transition: filter 140ms ease, transform 140ms ease;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--hair-strong); }
.btn.sm { padding: 9px 18px; font-size: 13.5px; }

/* ---------- shared type ---------- */
.eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--orange); font-weight: 500; margin: 0 0 18px;
}
.h1 {
  margin: 0 0 22px; font-size: clamp(38px, 5.2vw, 60px); font-weight: 700;
  letter-spacing: -0.035em; line-height: 1.03; color: var(--ink); text-wrap: balance;
}
.h1 em { font-style: normal; color: var(--purple); }
.h2 { margin: 0; font-size: clamp(24px,3vw,32px); font-weight: 700; letter-spacing: -0.03em; color: var(--ink); }
.lede { font-size: 17.5px; line-height: 1.55; color: var(--muted); margin: 0 0 34px; max-width: 46ch; }
.meta {
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint); margin: 0;
}

/* ---------- sections ---------- */
.section { padding: 0 0 84px; }
.sec-head {
  display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap;
  margin: 0 0 28px; padding-bottom: 16px; border-bottom: 1px solid var(--hair);
}
.sec-head .more { margin-left: auto; font-size: 13.5px; color: var(--purple); text-decoration: none; }
.sec-head .more:hover { text-decoration: underline; }
/* The head aligns on the baseline, which is right for the "All insights →" link
   but drops a small chip well below the optical centre of a 32px heading.
   Centre just the chip against the heading's line box. */
.sec-head .status { align-self: center; }

/* ---------- homepage ---------- */
.hero { display: grid; grid-template-columns: 1.02fr .98fr; gap: 52px; align-items: center; padding: 84px 0 76px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-figure canvas { display: block; width: 100%; height: auto; cursor: grab; }
.hero-figure canvas:active { cursor: grabbing; }
.figcap {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; color: var(--faint);
  margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--hair);
}
.figcap b { color: var(--orange); font-weight: 500; }

.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 18px; }

.card {
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--card-shadow);
  display: flex; flex-direction: column;
  transition: border-color 160ms ease, transform 160ms ease;
}
.card:hover { border-color: var(--hair-strong); transform: translateY(-2px); }
.card h3 {
  font-size: 19.5px; line-height: 1.24; letter-spacing: -0.02em; margin: 12px 0 10px;
  color: var(--ink); font-weight: 700; text-wrap: balance;
}
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { color: var(--purple); }
.card p { font-size: 14.5px; line-height: 1.55; color: var(--muted); margin: 0 0 18px; }
.card .foot { margin-top: auto; }

.tag {
  display: inline-block; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .08em; text-transform: uppercase; padding: 5px 10px;
  border-radius: var(--radius); border: 1px solid var(--hair);
  color: var(--muted); text-decoration: none;
}
.tag:hover { border-color: var(--hair-strong); color: var(--ink); }
.tag.is-series { color: var(--purple); border-color: color-mix(in srgb, var(--purple) 36%, transparent); }

.status {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; padding: 5px 10px; border-radius: var(--radius);
}
.status.live { background: color-mix(in srgb, var(--purple) 15%, transparent); color: var(--purple); }
/* The original semantic chip blue from the design system tokens
   (--chip-solo-episode-bg/text, "verbatim from source"). Distinct from the
   orange discipline line above it and from the purple live chip. */
.status.soon { background: var(--chip-info-bg); color: var(--chip-info-text); }
/* Queued behind the Lab in preparation. Deliberately the quietest of the
   three — outline only — so the running order reads at a glance. The 1px
   border is taken back out of the padding to keep all three the same height. */
.status.planned {
  background: transparent; color: var(--muted);
  border: 1px solid var(--hair); padding: 4px 9px;
}

.series-card {
  display: grid; grid-template-columns: auto 1fr; gap: 20px; padding: 26px;
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--radius);
  box-shadow: var(--card-shadow); align-items: start;
}
.series-card .n { font-family: var(--mono); font-size: 12px; color: var(--faint); padding-top: 5px; letter-spacing: .06em; }
.series-card h3 { margin: 0 0 5px; font-size: 20px; letter-spacing: -0.02em; color: var(--ink); font-weight: 700; }
.series-card h3 a { color: inherit; text-decoration: none; }
.series-card .disc { font-size: 13.5px; color: var(--orange); font-family: var(--mono); letter-spacing: .04em; margin: 0 0 12px; }
.series-card p { font-size: 14.5px; color: var(--muted); margin: 0 0 16px; line-height: 1.55; }
.series-card .stat { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.series-card p.subtitle { font-size: 15px; color: var(--ink); margin: 0 0 10px; line-height: 1.45; }

/* ---------- articles / episodes ----------
   These styles were missing from the theme entirely — the block existed in the
   markup but had no CSS, so it rendered as unstyled stacked divs.

   Two plain columns divided by a hairline, rather than the mockup's filled
   boxes and arrow graphic: filled slabs fight the hairline-and-mono register
   the rest of the page uses. */
.flow { display: grid; grid-template-columns: 1fr 1fr; gap: 0; align-items: start; }
.flow-card { background: transparent; border: 0; padding: 0 44px 0 0; }
.flow-card + .flow-card { padding: 0 0 0 44px; border-left: 1px solid var(--hair); }
.flow-card h3 {
  margin: 0 0 12px; font-size: 19px; letter-spacing: -0.02em;
  color: var(--ink); font-weight: 700; text-wrap: balance;
}
.flow-card p { margin: 0; font-size: 15.5px; color: var(--muted); line-height: 1.65; }

@media (max-width: 760px) {
  .flow { grid-template-columns: 1fr; gap: 28px; }
  .flow-card { padding: 0; }
  .flow-card + .flow-card {
    padding: 28px 0 0; border-left: 0; border-top: 1px solid var(--hair);
  }
}

/* ---------- subscribe band ---------- */
.band {
  display: grid; grid-template-columns: 1fr auto; gap: 36px; align-items: center;
  padding: 42px; border-radius: var(--radius);
  background: var(--band-bg); border: 1px solid var(--band-border); color: var(--band-fg);
  clear: both;
}
.band h2 { margin: 0 0 8px; font-size: 27px; letter-spacing: -0.025em; color: var(--band-fg); font-weight: 700; }
.band p { margin: 0; font-size: 15px; color: var(--band-dim); }
.band .promise {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--band-fg) 18%, transparent);
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  letter-spacing: .02em; opacity: .82; max-width: 52ch;
}
.band form { display: flex; gap: 10px; flex-wrap: wrap; }
.band input {
  padding: 13px 18px; border-radius: var(--radius);
  border: 1px solid var(--band-input-b); background: var(--band-input);
  color: var(--band-fg); font-size: 14px; font-family: inherit; min-width: 230px;
}
.band input::placeholder { color: var(--band-dim); opacity: .7; }
.band .btn { background: var(--band-btn-bg); color: var(--band-btn-fg); }

/* ============================================================
   READING LAYOUT  (single.php)
   ============================================================ */
.reader {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, var(--col)) 1fr;
  column-gap: var(--gutter);
  padding: 56px 0 0;
  align-items: start;
}

.toc { position: sticky; top: 40px; grid-column: 1; }
.toc h2 {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--faint); font-weight: 500;
  margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--hair);
}
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; margin-bottom: 3px; }
.toc a {
  display: grid; grid-template-columns: 22px 1fr; gap: 6px;
  padding: 6px 0 6px 12px; font-size: 13.5px; line-height: 1.35;
  color: var(--muted); text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 140ms, border-color 140ms;
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--mono); font-size: 10.5px; color: var(--faint); padding-top: 2px;
}
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--purple); border-left-color: var(--purple); }
.toc a.active::before { color: var(--purple); }

.article { grid-column: 2; font-size: 18.5px; line-height: 1.75; }

.a-head { margin: 0 0 48px; }
.a-series {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--purple); text-decoration: none; padding: 5px 10px; border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--purple) 34%, transparent); margin-bottom: 22px;
}
.a-title {
  font-size: clamp(34px,4.6vw,50px); font-weight: 700; letter-spacing: -0.035em;
  line-height: 1.05; color: var(--ink); margin: 0 0 20px; text-wrap: balance;
}
.a-deck { font-size: 21px; line-height: 1.5; color: var(--muted); margin: 0 0 28px; font-weight: 400; }
.a-meta {
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center;
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--faint);
  padding-top: 20px; border-top: 1px solid var(--hair);
}
.a-meta .sep { color: var(--hair-strong); }

.entry-content h2 {
  font-size: 27px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.2;
  color: var(--ink); margin: 56px 0 16px; scroll-margin-top: 32px; text-wrap: balance;
}
.entry-content h3 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); margin: 36px 0 12px; }
.entry-content p { margin: 0 0 24px; }
.entry-content strong { color: var(--ink); font-weight: 600; }
.entry-content ul, .entry-content ol { margin: 0 0 24px; padding-left: 24px; }
.entry-content li { margin-bottom: 10px; }
.entry-content img { max-width: 100%; height: auto; border-radius: var(--radius); }
/* prose links only — component links all carry a class */
.entry-content a:not([class]) { color: var(--purple); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.entry-content > p.opener { font-size: 20px; line-height: 1.68; color: var(--ink); }

/* APA in-text citation */
.cite { color: var(--orange); text-decoration: none; white-space: nowrap; }
.cite:hover { text-decoration: underline; }

/* Peterson's drafting placeholder. Only ever visible in a review preview —
   the publish plan blocks a live page that still contains one. */
.refmark {
  background: color-mix(in srgb, var(--orange) 22%, transparent);
  color: var(--orange);
  font-family: var(--mono); font-size: 0.85em;
  padding: 1px 5px; border-radius: 2px;
  border: 1px dashed color-mix(in srgb, var(--orange) 55%, transparent);
}

/* key term + hover card */
.term {
  background: var(--mark); padding: 1px 4px; border-radius: 2px;
  color: var(--ink); font-weight: 500; text-decoration: none;
  border-bottom: 1px dotted var(--orange); position: relative;
}
.term:hover, .term:focus { background: color-mix(in srgb, var(--orange) 40%, transparent); }
.termcard {
  position: absolute; z-index: 40; max-width: 300px;
  background: var(--card); color: var(--body);
  border: 1px solid var(--hair-strong); border-radius: var(--radius);
  padding: 14px 16px; font-size: 14.5px; line-height: 1.5;
  box-shadow: 0 12px 40px rgba(20,10,40,.18);
  pointer-events: none; opacity: 0; transition: opacity 120ms ease;
}
.termcard.show { opacity: 1; }
.termcard b {
  display: block; font-family: var(--mono); font-size: 10px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--orange);
  font-weight: 500; margin-bottom: 6px;
}

/* sidenotes */
.sidenote {
  float: right; clear: right; width: var(--note);
  margin-right: calc(-1 * (var(--note) + var(--gutter)));
  margin-top: 6px; margin-bottom: 22px; margin-left: 0;
  font-size: 13.5px; line-height: 1.55; color: var(--muted);
  padding-left: 14px; border-left: 2px solid var(--hair-strong);
}
.sidenote b {
  display: block; font-family: var(--mono); font-size: 10px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--orange);
  font-weight: 500; margin-bottom: 5px;
}

/* callout */
.callout {
  background: var(--sunken); border: 1px solid var(--hair); border-radius: var(--radius);
  padding: 22px 24px; margin: 0 0 28px; font-size: 16.5px; line-height: 1.65; clear: both;
}
.callout h4 {
  margin: 0 0 8px; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--orange); font-weight: 500;
}
.callout p { margin: 0; color: var(--body); }
.callout p + p { margin-top: 12px; }

.entry-content blockquote {
  margin: 0 0 28px; padding: 4px 0 4px 24px; border-left: 2px solid var(--purple);
  font-size: 20px; line-height: 1.55; color: var(--ink);
}
.entry-content blockquote cite {
  display: block; margin-top: 12px; font-family: var(--mono); font-size: 11px;
  font-style: normal; letter-spacing: .08em; text-transform: uppercase; color: var(--faint);
}

.entry-content figure { margin: 36px 0 32px; clear: both; }
.entry-content figure svg, .entry-content figure img { display: block; width: 100%; height: auto; }
.entry-content figcaption {
  font-family: var(--mono); font-size: 11px; line-height: 1.6; letter-spacing: .04em;
  color: var(--faint); margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--hair);
}
.entry-content figcaption b { color: var(--orange); font-weight: 500; }

/* ---------- APA references ---------- */
/* NOT grid: <cite>/<a> are element children and would each become a grid item,
   fragmenting every entry across rows. Hanging indent instead. */
.refs { margin: 64px 0 0; padding-top: 28px; border-top: 1px solid var(--hair); clear: both; }
.refs h2 {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--faint); font-weight: 500; margin: 0 0 18px;
}
.refs ol, .refs ul { margin: 0; padding: 0; list-style: none; }
.refs li {
  font-size: 14.5px; line-height: 1.6; color: var(--muted);
  padding: 10px 0 10px 34px; text-indent: -34px;   /* APA hanging indent */
  border-bottom: 1px solid var(--hair); scroll-margin-top: 40px;
}
.refs li:target { background: var(--sunken); box-shadow: -12px 0 0 var(--sunken), 12px 0 0 var(--sunken); }
.refs cite { font-style: italic; color: var(--body); }

.tie {
  display: grid; grid-template-columns: auto 1fr; gap: 18px; clear: both;
  margin: 40px 0 0; padding: 24px;
  border: 1px dashed var(--hair-strong); border-radius: var(--radius); align-items: start;
}
.tie .badge {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--orange); border: 1px solid color-mix(in srgb, var(--orange) 40%, transparent);
  border-radius: var(--radius); padding: 5px 9px; white-space: nowrap;
}
.tie p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--muted); }
.tie strong { color: var(--ink); }

.next {
  display: block; margin: 40px 0 0; padding: 26px; clear: both;
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--radius);
  box-shadow: var(--card-shadow); text-decoration: none;
  transition: border-color 160ms, transform 160ms;
}
.next:hover { border-color: var(--hair-strong); transform: translateY(-2px); }
.next .lbl {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--faint); display: block; margin-bottom: 8px;
}
.next .ttl { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); display: block; margin-bottom: 6px; }
.next .dek { font-size: 14.5px; color: var(--muted); }

/* ---------- comments (the feedback system) ---------- */
.comments { margin: 72px 0 0; padding-top: 32px; border-top: 1px solid var(--hair); clear: both; }
.comments h2 { font-size: 24px; letter-spacing: -0.03em; color: var(--ink); margin: 0 0 12px; }
.comments .invite { font-size: 15px; color: var(--muted); margin: 0 0 28px; max-width: 60ch; }
.comments .invite > p:first-child { margin-top: 0; }
.comments .invite ul { margin: 12px 0 0; padding-left: 20px; }
.comments .invite li { margin-bottom: 6px; }
.commentlist { list-style: none; margin: 0 0 36px; padding: 0; }
.commentlist li { padding: 20px 0; border-bottom: 1px solid var(--hair); }
.commentlist .children { list-style: none; margin: 16px 0 0 24px; padding-left: 20px; border-left: 2px solid var(--hair); }
.comment-meta {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 8px;
}
.comment-meta .author { color: var(--purple); }
.comment-body p { font-size: 15.5px; line-height: 1.6; margin: 0 0 10px; }
/* The form's own title duplicates the section heading, so its text is empty.
   :empty will not match, because core keeps a hidden "Cancel reply" link inside
   it — so collapse the title itself and restore size on that link, which does
   need to be visible once you are replying to someone. */
#reply-title { font-size: 0; margin: 0; line-height: 0; }
#reply-title small { font-size: 14px; line-height: 1.6; }
#reply-title small a { color: var(--purple); }

.comment-form { max-width: 620px; }
.comment-form p { margin: 0 0 16px; }

/* inline-flex, because a flex container ignores the whitespace between its
   children — which is what was pushing the required marker away from the word.
   gap then sets the spacing exactly, instead of fighting a literal space. */
.comment-form label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--faint);
  display: inline-flex; align-items: baseline; gap: 2px;
  margin: 0 0 6px;
}
/* The asterisk sits inside the label, after a literal space that also picks up
   the label's .12em tracking — which is what made it look detached. Pull it back
   and drop the tracking on the marker itself. */
.comment-form label .required {
  color: var(--orange);
  margin: 0;
  letter-spacing: 0;
}
.comment-form .comment-notes,
.comment-form .comment-form-cookies-consent label {
  font-family: var(--sans); font-size: 14px; letter-spacing: 0;
  text-transform: none; color: var(--muted);
}
.comment-form .comment-notes { margin-bottom: 20px; }

.comment-form input[type=text], .comment-form input[type=email],
.comment-form textarea, .comment-form select {
  display: block; width: 100%;
  padding: 12px 14px; font-family: inherit; font-size: 15px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--hair-strong); border-radius: var(--radius);
}
.comment-form textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.comment-form select { cursor: pointer; }

/* checkbox and its text on one line, text aligned to the box */
.comment-form-cookies-consent {
  display: flex; align-items: flex-start; gap: 10px;
}
.comment-form-cookies-consent input[type=checkbox] {
  flex: 0 0 auto; width: auto; margin: 3px 0 0; accent-color: var(--purple);
}
.comment-form-cookies-consent label { margin: 0; line-height: 1.5; }

/* a real button, not a browser default */
.form-submit { margin: 24px 0 0; }
.comment-form input[type=submit],
.form-submit input[type=submit] {
  display: inline-flex; align-items: center;
  width: auto; padding: 14px 30px;
  font-family: inherit; font-size: 15px; font-weight: 600;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 0; border-radius: var(--radius); cursor: pointer;
  transition: filter 140ms ease, transform 140ms ease;
}
.comment-form input[type=submit]:hover,
.form-submit input[type=submit]:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* ---------- archive / series ---------- */
.arch-head { padding: 64px 0 40px; border-bottom: 1px solid var(--hair); margin-bottom: 40px; }
.arch-head .h1 { margin-bottom: 14px; }
.arch-head .subtitle { font-size: 19px; color: var(--ink); margin: 0 0 18px; max-width: 52ch; line-height: 1.45; }
.arch-head .title-ref { font-size: 14px; color: var(--muted); margin: -14px 0 0; max-width: 68ch; line-height: 1.55; }
.arch-head .title-ref span { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--orange); margin-right: 6px; }
.arch-list { display: grid; gap: 0; margin: 0 0 64px; }
.arch-item { padding: 24px 0; border-bottom: 1px solid var(--hair); display: grid; gap: 8px; }
.arch-item h2 { font-size: 23px; letter-spacing: -0.025em; margin: 0; }
.arch-item h2 a { color: var(--ink); text-decoration: none; }
.arch-item h2 a:hover { color: var(--purple); }
.arch-item p { margin: 0; font-size: 15.5px; color: var(--muted); max-width: 68ch; }

/* ---------- Atom & Element lists ---------- */
.gloss-jump {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 0 0 44px; padding-bottom: 20px; border-bottom: 1px solid var(--hair);
}
.gloss-jump a {
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
  color: var(--muted); text-decoration: none;
  padding: 6px 10px; border: 1px solid var(--hair); border-radius: var(--radius);
}
.gloss-jump a:hover { color: var(--ink); border-color: var(--hair-strong); }

.gloss-group { margin: 0 0 40px; }
.gloss-letter {
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em;
  color: var(--orange); font-weight: 500; margin: 0 0 14px;
  padding-bottom: 10px; border-bottom: 1px solid var(--hair);
  scroll-margin-top: 24px;
}
.gloss-list { margin: 0; }
.gloss-item {
  display: grid; grid-template-columns: minmax(180px, 240px) 1fr; gap: 24px;
  padding: 16px 0; border-bottom: 1px solid var(--hair);
}
.gloss-item dt { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.015em; }
.gloss-item dt a { color: var(--ink); text-decoration: none; }
.gloss-item dt a:hover { color: var(--purple); }
.gloss-item dd { margin: 0; font-size: 15px; line-height: 1.6; color: var(--muted); }

@media (max-width: 700px) {
  .gloss-item { grid-template-columns: 1fr; gap: 6px; }
}

/* ---------- backlinks on an Atom or Element ---------- */
.backlinks { margin: 56px 0 0; padding-top: 26px; border-top: 1px solid var(--hair); clear: both; }
.backlinks h2 {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--faint); font-weight: 500; margin: 0 0 14px;
}
.backlinks ul { margin: 0; padding: 0; list-style: none; }
.backlinks li { padding: 9px 0; border-bottom: 1px solid var(--hair); }
.backlinks a { color: var(--ink); text-decoration: none; font-size: 16px; }
.backlinks a:hover { color: var(--purple); }

/* ---------- footer ---------- */
.foot-wrap { border-top: 1px solid var(--hair); padding: 44px 0 60px; margin-top: 20px; clear: both; }
.foot-cols { display: grid; grid-template-columns: 1.6fr repeat(3,1fr); gap: 32px; }
.foot-cols h4 {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--faint); font-weight: 500; margin: 0 0 14px;
}
.foot-cols a { display: block; font-size: 14px; color: var(--muted); text-decoration: none; margin-bottom: 9px; }
.foot-cols a:hover { color: var(--ink); }
/* wp_nav_menu emits bare <li> once items_wrap drops the <ul>; they still
   render as list items and show markers. */
.foot-cols ul { list-style: none; margin: 0; padding: 0; }
.foot-cols li { list-style: none; display: block; margin: 0; }
.foot-cols li::marker { content: none; }
.foot-legal { margin-top: 34px; font-size: 13px; color: var(--faint); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .reader { grid-template-columns: minmax(0, var(--col)); justify-content: center; }
  .toc {
    grid-column: 1; position: static; margin: 0 0 40px; padding: 20px 22px;
    background: var(--sunken); border: 1px solid var(--hair); border-radius: var(--radius);
  }
  .article { grid-column: 1; }
  .sidenote {
    float: none; width: auto; margin: 24px 0; padding: 16px 18px;
    border-left: 2px solid var(--orange); background: var(--sunken);
  }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 40px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .band { grid-template-columns: 1fr; }
  .foot-cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .article { font-size: 17.5px; }
  .tie { grid-template-columns: 1fr; }
  .shell { padding: 0 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .site *, .site *::before, .site *::after {
    animation-duration: .001ms !important; transition-duration: .001ms !important;
  }
  .progress i { transition: none; }
}
