@font-face {
  font-family: "Lab Grotesque";
  font-style: normal;
  font-weight: 300;
  src: url("fonts/LabGrotesque-Light.woff2") format("woff2");
}
@font-face {
  font-family: "Lab Grotesque";
  font-style: normal;
  font-weight: 400;
  src: url("fonts/LabGrotesque-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Lab Grotesque";
  font-style: normal;
  font-weight: 700;
  src: url("fonts/LabGrotesque-Bold.woff2") format("woff2");
}
@font-face {
  font-family: "Lab Grotesque Mono";
  font-style: normal;
  font-weight: 400;
  src: url("fonts/LabGrotesqueMono-Regular.woff2") format("woff2");
}

:root {
  --bg: #eef3f7;
  --paper: #ffffff;
  --panel: #f6f9fc;
  --panel-strong: #eef4f9;
  --navy: #071d34;
  --text: #17263a;
  --muted: #5b6f83;
  --accent: #1e6fb3;
  --accent-soft: #e3f0fb;
  --border: #cbd8e5;
  --border-strong: #9fb5c9;
  --shadow: 0 28px 70px rgba(35, 55, 78, 0.13);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
body {
  margin: 0;
  font-family: "Lab Grotesque", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(30, 111, 179, 0.08), transparent 32%),
    linear-gradient(180deg, #f8fbfd 0%, var(--bg) 100%);
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }

.site-shell {
  min-height: 100vh;
}
.side-rail {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  width: 320px;
  height: 100vh;
  padding: 28px 24px;
  border-right: 1px solid var(--border);
  background: rgba(248, 251, 253, 0.94);
  overflow: auto;
}
.brand {
  padding: 20px;
  border: 1px solid var(--border);
  background: var(--paper);
}
.brand h2 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 30px;
}
.brand p:last-child, .rail-note p { color: var(--muted); margin-bottom: 0; }
.eyebrow {
  margin: 0 0 10px;
  font-family: "Lab Grotesque Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-nav {
  display: grid;
  gap: 6px;
  margin: 20px 0;
}
.nav-link {
  display: block;
  padding: 10px 12px;
  border: 1px solid transparent;
  color: var(--text);
  background: linear-gradient(90deg, rgba(255,255,255,0.88), transparent);
}
.nav-link.is-active {
  color: var(--navy);
  border-color: var(--border-strong);
  box-shadow: inset 3px 0 0 var(--accent);
  background: var(--accent-soft);
}
.rail-note {
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: var(--panel);
}
.document {
  max-width: 1480px;
  width: calc(100% - 320px);
  min-width: 0;
  margin: 0 0 0 320px;
  padding: 32px;
  overflow-x: hidden;
}
.hero, .content-section, p, .case-list, .table-wrap, .scenario-block, .topology-figure {
  max-width: 1180px;
}
.hero,
.content-section,
td[id] {
  scroll-margin-top: 24px;
}
.hero {
  padding: 34px 36px;
  border: 1px solid var(--border);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.hero h1 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1;
}
.hero-meta { margin: 4px 0; color: var(--muted); font-size: 18px; }
.content-section { margin-top: 38px; }
h2, h3, h4 {
  color: var(--navy);
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
h2 {
  margin: 0 0 16px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 30px;
}
h3 { margin-top: 28px; font-size: 22px; }
h4 { margin-top: 22px; font-size: 18px; color: var(--accent); }
p, li { font-size: 17px; }
p, li, td, th {
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

a,
code,
.id-link {
  overflow-wrap: anywhere;
}
.id-link {
  display: inline-block;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}
code {
  font-family: "Lab Grotesque Mono", Consolas, monospace;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 4px;
}
.case-list {
  padding: 16px 20px 16px 34px;
  border: 1px solid var(--border);
  background: var(--panel);
}
.case-list li { margin: 6px 0; }
.table-wrap {
  margin: 18px 0 28px;
  border: 1px solid var(--border);
  background: var(--paper);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}
.wide-table table, .stories-table table, .trace-table table { min-width: 1180px; }
.categorized-table table th:nth-child(1),
.categorized-table table td:nth-child(1) { width: 88px; }
.categorized-table table th:nth-child(2),
.categorized-table table td:nth-child(2) { width: 150px; }
.categorized-table table th:last-child,
.categorized-table table td:last-child { width: 118px; }
.categorized-table table th:nth-child(3),
.categorized-table table td:nth-child(3),
.categorized-table table th:nth-child(4),
.categorized-table table td:nth-child(4) { width: auto; }

.stories-table table th:nth-child(1),
.stories-table table td:nth-child(1) { width: 88px; }
.stories-table table th:nth-child(2),
.stories-table table td:nth-child(2) { width: 112px; }
.stories-table table th:nth-child(3),
.stories-table table td:nth-child(3) { width: 280px; }
.wide-table table th:nth-child(2),
.wide-table table td:nth-child(2) { width: 230px; }

.categorized-table table th:nth-child(2),
.categorized-table table td:nth-child(2),
.stories-table table th:nth-child(3),
.stories-table table td:nth-child(3),
.wide-table table th:nth-child(2),
.wide-table table td:nth-child(2) {
  overflow-wrap: normal;
  word-break: normal;
}

.trace-table table th:nth-child(1),
.trace-table table td:nth-child(1),
.trace-table table th:nth-child(2),
.trace-table table td:nth-child(2) { width: 92px; }
.trace-table table th:nth-child(3),
.trace-table table td:nth-child(3) { width: 430px; }
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
  font-size: 14.5px;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--navy);
  background: #e8f1f9;
  font-weight: 700;
}
tr:nth-child(even) td { background: #f8fbfd; }
td:first-child, th:first-child {
  min-width: 86px;
  font-family: "Lab Grotesque Mono", monospace;
  color: var(--navy);
}
.id-link {
  display: inline-flex;
  padding: 1px 4px;
  border: 1px solid rgba(30, 111, 179, 0.2);
  background: rgba(30, 111, 179, 0.07);
  font-family: "Lab Grotesque Mono", monospace;
  font-size: 0.92em;
}
td:target {
  outline: 3px solid rgba(30, 111, 179, 0.32);
  background: #fff7df !important;
}
.scenario-block {
  padding: 16px 18px;
  overflow: auto;
  border: 1px solid var(--border);
  background: #0d1b2a;
  color: #edf6ff;
}
.scenario-block code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-family: "Lab Grotesque Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}
.gherkin-keyword {
  color: #ffffff;
  font-weight: 800;
}
.topology-figure {
  margin: 18px 0 28px;
  padding: 16px;
  border: 1px solid var(--border);
  background: var(--paper);
}
.topology-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  background: white;
}
.topology-figure figcaption {
  margin-top: 10px;
  font-family: "Lab Grotesque Mono", monospace;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1800px) {
  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  table,
  .wide-table table,
  .stories-table table,
  .trace-table table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  thead {
    display: none;
  }

  tr {
    margin-bottom: 14px;
    border: 1px solid var(--border);
    background: var(--paper);
  }

  td {
    display: block;
    width: 100% !important;
    border-right: 0;
    font-size: 14px;
  }

  .categorized-table table th,
  .categorized-table table td,
  .stories-table table th,
  .stories-table table td,
  .wide-table table th,
  .wide-table table td,
  .trace-table table th,
  .trace-table table td,
  .compact-table table th,
  .compact-table table td {
    width: 100% !important;
  }

  td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 6px;
    font-family: "Lab Grotesque Mono", monospace;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--muted);
  }

  td:first-child {
    min-width: 0;
    background: var(--accent-soft);
  }
}

@media (max-width: 960px) {
  .side-rail {
    position: static;
    width: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .section-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .document {
    width: 100%;
    margin: 0;
    padding: 18px;
  }
  .document,
  .hero,
  .content-section,
  p,
  .case-list,
  .table-wrap,
  .scenario-block,
  .topology-figure {
    max-width: 100%;
  }
  .hero { padding: 26px 22px; }

  h2 {
    font-size: 25px;
    line-height: 1.18;
  }

  h3 {
    font-size: 20px;
    line-height: 1.22;
  }

  td {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

@media print {
  .side-rail { display: none; }
  .site-shell { display: block; }
  .document { padding: 0; max-width: none; }
  .table-wrap { overflow: visible; }
}
