/* Direction D: Loud notebook. B's lab-notebook structure with C's colour, display type and hard shadows.
   Accessibility rules this file keeps:
   - Every text colour pair meets WCAG AA (4.5:1 body, 3:1 large). Coral is decoration only, never text.
   - Links are underlined, not signalled by colour alone.
   - A visible focus ring everywhere, recoloured on dark and lemon surfaces so it never disappears.
   - 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.
   - Layout reflows to 320px with no sideways scrolling; sizes are in rem so text zoom works. */
@import url("fonts.css");

:root {
  --paper: #fff8ec;
  --grid: rgba(34, 51, 255, 0.07);
  --ink: #121212;
  --muted: #4b4640;
  --link: #1f2fe6;
  --focus: #1f2fe6;
  --line: #121212;
  --shadow: #121212;
  --mark: #ffe14d;
  --surface: #ffffff;
  --rule: #d9d0c1;
  /* Fixed brand colours: the same in light and dark mode */
  --cobalt: #2233ff;
  --coral: #ff5b3a;
  --lemon: #ffe14d;
  --night: #121212;
  --cream: #fff8ec;
  --term-ink: #fff3b0;
  --term-dim: #a8a29a;
  --display: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  --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: #0f1115; --grid: rgba(150, 160, 255, 0.06); --ink: #f1efe9; --muted: #b3aea4;
    --link: #a9b2ff; --focus: #ffe14d; --line: #f1efe9; --shadow: #ff5b3a; --mark: #4d4412;
    --surface: #181b22; --rule: #2c3039;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  font: 400 clamp(1.03rem, 0.97rem + 0.3vw, 1.15rem)/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;
}
a { color: var(--link); text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--focus); 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(--lemon); color: var(--night); padding: .6rem 1rem; border: 2px solid var(--night); font-weight: 600; }

.page { max-width: 64rem; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }

/* Top bar and site footer: always dark, in both colour schemes */
.topbar, .site-foot { background: var(--night); color: var(--cream); --focus: var(--lemon); }
.topbar { position: sticky; top: 0; z-index: 3; border-bottom: 3px solid var(--coral); }
.topbar .page { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: .7rem; }
.wordmark { color: inherit; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 1.1rem; letter-spacing: -0.02em; line-height: 1.2; }
.wordmark:hover { text-decoration: underline; }
.wordmark .prompt { font-family: var(--mono); font-weight: 700; color: var(--lemon); margin-right: .15em; }
.cursor { display: inline-block; width: .5em; height: 1em; background: var(--lemon); vertical-align: -0.12em; margin-left: .2em; animation: blink 1.1s steps(1) 4; }
@keyframes blink { 50% { opacity: 0; } }
.topbar nav a { display: inline-block; color: inherit; font-family: var(--mono); font-size: .9rem; font-weight: 700; text-decoration: none; border: 2px solid currentColor; border-radius: 99px; padding: .2rem .85rem; min-height: 2rem; }
.topbar nav a:hover { background: var(--lemon); color: var(--night); border-color: var(--lemon); }
.site-foot { margin-top: 5rem; }
.site-foot .page { display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; padding-block: 1.75rem 2.5rem; font-family: var(--mono); font-size: .9rem; }
.site-foot a { color: var(--lemon); }

/* Post header band: cobalt with a white grid, the notebook page gone loud */
.band { position: relative; overflow: hidden; background-color: var(--cobalt); color: #fff;
  background-image: linear-gradient(rgba(255,255,255,.1) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.1) 1px, transparent 1px);
  background-size: 24px 24px; background-position: -1px -1px; }
