/* Colbert Digital. Palette A is the only source of colour; JetBrains Mono for the site name, headings, navigation and code,
   the system sans stack for body text. No fixed or sticky positioning, no clipping on main, motion only under .motion-on. */

@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0F172A;
  --text: #F1F5F9;
  --muted: #A8B3C7;
  --accent: #FBBF24;
  --surface: #1E293B;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-synthesis: none;
}

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* skip link: off-screen until it has focus */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 1;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--accent);
  font-family: var(--mono);
  font-size: 0.95rem;
}
.skip-link:focus { top: 1rem; }

/* header, navigation, footer share one left edge and one width */
.site-header, .site-footer { max-width: 46rem; margin: 0 auto; padding: 1.5rem 1rem; }

/* logo left and pause button right on one row (the script adds the button last, so order puts it second); the nav takes the row below */
.site-header { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 2rem; }
.brand { display: block; order: 1; }
.site-header nav { order: 3; flex-basis: 100%; }
.lockup { display: block; width: 11rem; height: auto; }

/* Home logo reveal (release 4, part A). CSS only, no JavaScript: the stencil fades in, the solid logo is revealed in 12 layers from the bottom
   with a thin nozzle line, then the overlay fades out. Declared only inside the no-preference query and only for body.home, so every other page, reduced
   motion, print and forced colours show the finished logo. The default state is the finished logo: the overlay is hidden and the lockup is not clipped;
   only the keyframes start from "stencil only", and the fill mode is `backwards`, so nothing can hold on the stencil. The pause button (html.motion-paused)
   ends the reveal at once (`animation: none`, never `paused`, which would freeze a half-printed logo). Only opacity, clip-path and transform move. */
.brand { position: relative; }
.logo-overlay { display: none; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; }
.logo-overlay .stencil { stroke-width: 4.8px; opacity: 0.3; }
.logo-overlay .nozzle { opacity: 0; }
@media (min-width: 40em) { .logo-overlay .stencil { stroke-width: 4.1px; } }
@media (prefers-reduced-motion: no-preference) {
  body.home .logo-overlay { display: block; animation: logo-overlay 3s linear backwards; }
  body.home .lockup { animation: logo-print 3s steps(12, end) backwards; }
  body.home .logo-overlay .nozzle { animation: logo-nozzle-rise 3s steps(12, end) backwards, logo-nozzle-fade 3s linear backwards; }
  body.home .logo-overlay .nozzle-head { animation: logo-head 0.525s ease-in-out 0.4s 4 alternate backwards; }
  html.motion-paused body.home .lockup, html.motion-paused body.home .logo-overlay,
  html.motion-paused body.home .logo-overlay .nozzle, html.motion-paused body.home .logo-overlay .nozzle-head { animation: none; }
}
@keyframes logo-overlay { 0% { opacity: 0; } 13.33% { opacity: 1; } 83.33% { opacity: 1; } 100% { opacity: 0; } }
@keyframes logo-print { 0%, 13.33% { clip-path: inset(100% 0 0 0); } 83.33%, 100% { clip-path: inset(0 0 0 0); } }
@keyframes logo-nozzle-rise { 0%, 13.33% { transform: translateY(250px); } 83.33%, 100% { transform: translateY(-10px); } }
@keyframes logo-nozzle-fade { 0% { opacity: 0; } 13.33% { opacity: 1; } 83.33% { opacity: 1; } 100% { opacity: 0; } }
@keyframes logo-head { from { transform: translateX(0); } to { transform: translateX(830px); } }
@media (forced-colors: active) { body.home .logo-overlay { display: none; } body.home .lockup { animation: none; } }
@media print { body.home .logo-overlay { display: none; } body.home .lockup { animation: none; } }

nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 0; padding: 0; list-style: none; }
nav a {
  display: inline-block;
  min-height: 1.75rem;
  padding: 0.25rem 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 400;
  text-decoration: none;
}
nav a:hover, nav a[aria-current] {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 0.1em;
  text-underline-offset: 0.35em;
}
nav a[aria-current] { text-decoration-thickness: 0.18em; }

button {
  min-width: 2rem;
  min-height: 2rem;
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 0;
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 400;
  cursor: pointer;
}
button:hover { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 0.25em; }
.site-header button { order: 2; margin-left: auto; }

/* main and the rail: a thin line at the left with a square at each h2 */
main { position: relative; max-width: 46rem; margin: 0 auto; padding: 1.5rem 1rem 3rem 3rem; }
main > * { max-width: 68ch; }
main::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 1.5rem;
  width: 1px;
  background: var(--muted);
  opacity: 0.35;
}

h1, h2, h3 { margin: 2rem 0 0.75rem; font-family: var(--mono); font-weight: 400; line-height: 1.2; }
h1 { margin-top: 0; font-size: 2rem; letter-spacing: -0.01em; }
h2 { position: relative; font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h2::before {
  content: "";
  position: absolute;
  top: 0.4em;
  left: -1.75rem;
  width: 0.5rem;
  height: 0.5rem;
  background: var(--accent);
}

p, ul, ol { margin: 0 0 1rem; }
li { margin: 0.25rem 0; }

main a, .site-footer a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}
main a:hover, .site-footer a:hover { text-decoration-thickness: 0.18em; }

code, pre { font-family: var(--mono); font-size: 0.9em; }
pre { margin: 0 0 1rem; padding: 1rem; overflow-x: auto; background: var(--surface); }
:not(pre) > code { padding: 0.1em 0.3em; background: var(--surface); }
blockquote { margin: 1.5rem 0; padding-left: 1rem; border-left: 2px solid var(--muted); color: var(--muted); }
table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 0 0 1rem; }
th, td { padding: 0.4rem 0.6rem; border: 1px solid var(--surface); text-align: left; }
hr { margin: 2rem 0; border: 0; border-top: 1px solid var(--surface); }
img { max-width: 100%; height: auto; }

