/* ============================================================================
   LAYOUTS.CSS  —  @layer app.layouts  —  the page skeletons.

   Four of them: the landing page, the auth page, the signed-in shell
   (rail + page) and the page itself (head, body, foot). Nothing here styles a
   widget; it decides where widgets are allowed to sit and how wide they get.
   ==========================================================================*/

@layer app.layouts {

.landing {
  min-block-size: calc(100vh - var(--nav-h));
  min-block-size: calc(100dvh - var(--nav-h));
  display: grid;
  align-content: center;
  justify-items: center;
  padding: var(--sp-6) var(--sp-4);
}
.front {
  inline-size: min(56rem, 100%);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: clamp(var(--sp-5), 5vw, var(--sp-7));
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  background: var(--glass-bg);
  box-shadow: var(--glass-shadow);
  backdrop-filter: var(--glass-filter);
  -webkit-backdrop-filter: var(--glass-filter);
}
.front h1 {
  margin: 0;
  max-inline-size: 16ch;
  font-size: clamp(var(--fs-2xl), 5vw, 3rem);
  letter-spacing: var(--tracking-2xl);
  line-height: var(--lh-tight);
  text-wrap: balance;
}
.front > p:not(.front-actions) {
  max-inline-size: 60ch;
  margin: 0;
  color: var(--fg-muted);
  font-size: var(--fs-md);
  line-height: 1.65;
}
.front-actions {
  display: flex;
  gap: var(--sp-3);
  margin-block-start: var(--sp-2);
}
.front-actions a[data-cta] {
  display: inline-flex;
  align-items: center;
  min-block-size: 3rem;
  padding-inline: var(--sp-4);
  border-radius: var(--r-full);
  background: var(--grad-brand);
  color: var(--fg-on-brand);
  font-weight: var(--fw-semi);
  text-decoration: none;
  box-shadow: var(--sh-sm);
}
.front-actions a[data-cta]:hover {
  background: var(--grad-brand-hover);
  text-decoration: none;
}

.auth {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  align-content: center;
  min-block-size: 100vh;
  min-block-size: 100dvh;
  inline-size: 100%;
  max-inline-size: none;
  margin: 0;
  padding: var(--sp-6) var(--sp-4);
}

body[data-surface="platform-auth"] main.auth {
  --auth-gutter: clamp(var(--sp-3), 2vw, var(--sp-4));
  inline-size: min(100%, var(--auth-w));
  max-inline-size: var(--auth-w);
  margin-inline: auto;
  margin-block: 0;
  padding: clamp(var(--sp-4), 2.5vh, var(--sp-6)) var(--auth-gutter);
}

body[data-surface="platform-auth"] {
  --auth-w: var(--platform-auth-w);
  display: block;
  min-height: 100dvh;
  inline-size: 100%;
  max-inline-size: none;
  margin: 0;
  padding: 0;
  background-color: var(--bg-body);
  background-image: url("/assets/bg-soft-mesh.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

body[data-surface="platform-auth"] #main {
  inline-size: min(100%, var(--auth-w));
  max-inline-size: var(--auth-w);
  margin-inline: auto;
}

body[data-surface="platform-auth"] > #root {
  inline-size: 100%;
  min-block-size: 100dvh;
}

.auth-mark {
  display: flex;
  justify-content: center;
  gap: var(--sp-2);
  margin-block-end: var(--sp-3);
  align-items: center;
}
.auth-mark .site-mark { --mark-size: 3rem; }

/* The isolated operator sign-in is served as a light DOM page rather than
   the React platform-auth shell. Constrain its main region and mark explicitly:
   the HTML image dimensions are 300px for intrinsic sizing, not page layout. */
/* The body also has .auth; its viewport-height grid and padding otherwise
   stack with #main\u2019s own 100dvh minimum and introduce phantom scrolling. */
html:has(body[data-surface="super-admin-auth"]) { scrollbar-gutter: auto; }
body[data-surface="super-admin-auth"] {
  background: var(--bg-body);
  padding: 0;
}
body[data-surface="super-admin-auth"] #main {
  position: relative;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: none;
  min-block-size: 100dvh;
  margin: 0 auto;
  padding: clamp(24px, 6vh, 56px) clamp(16px, 5vw, 32px);
}
body[data-surface="super-admin-auth"] #main > .auth-head,
body[data-surface="super-admin-auth"] #main > .auth-card {
  inline-size: min(100%, 30rem);
  max-inline-size: 30rem;
  margin-inline: auto;
}
body[data-surface="super-admin-auth"] #main > .auth-head {
  margin-block-end: 0;
}
body[data-surface="super-admin-auth"] .auth-mark {
  flex-direction: column;
  gap: var(--sp-3);
  margin-block-end: var(--sp-2);
}
body[data-surface="super-admin-auth"] .auth-mark .site-mark,
body[data-surface="super-admin-auth"] .auth-mark-image {
  --mark-size: 3.75rem;
  inline-size: 3.75rem;
  block-size: 3.75rem;
  flex: none;
  object-fit: contain;
}
body[data-surface="super-admin-auth"] .auth-mark h1 {
  font-size: clamp(1.6rem, 3vw, 2rem);
  line-height: 1.2;
}
body[data-surface="super-admin-auth"] .auth-lead {
  max-inline-size: 38ch;
  margin: var(--sp-2) auto 0;
  text-align: center;
  line-height: 1.5;
}
@media (max-width: 600px) {
  body[data-surface="super-admin-auth"] #main {
    justify-content: center;
    padding: 24px 16px;
  }
}