.band .page { position: relative; z-index: 1; padding-block: clamp(2.5rem, 8vw, 5.5rem) clamp(2rem, 5vw, 3.5rem); }
.band .label { font-family: var(--mono); font-size: .85rem; margin: 0 0 1rem; color: var(--lemon); letter-spacing: .02em; }
.band h1 { font-family: var(--display); font-weight: 800; font-size: clamp(2.6rem, 1rem + 7vw, 6.5rem); line-height: .9; letter-spacing: -0.045em; margin: 0; max-width: 12ch; text-wrap: balance; }
.band .abstract { max-width: 36rem; font-size: 1.15em; line-height: 1.5; margin: 1.5rem 0 0; }
.band .blob { position: absolute; border-radius: 50%; pointer-events: none; }
.band .blob.one { width: 18rem; height: 18rem; right: -5rem; top: -6rem; background: var(--coral); }
.band .blob.two { width: 7rem; height: 7rem; right: 14rem; bottom: -2.5rem; background: var(--lemon); }
@media (max-width: 44rem) { .band .blob.one { width: 10rem; height: 10rem; right: -4rem; top: -4rem; } .band .blob.two { display: none; } }

/* Entry layout: sticky-note margin column plus body column */
.entry { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem 3rem; padding-block: clamp(2rem, 5vw, 3.5rem) 0; }
@media (min-width: 56rem) { .entry { grid-template-columns: 12rem minmax(0, 40rem); } }
.note { --focus: var(--night); background: var(--lemon); color: var(--night); border: 2px solid var(--night); border-radius: .75rem; box-shadow: 5px 5px 0 var(--shadow); padding: 1rem 1.1rem; font-family: var(--mono); font-size: .82rem; }
@media (min-width: 56rem) { .note { position: sticky; top: 5.5rem; align-self: start; } }
.note dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; }
@media (min-width: 56rem) { .note dl { grid-template-columns: 1fr; gap: .15rem; } .note dd + dt { margin-top: .6rem; } }
.note dt { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 700; }
.note dd { margin: 0; }
.note a { color: var(--night); text-decoration-thickness: 2px; }
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .1rem .6rem; }

/* Prose */
.prose :where(p) { margin: 0; }
.prose > * + * { margin-top: 1.1em; }
.prose strong { font-weight: 600; box-shadow: inset 0 -0.4em 0 var(--mark); }
.prose em { font-style: italic; }
.prose h2, .prose h3 { font-family: var(--display); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; text-wrap: balance; }
.prose h2 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); margin: 2.2em 0 0; }
.prose h3 { font-size: 1.4rem; margin: 1.8em 0 0; }
.prose h2::before { content: "## " / ""; font-family: var(--mono); font-size: .55em; font-weight: 700; color: var(--link); vertical-align: .25em; }
.prose h2 + *, .prose h3 + * { margin-top: .7em; }
.prose ul, .prose ol { padding: 0; }
.prose ul { list-style: none; }
.prose ul > li { position: relative; padding-left: 1.8rem; }
.prose ul > li::before { content: "->" / ""; position: absolute; left: 0; top: .1em; font-family: var(--mono); font-weight: 700; font-size: .85em; color: var(--link); }
.prose ol { padding-left: 1.6rem; }
.prose ol > li::marker { font-family: var(--mono); font-weight: 700; color: var(--link); }
.prose li + li { margin-top: .6em; }
.prose code { font-family: var(--mono); font-size: .86em; background: var(--surface); border: 1px solid var(--rule); padding: .05em .3em; border-radius: 4px; }
.prose pre { position: relative; font-family: var(--mono); font-size: .84rem; line-height: 1.65; background: var(--night); color: var(--term-ink); padding: 2.5rem 1.25rem 1.25rem; border: 2px solid var(--line); border-radius: .9rem; box-shadow: 7px 7px 0 var(--coral); overflow-x: auto; margin-top: 1.6em; }
.prose pre::before { content: attr(data-lang); position: absolute; top: .7rem; left: 1.25rem; font-size: .72rem; color: var(--term-dim); letter-spacing: .08em; text-transform: uppercase; }
.prose pre::after { content: "" / ""; position: absolute; top: .95rem; right: 1.1rem; width: .55rem; height: .55rem; border-radius: 50%; background: var(--lemon); box-shadow: -1rem 0 var(--coral), -2rem 0 var(--cobalt); }
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }
.prose pre:focus-visible { outline-offset: 4px; }
.prose blockquote { margin-left: 0; margin-right: 0; padding: .9rem 1.2rem; background: var(--surface); border: 2px solid var(--line); border-left-width: 8px; border-radius: .6rem; }
.prose img { max-width: 100%; height: auto; border: 2px solid var(--line); border-radius: .6rem; }
.prose hr { border: 0; border-top: 2px dashed var(--rule); margin-block: 2.5em; }
.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 { grid-column: -2 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; border-top: 2px dashed var(--rule); margin-top: 1.5rem; padding-top: 1rem; font-family: var(--mono); font-size: .88rem; color: var(--muted); }

