/* The system page (/the-system/): the site's tokens, type and components, drawn by the site's
 * own CSS. Loads after home.css and project.css (for the hero and facts row). Uses the site's
 * tokens only. system.js reads the values from home.css and fills in the numbers. */

.sys-hero .case-facts { width: min(100%, 880px); margin-inline: auto; text-align: center; } /* keeps the project pages' hairline above */
.sys-hero .case-facts div { justify-items: center; }

/* The sections: one column no wider than the screen */
.sys {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-12);
  padding: 0 var(--edge); /* Let's talk, below, brings its own space */
}
/* The index: at every width, a strip pinned under the top bar (48px) from the moment the
   page opens, page-wide, that scrolls sideways where it doesn't fit. Its links are the top
   bar's links (Type/link-nav, with the fill sweep on hover and focus, home.css) and start and
   end on the page's edge, like the content. A chevron icon button sits over each end, on a
   short fade to the page colour, to step it along without swiping; each shows only while
   there's more that way (system.js .can-back/.can-on). system.js also keeps the section
   you're reading in view. Under the phone menu, which covers it. */
.sys-index {
  position: fixed; top: 48px; left: 0; right: 0; z-index: 8;
  padding-block: 0 var(--space-2); /* none above: it sits right under the top bar */
  background: var(--color-bg);
}
.sys-index ul {
  position: relative;
  display: flex; flex-wrap: nowrap; gap: var(--space-5);
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
  scroll-padding-inline: var(--space-12); /* a link tabbed to stops clear of the chevrons and their fade */
}
.sys-index ul::-webkit-scrollbar { display: none; }
.sys-index li { flex: none; }
/* The page's edge before the first link and after the last (padding on the items, so
   every browser scrolls it) */
.sys-index li:first-child { padding-left: var(--edge); }
.sys-index li:last-child { padding-right: var(--edge); }
/* Centred at every width, like the top bar's links, until they reach the sides; then it
   scrolls from the first link. The list shrinks to its links and is centred itself (never
   wider than the page); works in every browser, unlike auto margins on the items. */
.sys-index ul { width: max-content; max-width: 100%; margin-inline: auto; }
.sys-index::before, .sys-index::after {
  content: ""; position: absolute; z-index: 1; top: 0; bottom: 0; width: var(--space-16);
  pointer-events: none; opacity: 0; transition: opacity var(--duration-s) var(--ease);
}
.sys-index::before { left: 0; background: linear-gradient(to right, var(--color-bg) 60%, transparent); }
.sys-index::after { right: 0; background: linear-gradient(to left, var(--color-bg) 60%, transparent); }
.sys-index.can-back::before, .sys-index.can-on::after { opacity: 1; }
.sys-index__step {
  display: grid; position: absolute; z-index: 2; top: 50%; translate: 0 -50%;
  color: var(--color-text-muted); transition: opacity var(--duration-s) var(--ease);
}
.sys-index__step[data-step="-1"] { left: var(--space-1); }
.sys-index__step[data-step="1"] { right: var(--space-1); }
.sys-index__step:disabled { opacity: 0; pointer-events: none; }
/* Anything tabbed to stops clear of the top bar and the strip (80px) */
html:has(.sys-index) { scroll-padding-top: var(--space-24); }
/* The section you're reading is in the text colour, the rest muted */
.sys-index a:not([aria-current]) { color: var(--color-text-muted); }
.sys-index a { display: inline-block; font: var(--type-link-nav); text-decoration: none; } /* a full 24px line, like the top bar's links */

.sys-body { display: grid; min-width: 0; }
.sys-section { position: relative; display: grid; gap: var(--space-4); padding-block: var(--space-44); scroll-margin-top: var(--space-24); } /* clear of the top bar and the index strip */
/* Sections break like the project pages' chapters: 176px above and below (120px on phones)
   and a hairline across the whole page. */
.sys-section::before { content: ""; position: absolute; top: 0; left: -100vw; right: -100vw; border-top: 1px solid var(--color-border); }
.sys-section > .label + .sys-title { margin-top: calc(-1 * var(--space-2)); }
.sys-title { margin-bottom: var(--space-6); font: var(--type-display-m); letter-spacing: var(--type-display-m-tracking); } /* 40px to what follows, with the section's gap */
.sys-lede { max-width: 560px; margin-bottom: var(--space-6); font: var(--type-body-m); color: var(--color-text-muted); text-wrap: pretty; }
/* How to use the section's tokens, as one terminal line (like the 404 log) in a pill on the
   subtle surface: the $ muted, the code in --color-text. A line that wraps on a phone keeps
   rounded corners rather than a stretched capsule. */
