/* ==========================================================================
   Product spec pages (/products/<product>)
   Scoped under .spec so nothing here can leak into the rest of the site.
   Uses the site tokens from styles.css — no new palette, and no inline
   styles anywhere (the CSP forbids them).
   ========================================================================== */

.spec { font-family: var(--font-body); }
.spec .wrap-narrow { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.spec .num, .spec td, .spec th { font-variant-numeric: tabular-nums; }

/* -- hero ---------------------------------------------------------------- */
.spec-crumbs { font-size: 0.875rem; color: var(--muted); padding-top: 28px; margin: 0; }
.spec-crumbs a { color: var(--muted); }
.spec-hero { padding: 10px 0 36px; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 40px; align-items: end; }
.spec-hero h1 { margin: 6px 0 12px; text-wrap: balance; }
.spec-hero h1 .ka-name { display: block; font-size: 0.46em; color: var(--accent); margin-top: 10px; }
.spec-lede { font-size: 1.1rem; max-width: 58ch; margin: 0; text-wrap: pretty; }
.spec-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 0; }
.spec-facts > div { background: var(--panel); padding: 14px 16px; }
.spec-facts dt { font-family: var(--font-display); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.spec-facts dd { margin: 4px 0 0; font-weight: 600; }
@media (max-width: 820px) { .spec-hero { grid-template-columns: 1fr; gap: 24px; } }

/* -- jump chips ---------------------------------------------------------- */
.spec-jump { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 30px; margin: 0; list-style: none; }
.spec-jump a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--line); background: var(--panel); color: var(--paper); text-decoration: none; font-family: var(--font-mono); font-size: 0.875rem; }
.spec-jump a small { font-family: var(--font-body); color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .spec-jump a:hover { border-color: var(--accent); } }

