/* The Matte page: what the work page and the Experiments page share. Load after styles.css and matte.css.
   The signal colour, the page column, the nav as a rail of Matte keys, the off-black speckled ground,
   and the footer on its field of Slate. Each page adds its own content styles on top. */
:root { --signal: #e08a3c; }                              /* Matte's copper: status and Result, nothing else */
:root[data-theme="light"] { --signal: #8b5625; }           /* the same copper, darkened to read on paper */


.home, .foot-col { max-width: 76rem; margin: 0 auto; padding: 0 max(var(--space-4), 4vw); }
/* The site's grid: twelve columns across the page column, on every page. Whatever a page lays out side by side (a record's
   words and picture, the record's fields, the footer, the cards, a page's reading column) starts and ends on these
   columns, with this one gutter between them. Shift+G, or ?grid in the address, shows them (nav.js). */
:root { --grid-gutter: var(--space-4); }
@media (min-width: 761px) { :root { --grid-gutter: var(--space-5); } }
@media (min-width: 1100px) { :root { --grid-gutter: var(--space-6); } }
.grid-overlay { position: fixed; top: 0; bottom: 0; z-index: 9999; pointer-events: none; display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--grid-gutter); }
.grid-overlay span { background: rgb(224 138 60 / 0.08); box-shadow: inset 1px 0 rgb(224 138 60 / 0.4), inset -1px 0 rgb(224 138 60 / 0.4); }
/* A page of reading (Bio, How I Work): the heading across the grid, the text on the first columns, as many as keep its
   lines a comfortable length at the window's width */
.page { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--grid-gutter); align-content: start; }
.page > * { grid-column: 1 / -1; }
.page > .page__body { grid-column: 1 / span 8; max-width: none; }
@media (max-width: 760px) { .page > .page__body { grid-column: 1 / -1; } }
@media (min-width: 1300px) { .page > .page__body { grid-column: 1 / span 7; } }
@media (min-width: 1600px) { .page > .page__body { grid-column: 1 / span 6; } }
@media (min-width: 1800px) { .page > .page__body { grid-column: 1 / span 5; } }
@media (min-width: 2200px) { .page > .page__body { grid-column: 1 / span 4; } }
.home { position: relative; z-index: 1; }   /* above the halftone's canvas, which reaches up behind the last project */
.home a, .foot-col a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.mono { font: 400 var(--text-2xs)/1.5 "Söhne Mono", ui-monospace, Menlo, monospace; color: var(--muted); }


/* Going from one of these pages to another, the browser carries the nav across as its own layer and cross-fades the rest
   under it, so the nav holds still (a cross-document view transition; a browser without them loads the page as before).
   The rail starts at the same height on every page for the same reason. */
