/* Platform-only branding and diagrams; colours share the investor deck palette. */
.platform-layer-index a[href="#layer-silicon"] { --tab-color: var(--silicon); }
.platform-layer-index a[href="#layer-sapphire"] { --tab-color: var(--sapphire); }
.platform-layer-index a[href="#layer-emerald"] { --tab-color: var(--layer-emerald); }
.platform-layer-index a[href="#layer-opal"] { --tab-color: var(--opal); }
.platform-layer-index a[href="#layer-titanium"] { --tab-color: var(--titanium); }
.platform-layer-index a[href="#layer-amber"] { --tab-color: var(--amber); }
.platform-layer-index a[href="#layer-alloy"] { --tab-color: var(--alloy); }
.platform-layer-index a[href="#layer-copper"] { --tab-color: var(--copper); }
.platform-layer-index a {
  min-height: 3rem;
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  background: var(--tab-color);
  font-size: 0.8rem;
}
.platform-layer-index a:last-child { border-color: rgba(255, 255, 255, 0.2); }
.platform-layer-index a:hover,
.platform-layer-index a:focus-visible {
  color: #fff;
  background: var(--tab-color);
  box-shadow: inset 0 -3px 0 #fff;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.platform-layer-stack > .platform-layer-slide {
  border-top: 0;
  color: #fff;
  background-color: var(--layer-color);
  background-image:
    radial-gradient(circle at 86% 14%, rgba(255, 255, 255, 0.08), transparent 27%),
    linear-gradient(132deg, rgba(0, 0, 0, 0.14), transparent 46%, rgba(255, 255, 255, 0.025));
}
.platform-layer-stack > .platform-layer-slide:focus-visible {
  outline-color: #fff;
}
.platform-layer-stack .platform-layer-atmosphere i {
  border-color: rgba(255, 255, 255, 0.16);
}
.platform-layer-stack .platform-layer-atmosphere > span {
  top: auto;
  bottom: -0.16em;
  color: rgba(255, 255, 255, 0.07);
}
.platform-layer-stack .platform-layer-name h2,
.platform-layer-stack .platform-layer-role,
.platform-layer-stack .platform-layer-intro > p:first-child {
  color: #fff;
}
.platform-layer-stack .platform-layer-role {
  font-size: 1.05rem;
}
.platform-layer-stack .platform-layer-showcase {
  grid-template-columns: minmax(0, 1fr) minmax(22rem, 1fr);
  align-items: start;
}
.platform-layer-stack .platform-process-grid {
  gap: 0.75rem;
  border: 0;
}
.platform-layer-stack .platform-process-grid > article {
  padding: clamp(1.1rem, 1.7vw, 1.5rem);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: var(--ink);
  background: #fff;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.06);
}
.platform-layer-stack .platform-process-grid h3 { color: var(--layer-color); }
.platform-layer-stack .platform-process-grid p { font-size: 0.9rem; }
.platform-layer-stack .platform-layer-interaction {
  border-color: rgba(255, 255, 255, 0.35);
}
.platform-layer-stack .platform-layer-interaction > strong,
.platform-layer-stack .platform-layer-interaction > span { color: #fff; }
.platform-layer-stack .platform-layer-interaction > span { line-height: 2; }
.platform-layer-stack .platform-layer-interaction .layer-pill {
  display: inline;
  padding: 0.17rem 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 0.25rem;
  color: #fff;
  background: var(--layer-pill);
  white-space: nowrap;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.platform-layer-stack .platform-layer-interaction .layer-pill:hover,
.platform-layer-stack .platform-layer-interaction .layer-pill:focus-visible {
  color: var(--layer-pill);
  background: #fff;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.platform-layer-figure.layer-diagram {
  gap: 0;
  min-height: 0;
  padding: clamp(1.1rem, 1.5vw, 1.3rem);
  border: 1px solid rgba(255, 255, 255, 0.7);
  color: var(--ink);
  background: #fff;
  box-shadow: 0 0.7rem 2rem rgba(0, 0, 0, 0.12);
  --diagram-tint: color-mix(in srgb, var(--layer-color) 5%, white);
  --diagram-line: color-mix(in srgb, var(--layer-color) 28%, white);
}
.layer-diagram .diagram-heading { margin-bottom: 1rem; }
.layer-diagram small {
  display: block;
  font-size: 0.7rem;
  line-height: 1.5;
  letter-spacing: 0.06em;
}
.layer-diagram .diagram-heading h3 {
  max-width: none;
  margin: 0.35rem 0 0;
  color: var(--layer-color);
  font-size: clamp(1.25rem, 1.6vw, 1.5rem);
  line-height: 1.2;
  letter-spacing: -0.035em;
}
.layer-diagram h4 {
  max-width: none;
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 750;
  line-height: 1.35;
  letter-spacing: -0.015em;
}
.layer-diagram p {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.83rem;
  line-height: 1.5;
}
.layer-diagram .diagram-card {
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid var(--diagram-line);
  background: var(--diagram-tint);
}
.layer-diagram .diagram-card > small { margin-bottom: 0.3rem; }
.layer-diagram .diagram-card--center { text-align: center; }
.layer-diagram .diagram-card--accent {
  border: 2px solid var(--layer-color);
  background: #fff;
}
.layer-diagram .diagram-card--accent h4 { color: var(--layer-color); }
.layer-diagram .diagram-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}
.layer-diagram .diagram-pair > div { min-width: 0; }
.layer-diagram .diagram-pair strong { color: var(--ink); font-size: 0.8rem; }
.layer-diagram .diagram-pair p { margin-top: 0.3rem; }
.layer-diagram h4 + .diagram-pair { margin-top: 0.7rem; }
.layer-diagram .diagram-note {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--diagram-line);
}
.layer-diagram .diagram-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}
.layer-diagram .diagram-tags > li {
  padding: 0.32rem 0.5rem;
  border: 1px solid var(--diagram-line);
  color: var(--layer-color);
  background: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.35;
}

