/* Martin Monzon — site styles */

:root {
  --paper: #eef1ec;
  --ink: #18201d;
  --muted: #56615b;
  --rule: #c5ccc6;
  --signal: #9a6413;      /* alert amber, darkened for text contrast */
  --signal-soft: #e4c58f;
  --link: #1f5c57;
  --node: #f7f9f6;
  --measure: 44rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.5rem;
  --step-3: clamp(1.6rem, 1.1rem + 2.2vw, 2.5rem);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131916;
    --ink: #e2e8e4;
    --muted: #9aa59f;
    --rule: #2f3934;
    --signal: #e3a646;
    --signal-soft: #5a4320;
    --link: #86c7be;
    --node: #1a221e;
  }
}
:root[data-theme="dark"] {
  --paper: #131916;
  --ink: #e2e8e4;
  --muted: #9aa59f;
  --rule: #2f3934;
  --signal: #e3a646;
  --signal-soft: #5a4320;
  --link: #86c7be;
  --node: #1a221e;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--step-0);
  line-height: 1.6;
  padding: 0 16px;
}

main, header.site, footer.site {
  max-width: var(--measure);
  margin: 0 auto;
}

a { color: var(--link); text-decoration-color: var(--signal-soft); text-underline-offset: 0.18em; text-decoration-thickness: 0.09em; }
a:hover { text-decoration-color: var(--signal); }
a:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 6px 10px; }
.skip:focus { left: 16px; }

h1, h2, h3 { line-height: 1.2; font-weight: 700; margin: 0; }
p, ul { margin: 0 0 1em; }

/* Home */

.home-page { padding: clamp(48px, 10vw, 112px) 0 24px; }

.intro h1 {
  font-size: var(--step-1);
  letter-spacing: 0.005em;
  margin-bottom: 1.25rem;
}

.intro .claim {
  font-size: var(--step-3);
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: -0.012em;
  max-width: 24ch;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}

.intro .where { color: var(--muted); max-width: 46ch; }

.home-page section {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding-top: 1.25rem;
  display: grid;
  grid-template-columns: 9rem 1fr;
  column-gap: 1.5rem;
}
.home-page section > h2 {
  font-size: var(--step-0);
  color: var(--muted);
  font-weight: 400;
  padding-top: 0.15rem;
}
.home-page section > :not(h2) { grid-column: 2; }

.entry { margin-bottom: 1.75rem; }
.entry:last-child { margin-bottom: 0; }
.entry h3 { font-size: var(--step-1); margin-bottom: 0.35rem; }
.entry .meta { color: var(--muted); margin-bottom: 0.4rem; }
.entry p:last-child { margin-bottom: 0; }

.links { list-style: none; padding: 0; margin: 0; display: flex; gap: 1.5rem; flex-wrap: wrap; }

@media (max-width: 640px) {
  .home-page section { display: block; }
  .home-page section > h2 { margin-bottom: 0.75rem; }
}

/* Article */

header.site { padding: 28px 0 0; }
header.site .home { font-weight: 700; color: var(--ink); text-decoration: none; }
header.site .home:hover { text-decoration: underline; text-decoration-color: var(--signal); }

.article { padding: clamp(40px, 8vw, 88px) 0 24px; }
.article h1 {
  font-size: var(--step-3);
  letter-spacing: -0.012em;
  margin-bottom: 1rem;
  text-wrap: balance;
}
.article .standfirst { font-size: var(--step-1); color: var(--muted); line-height: 1.5; margin-bottom: 2.5rem; }
.article h2 { font-size: var(--step-2); margin: 2.5rem 0 0.75rem; }
.article ul { padding-left: 1.25rem; }
.article li { margin-bottom: 0.6em; }
.article li::marker { color: var(--signal); }
.article .back { margin-top: 3rem; }

/* Diagram */

figure.loop, figure.lab { margin: 2.5rem 0; }
figure.loop svg { width: 100%; height: auto; display: block; }
/* LaTeX figures have fixed light colors, so they sit on white in both themes */
figure.lab img { display: block; width: 100%; height: auto; background: #fff; border: 1px solid var(--rule); border-radius: 6px; padding: 12px; }
figure.loop figcaption, figure.lab figcaption { color: var(--muted); font-size: 0.95rem; margin-top: 0.75rem; }

.node rect { fill: var(--node); stroke: var(--ink); stroke-width: 1.25; }
.node.signal rect { stroke: var(--signal); stroke-width: 2; }
.node text { fill: var(--ink); font: 700 17px "Atkinson Hyperlegible", system-ui, sans-serif; text-anchor: middle; }
.edge { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.edge.signal { stroke: var(--signal); stroke-width: 2.25; }
.edge.missing { stroke: var(--muted); stroke-dasharray: 4 6; }
.arrowhead { fill: var(--ink); }
.arrowhead.signal { fill: var(--signal); }
.note { fill: var(--muted); font: 400 15px "Atkinson Hyperlegible", system-ui, sans-serif; text-anchor: middle; }
/* Footer */

footer.site { border-top: 1px solid var(--rule); margin-top: 3rem; padding: 1.25rem 0 2.5rem; color: var(--muted); font-size: 0.95rem; }
footer.site p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
