/* Residentia site: page composition only.
   Colour, type and blocks come from Dock (tokens/, surfaces/web.css); nothing here defines either. */

/* One left edge for nav, hero, sections and footer. */
.w-nav-inner, .w-footer-inner, .w-hero-inner { max-width: calc(var(--web-container) + 2 * var(--web-gutter)); }

/* Anchor targets clear the sticky nav. */
.w-section[id], .w-hero[id] { scroll-margin-top: var(--web-nav-h); }

/* Hero */
.s-hero-title { margin-top: 18px; max-width: 1080px; text-wrap: balance; }
.s-hero-lede { margin-top: 24px; max-width: 58ch; }

/* Section head: eyebrow, heading, optional lede. One spacing rule for every section. */
.s-head { display: grid; gap: 16px; margin-bottom: var(--web-block); }
.s-head .w-h1 { max-width: 22ch; text-wrap: balance; }
.s-head .w-lede { margin-top: 8px; max-width: 62ch; }

/* Services: two by two, the service name as the kicker. */
.s-services { --cols: 2; --cols-md: 1; row-gap: var(--web-block); }
.s-services .num { text-transform: uppercase; }
.s-services p { max-width: 52ch; }

/* References: one sentence, two lists. */
.s-inuse { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: clamp(28px, 4vw, 72px); align-items: start; }
.s-inuse .w-lede { max-width: 30ch; }
.s-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.s-list li { font-size: var(--web-body); font-weight: var(--w-medium); line-height: 1.35; color: var(--head-c); }
.s-list li span { display: block; font-size: var(--web-small); font-weight: var(--w-light); color: var(--soft); }
/* A peek into the product: two panels of the real UI on one row, captured at phone width and shown a little larger
   than in the app (three across shrank them until the small print was unreadable).
   Each slot is a figure, so a panel can be swapped. The panels are white and differ a little in proportion: contain on a
   white ground fits each whole without cropping. */
.s-peek { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: var(--web-block); align-items: start; }
.s-peek figure { margin: 0; min-width: 0; }
.s-peek img { display: block; width: 100%; height: auto; aspect-ratio: 436 / 330; object-fit: contain; object-position: center; border: 1px solid var(--hair); border-radius: 8px; background: #fff; }
.s-peek figcaption { margin-top: 10px; font-size: var(--web-small); font-weight: var(--w-light); color: var(--soft); }
/* Above the three panels: the network map, wide, one point selected, the app's legend in frame. On a phone the crop
   keeps its height and shows the left part, where the legend is. */
.s-peek-map { margin: var(--web-block) 0 0; }
.s-peek-map img { display: block; width: 100%; height: auto; aspect-ratio: 1188 / 500; object-fit: cover; object-position: left bottom; border: 1px solid var(--hair); border-radius: 8px; background: #f2efe9; }
.s-peek-map figcaption { margin-top: 10px; display: flex; justify-content: space-between; gap: 2px 16px; flex-wrap: wrap; font-size: var(--web-small); font-weight: var(--w-light); color: var(--soft); }
.s-peek-credit { color: inherit; opacity: .75; text-decoration: none; }
.s-peek-credit:hover { text-decoration: underline; }
.s-peek-map + .s-peek { margin-top: 24px; }
.s-peek-note { margin: 18px 0 0; font-size: var(--web-small); font-weight: var(--w-light); color: var(--soft); opacity: .75; }

/* Case: the story, then three figures that each select a plot of the measured days.
   (generated by ../illustrations/result_plots.py; radio inputs and labels, no script.) */
.s-case .w-h2 { max-width: 24ch; text-wrap: balance; }
.s-case .w-body { max-width: 62ch; margin: 0; }
.s-case-scope { margin-top: 24px; max-width: 78ch; }
.s-res { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); grid-template-rows: repeat(3, 1fr); column-gap: clamp(24px, 4vw, 64px); border-top: var(--rule-strong) solid var(--head-c); }
.s-res input { position: absolute; opacity: 0; pointer-events: none; }
/* A figure is a tab. The edge that faces the plot is a track; the chosen figure's part of it is thick. */
.s-res .tab { grid-column: 2; display: grid; gap: 10px; align-content: center; padding: clamp(18px, 2vw, 28px) 0 clamp(18px, 2vw, 28px) clamp(20px, 2.4vw, 34px); border-left: var(--rule-hair) solid var(--hair); cursor: pointer; }
.s-res .tab + .tab { border-top: var(--rule-hair) solid var(--hair); }
.s-res .tab-1 { grid-row: 1; } .s-res .tab-2 { grid-row: 2; } .s-res .tab-3 { grid-row: 3; }
.s-res .label { font-family: var(--font-sans); font-weight: var(--w-medium); font-size: var(--web-label); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--soft); }
.s-res .value { font-family: var(--font-display); font-weight: var(--w-black); letter-spacing: var(--tracking-tight); line-height: 0.9; font-size: var(--web-stat); color: var(--head-c); white-space: nowrap; }
.s-res .value .unit { font-family: var(--font-display-alt); font-weight: var(--w-medium); font-size: 0.38em; letter-spacing: -0.02em; opacity: 0.7; margin-left: 4px; }
/* That a figure is a control has to show without hovering: the ones not chosen carry a link-styled cue,
   the chosen one sits on a filled ground that joins it to the plot. */
