/* ---- site/pixels/00-core.css ---- */
/* Pixel interactions: shared CSS. The 4x4 Bayer matrix as mask tiles: --px-b1..b3 light 1/4, 2/4 and 3/4
   of every 4x4 block of 4px cells in Bayer order (the same order as KSC.bayer), so stepping b1 → b2 → b3 →
   no mask "dithers in" a fill. --px-l1..l3 are the 1-D version (3px cells in a 24x3 strip) for thin bars. */
:root {
  --px-b1: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20shape-rendering='crispEdges'%3E%3Crect%20x='0'%20y='0'%20width='4'%20height='4'/%3E%3Crect%20x='8'%20y='0'%20width='4'%20height='4'/%3E%3Crect%20x='0'%20y='8'%20width='4'%20height='4'/%3E%3Crect%20x='8'%20y='8'%20width='4'%20height='4'/%3E%3C/svg%3E");
  --px-b2: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20shape-rendering='crispEdges'%3E%3Crect%20x='0'%20y='0'%20width='4'%20height='4'/%3E%3Crect%20x='8'%20y='0'%20width='4'%20height='4'/%3E%3Crect%20x='4'%20y='4'%20width='4'%20height='4'/%3E%3Crect%20x='12'%20y='4'%20width='4'%20height='4'/%3E%3Crect%20x='0'%20y='8'%20width='4'%20height='4'/%3E%3Crect%20x='8'%20y='8'%20width='4'%20height='4'/%3E%3Crect%20x='4'%20y='12'%20width='4'%20height='4'/%3E%3Crect%20x='12'%20y='12'%20width='4'%20height='4'/%3E%3C/svg%3E");
  --px-b3: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20shape-rendering='crispEdges'%3E%3Crect%20x='0'%20y='0'%20width='4'%20height='4'/%3E%3Crect%20x='4'%20y='0'%20width='4'%20height='4'/%3E%3Crect%20x='8'%20y='0'%20width='4'%20height='4'/%3E%3Crect%20x='12'%20y='0'%20width='4'%20height='4'/%3E%3Crect%20x='4'%20y='4'%20width='4'%20height='4'/%3E%3Crect%20x='12'%20y='4'%20width='4'%20height='4'/%3E%3Crect%20x='0'%20y='8'%20width='4'%20height='4'/%3E%3Crect%20x='4'%20y='8'%20width='4'%20height='4'/%3E%3Crect%20x='8'%20y='8'%20width='4'%20height='4'/%3E%3Crect%20x='12'%20y='8'%20width='4'%20height='4'/%3E%3Crect%20x='4'%20y='12'%20width='4'%20height='4'/%3E%3Crect%20x='12'%20y='12'%20width='4'%20height='4'/%3E%3C/svg%3E");
  --px-l1: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='3'%20shape-rendering='crispEdges'%3E%3Crect%20x='0'%20y='0'%20width='3'%20height='3'/%3E%3Crect%20x='12'%20y='0'%20width='3'%20height='3'/%3E%3C/svg%3E");
  --px-l2: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='3'%20shape-rendering='crispEdges'%3E%3Crect%20x='0'%20y='0'%20width='3'%20height='3'/%3E%3Crect%20x='6'%20y='0'%20width='3'%20height='3'/%3E%3Crect%20x='12'%20y='0'%20width='3'%20height='3'/%3E%3Crect%20x='18'%20y='0'%20width='3'%20height='3'/%3E%3C/svg%3E");
  --px-l3: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='3'%20shape-rendering='crispEdges'%3E%3Crect%20x='0'%20y='0'%20width='3'%20height='3'/%3E%3Crect%20x='3'%20y='0'%20width='3'%20height='3'/%3E%3Crect%20x='6'%20y='0'%20width='3'%20height='3'/%3E%3Crect%20x='12'%20y='0'%20width='3'%20height='3'/%3E%3Crect%20x='15'%20y='0'%20width='3'%20height='3'/%3E%3Crect%20x='18'%20y='0'%20width='3'%20height='3'/%3E%3C/svg%3E");
}
@keyframes px-dither-in {
  0% { -webkit-mask-image: var(--px-b1); mask-image: var(--px-b1); }
  33% { -webkit-mask-image: var(--px-b2); mask-image: var(--px-b2); }
  66% { -webkit-mask-image: var(--px-b3); mask-image: var(--px-b3); }
  100% { -webkit-mask-image: none; mask-image: none; }
}
@keyframes px-bar-in {
  0% { -webkit-mask-image: var(--px-l1); mask-image: var(--px-l1); }
  33% { -webkit-mask-image: var(--px-l2); mask-image: var(--px-l2); }
  66% { -webkit-mask-image: var(--px-l3); mask-image: var(--px-l3); }
  100% { -webkit-mask-image: none; mask-image: none; }
}

