/* ==========================================================================
   Capabilities (services.html, IDL-02) — page layout only.
   Tokens and components come from core.css.
   ========================================================================== */

/* ---------- Hero -------------------------------------------------------- */
.svc-hero { padding-bottom: clamp(48px, 5vw, 72px); }

/* ---------- Layer map glyph: six stack layers, L0 (power) → L5 (product) --
   Used large in the index (one layer per grid column) and small in each
   chapter rule. On = filled node; joined runs = a 1.5px trace between nodes. */
.lmap { --gap: 6px; --dot: 6px; --off: 3px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: var(--gap); align-items: center; }
.lmap i { position: relative; display: block; height: 12px; }
.lmap i::before { content: ""; position: absolute; left: 50%; top: 50%; width: var(--off); height: var(--off); border-radius: 50%; background: var(--line-2); transform: translate(-50%, -50%); z-index: 1; }
.lmap i.on::before { width: var(--dot); height: var(--dot); background: var(--tx-1); }
.lmap i.j::after { content: ""; position: absolute; left: 50%; top: 50%; width: calc(100% + var(--gap)); height: 1.5px; margin-top: -0.75px; background: var(--tx-2); }
.lmap--mini { width: 96px; flex: none; }

/* ---------- Index (stack map) ------------------------------------------ */
.smap { position: relative; padding-bottom: clamp(56px, 7vw, 112px); }
.smap .section-rule { margin-bottom: clamp(28px, 3vw, 40px); }

.smap__head { align-items: start; padding-bottom: 14px; border-bottom: 1px solid var(--line-2); font-family: var(--font-mono); font-size: 11px; line-height: 1.3; letter-spacing: 0.09em; text-transform: uppercase; color: var(--tx-3); font-weight: 500; }
.smap__h-name { grid-column: 1 / span 4; display: flex; gap: 0; }
.smap__h-name span:first-child { width: 56px; flex: none; }
.smap__h-layers { grid-column: 5 / span 6; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: var(--gutter); }
.smap__h-layers > span { display: grid; gap: 6px; justify-items: center; align-content: start; text-align: center; color: var(--tx-3); }
.smap__h-layers b { font-size: 11px; font-weight: 500; color: var(--tx-2); }
.smap__h-st { grid-column: 11 / span 2; }

.smap__list { list-style: none; padding: 0; }
.smap__list > li { border-bottom: 1px solid var(--line-1); }
.smap__row { align-items: stretch; color: var(--tx-2); transition: background-color var(--dur-micro) linear; }
.smap__row:hover { background: var(--bg-1); }
.smap__row:focus-visible { outline-offset: -2px; }
.smap__name { grid-column: 1 / span 4; display: flex; align-items: baseline; padding-block: 22px; }
.smap__no { width: 56px; flex: none; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; color: var(--tx-3); font-variant-numeric: tabular-nums slashed-zero; }
.smap__t { font-size: clamp(1.0625rem, 0.95rem + 0.3vw, 1.25rem); line-height: 1.3; font-weight: 470; font-stretch: 96%; letter-spacing: -0.006em; color: var(--tx-1); }
.smap__layers { --gap: var(--gutter); --dot: 9px; --off: 5px; grid-column: 5 / span 6; align-self: stretch; }
.smap__layers i { height: 100%; min-height: 24px; background: linear-gradient(var(--line-1), var(--line-1)) center / 1px 100% no-repeat; }
.smap__layers i::before { background: var(--bg-0); box-shadow: inset 0 0 0 1px var(--line-2); }
.smap__layers i.on::before { background: var(--tx-1); box-shadow: none; }
.smap__row:hover .smap__layers i:not(.on)::before { background: var(--bg-1); }
.smap__st { grid-column: 11 / span 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 22px; }
.smap__go { font-size: 15px; color: var(--tx-3); transition: transform var(--dur-ui) var(--ease-out), color var(--dur-micro) linear; }
.smap__row:hover .smap__go { transform: translateY(3px); color: var(--tx-1); }
/* Mapping pass (armed by services.js, never under reduced motion): nodes land row by row,
   left to right, and each trace draws to the next node. */
.smap__list > li:nth-child(2) { --r: 1; } .smap__list > li:nth-child(3) { --r: 2; } .smap__list > li:nth-child(4) { --r: 3; } .smap__list > li:nth-child(5) { --r: 4; }
.smap__layers i:nth-child(2) { --c: 1; } .smap__layers i:nth-child(3) { --c: 2; } .smap__layers i:nth-child(4) { --c: 3; } .smap__layers i:nth-child(5) { --c: 4; } .smap__layers i:nth-child(6) { --c: 5; }
.smap__layers i.j::after { transform-origin: left center; }
.smap.is-armed .smap__layers i.on::before { transition: transform 520ms var(--ease-out) calc(var(--map-at, 220ms) + var(--r, 0) * 80ms + var(--c, 0) * 70ms); }
.smap.is-armed .smap__layers i.j::after { transition: transform 460ms var(--ease-move) calc(var(--map-at, 220ms) + 20ms + var(--r, 0) * 80ms + var(--c, 0) * 70ms); }
.smap.is-armed:not(.is-mapped) .smap__layers i.on::before { transform: translate(-50%, -50%) scale(0); }
.smap.is-armed:not(.is-mapped) .smap__layers i.j::after { transform: scaleX(0); }
.smap__legend { display: none; margin-top: var(--s-4); font-family: var(--font-mono); font-size: 12px; line-height: 1.6; letter-spacing: 0.02em; color: var(--tx-3); max-width: 62ch; }