.sys-usage {
  justify-self: start; max-width: 100%;
  margin: calc(-1 * var(--space-3)) 0 var(--space-6); padding: var(--space-1) 14px;
  border-radius: var(--radius-s);
  background: var(--color-bg-subtle);
  font: var(--type-label-meta); letter-spacing: var(--type-label-meta-tracking);
  color: var(--color-text); overflow-wrap: anywhere;
}
.sys-usage code { font: inherit; }
.sys-usage__prompt { color: var(--color-text-muted); }

/* Rows: a hairline between each, none above the first or below the last */
.sys-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2) var(--space-6); align-items: center;
  padding: var(--space-4) 0;
}
.sys-row + .sys-row { border-top: 1px solid var(--color-border); }
.sys-rows > .sys-row:first-child { padding-top: 0; }
.sys-rows > .sys-row:last-child { padding-bottom: 0; }
.sys-meta { display: grid; gap: 2px; min-width: 0; }
.sys-name, .sys-value {
  font: var(--type-label-meta); letter-spacing: var(--type-label-meta-tracking);
}
.sys-name { color: var(--color-text); overflow-wrap: anywhere; }
.sys-role { font: var(--type-body-m); color: var(--color-text-muted); text-wrap: pretty; }
.sys-value { display: grid; justify-items: end; gap: 2px; color: var(--color-text-muted); text-align: right; }

/* Colour: two rounded squares side by side, the light theme then the dark, each with the
   border token. Without script both show the colour in the current theme. See-through
   tokens sit on each theme's own page colour. */
.sys-row--colour { grid-template-columns: 68px minmax(0, 1fr) auto; }
.swatch { position: relative; width: 68px; height: 32px; }
.swatch::before, .swatch::after {
  content: ""; position: absolute; top: 0;
  width: 32px; height: 32px; border-radius: var(--radius-s);
  border: 1px solid var(--color-border);
}
.swatch::before { left: 0; background: linear-gradient(var(--light, var(--c)) 0 0), var(--light-back, var(--color-bg)); }
.swatch::after { left: 36px; background: linear-gradient(var(--dark, var(--c)) 0 0), var(--dark-back, var(--color-bg)); }
.sys-pass { color: var(--color-text); }

/* Type: each sample in its own style; its sizes right now on the right */
.sys-row--type { grid-template-columns: minmax(0, 1fr) 320px; align-items: baseline; padding: var(--space-6) 0; }
.sys-sample { min-width: 0; overflow-wrap: anywhere; }
.t-display-xl { font: var(--type-display-xl); letter-spacing: var(--type-display-xl-tracking); }
.t-display-l { font: var(--type-display-l); letter-spacing: var(--type-display-l-tracking); }
.t-display-m { font: var(--type-display-m); letter-spacing: var(--type-display-m-tracking); }
.t-display-s { font: var(--type-display-s); letter-spacing: var(--type-display-s-tracking); }
.t-display-menu { font: var(--type-display-menu); letter-spacing: var(--type-display-menu-tracking); }
.t-heading-stat { font: var(--type-heading-stat); letter-spacing: var(--type-heading-stat-tracking); }
.t-heading-pull { font: var(--type-heading-pull); letter-spacing: var(--type-heading-pull-tracking); }
.t-body-m { font: var(--type-body-m); }
.t-body-s { font: var(--type-body-s); }
.t-link-nav { font: var(--type-link-nav); }
.t-link-company { font: var(--type-link-company); }
.t-label { font: var(--type-label); letter-spacing: var(--type-label-tracking); color: var(--color-text-muted); }
.t-label-meta { font: var(--type-label-meta); letter-spacing: var(--type-label-meta-tracking); color: var(--color-text-muted); }

/* Layout: the edge, the content, the edge */
.sys-layout {
  display: grid; grid-template-columns: 1fr 4fr 1fr; gap: var(--space-1);
  height: 64px; margin-bottom: var(--space-2);
  font: var(--type-label-meta); letter-spacing: var(--type-label-meta-tracking); color: var(--color-text-muted);
}
.sys-layout > span { display: grid; place-items: center; border-radius: var(--radius-l); }
.sys-layout__content { background: var(--color-bg-subtle); color: var(--color-text); }