/* ---- site/pixels/10-trail.css ---- */
/* 10-trail: the pixel cursor trail's canvas (created by 10-trail.js on the first mouse move that leaves a
   trail). Fixed over the page, under Coco (90), the hands chip (95), the header (100), the wipe game (900),
   the video player (1200) and the scroll dots (1500); it never takes the pointer. */
.px-trail { position: fixed; inset: 0; z-index: 89; display: block; pointer-events: none; }
@media (prefers-reduced-motion: reduce), (forced-colors: active), print {
  .px-trail { display: none; }
}

/* ---- site/pixels/20-buttons.css ---- */
/* 20-buttons.css — E2: the button sweep / ripple canvas (see 20-buttons.js).
   .ksc-btn is already position: relative (and has scale/translate, so it is a stacking context);
   isolation makes that explicit, so the canvas's z-index -1 paints above the button's own background and
   border but below its label, rolling label and icons. Nothing here changes the button's box. */
.px-host { isolation: isolate; }
.px-btn { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: 100%; max-height: 100%; z-index: -1; border-radius: inherit; pointer-events: none; } /* never wider than its button, even mid-ring */
@media (prefers-reduced-motion: reduce) { .px-btn { display: none; } }

/* ---- site/pixels/30-assemble.css ---- */
/* 30-assemble.css — E3 icon pixel assemble + E4 authority logos as dots (see 30-assemble.js).
   The canvases are absolute (they take no grid slot) and never catch the pointer. The service icon's canvas
   sits inside its span so it turns with the hover rotation; the logo's canvas is the logo's sibling and
   mirrors its box (set from JS) and its hover scale, from the same top-left origin. */
.ksc-service__icon { position: relative; }
.px-host { position: relative; }
.px-asm, .px-logo { position: absolute; left: 0; top: 0; display: block; pointer-events: none; }
.ksc-icon.px-hide { visibility: hidden; }
.track-tile.px-pending .track-tile__logo, .track-tile.px-on .track-tile__logo { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .track-tile .px-logo { scale: 1; transition: scale var(--dur-snappy) var(--spring-snappy); }
  .track-tile:hover .px-logo { scale: 1.12; }
}
@media (prefers-reduced-motion: reduce) {
  .px-asm, .px-logo { display: none; }
  .track-tile.px-pending .track-tile__logo, .track-tile.px-on .track-tile__logo { opacity: 1; }
  .ksc-icon.px-hide { visibility: visible; } /* reduce motion turned on mid-visit: the icon stays put, no dots */
}

/* ---- site/pixels/40-edges.css ---- */
/* 40-edges.css — E5 dithered section edges (see 40-edges.js). One canvas per side, appended as the host's
   last child: absolute along the host's top or bottom edge, inside its padding, under all of its content
   (z-index -1 in the host's own stacking context: every host is position: relative + isolation: isolate in
   site.css, so the band paints above the host's background canvases, which come earlier in the DOM, and
   below text, Coco and the yard bar). It never catches the pointer. JS sets the exact size (4 rows of 12px
   cells, 10px at ≤760px); this is the size before the first draw. */
.px-edge { position: absolute; left: 0; right: 0; z-index: -1; display: block; width: 100%; height: 48px; pointer-events: none; }
.px-edge--top { top: 0; }
.px-edge--bottom { bottom: 0; }
@media (max-width: 760px) { .px-edge { height: 40px; } }
@media (forced-colors: active), print { .px-edge { display: none; } }

/* ---- site/pixels/50-rails.css ---- */
/* 50-rails.css — E6 scroll rails (50-rails.js adds .px-rail and writes --px-fill / --px-seg / li.is-lit).
   The rail is a 2px line of 2px dots (6px period) in an "off" grey, filled with --blue up to the scroll
   progress. Every rule is keyed on .px-rail, so without the script the lists look exactly as before.
   Off grey: --muted on the light theme; on the dark one --muted (#262626 on #0a0a0a) all but vanishes, so
   the rail steps up to --border-control there. */
