/* nikolanikolovski.com — "Sheet 1 of 1" design system (plan §6).
 *
 * Light = drafting film, dark = blueprint. The theme follows prefers-color-scheme; <html data-theme="light|dark">
 * overrides it (set before first paint by the page, saved in localStorage). Every text/background pair is
 * checked by tools/contrast.py; the numbers are in REPORT-part1-content-design.md.
 *
 * No inline styles anywhere (the CSP has no 'unsafe-inline'): every visual rule, including the schematic's,
 * lives in this file.
 */

/* ---------------------------------------------------------------------------------------------- fonts */
/* Bricolage Grotesque (OFL, no reserved name): headings, weights 600–800, Latin only.
 * NN Sans / NN Mono: IBM Plex Sans / Mono (OFL) subsets, renamed because "Plex" is a Reserved Font Name. */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-grotesque-latin-var.3c92327ea7.woff2") format("woff2");
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2009-200A,
    U+2010-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2032-2033, U+2039-203A, U+2044,
    U+20AC, U+2122, U+2190-2193, U+2212, U+2500;
}
@font-face {
  font-family: "NN Sans";
  src: url("fonts/nn-sans-var.3e1b61e356.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "NN Mono";
  src: url("fonts/nn-mono-400.458b003c35.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "NN Mono";
  src: url("fonts/nn-mono-500.f5912c393e.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------------------------- tokens */
:root {
  color-scheme: light;
  /* drafting film */
  --paper: #F5F4EF;        /* page */
  --paper-2: #FCFBF8;      /* sheet surface (spec sheets, title block) */
  --ink: #15171C;          /* text, block outlines */
  --ink-2: #555B66;        /* secondary text, annotations, connector lines */
  --line: #DADDE2;         /* construction lines, sheet rules (decorative) */
  --line-strong: #80868F;  /* dimension ticks, toggle borders (non-text, 3:1) */
  --signal: #D2441C;       /* vermilion: pulse, live dot, focus ring (graphics) */
  --signal-ink: #B23A17;   /* vermilion when it is text (needs 4.5:1) */
  --grid: rgba(21, 23, 28, 0.03);
  --shadow: none;

  /* type (five sizes) */
  --font-head: "Bricolage Grotesque", "NN Sans", ui-sans-serif, system-ui, sans-serif;
  --font-body: "NN Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "NN Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --fs-xs: 0.8125rem;                                  /* 13px  annotations, mono labels */
  --fs-sm: 0.9375rem;                                  /* 15px  meta lines, stack, footer */
  --fs-base: 1.0625rem;                                /* 17px  body */
  --fs-lg: clamp(1.375rem, 1.2rem + 0.75vw, 1.75rem);  /* 22–28px  section titles, sheet names */
  --fs-xl: clamp(2rem, 1.35rem + 2.9vw, 3.25rem);      /* 32–52px  the h1 */
  --lh-tight: 1.12;
  --lh-snug: 1.3;
  --lh-body: 1.6;
  --track-annot: 0.06em;

  /* space (4 px base) */
  --s-1: 0.25rem;  /*  4 */
  --s-2: 0.5rem;   /*  8 */
  --s-3: 0.75rem;  /* 12 */
  --s-4: 1rem;     /* 16 */
  --s-5: 1.5rem;   /* 24 */
  --s-6: 2rem;     /* 32 */
  --s-7: 3rem;     /* 48 */
  --s-8: 4.5rem;   /* 72 */
  --s-9: 6rem;     /* 96 */

  /* layout */
  --wrap: 70rem;           /* 1120px content */
  --measure: 68ch;         /* body text width */
  --gutter: clamp(1.25rem, 0.8rem + 2vw, 2.5rem);
  --rule: 1px;
  --stroke: 1.25px;
  --radius: 2px;
  --focus: 2px solid var(--signal);

  /* motion */
  --pulse-dur: 3s;         /* one run of the loop */
  --pulse-cycle: 5s;       /* run + 2 s rest; the pulse keyframes assume 3 s / 5 s = 60 % */
  --fade: 150ms;
}

/* blueprint — the same values twice: once for the system setting, once for the toggle.
 * tools/contrast.py fails if the two blocks ever differ. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0F1B2D;
    --paper-2: #132238;
    --ink: #E6EEF7;
    --ink-2: #9FB0C6;
    --line: #2A3B55;
    --line-strong: #6F819B;
    --signal: #FF6B3D;
    --signal-ink: #FF7A50;
    --grid: rgba(230, 238, 247, 0.035);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0F1B2D;
  --paper-2: #132238;
  --ink: #E6EEF7;
  --ink-2: #9FB0C6;
  --line: #2A3B55;
  --line-strong: #6F819B;
  --signal: #FF6B3D;
  --signal-ink: #FF7A50;
  --grid: rgba(230, 238, 247, 0.035);
}

/* ----------------------------------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--fs-base) / var(--lh-body) var(--font-body);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: -0.012em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-xl); font-weight: 750; letter-spacing: -0.02em; }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-lg); font-weight: 650; }
p, ul, ol, dl { margin: 0; }
p { text-wrap: pretty; }
ul, ol { padding-left: 1.15em; }
li + li { margin-top: var(--s-1); }
img, svg { display: block; max-width: 100%; height: auto; }
strong, b { font-weight: 600; }
:lang(mk) { font-feature-settings: "locl"; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-color var(--fade) ease, color var(--fade) ease;
}
a:hover { text-decoration-color: var(--signal); }
:focus-visible { outline: var(--focus); outline-offset: 3px; border-radius: var(--radius); }

::selection { background: var(--signal-ink); color: var(--paper); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link {
  position: absolute; left: var(--s-4); top: -10rem; z-index: 10;
  padding: var(--s-2) var(--s-4);
  background: var(--ink); color: var(--paper);
  font: 500 var(--fs-sm) / 1 var(--font-mono);
  text-decoration: none;
}
.skip-link:focus { top: var(--s-4); }

/* ------------------------------------------------------------------------------------------- layout */
.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--s-5); row-gap: var(--s-6); }
.span-12 { grid-column: span 12; }
.measure { max-width: var(--measure); }
.stack > * + * { margin-top: var(--s-4); }
.stack-lg > * + * { margin-top: var(--s-6); }
@media (min-width: 60rem) {
  .span-7 { grid-column: span 7; }
  .span-5 { grid-column: span 5; }
  .span-8 { grid-column: span 8; }
  .span-4 { grid-column: span 4; }
  .span-6 { grid-column: span 6; }
}
@media (max-width: 59.99rem) {
  .span-7, .span-5, .span-8, .span-4, .span-6 { grid-column: span 12; }
}

/* ------------------------------------------------------------------------------------- annotations */
/* The small all-caps mono line used for labels, sheet numbers and status. */
.annot {
  font: 500 var(--fs-xs) / var(--lh-snug) var(--font-mono);
  letter-spacing: var(--track-annot);
  text-transform: uppercase;
  color: var(--ink-2);
}
.mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
.muted { color: var(--ink-2); }
.lede { font-size: var(--fs-base); color: var(--ink-2); max-width: var(--measure); }

/* ------------------------------------------------------------------------------------ section marks */
/* <header class="section-mark"><span class="section-mark__num">01</span><h2>Now</h2></header>
 * A thin dimension line with end ticks runs across the top of each section. */
.section { padding: var(--s-8) 0 0; }
.section-mark {
  position: relative;
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  align-items: baseline;
  gap: var(--s-3);
  padding-top: var(--s-5);
  margin-bottom: var(--s-6);
}
.section-mark::before {               /* the dimension line */
  content: "";
  position: absolute; left: 0; right: 0; top: 0;
  border-top: var(--rule) solid var(--line-strong);
}
.section-mark::after {                /* end ticks */
  content: "";
  position: absolute; left: 0; right: 0; top: -5px; height: 11px;
  border-left: var(--rule) solid var(--line-strong);
  border-right: var(--rule) solid var(--line-strong);
  pointer-events: none;
}
.section-mark__num {
  font: 500 var(--fs-xs) / 1 var(--font-mono);
  letter-spacing: var(--track-annot);
  color: var(--signal-ink);
}
.section-mark__num::after { content: " ·"; color: var(--ink-2); }

/* A standalone dimension line, e.g. between hero and content. */
.dim {
  position: relative; height: 11px; margin: var(--s-6) 0;
  border-left: var(--rule) solid var(--line-strong);
  border-right: var(--rule) solid var(--line-strong);
}
.dim::before { content: ""; position: absolute; left: 0; right: 0; top: 5px; border-top: var(--rule) solid var(--line-strong); }

/* --------------------------------------------------------------------------------------------- hero */
.hero { position: relative; padding: var(--s-8) 0 var(--s-7); isolation: isolate; }
.hero::before {                       /* faint construction grid, hero only */
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, #000 70%, transparent);
  pointer-events: none;
}
.hero h1 { max-width: 18ch; }
.hero__sub { margin-top: var(--s-5); font-size: var(--fs-base); color: var(--ink-2); max-width: 46ch; }
.hero__name-mk { font: 400 var(--fs-xs) / 1 var(--font-mono); letter-spacing: var(--track-annot); color: var(--ink-2); }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-6); }

