/*
 * ui-frame (ADR 0149 clause 1; design-silos 090): the page every service puts its content inside.
 * Transcribed from design-silos designs/_ui/service-shell-v3.css, whose .ss-app review scaffolding supplied the
 * window height that the frame now owns itself.
 *
 *   .sr-frame                 a grid as tall as the window: header, main, consent, footer
 *     .sr-frame-header        row 1: the header and its breadcrumbs strip (ui-header)
 *     main.sr-main            row 2: the only vertical scroll container, spanning the window
 *       .sr-frame-content     the website's own inset: Bootstrap 5.3.3's .container
 *     .sr-frame-consent       row 3: the consent bar, directly above the footer and over nothing (ui-consent)
 *     .sr-frame-footer        row 4: the footer, whose bottom is the window's (ui-footer)
 *
 * The rows are the frame's own wrappers, so it names no other family's class, and they make no stacking context: a
 * header that rises to --sr-frame-popup-layer rises above main, the consent row and the footer.
 */

/* The two tokens header, footer and breadcrumbs already read and nobody defined: the frame owns them. */
:root {
  --sr-frame-max-width: 1248px; /* the header and footer rows */
  --sr-frame-popup-layer: 300; /* an open disclosure is above main, the consent row and the footer */
}

.sr-frame {
  container: sr-frame / inline-size;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  block-size: 100dvh;
  min-block-size: 0;
  position: relative;
  isolation: isolate;
  color: var(--sr-site-text, CanvasText);
  background: var(--sr-site-bg, Canvas);
  font: 15px/1.5 var(--sr-font-sans, system-ui, sans-serif);
}

.sr-frame-header { grid-row: 1; min-inline-size: 0; }
/*
 * Design 957 draws the consent row in the shell's brand sans, like 070's header and 080's footer. The consent family
 * reads its face from two inheritable tokens, so the frame sets them on its own row; a consent bar outside any frame
 * keeps its face.
 */
.sr-frame-consent {
  grid-row: 3; min-inline-size: 0;
  --sr-consent-font: var(--sr-font-sans, var(--sr-site-font-body, system-ui));
  --sr-consent-font-head: var(--sr-font-sans, var(--sr-site-font-body, system-ui));
}
.sr-frame-footer { grid-row: 4; min-inline-size: 0; }

/* One scrollbar: main scrolls, and it spans the window, so its scrollbar is at the page's far right. */
.sr-main {
  grid-row: 2;
  min-block-size: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-block: 48px;
  scroll-padding-block: 20px;
  background-color: var(--sr-site-bg, Canvas);
  background-image: radial-gradient(var(--sr-site-bg-grid, transparent) 1px, transparent 1px);
  background-size: 20px 20px;
}
.sr-main:focus-visible { outline-offset: -2px; }

/* The website's own content inset: Bootstrap 5.3.3 .container, as savantrealms.com ships it. */
.sr-frame-content {
  box-sizing: border-box;
  inline-size: 100%;
  margin-inline: auto;
  padding-inline: .75rem;
}
@container sr-frame (min-width: 576px) { .sr-frame-content { max-inline-size: 540px; } }
@container sr-frame (min-width: 768px) { .sr-frame-content { max-inline-size: 720px; } }
@container sr-frame (min-width: 992px) { .sr-frame-content { max-inline-size: 960px; } }
@container sr-frame (min-width: 1200px) { .sr-frame-content { max-inline-size: 1140px; } }
@container sr-frame (min-width: 1400px) { .sr-frame-content { max-inline-size: 1320px; } }
@container sr-frame (max-width: 48rem) { .sr-main { padding-block: 32px; } }

/* While the frame holds the window, the document itself neither scrolls nor keeps a margin. */
:root:has(.sr-frame:not([data-flow])) { overflow: clip; }
body:has(.sr-frame) { margin: 0; }

/* Locked: only the content between the header and the consent row is blurred (and, by the page behaviour, inert). */
.sr-frame[data-locked] > .sr-main { filter: blur(4px); opacity: .7; pointer-events: none; user-select: none; }
/* The header and footer stay usable, except the controls that would add a cookie (957 Q13). */
.sr-frame[data-locked] > :is(.sr-frame-header, .sr-frame-footer) [data-sets-cookie] { opacity: .5; pointer-events: none; }

/*
 * Short windows: below 500px of window height, or with under 160px left for main, everything flows as one page
 * (ADR 0139's fallback, kept for WCAG 1.4.10), with the consent bar first. The page behaviour sets data-flow; the
 * media query is the same flow for a page whose script has not run.
 */
.sr-frame[data-flow] { display: flex; flex-direction: column; block-size: auto; min-block-size: 100dvh; }
.sr-frame[data-flow] > .sr-main { overflow: visible; min-block-size: 380px; }
.sr-frame[data-flow] > .sr-frame-consent { order: -1; }
@media (max-height: 499.98px) {
  :root:has(.sr-frame:not([data-flow])) { overflow: visible; }
  .sr-frame { display: flex; flex-direction: column; block-size: auto; min-block-size: 100dvh; }
  .sr-frame > .sr-main { overflow: visible; min-block-size: 380px; }
  .sr-frame > .sr-frame-consent { order: -1; }
}