/* Motion: the curve, and a dot that runs its track on that curve, over and over. Both dots
   start together, so the difference between the curves shows. Still with Reduce motion or
   Pause animations. */
.sys-row--ease { grid-template-columns: 96px minmax(0, 1fr) auto; }
.sys-curve { width: 96px; height: 96px; overflow: visible; }
.sys-curve__grid { fill: none; stroke: var(--color-border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.sys-curve__line { fill: none; stroke: var(--color-text); stroke-width: 1.5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.sys-track { position: relative; display: block; height: 16px; margin-top: var(--space-3); margin-right: 12%; border-bottom: 1px solid var(--color-border); } /* every track stops short, so --ease-pop's overshoot stays on screen */
.sys-track__dot {
  position: absolute; z-index: 1; left: 0; bottom: -4px; /* above the track and the pop's run-on line */
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-text);
}
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="paused"]) .sys-track__dot {
    animation: sys-run 3.2s var(--run-ease, var(--ease)) infinite alternate;
  }
}
/* Held at each end, then the eased run between: the curve applies to each stretch */
@keyframes sys-run {
  0%, 15% { left: 0; }
  85%, 100% { left: calc(100% - 8px); }
}

/* Components: grouped under a small label; a card each, two side by side on wide screens,
   the long ones the full width. Samples sit on the grey surface, like the pictures on the
   project pages, with no borders. */
.sys-group { display: grid; gap: var(--space-6); }
.sys-group + .sys-group { margin-top: var(--space-16); }
.sys-group__name { padding-bottom: var(--space-3); border-bottom: 1px solid var(--color-border); }
.sys-cards { display: grid; gap: var(--space-10) var(--space-6); }
@media (min-width: 1024px) {
  .sys-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sys-card--wide { grid-column: 1 / -1; }
}
.sys-card { display: grid; gap: var(--space-3); align-content: start; min-width: 0; }
.sys-card__name { font: var(--type-body-m); font-weight: 500; color: var(--color-text); } /* bold, like every small heading here */
.sys-demo {
  display: grid; place-items: center; gap: var(--space-4);
  min-height: 176px; padding: var(--space-10) var(--space-6);
  border-radius: var(--radius-l);
  background: var(--color-bg-subtle);
  overflow: hidden;
}
.sys-demo--stack { justify-items: center; align-content: center; }
.sys-demo--row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--space-2); }
.sys-demo--wide { place-items: stretch; align-content: center; padding: var(--space-10); }
.sys-note { font: var(--type-body-s); color: var(--color-text-muted); max-width: 560px; text-wrap: pretty; }

/* Small fixes so each sample sits in its panel the way it sits on its page */
.sys-demo .primary-btn { border: 0; cursor: pointer; } /* a button here, a link on the pages */
.sys-icon-row { display: flex; gap: var(--space-2); }
.sys-demo .sys-menu-btn { display: inline-flex; } /* phones only on the pages */
.sys-pill-panel { font: var(--type-body-s); color: var(--color-text-muted); }
.sys-fold { width: min(100%, 560px); justify-self: center; }
.sys-navlinks { padding: 0; border-top: 0; justify-content: center; }
.sys-inline { padding-top: 0; max-width: 520px; }
.sys-demo--stack .sys-inline { text-align: center; }
.sys-log { justify-self: center; }
.sys-copy { position: static; translate: none; opacity: 1; justify-self: center; transition: none; }
/* One stat is enough to show the part: centred, as wide as one of three on a project page */
.sys-stats { margin-top: 0; grid-template-columns: minmax(0, 384px); justify-content: center; }
.sys-facts { width: 100%; margin-top: 0; padding-top: 0; border-top: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 768px) { /* the three facts together in the middle, not spread to the panel's edges */
  .sys-facts { width: auto; justify-self: center; grid-template-columns: repeat(3, max-content); column-gap: var(--space-16); }
}
.sys-career, .sys-quotes { width: 100%; }
.sys-career li:first-child { border-top: 0; }
.sys-career { border-bottom: 0; }
.sys-quotes { grid-template-columns: minmax(0, 1fr); }
.sys-quotes li { border-top: 0; padding-top: 0; }
/* Samples narrower than their panel sit in its middle, text still ranged left; the ones that
   fill the width (rows, stats, columns) are centred top to bottom instead */