/* ------------------------------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: 44px;
  padding: var(--s-2) var(--s-4);
  border: var(--rule) solid var(--ink);
  border-radius: var(--radius);
  background: transparent; color: var(--ink);
  font: 500 var(--fs-sm) / 1.2 var(--font-mono);
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--fade) ease, color var(--fade) ease, border-color var(--fade) ease;
}
.btn:hover { border-color: var(--signal); }
.btn--lead { background: var(--ink); color: var(--paper); }
.btn--lead:hover { background: var(--paper); color: var(--ink); }
.btn--quiet { border-color: transparent; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 0.25em; }
.btn--quiet:hover { border-color: transparent; text-decoration-color: var(--signal); }

/* ------------------------------------------------------------------------------------ status marks */
/* ● live (filled signal) · ○ code public (ring) · ◌ code private (dashed ring). Drawn in CSS, not glyphs. */
.status { display: inline-flex; align-items: center; gap: 0.45em; }
.status::before {
  content: ""; flex: none;
  width: 0.62em; height: 0.62em; border-radius: 50%;
  border: 1.5px solid var(--ink-2);
}
.status--live::before { background: var(--signal); border-color: var(--signal); }
.status--public::before { border-color: var(--ink); }
.status--private::before { border-style: dashed; border-color: var(--ink-2); }