/* -- the "80 mm is not one thing" band ----------------------------------- */
.spec-trap { background: var(--charcoal); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: clamp(36px, 6vw, 64px) 0; }
.spec-trap .wrap-narrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(24px, 5vw, 64px); align-items: center; }
.spec-trap p { margin: 0 0 14px; max-width: 56ch; }
.spec-note { border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 14px 16px; font-size: 0.97rem; }
.spec-note strong { color: var(--accent); }
.xs-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.xs { margin: 0; background: var(--panel); border: 1px solid var(--line); padding: 18px 16px 14px; display: flex; flex-direction: column; align-items: center; }
.xs svg { height: 250px; width: auto; overflow: visible; }
.xs-shape { stroke-width: 1.5; }
.xs-gost .xs-shape { fill: var(--line); stroke: var(--muted); }
.xs-upn .xs-shape { fill: var(--accent); stroke: var(--accent); }
.xs-dim { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.xs-t { font-family: var(--font-mono); font-size: 11px; fill: var(--muted); text-anchor: middle; }
.xs-l { text-anchor: start; }
.xs figcaption { display: flex; justify-content: space-between; align-items: baseline; width: 100%; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.xs-name { font-family: var(--font-mono); font-size: 0.8rem; }
.xs-kg { font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; }
.xs-kg small { font-family: var(--font-body); font-weight: 400; font-size: 0.8rem; color: var(--muted); }
.xs-cap { grid-column: 1 / -1; font-size: 0.8rem; color: var(--muted); margin: 0; }
@media (max-width: 860px) { .spec-trap .wrap-narrow { grid-template-columns: 1fr; } }

/* -- standards, one collapsible block each ------------------------------- */
.spec-standards { padding: clamp(40px, 6vw, 72px) 0 20px; }
.spec-standards > .wrap-narrow > p { max-width: 62ch; color: var(--muted); margin: 0 0 26px; }
.std { border: 1px solid var(--line); background: var(--panel); margin-bottom: 12px; }
.std summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 16px; padding: 16px 20px; min-height: 64px; touch-action: manipulation; }
.std summary::-webkit-details-marker { display: none; }
.std .code { font-family: var(--font-mono); font-size: 0.85rem; color: var(--accent); white-space: nowrap; }
.std h3 { margin: 0; font-size: 1.1rem; }
.std .chev { width: 18px; height: 18px; color: var(--muted); transition: transform 200ms cubic-bezier(0.25, 1, 0.5, 1); }
.std details[open] > summary .chev, .std[open] > summary .chev { transform: rotate(180deg); }
.std details[open] > summary { border-bottom: 1px solid var(--line); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600; padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
.badge svg { width: 14px; height: 14px; }
.badge.ok { color: #7fd49c; background: #16291d; }
.badge.wait { color: #f0c05a; background: #2c2413; }
[data-theme="light"] .badge.ok { color: #1f6b3a; background: #e3f2e8; }
[data-theme="light"] .badge.wait { color: #7a4d00; background: #fbeecb; }
.std-body { padding: 18px 20px 22px; }
.std-body p { max-width: 70ch; margin: 0 0 12px; }
.std-body.pending p:last-child { margin-bottom: 0; }
.std-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin: 4px 0 12px; }
.std-src { font-size: 0.83rem; color: var(--muted); }
@media (max-width: 620px) {
  .std summary { grid-template-columns: 1fr auto; gap: 6px 12px; }
  .std .code { grid-column: 1 / -1; }
  .std .badge { grid-row: 3; justify-self: start; }
  .std .chev { grid-row: 2; grid-column: 2; }
}

/* -- the section-properties switch (CSS only, no JS) --------------------- */
.spec-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; font-weight: 600; }
.spec-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.spec-toggle .sw { width: 40px; height: 22px; border-radius: 11px; background: var(--line); position: relative; flex: none; }
.spec-toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--panel); transition: transform 180ms cubic-bezier(0.25, 1, 0.5, 1); }
.spec-toggle input:checked + .sw { background: var(--accent); }
.spec-toggle input:checked + .sw::after { transform: translateX(18px); }
.spec-toggle input:focus-visible + .sw { outline: 3px solid var(--accent); outline-offset: 3px; }
.std .prop { display: none; }
.std:has(.show-props:checked) .prop { display: table-cell; }

/* -- tables -------------------------------------------------------------- */
.spec .tbl { overflow-x: auto; border: 1px solid var(--line); background: var(--panel); -webkit-overflow-scrolling: touch; }
.spec .tbl table { border-collapse: collapse; width: 100%; font-size: 0.94rem; white-space: nowrap; }
.spec .tbl caption { text-align: left; font-size: 0.83rem; color: var(--muted); padding: 0 0 8px; }
.spec .tbl thead th { font-weight: 600; font-size: 0.8rem; color: var(--muted); text-align: right; padding: 12px 14px; background: var(--charcoal); border-bottom: 1px solid var(--line); vertical-align: bottom; }
.spec .tbl thead th .u { display: block; font-weight: 400; font-size: 0.72rem; margin-top: 3px; }
.spec .tbl td, .spec .tbl tbody th { padding: 9px 14px; border-bottom: 1px solid var(--line); text-align: right; }
.spec .tbl thead th:first-child, .spec .tbl tbody th { text-align: left; }
.spec .tbl tbody th { font-family: var(--font-mono); font-size: 0.87rem; font-weight: 500; position: sticky; left: 0; background: var(--panel); z-index: 1; }
.spec .tbl thead th:first-child { position: sticky; left: 0; z-index: 2; }
.spec .tbl tbody tr:last-child > * { border-bottom: 0; }
.spec .tbl td.kg { font-weight: 700; }
.spec .tbl thead th.kg { color: var(--accent); }
.spec .tbl .ser { display: block; font-family: var(--font-body); font-size: 0.72rem; color: var(--muted); }
.spec .tbl .diff { font-weight: 700; color: var(--accent); text-align: left; min-width: 150px; }
.spec .bar { display: inline-block; width: 70px; height: 6px; background: var(--line); vertical-align: middle; margin-right: 8px; }
.spec .bar i { display: block; height: 100%; background: var(--accent); }
.spec .w3 { width: 30%; } .spec .w4 { width: 40%; } .spec .w5 { width: 50%; }
.spec .w6 { width: 60%; } .spec .w7 { width: 70%; } .spec .w8 { width: 80%; }
.spec .w9 { width: 90%; } .spec .w10 { width: 100%; }
@media (hover: hover) and (pointer: fine) { .spec .tbl tbody tr:hover > * { background: color-mix(in srgb, var(--accent) 10%, transparent); } }

/* -- per-standard metadata strip ----------------------------------------- */
.std-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 16px 0 0; }
.std-meta > div { background: var(--panel); padding: 12px 14px; font-size: 0.94rem; }
.std-meta b { display: block; font-family: var(--font-display); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }

/* -- reference blocks below the standards -------------------------------- */
.spec-ref { padding: 30px 0 clamp(48px, 7vw, 80px); }
.spec-ref h2 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); margin: 0 0 14px; }
.spec-ref p { max-width: 62ch; }
.spec-ref .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: clamp(28px, 4vw, 48px); margin-top: clamp(36px, 5vw, 56px); }
.spec-ref .tbl + h2 { margin-top: 34px; }
.spec-ref .tbl td, .spec-ref .tbl thead th { text-align: left; }
.spec-ref .tbl tbody th { font-family: var(--font-body); font-weight: 600; }

