/* frames.css - THE ALL-DEVICE FRAMES (LAYOUTFRAMES-1129, Rob 11-29: "all our concept sheets should be done in a way that fit
   all layout types and all devices"). Version: see KIT.json "frames". Rules: FRAMES.md.
   THREE LAYERS: the browser does the math; layout.css holds the proven shelves (Stack, Cluster, Sidebar, Switcher, AutoGrid,
   Center, the one pinned bar); a FRAME is a named arrangement of those shelves for one kind of screen; look pieces (colour,
   type, borders, shadows) sit on top in the page's own sheet. A frame sizes itself by ITS OWN WIDTH (container queries),
   never by the window, so the same frame is right in a phone, in a sidebar, in a card and on a 1920 desk.
   A frame HOLDS ITS SPACE: its box has its final size before its content arrives (aspect-ratio / min-block-size), so nothing
   jumps on load or on rotate. This file is layout only: no colour, no font, no picture. It is COPIED at a pinned version and
   never edited per page (the gate compares the served bytes: review.py D27). */

/* ---- the frame box: every frame is a size container that can never be wider than its place ---- */
.rs-frame {
  container-type: inline-size;
  container-name: frame;
  box-sizing: border-box;
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
}
.rs-frame *, .rs-frame *::before, .rs-frame *::after { box-sizing: border-box; }
.rs-frame :where(.rs-stack, .rs-cluster, .rs-sidebar, .rs-switcher, .rs-autogrid) > * { min-inline-size: 0; }
.rs-frame :where(h1, h2, h3, h4, p, li, dt, dd, td, th, label, a, b, span, small, strong, em) { overflow-wrap: anywhere; }
.rs-frame :where(img, svg, video, canvas) { max-inline-size: 100%; }
.rs-frame :where(img, video) { block-size: auto; }
/* one tap size (layout.css --tap = 44 CSS px at 100% text): every press inside a frame */
.rs-frame :where(button, [role="button"], summary, select, input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), textarea, a.rs-tap) {
  min-block-size: var(--tap, 2.75rem);
  min-inline-size: var(--tap, 2.75rem);
}
/* a frame that is loading keeps its box and shows nothing inside it (empty at its final size) */
.rs-frame[aria-busy="true"] > * { visibility: hidden; }

/* ---- 1. DASHBOARD: an AutoGrid of tiles with one minimum tile width ----
   <section class="rs-frame rs-frame-dashboard"><div class="rs-autogrid"> tile, tile, ... </div></section> */
.rs-frame-dashboard > .rs-autogrid { --grid-min: var(--tile-min, 14rem); }
.rs-frame-dashboard > .rs-autogrid > * { min-block-size: var(--tile-h, 6rem); }
@container frame (max-width: 30rem) {
  .rs-frame-dashboard > .rs-autogrid { --grid-min: var(--tile-min-narrow, 8.5rem); }
}

/* ---- 2. APP SCREEN: a phone-shaped screen that scales with its place; the whole width on a real phone ----
   <section class="rs-frame rs-frame-app"><div class="rs-stack rs-app-screen"> ... </div></section> */
.rs-frame-app > .rs-app-screen {
  inline-size: min(100%, var(--app-w, 24.375rem));
  aspect-ratio: var(--app-ratio, 9 / 19.5);
  margin-inline: auto;
  min-inline-size: 0;
}
@container frame (max-width: 30rem) {
  .rs-frame-app > .rs-app-screen {
    inline-size: 100%;
    aspect-ratio: auto;
    min-block-size: var(--app-min-h, 32rem);
  }
}

/* ---- 3. TABLE: a real table while there is room; each row a stacked card when narrow ----
   <div class="rs-frame rs-frame-table"><table> thead + tbody, every td with data-label="its column name" </table></div> */
.rs-frame-table { min-block-size: var(--table-min-h, 12rem); }
.rs-frame-table > table { inline-size: 100%; border-collapse: collapse; table-layout: auto; }
.rs-frame-table :where(th, td) { text-align: start; vertical-align: top; }
@container frame (max-width: 40rem) {
  .rs-frame-table > table,
  .rs-frame-table > table > :where(tbody, tfoot),
  .rs-frame-table > table > :where(tbody, tfoot) > tr,
  .rs-frame-table > table > :where(tbody, tfoot) > tr > :where(td, th) { display: block; inline-size: 100%; }
  .rs-frame-table > table > thead {
    position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .rs-frame-table > table > :where(tbody, tfoot) > tr + tr { margin-block-start: var(--space-4, 1rem); }
  .rs-frame-table > table > :where(tbody, tfoot) > tr > td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.8125em;
  }
}

/* ---- 4. MAP: a map box of fixed shape, its list beside it while there is room and below it when not ----
   <section class="rs-frame rs-frame-map"><div class="rs-sidebar rs-sidebar-end">
     <div class="rs-map"> the map (img / svg / canvas / div) </div>  <div class="rs-stack"> the list </div>
   </div></section> */
.rs-frame-map > .rs-sidebar { --sidebar-width: var(--map-list-w, 18rem); --sidebar-content-min: var(--map-min, 20rem); }
.rs-frame-map .rs-map {
  position: relative;
  aspect-ratio: var(--map-ratio, 4 / 3);
  overflow: hidden;
  min-inline-size: 0;
}
.rs-frame-map .rs-map > * {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  max-inline-size: none;
  object-fit: cover;
}

/* ---- 5. FORM: fields on an AutoGrid; ONE column when narrow ----
   <section class="rs-frame rs-frame-form"><form class="rs-autogrid"> <label class="rs-stack">Name <input></label> ... </form></section> */
.rs-frame-form { max-inline-size: var(--form-max, 44rem); }
.rs-frame-form > .rs-autogrid { --grid-min: var(--field-min, 16rem); }
.rs-frame-form :where(label.rs-stack, .rs-field) { --stack-space: var(--space-1, 0.25rem); }
.rs-frame-form :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { inline-size: 100%; max-inline-size: 100%; font: inherit; }
.rs-frame-form .rs-field-wide { grid-column: 1 / -1; }
@container frame (max-width: 36rem) {
  .rs-frame-form > .rs-autogrid { grid-template-columns: minmax(0, 1fr); }
}

/* ---- 6. HERO (Hero A): the picture fills the frame edge to edge, the words and the search sit ON it, chips under ----
   <section class="rs-frame rs-frame-hero">
     <div class="rs-hero-media"><img ... width height alt></div>      (a photo; video only on a public website front door)
     <div class="rs-stack rs-hero-body"> h1, the search (rs-switcher), chips (rs-cluster) </div>
   </section> */
.rs-frame-hero {
  position: relative;
  display: grid;
  min-block-size: var(--hero-min, 24rem);
  overflow: hidden;
}
.rs-frame-hero > .rs-hero-media { position: absolute; inset: 0; }
.rs-frame-hero > .rs-hero-media > * { inline-size: 100%; block-size: 100%; max-inline-size: none; object-fit: cover; display: block; }
.rs-frame-hero > .rs-hero-body {
  position: relative;
  justify-content: flex-end;
  padding: var(--hero-pad, clamp(1rem, 5cqi, 3rem));
  min-inline-size: 0;
}
.rs-frame-hero .rs-switcher { --switcher-threshold: var(--hero-search-min, 26rem); }
