/* erceau.com, scene "couches" (A tenant built layer upon layer): Copilot on top, the three layers of "your tenant" with
   their marks, then twenty years of platforms, slab on slab.
   The shared frame of the scenes (.scene-*) is in main.css. Behaviour: assets/js/scene-couches.js.
   The base state is the complete, still image: it is what shows without JavaScript and in reduced motion. */
.cc { padding-block: clamp(1.9rem, 4vw, 3rem); }
.cc-in { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 1rem; align-content: start; }
.cc .scene-freeze { justify-self: start; }
.cc .scene-note { margin-top: -.25rem; }

/* The status block keeps the height of its longest role (overly broad sharing), measured in French and in English for each
   width of the block: four lines, then one more each time the block gets too narrow. Nothing grows when a role arrives. */
.cc-state { container: cc-state / inline-size; }
.cc .scene-state { min-height: 7.25rem; }
@container cc-state (width < 28.75rem) { .cc .scene-state { min-height: 8.5rem; } }
@container cc-state (width < 24rem) { .cc .scene-state { min-height: 10rem; } }
@container cc-state (width < 20.75rem) { .cc .scene-state { min-height: 11.375rem; } }
@container cc-state (width < 17.5rem) { .cc .scene-state { min-height: 12.75rem; } }

/* The figure: a 500 x 866 drawing, the light canvas exactly over it. Everything inside is in the units of the drawing. */
.cc-fig { position: relative; container: cc-fig / inline-size; width: min(28.75rem, 100%); justify-self: center; }
.cc-svg { width: 100%; height: auto; overflow: visible; font-family: var(--f-display); font-size: 18px; }
.cc .scene-light { inset: 0; width: 100%; height: 100%; }
.cc-col { stroke: #a9c6f2; stroke-width: 1.6; opacity: .7; }
.cc-halo { fill: none; stroke: rgb(122 168 234 / .22); stroke-width: 7; stroke-linejoin: round; }
.cc-face { fill: rgb(122 168 234 / .09); stroke: #b9d2f6; stroke-width: 1.7; stroke-linejoin: round; }
.cc-front { fill: rgb(122 168 234 / .3); stroke: var(--cue); stroke-width: 1.2; }
.cc-ten .cc-face { fill: rgb(239 233 220 / .05); }
.cc-strata { stroke: rgb(122 168 234 / .45); stroke-dasharray: 3 5; }
.cc-top .cc-halo { stroke: rgb(212 171 87 / .25); }
.cc-top .cc-face { fill: rgb(212 171 87 / .1); stroke: #f0d28e; }
.cc-top .cc-front { fill: rgb(212 171 87 / .3); stroke: var(--brass); }
.cc-ring { fill: rgb(13 31 23 / .9); stroke: var(--brass); stroke-width: 2.4; }
.cc-dot { fill: #f0d28e; }
.cc-node > * { fill: none; stroke: #b9d2f6; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
.cc-node > rect { fill: rgb(13 31 23 / .9); stroke: var(--cue); }
.cc-node > .cc-side { fill: rgb(122 168 234 / .28); stroke: var(--cue); }
.cc-node > .cc-led { fill: #cfe0fa; stroke: none; }
.cc-tick { stroke: rgb(122 168 234 / .4); stroke-dasharray: 2 4; }
.cc-sq { fill: var(--ball-red); }
.cc-red { fill: var(--ball-red); stroke: #ff8a70; stroke-width: 1.5; opacity: 0; }
.cc-ok { fill: var(--brass); stroke: #f6e2b0; }

/* The labels: years in brass, platforms dimmed, the two headings and the three risks in chalk */
.cc-name { fill: #f0d28e; font-weight: 700; }
.cc-year { fill: var(--brass); font-weight: 700; }
.cc-plat { fill: var(--chalk-dim); font-weight: 500; }
.cc-head { fill: var(--chalk); font-weight: 700; }
.cc-rt { fill: var(--chalk); font-weight: 600; }

/* The nodes: one box per level, lit when it is pointed, chosen or focused (the focus ring is drawn: an outline on a g is not reliable) */
.cc-box { fill: transparent; stroke: transparent; stroke-width: 2; }
.cc-hit { outline: none; }
.is-held .cc-hit { cursor: pointer; }
.is-held .cc-hit:hover .cc-box, .cc-hit[aria-pressed="true"] .cc-box { fill: rgb(122 168 234 / .06); stroke: rgb(122 168 234 / .3); }
.is-held .cc-risk:hover .cc-box, .cc-risk[aria-pressed="true"] .cc-box { fill: rgb(200 55 45 / .08); stroke: rgb(255 138 112 / .4); }
.cc .cc-hit:focus-visible .cc-box { fill: rgb(212 171 87 / .07); stroke: var(--brass); }

/* Legend swatches, and the two headings of the text version */
.cc-sw { flex: none; width: 1.125rem; height: .25rem; border-radius: 1px; forced-color-adjust: none; }
.cc-sw-b { background: var(--cue); }
.cc-sw-r { width: .5625rem; height: .5625rem; background: var(--ball-red); }
.cc-sw-k { background: var(--brass); }
.cc-part { margin-top: .75rem; font-family: var(--f-display); font-weight: 700; font-size: 1rem; }

/* A drawing under 334 px wide (a window under 375 px): the labels grow and narrow to stay 12 px tall on screen, their lines
   move apart, and the three layers of the tenant get taller boxes (32 px on screen), which the two headings make room for. */
@container cc-fig (width < 334px) {
  .cc-svg { font-size: 21.5px; font-stretch: 80%; }
  .cc-plat { translate: 0 1.5px; }
  .cc-plat + .cc-plat { translate: 0 3.5px; }
  .cc-h1 { translate: 0 -10px; }
  .cc-h2 { translate: 0 6.5px; }
  .cc-risk .cc-box { transform-origin: 0 210px; scale: 1 1.2083; }
}

/* Side by side from 1000 px: the texts on the left, the figure on the right, as tall as the window allows (never so small
   that a label goes under 12 px). The figure spans one row more than the texts fill: that empty row takes the height left. */
@media (min-width: 62.5rem) {
  .cc-in { grid-template-columns: minmax(0, 1fr) auto; column-gap: 3rem; }
  .cc-in > * { grid-column: 1; }
  .cc-in > .cc-fig { grid-column: 2; grid-row: 1 / span 7; width: max(21rem, min(32.5rem, (90vh - 4.625rem) * .574)); }
}

/* The story the script plays: a level and its columns come in when they are traced, a mark waits, turns red, is mended,
   and Copilot is blue until then. Without the script, and in reduced motion, none of these classes shows. */
@media screen and (prefers-reduced-motion: no-preference) {
  .cc-draw, .cc-col { transition: opacity .35s ease; }
  .cc-draw.is-off, .cc-col.is-off, .is-due .cc-ok { opacity: 0; }
  .is-red .cc-red { opacity: 1; }
  .is-cue .cc-halo { stroke: rgb(122 168 234 / .22); }
  .is-cue .cc-face { fill: rgb(122 168 234 / .09); stroke: #b9d2f6; }
  .is-cue .cc-front { fill: rgb(122 168 234 / .3); stroke: var(--cue); }
  .is-cue .cc-ring { stroke: var(--cue); }
  .is-cue .cc-dot { fill: #cfe0fa; }
}

/* In forced colours there is no canvas and nothing moves: the still image stays whole, in its own colours on its own felt. */
@media (forced-colors: active) {
  .cc-fig { forced-color-adjust: none; background: var(--felt); }
}