/* Numbered flows connect chapters; the card keeps each chapter's facts together. */
.layer-diagram .diagram-steps {
  display: grid;
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.layer-diagram .diagram-steps > li {
  position: relative;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  align-items: start;
  gap: 0.65rem;
}
.layer-diagram .diagram-steps > li:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 2rem;
  bottom: -0.8rem;
  left: calc(1rem - 1px);
  width: 2px;
  background: var(--diagram-line);
}
.layer-diagram .diagram-number {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  color: #fff;
  background: var(--layer-color);
  font: 700 0.75rem/1 var(--mono);
}
.layer-diagram .diagram-arrow {
  position: relative;
  align-self: center;
  width: 2px;
  height: 1.2rem;
  margin-block: 0.2rem;
  background: var(--layer-color);
}
.layer-diagram .diagram-arrow::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: -3px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--layer-color);
  border-bottom: 2px solid var(--layer-color);
  transform: rotate(45deg);
}

/* Branches share a source, rather than implying one permission grants another. */
.layer-diagram .diagram-branches {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1.5rem;
}
.layer-diagram .diagram-branches::before {
  content: "";
  position: absolute;
  top: -1.5rem;
  left: calc(50% - 1px);
  width: 2px;
  height: 0.75rem;
  background: var(--layer-color);
}
.layer-diagram .diagram-branches > .diagram-card { position: relative; }
.layer-diagram .diagram-branches > .diagram-card::before {
  content: "";
  position: absolute;
  top: calc(-0.75rem - 1px);
  left: calc(50% - 1px);
  width: 2px;
  height: 0.75rem;
  background: var(--layer-color);
}
.layer-diagram .diagram-branches::after {
  content: "";
  position: absolute;
  top: -0.75rem;
  left: calc((100% - 0.85rem) / 4);
  right: calc((100% - 0.85rem) / 4);
  height: 2px;
  background: var(--layer-color);
}
.layer-diagram .diagram-branches--three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.layer-diagram .diagram-branches--three::after {
  left: calc((100% - 1.2rem) / 6);
  right: calc((100% - 1.2rem) / 6);
}
.layer-diagram .diagram-branches--three .diagram-card { padding: 0.75rem; }
.layer-diagram .diagram-branches--three h4 { font-size: 0.87rem; }
.layer-diagram .diagram-outcomes { margin-top: 1rem; }
.layer-diagram .diagram-outcomes > strong { color: var(--ink-soft); font-size: 0.8rem; }
.layer-diagram .diagram-outcomes .diagram-tags { margin-top: 0.4rem; }

.layer-diagram .diagram-source-groups { margin-top: 0.6rem; }
.layer-diagram .diagram-source-groups > div { padding: 0.75rem; background: #fff; }
.layer-diagram .diagram-withheld { border: 1px dashed var(--layer-color); }
.layer-diagram .diagram-withheld strong {
  display: block;
  margin-top: 0.5rem;
  color: var(--layer-color);
}
.layer-diagram .diagram-filter { text-align: center; }
.layer-diagram .diagram-filter strong { color: var(--layer-color); font-size: 0.95rem; }
.layer-diagram .diagram-binding {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--diagram-line);
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.4;
}

