/* ==========================================================================
   BESU — Article page, prose & content blocks, diagrams
   ========================================================================== */

.article-head { padding-top: clamp(28px, 5vw, 64px); max-width: 820px; }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-small);
  color: var(--muted);
}
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--faint); }

.article-head .eyebrow { margin-top: 28px; }
.article-head .page-title { margin-top: 14px; }
.article-head .lede { margin-top: 20px; }

.article-meta {
  margin-top: 32px;
  padding-block: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
}
.article-meta-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 20px;
  font-size: var(--fs-small);
  color: var(--muted);
}
.article-meta-info span { display: inline-flex; align-items: center; gap: 7px; }
.article-meta-info .icon { width: 16px; height: 16px; color: var(--faint); }
.article-actions { display: flex; align-items: center; gap: 6px; }

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--read)) minmax(200px, 248px);
  justify-content: space-between;
  gap: 64px;
  margin-top: clamp(40px, 5vw, 64px);
}
.article-aside { min-width: 0; }
.article-body { min-width: 0; }

@media (max-width: 1099px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); margin-top: 0; }
  .article-aside { display: none; }
  .article-body { max-width: var(--read); padding-top: 40px; }
}
@media (min-width: 1100px) {
  .toc-bar { display: none; }
}

/* ---------- Prose ---------- */

.prose {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text);
}
.a-section { scroll-margin-top: calc(var(--nav-h) + 72px); }
.a-section + .a-section { margin-top: clamp(56px, 7vw, 80px); }
.a-section-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.a-section > h2 {
  margin-top: 8px;
  margin-bottom: 20px;
  font-size: var(--fs-h2);
  letter-spacing: -0.024em;
  line-height: 1.2;
}

.prose .blk + .blk { margin-top: 1.15em; }
.prose .blk--wide + .blk, .prose .blk + .blk--wide { margin-top: 1.8em; }

.prose p strong { color: var(--ink); font-weight: 600; }
.prose em { font-style: italic; }
.prose h3 {
  font-size: var(--fs-h3);
  letter-spacing: -0.015em;
  line-height: 1.35;
  margin-top: 2.1em !important;
}
.prose h3 + .blk { margin-top: 0.6em; }

.prose code, .inline-code {
  font-size: 0.84em;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.08em 0.35em;
  color: var(--ink);
  white-space: nowrap;
}

.inline-link {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.inline-link:hover { text-decoration-color: var(--accent); color: var(--accent-ink); }
.inline-soon { color: var(--ink); border-bottom: 1px dashed var(--line-2); }

.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.5em; }
.prose li::marker { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.prose li strong { color: var(--ink); font-weight: 600; }

/* ---------- Blocks ---------- */

.formula {
  position: relative;
  padding: 36px 24px 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
}
.formula-label { position: absolute; top: 12px; left: 16px; }
.formula-expr {
  font-size: clamp(1.625rem, 1.3rem + 1.4vw, 2.25rem);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink);
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.formula-note { margin-top: 8px; font-size: var(--fs-small); color: var(--muted); }

.steps {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.steps-title { padding: 14px 20px; border-bottom: 1px solid var(--line); }
.step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) minmax(0, 0.9fr);
  align-items: baseline;
  gap: 16px;
  padding: 14px 20px;
}
.step + .step { border-top: 1px solid var(--line); }
.step-n { font-family: var(--font-mono); font-size: 12px; color: var(--faint); }
.step-expr {
  font-size: 1.1875rem;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.005em;
  overflow-wrap: anywhere;
}
.step-note { font-size: var(--fs-small); color: var(--muted); line-height: 1.5; }
.step.is-final { background: var(--accent-wash); }
.step.is-final .step-expr { color: var(--accent-ink); font-weight: 600; }
.step.is-final .step-n { color: var(--accent); }
@media (max-width: 599px) {
  .step { grid-template-columns: 22px minmax(0, 1fr); gap: 4px 12px; padding: 12px 16px; }
  .step-note { grid-column: 2; }
}

/* Versi Gampang — the signature block */
.easy {
  position: relative;
  padding: 24px clamp(18px, 3vw, 28px) 26px;
  background: var(--accent-wash);
  border: 1px solid var(--accent-line);
  border-radius: 14px;
  color: var(--ink);
}
.easy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.easy-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--accent);
}
.easy-glyph {
  width: 26px; height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}
