/* climate-sheet - the paged Climate sheet shell (#732, plan unit U6).
 * Matches docs/design/mockups/climate-dial-732.html. --v2-* tokens only, Manrope only.
 * JS: js/components/climate-sheet.js. Dark mode is .dark on <html>; tokens carry it. */

.cs-sheet {
  background: var(--v2-bg-primary);
  color: var(--v2-text-primary);
  font-family: var(--v2-font-body);
  border-radius: var(--v2-radius-xl) var(--v2-radius-xl) 0 0;
  box-shadow: var(--v2-sheet-shadow);
  height: min(844px, 92dvh);
  max-height: 92dvh;
}
.cs-sheet::before { background: var(--v2-sheet-handle-bg); opacity: 1; width: 36px; height: 4px; margin: 8px auto 0; }
.cs-host { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.cs-shell { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--v2-bg-primary); color: var(--v2-text-primary); font-family: var(--v2-font-body); }
.cs-shell * { box-sizing: border-box; }
.cs-shell button { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cs-ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Header */
.cs-top { display: flex; align-items: center; padding: 16px 12px 4px 20px; flex: none; }
.cs-top-t { flex: 1; min-width: 0; }
.cs-title { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.2; }
.cs-updated { margin: 0; font-size: 13px; font-weight: 500; line-height: 1.35; color: var(--v2-text-secondary); min-height: 17.5px; }
.cs-ibtn { position: relative; width: 44px; height: 44px; border: 0; background: none; color: var(--v2-text-primary); display: grid; place-items: center; border-radius: 50%; padding: 0; }
.cs-ibtn:active { background: var(--v2-bg-secondary); }
.cs-ibtn:focus-visible, .cs-tab:focus-visible, .cs-status:focus-visible { outline: 2px solid var(--v2-text-primary); outline-offset: -2px; }
.cs-badge { position: absolute; top: 4px; right: 2px; min-width: 16px; height: 16px; border-radius: 9999px; background: var(--v2-text-primary); color: var(--v2-bg-primary); font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 3px; }
.cs-badge[hidden] { display: none; }

/* Status row: coral only when something is wrong, quiet otherwise */
.cs-status { display: flex; gap: 8px; align-items: center; min-height: 48px; width: 100%; border: 0; background: none; padding: 0 20px; text-align: left; margin-top: 4px; font-size: 15px; font-weight: 600; line-height: 1.3; flex: none; }
.cs-status .cs-ic { width: 20px; height: 20px; }
.cs-status.is-active { color: var(--v2-pop-coral-text); }
.cs-status.is-fine { color: var(--v2-text-secondary); }
/* Issue 753: no signal reads as a warning; owners get Reconnect beside it, members a line under it. */
.cs-status.is-quiet { color: var(--v2-pop-ochre); }
.cs-status-row { display: flex; align-items: center; flex: none; margin-top: 4px; }
.cs-status-row .cs-status { flex: 1; min-width: 0; width: auto; margin-top: 0; }
.cs-status-row.has-reconnect .cs-status { padding-right: 4px; }
.cs-status-row.has-reconnect .cs-chev { display: none; }
.cs-reconnect { flex: none; display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 16px 0 8px; border: 0; background: none; color: var(--v2-text-primary); font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.cs-reconnect[hidden], .cs-who[hidden] { display: none; }
.cs-reconnect .cs-ic { width: 16px; height: 16px; }
.cs-reconnect:focus-visible { outline: 2px solid var(--v2-text-primary); outline-offset: -2px; }
.cs-who { margin: -6px 20px 4px 48px; font-size: 13px; line-height: 1.4; color: var(--v2-text-secondary); flex: none; }
.cs-status-t { flex: 1; min-width: 0; }
.cs-chev { color: var(--v2-text-tertiary); display: grid; }
.cs-chev .cs-ic { width: 16px; height: 16px; }
.cs-status.is-plain { cursor: default; }
.cs-status.is-plain .cs-chev { visibility: hidden; }

/* Tabs and the sliding underline (the fade mask only reads alpha) */
.cs-tabs { position: relative; overflow: hidden; margin-top: 8px; flex: none; border-bottom: 1px solid var(--v2-border-strong); -webkit-mask-image: linear-gradient(90deg, var(--v2-text-primary) calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, var(--v2-text-primary) calc(100% - 28px), transparent); }
.cs-tabs-in { position: relative; display: flex; gap: 8px; padding: 0 0 0 20px; width: max-content; height: 46px; will-change: transform; }
.cs-tab { height: 46px; border: 0; background: none; color: var(--v2-text-secondary); padding: 0 12px; text-align: center; white-space: nowrap; font-size: 15px; font-weight: 600; line-height: 1.3; }
/* The bold label is reserved in every tab, so picking a tab never nudges the others or the underline. */
.cs-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cs-tab::after { content: attr(data-label); font-weight: 700; height: 0; overflow: hidden; visibility: hidden; pointer-events: none; }
.cs-tab[aria-selected="true"] { color: var(--v2-text-primary); font-weight: 700; }
.cs-ind { position: absolute; bottom: -1px; left: 0; width: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--v2-text-primary); }

/* Pager: native scroll-snap, one page per swipe */
.cs-pager { flex: 1; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.cs-pager::-webkit-scrollbar { display: none; }
.cs-page { flex: 0 0 100%; width: 100%; min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; overflow-y: auto; overscroll-behavior-y: contain; padding: 24px 20px 40px; display: flex; flex-direction: column; gap: 32px; }

/* A chart plot keeps its own sideways drag for the finger readout: the browser never gives it to the pager.
   Only the plot: the lines around it (time window, readout) page like the rest of the sheet (#747). */
.cs-page .nur-chart--scrub,
.cs-page svg[data-scrub] { touch-action: pan-y; }

@media (prefers-reduced-motion: reduce) {
  .cs-pager { scroll-behavior: auto; }
}

/* Readings pages (U10): Moisture, Temperature, Humidity. Mockup: climate-dial-732.html (.hero, .meta, .slate, .sec-g).
 * The dial, range control, source link, summary and rows are styled in climate-dial.css and climate-range.css. */
.cs-page .cr-hero { display: flex; justify-content: center; margin: 0 -20px; flex: none; }
.cr-meta { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: -16px; flex: none; }
.cr-cal { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; min-height: 28px; text-align: center; font: 500 15px/1.35 var(--v2-font-body); color: var(--v2-pop-slate-text); }
.cr-cal[hidden] { display: none; }
.cr-cal-btn { position: relative; border: 0; background: none; padding: 0; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.cr-cal-btn::after { content: ''; position: absolute; inset: -12px -10px; }
.cr-cal-btn:focus-visible { outline: 2px solid var(--v2-text-primary); outline-offset: 4px; }
.cr-sec { display: flex; flex-direction: column; gap: 16px; flex: none; }
.cr-chart svg.nur-chart { display: block; width: 100%; height: auto; }
.cr-below { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.cr-note { margin: 0; min-height: 256px; display: flex; align-items: center; justify-content: center; text-align: center; font: 500 15px/1.4 var(--v2-font-body); color: var(--v2-text-secondary); }

/* Pushed sensor page (#732): covers the whole shell, so the header, status row and tabs step aside. */
.cs-shell { position: relative; }
.cs-sensor { position: absolute; inset: 0; z-index: 3; background: var(--v2-bg-primary); overflow-y: auto; -webkit-overflow-scrolling: touch; animation: cs-push 220ms ease-out; }
@keyframes cs-push { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cs-sensor { animation: none; } }
