:root {
  --bg: #f7f8f6;
  --paper: #ffffff;
  --ink: #18201d;
  --muted: #5b6661;
  --line: #d9ded9;
  --line-strong: #aeb8b1;
  --accent: #245c73;
  --accent-2: #6f4e7c;
  --ok: #2f6f4e;
  --warn: #8a5a16;
  --todo-bg: #fff8e7;
  --todo-line: #e4c16c;
  --code: #eef2ef;
  --shadow: 0 14px 34px rgba(24, 32, 29, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: #fbfcfa;
  overflow: auto;
}

.brand {
  display: block;
  margin-bottom: 24px;
  color: var(--ink);
}

.brand strong {
  display: block;
  font-size: 16px;
  line-height: 1.25;
}

.brand span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.nav-group {
  margin: 0 0 22px;
}

.nav-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-link {
  display: block;
  padding: 7px 9px;
  border-radius: 6px;
  color: #24302c;
  font-size: 14px;
}

.nav-link[aria-current="page"] {
  background: #e7eeeb;
  color: #173f50;
  font-weight: 700;
}

.content {
  width: min(1120px, 100%);
  padding: 42px 48px 80px;
}

.hero {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.18;
  letter-spacing: 0;
}

h1 {
  max-width: 900px;
  font-size: clamp(34px, 5vw, 58px);
}

h2 {
  margin-top: 42px;
  padding-top: 8px;
  font-size: 28px;
}

h3 {
  margin-top: 24px;
  font-size: 19px;
}

p {
  max-width: 860px;
}

.lede {
  max-width: 880px;
  color: #31403b;
  font-size: 19px;
}

.section {
  margin-top: 34px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.card h3 {
  margin-top: 0;
}

.note,
.todo,
.decision,
.critical-note {
  margin: 20px 0;
  padding: 15px 16px;
  border-radius: 8px;
}

.note {
  border: 1px solid #bed3d9;
  background: #eef7f8;
}

.todo {
  border: 1px solid var(--todo-line);
  background: var(--todo-bg);
}

.decision {
  border: 1px solid #b9cbbf;
  background: #edf6ef;
}

.critical-note {
  border: 1px solid #d4a3a0;
  background: #fff1f0;
  color: #681f1a;
  font-weight: 700;
}

.todo strong,
.note strong,
.decision strong,
.critical-note strong {
  display: block;
  margin-bottom: 4px;
}

.figure {
  margin: 24px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.figure img {
  display: block;
  width: 100%;
  max-height: 620px;
  object-fit: contain;
  border-radius: 6px;
  background: #111;
}

.figure figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.storyboard {
  margin: 24px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #070807;
}

.storyboard a {
  display: block;
}

.storyboard img {
  display: block;
  width: 100%;
  border-radius: 6px;
  background: #000;
}

.storyboard figcaption {
  margin-top: 12px;
  color: #d6ddd8;
  font-size: 13px;
}

.storyboard figcaption a {
  display: inline;
  color: #a9d7e6;
}

.sample-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.sample-strip img {
  width: 100%;
  height: 210px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
}

table {
  width: 100%;
  margin: 20px 0;
  border-collapse: collapse;
  border: 1px solid var(--line);
  background: var(--paper);
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #edf0ed;
  font-size: 13px;
}

code {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--code);
  font-size: 0.92em;
}

pre {
  overflow: auto;
  padding: 16px;
  border-radius: 8px;
  background: #17211d;
  color: #eef5f1;
  font-size: 13px;
}

pre code {
  display: block;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  line-height: 1.55;
}

.flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.flow span {
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  font-size: 13px;
}

.clean-diagram {
  margin: 24px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  overflow-x: auto;
}

.diagram-svg {
  display: block;
  width: 100%;
  min-width: 920px;
  height: auto;
}

.workflow-svg {
  min-width: 680px;
}

.sequence-svg {
  min-width: 900px;
}

.diagram-svg text {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  fill: var(--ink);
}

.diagram-svg .label {
  font-size: 16px;
  font-weight: 800;
}

.diagram-svg .small {
  fill: var(--muted);
  font-size: 12px;
}

.diagram-svg .tiny {
  fill: var(--muted);
  font-size: 11px;
}

.diagram-svg .boundary-title {
  fill: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.diagram-svg .box {
  fill: #ffffff;
  stroke: #b9c2bb;
  stroke-width: 1.4;
  rx: 10;
}

.diagram-svg .soft {
  fill: #f5f7f5;
}

.diagram-svg .blue {
  fill: #edf7fb;
  stroke: #9fc7d3;
}

.diagram-svg .green {
  fill: #eef8f1;
  stroke: #9fc6aa;
}

.diagram-svg .amber {
  fill: #fff8e8;
  stroke: #dec06e;
}

.diagram-svg .violet {
  fill: #f6eff9;
  stroke: #c5a8d4;
}

.diagram-svg .red {
  fill: #fff0ef;
  stroke: #daa4a0;
}

.diagram-svg .dark {
  fill: #1d2723;
  stroke: #1d2723;
}

.diagram-svg .dark-text {
  fill: #ffffff;
}

.diagram-svg .boundary {
  fill: rgba(255, 255, 255, 0.58);
  stroke: #aeb8b1;
  stroke-width: 2;
  rx: 18;
}

.diagram-svg .dashed {
  stroke-dasharray: 8 7;
}

.diagram-svg .arrow {
  fill: none;
  stroke: #52615b;
  stroke-width: 2;
  marker-end: url(#arrow);
}

.diagram-svg .audit-arrow {
  fill: none;
  stroke: #6f4e7c;
  stroke-width: 1.8;
  stroke-dasharray: 7 6;
  marker-end: url(#audit-arrow);
}

.diagram-svg .report-arrow {
  fill: none;
  stroke: #8a5a16;
  stroke-width: 2;
  marker-end: url(#report-arrow);
}

.diagram-svg .context-arrow {
  fill: none;
  stroke: #2f6f4e;
  stroke-width: 2;
  marker-end: url(#context-arrow);
}

.diagram-svg .divider {
  stroke: #c43f36;
  stroke-width: 3;
}

.diagram-svg .divider-text {
  fill: #a93630;
  font-size: 12px;
  font-weight: 800;
}

.diagram-svg .lifeline {
  stroke: #aeb8b1;
  stroke-dasharray: 6 7;
  stroke-width: 1.2;
}

.diagram-svg .message {
  fill: none;
  stroke: #52615b;
  stroke-width: 1.7;
  marker-end: url(#seq-arrow);
}

.diagram-svg .message.audit {
  stroke: #6f4e7c;
  marker-end: url(#seq-audit-arrow);
}

.diagram-svg .message.report {
  stroke: #8a5a16;
  marker-end: url(#seq-report-arrow);
}

.diagram-svg .message-label {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.diagram-svg a rect,
.diagram-svg a path.box {
  transition: stroke 140ms ease, filter 140ms ease, transform 140ms ease;
}

.diagram-svg a:hover rect,
.diagram-svg a:focus rect,
.diagram-svg a:hover path.box,
.diagram-svg a:focus path.box {
  stroke: var(--accent);
  stroke-width: 2.4;
  filter: drop-shadow(0 7px 10px rgba(36, 92, 115, 0.14));
}

.diagram {
  margin: 24px 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f6f4;
}

.diagram h2 {
  margin-top: 0;
  padding-top: 0;
}

.diagram-grid {
  display: grid;
  grid-template-columns: 1fr auto 1.4fr auto 2.2fr;
  gap: 12px;
  align-items: center;
}

.diagram-product {
  padding: 14px;
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
}

.diagram-product-title {
  margin: 0 0 12px;
  font-weight: 800;
}

.diagram-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.diagram-bottom {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  max-width: 860px;
  margin: 18px 0 0 auto;
}

.diagram-box {
  display: block;
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

a.diagram-box:hover,
a.diagram-box:focus-visible,
a.workflow-step:hover,
a.workflow-step:focus-visible,
a.workflow-choice:hover,
a.workflow-choice:focus-visible,
.diagram-pills a:hover,
.diagram-pills a:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(36, 92, 115, 0.14);
  text-decoration: none;
  transform: translateY(-1px);
}

a.diagram-box:focus-visible,
a.workflow-step:focus-visible,
a.workflow-choice:focus-visible,
.diagram-pills a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.diagram-box strong {
  display: block;
  margin-bottom: 4px;
}

.diagram-box small {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.diagram-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.diagram-pills span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8faf8;
  font-size: 12px;
  white-space: nowrap;
}

.diagram-pills a {
  display: inline-block;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8faf8;
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
  text-decoration: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.diagram-arrow {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 76px;
  color: var(--muted);
  font-size: 12px;
}

.diagram-arrow::before {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line-strong);
}

.diagram-arrow::after {
  content: ">";
  color: var(--line-strong);
  font-weight: 800;
}

.workflow-diagram {
  max-width: 820px;
  margin: 24px auto;
}

.workflow-step {
  display: block;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.workflow-step strong,
.workflow-choice strong {
  display: block;
}

.workflow-step small,
.workflow-choice small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.workflow-down {
  margin: 6px 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.workflow-down::after {
  content: "↓";
  display: block;
  color: var(--line-strong);
  font-size: 20px;
  line-height: 1;
}

.workflow-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.workflow-choice {
  display: block;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.tone-amber { background: #fff7e6; border-color: #e7c576; }
.tone-blue { background: #eef6ff; border-color: #aac7e8; }
.tone-violet { background: #f5effa; border-color: #cab0da; }
.tone-green { background: #eef8f1; border-color: #a9ceb5; }
.tone-yellow { background: #fff9df; border-color: #dec56b; }
.tone-red { background: #fff0f0; border-color: #e3adad; }
.tone-sky { background: #edf8fb; border-color: #a9d4df; }
.tone-dark { background: #17211d; border-color: #17211d; color: #fff; }
.tone-dark small { color: #d2d8d5; }

.mock {
  display: grid;
  grid-template-columns: minmax(280px, 1.25fr) minmax(260px, 0.75fr);
  min-height: 420px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}

.mock-viewer {
  position: relative;
  display: grid;
  place-items: center;
  background: #101312;
}

.mock-viewer img {
  width: 100%;
  max-height: 500px;
  object-fit: contain;
}

.roi {
  position: absolute;
  border: 2px solid #e9c44a;
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(16, 19, 18, 0.12);
}

.roi.one {
  top: 34%;
  left: 44%;
  width: 18%;
  height: 20%;
}

.roi.two {
  top: 48%;
  left: 25%;
  width: 16%;
  height: 14%;
}

.mock-panel {
  padding: 18px;
  border-left: 1px solid var(--line);
}

.status-list {
  padding-left: 20px;
}

.status-list li {
  margin: 8px 0;
}

.tag {
  display: inline-block;
  margin: 0 6px 6px 0;
  padding: 4px 7px;
  border-radius: 999px;
  background: #e9eeeb;
  color: #2b3833;
  font-size: 12px;
  font-weight: 700;
}

.footer {
  margin-top: 60px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 900px) {
  .layout {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .content {
    padding: 28px 20px 56px;
  }

  .grid,
  .grid.three,
  .sample-strip,
  .mock,
  .diagram-grid,
  .diagram-row,
  .diagram-bottom,
  .workflow-choices {
    grid-template-columns: 1fr;
  }

  .diagram-arrow {
    justify-content: center;
    min-height: 28px;
  }

  .diagram-arrow::before {
    display: none;
  }

  .diagram-arrow::after {
    content: "↓";
  }

  .mock-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