/* ------------------------------------------------------------------------------------- layer filter */
.filter { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-bottom: var(--s-5); }
.filter__label { margin-right: var(--s-2); }
.toggle {
  min-height: 36px; padding: var(--s-1) var(--s-3);
  border: var(--rule) solid var(--line-strong); border-radius: 999px;
  background: transparent; color: var(--ink-2);
  font: 500 var(--fs-xs) / 1 var(--font-mono); letter-spacing: var(--track-annot); text-transform: uppercase;
  cursor: pointer;
  transition: background-color var(--fade) ease, color var(--fade) ease, border-color var(--fade) ease;
}
.toggle:hover { color: var(--ink); border-color: var(--ink); }
.toggle[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ------------------------------------------------------------------------------------- spec sheets */
/* <article class="sheet" data-layers="ai api">
 *   <header class="sheet__head annot">…SHEET 02.1 · ● LIVE · LAYERS AI / API</header>
 *   <h3 class="sheet__name">…</h3> <p class="sheet__what">…</p>
 *   <dl class="sheet__spec"><dt>What I did</dt><dd><ul>…</ul></dd><dt>Stack</dt><dd>…</dd></dl>
 *   <p class="proof"><span>45+ models scored</span></p>
 *   <p class="sheet__links">…</p>
 * </article> */
.sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 32rem), 1fr)); gap: var(--s-5); }
.sheet {
  position: relative;
  display: flex; flex-direction: column; gap: var(--s-4);
  padding: var(--s-5);
  background: var(--paper-2);
  border: var(--rule) solid var(--ink-2);
  transition: opacity var(--fade) ease;
}
.sheet::before, .sheet::after {      /* registration corners */
  content: ""; position: absolute; width: 9px; height: 9px; pointer-events: none;
}
.sheet::before { top: -5px; left: -5px; border-right: var(--rule) solid var(--line-strong); border-bottom: var(--rule) solid var(--line-strong); }
.sheet::after { bottom: -5px; right: -5px; border-left: var(--rule) solid var(--line-strong); border-top: var(--rule) solid var(--line-strong); }
.sheet__head {
  display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3);
  margin: calc(-1 * var(--s-5)) calc(-1 * var(--s-5)) 0;
  padding: var(--s-2) var(--s-5);
  border-bottom: var(--rule) solid var(--line);
}
.sheet__head > *:not(:last-child)::after { content: "·"; margin-left: var(--s-3); color: var(--ink-2); }
.sheet__name { font-size: var(--fs-lg); }
.sheet__name [lang="mk"] { font-family: var(--font-body); font-weight: 600; }
.sheet__what { color: var(--ink); }
.sheet__spec { display: grid; grid-template-columns: 1fr; gap: var(--s-2); }
.sheet__spec dt { font: 500 var(--fs-xs) / var(--lh-snug) var(--font-mono); letter-spacing: var(--track-annot); text-transform: uppercase; color: var(--ink-2); }
.sheet__spec dd { margin: 0 0 var(--s-2); font-size: var(--fs-sm); }
.sheet__spec dd.mono { font-size: var(--fs-xs); letter-spacing: 0.01em; }
.sheet__note { font-size: var(--fs-sm); color: var(--ink-2); }
.sheet__links { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); margin-top: auto; font: 500 var(--fs-sm) / 1.3 var(--font-mono); }
.sheet[hidden] { display: none; }
.sheet.is-dimmed { opacity: 0.35; }