.easy-toggle {
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--accent);
  padding: 6px 8px;
  border-radius: 6px;
}
.easy-toggle:hover { background: var(--bg); }
.easy-body { margin-top: 14px; }
.easy-body > p { font-size: 1.0625em; line-height: 1.65; color: var(--ink); }
.easy-body > p + p { margin-top: 0.7em; }
.easy-map {
  margin-top: 18px;
  display: grid;
  grid-template-columns: fit-content(46%) 22px minmax(0, 1fr);
  border-top: 1px solid var(--accent-line);
  font-size: 0.95em;
}
.easy-map > * { padding: 10px 0; border-bottom: 1px solid var(--accent-line); }
.easy-map dt { font-weight: 600; color: var(--ink); padding-right: 12px; }
.easy-map .eq { color: var(--accent); text-align: center; font-weight: 600; }
.easy-map dd { color: var(--ink-2); }
.easy .figure-frame { background: var(--bg); border-color: var(--accent-line); }
.easy .figure { margin-top: 18px; }
.easy.is-collapsed .easy-body { display: none; }
.easy.is-collapsed { padding-bottom: 22px; }

/* Notes */
.note {
  padding: 4px 0 4px 20px;
  border-left: 2px solid var(--line-2);
}
.note .eyebrow { margin-bottom: 6px; }
.note p { font-size: 0.95em; color: var(--ink-2); line-height: 1.7; }
.note--tip { border-left-color: var(--accent); }
.note--tip .eyebrow { color: var(--accent); }

/* Terms (definition list) */
.terms { border-top: 1px solid var(--line); }
.term {
  display: grid;
  grid-template-columns: minmax(96px, 0.32fr) minmax(0, 1fr);
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.term dt { font-weight: 600; color: var(--ink); font-size: 0.95em; }
.term dt code { white-space: nowrap; }
.term dd { font-size: 0.95em; color: var(--ink-2); line-height: 1.6; }
@media (max-width: 519px) { .term { grid-template-columns: minmax(0, 1fr); gap: 4px; } }

/* Uses grid */
.uses {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
}
.use { padding: 16px 0 18px; border-top: 1px solid var(--line); }
.use h4 { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.use p { margin-top: 6px; font-size: 0.92em; line-height: 1.6; color: var(--ink-2); }
@media (max-width: 599px) { .uses { grid-template-columns: minmax(0, 1fr); } }

/* Compare */
.compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.compare-col { padding: 18px 20px 20px; min-width: 0; }
.compare-col + .compare-col { border-left: 1px solid var(--line); }
.compare-col h4 { font-size: 1rem; font-weight: 600; color: var(--ink); }
.compare-col .compare-sub { font-size: var(--fs-meta); color: var(--muted); margin-top: 2px; }
.compare-col ul { list-style: none; padding: 0; margin-top: 12px; }
.compare-col li { font-size: 0.92em; line-height: 1.55; color: var(--ink-2); padding: 7px 0; border-top: 1px solid var(--line); }
.compare-col li + li { margin-top: 0; }
@media (max-width: 599px) {
  .compare { grid-template-columns: minmax(0, 1fr); }
  .compare-col + .compare-col { border-left: 0; border-top: 1px solid var(--line); }
}

/* Before → after fixes */
.fixes { border-top: 1px solid var(--line); }
.fix { padding: 16px 0; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.fix-line { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: baseline; font-size: 0.97em; }
.fix-line .icon { width: 14px; height: 14px; stroke-width: 2.2; transform: translateY(2px); }
.fix-before { color: var(--muted); }
.fix-before .icon { color: var(--danger); }
.fix-after { color: var(--ink); font-weight: 500; }
.fix-after .icon { color: var(--success); }
.fix-why { margin-left: 30px; font-size: var(--fs-small); color: var(--muted); }

/* Table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 0.92em; }
.table th {
  text-align: left;
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: top; line-height: 1.55; }
.table tr:last-child td { border-bottom: 0; }
.table td:first-child { color: var(--ink); font-weight: 600; white-space: nowrap; }
.table code { white-space: nowrap; }

/* Code */
.code {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sunken);
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 6px 16px;
  border-bottom: 1px solid var(--line);
}
.code-head .eyebrow { font-family: var(--font-mono); letter-spacing: 0.04em; text-transform: none; }
.code-copy { font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 10px; border-radius: 6px; display: inline-flex; gap: 6px; align-items: center; }
.code-copy:hover { color: var(--ink); background: var(--bg); }
.code pre {
  margin: 0;
  padding: 16px 18px 18px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink);
  tab-size: 2;
}
.code-caption { padding: 10px 16px; border-top: 1px solid var(--line); font-size: var(--fs-meta); color: var(--muted); }
.tok-k { color: var(--accent); font-weight: 500; }
.tok-s { color: var(--success); }
.tok-c { color: var(--faint); font-style: italic; }
.tok-n { color: var(--danger); }
.tok-t { color: var(--accent-ink); }

/* Quote / document */
.doc-quote {
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--surface);
  box-shadow: 6px 6px 0 -1px var(--sunken), 6px 6px 0 0 var(--line);
}
.doc-quote-title { text-align: center; font-weight: 700; letter-spacing: 0.32em; font-size: 0.95em; color: var(--ink); }
.doc-quote blockquote { margin-top: 20px; font-size: 1.08em; line-height: 1.75; color: var(--ink); }
.doc-quote blockquote p + p { margin-top: 0.8em; }
.doc-quote figcaption { margin-top: 20px; font-size: var(--fs-small); color: var(--muted); text-align: right; }

