/* Look closer: annotated technical plates (boards, grip sensor, mechanical CAD).
   A plate is a bracketed instrument stage with the drawing, square numbered markers and
   leader labels, and a compact key below it. The drawings stay in quiet greys so the one
   signal colour, tactile yellow, marks what a marker refers to. */

.closer { display: grid; gap: clamp(72px, 9vw, 120px); }
.closer__part { display: grid; gap: 26px; }
.closer__head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 28px;
  padding-bottom: 14px; border-bottom: 1px solid var(--rule-2);
}
.closer__kicker {
  margin: 0; font-family: var(--display); font-stretch: 118%; font-weight: 700; font-size: var(--step-2);
  letter-spacing: 0.01em; text-transform: uppercase; color: var(--ink);
}
.closer__sub { margin: 0; font-family: var(--mono); font-size: var(--step--2); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }

.plate { --pin: 26px; display: grid; gap: 12px; }
.plate + .plate { margin-top: clamp(30px, 3.5vw, 48px); }
.plate__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; min-height: 34px; }
.plate__name {
  margin: 0; font-family: var(--mono); font-size: var(--step--1); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px;
}
.plate__name::before { content: ""; width: 7px; height: 7px; background: var(--tactile); align-self: center; }
.plate__name span { font-weight: 400; color: var(--ink-3); letter-spacing: 0.08em; }
.plate__bar { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.plate__chips { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0; border: 1px solid var(--rule-2); }
.plate__chips-label { font-family: var(--mono); font-size: var(--step--2); color: var(--ink-3); padding: 0 10px; }
.plate__chip {
  font: inherit; font-family: var(--mono); font-size: var(--step--2); letter-spacing: 0.12em; text-transform: uppercase; line-height: 1;
  color: var(--ink-2); background: transparent;
  border: 0; border-right: 1px solid var(--rule-2); border-radius: 0; padding: 9px 13px; cursor: pointer;
  transition: background .15s, color .15s;
}
.plate__chip:last-child { border-right: 0; }
.plate__chip:hover { color: var(--ink); background: var(--asphalt-2); }
.plate__chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.plate__chip:focus-visible { outline: 2px solid var(--tactile); outline-offset: -2px; }

/* stage */
.plate__stage {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--asphalt); color: var(--on-asphalt);
  border: 1px solid var(--asphalt-line); border-radius: 0;
  aspect-ratio: var(--plate-aspect, 2.4);
  min-height: 300px; max-height: 78vh; max-width: 100%;
  touch-action: pan-y;
}
.plate__stage::before { /* faint drafting grid */
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: linear-gradient(var(--plate-grid) 1px, transparent 1px), linear-gradient(90deg, var(--plate-grid) 1px, transparent 1px);
  background-size: 40px 40px;
}
.plate__stage::after { /* bracketed corners, like an instrument frame */
  content: ""; position: absolute; inset: 8px; z-index: 5; pointer-events: none;
  --c: var(--ink-3); --l: 14px;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--l) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) top left / 1px var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--l) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 1px var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--l) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 1px var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 1px var(--l) no-repeat;
}
.plate__still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 8% 4%; }
.plate__still--mirror { transform: scaleX(-1); }
.plate__fig { position: absolute; inset: 0; z-index: 1; }
.plate.is-zoomed .plate__fig { cursor: grab; touch-action: none; }
.plate.is-zoomed .plate__fig:active { cursor: grabbing; }
.plate__svg { display: block; width: 100%; height: 100%; }
.plate__ov { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; overflow: visible; }
.plate__stage.is-failed::after { content: "This drawing could not load. Try reloading the page."; inset: auto; position: absolute; left: 20px; bottom: 64px; color: var(--on-asphalt-2); font-size: var(--step--1); background: none; }