.s-res .go { justify-self: start; font-size: var(--web-small); font-weight: var(--w-medium); color: var(--head-c); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.s-res .tab:hover { background: color-mix(in srgb, var(--rs-purple-10) 55%, transparent); }
#res-1:checked ~ .tab-1, #res-2:checked ~ .tab-2, #res-3:checked ~ .tab-3 { box-shadow: inset 4px 0 0 var(--rs-purple); background: var(--rs-purple-10); cursor: default; }
#res-1:checked ~ .tab-1 .label, #res-2:checked ~ .tab-2 .label, #res-3:checked ~ .tab-3 .label { color: var(--head-c); }
#res-1:checked ~ .tab-1 .go, #res-2:checked ~ .tab-2 .go, #res-3:checked ~ .tab-3 .go { visibility: hidden; }
#res-1:focus-visible ~ .tab-1, #res-2:focus-visible ~ .tab-2, #res-3:focus-visible ~ .tab-3 { outline: 2px solid var(--rs-teal); outline-offset: -2px; }
/* The plot: measured days as dots, one trend line per period. Type sits in HTML over a stretched data layer,
   so the same markup serves every width. */
.s-res .plot { grid-column: 1; grid-row: 1 / span 3; display: none; margin: 0; padding: clamp(18px, 2vw, 28px) 0 0 34px; }
#res-1:checked ~ .plot-1, #res-2:checked ~ .plot-2, #res-3:checked ~ .plot-3 { display: block; }
.s-res .top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin: 0 0 12px -34px; }
.s-res .ttl { font-family: var(--font-sans); font-weight: var(--w-medium); font-size: var(--web-label); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--soft); margin: 0; }
.s-res .ttl.x { margin-top: 30px; text-align: right; }
.s-res .key { display: flex; gap: 18px; font-size: var(--web-small); font-weight: var(--w-medium); white-space: nowrap; }
.s-res .key span::before { content: ""; display: inline-block; width: 16px; height: 3px; margin-right: 7px; vertical-align: middle; background: currentColor; }
.s-res .key .on { color: var(--period-opt); } .s-res .key .off { color: var(--period-stop); }
.s-res .area { position: relative; aspect-ratio: 16 / 9; border-bottom: var(--rule-hair) solid var(--head-c); }
.s-res .area svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.s-res .area path { fill: none; vector-effect: non-scaling-stroke; }
.s-res .rule { stroke: var(--hair); stroke-width: 1; }
.s-res .dots { stroke-width: 4.5; stroke-linecap: round; stroke-opacity: 0.5; mix-blend-mode: multiply; }
.s-res .trend { stroke-width: 2.5; stroke-linejoin: round; }
.s-res .on { stroke: var(--period-opt); } .s-res .off { stroke: var(--period-stop); }
.s-res .yt, .s-res .xt { position: absolute; font-size: 12px; line-height: 1; color: var(--soft); font-variant-numeric: tabular-nums; }
.s-res .yt { right: 100%; margin-right: 8px; transform: translateY(-50%); }
.s-res .xt { top: 100%; margin-top: 9px; transform: translateX(-50%); }
.s-res figcaption { margin-top: 18px; font-size: var(--web-small); font-weight: var(--w-light); line-height: 1.45; color: var(--body-c); max-width: 62ch; margin-left: -34px; min-height: 2.9em; }
@media (max-width: 900px) {
  /* The figures become a row of three above the plot; the chosen one is marked on its lower edge. */
  .s-res { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto auto; column-gap: 0; }
  .s-res .tab { grid-row: 1; grid-column: auto; grid-template-rows: 1fr auto auto; align-content: stretch; padding: 14px 8px 16px; border-left: none; border-bottom: var(--rule-hair) solid var(--hair); }
  .s-res .tab + .tab { border-top: none; border-left: var(--rule-hair) solid var(--hair); }
  .s-res .go { font-size: 11px; text-underline-offset: 3px; }
  .s-res .tab-1 { grid-column: 1; } .s-res .tab-2 { grid-column: 2; } .s-res .tab-3 { grid-column: 3; }
  .s-res .label { font-size: 9px; letter-spacing: 0.05em; }
  .s-res .value { font-size: clamp(24px, 7.6vw, 40px); }
  #res-1:checked ~ .tab-1, #res-2:checked ~ .tab-2, #res-3:checked ~ .tab-3 { box-shadow: inset 0 -4px 0 var(--rs-purple); }
  .s-res .plot { grid-column: 1 / -1; grid-row: 2; padding-top: 20px; padding-left: 30px; }
  .s-res .top { flex-direction: column; gap: 8px; margin-left: -30px; }
  .s-res .area { aspect-ratio: 4 / 3; }
  .s-res .dots { stroke-width: 3.5; }
  .s-res .yt, .s-res .xt { font-size: 11px; }
  .s-res figcaption { margin-left: -30px; min-height: 0; }
}