/* Reveal (self-check) */
.reveal { border-top: 1px solid var(--line); }
.reveal-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.reveal-q { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.reveal-q p { color: var(--ink); font-weight: 500; }
.reveal-a {
  margin-top: 10px;
  font-size: 0.93em;
  color: var(--ink-2);
  padding-left: 14px;
  border-left: 2px solid var(--accent);
  animation: page-in var(--dur-slow) var(--ease-out) both;
}

/* Swatches */
.swatches { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.swatch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.swatch-row h4 { font-size: 1rem; font-weight: 600; color: var(--ink); }
.swatch-row p { font-size: 0.9em; color: var(--ink-2); margin-top: 2px; line-height: 1.5; }
.swatch-chips { display: flex; }
.swatch-chips i {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  margin-left: -8px;
  display: block;
}
.swatch-chips i:first-child { margin-left: 0; }

/* ---------- Figures & diagrams ---------- */

.figure { margin: 0; }
.figure-frame {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: clamp(16px, 3vw, 28px);
  overflow-x: auto;
}
.figure figcaption {
  margin-top: 12px;
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--muted);
}
.figure figcaption b { color: var(--ink); font-weight: 600; margin-right: 6px; }

.dg { width: 100%; height: auto; overflow: visible; }
.dg text { font-family: var(--font-sans); fill: var(--ink); }
.dg .t-muted { fill: var(--muted); }
.dg .t-faint { fill: var(--faint); }
.dg .t-accent { fill: var(--accent); }
.dg .t-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; }
.dg .s-ink { stroke: var(--ink); fill: none; }
.dg .s-line { stroke: var(--line-2); fill: none; }
.dg .s-faint { stroke: var(--line); fill: none; }
.dg .s-accent { stroke: var(--accent); fill: none; }
.dg .f-bg { fill: var(--bg); }
.dg .f-surface { fill: var(--surface); }
.dg .f-sunken { fill: var(--sunken); }
.dg .f-ink { fill: var(--ink); }
.dg .f-accent { fill: var(--accent); }
.dg .f-wash { fill: var(--accent-wash); }
.dg .f-muted { fill: var(--muted); }
.dg-wide { min-width: 560px; }