@view-transition { navigation: auto; }
.nav { view-transition-name: site-nav; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 220ms; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* Wide screens: the nav is a rail down the left of the page, the full height of the window, its buttons stacked and
   all one width (--rail-w). Controls sits at the foot of it. The page column starts just past the rail's hairline,
   however wide the window, and runs to --space-5 from its right edge. */
@media (min-width: 1100px) {
  :root { --rail-w: 156px; }
  .nav { position: fixed; inset: 0 auto 0 0; height: auto; flex-direction: column; justify-content: flex-start; align-items: flex-start;
    gap: var(--chip-gap); padding: var(--rail-top, var(--space-6)) 0 var(--space-6) var(--space-5);   /* first button level with the top of the board */ background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .nav__start, .nav__links { flex-direction: column; align-items: stretch; align-self: auto; width: var(--rail-w); }
  .nav__links { flex: 1; }
  .nav .chip { width: 100%; justify-content: flex-start; }
  /* LinkedIn and brian.md have no lamp (they leave the site or download), but keep the lamp's room empty, so every
     label in the rail starts on one line. brian.md's icon comes after its label, so it keeps the icon's room too. */
  .nav a.chip:is([target], [download])::before { content: ""; flex: none; width: 5px; margin-right: 2px; }
  .nav a.chip[download] { padding-left: calc(var(--chip-px) + var(--chip-fs) + 1px + 6px); }   /* the icon (styles.css) and the gap after it */
  /* A hairline between the rail and the page, from the top of the rail's first button to the bottom of its last. It
     belongs to the page, not the rail, so that it lies under the footer: the halftone's dots close over it. */
  body::before { content: ""; position: fixed; top: var(--rail-top, var(--space-6)); bottom: var(--space-6); width: 1px;
    left: calc(var(--space-5) + var(--rail-w) + var(--space-4)); background: var(--line); pointer-events: none; }
  /* Controls is pushed to the bottom of the rail, and its menu opens upward */
  .nav .dropdown--controls { margin-top: auto; }
  .nav .dropdown--controls .dropdown__menu { top: auto; bottom: calc(100% + var(--space-3)); left: 0; right: auto; }
  .home, .foot-col { --col-pad: max(var(--space-4), min(4vw, 58px)); max-width: none; margin-left: 164px; margin-right: 0;
    padding-left: var(--col-pad); padding-right: var(--space-5); }
}
/* Phones: one row, with the links in the Menu panel (styles.css and nav.js) */
/* Below the rail the nav spans the window. The iron filings' canvas reaches past each key (filings.js), and past
   the window's edge on the last one, which made the page scroll sideways; the bar clips it there. */
@media (max-width: 1099px) { .nav { overflow-x: clip; } }
/* Between phone and rail the row can't hold every button, so it wraps */
@media (min-width: 601px) and (max-width: 1099px) {
  .nav { height: auto; min-height: var(--nav-h); flex-wrap: wrap; row-gap: var(--space-2); padding-block: var(--space-3); }
}

/* ---- Matte: the page's controls are the Matte system's parts (matte.css).
        The nav buttons are Matte keys through the Button Lab's active version, "Matte" (button-versions.js);
        here the Controls menu is a small panel and the split-flap board sits in a powder-coated housing. Both finishes follow the page's light and dark switch. ---- */
.nav.matte .chip:focus-visible { outline: 2px solid var(--m-signal); outline-offset: 3px; }
.nav.matte .dropdown__menu { min-width: 200px; padding: 5px; border: 0; border-radius: var(--radius-md, 10px);
  background: linear-gradient(180deg, var(--m-body-hi), var(--m-body-lo));
  box-shadow: 0 1px 0 var(--m-shine) inset, 0 0 0 1px var(--m-edge), var(--m-drop); -webkit-backdrop-filter: none; backdrop-filter: none; }
.nav.matte .dropdown__menu a { padding: 10px; border-radius: 4px; color: var(--m-print); font: 400 var(--m-text-legend)/1 var(--m-font); letter-spacing: 0.1em; text-transform: uppercase; }
.nav.matte .dropdown__menu a:hover { background: color-mix(in srgb, var(--m-print) 12%, transparent); color: var(--m-print-hi); }

/* the page itself, in the dark theme: off-black with the same fine speckle as a Matte body, in place of Night.
   Everything mixed from Night (lines, surfaces, muted text) follows, so the greys stay neutral. */
:root:not([data-theme="light"]) { --c-night: #0d0d0e; }
:root:not([data-theme="light"]) body { background: var(--ground)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .126 -.059'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"); }

.foot { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-6) var(--grid-gutter); }
.foot > * { grid-column: span 4; }   /* three columns of four */
.foot h2 { font: 400 var(--text-2xs)/1.5 "Söhne Mono", monospace; color: var(--c-mist); margin: 0 0 var(--space-2); }
.foot p, .foot ul { margin: 0; padding: 0; list-style: none; font-size: var(--text-md); line-height: 1.55; }
.foot li { padding: 2px 0; }

/* The page ends on a solid field of Slate, and the footer sits on it. The ground dissolves
   into the field through the halftone at its top edge. The band classes and colours are the
   ones in styles.css; halftone.js draws the dots. Slate is the same in both themes, so the
   footer's text is Paper and Mist in both: about 7:1 and 6:1 against it. */
.endband { display: block; --band-from: var(--ground); --band-to: var(--c-slate); color: var(--c-paper); pointer-events: auto;
  padding-block: calc(var(--halftone-below) + 144px) var(--space-8); }   /* stray dots fall well past --halftone-below; the text starts under all of them */
.endband a:focus-visible { outline: 2px solid var(--c-paper); outline-offset: 2px; }
/* The halftone paints only Slate, in dots that grow until they close into a solid, and the page's ground shows between
   them. So the solid fill behind must not start at the field's edge, where it would fill the gaps in the lower half of the
   transition: it starts where the canvas ends, by which point the canvas is solid itself (a pixel's overlap hides the join). */
.endband::after { top: calc(var(--halftone-reach) - 1px); }
/* halftone.js draws on a canvas wider than the page that reaches --halftone-reach above the
   field's edge. The frame clips the canvas to the page's width; it is that much taller than
   the field and pulled up over the space left under the last project, so the dots above the
   edge show. Nothing in that overlap takes clicks. */
.endframe { overflow: clip; pointer-events: none; padding-top: var(--halftone-reach);
  margin-top: calc(var(--space-8) + var(--halftone-above) - var(--halftone-reach)); }

@media (max-width: 760px) { .foot > * { grid-column: 1 / -1; } }

/* The work page's end: the footer on the page's own ground, then a bison galloping in type (bison.js), as tall as the
   animal needs at the page's width, with room for its entrance's wall of characters around it. */
/* Its columns are the project record's (.fields): the same container, the same three columns and gap, a rule over them, and the same
   small mono capitals for their labels. */
.endfoot { display: block; margin-top: var(--space-8); padding-block: var(--space-4) var(--space-6); }
.endfoot .foot { padding-top: var(--space-5); border-top: 1px solid var(--line); }
.endfoot .foot h2 { margin: 0; padding-bottom: var(--space-2); font: 400 var(--text-2xs)/1.5 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.bison-run { position: relative; height: clamp(300px, 46vw, 86svh); margin-top: var(--space-4); color: var(--c-paper); overflow: hidden; }
:root[data-theme="light"] .bison-run { color: var(--c-night); }
.bison-run canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* beside the rail, the bison starts past its hairline, so the wall doesn't run under the nav and the animal centres in the page */
@media (min-width: 1100px) { .bison-run { margin-left: calc(var(--space-5) + var(--rail-w) + var(--space-4) + 1px); } }

/* ---- The card: one experiment on the Experiments wall, and the design system's specimen of it. ---- */
/* a card is a Matte body, speckle and all, with the picture set into it like a screen in its well */
.cards.matte .card { position: relative; isolation: isolate; border: 0; border-radius: var(--m-radius); overflow: visible; padding: 10px;
  color: var(--m-print); text-decoration: none;
  background: linear-gradient(180deg, var(--m-body-hi), var(--m-body-lo));
  box-shadow: 0 1px 0 var(--m-shine) inset, 0 -1px 0 rgb(0 0 0 / calc(0.6 * var(--m-shade))) inset, 0 0 0 1px var(--m-edge), var(--m-drop);
  transition: transform var(--dur-3) var(--ease-out); }
.cards.matte .card::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  opacity: calc(var(--m-speckle) * var(--m-speckle-gain)); filter: var(--m-speckle-ink);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 -.42'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"); }
.cards.matte a.card:hover, .cards.matte a.card:focus-visible { transform: translateY(-2px); }
.cards.matte a.card:focus-visible { outline: 2px solid var(--m-signal); outline-offset: 3px; }
.cards.matte .card__thumb { border-radius: calc(var(--m-radius) - 8px); background: var(--m-well);
  box-shadow: 0 1px 0 rgb(255 255 255 / calc(0.08 * var(--m-gloss))), 0 0 0 1px var(--m-edge); }
.cards.matte .card__body { padding: var(--space-4) 6px 6px; }
.cards.matte .card__title { color: var(--m-print-hi); font: 600 var(--text-heading)/1.2 "Söhne Breit", sans-serif; }
.cards.matte .card__desc { color: var(--m-print); font-size: var(--text-sm); line-height: 1.5; }
.cards.matte .card__meta { margin-top: var(--space-2); color: var(--m-print-dim); font: 400 var(--m-text-legend)/1.5 var(--m-font); letter-spacing: 0.1em; text-transform: uppercase; }
.cards.matte .card--soon { background: none; box-shadow: 0 0 0 1px var(--line-strong); color: var(--m-print-dim); font: 400 var(--m-text-legend)/1 var(--m-font); letter-spacing: 0.1em; text-transform: uppercase; }
.cards.matte .card--soon::before { content: none; }
@media (prefers-reduced-motion: reduce) { .cards.matte .card { transition: none; } }
