/* Building Zenith — engineer's lab notebook, beautifully typeset.
   Newsreader (editorial serif) for prose; Martian Mono for datasheet marginalia.
   Warm paper + ink, signal-amber accent. Zero external requests by design. */

:root {
  --paper: #f7f3ea;
  --paper-raise: #fdfaf3;
  --ink: #211b13;
  --ink-soft: #6f6557;
  --line: #ddd4c3;
  --accent: #b85c08;
  --accent-bright: #e8890c;
  --grid: rgba(94, 78, 54, 0.055);
  --measure: 44rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161209;
    --paper-raise: #1e1910;
    --ink: #ece3d2;
    --ink-soft: #a2957f;
    --line: #332b1d;
    --accent: #eb9a3c;
    --accent-bright: #f0930f;
    --grid: rgba(240, 213, 160, 0.045);
  }
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.1875rem;
  line-height: 1.68;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- structure ---------- */

.masthead, main, .colophon {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 2.25rem 3.5rem;
}

.brand {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
}

.masthead nav { display: flex; gap: 1.4rem; }
.masthead nav a { color: var(--ink-soft); text-decoration: none; }
.masthead nav a:hover { color: var(--accent); }

main { min-height: 60vh; }

.colophon { padding-block: 4rem 3rem; }
.colophon .dim { opacity: 0.7; }
.colophon a { color: inherit; }

/* ---------- the LED ---------- */

.led {
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: var(--accent-bright);
  box-shadow: 0 0 0 0 rgba(232, 137, 12, 0.45);
  animation: watch 3.2s ease-out infinite;
  flex: none;
  transform: translateY(-0.05em);
}

@keyframes watch {
  0%   { box-shadow: 0 0 0 0 rgba(232, 137, 12, 0.45); }
  55%  { box-shadow: 0 0 0 0.55em rgba(232, 137, 12, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 137, 12, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .led { animation: none; }
  .index li { animation: none !important; opacity: 1 !important; }
}

/* ---------- type ---------- */

.mono-label {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-soft);
  line-height: 1.9;
}

h1, h2, h3 {
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-wrap: balance;
}

h1 { font-size: clamp(2.1rem, 5.5vw, 3.1rem); margin: 0.4em 0 0.5em; }
h2 { font-size: 1.55rem; margin: 2.2em 0 0.6em; }
h3 { font-size: 1.2rem;  margin: 1.8em 0 0.5em; }

p { margin: 0 0 1.25em; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: text-decoration-thickness 120ms ease;
}
a:hover { text-decoration-thickness: 2.5px; }

strong { font-weight: 600; }
em { font-style: italic; }

hr.rule, article hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.75rem 0;
}

blockquote {
  margin: 1.6em 0;
  padding-left: 1.1em;
  border-left: 2px solid var(--accent-bright);
  font-style: italic;
  color: var(--ink-soft);
}

ul, ol { padding-left: 1.4em; margin: 0 0 1.25em; }
li { margin-bottom: 0.45em; }

code {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.78em;
  background: var(--paper-raise);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.08em 0.35em;
}

pre {
  background: var(--paper-raise);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  margin: 0 0 1.4em;
}
pre code { border: 0; background: none; padding: 0; font-size: 0.74rem; line-height: 1.7; }

table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.6;
  margin: 0 0 1.6em;
}
th {
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--ink-soft);
  padding: 0.5em 0.9em 0.5em 0;
}
td { border-bottom: 1px solid var(--line); padding: 0.55em 0.9em 0.55em 0; vertical-align: top; }

img { max-width: 100%; height: auto; border: 1px solid var(--line); }

/* ---------- index ---------- */

.manifesto { margin-bottom: 3.5rem; }
.manifesto h1 { margin-top: 0; }
.manifesto .standfirst {
  font-size: 1.32rem;
  line-height: 1.5;
  color: var(--ink);
  font-style: italic;
  margin-bottom: 1.2em;
}

.index { list-style: none; padding: 0; margin: 0; }

.index li {
  border-top: 1px solid var(--line);
  padding: 1.35rem 0 1.5rem;
  opacity: 0;
  animation: rise 500ms ease-out forwards;
}
.index li:nth-child(1) { animation-delay: 60ms; }
.index li:nth-child(2) { animation-delay: 140ms; }
.index li:nth-child(3) { animation-delay: 220ms; }
.index li:nth-child(4) { animation-delay: 300ms; }
.index li:nth-child(n+5) { animation-delay: 380ms; }

@keyframes rise {
  from { opacity: 0; transform: translateY(0.5rem); }
  to   { opacity: 1; transform: none; }
}

.index .meta { margin: 0 0 0.3rem; display: flex; gap: 0.8em; }
.index .num { color: var(--accent); font-weight: 600; }

.index h2 { margin: 0 0 0.35rem; font-size: 1.45rem; }
.index h2 a { color: var(--ink); text-decoration: none; }
.index h2 a:hover { color: var(--accent); }

.index .summary { color: var(--ink-soft); margin: 0; font-size: 1.05rem; }

/* ---------- post ---------- */

.post-head { margin-bottom: 2.6rem; }
.post-head .meta { display: flex; gap: 0.8em; margin: 0; }
.post-head .num { color: var(--accent); font-weight: 600; }
.post-head .standfirst {
  font-size: 1.28rem;
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.5;
}

.post-foot { margin-top: 3.5rem; }

/* Wide screens: marginalia rail for the post metadata */
@media (min-width: 72rem) {
  .post { position: relative; }
  .post-head .meta {
    position: absolute;
    left: -11.5rem;
    top: 0.9rem;
    width: 10rem;
    display: block;
  }
  .post-head .meta span, .post-head .meta time { display: block; }
  .post-head .meta .num { margin-bottom: 0.2rem; }
}
