:root {
  --paper: #e9e9e6;
  --panel: #f7f7f4;
  --ink: #171717;
  --deep: #090909;
  --muted: rgba(23, 23, 23, 0.62);
  --line: rgba(23, 23, 23, 0.11);
  --strong-line: rgba(23, 23, 23, 0.78);
  --accent: #ff6a1a;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 118px;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 650;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--paper);
  background-size: 42px 42px;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3,
strong,
.eyebrow,
.toc,
.top-actions,
.meta-table,
table,
.callout,
.north-star {
  font-family: var(--mono);
  letter-spacing: 0;
}

p,
li,
td {
  color: var(--muted);
  line-height: 1.58;
}

h4 {
  margin: 0 0 8px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 950;
}

.wrap {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--strong-line);
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    rgba(247, 247, 244, 0.94);
  background-size: 30px 30px;
  backdrop-filter: blur(16px);
}

.accent-line {
  height: 4px;
  background: var(--accent);
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand strong {
  font-size: clamp(1.05rem, 1.4vw, 1.46rem);
  font-weight: 950;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.top-actions a {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 8px 10px;
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.prd-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 890px);
  justify-content: center;
  gap: 28px;
  align-items: start;
  padding: 26px 0 70px;
}

.toc {
  position: sticky;
  top: 104px;
  display: grid;
  max-height: calc(100vh - 128px);
  gap: 10px;
  overflow: auto;
  border: 1px solid var(--strong-line);
  background: rgba(247, 247, 244, 0.92);
  padding: 12px;
}

.toc span {
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.toc-group {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(23, 23, 23, 0.08);
  background: rgba(233, 233, 230, 0.22);
  padding: 7px;
}

.toc a {
  border: 1px solid var(--line);
  background: rgba(247, 247, 244, 0.78);
  color: var(--muted);
  padding: 8px 9px;
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 850;
}

.toc-main {
  color: var(--ink) !important;
  font-size: 0.72rem !important;
  font-weight: 950 !important;
}

.toc-sublist {
  display: grid;
  gap: 4px;
  padding-left: 10px;
  border-left: 2px solid rgba(255, 106, 26, 0.28);
}

.toc-group.is-section-active .toc-sublist,
.toc-group:hover .toc-sublist {
  display: grid;
}

.toc-sub {
  border-color: transparent !important;
  background: transparent !important;
  padding: 5px 7px !important;
  color: rgba(23, 23, 23, 0.56) !important;
  font-size: 0.65rem !important;
  line-height: 1.25;
}

.toc a:hover,
.toc a.is-active {
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: inset 4px 0 0 var(--accent);
}

.toc-group.is-section-active {
  border-color: rgba(255, 106, 26, 0.48);
  background: rgba(255, 106, 26, 0.045);
}

.toc-group.is-section-active .toc-main {
  color: var(--ink) !important;
  border-color: var(--ink);
  box-shadow: inset 4px 0 0 var(--accent);
}

.toc-sub.is-active {
  color: var(--accent) !important;
  border-color: rgba(255, 106, 26, 0.42) !important;
  background: rgba(255, 106, 26, 0.07) !important;
  box-shadow: inset 3px 0 0 var(--accent) !important;
}

.prd-content {
  min-width: 0;
  background: transparent;
}

.doc-section {
  position: relative;
  margin-bottom: 34px;
  border: 1px solid var(--strong-line);
  background:
    linear-gradient(90deg, rgba(255, 106, 26, 0.05), transparent 36%),
    rgba(247, 247, 244, 0.96);
  padding: clamp(22px, 3vw, 34px);
  box-shadow: 10px 10px 0 rgba(23, 23, 23, 0.055);
}

.doc-section::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: var(--accent);
  opacity: 0.88;
}

.doc-section:last-child {
  margin-bottom: 0;
}

.eyebrow,
.callout span,
.north-star span {
  display: block;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

h1 {
  max-width: 11ch;
  margin: 10px 0 16px;
  color: var(--deep);
  font-size: clamp(3.2rem, 6vw, 6rem);
  line-height: 0.9;
}

h2 {
  margin: 6px 0 18px;
  color: var(--ink);
  font-size: clamp(2rem, 3.2vw, 3.45rem);
  line-height: 0.94;
}

h3 {
  position: relative;
  margin: 28px 0 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255, 106, 26, 0.12), transparent 44%),
    rgba(233, 233, 230, 0.34);
  padding: 12px 12px 12px 16px;
  font-size: clamp(1rem, 1.4vw, 1.18rem);
}