/* HTML diagrams */
.d-flow {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.d-flow-node {
  flex: 1 1 0;
  min-width: 0;
  padding: 14px 14px 16px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--bg);
  text-align: center;
}
.d-flow-node strong { display: block; font-size: 0.95rem; color: var(--ink); letter-spacing: -0.01em; line-height: 1.3; }
.d-flow-node span { display: block; margin-top: 4px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.d-flow-node.is-accent { border-color: var(--accent); background: var(--accent-wash); }
.d-flow-node.is-accent strong { color: var(--accent-ink); }
.d-flow-arrow {
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  color: var(--faint);
}
.d-flow-arrow .icon { width: 16px; height: 16px; }
.d-flow-note { margin-top: 14px; font-size: 12.5px; color: var(--muted); text-align: center; }
@media (max-width: 639px) {
  .d-flow { flex-direction: column; }
  .d-flow-arrow { flex-basis: 24px; transform: rotate(90deg); }
  .d-flow-node { text-align: left; }
}

.d-process {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 0.9fr) 28px minmax(0, 1fr);
  align-items: center;
}
.d-process-col { display: flex; flex-direction: column; gap: 8px; }
.d-process-col .eyebrow { margin-bottom: 2px; }
.d-pill {
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg);
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--ink);
}
.d-pill small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.d-process-core {
  padding: 22px 14px;
  border-radius: 50%;
  aspect-ratio: 1;
  max-width: 100%;
  display: grid;
  place-content: center;
  text-align: center;
  background: var(--accent-wash);
  border: 1px solid var(--accent);
}
.d-process-core strong { font-size: 1rem; color: var(--accent-ink); }
.d-process-core span { font-size: 12px; color: var(--ink-2); margin-top: 4px; display: block; }
.d-process .d-flow-arrow { flex: none; }
@media (max-width: 639px) {
  .d-process { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .d-process .d-flow-arrow { transform: rotate(90deg); height: 28px; }
  .d-process-core { aspect-ratio: auto; border-radius: 12px; padding: 16px; }
}

.d-cycle { position: relative; padding-bottom: 36px; }
.d-cycle-row {
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  gap: 28px;
  position: relative;
}
.d-cycle-node {
  position: relative;
  padding: 14px 14px 16px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--bg);
}
.d-cycle-node .d-num { font-family: var(--font-mono); font-size: 11px; color: var(--accent); }
.d-cycle-node strong { display: block; margin-top: 4px; font-size: 0.95rem; color: var(--ink); }
.d-cycle-node span { display: block; margin-top: 4px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.d-cycle-node:not(:last-child)::after {
  content: "→";
  position: absolute;
  right: -22px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  font-size: 15px;
}
.d-cycle-loop {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 0;
  height: 26px;
  border: 1px dashed var(--line-2);
  border-top: 0;
  border-radius: 0 0 14px 14px;
}
.d-cycle-loop::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -2px;
  border: 4px solid transparent;
  border-bottom: 6px solid var(--line-2);
  border-top: 0;
}
.d-cycle-loop span {
  position: absolute;
  left: 50%;
  bottom: -9px;
  transform: translateX(-50%);
  padding: 0 10px;
  background: var(--surface);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
.d-cycle-center { text-align: center; margin-bottom: 18px; }
@media (max-width: 639px) {
  .d-cycle { padding-bottom: 0; padding-right: 30px; }
  .d-cycle-row { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .d-cycle-node:not(:last-child)::after { content: "↓"; right: auto; left: 18px; top: auto; bottom: -19px; transform: none; }
  .d-cycle-loop { left: auto; right: 0; top: 40px; bottom: 30px; width: 22px; height: auto; border: 1px dashed var(--line-2); border-left: 0; border-radius: 0 14px 14px 0; }
  .d-cycle-loop::before { left: -6px; top: -5px; border: 4px solid transparent; border-right: 6px solid var(--line-2); border-left: 0; }
  .d-cycle-loop span { display: none; }
}

.d-nested { display: flex; flex-direction: column; }
.d-nest {
  padding: 14px 16px 16px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--bg);
}
.d-nest .d-nest { margin-top: 14px; background: var(--surface); }
.d-nest .d-nest .d-nest { background: var(--accent-wash); border-color: var(--accent); }
.d-nest-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.d-nest-head strong { font-size: 0.98rem; color: var(--ink); letter-spacing: -0.01em; }
.d-nest-head span { font-size: 12.5px; color: var(--muted); }
.d-nest-ex { margin-top: 6px; font-size: 12.5px; color: var(--ink-2); }

.d-layers { display: flex; flex-direction: column; gap: 6px; }
.d-layer {
  display: grid;
  grid-template-columns: 28px minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--bg);
}
.d-layer:first-child { border-color: var(--accent); background: var(--accent-wash); }
.d-layer .d-num { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.d-layer strong { font-size: 0.95rem; color: var(--ink); display: block; }
.d-layer small { font-size: 12px; color: var(--muted); display: block; margin-top: 2px; }
.d-layer p { font-size: 13px; color: var(--ink-2); line-height: 1.45; }
@media (max-width: 559px) {
  .d-layer { grid-template-columns: 22px minmax(0, 1fr); }
  .d-layer p { grid-column: 2; }
}

.d-anatomy {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 18px 4px;
  padding: 8px 0 4px;
}
.d-part { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.d-part-text {
  font-size: clamp(1.375rem, 1.1rem + 1.2vw, 2rem);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.2;
  padding: 0 4px;
  white-space: pre;
}
.d-part.is-labeled .d-part-text { color: var(--ink); }
.d-part-tick {
  width: 100%;
  height: 8px;
  margin-top: 6px;
  border: 1.5px solid var(--accent);
  border-top: 0;
  border-radius: 0 0 4px 4px;
}
.d-part-label {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}
.d-part.is-plain .d-part-text { color: var(--muted); }
.d-anatomy.is-code .d-part-text { font-family: var(--font-mono); font-size: clamp(1rem, 0.9rem + 0.6vw, 1.375rem); }

.d-bits { text-align: center; }
.d-bits-row {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  max-width: 520px;
  margin-inline: auto;
}
.d-bit-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.d-bit-val { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.d-bit {
  width: 100%;
  aspect-ratio: 1 / 1.15;
  max-width: 56px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: clamp(1rem, 0.8rem + 1vw, 1.5rem);
  font-weight: 500;
  color: var(--faint);
  transition: all var(--dur) var(--ease);
}
.d-bit:hover { border-color: var(--ink); }
.d-bit[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.d-bits-sum {
  margin-top: 18px;
  font-size: 0.95rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
}
.d-bits-sum strong { font-size: 1.5rem; color: var(--ink); letter-spacing: -0.02em; }
.d-bits-hint { margin-top: 6px; font-size: 12.5px; color: var(--muted); }

.d-machine {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1.3fr) 28px minmax(0, 1fr);
  align-items: center;
}
.d-machine-io { text-align: center; }
.d-machine-io label, .d-machine-io .eyebrow { display: block; margin-bottom: 8px; }
.d-machine-io input, .d-machine-out {
  width: 100%;
  max-width: 120px;
  height: 56px;
  margin-inline: auto;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--bg);
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.d-machine-out { display: grid; place-items: center; border-color: var(--accent); color: var(--accent-ink); background: var(--accent-wash); }
.d-machine-io input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-wash); }
.d-machine-box {
  padding: 22px 12px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  text-align: center;
}
.d-machine-box small { display: block; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.6; font-weight: 600; }
.d-machine-box strong { display: block; margin-top: 6px; font-size: 1.125rem; font-weight: 600; letter-spacing: 0.01em; }
.d-machine-calc { margin-top: 16px; text-align: center; font-size: 0.9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 559px) {
  .d-machine { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .d-machine .d-flow-arrow { transform: rotate(90deg); height: 28px; }
}

.d-boxes { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px 28px; padding: 6px 0; }
.d-box { display: flex; flex-direction: column; align-items: center; gap: 0; }
.d-box-label {
  padding: 3px 10px;
  border-radius: 6px 6px 0 0;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}
.d-box-body {
  min-width: 112px;
  padding: 18px 16px;
  border: 1.5px solid var(--ink);
  border-radius: 4px 4px 10px 10px;
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 1.0625rem;
  color: var(--accent-ink);
  text-align: center;
}
.d-box-type { margin-top: 8px; font-size: 11.5px; color: var(--muted); }

.d-hier { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.d-hier-card { border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); padding: 22px 20px; min-width: 0; }
.d-hier-tag { margin-bottom: 14px; }
.d-hier-flat p { font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.d-hier-good .h-kicker { font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; color: var(--accent); }
.d-hier-good .h-title { margin-top: 6px; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; color: var(--ink); }
.d-hier-good .h-date { margin-top: 10px; font-size: 0.95rem; font-weight: 600; color: var(--ink); }
.d-hier-good .h-detail { margin-top: 14px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.d-hier-good .h-cta { margin-top: 16px; display: inline-block; padding: 6px 12px; border-radius: 6px; background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 600; }
@media (max-width: 559px) { .d-hier { grid-template-columns: minmax(0, 1fr); } }

.d-tz-times {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.d-tz-time { padding: 10px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.d-tz-time .eyebrow { display: block; }
.d-tz-time strong { display: block; margin-top: 4px; font-size: 1.375rem; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.d-tz-time small { font-size: 12px; color: var(--muted); }
.d-tz-control { display: flex; align-items: center; gap: 14px; margin-top: 14px; font-size: 13px; color: var(--ink-2); }
.d-tz-control input[type="range"] { flex: 1; accent-color: var(--accent); }
.d-tz-scroll { overflow-x: auto; }

.d-demo { text-align: center; padding: 8px 0; }
.d-demo-out { margin-top: 14px; font-size: 2.5rem; font-weight: 700; letter-spacing: -0.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.d-demo-hint { margin-top: 4px; font-size: 12.5px; color: var(--muted); }

/* ---------- Timeline ---------- */

.timeline { list-style: none; padding: 0; }
.tl-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 0 18px;
}
.tl-year {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
  text-align: right;
}
.tl-body {
  position: relative;
  padding: 0 0 28px 24px;
  border-left: 1px solid var(--line-2);
}
.tl-item:last-child .tl-body { padding-bottom: 4px; border-left-color: transparent; }
.tl-body::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 6px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--ink);
}
.tl-item.is-key .tl-body::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-wash); }
.tl-item.is-key .tl-year { color: var(--accent); }
.tl-body h4 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.012em; color: var(--ink); line-height: 1.35; }
.tl-body p { margin-top: 4px; font-size: 0.93em; line-height: 1.6; color: var(--ink-2); }
@media (max-width: 519px) {
  .tl-item { grid-template-columns: minmax(0, 1fr); }
  .tl-year { text-align: left; padding: 0 0 4px 24px; border-left: 1px solid var(--line-2); position: relative; }
  .tl-item:last-child .tl-year { border-left-color: var(--line-2); }
  .tl-body::before { top: -22px; }
}

/* ---------- Article end ---------- */

.article-end {
  margin-top: clamp(56px, 7vw, 88px);
  padding: clamp(28px, 4vw, 40px);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px 32px;
}
.article-end h2 { font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem); letter-spacing: -0.028em; }
.article-end p { margin-top: 6px; color: var(--ink-2); font-size: var(--fs-ui); }
.article-end .best { color: var(--success); font-weight: 600; }
@media (max-width: 599px) {
  .article-end { grid-template-columns: minmax(0, 1fr); }
  .article-end .btn { width: 100%; }
}

.article-next { margin-top: clamp(64px, 8vw, 104px); padding-top: clamp(40px, 5vw, 64px); border-top: 1px solid var(--line); }
.article-next .section-head { margin-bottom: 28px; }
.related-more { margin-top: 48px; }

/* Sequence (request / response) */
.d-seq { position: relative; }
.d-seq-actors { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.d-seq-actor {
  margin: 0 6px;
  padding: 10px 8px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--bg);
  text-align: center;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.d-seq-actor small { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.d-seq-body { position: relative; padding: 6px 0 14px; }
.d-seq-life { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--line-2); }
.d-seq-msg { position: relative; padding: 12px 0 4px; }
.d-seq-arrow { position: relative; }
.d-seq-label {
  display: block;
  padding: 0 10px 7px;
  text-align: center;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink);
}
.d-seq-label b {
  display: inline-grid;
  place-items: center;
  width: 18px; height: 18px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  font-size: 10.5px;
  font-weight: 700;
  vertical-align: 1px;
}
.d-seq-label code { white-space: normal; }
.d-seq-line { display: block; position: relative; height: 0; border-top: 1.5px solid var(--ink); }
.d-seq-line::after {
  content: "";
  position: absolute;
  top: -5.5px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}
.is-fwd .d-seq-line::after { right: -1px; border-left: 8px solid var(--ink); }
.is-rev .d-seq-line::after { left: -1px; border-right: 8px solid var(--ink); }
.is-back .d-seq-line { border-top-style: dashed; border-top-color: var(--accent); }
.is-back.is-fwd .d-seq-line::after { border-left-color: var(--accent); }
.is-back.is-rev .d-seq-line::after { border-right-color: var(--accent); }
.is-back .d-seq-label b { background: var(--accent); color: var(--on-accent); }
@media (max-width: 519px) {
  .d-seq-label { font-size: 12px; padding-inline: 4px; }
  .d-seq-actor { font-size: 0.82rem; margin: 0 3px; }
}
