/* Direction B: Engineering notebook. Graph paper, monospace accents, lab-notebook entries.
   Mobile first: base styles are for a phone; min-width queries add room as the screen grows.
   Accessibility rules this file keeps:
   - Every text colour pair meets WCAG AA (4.5:1) in light and dark mode.
   - Links are underlined, not signalled by colour alone.
   - A visible focus ring on every interactive element; sticky header never covers the focused element.
   - Motion is short and off under prefers-reduced-motion. The cursor blinks four times, then stops.
   - Decorative glyphs (##, ->, [ ], ~/) are hidden from screen readers with CSS alt text or aria-hidden.
   - Tap targets are at least 24px; sizes are in rem so text zoom works; reflows to 320px. */
@import url("fonts.css");

:root {
  --paper: #fbfbf7;
  --grid: rgba(20, 40, 30, 0.055);
  --ink: #1d2320;
  --muted: #56605a;
  --accent: #056b4a;
  --mark: #fff0a0;
  --rule: #d5dbd6;
  --term-bg: #121815;
  --term-ink: #d8e4dc;
  --term-dim: #8a9d93;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1412; --grid: rgba(160, 220, 190, 0.05); --ink: #e1e8e3; --muted: #9aa8a0;
    --accent: #52d6a3; --mark: #3b3a16; --rule: #2c3833; --term-bg: #070a09;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); -webkit-text-size-adjust: 100%; scroll-padding-top: 4.5rem; }
body {
  margin: 0;
  font: 400 1.0625rem/1.65 var(--sans);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
}
@media (min-width: 40rem) { body { font-size: 1.125rem; } }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.nowrap { white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 9; background: var(--paper); color: var(--ink); padding: .6rem 1rem; border: 2px solid var(--accent); }

.page { max-width: 58rem; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 40rem) { .page { padding: 0 1.5rem; } }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 2; border-bottom: 1px solid var(--rule); background: var(--paper); }
@supports (backdrop-filter: blur(4px)) { .topbar { background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(4px); } }
.topbar .page { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: .5rem; font-family: var(--mono); font-size: .9rem; }
.topbar a { display: inline-block; padding-block: .35rem; }
.wordmark { color: var(--ink); text-decoration: none; font-weight: 600; }
.wordmark:hover { text-decoration: underline; }
.wordmark .prompt { color: var(--accent); }
.cursor { display: inline-block; width: .55em; height: 1.05em; background: var(--accent); vertical-align: -0.15em; margin-left: .15em; animation: blink 1.1s steps(1) 4; }
@keyframes blink { 50% { opacity: 0; } }
.topbar nav { display: flex; gap: 1rem; }
.topbar nav a::before { content: "[" / ""; color: var(--muted); }
.topbar nav a::after { content: "]" / ""; color: var(--muted); }

/* Entry. Source order is header, details, body, footer: phones read it top to bottom;
   wide screens lift the details into a sticky margin column. */
.entry { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 2.5rem; padding-block: 2rem 1rem; }
.margin { font-family: var(--mono); font-size: .85rem; color: var(--muted); margin-top: 1.25rem; padding-block: .6rem; border-block: 1px dashed var(--rule); }
.margin dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; }
.margin dt { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; padding-top: .1em; }
.margin dd { margin: 0; color: var(--ink); }
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0 .6rem; }
.entry .prose { margin-top: 2rem; }
@media (min-width: 52rem) {
  .entry { grid-template-columns: 11rem minmax(0, 38rem); padding-block: 3rem 2rem; }
  .entry > * { grid-column: 2; }
  .entry > .margin { grid-column: 1; grid-row: 1 / span 3; align-self: start; position: sticky; top: 5rem; margin-top: .4rem; padding: 0; border: 0; text-align: right; }
  .margin dl { grid-template-columns: 1fr; gap: .15rem; }
  .margin dd + dt { margin-top: .6rem; }
  .margin .tags { justify-content: flex-end; }
}