.layer-diagram .diagram-route-options { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.layer-diagram .diagram-route-options > li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--diagram-line);
  background: var(--diagram-tint);
  font-size: 0.85rem;
  line-height: 1.4;
}
.layer-diagram .diagram-route-options > li > span { color: var(--layer-color); font-size: 0.76rem; font-weight: 700; }
.layer-diagram .diagram-route-options > .diagram-route-selected { color: #fff; border-color: var(--layer-color); background: var(--layer-color); }
.layer-diagram .diagram-route-options > .diagram-route-selected > span { color: #fff; }

.layer-diagram .diagram-details { margin: 0.7rem 0 0; }
.layer-diagram .diagram-details > div {
  display: grid;
  grid-template-columns: minmax(5rem, 0.38fr) minmax(0, 1fr);
  gap: 0.65rem;
  padding-block: 0.45rem;
  border-top: 1px solid var(--diagram-line);
  font-size: 0.81rem;
  line-height: 1.4;
}
.layer-diagram .diagram-details dt { color: var(--ink); font-weight: 700; }
.layer-diagram .diagram-details dd { margin: 0; color: var(--ink-soft); }
.layer-diagram .diagram-checkpoints { margin-top: 1.2rem; }
.layer-diagram .diagram-lifecycle { margin: 0.65rem 0 0; padding: 0; list-style: none; }
.layer-diagram .diagram-lifecycle > li {
  position: relative;
  display: grid;
  grid-template-columns: minmax(7rem, 0.8fr) minmax(0, 1fr);
  gap: 0.6rem;
  padding: 0.55rem 0 0.55rem 1.5rem;
  font-size: 0.81rem;
  line-height: 1.4;
}
.layer-diagram .diagram-lifecycle > li::before {
  content: "";
  position: absolute;
  top: 0.75rem;
  left: 0;
  width: 0.65rem;
  height: 0.65rem;
  border: 2px solid var(--layer-color);
  border-radius: 50%;
  background: #fff;
}
.layer-diagram .diagram-lifecycle > li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 1.4rem;
  bottom: -0.75rem;
  left: 0.26rem;
  width: 2px;
  background: var(--diagram-line);
}
.layer-diagram .diagram-lifecycle span { color: var(--ink-soft); }

.layer-diagram .diagram-migration { margin-top: 1.35rem; padding-top: 1.15rem; border-top: 1px solid var(--diagram-line); }
.layer-diagram .diagram-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
}
.layer-diagram .diagram-rail > li {
  position: relative;
  padding: 0.6rem 0.3rem;
  border: 1px solid var(--diagram-line);
  color: var(--layer-color);
  background: var(--diagram-tint);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}
.layer-diagram .diagram-rail > li:not(:last-child)::after {
  content: "→";
  position: absolute;
  top: 50%;
  right: -1rem;
  width: 1rem;
  transform: translateY(-50%);
  color: var(--layer-color);
}
.layer-diagram .diagram-exchange { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding-block: 0.6rem; }
.layer-diagram .diagram-exchange p { display: grid; justify-items: center; align-content: start; gap: 0.2rem; margin: 0; text-align: center; }
.layer-diagram .diagram-exchange p > span:first-child { color: var(--layer-color); font-size: 1.6rem; line-height: 1; }
.layer-diagram .diagram-exchange p > strong { font-size: 0.8rem; }
.layer-diagram .diagram-exchange p > span:last-child:not(:first-child) { max-width: 20ch; font-size: 0.76rem; }
.layer-diagram .diagram-exchange--compact { color: var(--layer-color); font-size: 1.6rem; line-height: 1; text-align: center; }
.layer-diagram .diagram-destinations { gap: 0.7rem; }

.platform-layer-figure.layer-diagram figcaption {
  margin-top: 1.15rem;
  padding-top: 0.9rem;
  border-color: var(--diagram-line);
  font-size: 0.81rem;
}

@media (max-width: 1060px) and (min-width: 601px) {
  .platform-layer-figure.layer-diagram { width: min(100%, 44rem); justify-self: center; }
}
@media (max-width: 1060px) {
  .platform-layer-stack .platform-layer-showcase { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .layer-diagram .diagram-pair { gap: 0.65rem; }
  .layer-diagram .diagram-card { padding: 0.75rem; }
  .layer-diagram .diagram-branches--three {
    grid-template-columns: 1fr;
    gap: 0.65rem;
    margin-top: 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--layer-color);
  }
  .layer-diagram .diagram-branches--three::before { top: -1.5rem; left: -2px; height: 1.5rem; }
  .layer-diagram .diagram-branches--three::after { top: -1.5rem; left: -2px; right: 50%; }
  .layer-diagram .diagram-branches--three > .diagram-card::before { top: 50%; left: calc(-1rem - 2px); width: 1rem; height: 2px; }
  .layer-diagram .diagram-rail { grid-template-columns: 1fr; gap: 1rem; }
  .layer-diagram .diagram-rail > li:not(:last-child)::after { top: auto; right: auto; bottom: -1.1rem; left: calc(50% - 0.5rem); transform: none; content: "↓"; }
}
@media (max-width: 380px) {
  .layer-diagram .diagram-pair,
  .layer-diagram .diagram-branches { grid-template-columns: 1fr; }
  .layer-diagram .diagram-branches {
    gap: 0.65rem;
    margin-top: 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--layer-color);
  }
  .layer-diagram .diagram-branches::before { top: -1.5rem; left: -2px; height: 1.5rem; }
  .layer-diagram .diagram-branches::after { top: -1.5rem; left: -2px; right: 50%; }
  .layer-diagram .diagram-branches > .diagram-card::before { top: 50%; left: calc(-1rem - 2px); width: 1rem; height: 2px; }
  .layer-diagram .diagram-lifecycle > li { grid-template-columns: 1fr; gap: 0.15rem; }
  .layer-diagram .diagram-details > div { grid-template-columns: 1fr; gap: 0.15rem; }
  .layer-diagram .diagram-route-options > li { align-items: start; flex-direction: column; gap: 0.25rem; }
}
