/* The scope on the front page: screen, traces, digital lines, zoom pane, measurements and controls.
   Colours come only from tokens.css; a trace's colour comes from data-channel (--cc). */

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.scope > * { min-width: 0; }
.bezel { background: var(--bezel); border-radius: 16px; padding: 10px; }
.screen { background: var(--screen); border-radius: 10px; padding: 10px 12px; display: grid;
          grid-template-columns: minmax(0, 1fr); gap: 8px; font-family: var(--mono); color: var(--text); text-shadow: var(--glow); }
.screen > * { min-width: 0; }
html[data-style=hc] .bezel, html[data-style=hc] .screen, html[data-style=hc] .strip, html[data-style=hc] .zoom { border: 2px solid #fff; }
@media (prefers-contrast: more) {
  html:not([data-style]) .bezel, html:not([data-style]) .screen, html:not([data-style]) .strip, html:not([data-style]) .zoom { border: 2px solid #fff; }
}
.screen .k, .zoom .k { color: var(--dim); text-shadow: none; }
.zoom .k { color: var(--zdim); }
.strip .k { color: var(--paneldim); margin-right: 2px; }

.status { display: flex; justify-content: space-between; gap: 2px 12px; font-size: 12px; flex-wrap: wrap; }
.status b { font-weight: 500; }

/* Record bar: the whole career, with a bracket on the part on screen. */
.rec { position: relative; height: 22px; border: 1px solid var(--grid); border-radius: 4px; cursor: pointer; touch-action: none; }
.rec svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.rarea { fill: var(--dim); fill-opacity: .22; stroke: var(--dim); stroke-opacity: .55; stroke-width: 1; }
.rbr { fill: var(--accent); fill-opacity: .08; stroke: var(--accent); stroke-width: 1.5; }

.plot { position: relative; height: 360px; border: 1px solid var(--grid); border-radius: 6px; touch-action: pan-y; cursor: grab; }
.plot svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hint, .dfold { margin: -4px 0 0; font-size: 11px; color: var(--dim); text-shadow: none; }

/* Style C: a smooth signal with a faint noise floor and a phosphor glow. Style A (hc, reduced motion): the line only. */
.gl { stroke: var(--grid); stroke-width: 1; }
.tr { fill: none; stroke: var(--cc); stroke-width: 2; stroke-linejoin: round; }
.glow { fill: none; stroke: var(--cc); stroke-width: 7; stroke-opacity: .16; stroke-linejoin: round; }
html[data-style=paper] .glow { stroke-opacity: .09; }
html[data-style=hc] .tr { stroke-width: 3; }
.tr.thin { stroke-opacity: .4; stroke-width: 1.5; }
.lab { fill: var(--dim); font: 11px var(--mono); }
.lab.cl { fill: var(--cc); }
.nosig { fill: var(--dim); font: 10px var(--mono); }
.msg { fill: var(--dim); font: 12px var(--sans); }
.ddiv { stroke: var(--dim); stroke-dasharray: 4 4; stroke-opacity: .6; }
.dl { fill: none; stroke: var(--dig); stroke-width: 1.5; }
.dbus { fill: var(--screen); stroke: var(--dig); stroke-width: 1.5; }
.dtx { fill: var(--dig); font: 9px var(--mono); }
.dlab { fill: var(--dim); font: 10px var(--mono); }
.dseg { cursor: pointer; outline: none; }
.dseg .hit { fill: transparent; }
.dseg:hover .dbus, .dseg:focus .dbus, .dseg:hover .dl, .dseg:focus .dl { stroke-width: 2.5; }
.dseg:focus .dbus, .dseg:focus .dl { stroke: var(--accent); }
.dopen { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.dopentx { fill: var(--accent); font: 9px var(--mono); }
.mlane { --cc: var(--cm); }
.mzero { stroke: var(--cm); stroke-opacity: .45; stroke-dasharray: 3 4; }
#dtip { position: absolute; z-index: 2; pointer-events: none; transform: translate(-50%, -100%); font: 11px var(--sans);
        background: var(--btn); color: var(--btntext); border: 1px solid var(--btnedge); border-radius: 4px; padding: 2px 6px;
        white-space: nowrap; text-shadow: none; }

/* The accent marks state only: selection, milestones, cursors, focus and the pressed fill. */
.mk { fill: var(--accent); cursor: pointer; outline: none; }
.mk:focus polygon { stroke: var(--pagetext); stroke-width: 2; }
.mkn { fill: var(--accent); font: 10px var(--mono); }
.cur { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 4; }
.cur.on { stroke-width: 3; }
.hl { fill: none; stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 3; }
.sel { fill: var(--accent); fill-opacity: .12; stroke: var(--accent); stroke-dasharray: 3 3; }

/* Overlay: one shared plot; a highlighted trace comes to the front, the rest dim. */
.ov.dim { opacity: .4; }
.ov.hot .tr { stroke-width: 3; }
@media (prefers-reduced-transparency: reduce) {
  .ov.dim { opacity: 1; }
  .ov.hot .tr { stroke-width: 4.5; }
  .ov.hot .glow { stroke-opacity: 0; }
  .sel, .rarea, .rbr { fill-opacity: 0; }
}

/* Buttons: standard grey; toggles fill with the accent when on; channel and digital buttons with their line colour. */
.btn { font: 12px var(--sans); text-transform: none; letter-spacing: normal; white-space: nowrap; background: var(--btn);
       color: var(--btntext); border: 1px solid var(--btnedge); border-radius: 6px; padding: 5px 9px; cursor: pointer;
       text-shadow: none; text-decoration: none; display: inline-block; }
.btn[aria-pressed=true] { background: var(--accent); color: var(--onaccent); border-color: var(--accent); }
.chb { border-color: var(--cc); white-space: normal; text-align: left; max-width: 100%; }
.chb[aria-pressed=true] { background: var(--cc); color: var(--chtext); border-color: var(--cc); }
.chb[aria-pressed=false] { background: transparent; color: var(--cc); border-style: dashed; }
.chb.quiet { border-style: dotted; }
.chb .ns { font-size: 10px; margin-left: 6px; text-transform: uppercase; letter-spacing: .05em; }
.dgb { --cc: var(--dig); }
.mth { --cc: var(--cm); }
.msel { font: 12px var(--sans); background: var(--btn); color: var(--btntext); border: 1px solid var(--btnedge);
        border-radius: 6px; padding: 4px 6px; max-width: 13.5em; }
.strip { gap: 8px 20px; }
.strip .grp { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-width: 0; max-width: 100%; }
.strip .morebtn { margin-left: auto; }
.strip .more { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; width: 100%;
               padding-top: 8px; border-top: 1px solid var(--btnedge); }
.strip .more[hidden] { display: none; }

/* Zoom pane: under the trace, never over it. */
.zoom { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 16px; align-items: start;
        background: var(--zbg); color: var(--ztext); border: 1px solid var(--grid); border-radius: 14px; padding: 12px;
        font-family: var(--sans); text-shadow: none; cursor: default; }
.zoom.span, .zoom.nophoto { grid-template-columns: minmax(0, 1fr); }
.zoom .photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: var(--grid); }
.zk { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.zk .btn { margin-left: auto; }
.zoom h3 { margin: 6px 0 2px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.zoom h3 a { color: inherit; text-decoration: none; }
.zoom h3 a:hover { text-decoration: underline; }
.zd { margin: 0 0 8px; font-size: 13px; color: var(--zdim); }
.story { margin: 0; line-height: 1.5; font-size: 14px; }
.zoom .proof { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 10px; font-size: 12px; }
.ptag { background: var(--tagbg); color: var(--zdim); border-radius: 4px; padding: 2px 8px; }
.plink { color: var(--ztext); text-decoration: underline; text-underline-offset: 2px; }
.zact { margin: 12px 0 0; }
.zoom .parts { margin: 10px 0 0; font-size: 13px; }
.rl { display: inline-block; margin-left: 4px; font: 600 10px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase;
      color: var(--zdim); border: 1px solid currentColor; border-radius: 3px; padding: 2px 4px; vertical-align: 2px; }
.rl.wip { color: var(--accent); }
.wave { display: block; width: 100%; margin: 8px 0 10px; background: var(--screen); border: 1px solid var(--grid); border-radius: 6px; }
.zoom .empty { color: var(--zdim); }
.more-note { margin-top: 6px; }

/* One project component: tiles and span cards. */
.screen .tiles, .pjs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pj { display: grid; grid-template-columns: auto auto minmax(0, 1fr); column-gap: 6px; row-gap: 2px; align-items: baseline;
      min-width: 0; text-align: left; font: 13px var(--sans); color: var(--ztext); background: transparent;
      border: 1px solid var(--grid); border-radius: 8px; padding: 7px 9px; cursor: pointer; text-shadow: none; }
.screen .pj { color: var(--text); }
.pj:hover { border-color: var(--zdim); }
.pj .dot { align-self: center; }
.pj .tag { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--zdim); }
.screen .pj .tag, .screen .pj .dt { color: var(--dim); }
.pj .ti { font-size: 14px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.pj .dt { grid-column: 3; font-size: 12px; color: var(--zdim); }
.tiles .more { grid-column: 1 / -1; justify-self: end; }
.screen .empty { margin: 0; font: 12px var(--sans); color: var(--dim); text-shadow: none; }

/* Measurements */
.mcap { margin-bottom: 4px; }
.mtw { overflow-x: auto; }
.mt { width: 100%; border-collapse: collapse; font: 12px var(--mono); min-width: 560px; }
.mt th { color: var(--dim); font-weight: 400; text-align: left; padding: 3px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.mt td { padding: 4px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.mt td:first-child { border-left: 3px solid var(--cc, var(--dim)); }
.mt td.sk { white-space: normal; min-width: 14em; }
.mt .mrow { --cc: var(--cm); }
.mt .mrow td { white-space: normal; min-width: 7em; }
.mt.dig { --cc: var(--dig); min-width: 0; }
.decode { margin-top: 10px; }
.rog { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ro { background: var(--grid); border-left: 3px solid var(--cc, var(--dim)); border-radius: 0 4px 4px 0; padding: 5px 8px;
      font-size: 12px; min-width: 0; overflow-wrap: anywhere; }
.ro span { color: var(--dim); }

#toast { position: fixed; right: 16px; bottom: 16px; background: var(--btn); color: var(--btntext); border: 1px solid var(--btnedge);
         padding: 8px 12px; border-radius: 8px; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.on { opacity: 1; }

@media (max-width: 820px) {
  .plot { height: 300px; }
  .zoom { grid-template-columns: minmax(0, 1fr); }
  .rog, .pjs, .screen .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip .grp { width: 100%; }
}
@media (max-width: 420px) { .pjs, .screen .tiles { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (forced-colors: active) {
  .mzero, .tr, .glow, .gl, .cur, .hl, .dl, .dbus, .ddiv { stroke: CanvasText !important; }
  .mk, .mkn { fill: Highlight; }
  .lab, .lab.cl, .dtx, .dlab, .nosig, .msg { fill: CanvasText !important; }
  .pj, .btn { border: 1px solid ButtonText; }
  .btn[aria-pressed=true] { background: Highlight; color: HighlightText; }
}
