/* ==========================================================================
   claude-experiences.css
   Claude's private branch of H&A V2.3 (revision 2): Site X-ray (C2) with a
   real-image mode, Commissioning Record (C1) with structured evidence fields,
   the instrument-reading component, and their art direction (C3). Every selector is scoped under .cx-* so this file
   can be merged without touching style.css. It relies on the existing :root tokens
   (--navy, --deep, --ink, --muted, --paper, --line, --copper).
   ========================================================================== */

:root {
  --cx-film: #eef1ef;        /* drafting film: X-ray section */
  --cx-table: #e3e8e5;       /* drawing table: Record section */
  --cx-sheet: #ffffff;
  --cx-blue: #2a5f8f;        /* X-ray linework */
  --cx-graphite: #6b7a86;    /* context linework */
  --cx-copper-dk: #95521a;   /* copper for strokes and text on light ground */
  --cx-copper-wash: #fbe5c8; /* selected fill */
  --cx-grid: #dde4e0;
  --cx-ease: cubic-bezier(.65, 0, .35, 1);
}

/* ---------- shared ---------- */
.cx-flag { display: flex; gap: 10px; align-items: baseline; margin-top: 14px; font-size: 15px; font-weight: 650; color: var(--ink); }
.cx-flag-mark { flex: none; width: 10px; height: 10px; border: 2px solid var(--cx-copper-dk); transform: translateY(1px); }

/* ==========================================================================
   SITE X-RAY
   ========================================================================== */
.cx-xray { background: var(--cx-film); border-top: 1px solid #c3cdc9; }
.cx-xr-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .78fr); gap: 14px clamp(24px, 5vw, 72px); align-items: end; margin-bottom: clamp(22px, 3.4vw, 40px); }
.cx-xr-head h2 { max-width: 14ch; }
.cx-xr-head p { color: var(--muted); max-width: 52ch; }
.cx-xr-head .cx-flag { color: var(--ink); }

.cx-xr-layout { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(300px, 1fr); gap: clamp(20px, 3vw, 44px); align-items: start; }