/* The proof line, set like a dimension callout: |── 507 tests ──| */
.proof {
  display: flex; align-items: center; gap: var(--s-3);
  font: 500 var(--fs-sm) / 1 var(--font-mono);
  color: var(--ink);
}
.proof::before, .proof::after {
  content: ""; flex: 1 1 auto; height: 9px; min-width: 1.5rem;
  background: linear-gradient(var(--line-strong), var(--line-strong)) center / 100% 1px no-repeat;
}
.proof::before { border-left: var(--rule) solid var(--line-strong); }
.proof::after { border-right: var(--rule) solid var(--line-strong); }

/* Compact list for "smaller and earlier" */
.ledger { list-style: none; padding: 0; border-top: var(--rule) solid var(--line); }
.ledger li { display: grid; grid-template-columns: minmax(10rem, 14rem) 1fr; gap: var(--s-2) var(--s-5); padding: var(--s-3) 0; margin: 0; border-bottom: var(--rule) solid var(--line); }
.ledger__name { font-weight: 600; }
@media (max-width: 40rem) { .ledger li { grid-template-columns: 1fr; } }

/* Background: experience rows with the period in the margin */
.timeline { list-style: none; padding: 0; }
.timeline li { display: grid; grid-template-columns: 9.5rem 1fr; gap: var(--s-1) var(--s-5); margin: 0 0 var(--s-5); }
.timeline__period { font: 500 var(--fs-xs) / 1.7 var(--font-mono); letter-spacing: var(--track-annot); text-transform: uppercase; color: var(--ink-2); }
@media (max-width: 40rem) { .timeline li { grid-template-columns: 1fr; } }

.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: var(--s-5); }
.skills ul { list-style: none; padding: 0; font-size: var(--fs-sm); }
.skills li + li { margin-top: 2px; }

/* --------------------------------------------------------------------------------------- title block */
/* The footer: a small ruled box like a drawing's title block. */
.title-block {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, auto)) 1fr;
  border: var(--rule) solid var(--ink-2);
  background: var(--paper-2);
  font-size: var(--fs-sm);
}
.title-block > div { padding: var(--s-2) var(--s-4); border-right: var(--rule) solid var(--line); min-width: 0; }
.title-block > div:last-child { border-right: 0; }
.title-block dt, .title-block .tb-label { display: block; font: 500 0.6875rem / 1.4 var(--font-mono); letter-spacing: var(--track-annot); text-transform: uppercase; color: var(--ink-2); }
.title-block dd, .title-block .tb-value { margin: 0; font: 500 var(--fs-sm) / 1.4 var(--font-mono); color: var(--ink); }
.title-block .tb-links { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: var(--s-2) var(--s-4); }
@media (max-width: 40rem) {
  .title-block { grid-template-columns: 1fr 1fr; }
  .title-block > div { border-bottom: var(--rule) solid var(--line); }
  .title-block > div:nth-child(2n) { border-right: 0; }
  .title-block .tb-links { grid-column: 1 / -1; justify-content: flex-start; border-bottom: 0; }
}
.site-footer { padding: var(--s-8) 0 var(--s-6); }