.sys-quotes { max-width: 640px; justify-self: center; }
.sys-career { max-width: 520px; justify-self: center; } /* its widest on the homepage */
.sys-chapter { display: grid; gap: var(--space-4); max-width: 640px; justify-self: center; }
.sys-chapter .label + .chapter-title { margin-top: calc(-1 * var(--space-2)); }
.sys-case-quote { padding: 0; }
.sys-cols { --cols: 2; }
.sys-demo:has(> .fig) { padding: 0; background: none; overflow: visible; } /* no clipping, or the caption's first letter loses its edge */
.sys-video-bar { width: 100%; }

/* Accessibility and principles */
.sys-row--a11y { align-items: start; }
.sys-rule { font: var(--type-body-m); font-weight: 500; color: var(--color-text); }
.sys-principles { display: grid; gap: 0; counter-reset: rule; }
.sys-principles li {
  display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: var(--space-1) var(--space-6);
  padding: var(--space-6) 0;
  counter-increment: rule;
}
.sys-principles li::before {
  content: counter(rule, decimal-leading-zero); grid-row: span 2;
  font: var(--type-heading-pull); letter-spacing: var(--type-heading-pull-tracking); color: var(--color-text-muted);
}
.sys-principle { font: var(--type-heading-pull); letter-spacing: var(--type-heading-pull-tracking); }

/* Phones: rows stack, numbers go under their names */
@media (max-width: 767px) {
  .sys-section { padding-block: var(--space-30); }
  .sys-row, .sys-row--type { grid-template-columns: minmax(0, 1fr); }
  .sys-row--colour { grid-template-columns: 68px minmax(0, 1fr); }
  .sys-row--ease { grid-template-columns: 72px minmax(0, 1fr); }
  .sys-row--colour .sys-value { grid-column: 2; }
  .sys-row--ease .sys-value { grid-column: 1 / -1; white-space: nowrap; } /* the full row, under the curve, so a cubic-bezier() keeps to one line down to 320px */
  .sys-curve { width: 72px; height: 72px; }
  .sys-value { justify-items: start; text-align: left; }
  .sys-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sys-demo--wide { padding: var(--space-8) var(--space-5); }
  .sys-cols { --cols: 1; }
  .sys-principles li { grid-template-columns: 40px minmax(0, 1fr); gap: var(--space-1) var(--space-4); }
}

/* home.css resets h1–h3; this page also uses h4 (card names) and h5 (sample headings) */
:where(.sys-body) :is(h4, h5) { margin: 0; font-weight: 400; }
.sys-cols .diff { font-size: 1.17em; } /* an h3 on the project pages */
.sys-navlinks a { display: inline-block; color: var(--color-text); text-decoration: none; } /* a full 24px box, as in the top bar, so the fill and its line sit right */
.sys-demo > .career-co { justify-self: center; } /* the lone link in Links; inside a career row it stays with its role */
.sys-chapter .chapter-body { margin-top: var(--space-2); }
/* The Figure sample's placeholder picture, drawn in the tokens so it suits both themes */
.sys-picture { display: block; width: 100%; height: auto; }
.sys-picture__page { fill: var(--color-bg); stroke: var(--color-border); }
.sys-picture__ink { fill: var(--color-text); }
.sys-picture__muted { fill: var(--color-text-muted); opacity: .5; }
.sys-picture__card { fill: var(--color-bg-subtle); stroke: var(--color-border); }
/* Descriptions in rows stop at the project pages' paragraph width, however wide the row */
.sys-role { max-width: 560px; }
/* The easing curves sit in small grey panels, like the samples */
.sys-curve { box-sizing: border-box; padding: var(--space-3); border-radius: var(--radius-m); background: var(--color-bg-subtle); }
/* The theme and pause samples show their own state, whatever the page's theme or pause */
.sys-demo [data-sys-theme] .theme-icon { rotate: 0deg; }
.sys-demo [data-sys-theme].is-on .theme-icon { rotate: 180deg; }
.sys-demo [data-sys-pause] .motion-icon__pause { display: inline; }
.sys-demo [data-sys-pause] .motion-icon__play { display: none; }
.sys-demo [data-sys-pause][aria-pressed="true"] .motion-icon__pause { display: none; }
.sys-demo [data-sys-pause][aria-pressed="true"] .motion-icon__play { display: inline; }
.sys-principles li + li { border-top: 1px solid var(--color-border); }
.sys-principles li:first-child { padding-top: 0; }
.sys-principles li:last-child { padding-bottom: 0; }