/* the drawing plate */
.cx-xr-plate { background: var(--cx-sheet); border: 1px solid var(--ink); min-width: 0; }
.cx-xr-toolbar { display: flex; flex-wrap: wrap; align-items: stretch; border-bottom: 1px solid var(--ink); }
.cx-xr-views { display: flex; }
.cx-xr-views button { min-height: 48px; min-width: 96px; padding: 8px 18px; border: 0; border-right: 1px solid var(--ink); background: transparent; color: var(--ink); font-size: 15px; font-weight: 700; }
.cx-xr-views button:hover { background: #eef2f4; }
.cx-xr-views button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.cx-xr-views button:focus-visible { outline-offset: -5px; }
.cx-xr-views button[aria-pressed="true"]:focus-visible { outline-color: #fff; }
.cx-xr-hint { align-self: center; margin: 0 0 0 auto; padding: 8px 16px; font-size: 14px; color: var(--muted); }

.cx-xr-stage {
  position: relative;
  aspect-ratio: 1200 / 720;
  background-color: #f7f9f8;
  background-image:
    linear-gradient(var(--cx-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--cx-grid) 1px, transparent 1px);
  background-size: 4.1666% 6.9444%;
  overflow: hidden;
}
.cx-xr-stage > svg, .cx-xr-facade, .cx-xr-facade svg { position: absolute; inset: 0; width: 100%; height: 100%; }

/* drawing vocabulary */
.cx-xr-svg .cx-ln, .cx-xr-facade .cx-ln { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linejoin: round; }
.cx-xr-svg .cx-ln-thin, .cx-xr-facade .cx-ln-thin { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.cx-xr-svg .cx-ln-ctx { fill: none; stroke: var(--cx-graphite); stroke-width: 1.6; stroke-linecap: round; }
.cx-xr-svg .cx-fill, .cx-xr-facade .cx-fill { fill: #fbfcfb; }
.cx-xr-svg .cx-hatch { stroke: #93a3ae; stroke-width: 1.2; }
.cx-xr-svg .cx-earth { stroke: none; opacity: .7; }
.cx-xr-svg .cx-ground { stroke-width: 3; }
.cx-xr-svg .cx-pole { stroke-width: 7; }
.cx-xr-svg .cx-frame .cx-ln-thin { stroke: #9aa9b4; stroke-width: 1; }
.cx-xr-svg .cx-cable { fill: none; stroke: var(--cx-blue); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.cx-xr-svg .cx-oth { stroke-dasharray: 9 7; }
.cx-xr-svg .cx-leader-dot { fill: var(--ink); stroke: none; }
.cx-xr-svg .cx-in .cx-leader-dot { fill: var(--cx-blue); }
.cx-xr-stage[data-active="1"] .cx-part[data-cx-part="1"] .cx-leader-dot,
.cx-xr-stage[data-active="2"] .cx-part[data-cx-part="2"] .cx-leader-dot,
.cx-xr-stage[data-active="3"] .cx-part[data-cx-part="3"] .cx-leader-dot,
.cx-xr-stage[data-active="4"] .cx-part[data-cx-part="4"] .cx-leader-dot { fill: var(--cx-copper-dk); }
.cx-xr-svg .cx-dot { fill: none; stroke: var(--ink); stroke-width: 7; stroke-linecap: round; }
.cx-xr-svg .cx-in .cx-ln, .cx-xr-svg .cx-in .cx-ln-thin, .cx-xr-svg .cx-in.cx-part .cx-ln, .cx-xr-svg .cx-in.cx-part .cx-ln-thin { stroke: var(--cx-blue); }

.cx-xr-facade .cx-facade-wall { fill: #e6eae7; stroke: var(--ink); stroke-width: 2.4; }
.cx-xr-facade .cx-ln-clad { stroke: #c4ccc8; stroke-width: 1; }

/* outside <-> X-ray wipe: the façade is clipped away from left to right */
.cx-xr-facade { clip-path: inset(0 0 0 0); transition: clip-path .72s var(--cx-ease); }
.cx-xr-stage[data-view="xray"] .cx-xr-facade { clip-path: inset(0 0 0 100%); }
.cx-xr-scan { position: absolute; top: 45%; bottom: 17.5%; left: 0; width: 2px; background: var(--cx-blue); box-shadow: 0 0 0 4px #2a5f8f22; opacity: 0; pointer-events: none; }
.cx-xr-stage.is-scan-in .cx-xr-scan { animation: cx-scan-in .72s var(--cx-ease) both; }
.cx-xr-stage.is-scan-out .cx-xr-scan { animation: cx-scan-out .72s var(--cx-ease) both; }
@keyframes cx-scan-in { 0% { left: 0; opacity: 1; } 92% { left: 100%; opacity: 1; } 100% { left: 100%; opacity: 0; } }
@keyframes cx-scan-out { 0% { left: 100%; opacity: 1; } 92% { left: 0; opacity: 1; } 100% { left: 0; opacity: 0; } }

/* focus a component: everything else steps back */
.cx-xr-svg .cx-part { transition: opacity .3s ease; }
.cx-xr-stage:not([data-active="0"]) .cx-part { opacity: .28; }
.cx-xr-stage[data-active="1"] .cx-part[data-cx-part="1"],
.cx-xr-stage[data-active="2"] .cx-part[data-cx-part="2"],
.cx-xr-stage[data-active="3"] .cx-part[data-cx-part="3"],
.cx-xr-stage[data-active="4"] .cx-part[data-cx-part="4"] { opacity: 1; }
.cx-xr-stage[data-active="1"] .cx-part[data-cx-part="1"] :is(.cx-ln, .cx-ln-thin, .cx-cable),
.cx-xr-stage[data-active="2"] .cx-part[data-cx-part="2"] :is(.cx-ln, .cx-ln-thin, .cx-cable),
.cx-xr-stage[data-active="3"] .cx-part[data-cx-part="3"] :is(.cx-ln, .cx-ln-thin, .cx-cable),
.cx-xr-stage[data-active="4"] .cx-part[data-cx-part="4"] :is(.cx-ln, .cx-ln-thin, .cx-cable) { stroke: var(--cx-copper-dk); }
.cx-xr-stage[data-active="1"] .cx-part[data-cx-part="1"] .cx-fill,
.cx-xr-stage[data-active="2"] .cx-part[data-cx-part="2"] .cx-fill,
.cx-xr-stage[data-active="3"] .cx-part[data-cx-part="3"] .cx-fill,
.cx-xr-stage[data-active="4"] .cx-part[data-cx-part="4"] .cx-fill { fill: var(--cx-copper-wash); }

/* hotspots: a 44px target around a 34px marker */
.cx-hotspot { position: absolute; z-index: 2; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 0; border: 0; background: transparent; display: grid; place-items: center; color: #fff; }
.cx-hotspot > span[aria-hidden] { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--navy); font-size: 16px; font-weight: 750; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--navy); transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease; }
.cx-hotspot:hover > span[aria-hidden] { transform: scale(1.1); }
.cx-hotspot[aria-expanded="true"] > span[aria-hidden] { background: var(--copper); color: #172436; box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--cx-copper-dk); }
.cx-hotspot:focus-visible { outline: 3px solid #215f9f; outline-offset: 0; border-radius: 50%; }
/* in the outside view, markers behind the wall read as hidden */
.cx-xr-stage[data-view="outside"] :is(.cx-hs-2, .cx-hs-3, .cx-hs-4):not([aria-expanded="true"]) > span[aria-hidden] { background: #fff; color: var(--ink); box-shadow: 0 0 0 2px var(--ink); outline: 2px dashed var(--ink); outline-offset: 3px; }
/* item balloons sit in free space; SVG leader lines run to each part */
.cx-hs-1 { left: 50%;    top: 27.22%; }
.cx-hs-2 { left: 20.83%; top: 69.44%; }
.cx-hs-3 { left: 51.25%; top: 54.44%; }
.cx-hs-4 { left: 74.58%; top: 76.11%; }

/* title block */
.cx-xr-titleblock { display: grid; grid-template-columns: auto minmax(0, 1.4fr) auto minmax(0, 1fr); margin: 0; border-top: 1px solid var(--ink); }
.cx-xr-titleblock > div { padding: 9px 14px; border-right: 1px solid var(--line); min-width: 0; }
.cx-xr-titleblock > div:last-child { border-right: 0; }
.cx-xr-titleblock dt { font-size: 13px; color: var(--muted); }
.cx-xr-titleblock dd { font-size: 14px; font-weight: 650; }

/* component index */
.cx-xr-index { min-width: 0; }
.cx-xr-index-title { font-size: 19px; letter-spacing: -.02em; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.cx-xr-list { list-style: none; margin: 0; padding: 0; }
.cx-xr-item { border-bottom: 1px solid #9eb0bb; }
.cx-xr-item h4 { margin: 0; font-size: inherit; }
.cx-xr-trigger { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 4px 14px; width: 100%; min-height: 60px; padding: 10px 4px; border: 0; background: transparent; color: var(--ink); text-align: left; }
.cx-xr-trigger:hover { background: #e3e9e6; }
.cx-xr-trigger:focus-visible { outline-offset: -3px; }
.cx-xr-num { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--ink); font-weight: 750; font-variant-numeric: tabular-nums; }
.cx-xr-name { font-size: 18px; font-weight: 700; line-height: 1.25; }
.cx-xr-kind { font-size: 14px; color: var(--muted); }
.cx-xr-trigger[aria-expanded="true"] { background: var(--cx-sheet); }
.cx-xr-trigger[aria-expanded="true"] .cx-xr-num { background: var(--copper); border-color: var(--copper); color: #172436; }
.cx-xr-detail { padding: 2px 4px 20px 52px; background: var(--cx-sheet); }
.cx-xr-detail p { color: var(--ink); max-width: 58ch; }
.cx-xr-detail h5 { margin: 16px 0 6px; font-size: 15px; letter-spacing: -.01em; }
.cx-xr-detail ul { margin: 0; padding-left: 18px; color: var(--muted); }
.cx-xr-detail li + li { margin-top: 3px; }
.cx-xr-why { margin-top: 14px; }
.cx-xr-note { margin-top: 12px; font-size: 14px; color: var(--muted); padding-left: 12px; border-left: 3px solid var(--cx-copper-dk); }
.cx-xr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; margin-top: 16px; }
.cx-xr-foot { margin-top: 14px; }
.cx-xr-foot .inline-arrow { color: var(--ink); }

/* opening a component: the detail settles into place */
.cx-js .cx-xr-detail.is-opening { animation: cx-rise .32s ease-out both; }
@keyframes cx-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   COMMISSIONING RECORD
   ========================================================================== */
.cx-record { background: var(--cx-table); border-top: 1px solid #c3cdc9; }
.cx-rec-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .62fr); gap: 16px clamp(24px, 5vw, 72px); align-items: end; margin-bottom: clamp(24px, 3.6vw, 44px); }
.cx-rec-head h2 { max-width: 15ch; }
.cx-rec-head p { color: var(--muted); max-width: 54ch; margin-top: 14px; }

/* the sheet: a document lying on the drawing table */
.cx-rec-sheet { background: var(--cx-sheet); border: 1px solid var(--ink); box-shadow: 12px 12px 0 #c6d0cb; }
.cx-rec-block { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.35fr) minmax(220px, .7fr); border-bottom: 2px solid var(--ink); }
.cx-rec-block-main { padding: clamp(16px, 2.4vw, 28px); border-right: 1px solid var(--ink); display: grid; align-content: space-between; gap: 14px; }
.cx-rec-no { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cx-rec-stamp { padding: 2px 8px; border: 1.5px solid var(--cx-copper-dk); color: var(--cx-copper-dk); font-size: 13px; font-weight: 650; line-height: 1.35; transform: rotate(-1deg); }
.cx-rec-block h3 { font-size: clamp(24px, 2.6vw, 36px); }
.cx-rec-block .cx-rec-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border-right: 1px solid var(--ink); }
.cx-rec-block .cx-rec-fields .cx-field { padding: 12px 16px; border-top: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cx-rec-block .cx-rec-fields .cx-field:nth-child(2n) { border-right: 0; }
.cx-rec-block .cx-rec-fields .cx-field:nth-last-child(-n + 2) { border-bottom: 0; }
.cx-rec-block .cx-rec-fields .cx-field-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.cx-rec-block .cx-rec-fields dd { font-size: 14px; }

/* placeholder: hatched, like an unfilled area on a drawing */
.cx-ph { padding: 0 6px; background: repeating-linear-gradient(135deg, #eef1ef 0 5px, #dfe6e2 5px 6px); border: 1px dashed #7d8f9c; color: #33475a; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.cx-rec-block h3 .cx-ph { font-weight: 650; }

/* stage navigation: nodes on a rail */
.cx-rec-nav { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px 24px; padding: clamp(16px, 2.4vw, 26px) clamp(14px, 2.4vw, 28px) 0; }
.cx-rec-tabs { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cx-rec-tabs::before, .cx-rec-tabs::after { content: ""; position: absolute; left: 10%; top: 23px; height: 2px; pointer-events: none; }
.cx-rec-tabs::before { right: 10%; background: #b6c2ca; }
.cx-rec-tabs::after { width: 0; background: var(--cx-copper-dk); transition: width .4s var(--cx-ease); }
.cx-rec-tabs[data-step="2"]::after { width: 20%; }
.cx-rec-tabs[data-step="3"]::after { width: 40%; }
.cx-rec-tabs[data-step="4"]::after { width: 60%; }
.cx-rec-tabs[data-step="5"]::after { width: 80%; }
.cx-rec-tabs [role="tab"] { position: relative; z-index: 1; display: grid; justify-items: center; gap: 6px; min-width: 0; padding: 0 2px 12px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-weight: 650; }
.cx-tab-n { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 2px solid #8da0ae; background: var(--cx-sheet); color: var(--ink); font-size: 17px; font-weight: 750; font-variant-numeric: tabular-nums; transition: background-color .2s ease, border-color .2s ease; }
.cx-tab-l { font-size: 14px; line-height: 1.2; text-align: center; }
.cx-rec-tabs [role="tab"][data-done] .cx-tab-n { border-color: var(--cx-copper-dk); background: var(--cx-copper-wash); }
.cx-rec-tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.cx-rec-tabs [role="tab"][aria-selected="true"] .cx-tab-n { background: var(--navy); border-color: var(--navy); color: #fff; }
.cx-rec-tabs [role="tab"]:hover .cx-tab-n { border-color: var(--ink); }
.cx-rec-tabs [role="tab"]:focus-visible { outline-offset: -2px; }
.cx-rec-all { justify-self: end; margin-bottom: 8px; color: var(--ink); }

/* stage panels */
.cx-rec-panel { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: clamp(20px, 3.4vw, 48px); padding: clamp(18px, 3vw, 40px) clamp(14px, 2.6vw, 40px); border-top: 1px solid var(--line); }
.cx-rec-panel:focus-visible { outline-offset: -4px; }
.cx-rec-n { font-size: clamp(64px, 8vw, 118px); line-height: .85; font-weight: 250; letter-spacing: -.06em; color: #b9c6ce; font-variant-numeric: tabular-nums; }
.cx-rec-text h4 { margin-top: 12px; font-size: clamp(24px, 2.4vw, 32px); letter-spacing: -.03em; }
.cx-rec-purpose { margin-top: 10px; font-size: clamp(17px, 1.5vw, 19px); color: var(--ink); max-width: 46ch; }
.cx-rec-text h5 { margin: 22px 0 6px; font-size: 15px; }

.cx-rec-figure { position: relative; align-self: start; margin: 8px 0 0; padding: 18px; background-color: #f5f7f6; background-image: linear-gradient(var(--cx-grid) 1px, transparent 1px), linear-gradient(90deg, var(--cx-grid) 1px, transparent 1px); background-size: 20px 20px; border: 1px solid #9fb0bb; }
.cx-rec-figure::before, .cx-rec-figure::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid var(--ink); }
.cx-rec-figure::before { top: -6px; left: -6px; border-right: 0; border-bottom: 0; }
.cx-rec-figure::after { right: -6px; bottom: -6px; border-left: 0; border-top: 0; }
.cx-rec-figure svg { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; }
.cx-rec-figure figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); }
.cx-il { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cx-il-acc { stroke: var(--cx-copper-dk); stroke-width: 2.6; }
.cx-il-dark { fill: var(--ink); }
.cx-il-dash { stroke-dasharray: 6 5; }

.cx-rec-step-nav { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.cx-rec-step-nav .text-btn { color: var(--ink); }

.cx-js .cx-rec-panel.is-entering { animation: cx-rise .3s ease-out both; }

/* "show all" reading mode, and the no-script fallback, stack every stage */
.cx-record:not(.cx-js) .cx-rec-nav, .cx-record:not(.cx-js) .cx-rec-step-nav { display: none; }
.cx-rec-sheet[data-mode="all"] .cx-rec-tabs { display: none; }
.cx-rec-sheet[data-mode="all"] .cx-rec-step-nav { display: none; }
.cx-rec-sheet[data-mode="all"] .cx-rec-nav { grid-template-columns: minmax(0, 1fr); padding-bottom: 6px; }
.cx-rec-sheet[data-mode="all"] .cx-rec-all { justify-self: start; }

/* publication gate and next action */
.cx-rec-after { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(20px, 3vw, 40px); margin-top: clamp(30px, 4vw, 52px); align-items: start; }
.cx-gate h3, .cx-rec-cta h3 { font-size: clamp(21px, 2vw, 26px); }
.cx-gate > p, .cx-rec-cta p { margin-top: 8px; color: var(--muted); max-width: 52ch; }
.cx-gate-list { list-style: none; margin: 16px 0 0; padding: 0; border-top: 2px solid var(--ink); }
.cx-gate-list li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 14px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid #a8b7c0; }
.cx-gate-mark { width: 16px; height: 16px; border: 2px solid var(--ink); background: var(--cx-sheet); transform: translateY(2px); }
.cx-gate-state { font-size: 14px; font-weight: 700; color: var(--cx-copper-dk); }
.cx-rec-cta { background: var(--navy); color: #fff; padding: clamp(20px, 2.6vw, 32px); }
.cx-rec-cta p { color: var(--light); }
.cx-rec-cta .primary-btn { margin-top: 18px; }
.cx-rec-cta :focus-visible { outline-color: #fff; }

/* link from the projects area (template, not a case) */
.cx-record-link { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; margin-top: clamp(16px, 2vw, 24px); font-size: 15px; }
.cx-record-link a { font-weight: 700; text-underline-offset: 5px; }
.cx-record-link span { color: var(--muted); }

@media (min-width: 1081px) {
  .cx-xr-plate { position: sticky; top: 88px; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .cx-xr-layout { grid-template-columns: minmax(0, 1fr); }
  .cx-rec-block { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
  .cx-rec-block .cx-rec-fields { border-right: 0; }
  .cx-ready { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--ink); }
}

@media (max-width: 760px) {
  .cx-xr-head, .cx-rec-head, .cx-rec-after { grid-template-columns: minmax(0, 1fr); }
  .cx-rec-block { grid-template-columns: minmax(0, 1fr); }
  .cx-rec-block-main { border-right: 0; border-bottom: 1px solid var(--ink); }
  .cx-rec-block .cx-rec-fields { border-bottom: 0; }
  .cx-rec-panel { grid-template-columns: minmax(0, 1fr); }
  .cx-rec-figure { max-width: 420px; }
  .cx-rec-nav { grid-template-columns: minmax(0, 1fr); }
  .cx-rec-all { justify-self: start; }
  .cx-rec-sheet { box-shadow: 6px 6px 0 #c6d0cb; }
  .cx-xr-titleblock { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cx-xr-titleblock > div:nth-child(2) { border-right: 0; }
  .cx-xr-titleblock > div:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .cx-xr-detail { padding-left: 4px; }
  .cx-xr-hint { margin-left: 0; width: 100%; border-top: 1px solid var(--line); }
}

@media (max-width: 480px) {
  .cx-xr-views { width: 100%; }
  .cx-xr-views button { flex: 1 1 50%; }
  .cx-xr-views button:last-child { border-right: 0; }
  .cx-hotspot > span[aria-hidden] { width: 30px; height: 30px; font-size: 15px; }
  .cx-tab-n { width: 40px; height: 40px; }
  .cx-rec-tabs::before, .cx-rec-tabs::after { top: 20px; }
  .cx-tab-l { font-size: 12px; letter-spacing: -.005em; white-space: nowrap; }
  .cx-rec-tabs [role="tab"] { padding-inline: 0; }
  /* the longest labels sit at the ends of the rail; let them use the outer edge instead of colliding inward */
  .cx-rec-tabs [role="tab"]:first-child .cx-tab-l { justify-self: start; }
  .cx-rec-tabs [role="tab"]:last-child .cx-tab-l { justify-self: end; }
  .cx-rec-block .cx-rec-fields .cx-field { padding: 10px 12px; }
  .cx-rec-block .cx-rec-fields dd { font-size: 13px; }
  .cx-rec-figure { max-width: 280px; padding: 12px; }
  .cx-xr-trigger { grid-template-columns: 30px minmax(0, 1fr); }
  .cx-xr-kind { grid-column: 2; }
}

/* ==========================================================================
   Reduced motion: every state change is instant; nothing scans or rises.
   ========================================================================== */
/* very narrow phones (below 340px): name only the selected stage; the others keep their names for assistive technology */
@media (max-width: 339px) {
  .cx-rec-tabs [role="tab"][aria-selected="false"] .cx-tab-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .cx-rec-tabs [role="tab"] .cx-tab-l { justify-self: center; }
  .cx-rec-tabs [role="tab"]:first-child .cx-tab-l { justify-self: start; }
  .cx-rec-tabs [role="tab"]:last-child .cx-tab-l { justify-self: end; }
}

@media (prefers-reduced-motion: reduce) {
  .cx-xr-facade, .cx-xr-svg .cx-part, .cx-hotspot > span[aria-hidden], .cx-rec-tabs::after, .cx-tab-n { transition: none; }
  .cx-xr-scan { display: none; }
  .cx-js .cx-xr-detail.is-opening, .cx-js .cx-rec-panel.is-entering { animation: none; }
  .cx-hotspot:hover > span[aria-hidden] { transform: none; }
}

/* without JavaScript the X-ray drawing is shown open and every detail is visible */
.cx-xray:not(.cx-js) .cx-xr-facade, .cx-xray:not(.cx-js) .cx-xr-views, .cx-xray:not(.cx-js) .cx-xr-hint { display: none; }


/* ==========================================================================
   REVISION 2 (V2.3 branch)
   ========================================================================== */

/* ---------- X-ray: what to look at (generic drawing / installation photo) ---------- */
.cx-xr-modes { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--ink); background: #e4eae7; }
.cx-xr-modes button { display: grid; gap: 1px; justify-items: start; min-height: 56px; padding: 9px 16px 8px; border: 0; border-top: 4px solid transparent; border-right: 1px solid #9eb0bb; background: transparent; color: var(--muted); text-align: left; }
.cx-xr-modes button:last-child { border-right: 0; }
.cx-xr-modes button span { font-size: 15px; font-weight: 700; line-height: 1.25; }
.cx-xr-modes button small { font-size: 13px; line-height: 1.3; }
.cx-xr-modes button:hover { background: #eef2f0; color: var(--ink); }
.cx-xr-modes button[aria-pressed="true"] { background: var(--cx-sheet); border-top-color: var(--ink); color: var(--ink); }
.cx-xr-modes button:focus-visible { outline-offset: -4px; }
.cx-xray:not(.cx-js) .cx-xr-modes { display: none; }
.cx-js .cx-xr-sheet.is-entering { animation: cx-rise .28s ease-out both; }

/* status that belongs to the visual on screen (V2.2 two-label chips) */
.cx-xr-status { padding: 10px 14px; border-top: 1px solid var(--line); }

/* live-in-daylight: dots along the DC run, plus a plain-language strip under the drawing */
.cx-xr-svg .cx-live-run { fill: none; stroke: var(--cx-copper-dk); stroke-width: 9; stroke-dasharray: 1 13; stroke-linecap: round; opacity: 0; transition: opacity .2s ease; }
.cx-xr-stage[data-view="xray"][data-active="1"] .cx-live-run { opacity: 1; }
.cx-xr-callout { margin: 0; padding: 10px 14px; border-top: 1px solid var(--line); border-left: 4px solid var(--cx-copper-dk); background: var(--cx-copper-wash); color: var(--ink); font-size: 14px; line-height: 1.45; }

/* real-image mode: photo stage, placeholder plate, spotlight */
.cx-xr-photo-stage { position: relative; aspect-ratio: 3 / 2; overflow: hidden; background: #d5dcd8; }
.cx-xr-photo-stage > svg, .cx-xr-photo-stage > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cx-ph-ground { fill: #d9e0dc; }
.cx-ph-hatch-ln { stroke: #c7d0cb; stroke-width: 2; }
.cx-ph-thirds { fill: none; stroke: #b2beb7; stroke-width: 2; stroke-dasharray: 6 10; }
.cx-ph-area { fill: rgba(255, 255, 255, .35); stroke: #5d6f7d; stroke-width: 2.5; stroke-dasharray: 10 8; }
.cx-xr-photo-msg { position: absolute; left: 24%; right: 24%; top: 36%; display: grid; gap: 2px; margin: 0; padding: 10px 14px; background: var(--cx-sheet); border: 1px solid var(--ink); text-align: center; font-size: 14px; line-height: 1.35; color: var(--muted); }
.cx-xr-photo-msg strong { color: var(--ink); font-size: 15px; }
.cx-xr-spot { pointer-events: none; }
.cx-spot-shade { fill: var(--navy); opacity: 0; transition: opacity .25s ease; }
.cx-spot-ring { fill: none; stroke: var(--copper); stroke-width: 3; vector-effect: non-scaling-stroke; opacity: 0; }
.cx-xr-photo-stage:not([data-active="0"]) .cx-spot-shade { opacity: .58; }
.cx-xr-photo-stage:not([data-active="0"]) .cx-spot-ring { opacity: 1; }
.cx-xr-index .cx-plain-note { margin-top: 18px; padding-left: 12px; border-left: 3px solid #9eb0bb; font-size: 14px; color: var(--muted); max-width: 52ch; }

/* ---------- Record: structured fields and evidence labels ---------- */
.cx-rec-head { grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); }
.cx-rec-intro .visual-status { margin-bottom: 10px; }
.cx-rec-intro p { margin-top: 0; }

.cx-fields { margin: 18px 0 0; }
.cx-field { min-width: 0; padding: 11px 0 12px; border-top: 1px dashed #8fa1ad; }
.cx-field:last-child { border-bottom: 1px dashed #8fa1ad; }
.cx-field dt { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.cx-field-label { font-size: 15px; font-weight: 700; color: var(--ink); }
.cx-field dd { margin: 6px 0 0; font-size: 15px; line-height: 1.5; color: var(--ink); }

.cx-tag { flex: none; padding: 1px 7px; border: 1px solid #5d6f7d; font-size: 12px; font-weight: 650; line-height: 1.5; color: var(--ink); background: var(--cx-sheet); white-space: nowrap; }
.cx-tag[data-tag="empty"] { border-style: dashed; color: var(--muted); }
.cx-tag[data-tag="confirmed"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.cx-tag[data-tag="reported"] { border-color: var(--navy); }
.cx-tag[data-tag="proposed"] { border-style: dotted; }
.cx-tag[data-tag="unresolved"] { border-color: var(--cx-copper-dk); background: var(--cx-copper-wash); color: #6e3a0e; }
.cx-tag[data-tag="unknown"] { background: #e3e8e5; border-color: #9eb0bb; color: var(--muted); }

.cx-ready { display: grid; align-content: start; gap: 10px; padding: clamp(14px, 2vw, 22px); border-left: 1px solid var(--ink); background: #f6f8f7; }
.cx-ready-verdict { display: flex; gap: 9px; align-items: baseline; margin: 0; font-size: 15px; color: var(--ink); }
.cx-ready-mark { flex: none; width: 11px; height: 11px; border: 2px solid var(--cx-copper-dk); transform: translateY(1px); }
.cx-ready[data-ready="true"] .cx-ready-mark { background: var(--navy); border-color: var(--navy); }
.cx-ready-counts { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
.cx-ready-counts span { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }

.cx-qkind { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; }
.cx-qkind li { padding: 1px 8px; border: 1px dashed #8da0ae; font-size: 13px; color: var(--muted); }
.cx-rec-kinds { margin-top: 14px; padding-left: 12px; border-left: 3px solid var(--ink); font-size: 15px; color: var(--ink); max-width: 52ch; }

.cx-obs { margin-top: 18px; border: 1px solid var(--ink); }
.cx-obs-title { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin: 0; padding: 9px 14px; border-bottom: 1px solid var(--ink); background: #f2f5f3; font-size: 14px; font-weight: 700; color: var(--ink); }
.cx-obs-link { font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.cx-obs .cx-fields { margin: 0; padding: 0 14px; }
.cx-obs .cx-field:first-child { border-top: 0; }
.cx-obs .cx-field:last-child { border-bottom: 0; }
.cx-obs.cx-obs-unlinked { border-color: var(--cx-copper-dk); }
.cx-obs.cx-obs-unlinked .cx-obs-link { color: var(--cx-copper-dk); }

/* image rights travel with every image slot */
/* the drawing area keeps the grid; caption and rights sit on plain paper below it */
.cx-rec-figure { padding-bottom: 14px; background-image: none; background-color: var(--cx-sheet); }
.cx-rec-figure svg { background-color: #f5f7f6; background-image: linear-gradient(var(--cx-grid) 1px, transparent 1px), linear-gradient(90deg, var(--cx-grid) 1px, transparent 1px); background-size: 20px 20px; }
.cx-rights { display: grid; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid #9fb0bb; }
.cx-rights-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 12px; margin: 0; font-size: 13px; }
.cx-rights-meta dt { color: var(--muted); }
.cx-rights-meta dd { margin: 0; color: var(--ink); font-weight: 600; }

.cx-rec-legend { padding: 16px clamp(14px, 2.6vw, 40px) 18px; border-top: 2px solid var(--ink); background: #f6f8f7; }
.cx-legend-title { margin: 0 0 8px; font-size: 14px; font-weight: 700; color: var(--ink); }
.cx-rec-legend ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; padding: 0; font-size: 14px; color: var(--muted); }
.cx-rec-legend li { display: flex; gap: 8px; align-items: baseline; }
.cx-legend-note { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.cx-gate-meta { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }

/* safety net: released-before-approval content is withheld on screen */
.cx-guarded dd > :not(.cx-guard-note) { display: none; }
.cx-guarded > :is(svg, img) { visibility: hidden; }
.cx-guard-note { margin: 6px 0 0; font-size: 14px; font-weight: 650; color: var(--cx-copper-dk); }

/* ---------- Instrument reading ---------- */
.cx-inst { align-self: start; min-width: 0; background: var(--cx-sheet); border: 1px solid var(--ink); }
.cx-inst-head { padding: 14px 16px 12px; }
.cx-inst-title { margin: 0; font-size: 17px; font-weight: 750; color: var(--ink); letter-spacing: -.01em; }
.cx-inst-sub { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.cx-capture { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.cx-capture > div { min-width: 0; padding: 8px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cx-capture > div:nth-child(2n) { border-right: 0; }
.cx-capture > div:nth-last-child(-n + 2) { border-bottom: 0; }
.cx-capture dt { font-size: 12px; color: var(--muted); }
.cx-capture dd { margin: 2px 0 0; font-size: 13px; font-weight: 600; color: var(--ink); }

.cx-inst-stage { position: relative; aspect-ratio: 480 / 320; max-width: 520px; margin: 14px 16px 10px; }
@media (min-width: 553px) { .cx-inst-stage { margin-inline: auto; } }
.cx-inst-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cx-in-case { fill: #eef1ef; stroke: var(--ink); stroke-width: 2.4; }
.cx-in-screen { fill: #dfe7e2; stroke: var(--ink); stroke-width: 2; }
.cx-in-node { fill: #f8faf9; stroke: #4c6072; stroke-width: 1.6; transition: fill .2s ease; }
.cx-in-ln { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cx-in-flow { fill: none; stroke: #6b7a86; stroke-width: 2; stroke-dasharray: 4 5; }
.cx-in-label { font-family: inherit; font-size: 15px; font-weight: 700; fill: var(--ink); }
.cx-in-value { font-family: inherit; font-size: 20px; font-weight: 600; fill: #46596d; }
.cx-in-key { fill: #fff; stroke: var(--ink); stroke-width: 2; }
.cx-in-led { fill: #9fb0bb; }
.cx-in-muted { opacity: .45; }
.cx-in-ring { fill: none; stroke: var(--cx-copper-dk); stroke-width: 3; opacity: 0; transition: opacity .2s ease; }
.cx-in-zone { transition: opacity .2s ease; }
.cx-inst-stage:not([data-active="0"]) .cx-in-zone { opacity: .35; }
.cx-inst-stage[data-active="1"] [data-cx-zone="1"],
.cx-inst-stage[data-active="2"] [data-cx-zone="2"],
.cx-inst-stage[data-active="3"] [data-cx-zone="3"] { opacity: 1; }
.cx-inst-stage[data-active="1"] [data-cx-zone="1"] .cx-in-ring,
.cx-inst-stage[data-active="2"] [data-cx-zone="2"] .cx-in-ring,
.cx-inst-stage[data-active="3"] [data-cx-zone="3"] .cx-in-ring { opacity: 1; }
.cx-inst-stage[data-active="1"] [data-cx-zone="1"] .cx-in-node,
.cx-inst-stage[data-active="2"] [data-cx-zone="2"] .cx-in-node,
.cx-inst-stage[data-active="3"] [data-cx-zone="3"] .cx-in-node { fill: var(--cx-copper-wash); }
.cx-inst-stage[data-active="1"] [data-cx-zone="1"] .cx-in-flow,
.cx-inst-stage[data-active="2"] [data-cx-zone="2"] .cx-in-flow,
.cx-inst-stage[data-active="3"] [data-cx-zone="3"] .cx-in-flow { stroke: var(--cx-copper-dk); stroke-dasharray: none; }

.cx-inst-hs { position: absolute; z-index: 2; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 0; border: 0; background: transparent; display: grid; place-items: center; color: #fff; }
.cx-inst-hs > span[aria-hidden] { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--navy); font-size: 15px; font-weight: 750; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--navy); transition: background-color .18s ease, box-shadow .18s ease; }
.cx-inst-hs[aria-expanded="true"] > span[aria-hidden] { background: var(--copper); color: #172436; box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--cx-copper-dk); }
.cx-inst-hs:focus-visible { outline: 3px solid #215f9f; outline-offset: 0; border-radius: 50%; }
.cx-inst:not(.cx-js) .cx-inst-hs { display: none; }

.cx-capture-rule { margin: 0; padding: 10px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--ink); background: #f2f5f3; font-size: 14px; color: var(--ink); }
.cx-inst-list { list-style: none; margin: 0; padding: 0 16px; }
.cx-inst-list > li { border-bottom: 1px solid #9eb0bb; }
.cx-inst-list h5 { margin: 0; font-size: inherit; }
.cx-inst-trigger { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 2px; border: 0; background: transparent; color: var(--ink); text-align: left; }
.cx-inst-trigger:hover { background: #eef2f0; }
.cx-inst-trigger:focus-visible { outline-offset: -3px; }
.cx-inst-name { font-size: 16px; font-weight: 700; }
.cx-inst-trigger[aria-expanded="true"] .cx-xr-num { background: var(--copper); border-color: var(--copper); color: #172436; }
.cx-inst-detail { padding: 0 0 14px 42px; }
.cx-inst-detail p { margin: 0 0 6px; font-size: 15px; color: var(--ink); max-width: 56ch; }
.cx-reading { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0; margin: 10px 0 0; border: 1px dashed #8da0ae; }
.cx-reading > div { padding: 7px 10px; min-width: 0; }
.cx-reading > div + div { border-left: 1px dashed #8da0ae; }
.cx-reading dt { font-size: 12px; color: var(--muted); }
.cx-reading dd { margin: 2px 0 0; font-size: 14px; font-weight: 650; color: var(--ink); }
.cx-reading-value { padding: 0 5px; background: repeating-linear-gradient(135deg, #eef1ef 0 5px, #dfe6e2 5px 6px); }
.cx-reading-rejected { border-color: var(--cx-copper-dk); }
.cx-reading-rejected .cx-reading-value { background: var(--cx-copper-wash); color: #6e3a0e; }
.cx-js .cx-inst-detail.is-opening { animation: cx-rise .28s ease-out both; }
.cx-inst-together { margin: 0; padding: 12px 16px 0; font-size: 14px; color: var(--muted); }
.cx-inst-together strong { color: var(--ink); }
.cx-inst .cx-rights { margin: 12px 16px 16px; }

@media (max-width: 760px) {
  /* single column: the instrument comes straight after the stage introduction, before the observation fields */
  .cx-rec-panel:has(.cx-inst) { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .cx-rec-panel:has(.cx-inst) > .cx-rec-text { display: contents; }
  .cx-rec-panel:has(.cx-inst) > .cx-rec-text > * { order: 1; }
  .cx-rec-panel:has(.cx-inst) > .cx-inst { order: 2; margin-top: 20px; }
  .cx-rec-panel:has(.cx-inst) > .cx-rec-text > .cx-obs { order: 3; margin-top: 22px; }
  .cx-rec-panel:has(.cx-inst) > .cx-rec-step-nav { order: 4; margin-top: 24px; }
}
@media (max-width: 760px) {
  .cx-rec-head { grid-template-columns: minmax(0, 1fr); }
  .cx-ready { grid-column: auto; }
  .cx-ready-counts { grid-template-columns: repeat(3, auto); justify-content: start; gap: 2px 14px; }
  .cx-rights-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* on small screens the chips and title block carry the "not released" message; the overlay would cover markers */
  .cx-xr-photo-msg { display: none; }
}
@media (max-width: 480px) {
  .cx-rec-figure { max-width: none; }
  .cx-rec-figure svg { max-width: 280px; margin-inline: auto; }
  .cx-xr-modes button { padding: 8px 12px 7px; }
  .cx-xr-titleblock > div { padding: 7px 12px; }
  .cx-xr-titleblock dt { font-size: 12px; }
  .cx-xr-titleblock dd { font-size: 13px; }
  .cx-xr-status { padding: 8px 12px; }
  .cx-xr-modes button span { font-size: 14px; }
  .cx-ready { padding: 12px; gap: 6px; }
  .cx-rec-block .cx-rec-fields { grid-template-columns: minmax(0, 1fr); }
  .cx-rec-block .cx-rec-fields .cx-field { border-right: 0; border-bottom: 1px solid var(--line); }
  .cx-rec-block .cx-rec-fields .cx-field:nth-last-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .cx-rec-block .cx-rec-fields .cx-field:last-child { border-bottom: 0; }
  .cx-rec-block .cx-rec-fields dd { margin-top: 3px; }
  .cx-ready-counts { grid-template-columns: minmax(0, 1fr); }
  .cx-inst-head { padding: 12px 12px 10px; }
  .cx-inst-stage { margin: 12px 10px 8px; }
  .cx-inst-list { padding: 0 12px; }
  .cx-inst-detail { padding-left: 0; }
  .cx-capture-rule, .cx-inst-together { padding-inline: 12px; }
  .cx-inst .cx-rights { margin-inline: 12px; }
  .cx-inst-hs > span[aria-hidden] { width: 28px; height: 28px; font-size: 14px; }
  .cx-reading { grid-template-columns: minmax(0, 1fr); }
  .cx-reading > div + div { border-left: 0; border-top: 1px dashed #8da0ae; }
}
@media (prefers-reduced-motion: reduce) {
  .cx-live-run, .cx-spot-shade, .cx-in-ring, .cx-in-zone, .cx-in-node, .cx-inst-hs > span[aria-hidden] { transition: none; }
  .cx-js .cx-xr-sheet.is-entering, .cx-js .cx-inst-detail.is-opening { animation: none; }
}