/* ------------------------------------------------------------------------------------- header / nav */
.site-header { border-bottom: var(--rule) solid var(--line); }
.site-header__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3) var(--s-5); padding-block: var(--s-4); }
.wordmark { font: 700 1.125rem / 1.1 var(--font-head); letter-spacing: -0.01em; text-decoration: none; }
.wordmark small { display: block; margin-top: 3px; font: 400 0.75rem / 1.2 var(--font-mono); letter-spacing: var(--track-annot); color: var(--ink-2); }
.nav { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-5); font: 500 var(--fs-sm) / 1 var(--font-mono); }
.nav a { text-decoration: none; padding: var(--s-2) 0; }
.nav a:hover { text-decoration: underline; text-decoration-color: var(--signal); }

/* -------------------------------------------------------------------------------------- schematic */
/* src/schematic.svg.tmpl. Two drawings of the same loop: .sch--desk (2 × 2, return line along the bottom)
 * and .sch--phone (vertical, return line up the right side). A ≈3 s signal pulse runs the loop, rests
 * 2 s and runs again, forever (one 5 s cycle); each block's outline flashes as the pulse reaches it. */
.schematic { margin: 0; }
.schematic .sch--phone { display: none; }
@media (max-width: 40rem) {
  .schematic .sch--desk { display: none; }
  .schematic .sch--phone { display: block; }
}
.sch { width: 100%; height: auto; overflow: visible; }
.sch-frame { fill: none; stroke: var(--line); stroke-width: 1; }
.sch-reg { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.sch-wire { fill: none; stroke: var(--ink-2); stroke-width: var(--stroke); stroke-linejoin: round; }
.sch-return { fill: none; stroke: var(--ink-2); stroke-width: var(--stroke); stroke-dasharray: 6 4; stroke-linejoin: round; }
.sch-arrowhead { fill: var(--ink-2); }
.sch-box { fill: var(--paper-2); stroke: var(--ink); stroke-width: var(--stroke); transition: stroke var(--fade) ease; }
.sch-num { font: 500 11px var(--font-mono); letter-spacing: 0.06em; fill: var(--signal-ink); }
.sch-name { font: 700 20px var(--font-head); letter-spacing: -0.01em; fill: var(--ink); }
.sch-stack { font: 400 12px var(--font-mono); fill: var(--ink-2); }
.sch-label { font: 500 12px var(--font-mono); letter-spacing: 0.04em; fill: var(--ink-2); }
.sch-fig { font: 500 10.5px var(--font-mono); letter-spacing: 0.08em; fill: var(--ink-2); }
.sch-link { cursor: pointer; text-decoration: none; }
.sch text { text-decoration: none; }
.sch-link:hover .sch-box, .sch-link:focus-visible .sch-box, .sch-link.is-active .sch-box { stroke: var(--signal); stroke-width: 2.25px; }
.sch-link:focus { outline: none; }
.sch-link:focus-visible .sch-box { stroke-dasharray: none; }

/* The pulse: a short signal dash on the loop path (pathLength = 1). Its resting dash offset sits just
 * before the start of the path, so with no animation (reduced motion, print, old browsers) nothing shows. */
.sch-pulse {
  fill: none; stroke: var(--signal); stroke-width: 3.5px; stroke-linecap: round;
  stroke-dasharray: 0.035 2; stroke-dashoffset: 0.035;
}
/* Looping (Nikola, 21 Nov 2026): every animation below shares one 5 s cycle (--pulse-cycle) and repeats
 * forever, so the delays keep them in step. Percentages are of 5 s: the 3 s run = 60 %, a 0.7 s flash = 14 %
 * with its peak at 3.5 %. Change --pulse-cycle and these percentages together. */
@keyframes sch-pulse { 0% { stroke-dashoffset: 0.035; } 60%, 100% { stroke-dashoffset: -1; } }
@keyframes sch-flash {
  0%, 14%, 100% { stroke: var(--ink); stroke-width: var(--stroke); }
  3.5% { stroke: var(--signal); stroke-width: 2.25px; }
}
/* L1 flashes twice per cycle: as the pulse leaves (t = 0.4 s) and as it comes back (t = 3.4 s).
 * Its delay is 0.225 s, so the peaks sit at 3.5 % and 63.5 % of the cycle. */
@keyframes sch-flash-first {
  0%, 14%, 60%, 74%, 100% { stroke: var(--ink); stroke-width: var(--stroke); }
  3.5%, 63.5% { stroke: var(--signal); stroke-width: 2.25px; }
}
@media (prefers-reduced-motion: no-preference) {
  .sch-pulse { animation: sch-pulse var(--pulse-cycle) linear 0.4s infinite both; }
  .sch-b1 .sch-box { animation: sch-flash-first var(--pulse-cycle) ease-out 0.225s infinite both; }
  .sch-b2 .sch-box, .sch-b3 .sch-box, .sch-b4 .sch-box { animation: sch-flash var(--pulse-cycle) ease-out infinite both; }
  /* delay = 0.4 s start + (block centre's position along its loop, 0–1) × 3 s − 0.175 s (flash peak).
   Desk loop 1880 units: L2 .123, L3 .328, L4 .451. Phone loop 1044 units: L2 .115, L3 .230, L4 .345. */
  .sch--desk .sch-b2 .sch-box { animation-delay: 0.6s; }
  .sch--desk .sch-b3 .sch-box { animation-delay: 1.21s; }
  .sch--desk .sch-b4 .sch-box { animation-delay: 1.58s; }
  .sch--phone .sch-b2 .sch-box { animation-delay: 0.57s; }
  .sch--phone .sch-b3 .sch-box { animation-delay: 0.92s; }
  .sch--phone .sch-b4 .sch-box { animation-delay: 1.26s; }
}

/* ------------------------------------------------------------------------------- the page (Part 2) */
/* Controls that only work with JS. src/theme.js adds .js to <html> before first paint, so they
 * appear without a layout shift; without JS they never show. */
html:not(.js) .js-only { display: none !important; }

.theme-toggle {
  display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: 36px; padding: var(--s-1) var(--s-3);
  border: var(--rule) solid var(--line-strong); border-radius: 999px;
  background: transparent; color: var(--ink-2);
  font: 500 var(--fs-xs) / 1 var(--font-mono); letter-spacing: var(--track-annot); text-transform: uppercase;
  cursor: pointer;
  transition: color var(--fade) ease, border-color var(--fade) ease;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink); }