h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--accent);
}

.lead {
  max-width: 74ch;
  color: rgba(23, 23, 23, 0.72);
  font-size: clamp(1rem, 1.15vw, 1.13rem);
  font-weight: 720;
}

.meta-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 22px;
  border: 1px solid var(--strong-line);
  background: rgba(233, 233, 230, 0.34);
}

.meta-table div {
  min-height: 72px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.meta-table b {
  display: block;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.meta-table span {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 850;
  line-height: 1.28;
}

.process-figure {
  margin: 20px 0 18px;
  border: 1px solid var(--strong-line);
  background: rgba(233, 233, 230, 0.24);
}

.process-figure img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  object-position: center;
  border-bottom: 1px solid var(--line);
}

.process-figure figcaption {
  padding: 10px 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1.35;
  text-transform: uppercase;
}

.definition-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 14px 0 26px;
  border: 1px solid var(--strong-line);
  background: rgba(247, 247, 244, 0.82);
}

.definition-grid > div {
  min-height: 132px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 15px;
}

.definition-grid b {
  display: block;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 950;
  text-transform: uppercase;
}

.definition-grid p,
.definition-grid ul {
  margin-top: 8px;
}

.insight-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 20px;
}

.insight-strip article {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  border: 1px solid rgba(255, 106, 26, 0.34);
  background:
    linear-gradient(135deg, rgba(255, 106, 26, 0.09), transparent 48%),
    rgba(247, 247, 244, 0.92);
  padding: 14px;
}

.insight-strip article::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -28px;
  width: 88px;
  height: 88px;
  border: 1px solid rgba(255, 106, 26, 0.28);
}

.insight-strip b {
  display: block;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.insight-strip strong {
  display: block;
  margin-top: 10px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: clamp(0.98rem, 1.32vw, 1.18rem);
  font-weight: 950;
  line-height: 1.12;
}

.insight-strip span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.subsection-stack {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.subsection-stack article {
  border-left: 5px solid var(--accent);
  background: rgba(255, 106, 26, 0.045);
  padding: 14px 16px;
}

.subsection-stack p,
.subsection-stack ul {
  margin-top: 0;
}

.flow-map {
  margin: 20px 0;
  border: 1px solid var(--strong-line);
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    rgba(247, 247, 244, 0.72);
  background-size: 26px 26px;
  padding: 16px;
}

.flow-row {
  display: grid;
  gap: 12px;
}

.entry-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.flow-row article,
.process-graph article,
.data-grid article,
.term-grid article {
  border: 1px solid var(--line);
  background: rgba(247, 247, 244, 0.9);
  padding: 13px;
}

.flow-row b,
.process-graph b,
.data-grid b,
.term-grid b {
  display: block;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.flow-row strong,
.process-graph strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 950;
  line-height: 1.15;
}

.flow-row span,
.process-graph span,
.term-grid span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.flow-line {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}

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

.flow-line span {
  position: relative;
  height: 4px;
  overflow: hidden;
  background: rgba(255, 106, 26, 0.16);
}

.flow-line span::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 44%;
  background: var(--accent);
  animation: flowPulse 2.6s linear infinite;
}

.flow-line.reverse span::after {
  animation-direction: reverse;
}

@keyframes flowPulse {
  from {
    transform: translateX(-110%);
  }
  to {
    transform: translateX(260%);
  }
}

.process-graph {
  display: grid;
  grid-template-columns: 1fr 22px 1fr 22px 1fr 22px 1fr 22px 1fr;
  align-items: stretch;
  margin: 18px 0;
}

.process-graph article {
  min-height: 160px;
}

.process-graph i {
  align-self: center;
  height: 3px;
  background: var(--accent);
}

.data-grid,
.term-grid,
.qa-grid,
.release-gates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.data-grid article,
.qa-grid article {
  min-height: 156px;
}

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

.term-grid article,
.release-gates article {
  min-height: 132px;
}

.release-timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0;
  padding-top: 16px;
}