/* markers, labels, leaders */
.plate__pin {
  position: absolute; left: 0; top: 0; z-index: 3;
  width: var(--pin); height: var(--pin); margin: calc(var(--pin) / -2) 0 0 calc(var(--pin) / -2);
  display: grid; place-items: center; padding: 0;
  font: inherit; font-family: var(--mono); font-size: 0.72rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
  color: var(--tactile); background: color-mix(in srgb, var(--asphalt) 82%, transparent);
  border: 1px solid var(--tactile); border-radius: 0; cursor: pointer;
  transition: background .15s, color .15s, box-shadow .2s, opacity .2s;
}
.plate__pin::before, .plate__pin::after { /* reticle ticks */
  content: ""; position: absolute; background: var(--tactile); pointer-events: none;
}
.plate__pin::before { left: 50%; top: -6px; width: 1px; height: 4px; box-shadow: 0 calc(var(--pin) + 6px) 0 var(--tactile); }
.plate__pin::after { top: 50%; left: -6px; height: 1px; width: 4px; box-shadow: calc(var(--pin) + 6px) 0 0 var(--tactile); }
.plate__pin[hidden], .plate__label[hidden] { display: none; }
.plate__pin.is-other-side { border-style: dashed; }
.plate__pin:hover, .plate__pin.is-preview, .plate__pin.is-active { background: var(--tactile); color: var(--tactile-ink); }
.plate__pin.is-active { box-shadow: 0 0 0 4px var(--tactile-dim); }
.plate.is-focused .plate__pin:not(.is-active) { opacity: .4; }
.plate__pin:focus-visible { outline: 1px solid var(--on-asphalt); outline-offset: 4px; }
.plate__label {
  position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none;
  font-family: var(--mono); font-size: 0.72rem; font-weight: 400; line-height: 1.3; white-space: nowrap;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--on-asphalt);
}
.plate__leader { fill: none; stroke: var(--on-asphalt-2); stroke-width: 1; opacity: .6; }
.plate__leader.is-other-side { stroke-dasharray: 3 3; }
.plate__leader-dot { fill: var(--tactile); }
.plate.has-hl .plate__label, .plate.has-hl .plate__leader { opacity: .3; }

/* heads-up bar */
.plate__hud {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
  padding: 14px 16px; pointer-events: none;
}
.plate__hud > * { pointer-events: auto; }
.plate__nav, .plate__zoom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.plate__nav { flex: 1 1 auto; align-items: flex-end; }
.plate__caption { min-width: 0; display: grid; gap: 3px; padding: 0 8px; }
.plate__caption-title {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono); font-size: var(--step--2); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--on-asphalt-2); font-variant-numeric: tabular-nums;
}
.plate.is-focused .plate__caption-title { color: var(--tactile); }
.plate__caption-text { font-size: var(--step--1); line-height: 1.4; color: var(--on-asphalt); max-width: 60ch; }
.plate__caption-text:empty { display: none; }
.plate__btn {
  flex: none; font: inherit; font-family: var(--mono); font-size: 0.95rem; line-height: 1; min-width: 34px; height: 34px; padding: 0 10px;
  color: var(--on-asphalt); background: color-mix(in srgb, var(--asphalt-2) 90%, transparent);
  border: 1px solid var(--rule-2); border-radius: 0; cursor: pointer;
}
.plate__btn--text { font-size: var(--step--2); letter-spacing: 0.12em; text-transform: uppercase; }
.plate__btn:hover { border-color: var(--on-asphalt-2); }
.plate__btn:focus-visible { outline: 2px solid var(--tactile); outline-offset: 2px; }
.plate:not(.is-zoomed):not(.is-focused) .plate__btn--text { opacity: .45; }