.px-rail { --px-off: var(--muted); }
:root[data-theme="dark"] .px-rail { --px-off: var(--border-control); }

/* ---- vertical rails: the about timeline and the home milestones ---- */
.px-rail.timeline, .px-rail.milestones { position: relative; }
.px-rail.timeline::after, .px-rail.milestones::after {
  content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 2px; pointer-events: none;
  background: linear-gradient(180deg, var(--blue) 0 var(--px-fill, 0px), var(--px-off) var(--px-fill, 0px));
  -webkit-mask-image: repeating-linear-gradient(180deg, #000 0 2px, transparent 2px 6px);
  mask-image: repeating-linear-gradient(180deg, #000 0 2px, transparent 2px 6px);
}

/* timeline: the copy steps right to make room for the rail; an 8px marker sits on the rail beside the year */
.px-rail.timeline li { padding-left: 28px; }
.px-rail.timeline li b { position: relative; align-self: start; }
.px-rail.timeline li b::before {
  content: ""; position: absolute; z-index: 1; left: -28px; top: 50%; width: 8px; height: 8px; margin-top: -4px;
  background: var(--px-off); pointer-events: none;
}

/* milestones: the existing square (x 0..8) already sits on the rail; muted until lit */
.px-rail.milestones b::before { position: relative; z-index: 1; background: var(--px-off); }

.px-rail.timeline li.is-lit b::before, .px-rail.milestones li.is-lit b::before { background: var(--blue); }

/* ---- process (services): each step's top rule (1px --ink) becomes a dotted rail, filled step by step;
   its grey stays --border-control on both themes, so the four steps keep a visible rule before they fill ---- */
.px-rail.process li { position: relative; border-top-color: transparent; } /* the 1px border keeps its room: nothing moves */
.px-rail.process li::after {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, var(--blue) 0 calc(var(--px-seg, 0) * 100%), var(--border-control) 0);
  -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 2px, transparent 2px 6px);
  mask-image: repeating-linear-gradient(90deg, #000 0 2px, transparent 2px 6px);
}
.px-rail.process li::before { color: var(--ink-secondary); }
.px-rail.process li.is-lit::before { color: var(--blue); }

/* ---- the marker pop: 14 → 12 → 10 → 8px in three hard steps, then still ---- */
@keyframes px-rail-pop { from { transform: scale(1.75); } to { transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .px-rail.timeline li.is-pop b::before, .px-rail.milestones li.is-pop b::before { animation: px-rail-pop .27s steps(3, end); }
}

/* ---- site/pixels/60-forms.css ---- */
/* 60-forms.css — E7: form pixel states, for the contact form (/contact) and the internship form (/careers)
   only (both are form.contact-form).

   Focus bar: ksc.css gives .ksc-field__control::after a 2px bar that springs open (scale 0 → 1). Here it is a
   3px full-width bar that dithers in along the 1-D Bayer strips (L1 → L2 → L3 → solid, 80ms a step) when
   the field takes focus, and snaps off on blur. Its colour is untouched, so ksc.css's error colour
   (.ksc-field.is-error … ::after) still applies, and the error shake (an animation on the control itself,
   not on ::after) still plays.

   Sending: 60-forms.js puts .px-busy on the submit button while site.js has it disabled ("Sending…"). Three
   4px squares sit in the button's right padding (absolutely positioned, so the button keeps its size) and
   fill one by one in steps; under reduced motion they are three static squares. */
.contact-form .ksc-field__control::after {
  bottom: var(--px-bar-b, 0px); /* set on focus by 60-forms.js: the field's own bottom edge */
  height: 3px; scale: 1 1; opacity: 0; transition: none;
  -webkit-mask-image: none; mask-image: none;
  -webkit-mask-size: 24px 3px; mask-size: 24px 3px;
  -webkit-mask-repeat: repeat-x; mask-repeat: repeat-x;
  -webkit-mask-position: 0 0; mask-position: 0 0;
}
.contact-form .ksc-field__control:focus-within::after { opacity: 1; }

.contact-form .ksc-btn.px-busy::after {
  content: ""; position: absolute; top: 50%; right: 16px; width: 20px; height: 4px; margin-top: -2px; pointer-events: none;
  background:
    repeating-linear-gradient(90deg, var(--blue) 0 4px, transparent 4px 8px) 0 0 / 24px 4px no-repeat,
    repeating-linear-gradient(90deg, color-mix(in srgb, currentColor 35%, transparent) 0 4px, transparent 4px 8px) 0 0 / 20px 4px no-repeat;
}

@media (prefers-reduced-motion: no-preference) {
  .contact-form .ksc-field__control:focus-within::after { animation: px-bar-in 240ms steps(1) forwards; }
  .contact-form .ksc-btn.px-busy::after { animation: px-busy-fill 900ms steps(4, jump-end) infinite; }
}
/* the lit layer grows 0 → 8 → 16 → 24px: none, one, two, three squares */
@keyframes px-busy-fill {
  from { background-size: 0 4px, 20px 4px; }
  to { background-size: 32px 4px, 20px 4px; }
}

/* ---- site/pixels/70-links.css ---- */
/* 70-links.css — E8: dotted underlines that step in on hover / keyboard focus. 2px dots on a 4px pitch,
   revealed left to right in 8 steps. For the footer's column links (not the social icon buttons, which
   share the first column), the contact-card lines (/contact) and the menu sheet's email / phone links.
   The footer's solid 1px underline (ksc.css .ksc-footer a) and the contact lines' text-decoration
   underline are replaced here, never doubled. Reduced motion: the underline appears at once. */
.ksc-footer .ksc-footer__cols ul:not(.footer-social) a,
.contact-lines a,
.ksc-nav__sheet .ksc-nav__meta > a {
  text-decoration: none;
  background: repeating-linear-gradient(90deg, currentColor 0 2px, transparent 2px 4px) 0 100% / 0% 2px no-repeat;
}
/* the email line's link is itself a grid item of .contact-lines li (24px 1fr): size it to its text so the
   underline ends with the address instead of running across the card (the text doesn't move) */
.contact-lines li > a { justify-self: start; }
.ksc-footer .ksc-footer__cols ul:not(.footer-social) a:is(:hover, :focus-visible),
.contact-lines a:is(:hover, :focus-visible),
.ksc-nav__sheet .ksc-nav__meta > a:is(:hover, :focus-visible) {
  text-decoration: none;
  background-size: 100% 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .ksc-footer .ksc-footer__cols ul:not(.footer-social) a,
  .contact-lines a { transition: background-size .32s steps(8, jump-end); }
  /* the menu-sheet links are also stagger items (ksc.css): keep their opacity / translate entrance */
  .ksc-nav__sheet .ksc-nav__meta > a { transition: opacity .35s ease, translate var(--dur-snappy) var(--spring-snappy), background-size .32s steps(8, jump-end); }
  .is-open .ksc-nav__sheet .ksc-nav__meta > a { transition-delay: calc(80ms + var(--i, 0) * 45ms), calc(80ms + var(--i, 0) * 45ms), 0s; }
}
@media (prefers-reduced-motion: reduce) {
  .ksc-footer .ksc-footer__cols ul:not(.footer-social) a,
  .contact-lines a { transition: none; }
}

/* ---- site/pixels/80-modules.css ---- */
/* 80-modules.css — E9: module rows (.ksc-modules, home flagship and /development-authority) wash in with a
   Bayer dither on hover (1/4 → 2/4 → 3/4 → solid in 4px cells, 200ms) instead of ksc.css's flat background.
   The wash is the row's ::after (::before is the 01, 02… counter, a grid item), absolutely positioned
   behind the row's content inside the row's own stacking context; it covers the padding box, so the row's
   bottom rule stays visible. Rows keep their padding-left nudge and arrow. Leaving snaps it off.
   Colours: --blue-wash on light/dark canvas; on the black flagship, KSC blue at 35% (white text on the
   result, about rgb(0 1 86), is ~16:1). Reduced motion: the wash shows at once. */
.ksc-modules li > * { isolation: isolate; }
.ksc-modules li > *::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--px-wash, var(--blue-wash)); opacity: 0;
  -webkit-mask-image: none; mask-image: none;
  -webkit-mask-size: 16px 16px; mask-size: 16px 16px;
  -webkit-mask-repeat: repeat; mask-repeat: repeat;
  -webkit-mask-position: 0 0; mask-position: 0 0;
}
.flagship .ksc-modules { --px-wash: rgb(0 4 246 / .35); }
/* the flat wash from ksc.css / site.css is replaced by the dithered one */
.ksc-modules li > *:hover,
.flagship .ksc-modules li > *:hover { background: none; }
.ksc-modules li > *:hover::after { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  .ksc-modules li > *:hover::after { animation: px-dither-in 200ms steps(1) forwards; }
}