body[data-surface="super-admin-auth"]::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  z-index: var(--z-under);
  inline-size: min(34rem, 92vw);
  block-size: min(34rem, 92vh);
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 50%,
    color-mix(in srgb, var(--brand) 30%, transparent),
    color-mix(in srgb, var(--ember-300) 12%, transparent) 46%,
    transparent 70%
  );
  filter: blur(46px);
  opacity: .6;
  pointer-events: none;
}

.auth-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-5);
  padding: 0;
  list-style: none;
}
.auth-steps > li {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0;
  color: var(--fg-subtle);
  font-size: var(--fs-xs);
  letter-spacing: .01em;
}
.auth-steps > li::before {
  content: "";
  flex: none;
  inline-size: .5rem;
  block-size: .5rem;
  border-radius: var(--r-full);
  background: var(--gray-300);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gray-0) 65%, transparent);
}
.auth-steps > li:not(:last-child)::after {
  content: "";
  inline-size: var(--sp-4);
  block-size: 1px;
  margin-inline-start: var(--sp-1);
  background: color-mix(in srgb, var(--gray-400) 55%, transparent);
}
.auth-steps > li[data-state="done"] { color: var(--brand-fg); }
.auth-steps > li[data-state="done"]::before { background: var(--brand); }
.auth-steps > li[data-state="done"]::after {
  background: color-mix(in srgb, var(--brand) 45%, transparent);
}
.auth-steps > li[data-state="current"] {
  color: var(--gray-900);
  font-weight: var(--fw-semi);
}
.auth-steps > li[data-state="current"]::before {
  background: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red-200) 70%, transparent);
}

.auth-head {
  inline-size: min(100%, var(--auth-w));
  max-inline-size: none;
  margin-block-end: var(--sp-4);
  text-align: center;
}

body[data-surface="platform-auth"] main.auth > .auth-head,
body[data-surface="platform-auth"] main.auth > .auth-card {
  inline-size: min(
    calc(100% + 2 * var(--auth-gutter)),
    var(--auth-w)
  );
  max-inline-size: var(--auth-w);
}

.auth-head h1 {
  margin: 0;
  font-size: var(--fs-xl);
  letter-spacing: var(--tracking-xl);
  line-height: var(--lh-tight);
  text-wrap: balance;
}