.theme-toggle__icon {          /* a half-filled disc, drawn in CSS */
  width: 0.85em; height: 0.85em; border-radius: 50%;
  border: 1.5px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}
.site-header__tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); }
.theme-toggle { white-space: nowrap; }
/* app.js replaces the first-paint "Auto" with "Light (Auto)" / "Dark (Auto)" / "Light" / "Dark": reserve room for
 * the longest (12 mono characters at 0.6em + 0.06em tracking = 7.92em) so nothing in the header moves when it does
 * (no layout shift from JS). In em, not ch: ch changes when the web font replaces the fallback. */
.theme-toggle__value { display: inline-block; min-width: 8.25em; text-align: left; }
@media (max-width: 40rem) {
  .site-header__row { row-gap: var(--s-2); }
  .site-header__tools { width: 100%; justify-content: space-between; }
  .nav { gap: 0 var(--s-4); }
  .theme-toggle__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

.hero__eyebrow { margin-bottom: var(--s-4); }
.hero__eyebrow [lang="mk"] { text-transform: none; }
.hero__open { margin-top: var(--s-4); font-weight: 600; }
.hero__figure { align-self: center; }
.hero__figure .schematic { max-width: 30rem; margin-left: auto; margin-right: auto; }
.sch-hint { margin-top: var(--s-3); text-align: center; }
@media (min-width: 60rem) { .hero__figure .schematic { margin-right: 0; } .sch-hint { text-align: right; } }

/* 01 · Now */
.now { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s-6) var(--s-5); }
.now__item { grid-column: span 12; }
@media (min-width: 60rem) {
  .now__item:first-child { grid-column: span 8; }
  .now__item:not(:first-child) { grid-column: span 4; border-left: var(--rule) solid var(--line); padding-left: var(--s-5); }
}
.now__title { font-size: var(--fs-lg); margin-top: var(--s-2); }
.now__org { color: var(--ink-2); margin-top: var(--s-1); }
.now__text { margin-top: var(--s-4); max-width: var(--measure); }
.now__item ul { margin-top: var(--s-3); max-width: var(--measure); }