/* Notices page: the legend, one table per product and the closing notes. Plain tables, no scrolling box, so the page reflows at 320 px;
   a badge is its text, and only the border style differs between licences, so colour is never the signal. */
.subtitle { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; margin: 0 0 2rem; padding: 0; list-style: none; }
.legend li { margin: 0; }
.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--muted);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.badge.lgpl { border-style: dashed; }
.badge.apache { border-style: dotted; border-width: 2px; }
.badge.bsd { border-style: double; border-width: 3px; }
.badge.isc { border-style: groove; border-width: 3px; }
.product-section { margin: 0 0 2.5rem; }
.product-section .product-name { margin-top: 2rem; }
.product-desc { color: var(--muted); }
.product-section table { display: table; width: 100%; overflow: visible; }
.product-section th { background: var(--surface); font-family: var(--mono); font-size: 0.875rem; font-weight: 400; }
.product-section th, .product-section td { overflow-wrap: anywhere; vertical-align: top; }
.lib-name { font-family: var(--mono); font-size: 0.95rem; }
.lib-desc { color: var(--muted); font-size: 0.9rem; }
.copyright { font-size: 0.9rem; }
.notices-footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--surface); }
.notices-footer p { color: var(--muted); font-size: 0.9rem; }

/* Projects page: two screenshots in an untidy pile. Straight and stacked by default (narrow screens, 200% zoom); tilt, offset and overlap only
   from 48em. Nothing moves and nothing reacts to hover: the images are not links. The first caption keeps clear of the overlap. */
.pile { max-width: 100%; margin: 2rem 0; padding: 1rem; }
.pile figure { margin: 0 0 2rem; }
.pile img {
  display: block;
  width: 100%;
  height: auto;
  padding: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--muted);
  box-shadow: 0 0.5rem 1.25rem rgb(0 0 0 / 0.45);
}
.pile figcaption { margin-top: 0.5rem; color: var(--muted); font-size: 0.875rem; }

@media (min-width: 48em) {
  .pile { display: grid; grid-template-columns: repeat(12, 1fr); }
  .pile figure { margin: 0; }
  .pile figure:first-child { grid-column: 1 / 8; grid-row: 1; transform: rotate(-1.5deg); }
  .pile figure:first-child figcaption { padding-inline-end: 17%; }
  .pile figure:last-child { grid-column: 7 / 13; grid-row: 1; margin-top: 2.5rem; transform: rotate(1.2deg); }
}

@media (forced-colors: active) {
  .pile img { border: 2px solid CanvasText; box-shadow: none; }
}

/* Illustrations (release 5): one decorative inline SVG on Home (a full-width banner under the intro) and one on About (14 rem, floated right from 48em,
   in normal flow below it). No motion at all and no hover or focus effect; strokes keep their on-screen width (vector-effect in the SVG). Forced colours:
   outlined in system colours, never hidden. Print: hidden. */
.illustration-box { margin: 1.5rem 0; }
.illustration { display: block; width: 100%; height: auto; }
.illustration-box.side { width: 14rem; max-width: 100%; }
@media (min-width: 48em) {
  .illustration-box.side { float: right; margin: 0.25rem 0 1rem 1.5rem; }
  main h2 { clear: both; }
}
@media (forced-colors: active) {
  .illustration * { fill: none; stroke: CanvasText; }
  .illustration [fill="#FBBF24"] { fill: Highlight; stroke: none; }
}
@media print { .illustration-box { display: none; } }

.site-footer { border-top: 2px solid var(--surface); font-size: 0.875rem; }
.site-footer p { margin: 0 0 0.5rem; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 0 0 0.75rem; padding: 0; list-style: none; }
.footer-links a { display: inline-block; min-height: 1.5rem; padding: 0.25rem 0; }

@media (max-width: 39.99em) {
  .product-section th, .product-section td { padding: 0.35rem 0.4rem; }
  .product-section th, .copyright, .lib-desc { font-size: 0.8125rem; }
  nav ul { gap: 0 1rem; }
  nav a { min-height: 1.5rem; padding: 0.125rem 0; line-height: 1.4; }
}

@media (min-width: 40em) {
  h1 { font-size: 2.75rem; }
  .lockup { width: 13rem; }
}

/* the one animation: a square drifts down the rail and back. It needs .motion-on (set by site.js) and no reduced-motion preference.
   The moving box is half the height of main and slides from just above it to the bottom, so it never leaves main. */
@media (prefers-reduced-motion: no-preference) {
  .motion-on main::after {
    content: "";
    position: absolute;
    top: 0;
    left: 1.25rem;
    width: 0.5rem;
    height: 50%;
    background: linear-gradient(var(--accent), var(--accent)) left bottom / 0.5rem 0.5rem no-repeat;
    pointer-events: none;
    animation: drift 28s ease-in-out infinite alternate;
  }
  .motion-on.motion-paused main::after { animation-play-state: paused; }
}

@keyframes drift {
  from { transform: translateY(-100%); }
  to { transform: translateY(100%); }
}

/* Cross-page transitions (release 4, part B): a supporting browser (Chrome and Edge 126+, Safari 18.2+) crossfades between two pages of this site in
   0.2 s; Firefox and any browser that does not know the rule load pages instantly as before. CSS only, no JavaScript, no request. Only inside the
   no-preference query, so reduced motion gets instant loads. No element is named (no view-transition-name): the whole page crossfades, so nothing in the
   header (the pause button and the current-page marker are added by site.js after load) can flicker or morph. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-group(root), ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.2s; }
}