/* -- closing call to action ---------------------------------------------- */
.spec-cta { background: var(--charcoal); border-top: 1px solid var(--line); padding: clamp(40px, 6vw, 64px) 0; }
.spec-cta .wrap-narrow { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: center; }
.spec-cta h2 { margin: 0 0 6px; }
.spec-cta p { margin: 0; color: var(--muted); max-width: 56ch; }

/* -- the SPECS link on a catalogue card ---------------------------------- */
.product-spec-link { display: inline-block; margin: 0 0 12px; font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); }

/* -- added for the generated pages --------------------------------------- */
.badge.calc { color: #9cc6f0; background: #14222f; }
[data-theme="light"] .badge.calc { color: #1d4f7a; background: #e2eef8; }
.spec-trap-solo .wrap-narrow { grid-template-columns: minmax(0, 1fr); }
.spec-trap-solo p { max-width: 70ch; }

/* Dimensioned product comparisons: a shared scale within each pair. */
.cmp-pair { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; min-width:0; }
.cmp-card { margin:0; padding:14px; min-width:0; background:var(--panel); border:1px solid var(--line); }
.cmp-card svg { display:block; width:100%; height:auto; }
.cmp-material { fill:var(--muted); }
.cmp-accent .cmp-material { fill:var(--accent); }
.cmp-hole { fill:var(--panel); }
.cmp-core { fill:var(--line); }
.cmp-accent .cmp-core { fill:color-mix(in srgb,var(--accent) 24%,var(--panel)); }
.cmp-fibre { fill:none; stroke:var(--muted); stroke-width:1; }
.cmp-label { fill:var(--muted); font:11px var(--font-mono); text-anchor:middle; }
.cmp-dim { fill:none; stroke:var(--muted); stroke-width:1; stroke-dasharray:3 3; }
.cmp-card figcaption { border-top:1px solid var(--line); padding-top:12px; display:flex; flex-wrap:wrap; gap:8px 12px; align-items:baseline; justify-content:space-between; }
.cmp-card figcaption > span { font:0.78rem var(--font-mono); }
.cmp-card strong { font:600 1.5rem var(--font-display); white-space:nowrap; }
.cmp-card small { display:block; font:0.75rem var(--font-body); color:var(--muted); }
.cmp-caption { grid-column:1/-1; font-size:0.82rem; color:var(--muted); }
@media(max-width:520px) { .cmp-pair { grid-template-columns:1fr; } .cmp-card svg { max-height:260px; } .xs-pair { grid-template-columns:1fr; } .xs svg { max-width:100%; } }