/* Network illustration (generated by ../illustrations/network_svg.py, which enforces a complexity budget).
   Dock has no illustration style, so the drawing borrows the page's own means: flat square colour fields,
   square-cut lines, eyebrow and body type, one lime accent. */
.s-net { margin: 0 0 var(--web-block); border-top: 2px solid var(--rs-purple); border-bottom: 1px solid var(--ink-hair); }
.s-net svg { display: block; width: 100%; }
.s-net .wide { aspect-ratio: 960 / 384; }
.s-net .tall { aspect-ratio: 360 / 736; display: none; }
/* Line work is thin and in the page's ink, like the rules, the plot axes and the pipes on the map below;
   colour is left to the fields. The network is one pipe. */
.s-net .pipe { fill: none; stroke: var(--rs-purple); stroke-width: 3; stroke-linecap: butt; stroke-linejoin: miter; }
/* A building takes the colour of what its meter reports: teal, or copper where cooling is weak.
   Purple is left for the two blocks that are not buildings: the utility's plant and the platform. */
.s-net .plant, .s-net .plat-b { fill: var(--rs-purple); }
.s-net .blk { fill: var(--rs-teal); stroke: var(--rs-purple); stroke-width: 2; }
.s-net .blk.weak { fill: var(--series-3); }
/* Every building sends measurement data and the platform receives it: one radio mark each, in ink. */
.s-net .radio { fill: none; stroke: var(--rs-purple); stroke-width: 1.75; stroke-linecap: butt; }
/* Lime is the reserved accent: it marks RCS inside a building, and nothing else on the page. */
.s-net .chip { fill: var(--rs-lime); }
.s-net .blk.rcs { fill: var(--rs-lime); }
.s-net .rcs-t { fill: var(--rs-purple); font-family: var(--font-display-alt); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; }
/* One line leaves the platform: the demand forecast to the plant. (.link is the dotted control line, drawn only with --links.) */
.s-net .fore { fill: none; stroke: var(--rs-purple); stroke-width: 1.5; }
.s-net .fore-a { fill: var(--rs-purple); }
.s-net .link { fill: none; stroke: var(--rs-purple); stroke-width: 2; stroke-dasharray: 2 5; }
@media (prefers-reduced-motion: no-preference) {
  /* Only when the control lines are drawn: they move toward the buildings. */
  .s-net .link { animation: s-net-flow 1.4s linear infinite; }
}
@keyframes s-net-flow { to { stroke-dashoffset: -7; } }
.s-net .plat { fill: var(--rs-paper); font-family: var(--font-display); font-size: 17px; letter-spacing: -0.035em; }
.s-net .lab { fill: var(--rs-purple); font-family: var(--font-sans); font-size: 10.5px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; }
/* Bullet lines under a name: what RCS gives, and what the platform is. */
.s-net .bul { fill: var(--ink-soft); font-family: var(--font-sans); font-size: 11.5px; font-weight: 400; }
.s-net .bul.on { fill: var(--paper-soft); }
.s-net .tall .lab { font-size: 12px; letter-spacing: 0.14em; }
.s-net .tall .plat { font-size: 20px; }
.s-net .tall .bul { font-size: 13.5px; }
/* Below 900 px the wide layout's labels would fall under 9 px, so the tall layout takes over, at phone size. */
@media (max-width: 900px) {
  .s-net .wide { display: none; }
  .s-net .tall { display: block; max-width: 420px; margin-inline: auto; }
}

/* Audience cards share one height. */
.s-cards { align-items: stretch; }

/* Contact */
.s-contact { align-items: start; }
.s-contact .w-h1 { margin-top: 16px; max-width: 12ch; }
.s-contact .w-lede { padding-top: calc(var(--web-eyebrow) * 1.5 + 16px); }
.s-actions { margin: 28px 0 0; }
.s-contact-details { display: grid; grid-template-columns: 1fr 1fr; gap: var(--web-gap); margin-top: var(--web-block); }

.s-footer-blurb { margin-top: 16px; max-width: 34ch; }

/* The contact link sits in the menu only when the button is hidden. */
.s-nav-contact { display: none; }

@media (max-width: 900px) {
  .s-cards { grid-template-columns: 1fr; }
  .s-inuse { grid-template-columns: 1fr 1fr; }
  .s-inuse .w-lede { grid-column: 1 / -1; max-width: 46ch; }
  .s-peek { grid-template-columns: 1fr; gap: 28px; max-width: 440px; }
  .s-peek-map { max-width: 440px; }
  .s-peek-map img { aspect-ratio: 440 / 380; }
  .s-peek-map + .s-peek { margin-top: 28px; }
  .s-contact .w-lede { padding-top: 0; }
  /* On one column the case photo becomes a band above the story. */
  .s-case .w-teaser-photo { aspect-ratio: 16 / 9; }
}
@media (max-width: 640px) {
  /* The nav keeps the logo and the menu button; the contact link moves into the menu. */
  .w-nav-cta .w-btn { display: none; }
  .s-nav-contact { display: block; }
  .s-inuse, .s-contact-details { grid-template-columns: 1fr; }
}