.entry-head .label { font-family: var(--mono); font-size: .85rem; color: var(--accent); margin: 0 0 .6rem; letter-spacing: .02em; overflow-wrap: anywhere; }
.entry-head h1 { font-weight: 600; font-size: 2rem; line-height: 1.1; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
@media (min-width: 40rem) { .entry-head h1 { font-size: 2.6rem; } }
@media (min-width: 64rem) { .entry-head h1 { font-size: 3rem; } }
.entry-head .abstract { margin: 1rem 0 0; color: var(--muted); border-left: 3px solid var(--accent); padding: .2rem 0 .2rem 1rem; }

/* Prose */
.prose :where(p) { margin: 0; }
.prose > * + * { margin-top: 1em; }
.prose h2, .prose h3 { font-family: var(--mono); font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; }
.prose h2 { font-size: 1.15rem; margin: 2.4em 0 0; }
.prose h3 { font-size: 1rem; margin: 2em 0 0; }
.prose h2::before { content: "## " / ""; color: var(--accent); }
.prose h3::before { content: "### " / ""; color: var(--accent); }
.prose h2 + *, .prose h3 + * { margin-top: .6em; }
.prose strong { font-weight: 600; background: linear-gradient(transparent 58%, var(--mark) 58%); }
.prose ul, .prose ol { padding: 0; }
.prose ul { list-style: none; }
.prose ul > li { position: relative; padding-left: 1.6rem; }
.prose ul > li::before { content: "->" / ""; position: absolute; left: 0; top: .1em; font-family: var(--mono); font-size: .85em; color: var(--accent); }
.prose ol { padding-left: 1.6rem; }
.prose ol > li::marker { font-family: var(--mono); color: var(--accent); }
.prose li + li { margin-top: .7em; }
.prose code { font-family: var(--mono); font-size: .86em; border: 1px solid var(--rule); background: var(--paper); padding: .05em .3em; border-radius: 3px; }
.prose pre { position: relative; font-family: var(--mono); font-size: .82rem; line-height: 1.65; background: var(--term-bg); color: var(--term-ink); padding: 2.4rem 1rem 1rem; margin-inline: -1rem; border-radius: 0; overflow-x: auto; margin-top: 1.4em; }
@media (min-width: 40rem) { .prose pre { margin-inline: 0; padding-inline: 1.2rem; border-radius: 6px; } }
.prose pre::before { content: attr(data-lang); position: absolute; top: .6rem; left: 1rem; font-size: .75rem; color: var(--term-dim); letter-spacing: .08em; text-transform: uppercase; }
@media (min-width: 40rem) { .prose pre::before { left: 1.2rem; } }
.prose pre::after { content: "" / ""; position: absolute; top: .85rem; right: 1rem; width: .5rem; height: .5rem; border-radius: 50%; background: #3fb07c; box-shadow: -.9rem 0 #d9a53d, -1.8rem 0 #d8584a; }
.prose pre code { border: 0; background: none; padding: 0; font-size: inherit; color: inherit; }
.prose pre:focus-visible { outline-offset: 2px; }
.prose blockquote { margin: 1.4em 0 0; padding-left: 1rem; border-left: 3px solid var(--rule); color: var(--muted); }
.prose img { max-width: 100%; height: auto; border: 1px solid var(--rule); }
.prose hr { border: 0; border-top: 1px dashed var(--rule); margin-block: 2.4em; }
.prose .table { overflow-x: auto; }
.prose table { border-collapse: collapse; width: 100%; font-size: .92em; }
.prose th, .prose td { border: 1px solid var(--rule); padding: .4rem .6rem; text-align: left; vertical-align: top; }
.prose th { font-family: var(--mono); font-size: .85em; }

.entry-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; border-top: 1px dashed var(--rule); margin-top: 3rem; padding-top: 1rem; font-family: var(--mono); font-size: .85rem; color: var(--muted); }

/* Home */
.home { padding-block: 2rem 1rem; }
@media (min-width: 40rem) { .home { padding-block: 3rem 1rem; } }
.home h1 { font-size: 2rem; font-weight: 600; line-height: 1.05; letter-spacing: -0.025em; margin: 0; }
@media (min-width: 40rem) { .home h1 { font-size: 3.2rem; } }
.todo { border: 1px dashed var(--accent); padding: .3rem .6rem; display: inline-block; }
.cmd { font-family: var(--mono); font-size: .9rem; color: var(--muted); margin: 3rem 0 .1rem; }
.cmd .dollar { color: var(--accent); }
.home h2 { font-size: 1.3rem; font-weight: 600; margin: 0 0 .75rem; }
.ls { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.ls > li { display: grid; grid-template-columns: minmax(0, 1fr); gap: .2rem 1.25rem; padding: 1rem 0; border-bottom: 1px solid var(--rule); }
@media (min-width: 36rem) { .ls > li { grid-template-columns: 7.5rem minmax(0, 1fr); } }
.ls time, .ls .venue { font-family: var(--mono); font-size: .85rem; color: var(--muted); padding-top: .15rem; }
.ls h3 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.ls h3 a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule); }
.ls h3 a:hover { color: var(--accent); text-decoration-color: currentColor; }
.ls p { margin: .25rem 0 0; color: var(--muted); }
.ls > li > a { font-weight: 600; }
.ls .tags { font-family: var(--mono); font-size: .8rem; color: var(--accent); margin-top: .35rem; }

.site-foot { border-top: 1px solid var(--rule); margin-top: 4rem; }
.site-foot .page { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; padding-block: 1rem 2.5rem; font-family: var(--mono); font-size: .9rem; }
.site-foot a { display: inline-block; padding-block: .35rem; }

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
  html { scroll-behavior: auto; }
}
@media (forced-colors: active) {
  .cursor, .prose pre::after { display: none; }
  .prose strong { background: none; }
}
