/* gallop: the locked design system.
   A hairline cell grid, one ink, one ground and one grey, two faces. Light is the
   default; dark is opt-in from the switch in the nav and is remembered per
   browser. prefers-color-scheme is deliberately not consulted, because the
   default is a design decision rather than a preference to inherit.
   The written version is gallop-aesthetic.md. */

:root{
  /* --- ground and ink. two values, and everything else is an alpha of them --- */
  --bg:#FFFFFF;
  --fg:#000000;
  --line:rgba(0,0,0,.20);          /* cell rules, the skeleton */
  --line-2:rgba(0,0,0,.34);        /* a box that should read as an object */
  --dim:rgba(0,0,0,.55);           /* secondary label */
  --body:rgba(0,0,0,.78);          /* running prose */
  --wash:rgba(0,0,0,.06);          /* hover, and the one fill that is not solid */
  --surface:#EDEDED;               /* the grey: chrome that sits apart from the page (foot, contents) */

  /* --- two faces (display is Archivo bold) ------------------------------------------------------ */
  --disp:"Archivo",system-ui,sans-serif;
  --sans:"Archivo",Arial,sans-serif;
  --mono:"Courier Prime",ui-monospace,Menlo,monospace;

  --hair:1px solid var(--line);
}

:root[data-theme="dark"]{
  --bg:#0E1216;                    /* slate. the colour a terminal usually is */
  --fg:#FFFFFF;
  --line:rgba(255,255,255,.18);
  --line-2:rgba(255,255,255,.32);
  --dim:rgba(255,255,255,.55);
  --body:rgba(255,255,255,.80);
  --wash:rgba(255,255,255,.07);
  --surface:#171C22;               /* a step up from the ground, same hue */
}

/* --- the previous palette, mapped onto this one -------------------------
   The map and the intake are hand-authored documents whose diagrams are
   written against these names. Aliasing rather than rewriting keeps the
   inline SVG untouched and makes both documents theme with everything else. */
:root{
  --ink:var(--fg);
  --paper:var(--bg);
  --pasture:var(--bg);
  --pasture-shade:var(--line);
  --vellum:color-mix(in srgb, var(--fg) 13%, var(--bg));
  --f-chrome:var(--disp);
  /* --f-body feeds the diagram labels on the map and the intake, and nothing
     else. Those geometries were drawn against a proportional face, so a mono
     one runs every label past its box. It stays proportional. */
  --f-body:var(--sans);
  --f-mono:var(--mono);
  --drop:none;
}

/* --- base ---------------------------------------------------------------- */
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;background:var(--bg)}
body{margin:0;background:var(--bg);color:var(--fg);
     font-family:var(--mono);font-size:15px;line-height:1.6;
     -webkit-font-smoothing:antialiased;
     min-height:100vh;min-height:100dvh;display:flex;flex-direction:column}
body > footer{margin-top:auto}   /* the foot always closes the page */
a{color:inherit;text-decoration:none}
a:hover{text-decoration:underline}
:focus-visible{outline:2px solid var(--fg);outline-offset:2px}
img,svg{max-width:100%}

/* --- the cell grid is the skeleton --------------------------------------- */
.band{border-bottom:1px solid var(--line)}
.cells{display:grid}
.cells > *{border-right:1px solid var(--line);padding:16px 20px;min-width:0}
.cells > *:last-child{border-right:0}
.secthead{display:flex;align-items:baseline;justify-content:space-between;gap:16px;
          padding:14px 20px;border-bottom:1px solid var(--line);flex-wrap:wrap}

/* --- type roles ---------------------------------------------------------- */
.lab{font-family:var(--sans);text-transform:uppercase;font-size:11px;
     letter-spacing:.16em;font-weight:600;margin:0}
.d{font-family:var(--disp);font-weight:700;line-height:1.02;letter-spacing:0;margin:0}
.wm{font-family:var(--disp);font-weight:700;text-transform:lowercase;letter-spacing:0}
.dim{color:var(--dim)}
.key{font-weight:700}
.mono{font-family:var(--mono)}