@media (max-width: 1023px) {
  .smap__head { display: none; }
  .smap__list { border-top: 1px solid var(--line-2); }
  .smap__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s-5); padding-block: 18px 16px; }
  .smap__name { grid-column: 1 / -1; padding-block: 0 12px; }
  .smap__no { width: 44px; }
  .smap__layers { --gap: 10px; --dot: 7px; --off: 4px; grid-column: 1; align-self: center; width: 152px; margin-left: 44px; }
  .smap__layers i { height: 16px; min-height: 0; background: none; }
  .smap__st { grid-column: 2; padding-block: 0; gap: 16px; }
  .smap__legend { display: block; }
}

/* ---------- Chapters ---------------------------------------------------- */
.chapter { position: relative; padding-block: clamp(72px, 9vw, 152px); }
.chapter + .chapter { padding-top: 0; }
.chapter__rule { display: flex; align-items: center; gap: var(--s-4); margin-bottom: clamp(40px, 5vw, 72px); }
.chapter__rule .rule { flex: 1; }
.chapter__grid { align-items: start; row-gap: var(--s-7); }
.chapter__text { grid-column: 1 / span 5; }
.chapter__text h2 { max-width: 13ch; }
.chapter__fact { margin-top: clamp(24px, 2.6vw, 36px); font-size: var(--t-lead); line-height: 1.4; font-weight: 400; letter-spacing: -0.006em; color: var(--tx-1); max-width: 30ch; text-wrap: balance; }
.chapter__stance { margin-top: var(--s-4); max-width: 40ch; text-wrap: balance; }
.chapter__spec { margin-top: clamp(32px, 3.4vw, 48px); padding-top: var(--s-5); border-top: 1px solid var(--line-1); max-width: 44ch; align-items: baseline; }
.chapter__spec dt { padding-top: 0; }
.chapter__links { margin-top: var(--s-5); display: flex; flex-direction: column; align-items: flex-start; gap: 0; }
.link-arrow--quiet { color: var(--tx-2); font-weight: 450; }

/* ---------- Schematics (drawing sheets) ---------------------------------- */
.schem { grid-column: 7 / span 6; margin: 0; }
.schem__cap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-height: 48px; padding: 10px 16px; border-bottom: 1px solid var(--line-1); font-family: var(--font-mono); font-size: 11px; line-height: 1.3; letter-spacing: 0.09em; text-transform: uppercase; color: var(--tx-3); font-weight: 500; }
.schem__no { color: var(--tx-2); font-variant-numeric: tabular-nums slashed-zero; }
.schem__title { flex: 1 1 auto; }
.schem__scale { flex: none; color: var(--tx-3); }
.schem__cap .stamp { flex: none; }
.schem__body { padding: clamp(16px, 2.6vw, 36px) clamp(12px, 2vw, 28px); }
.schem__svg { width: 100%; height: auto; overflow: visible; }

/* Engineering line language: 1.5px outlines, 0.75px detail, dashed hidden lines, mono labels */
.schem__svg * { vector-effect: non-scaling-stroke; }
.schem__svg .o, .schem__svg .k, .schem__svg .d, .schem__svg .h, .schem__svg .hk, .schem__svg .g { fill: none; stroke-linejoin: round; }
.schem__svg .o { stroke: var(--tx-2); stroke-width: 1.5; }
.schem__svg .k { stroke: var(--tx-1); stroke-width: 1.5; }
.schem__svg .d { stroke: var(--tx-3); stroke-width: 0.75; }
.schem__svg .h { stroke: var(--tx-3); stroke-width: 0.75; stroke-dasharray: 4 3; }
.schem__svg .hk { stroke: var(--tx-1); stroke-width: 1.5; stroke-dasharray: 3 2.5; }
.schem__svg .g { stroke: var(--ctrl); stroke-width: 0.75; }
.schem__svg .f { fill: var(--tx-3); }
.schem__svg .fk { fill: var(--tx-1); }
.schem__svg text { font-family: var(--font-mono); font-size: 9px; font-weight: 400; letter-spacing: 0.08em; fill: var(--tx-3); }
.schem__svg text.tk { fill: var(--tx-2); font-weight: 500; }

/* Before the page script arms a drawing (sets its strokes to undrawn), keep it hidden;
   a failsafe shows it if the script never runs. Reduced motion: always static. */
html.js:not(.reduce-motion) [data-schem]:not(.is-armed) .schem__svg { opacity: 0; animation: idl-failsafe 0.4s linear 2.4s forwards; }

/* ---------- Close ------------------------------------------------------- */
.svc-cta h2 { max-width: 15ch; }
.svc-cta .t-lead { margin-top: var(--s-5); max-width: 40ch; }

/* ---------- Responsive -------------------------------------------------- */
@media (max-width: 1023px) {
  .chapter__text, .schem { grid-column: 1 / -1; }
  .chapter__text h2 { max-width: 16ch; }
  .schem { max-width: 760px; }
}
@media (max-width: 767px) {
  .chapter__rule .lmap--mini { width: 78px; --gap: 5px; --dot: 5px; }
  .schem__body { padding: 20px 10px 14px; }
  .schem__svg text { font-size: 11.5px; letter-spacing: 0.03em; }
  .schem__cap { padding: 10px 12px; }
}

/* Phones: keep schematic labels at a readable size; the drawing scrolls sideways */
@media (max-width: 767px) { .schem__body { overflow-x: auto; -webkit-overflow-scrolling: touch; } .schem__svg { min-width: 520px; } }