.auth-lead {
  margin: var(--sp-2) auto 0;
  max-inline-size: var(--auth-w);
  color: var(--fg-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  text-wrap: pretty;
}

.auth[data-width="wide"] { --auth-w: 46rem; }

.auth-alt {
  margin: var(--sp-4) 0 0;
  color: var(--fg-muted);
  font-size: var(--fs-sm);
  text-align: center;
}

.auth-alt a {
  color: inherit;
  font-weight: var(--fw-medium);
  text-decoration-color: var(--red-300);
}
.auth-alt a:hover,
.auth-alt a:visited:hover {
  color: var(--brand-fg);
  text-decoration-color: currentColor;
}

.auth-alt a:visited { color: inherit; }

body:has(> .side-nav),
.app-shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  align-items: start;
}

body:has(> .app-header) .side-nav {
  inset-block-start: var(--nav-h);
  block-size: calc(100vh - var(--nav-h));
  block-size: calc(100dvh - var(--nav-h));
}
body:has(> .app-header) .page {
  min-block-size: calc(100vh - var(--nav-h));
  min-block-size: calc(100dvh - var(--nav-h));
}

html[data-side="rail"] { --side-w: var(--side-rail-w); }

.page {
  inline-size: 100%;
  max-inline-size: var(--page-w);
  min-block-size: 100vh;
  min-block-size: 100dvh;
  margin-inline: auto;
  padding-block: var(--sp-6) var(--sp-8);
  padding-inline: 0;
}

/* Title block. The gap below it belongs to the block, not to the <h1>: the h1
   used to carry `margin-bottom: var(--sp-5)`, which put 24px between a title
   and its own lead paragraph while the identical pattern on the auth pages
   (.auth-head h1 + .auth-lead) put 8px. Same shape, two spacings, and 16px of
   the page spent separating two lines that belong together. */
.page-head {
  margin-block-end: var(--sp-5);
}

/* The column everything on a signed-in page is stacked in.
   `align-items: center` sizes a flex item to its CONTENT, so a panel that did
   not ask for a width was as wide as its widest line and floated in the middle
   of the column: a form 800px wide above a .detail-group 612px wide above a
   table scrolling inside 470px, three different left edges down one page. The
   files had been patching that one element at a time — .profile-editor,
   .profile-card and .bzw-page each carry their own `width: 100%`, and this file
   had an EMPTY `.page-body > *` rule where the general fix was clearly meant to
   go. This is that rule.

   Children still centre, so anything with its own max-inline-size (a .card is
   26rem) sits in the middle of the column exactly as before; everything else
   now fills it. It is the same fix the console was given in AGENTS.md §14.8. */
.page-body {
  align-content: flex-start;
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  align-items: center;
  justify-content: flex-start;
}
.page-body > * {
  inline-size: 100%;
  /* A flex item will not shrink below its content unless it is told to; that
     is how a wide table stretches its own panel instead of scrolling inside
     the frame built for it. */
  min-inline-size: 0;
}

.page[data-layout="full"] {
  max-inline-size: none;
  padding-inline: var(--sp-6);
}

.page[data-layout="full"] .page-body {
  align-items: stretch;
}
.page-head > h1 {
  margin: 0;
  font-size: var(--fs-2xl);
  letter-spacing: var(--tracking-2xl);
  line-height: var(--lh-tight);
  text-wrap: balance;
}
.page-lead {
  margin: var(--sp-2) 0 0;
  max-inline-size: 42rem;
  color: var(--fg-muted);
  font-size: var(--fs-base);
  line-height: var(--lh-snug);
  text-wrap: pretty;
}
.page-foot {
  margin: var(--sp-5) 0 0;
  color: var(--fg-subtle);
  font-size: var(--fs-xs);
}

} /* @layer app.layouts */