/* --- the shared nav band -------------------------------------------------
   The wordmark on the left; six links sized to their labels and set right,
   in the uppercase chrome face the contents strip and the buttons use; the
   theme switch last. Equal cells left most of each one empty. The current
   page carries a 2px underline. Below 1080px the band is one row, wordmark
   and a menu button, and the links and the switch open under it as
   full-width rows. */
.nav{grid-template-columns:220px 1fr repeat(6,auto) auto;align-items:center}
.nav .wm{font-size:26px;line-height:1.05}
.nav .sw{display:flex;justify-content:flex-end;padding:8px 16px 8px 12px}
.nav a[aria-current="page"]{font-weight:700}
@media (min-width:1081px){
  .nav .wm{border-right:0}
  .nav > .menu + a{grid-column-start:3;border-left:1px solid var(--line)}
  .nav > a:not(.wm){align-self:stretch;display:flex;align-items:center;padding:0 22px;
    font-family:var(--sans);text-transform:uppercase;font-size:11.5px;letter-spacing:.14em;font-weight:600}
  .nav > a:not(.wm):hover{background:var(--wash);text-decoration:none}
  .nav a[aria-current="page"]{font-weight:600;box-shadow:inset 0 -2px 0 var(--fg)}
}
.nav .menu{display:none}
/* the theme switch: sun and moon side by side, no frame; the current one in
   ink, the other dimmed */
.theme{display:inline-flex;gap:2px}
.theme button{width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;
              padding:0;background:none;border:0;color:var(--dim);cursor:pointer}
.theme button:hover,.theme button[aria-pressed="true"]{color:var(--fg)}
.theme svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.4;
           stroke-linecap:round;stroke-linejoin:round}

/* --- skip link: the first tab stop on every page --------------------------- */
.skip{position:absolute;left:-9999px;top:8px;z-index:10;padding:10px 14px;
      background:var(--fg);color:var(--bg);font-family:var(--sans);text-transform:uppercase;
      font-size:11px;letter-spacing:.14em;font-weight:600}
.skip:focus{left:8px;text-decoration:none}

/* --- the contents strip on a long page ------------------------------------ */
.toc{position:sticky;top:0;z-index:5;display:flex;flex-wrap:wrap;align-items:stretch;
     background:var(--surface);border-bottom:1px solid var(--line);padding:0 var(--gutter,20px)}
.toc .lab{display:flex;align-items:center;padding:10px 20px 10px 0;color:var(--dim)}
.toc a{display:flex;align-items:center;padding:10px 16px;border-left:1px solid var(--line);
       font-family:var(--sans);text-transform:uppercase;font-size:11px;letter-spacing:.14em;
       font-weight:600}
.toc a:hover{background:var(--wash);text-decoration:none}
[id]{scroll-margin-top:56px}
@media (max-width:620px){
  /* one row that scrolls sideways, rather than five ragged ones */
  .toc{position:static;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch}
  .toc a{white-space:nowrap;flex:none}
  .toc .lab{flex:none}
  [id]{scroll-margin-top:0}
}

/* --- controls ------------------------------------------------------------ */
/* The call to action: a verb in a block, the primary filled, the secondary
   outlined, an arrow that moves on hover. One primary per band. */
.btn{display:flex;align-items:center;justify-content:space-between;gap:20px;
     min-height:54px;padding:0 18px;border:1px solid var(--fg);
     font-family:var(--sans);text-transform:uppercase;font-size:12px;
     letter-spacing:.14em;font-weight:600;transition:background .15s,color .15s}
.btn .arr{font-family:var(--mono);font-size:17px;transition:transform .15s}
.btn.pri{background:var(--fg);color:var(--bg)}
.btn:hover{background:var(--fg);color:var(--bg);text-decoration:none}
/* the filled button is already ink on ground, so its hover inverts rather
   than filling again: ground with ink type, inside the border it always had. */