.release-timeline::before {
  content: "";
  position: absolute;
  top: 0;
  left: 7%;
  right: 7%;
  height: 4px;
  background: var(--accent);
  box-shadow: 0 4px 0 rgba(23, 23, 23, 0.08);
}

.release-timeline article {
  position: relative;
  border: 1px solid var(--line);
  background: rgba(247, 247, 244, 0.9);
  padding: 13px;
  min-height: 184px;
}

.release-timeline article::before {
  content: "";
  position: absolute;
  top: -23px;
  left: 14px;
  width: 14px;
  height: 14px;
  border: 3px solid var(--accent);
  background: var(--panel);
}

.release-timeline b,
.release-gates b,
.qa-grid b {
  display: block;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.release-timeline strong,
.release-gates strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 950;
  line-height: 1.15;
}

.release-timeline span,
.release-gates span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.qa-grid article,
.release-gates article {
  border: 1px solid var(--line);
  background: rgba(247, 247, 244, 0.9);
  padding: 13px;
}

.callout,
.north-star {
  margin: 18px 0;
  border-left: 5px solid var(--accent);
  background: rgba(255, 106, 26, 0.055);
  padding: 15px 18px;
}

.callout strong,
.north-star strong {
  display: block;
  margin-top: 7px;
  font-size: clamp(1.05rem, 1.55vw, 1.42rem);
  line-height: 1.18;
}

.scope-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.scope-columns > div {
  border: 1px solid var(--line);
  background: rgba(233, 233, 230, 0.24);
  padding: 15px;
}

ul {
  margin: 0;
  padding-left: 20px;
}

li + li {
  margin-top: 7px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  background: rgba(247, 247, 244, 0.86);
  font-size: 0.84rem;
}

th {
  background: var(--ink);
  color: var(--panel);
  text-align: left;
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

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

td:first-child {
  color: var(--ink);
  font-weight: 850;
}

.system-flow {
  display: grid;
  grid-template-columns: 1fr 20px 1fr 20px 1fr 20px 1fr 20px 1fr;
  align-items: center;
  margin: 18px 0;
}

.system-flow div {
  min-height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(233, 233, 230, 0.24);
  text-align: center;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.2;
}

.system-flow i {
  height: 2px;
  background: var(--accent);
}

.north-star p {
  max-width: 72ch;
  margin-top: 8px;
}

@media (max-width: 1080px) {
  .prd-shell {
    grid-template-columns: 1fr;
  }

  .toc {
    position: static;
    max-height: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toc span {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .wrap {
    width: min(100% - 20px, 1180px);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions a {
    flex: 1;
    text-align: center;
  }

  .toc,
  .meta-table,
  .scope-columns,
  .definition-grid,
  .insight-strip,
  .entry-row,
  .decision-row,
  .completion-row,
  .flow-line,
  .flow-line.reverse,
  .data-grid,
  .term-grid,
  .qa-grid,
  .release-gates {
    grid-template-columns: 1fr;
  }

  .prd-content {
    padding: 18px;
  }

  .doc-section {
    padding: 24px 0;
  }

  h1 {
    font-size: clamp(2.8rem, 15vw, 4.4rem);
  }

  h2 {
    font-size: clamp(1.34rem, 7vw, 1.9rem);
  }

  table {
    display: block;
    overflow-x: auto;
  }

  th,
  td {
    min-width: 170px;
  }

  .system-flow {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .system-flow i {
    width: 2px;
    height: 20px;
    justify-self: center;
  }

  .process-graph {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .process-graph i {
    width: 3px;
    height: 20px;
    justify-self: center;
  }

  .release-timeline {
    grid-template-columns: 1fr;
    padding-top: 0;
  }

  .release-timeline::before {
    top: 0;
    bottom: 0;
    left: 9px;
    right: auto;
    width: 4px;
    height: auto;
  }

  .release-timeline article {
    margin-left: 24px;
    min-height: 0;
  }

  .release-timeline article::before {
    top: 14px;
    left: -31px;
  }
}
