/* V4 "Pet pravila": a component data sheet in preview status.
 * Three inks only: paper, ink, one stamp-violet signal (plus ink and signal tints).
 * One family, Archivo, used across its width axis the way a Swiss type system uses one family.
 * Twelve columns: 1-2 numeral tab, 3-9 text, 10-12 source margin. Solid rule = fact, dashed rule = optional or later.
 * The signal colour has three jobs only: product status, action and the active place, and the pilot panel. */

:root {
  --paper: #F2F3EF;
  --paper-2: #E8E9E4;
  --ink: #121417;
  --ink-2: #474C52;
  --ink-3: #5B6067;
  --rule: #BFC4C4;
  --signal: #3A2BC4;
  --signal-tint: #E4E1F7;
  --signal-ink-2: #C9C4F2;

  --font: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --gutter: clamp(16px, 4vw, 48px);
  --gap: clamp(16px, 2vw, 28px);
  --index-w: 260px;
  --strip-h: 52px;
  --doc-max: 1120px;

  --step--1: 0.8125rem;
  --step-0: 1.0625rem;
  --step-1: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem);
  --step-2: clamp(1.3125rem, 1.15rem + 0.75vw, 1.75rem);
  --step-3: clamp(1.75rem, 1.35rem + 1.9vw, 2.75rem);
  --step-4: clamp(2.375rem, 1.5rem + 3.8vw, 4.75rem);
  --numeral: clamp(3rem, 1.7rem + 4.2vw, 6rem);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
}

/* ---------- Base and browser surfaces ---------- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  caret-color: var(--signal);
  accent-color: var(--signal);
  scrollbar-color: var(--ink-2) var(--paper);
  scroll-padding-top: calc(var(--strip-h) + 12px);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  font-stretch: 100%;
  font-weight: 400;
  line-height: 1.55;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--signal); color: var(--paper); }

h1, h2, h3, p, ul, ol, dl, dd, figure, fieldset { margin: 0; }
ul, ol { padding: 0; list-style: none; }
fieldset { border: 0; padding: 0; min-width: 0; }
legend { padding: 0; }

h1, h2, h3 { text-wrap: balance; }
p, dd, li { text-wrap: pretty; }
p, dd, li, td, th { overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--signal); text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }
.doc:focus,
.pilot__contact:focus { outline: none; }

.label {
  font-size: var(--step--1);
  font-stretch: 75%;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--ink-2);
}

.skip {
  position: absolute;
  top: 8px;
  left: var(--gutter);
  z-index: 60;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus { transform: none; color: var(--paper); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 20px;
  border: 2px solid currentColor;
  border-radius: 2px;
  font: inherit;
  font-size: 1rem;
  font-stretch: 85%;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease);
}
.btn:active { transform: translateY(1px); }

.btn--signal { background: var(--signal); border-color: var(--signal); color: var(--paper); }
.btn--signal:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.btn--line { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn--line:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.btn--ink { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn--ink:hover { background: var(--signal); border-color: var(--signal); color: var(--paper); }

.btn--paper { background: var(--paper); border-color: var(--paper); color: var(--signal); }
.btn--paper:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- Document header: the data sheet's top line ---------- */