.btn.pri:hover{background:var(--bg);color:var(--fg)}
.btn:hover .arr{transform:translateX(6px)}
@media (prefers-reduced-motion:reduce){.btn,.btn .arr{transition:none}}

/* --- a terminal, when a page shows one -----------------------------------
   No window furniture. The map and the intake had their title-bar controls
   removed by the .bar rules below, and a traffic light borrowed from another
   operating system was the last of it left standing. The bar names the run
   instead: a cursor block, the skill, and what this is. */
.term{border:1px solid var(--line-2)}
.term .tbar{display:flex;align-items:center;gap:10px;padding:9px 12px;
            border-bottom:1px solid var(--line);font-size:11px;
            letter-spacing:.14em;text-transform:uppercase}
.term .cur{width:7px;height:13px;background:var(--fg);flex:none}
.term .path{font-family:var(--mono);text-transform:none;letter-spacing:0;
            font-size:13px;color:var(--dim)}
.term .path b{font-weight:700;color:var(--fg)}
/* a run is a question, its rows, and where it went. the rows are a grid, so
   on a phone the answer drops under its question instead of running off the
   right edge. */
.term .run{padding:18px 22px 20px;font-size:14px;line-height:1.75}
.term .run p{margin:0}
.term .run b{font-weight:700}
.term .q{margin-bottom:1.2em}
.term .row{display:grid;grid-template-columns:9ch 24ch 1fr;padding-left:2ch}
.term .to{margin-top:1.2em;padding-left:2ch}
.term .to a{color:inherit;text-decoration:underline;text-underline-offset:3px}
.term .sub{padding-left:5ch}
.term .run[hidden]{display:none}
@keyframes blink{50%{opacity:0}}
.cursor{display:inline-block;width:8px;height:1.05em;background:var(--fg);
        vertical-align:-2px;animation:blink 1s step-end infinite}
@media (prefers-reduced-motion:reduce){.cursor{animation:none}}

/* --- long-form documents: the map and the intake -------------------------
   Their markup calls a section a .win with a .bar header. Under this system a
   window is a cell, so the frame goes flat, the striped title bar becomes a
   labelled band, and the window furniture stops rendering. */
/* the one left edge for every document and hero body, on every page. Bars,
   nav and grid cells keep their own 20px; this is a margin, not a column,
   so the diagrams scale to the viewport and prose stops at its measure. */
:root{--gutter:clamp(20px,3.2vw,60px)}
.win{background:var(--bg);border:1px solid var(--line);box-shadow:none}
.bar{height:auto;min-height:38px;display:flex;align-items:center;gap:10px;
     padding:9px 20px;border-bottom:1px solid var(--line);
     background:none;background-image:none}
.bar h2{font-family:var(--sans);text-transform:uppercase;font-size:11px;
        letter-spacing:.16em;font-weight:600;margin:0;background:none;padding:0}
.bar .close,.bar .size{display:none}
.bar .grow{flex:1}

/* --- the foot band ------------------------------------------------------- */
.foot{grid-template-columns:1.5fr 1fr 1fr 1fr;font-size:13.5px;border-top:1px solid var(--line);
      background:var(--surface)}
.foot > *{padding:24px 20px 28px}
.foot .wm{font-size:22px;display:block;margin-bottom:8px}
.foot p{margin:0;max-width:34ch;font-family:var(--sans);color:var(--body);line-height:1.6}
.foot .lab{margin-bottom:10px;color:var(--dim)}
.foot a,.foot span{display:block;line-height:1.95}
.foot .dim{color:var(--dim)}

/* --- figures: inline SVG that wears the page's ink ------------------------ */
.fig{margin:26px 0 12px;background:var(--surface);border:1px solid var(--line);
     padding:20px 22px 18px}