/* 02 · Selected work */
.filter__status { flex-basis: 100%; min-height: 1.3em; }
.sheet.is-shown { animation: sheet-in var(--fade) ease-out; }
@keyframes sheet-in { from { opacity: 0; } to { opacity: 1; } }
.subhead { margin-top: var(--s-8); margin-bottom: var(--s-4); font-size: var(--fs-lg); }
.ledger__text a { margin-left: var(--s-2); white-space: nowrap; }

/* 03 · How I work */
.principles {
  list-style: none; padding: 0; counter-reset: p;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
  gap: 0; border-top: var(--rule) solid var(--line);
}
.principles li { margin: 0; padding: var(--s-5) var(--s-5) var(--s-5) 0; border-bottom: var(--rule) solid var(--line); counter-increment: p; }
@media (min-width: 52rem) {
  .principles li:nth-child(2n) { padding-left: var(--s-5); padding-right: 0; border-left: var(--rule) solid var(--line); }
}
.principles h3 { font-size: var(--fs-lg); }
.principles h3::before {
  content: "P" counter(p); display: block; margin-bottom: var(--s-2);
  font: 500 var(--fs-xs) / 1 var(--font-mono); letter-spacing: var(--track-annot); color: var(--signal-ink);
}
.principles p { margin-top: var(--s-3); max-width: 56ch; }

/* 04 · Background */
.bg-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s-6) var(--s-5); }
.bg-grid > * { grid-column: span 12; }
@media (min-width: 60rem) { .bg-grid > .bg-exp { grid-column: span 7; } .bg-grid > .bg-edu { grid-column: span 5; } }
.bg-grid h3, .bg-block h3 { font-size: var(--fs-lg); margin-bottom: var(--s-4); }
.timeline__role { font-weight: 600; }
.timeline__org { color: var(--ink-2); }
.timeline__text { margin-top: var(--s-1); font-size: var(--fs-sm); }
.bg-block { margin-top: var(--s-7); }
.skills h4 { margin-bottom: var(--s-2); }
.languages { font-size: var(--fs-base); }

/* 05 · Contact */
.contact__text { font: 650 var(--fs-lg) / var(--lh-snug) var(--font-head); max-width: 32ch; text-wrap: balance; }
.contact__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); margin-top: var(--s-6); }

/* -------------------------------------------------------------------------------------- 404 sheet */
.notfound { min-height: 60vh; display: grid; place-items: center; padding-block: var(--s-8); }
.notfound__sheet { max-width: 34rem; width: 100%; }
.notfound__sheet h1 { font-size: var(--fs-lg); }

/* ---------------------------------------------------------------------------------------- motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------------------------- forced colours */
@media (forced-colors: active) {
  .sch-box { stroke: CanvasText; fill: Canvas; }
  .sch-wire, .sch-return { stroke: CanvasText; }
  .sch-arrowhead { fill: CanvasText; }
  .sch-name, .sch-stack, .sch-num, .sch-label, .sch-fig { fill: CanvasText; }
  .sch-pulse { display: none; }
  .status--live::before { background: CanvasText; border-color: CanvasText; }
  .toggle[aria-pressed="true"] { border-width: 3px; }
  /* focus and the active layer on the drawing: system highlight colour and a thick line, not just the signal hue */
  .sch-link:hover .sch-box, .sch-link:focus-visible .sch-box, .sch-link.is-active .sch-box { stroke: Highlight; stroke-width: 3.5px; }
}

/* ----------------------------------------------------------------------------------------- print */
/* Ctrl-P = a clean 1–2 page A4 CV: no schematic, nav, filter or toggle; ink on white; external links print
 * their URL. Spec sheets keep what / stack / proof / links and drop the "What I did" bullets (the page has
 * them); the rest is set tight. tools/shots.mjs --pdf fails if the PDF is not 1–2 pages. */