/* Home */
.intro { padding-block: clamp(2.5rem, 8vw, 5rem) 1rem; }
.intro h1 { font-family: var(--display); font-weight: 800; font-size: clamp(2.3rem, 0.6rem + 8vw, 7rem); line-height: .9; letter-spacing: -0.045em; margin: 0; }
.intro h1 .second { display: block; color: var(--link); }
.todo { display: inline-block; margin: 1.75rem 0 0; background: var(--lemon); color: var(--night); border: 2px solid var(--night); border-radius: .6rem; box-shadow: 5px 5px 0 var(--shadow); padding: .5rem .9rem; font-weight: 600; }
.cmd { font-family: var(--mono); font-size: .88rem; color: var(--muted); margin: 3.5rem 0 .2rem; }
.cmd .dollar { color: var(--link); font-weight: 700; }
.home h2 { font-family: var(--display); font-weight: 800; font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); letter-spacing: -0.03em; line-height: 1.1; margin: 0 0 1.25rem; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }
.card { position: relative; display: flex; flex-direction: column; gap: .6rem; background: var(--cobalt); color: #fff; border: 3px solid var(--line); border-radius: 1.25rem; box-shadow: 7px 7px 0 var(--shadow); padding: 1.4rem 1.5rem 1.5rem; transition: transform .15s ease, box-shadow .15s ease; }
.card:hover { transform: translate(-3px, -3px); box-shadow: 10px 10px 0 var(--shadow); }
.card:focus-within { outline: 3px solid var(--focus); outline-offset: 4px; }
.card time { font-family: var(--mono); font-size: .85rem; color: var(--lemon); }
.card h3 { font-family: var(--display); font-weight: 800; font-size: 2rem; line-height: 1; letter-spacing: -0.03em; margin: 0; }
.card h3 a { color: #fff; text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card:hover h3 a { text-decoration: underline; text-decoration-thickness: 3px; }
.card h3 a:focus-visible { outline: none; }
.card p { margin: 0; line-height: 1.5; }
.card .tags { font-family: var(--mono); font-size: .8rem; margin-top: auto; padding-top: .4rem; }
.card .tags li { background: var(--lemon); color: var(--night); border-radius: 99px; padding: .05rem .6rem; }
.ls { list-style: none; padding: 0; margin: 0; border-top: 2px solid var(--line); }
.ls li { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: .2rem 1.25rem; padding: .9rem .25rem; border-bottom: 2px solid var(--line); }
@media (max-width: 36rem) { .ls li { grid-template-columns: 1fr; } }
.ls .venue { font-family: var(--mono); font-size: .85rem; color: var(--muted); padding-top: .2rem; }
.ls a { font-weight: 600; font-size: 1.15rem; }

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
  .card { transition: none; }
  .card:hover { transform: none; }
}
/* Windows high contrast: shadows vanish, so keep borders and let the system colour everything */
@media (forced-colors: active) {
  .card, .note, .todo, .prose pre { border: 2px solid CanvasText; }
  .band .blob, .prose pre::after { display: none; }
}