/* Shape: a grey tile per corner size, its name, where it's used and its value (read live) */
.sys-shapes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-10) var(--space-6); }
.sys-shape { display: grid; gap: var(--space-1); align-content: start; }
.sys-shape__tile { height: 120px; margin-bottom: var(--space-3); border: 1px solid var(--color-border); background: var(--color-bg-subtle); } /* the border token, so each corner reads */
.sys-shape .sys-value { justify-items: start; text-align: left; }

/* Icons: each icon bigger on a grey tile, with its name and where it's used */
.sys-icons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-10) var(--space-6); }
.sys-icon { display: grid; gap: var(--space-1); align-content: start; }
.sys-icon__art {
  display: grid; place-items: center; height: 120px; margin-bottom: var(--space-3);
  border-radius: var(--radius-l); background: var(--color-bg-subtle); color: var(--color-text);
}
.sys-icon__art .line-icon, .sys-icon__art .motion-icon { width: 28px; height: 28px; }
.sys-icon__art .theme-icon { width: 28px; height: 28px; }
.sys-icon__name { font: var(--type-body-m); font-weight: 500; color: var(--color-text); } /* bold, like every small heading here */
.sys-subtitle { margin-top: var(--space-12); font: var(--type-body-m); font-weight: 500; color: var(--color-text); } /* bold: Plex Sans 500, the heaviest the site loads */
.sys-icon__art .skill-icon { width: 28px; height: 28px; } /* drawn at 20px, shown bigger like the rest */
@media (max-width: 1023px) {
  .sys-shapes, .sys-icons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Icons with two states show both: the usual one, then the other. These rules set each
   copy's state outright, so the page's own theme or pause doesn't change them. */
.sys-icon__art:has(.sys-icon__state) { grid-auto-flow: column; justify-content: center; gap: var(--space-8); }
.sys-icon__state { display: grid; place-items: center; }
.sys-icon__art .theme-icon { rotate: 0deg; }
.sys-icon__state--alt .theme-icon { rotate: 180deg; }
.sys-icon__art .motion-icon__pause { display: inline; }
.sys-icon__art .motion-icon__play { display: none; }
.sys-icon__state--alt .motion-icon__pause { display: none; }
.sys-icon__state--alt .motion-icon__play { display: inline; }
.sys-icon__state--alt .menu-btn__icon { rotate: 45deg; }
.sys-icon__state--alt .fold-icon__bar { rotate: 90deg; }
/* A wide panel that stacks (Links) keeps everything centred, at every width */
.sys-demo--stack.sys-demo--wide { justify-items: center; }
.sys-demo--stack .sys-inline { justify-self: center; text-align: center; }
/* A company link outside a career row: its stretched click area (home.css) stays on the link
   itself, not over the page. Every sample panel also holds anything positioned inside it. */
.sys-demo { position: relative; }
.sys-demo > .career-co { position: relative; }
/* The section lines run the full width; clip them at the page edge so nothing scrolls
   sideways */
.sys { overflow-x: clip; }
/* Let's talk gets the same full-width line above it as the homepage's Contact */
.system .case-cta { border-top: 1px solid var(--color-border); }

/* Hero picture: the system's parts in the homepage's dots (a dotTile canvas, js/dots.js and
   system.js), in the project heroes' shape: 1360 by 635, then 680 by 560 on phones. */
.sys-mosaic { aspect-ratio: 1360 / 635; }
@media (max-width: 767px) {
  .sys-mosaic { aspect-ratio: 680 / 560; }
}

/* Spacing: each step as a bar of its real size */
.sys-row--space { grid-template-columns: 200px minmax(0, 1fr) auto; }
.sys-space__bar { height: var(--space-4); border-radius: var(--radius-xs); background: var(--color-text); }
@media (max-width: 767px) { .sys-row--space { grid-template-columns: minmax(0, 1fr); } }
/* --ease-pop overshoots its end, so its track runs on past the end in the muted colour:
   the stretch the dot pops into before settling back */
.sys-row--ease[data-ease="--ease-pop"] .sys-track::after {
  content: ""; position: absolute; left: 100%; bottom: -1px; width: 12%;
  border-bottom: 1px solid var(--color-text-muted);
}

/* Let's talk's boy (the homepage hero's): as tall as the project pages' closing drawings
   (Debug's crowd 159px, Plusnet's man 238px), not the hero's 92px */
.case-art .hero-doodle.person { width: calc(200px * 44 / 92); height: 200px; }