@media print {
  :root, :root[data-theme="dark"] {
    --paper: #FFFFFF; --paper-2: #FFFFFF; --ink: #000000; --ink-2: #333333;
    --line: #BBBBBB; --line-strong: #888888; --signal: #000000; --signal-ink: #000000;
    --fs-xs: 6.5pt; --fs-sm: 8pt; --fs-base: 8.5pt; --fs-lg: 10.5pt; --fs-xl: 15pt;
  }
  @page { size: A4; margin: 11mm 12mm 12mm; }
  html { scroll-behavior: auto; }
  body { font-size: var(--fs-base); line-height: 1.38; }
  .wrap { max-width: none; padding: 0; }
  .skip-link, .nav, .theme-toggle, .filter, .schematic, .sch-hint, .hero::before, .hero__actions, .js-only,
  .dim, .lede, .sheet__spec dt:first-of-type, .sheet__spec dd:first-of-type, .no-print { display: none !important; }
  .site-header { border: 0; }
  .site-header__row { padding: 0 0 1.5mm; }
  .wordmark { font-size: 13pt; }
  .hero { padding: 0 0 1mm; }
  .hero .grid { display: block; }
  .hero__eyebrow { display: none; }
  h1 { font-size: var(--fs-xl); max-width: none; line-height: 1.15; }
  .hero h1 { max-width: none; }
  .hero__sub { margin-top: 1mm; max-width: none; }
  h2, h3, h4 { break-after: avoid; }
  .section { padding-top: 2.5mm; }
  .section-mark { margin-bottom: 1.5mm; padding-top: 1.2mm; grid-template-columns: 7mm 1fr; }
  .section-mark::after { display: none; }
  li + li { margin-top: 0; }

  .now { display: grid; grid-template-columns: 3fr 1fr; gap: 0 5mm; }
  .now__item, .now__item:first-child, .now__item:not(:first-child) { grid-column: auto; padding-left: 0; border: 0; }
  .now__title { margin-top: 0.5mm; }
  .now__text { margin-top: 0.8mm; }
  .now__item ul { margin-top: 0.8mm; }

  .sheets { display: grid; grid-template-columns: 1fr 1fr; gap: 2mm; }
  .sheet { break-inside: avoid; gap: 0.8mm; padding: 1.6mm 2.5mm 2mm; border-color: #888; }
  .sheet::before, .sheet::after { display: none; }
  .sheet[hidden], .sheet.is-dimmed { display: flex !important; opacity: 1; }
  .sheet__head { margin: -1.6mm -2.5mm 0; padding: 0.8mm 2.5mm; }
  .sheet__spec { gap: 0; }
  .sheet__spec dd { margin: 0; }
  .sheet__note { font-size: var(--fs-xs); }
  .proof { font-size: var(--fs-xs); }
  .proof::before, .proof::after { height: 5px; }
  .sheet__links { font-size: var(--fs-xs); }

  .subhead { margin: 2.5mm 0 1mm; }
  .ledger li { grid-template-columns: 28mm 1fr; gap: 0 3mm; padding: 0.6mm 0; font-size: var(--fs-sm); }

  .principles { grid-template-columns: 1fr 1fr; }
  .principles li, .principles li:nth-child(2n) { padding: 1.2mm 3mm 1.2mm 0; border-left: 0; }
  .principles h3 { font-size: var(--fs-sm); }
  .principles h3::before { display: inline; margin: 0 1.5mm 0 0; }
  .principles p { margin-top: 0.4mm; font-size: var(--fs-sm); max-width: none; }

  .bg-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 0 6mm; }
  .bg-grid > *, .bg-grid > .bg-exp, .bg-grid > .bg-edu { grid-column: auto; }
  .bg-grid h3, .bg-block h3 { font-size: var(--fs-sm); margin-bottom: 1mm; }
  .timeline li { grid-template-columns: 22mm 1fr; gap: 0 2mm; margin-bottom: 1mm; font-size: var(--fs-sm); }
  .timeline__text { margin-top: 0; }
  .bg-block { margin-top: 2mm; }
  .skills { grid-template-columns: repeat(5, 1fr); gap: 0 3mm; }
  .skills ul { font-size: var(--fs-xs); }

  .contact__text { font-size: var(--fs-base); max-width: none; }
  .contact__actions { margin-top: 1mm; }
  .contact__actions .btn { min-height: 0; padding: 0; border: 0; background: none; color: #000; font-size: var(--fs-sm); }
  .site-footer { padding: 3mm 0 0; }
  .title-block { break-inside: avoid; font-size: var(--fs-xs); }
  .title-block > div { padding: 0.8mm 2.5mm; }

  a { text-decoration: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font: 400 6.5pt var(--font-mono); color: #333; word-break: break-all; }
  .btn::after, .tb-links a::after { content: none !important; }
  .contact__actions a[href^="http"]::after { content: " (" attr(href) ")" !important; }
}