/* highlights */
.plate__hl .hl { display: none; }
.plate__hl .hl.is-in-view.is-on { display: inline; }
.hl--cu { fill: var(--tactile); opacity: .82; }
.hl--part { fill: color-mix(in srgb, var(--tactile) 10%, transparent); stroke: var(--tactile); stroke-width: 2px; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.hl--zone { fill: color-mix(in srgb, var(--tactile) 22%, transparent); stroke: var(--tactile); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.plate__hl .hl.is-dim { opacity: .3; }
.plate__hl .hl--part.is-dim { stroke-dasharray: 2 4; }
.plate__base [data-hl] { transition: opacity .2s; }

/* technical drawings (grip and CAD). The stage is asphalt in both themes, so these
   tones are tokens defined once for that dark ground. */
.dwg { font-family: var(--mono); }
.dwg text { font-size: 3.1px; }
.dwg .hatch-bg { fill: var(--dw-print); }
.dwg .hatch-line { stroke: var(--dw-hatch); stroke-width: 0.32; }
.dwg .part { fill: var(--dw-body); stroke: var(--dw-line); stroke-width: 0.3; stroke-linejoin: round; }
.dwg .part--wall { fill: none; stroke: var(--dw-line-2); stroke-width: 0.25; stroke-dasharray: 1.2 0.9; }
.dwg .part--comp { fill: var(--dw-comp); stroke: var(--dw-ink); stroke-width: 0.35; }
.dwg .cut { fill: var(--dw-print); stroke: var(--dw-ink); stroke-width: 0.28; stroke-linejoin: round; }
.dwg .mat { stroke: var(--dw-line); stroke-width: 0.22; stroke-linejoin: round; }
.dwg .mat--elec { fill: var(--dw-elec); }
.dwg .mat--cell { fill: var(--dw-cell); }
.dwg .mat--dark { fill: var(--dw-dark); }
.dwg .mat--wire { fill: var(--dw-wire); stroke: none; }
.dwg .mat--lra { fill: var(--dw-lra); }
.dwg .mat--carbon { fill: var(--dw-carbon); }
.dwg .mat--ffc { fill: var(--dw-ffc); }
.dwg .mat--steel { fill: var(--dw-steel); }
.dwg .mat--copper, .dwg .copper { fill: var(--dw-copper); }
.dwg .copper { stroke: none; }
.dwg .copper--band { stroke: var(--dw-copper-2); stroke-width: 0.25; }
.dwg .guard { fill: var(--dw-guard); stroke: none; }
.dwg .guard--side { fill: color-mix(in srgb, var(--dw-guard) 55%, transparent); stroke: var(--dw-guard); stroke-width: 0.3; stroke-dasharray: 1.4 0.8; }
.dwg .wire { fill: var(--dw-copper-2); }
.dwg .guard-outline { fill: none; stroke: var(--dw-guard-2); stroke-width: 0.35; stroke-dasharray: 1.6 1; }
.dwg .guard-outline[data-hl].is-on { stroke: var(--tactile); stroke-width: 0.7; }
.dwg .wire--g { fill: var(--dw-guard-2); }
.dwg .wireline { fill: none; stroke: var(--dw-copper-2); stroke-width: 0.22; opacity: .9; }
.dwg .ghost { fill: none; stroke: var(--dw-line-2); stroke-width: 0.3; stroke-dasharray: 1 0.8; }
.dwg .ink { fill: none; stroke: var(--dw-ink); stroke-width: 0.35; stroke-linecap: round; stroke-linejoin: round; }
.dwg .ink--fill { fill: var(--dw-ink); }
.dwg .thin { fill: none; stroke: var(--dw-line-2); stroke-width: 0.22; }
.dwg .thin--grid { stroke-dasharray: 0.6 0.8; opacity: .7; }
.dwg .dim { fill: none; stroke: var(--dw-line-2); stroke-width: 0.22; }
.dwg .sig { fill: none; stroke: var(--dw-ink); stroke-width: 0.42; stroke-linejoin: round; stroke-linecap: round; }
.dwg .sig--sense { stroke: var(--dw-sense); }
.dwg .node { fill: var(--dw-ink); }
.dwg .hand { fill: color-mix(in srgb, var(--dw-ink) 7%, transparent); stroke: var(--dw-line-2); stroke-width: 0.28; stroke-dasharray: 1.6 1; }
.dwg .txt, .dwg .dimtext { fill: var(--dw-text); }
.dwg .dimtext { font-size: 2.7px; font-variant-numeric: tabular-nums; }
.dwg .txt--strong, .dwg .txt--strong tspan { fill: var(--dw-ink); font-weight: 680; }
.dwg tspan.txt--strong { fill: var(--dw-ink); font-weight: 680; }
.dwg .txt--title { font-size: 3.5px; fill: var(--dw-text); letter-spacing: 0.02em; }
.dwg .txt--net { font-family: var(--mono); font-size: 2.6px; fill: var(--dw-text); }
.dwg .txt--ghost { fill: var(--dw-line-2); font-style: italic; }
.dwg .txt--onguard { fill: var(--dw-ink); font-size: 2.8px; }
.dwg .txt--oncopper { fill: var(--dw-on-copper); }
.dwg [data-hl] { transition: fill .2s, stroke .2s, opacity .2s; }
.dwg [data-hl].is-on { stroke: var(--tactile); }
.dwg .part[data-hl].is-on, .dwg .cut[data-hl].is-on, .dwg .mat[data-hl].is-on { stroke: var(--tactile); stroke-width: 0.7; }
.dwg .copper[data-hl].is-on, .dwg .guard[data-hl].is-on { fill: var(--tactile); }
.dwg .sig[data-hl].is-on, .dwg .ink[data-hl].is-on { stroke: var(--tactile); stroke-width: 0.7; }
.dwg .ink--fill[data-hl].is-on { fill: var(--tactile); }
.dwg .part--comp[data-hl].is-on { fill: color-mix(in srgb, var(--tactile) 22%, var(--dw-comp)); stroke-width: 0.6; }
.plate.has-hl .dwg [data-hl]:not(.is-on) { opacity: .55; }

/* mechanical drawings: outlines stay one pixel wide at any zoom */
.dwg--cad text { font-size: var(--dt, 3.2px); }
.dwg--cad .dimtext { font-size: calc(var(--dt, 3.2px) * 0.88); }
.dwg--cad .cut, .dwg--cad .mat, .dwg--cad .out, .dwg--cad .dim, .dwg--cad .ray, .dwg--cad .fov { vector-effect: non-scaling-stroke; }
.dwg--cad .cut { stroke-width: 1px; }
.dwg--cad .mat { stroke-width: .8px; }
.dwg--cad .dim { stroke-width: .8px; }
.dwg--cad .dim--ext { stroke-dasharray: 3 3; opacity: .8; }
.dwg--cad .hatch-line { stroke-width: 0.3; }
.dwg .out { fill: var(--dw-body); stroke: var(--dw-line); stroke-width: 1px; stroke-linejoin: round; }
.dwg .out--print { fill: var(--dw-print); }
.dwg .out--dark, .dwg .out--carbon { fill: var(--dw-carbon); }
.dwg .out--vcol { fill: var(--dw-elec); }
.dwg .out--ffc { fill: var(--dw-ffc); }
.dwg .out--copper { fill: var(--dw-copper); stroke: var(--dw-copper-2); }
.dwg .fov { fill: color-mix(in srgb, var(--dw-ink) 6%, transparent); stroke: var(--dw-line-2); stroke-width: 1px; stroke-dasharray: 4 3; }
.dwg .ray { fill: none; stroke: var(--dw-ink); stroke-width: 1px; }
.dwg--cad [data-hl].is-on.cut, .dwg--cad [data-hl].is-on.mat, .dwg--cad [data-hl].is-on.out { stroke: var(--tactile); stroke-width: 2.2px; }
.dwg--cad .fov[data-hl].is-on { fill: color-mix(in srgb, var(--tactile) 14%, transparent); stroke: var(--tactile); }
.dwg--cad .ray[data-hl].is-on { stroke: var(--tactile); }

/* key: number, title and one line of figures; the sentence shows in the stage caption */
.plate__key {
  list-style: none; margin: 2px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(var(--key-cols, 4), minmax(0, 1fr)); gap: 0;
  border-top: 1px solid var(--rule); border-left: 1px solid var(--rule);
}
.key { padding: 14px 16px 15px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); min-width: 0; transition: background-color .15s; }
.key.is-active, .key.is-preview { background: var(--asphalt-2); }
.key__btn {
  display: flex; align-items: baseline; gap: 12px; width: 100%;
  font: inherit; text-align: left; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
}
.key__n {
  flex: none; font-family: var(--mono); font-size: var(--step--2); font-weight: 600; letter-spacing: 0.04em; font-variant-numeric: tabular-nums;
  color: var(--ink-3); transition: color .15s;
}
.key__title { font-size: var(--step-0); font-weight: 700; line-height: 1.3; text-wrap: balance; }
.key.is-active .key__n, .key.is-preview .key__n { color: var(--tactile); }
.key__btn:focus-visible { outline: 2px solid var(--tactile); outline-offset: 6px; }
.key .key__fig { margin: 6px 0 0 calc(1.6em + 12px); font-family: var(--mono); font-size: var(--step--2); letter-spacing: 0.04em; line-height: 1.5; color: var(--ink-2); }
.key .key__text { display: none; }
.plate__note { margin: 0; font-family: var(--mono); font-size: var(--step--2); letter-spacing: 0.04em; color: var(--ink-3); max-width: 90ch; }

@media (max-width: 1100px) { .plate__key { --key-cols: 2; } }
@media (max-width: 700px) {
  .plate { --pin: 24px; }
  .plate__key { --key-cols: 1; }
  .plate__stage { aspect-ratio: auto; height: var(--plate-h-m, clamp(300px, 92vw, 420px)); min-height: 0; }
  .plate__btn--text { display: none; }
  .plate__caption-text { display: none; }
  .key .key__text { display: block; margin: 6px 0 0 calc(1.6em + 12px); font-size: var(--step--1); color: var(--ink-2); }
}

:root {
  /* drawing tones, tuned for the dark instrument stage */
  --plate-grid: rgba(228, 232, 229, 0.028);
  --dw-ink: #e2e6e3;
  --dw-text: #98a2a6;
  --dw-line: #8f9aa0;
  --dw-line-2: #7a858b;
  --dw-body: #22292c;
  --dw-comp: #1b2124;
  --dw-print: #262e32;
  --dw-hatch: #566166;
  --dw-elec: #3b4f59;
  --dw-cell: #3d5548;
  --dw-dark: #1b2023;
  --dw-wire: #8c74b8;
  --dw-lra: #8a8f75;
  --dw-carbon: #15191b;
  --dw-ffc: #b98a4a;
  --dw-steel: #8b979d;
  --dw-copper: #b9814f;
  --dw-copper-2: #e0a06a;
  --dw-on-copper: #20262a;
  --dw-guard: #5f9480;
  --dw-guard-2: #8cc2ad;
  --dw-sense: #e0a06a;
}

html:not(.js) .plate__bar, html:not(.js) .plate__hud { display: none; }
@media (prefers-reduced-motion: reduce) { .plate__pin, .key__n { transition: none; } }