.fig svg{display:block;width:100%;height:auto}
.fig figcaption{font-size:13.5px;line-height:1.55;color:var(--dim);margin-top:14px;max-width:84ch}
.fig text{font-family:var(--sans);font-size:11.5px;fill:var(--fg)}
.fig .lab{font-family:var(--sans);text-transform:uppercase;letter-spacing:.14em;font-size:10px;fill:var(--dim)}
.fig .dimt{fill:var(--dim)}
.fig .key{font-weight:700}
.fig .mono{font-family:var(--mono);font-size:11px}
.fig .t-title{font-size:14px;font-weight:600}
.fig .t-q{font-size:11.5px}
.fig .t-edge{font-family:var(--mono);font-size:10.5px}
.fig .sk{font-family:var(--mono);font-size:12.5px;font-weight:700;text-decoration:underline;text-underline-offset:3px}
.fig a:hover .sk{fill:var(--dim)}
.fig .ax{stroke:var(--line-2);fill:none;stroke-width:1}
.fig .grid{stroke:var(--line);fill:none;stroke-width:1}
.fig .ln{stroke:var(--fg);stroke-width:1.5;fill:none;stroke-linejoin:round;stroke-linecap:round}
.fig .thin{stroke-width:1}
.fig .dash{stroke-dasharray:4 3}
.fig .dot{fill:var(--fg)}
.fig .dot-o{fill:var(--bg);stroke:var(--fg);stroke-width:1.5}
.fig .hbar{fill:var(--fg)}
.fig .wash{fill:var(--wash)}
.fig .node{fill:var(--bg);stroke:var(--fg);stroke-width:1}
@media (max-width:620px){.fig text{font-size:14px}}

@media (max-width:1080px){
  /* wordmark, theme, menu on one row; the switch stays in the bar */
  .nav{grid-template-columns:1fr auto auto}
  .nav > a:not(.wm){display:none;order:3}
  .nav .wm{order:0}
  .nav .sw{order:1;padding:0 10px;align-self:stretch;align-items:center}
  .nav .menu{order:2;display:flex;align-items:center;justify-content:center;align-self:stretch;
             width:56px;min-height:52px;padding:0;background:none;border:0;
             color:inherit;cursor:pointer}
  .nav .menu .bars,.nav .menu .bars::before,.nav .menu .bars::after{
    display:block;width:18px;height:2px;background:currentColor;transition:transform .15s}
  .nav .menu .bars{position:relative}
  .nav .menu .bars::before,.nav .menu .bars::after{content:"";position:absolute;left:0}
  .nav .menu .bars::before{top:-6px}
  .nav .menu .bars::after{top:6px}
  .nav.open .menu .bars{background:transparent}
  .nav.open .menu .bars::before{transform:translateY(6px) rotate(45deg)}
  .nav.open .menu .bars::after{transform:translateY(-6px) rotate(-45deg)}
  .nav.open > a:not(.wm){display:block;grid-column:1 / -1;border-right:0;
                          border-top:1px solid var(--line)}

  /* the foot: wordmark row, Read and Use side by side, the project line last */
  .foot{grid-template-columns:1fr 1fr;font-size:13px}
  .foot > *{padding:16px 20px 18px;border-bottom:1px solid var(--line)}
  .foot > :first-child{grid-column:1 / -1;border-right:0}
  .foot > :nth-child(3){border-right:0}
  .foot > :last-child{grid-column:1 / -1;border-bottom:0;display:flex;flex-wrap:wrap;
                      gap:4px 18px;align-items:baseline}
  .foot > :last-child .lab{margin:0}
  .foot a,.foot span{line-height:1.7}
}
@media (prefers-reduced-motion:reduce){
  .nav .menu .bars,.nav .menu .bars::before,.nav .menu .bars::after{transition:none}
}
@media (max-width:620px){
  .cells > *{padding:14px 18px}
  .nav .wm{font-size:24px}
  .foot > :first-child{display:flex;gap:16px;align-items:baseline}
  .foot > :first-child .wm{margin:0;flex:none}
  :root{--gutter:16px}
  .term .run{padding:14px 16px 16px;font-size:13px}
  .term .row{grid-template-columns:8ch 1fr;padding-left:0}
  .term .row span:last-child{grid-column:2}
  .term .to,.term .sub{padding-left:0}
}