.doc-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 10px var(--gap);
  padding: 14px var(--gutter) 12px;
  border-top: 6px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.doc-head__brand { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.doc-head__name {
  font-size: 1.125rem;
  font-stretch: 80%;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.doc-head__by {
  font-size: var(--step--1);
  font-stretch: 87%;
  line-height: 1.3;
  color: var(--ink-2);
}

/* Product status, printed like a preview stamp on a data sheet. */
.stamp {
  justify-self: start;
  max-width: 100%;
  padding: 5px 10px 4px;
  border: 2px solid var(--signal);
  color: var(--signal);
  font-size: var(--step--1);
  font-stretch: 75%;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-transform: uppercase;
}

.doc-head__cta { display: none; }

@media (min-width: 700px) {
  .doc-head { grid-template-columns: minmax(0, 1fr) auto; }
  .doc-head__cta { display: inline-flex; grid-column: 2; grid-row: 1; }
  .stamp { grid-column: 1; }
}

@media (min-width: 1100px) {
  .doc-head { grid-template-columns: minmax(0, 1fr) auto auto; }
  .stamp { grid-column: 2; grid-row: 1; justify-self: end; }
  .doc-head__cta { grid-column: 3; }
}

/* ---------- Page frame and the numbered index ---------- */

.index {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

.index__title,
.index__cta { display: none; }

.index__list {
  display: flex;
  gap: 2px;
  padding: 0 calc(var(--gutter) - 10px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.index__list a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--strip-h);
  padding: 0 10px;
  font-size: 0.9375rem;
  font-stretch: 85%;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink-2);
}
.index__list a:focus-visible { outline-offset: -3px; }
.index__list a:hover { color: var(--ink); }
.index__list a:hover .index__t { text-decoration: underline; text-underline-offset: 0.2em; }

.index__no {
  font-stretch: 62%;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.index__list a[aria-current] { color: var(--ink); box-shadow: inset 0 -3px 0 var(--signal); }
.index__list a[aria-current] .index__no { color: var(--signal); }

.doc {
  width: 100%;
  max-width: calc(var(--doc-max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

@media (min-width: 1200px) {
  html { scroll-padding-top: 16px; }

  .page {
    display: grid;
    grid-template-columns: var(--index-w) minmax(0, 1fr);
  }

  .index {
    align-self: start;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 36px 24px 28px var(--gutter);
    border-bottom: 0;
    border-right: 1px solid var(--rule);
    overflow-y: auto;
  }

  .index__title { display: block; }

  .index__list { flex-direction: column; gap: 0; padding: 0; overflow: visible; }
  .index__list li + li { border-top: 1px solid var(--rule); }
  .index__list a { min-height: 44px; padding: 9px 0; white-space: normal; line-height: 1.25; }
  .index__list a[aria-current] { box-shadow: none; font-weight: 700; }
  .index__list a[aria-current]::after {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    margin-left: auto;
    background: var(--signal);
  }
  .index__no { min-width: 1.1em; font-size: 1.0625rem; }

  .index__cta { display: inline-flex; margin-top: auto; width: 100%; }

  .doc { justify-self: center; margin: 0; }
}

/* ---------- The grid ---------- */

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: var(--gap);
}

@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .margin { grid-column: 10 / 13; grid-row: 1 / span 2; align-self: start; }
}

/* ---------- Hero: page one of the sheet ---------- */

.hero {
  row-gap: 40px;
  align-items: start;
  padding-block: clamp(36px, 7vw, 96px) clamp(16px, 3vw, 40px);
}

.hero__title {
  font-size: var(--step-4);
  font-stretch: 80%;
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.hero__lead {
  margin-top: 24px;
  max-width: 54ch;
  font-size: var(--step-1);
  line-height: 1.5;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.hero__note {
  display: flex;
  align-items: baseline;
  gap: 10px;
  max-width: 60ch;
  margin-top: 18px;
  font-size: 0.9375rem;
  color: var(--ink-2);
}
.hero__note::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  background: var(--signal);
}

.hero__rules { display: none; }

.toc { margin-top: 8px; }
.toc li + li { border-top: 1px solid var(--rule); }

.toc__item {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 3px;
  padding: 12px 0;
  text-decoration: none;
}

.toc__n {
  grid-row: 1 / span 2;
  font-size: 2.125rem;
  font-stretch: 62%;
  font-weight: 800;
  line-height: 0.85;
  font-variant-numeric: tabular-nums;
}

.toc__t { font-size: 0.9375rem; font-stretch: 90%; font-weight: 600; line-height: 1.3; }
.toc__s { font-size: var(--step--1); font-stretch: 87%; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.toc__item:hover .toc__t { text-decoration: underline; text-underline-offset: 0.2em; }

@media (max-width: 599px) {
  .hero__actions .btn { width: 100%; }
}

@media (min-width: 900px) {
  .hero__main { grid-column: 1 / 9; }
  .hero__rules {
    display: block;
    grid-column: 9 / 13;
    padding-top: 10px;
    border-top: 2px solid var(--ink);
  }
}

/* ---------- Sections ---------- */

.sec { padding-top: clamp(64px, 9vw, 128px); }

.sec__head {
  row-gap: 20px;
  margin-bottom: clamp(32px, 5vw, 56px);
  padding-top: 18px;
  border-top: 2px solid var(--ink);
}

.sec__title {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  font-size: var(--step-3);
  font-stretch: 85%;
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.sec__no {
  flex: none;
  font-stretch: 62%;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.sec__lead { max-width: 60ch; font-size: var(--step-1); line-height: 1.5; }
.sec__note { font-size: 0.9375rem; line-height: 1.45; color: var(--ink-2); }

@media (min-width: 900px) {
  .sec__head .sec__title {
    grid-column: 1 / 10;
    display: grid;
    grid-template-columns: subgrid;
  }
  .sec__head .sec__no { grid-column: 1 / 3; }
  .sec__head .sec__t { grid-column: 3 / 10; }
  .sec__head .sec__lead { grid-column: 3 / 10; }
  .sec__note { padding-top: 10px; border-top: 1px solid var(--rule); }
}

/* ---------- 1: the five rules ---------- */

.refs { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; border-top: 1px solid var(--rule); }
.refs__list { display: grid; gap: 8px; }
.refs__list div { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); gap: 8px; }
.refs__list dt { font-stretch: 75%; font-weight: 800; letter-spacing: 0.04em; line-height: 1.4; }
.refs__list dd { font-size: 0.875rem; line-height: 1.4; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.refs__penalty { padding-top: 10px; border-top: 1px solid var(--rule); font-size: 0.875rem; line-height: 1.4; }
.src { display: block; margin-top: 2px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.clause {
  row-gap: 16px;
  padding-block: clamp(24px, 3vw, 40px);
  border-top: 1px solid var(--rule);
}
.clause:first-child { padding-top: 0; border-top: 0; }

.clause.grid { grid-template-columns: 3.5rem minmax(0, 1fr); }

.clause__n {
  grid-row: 1 / span 2;
  font-size: var(--numeral);
  font-stretch: 62%;
  font-weight: 800;
  line-height: 0.78;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.clause__body { min-width: 0; container-type: inline-size; }
.clause__src { grid-column: 2; }

.clause__title {
  font-size: var(--step-2);
  font-stretch: 88%;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.clause__pair { display: grid; gap: 18px; margin-top: 18px; }
.clause__pair > div { padding-top: 10px; border-top: 1px solid var(--ink); }
.clause__pair dt { margin-bottom: 6px; }

@container (min-width: 34rem) {
  .clause__pair { grid-template-columns: 1fr 1fr; gap: 28px; }
}

.clause__src {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
  font-stretch: 90%;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 900px) {
  .clause.grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .clause__n { grid-column: 1 / 3; grid-row: 1; }
  .clause__body { grid-column: 3 / 10; }
  .clause__src { grid-column: 10 / 13; grid-row: 1; align-self: start; border-top: 2px solid var(--ink); }
}

/* ---------- Cross-references to a rule ---------- */

.xref {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3em;
  min-height: 24px;
  font-size: var(--step--1);
  font-stretch: 80%;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-underline-offset: 0.25em;
  color: var(--ink);
}
.xref__n { font-stretch: 62%; font-size: 1.125rem; font-weight: 800; line-height: 1; }

/* ---------- 2: feature table ---------- */

.spec__row { row-gap: 8px; align-items: baseline; padding-block: 18px; border-top: 1px solid var(--rule); }
.spec__row--head { display: none; }

.spec__fn { font-size: var(--step-1); font-stretch: 85%; font-weight: 700; line-height: 1.2; }
.spec__desc { max-width: 62ch; }
.spec__status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }

.tag {
  display: inline-block;
  padding: 3px 7px 2px;
  border: 1.5px solid var(--signal);
  color: var(--signal);
  font-size: 0.75rem;
  font-stretch: 75%;
  font-weight: 800;
  letter-spacing: 0.07em;
  line-height: 1.25;
  text-transform: uppercase;
}

@media (min-width: 900px) {
  .spec__row--head { display: grid; padding-block: 0 10px; border-top: 0; border-bottom: 2px solid var(--ink); }
  .spec__list .spec__row:first-child { border-top: 0; }
  .spec__fn { grid-column: 1 / 4; }
  .spec__desc { grid-column: 4 / 10; }
  .spec__status { grid-column: 10 / 13; }
}

/* ---------- 3: offline diagram and the fault selector ---------- */

/* Below 900px the block is plain flow, not grid: a sticky grid item is bounded by its own grid area,
   so the diagram could not stay in view while the fault list scrolls under it. */
.offline.grid { display: block; }
.faults { margin-top: 28px; }

.dg {
  position: sticky;
  top: var(--strip-h);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

.dg__node {
  position: relative;
  min-width: 8.5rem;
  max-width: 100%;
  padding: 6px 12px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.875rem;
  font-stretch: 80%;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  transition: color 200ms var(--ease), border-color 200ms var(--ease);
}

.dg__node--hub {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: min(15rem, 100%);
  padding: 10px 14px;
}
.dg__name { font-size: 1rem; font-weight: 800; }
.dg__sub { font-size: 0.8125rem; font-stretch: 87%; font-weight: 500; color: var(--ink-2); }

/* A connector is two half-lines; a fault pulls them apart, so the break opens in the middle. */
.dg__link { position: relative; width: 2px; height: 26px; }
.dg__link::before,
.dg__link::after {
  content: "";
  position: absolute;
  left: 0;
  width: 2px;
  height: 50%;
  background: var(--ink);
  transition: transform 360ms var(--ease), background-color 200ms var(--ease);
}
.dg__link::before { top: 0; transform-origin: 50% 0; }
.dg__link::after { bottom: 0; transform-origin: 50% 100%; }
.dg__link--bus { height: 18px; }

.dg__row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 27rem;
  padding-top: 22px;
}
.dg__row::before {
  content: "";
  position: absolute;
  top: 0;
  left: calc((100% - 20px) / 6);
  right: calc((100% - 20px) / 6);
  height: 2px;
  background: var(--ink);
}

.dg__node--p { min-width: 0; padding: 6px; font-size: 0.8125rem; overflow-wrap: anywhere; }
.dg__node--p::before {
  content: "";
  position: absolute;
  top: -24px;
  left: calc(50% - 1px);
  width: 2px;
  height: 22px;
  background: var(--ink);
  transform-origin: 50% 0;
  transition: transform 360ms var(--ease), background-color 200ms var(--ease);
}

.dg__flag {
  display: none;
  margin-top: 4px;
  padding: 3px 8px 2px;
  background: var(--signal);
  color: var(--paper);
  font-size: 0.75rem;
  font-stretch: 75%;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.25;
  text-transform: uppercase;
}

.dg__ups {
  display: none;
  position: absolute;
  top: -0.8em;
  right: 6px;
  padding: 0 4px;
  background: var(--paper);
  color: var(--signal);
  font-size: 0.6875rem;
  font-stretch: 75%;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.4;
  text-transform: uppercase;
}

/* Fault 1, internet down: the line to the tax office breaks, receipts wait for JIR in the queue. */
.offline:has(#kvar-1:checked) .dg__link--wan::before,
.offline:has(#kvar-1:checked) .dg__link--wan::after { transform: scaleY(0.3); background: var(--signal); }
.offline:has(#kvar-1:checked) .dg__flag--queue,
.offline:has(#kvar-2:checked) .dg__flag--queue { display: block; }

/* Fault 2, the tax office does not answer. */
.offline:has(#kvar-2:checked) .dg__node--cis { border-style: dashed; border-color: var(--signal); color: var(--signal); }
.offline:has(#kvar-2:checked) .dg__link--wan::after { transform: scaleY(0.3); background: var(--signal); }

/* Fault 3, power cut: what the small UPS keeps running stays solid, the rest goes dashed. */
.offline:has(#kvar-3:checked) .ups { border-color: var(--signal); }
.offline:has(#kvar-3:checked) .ups > .dg__ups { display: block; }
.offline:has(#kvar-3:checked) .mains { border-style: dashed; border-color: var(--ink-3); color: var(--ink-3); }
.offline:has(#kvar-3:checked) .mains::before { transform: scaleY(0.3); background: var(--ink-3); }

/* Fault 4, kitchen printer out of paper: the register raises the alarm, the ticket waits. */
.offline:has(#kvar-4:checked) .dg__node--kuhinja { border-style: dashed; border-color: var(--signal); color: var(--signal); }
.offline:has(#kvar-4:checked) .dg__node--kuhinja::before { transform: scaleY(0.3); background: var(--signal); }
.offline:has(#kvar-4:checked) .dg__flag--alarm { display: block; }

.faults__legend { margin-bottom: 12px; }

.fault {
  position: relative;
  display: grid;
  grid-template-columns: 1.375rem minmax(0, 1fr);
  column-gap: 14px;
  row-gap: 6px;
  padding: 14px 12px;
  border-top: 1px solid var(--rule);
  transition: background-color 200ms var(--ease);
}
.fault:hover { background: var(--paper-2); }
.fault:has(input:checked) { background: var(--signal-tint); }

.fault input {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  place-content: center;
  grid-column: 1;
  grid-row: 1;
  width: 1.375rem;
  height: 1.375rem;
  margin: 0.1rem 0 0;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  cursor: pointer;
}
.fault input::before {
  content: "";
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--signal);
  transform: scale(0);
  transition: transform 160ms var(--ease);
}
.fault input:checked { border-color: var(--signal); }
.fault input:checked::before { transform: scale(1); }

.fault__t {
  grid-column: 2;
  font-size: var(--step-1);
  font-stretch: 88%;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
}
/* The whole row selects the fault; the cross-reference link sits above that layer. */
.fault__t::after { content: ""; position: absolute; inset: 0; }
.fault--normal .fault__t { font-weight: 600; }
.fault__b { grid-column: 2; max-width: 60ch; }
.fault .xref { grid-column: 2; justify-self: start; position: relative; z-index: 1; }

@media (max-width: 899px) and (max-height: 700px) {
  .dg { position: static; }
}

@media (min-width: 900px) {
  .offline.grid { display: grid; align-items: start; }
  .faults { margin-top: 0; }
  .dg {
    grid-column: 7 / 13;
    grid-row: 1;
    top: calc(var(--strip-h) + 16px);
    padding: 28px 20px;
    border: 1px solid var(--ink);
  }
  .faults { grid-column: 1 / 7; grid-row: 1; }
}

@media (min-width: 1200px) {
  .dg { top: 24px; }
}

/* ---------- 4: owner and accountant ---------- */

.owner { row-gap: 32px; align-items: start; }
/* One or two columns by the room actually available, never two squeezed ones. */
.owner__items { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); column-gap: var(--gap); }
.owner__item { padding-block: 16px 24px; border-top: 1px solid var(--ink); }
.owner__item h3 { margin-bottom: 8px; font-size: var(--step-1); font-stretch: 88%; font-weight: 700; line-height: 1.2; }

/* The drawer count as an empty ledger form: operators and lines, never invented amounts. */
.ledger { padding: 16px 16px 20px; border: 1px solid var(--ink); }
.ledger__title { margin-bottom: 6px; }
.ledger__block + .ledger__block { margin-top: 20px; }
.ledger__row {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr) 3.5rem;
  align-items: end;
  gap: 8px;
  padding-block: 7px 3px;
  font-size: 0.9375rem;
  font-stretch: 90%;
  line-height: 1.3;
}
.ledger__row::after { content: ""; height: 1px; margin-bottom: 4px; background: var(--ink-2); }
.ledger__op { font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.ledger__row--sum { margin-top: 4px; border-top: 1px solid var(--ink); font-weight: 700; }
.ledger__row--total { padding-bottom: 6px; border-bottom: 3px double var(--ink); font-weight: 800; }

@media (min-width: 900px) {
  .owner__items { grid-column: 3 / 9; }
  .ledger { grid-column: 9 / 13; }
}

/* ---------- 5: first version, later, and the pilot criteria ---------- */

.phase { row-gap: 32px; }
.phase__label { margin-bottom: 4px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.phase__col--later .phase__label { border-bottom-style: dashed; }

.phase__list li { position: relative; padding: 10px 0 10px 22px; border-bottom: 1px solid var(--rule); }
.phase__list li::before {
  content: "";
  position: absolute;
  top: 1.05em;
  left: 0;
  width: 8px;
  height: 8px;
  background: var(--ink);
}
.phase__col--later .phase__list li { color: var(--ink-2); }
.phase__col--later .phase__list li::before { background: transparent; border: 1.5px solid var(--ink-2); }

@media (min-width: 900px) {
  .phase__col--now { grid-column: 3 / 8; }
  .phase__col--later { grid-column: 8 / 13; }
}

.crit { margin-top: clamp(56px, 7vw, 96px); }
.crit__head { row-gap: 12px; margin-bottom: 20px; }
.crit__title { font-size: var(--step-2); font-stretch: 88%; font-weight: 750; line-height: 1.15; letter-spacing: -0.01em; }
.crit__lead { max-width: 60ch; }

@media (min-width: 900px) {
  .crit__title,
  .crit__lead { grid-column: 3 / 10; }
}

.crit__table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.crit__table th,
.crit__table td { padding: 12px 14px 12px 0; text-align: left; vertical-align: top; }
.crit__table thead th {
  padding-block: 0 10px;
  border-bottom: 2px solid var(--ink);
  font-size: var(--step--1);
  font-stretch: 75%;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--ink-2);
}
.crit__table tbody tr { border-top: 1px solid var(--rule); }
.crit__table tbody tr:first-child { border-top: 0; }

.crit__id { width: 3rem; }
tbody .crit__id { font-size: 1.375rem; font-stretch: 62%; font-weight: 800; line-height: 1.1; }
.crit__param { font-weight: 600; }
.crit__method { color: var(--ink-2); }
.crit__method .xref { margin-left: 0.6em; }
.crit__target { font-stretch: 85%; font-weight: 800; }
.crit__cap { display: none; }

.crit__note {
  display: inline-block;
  max-width: 60ch;
  margin-top: 18px;
  padding: 8px 12px;
  border: 1.5px solid var(--signal);
  color: var(--signal);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
}

@media (min-width: 700px) {
  .crit__table thead th:nth-child(2) { width: 38%; }
  .crit__table thead th:nth-child(3) { width: 36%; }
}

@media (max-width: 699px) {
  .crit__table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  /* Explicit ARIA roles in the markup keep the table semantics when the rows restack. */
  .crit__table,
  .crit__table tbody { display: block; }
  .crit__table tr {
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr);
    column-gap: 10px;
    padding-block: 14px;
  }
  .crit__table th,
  .crit__table td { padding: 0; }
  .crit__id { grid-row: 1 / span 3; width: auto; }
  .crit__param,
  .crit__method,
  .crit__target { grid-column: 2; }
  .crit__method,
  .crit__target { margin-top: 8px; }
  .crit__cap {
    display: block;
    margin-bottom: 2px;
    font-size: 0.75rem;
    font-stretch: 75%;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-2);
  }
  .crit__method .xref { margin-left: 0; display: flex; }
}

/* ---------- 6: switching over, stations in a fixed order ---------- */

.stations { display: grid; }

.station { position: relative; padding: 0 0 28px 38px; }
.station::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 0;
  left: 7px;
  width: 2px;
  background: var(--ink);
}
.station:last-child::before { display: none; }
.station::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 0;
  width: 16px;
  height: 16px;
  border: 2px solid var(--ink);
  background: var(--paper);
}
.station__n {
  display: block;
  margin-bottom: 6px;
  font-size: 2.25rem;
  font-stretch: 62%;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.station h3 { margin-bottom: 8px; font-size: var(--step-1); font-stretch: 88%; font-weight: 700; line-height: 1.2; }

@media (min-width: 900px) {
  .stations { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--gap); }
  .station { padding: 32px 0 0; }
  .station::before,
  .station:last-child::before {
    display: block;
    top: 7px;
    bottom: auto;
    left: 0;
    right: calc(-1 * var(--gap));
    width: auto;
    height: 2px;
  }
  .station:last-child::before { right: 0; }
  .station::after { top: 0; }
}

/* ---------- 7: optional integration, dashed like an optional part on a schematic ---------- */

.opt { padding: clamp(20px, 3vw, 36px); border: 2px dashed var(--ink-2); }
.opt .sec__title { font-size: var(--step-2); }
.opt__lead { max-width: 62ch; margin-top: 12px; }
.opt__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr)); gap: 16px var(--gap); margin-top: 22px; }
.opt__list li { padding-top: 10px; border-top: 1px solid var(--ink); }
.opt__list h3 { margin-bottom: 6px; font-size: 1rem; font-stretch: 88%; font-weight: 700; line-height: 1.25; }
.opt__list p { font-size: 0.9375rem; color: var(--ink-2); }
.opt__note { max-width: 62ch; margin-top: 18px; font-size: 0.9375rem; color: var(--ink-2); }

@media (min-width: 900px) {
  .sec--opt { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); }
  .opt { grid-column: 3 / 11; }
}

/* ---------- 8: the pilot, the one panel printed on the signal colour ---------- */

.sec--pilot {
  margin-top: clamp(64px, 9vw, 128px);
  margin-inline: calc(-1 * var(--gutter));
  padding: clamp(40px, 6vw, 80px) var(--gutter) clamp(48px, 7vw, 96px);
  background: var(--signal);
  color: var(--paper);
}
.sec--pilot ::selection { background: var(--paper); color: var(--signal); }
.sec--pilot :focus-visible { outline-color: var(--paper); }
.sec--pilot .sec__head { border-top-color: var(--paper); }
.sec--pilot .sec__no { color: var(--signal-ink-2); }

.pilot { row-gap: 32px; }
.pilot__who li {
  position: relative;
  padding: 12px 0 12px 24px;
  border-top: 1px solid rgba(242, 243, 239, 0.45);
}
.pilot__who li:last-child { border-bottom: 1px solid rgba(242, 243, 239, 0.45); }
.pilot__who li::before {
  content: "";
  position: absolute;
  top: 1.1em;
  left: 0;
  width: 8px;
  height: 8px;
  background: var(--paper);
}

.pilot__act { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.pilot__contact { font-size: var(--step-1); font-weight: 700; line-height: 1.35; }

@media (min-width: 900px) {
  .pilot__who,
  .pilot__act { grid-column: 3 / 10; }
}

/* ---------- Footer ---------- */

.doc-foot {
  display: grid;
  gap: 12px 24px;
  padding: 28px var(--gutter) 36px;
  border-top: 6px solid var(--ink);
  font-size: var(--step--1);
  line-height: 1.45;
  color: var(--ink-2);
}
.doc-foot__name { margin-right: 0.75em; font-weight: 800; color: var(--ink); }
.doc-foot__top { justify-self: start; display: inline-flex; align-items: center; min-height: 24px; font-weight: 700; color: var(--ink); }

@media (min-width: 900px) {
  .doc-foot { grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; }
}

/* ---------- Motion and print ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .index,
  .skip,
  .doc-head__cta,
  .hero__actions { display: none; }
  .dg { position: static; }
  .sec--pilot { background: none; color: var(--ink); border-top: 2px solid var(--ink); }
}
