/* Snuug web app: the frame round every screen (src/app/shell.js). Five frames, set per route in src/app/routes.js:
     site    the signed-out front door: a top bar with the wordmark and Sign in
     bare    nothing but the screen (Welcome draws its own wordmark)
     flow    a step in a flow: back on the left, a slot in the middle (step dots), a slot on the right (Skip)
     tabs    the dashboard (signed in only): a sidebar on a laptop, a glass tab bar of five on a phone; <main> scrolls
             by itself, so the page never does (the brief's "one page"). The Room Analysis is one of its screens (its
             outline and card beside the sidebar; before 20 Nov 2026 a 'report' frame of its own, BUG-945)
   Phone below 900 px, laptop from 900 px (one breakpoint, as the spec). */

:root { --strip-h: calc(30px + env(safe-area-inset-top, 0px)); }   /* what sits above the frame on a phone: the Trial strip (in the page's flow) under the status bar's inset; 0 on a laptop, where it floats (BUG-1951) */
@media (min-width: 900px) { :root { --strip-h: 0px; } }
.frame { min-height: calc(100dvh - var(--strip-h)); display: flex; flex-direction: column; color: var(--ink); }   /* clear: the page's field shows */
.view { flex: 1 0 auto; display: flex; flex-direction: column; outline: none; }
/* The first screen of a visit rises in once (src/app/router.js). Fill "backwards", not "both": once it has played the
   view keeps no transform, which would hold its position: fixed children (BUG-1330, retired). */
.view.enter { animation: view-in var(--t-med) var(--ease-out) backwards; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .view.enter { animation: none; } }

/* ---------- Between screens: a View Transition (src/ui/motion.js; apps/webapp/AGENTS.md, "Motion") ----------
   Forward and back move the <main> alone (named only while a transition runs: a name makes a stacking context and a
   backdrop root, which would change the glass at rest); the frame, the bar and the field cross-fade as the root, which
   shows nothing where they are the same. A fade (a tab, a redirect, a new frame) is the root's cross-fade alone. The
   old screen leaves faster than the new one comes. The pointer goes through to the new screen at once. */
::view-transition { pointer-events: none; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: var(--t-screen); }
:root[data-vt="forward"] .view, :root[data-vt="back"] .view { view-transition-name: snuug-view; }   /* BUG-1491 */
::view-transition-group(snuug-view) { animation: none; }
::view-transition-old(snuug-view) { animation: vt-out calc(var(--t-screen) * .7) var(--ease-in) both; mix-blend-mode: normal; }
::view-transition-new(snuug-view) { animation: vt-in var(--t-screen) var(--ease-out) both; mix-blend-mode: normal; }
:root[data-vt="back"]::view-transition-old(snuug-view) { animation-name: vt-out-back; }
:root[data-vt="back"]::view-transition-new(snuug-view) { animation-name: vt-in-back; }
/* BUG-1492: a room's card into its page: the poster takes the card's picture's place (motion.js runMotion names it). */
:root[data-vt="forward"] .room-stage .room-still img, :root[data-vt="forward"] .room-stage .rv-poster { view-transition-name: snuug-room; }
::view-transition-group(snuug-room) { animation-duration: var(--t-med); animation-timing-function: var(--ease-move); }
::view-transition-old(snuug-room), ::view-transition-new(snuug-room) { animation-duration: var(--t-med); height: 100%; object-fit: contain; }
@keyframes vt-in { from { opacity: 0; transform: translateX(16px); } }
@keyframes vt-out { to { opacity: 0; transform: translateX(-8px); } }
@keyframes vt-in-back { from { opacity: 0; transform: translateX(-16px); } }
@keyframes vt-out-back { to { opacity: 0; transform: translateX(8px); } }


/* ---------- The trial strip (phone) and badge (laptop) ---------- */
.trial-strip { display: flex; justify-content: center; height: var(--strip-h); padding: calc(env(safe-area-inset-top) + 4px) 0 0; }
.trial-strip .trial-badge { position: static; transform: none; background: transparent; box-shadow: none; height: 24px; color: var(--muted); font-size: 10.5px; }
@media (min-width: 900px) {
  .trial-strip { position: fixed; z-index: 70; right: 20px; bottom: 20px; height: auto; padding: 0; background: none; }
  .trial-strip .trial-badge { height: 30px; padding: 0 12px 0 10px; color: var(--ink); background: var(--glass); box-shadow: inset 0 1px 0 var(--glass-rim), inset 0 0 0 .5px var(--glass-edge), var(--shadow-soft);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
}
/* Real mode (src/main.js sets .no-trial): no strip, so nothing takes its height, and the frame keeps clear of the status bar. */
/* BUG-947: the trial's dev skip on every screen that can be skipped (src/trial/dev-skip.js): a small pill beside the badge, the
   badge's own type. Temporary: it goes when the founder has finished testing the web app. */
.trial-strip { align-items: center; gap: 8px; }
.dev-skip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border: 0; border-radius: var(--radius-pill); cursor: pointer;
  font: 500 11px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.dev-skip:hover { background: color-mix(in srgb, var(--ink) 12%, transparent); }
.dev-skip:disabled { opacity: .6; cursor: default; }
@media (min-width: 900px) { .dev-skip { height: 30px; padding: 0 12px; background: var(--glass); box-shadow: inset 0 1px 0 var(--glass-rim), inset 0 0 0 .5px var(--glass-edge), var(--shadow-soft);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); } }
/* BUG-1951: real mode has no strip, but the status bar's inset (a phone's notch, from viewport-fit=cover) sits above the
   frame the same way, so every "100dvh - var(--strip-h)" screen fits the window. It was padding on .frame until 21 Nov 2026:
   the screens' own min-height (100dvh) then overflowed the frame by the inset, so every full-height screen scrolled by
   about 47 px on an iPhone and its foot slid under the home indicator. */
.no-trial { --strip-h: env(safe-area-inset-top, 0px); }
.no-trial #app { padding-top: env(safe-area-inset-top, 0px); }
/* The Room Analysis (S19) keeps Previous and Next at the card's bottom right: there the badge and the skip sit at the
   foot of the report's outline (the column beside the sidebar), so they cover neither Next nor the sidebar's Log out. */
@media (min-width: 900px) {
  :root:has(.r-shell .r-foot) .trial-strip { right: auto; left: calc(var(--q-side-w) + 36px); }
  :root:has(.side-folded):has(.r-shell .r-foot) .trial-strip { left: calc(66px + 36px); }
}

/* ---------- Top bar (site, flow) ---------- */
/* Clear over the field; glass once the page moves under it. */
.topbar { position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  min-height: var(--topbar-h); padding: 12px var(--gutter); background: transparent; }
.topbar .slot { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar .slot.l { justify-content: flex-start; }
.topbar .slot.c { justify-content: center; }
.topbar .slot.r { justify-content: flex-end; }
.topbar.scrolled { background: var(--theme-glass); -webkit-backdrop-filter: var(--theme-glass-blur); backdrop-filter: var(--theme-glass-blur); box-shadow: inset 0 -1px 0 var(--theme-line); }
.topbar .wordmark-link { display: inline-flex; align-items: center; height: var(--tap); }
.topbar .start-plan { flex: none; white-space: nowrap; padding-inline: 16px; }
@media (min-width: 900px) {
  .frame[data-frame="flow"] .topbar { padding-block: 16px; }
  /* The site's bar lines up with the landing's 1180 px measure. */
  .frame[data-frame="site"] .topbar { padding-inline: max(var(--gutter), calc((100% - 1180px) / 2 + var(--gutter))); }
}

/* ---------- Content columns: flows sit in a calm centred column; dashboard screens in a wider one ---------- */
.frame[data-frame="tabs"] .view > .screen, .frame[data-frame="site"] .view > .screen { width: 100%; max-width: 1120px; margin-inline: auto; padding: 16px var(--gutter) 32px; }
@media (min-width: 900px) { .frame[data-frame="tabs"] .view > .screen { padding-top: 40px; } }
/* The dashboard's pages use the width (the founder, 19 Nov 2026: "too narrow … unbalanced and untidy"): from the
   sidebar to the right edge with one even gutter each side, to 1680 px of content on a very wide screen. Rooms,
   Discover and Settings (settings.css) share --dash-gutter. */
@media (min-width: 900px) {
  :root { --dash-gutter: clamp(28px, 3.4vw, 64px); --dash-max: 1680px; }
  .frame[data-frame="tabs"] .view > .screen:not(.room-page):not(.public-room) { padding: var(--q-content-top) var(--dash-gutter) 48px; max-width: calc(var(--dash-max) + 2 * var(--dash-gutter)); }
}
.frame[data-frame="flow"] .view > .screen { width: 100%; max-width: calc(var(--col) + 2 * var(--gutter)); margin-inline: auto; padding: 8px var(--gutter) 32px; }
.frame[data-frame="flow"] .view > .screen.wide { max-width: calc(1120px + 2 * var(--gutter)); }

/* ---------- The dashboard: one screen high, <main> scrolls by itself ---------- */
/* BUG-1020: clip, not hidden. A box with overflow: hidden is still a scroll container, so a focus() or scrollIntoView()
   can scroll it sideways and push the sidebar off the left edge; clip cannot be scrolled at all. */
.frame[data-frame="tabs"] { height: calc(100dvh - var(--strip-h)); min-height: 0; overflow: clip; }
.frame[data-frame="tabs"] .view { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: clip; overscroll-behavior: contain; }

/* The phone's tab bar: five places in one glass pill. */
.tabbar { position: fixed; z-index: 40; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 12px); height: var(--tabbar-h); display: flex; }
.tabbar .tabs { flex: 1; display: flex; align-items: stretch; padding: 4px; border-radius: var(--radius-pill); background: var(--theme-glass-strong); }
.tabbar .side-item { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: var(--radius-pill);
  color: var(--ink); text-decoration: none; font: 500 10.5px/1 var(--font); -webkit-tap-highlight-color: transparent; transition: background-color var(--t-med), transform var(--t-fast) var(--ease-spring); }
.tabbar .side-item:active { transform: scale(.94); }   /* a press (apps/webapp/AGENTS.md, "Motion") */
.tabbar .side-box { position: relative; display: grid; place-items: center; }
.tabbar .side-box > .i { width: 23px; height: 23px; }
.tabbar .side-word { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar .side-item[aria-current="page"] { background: var(--theme-fill); }
.tabbar .side-item[aria-current="page"] .side-box > .i { stroke-width: 2; }
.tabbar .side-lock { display: none; position: absolute; right: -7px; bottom: -4px; width: 15px; height: 15px; border-radius: 50%; place-items: center; background: var(--paper); box-shadow: 0 0 0 .5px var(--glass-edge); }
.tabbar .side-lock .i { width: 10px; height: 10px; stroke-width: 2.2; }
.tabbar .side-item.locked .side-lock { display: grid; }
.frame.has-tabbar .view { padding-bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); }
/* The Room Analysis keeps that room itself (analysis.css .r-shell), so its sticky Next rests just over the tab bar. */
.frame.has-tabbar .view:has(> .r-shell) { padding-bottom: 0; }
/* A soft fade under the tab bar, so content slides beneath it. */
.tabbar-fade { position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; height: 100px; pointer-events: none;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--g-base) 0%, transparent), color-mix(in srgb, var(--g-base) 80%, transparent)); }

/* The laptop's sidebar (Qoves, the founder's pictures 07 and 11). */
.side { display: none; }
@media (min-width: 900px) {
  :root { --side-w: var(--q-side-w); }
  .tabbar, .tabbar-fade { display: none; }
  .frame.has-tabbar .view { padding-bottom: 0; }
  .frame.has-side { flex-direction: row; padding: 8px 0 8px 8px; }
  .frame.has-side.side-folded { --side-w: 66px; }
  .side { order: -1; flex: none; width: var(--side-w); display: flex; flex-direction: column; gap: 24px; padding: 16px 12px 12px; border-radius: var(--q-r-panel);
    background: var(--theme-glass); box-shadow: inset 0 1px 0 var(--theme-panel-rim), inset 0 0 0 1px var(--theme-glass-line), var(--theme-shadow);
    transition: width var(--t-med) var(--ease-move); overflow: hidden auto; overscroll-behavior: contain; scrollbar-width: none; }
  /* BUG-1020: on a short window (a laptop zoomed in) the foot no longer fits; the sidebar scrolls up and down instead
     of cutting off Settings and Log out. */
  .side::-webkit-scrollbar { display: none; }
  .side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding-left: 6px; }
  .side-top .wordmark-link { display: inline-flex; transition: opacity var(--t-fast); }
  .side-fold { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: var(--q-r-box); background: none; color: var(--muted); cursor: pointer; }
  .side-fold:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); }
  .side-fold .i { width: 20px; height: 20px; }
  .side-nav { display: flex; flex-direction: column; gap: var(--q-side-gap); }
  .side-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--q-side-gap); }
  .side .side-item { display: flex; align-items: center; gap: 12px; width: 100%; height: var(--q-side-item); padding: 0 5px; border: 0; border-radius: var(--q-r-item); background: none;
    color: var(--muted); text-decoration: none; font: 400 15px/20px var(--font); text-align: left; cursor: pointer;
    transition: background-color var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease-spring); }
  .side .side-item:active { transform: scale(.98); }
  .side .side-item:hover { color: var(--ink); background: var(--theme-item-hover); }
  .side .side-item[aria-current="page"] { color: var(--ink); background: var(--theme-item-on); box-shadow: var(--theme-card-edge); }
  .side .side-box { position: relative; flex: none; width: var(--q-side-box); height: var(--q-side-box); display: grid; place-items: center; border-radius: var(--q-r-box);
    background: var(--theme-item-box); box-shadow: var(--theme-card-edge); color: var(--ink); transition: background-color var(--t-fast), color var(--t-fast); }
  .side .side-box > .i { width: 18px; height: 18px; stroke-width: 1.6; }
  .side .side-item[aria-current="page"] .side-box { background: var(--theme-slate); color: #fff; box-shadow: none; }
  .side .side-lock { display: none; position: absolute; right: -7px; bottom: -7px; width: 18px; height: 18px; border-radius: 50%; place-items: center; background: var(--theme-disc);
    color: var(--muted); box-shadow: var(--theme-card-edge); }
  .side .side-lock .i { width: 11px; height: 11px; stroke-width: 2; }
  .side .side-item.locked .side-lock { display: grid; }
  .side .side-word { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity var(--t-fast); }
  .side-review { display: flex; align-items: center; justify-content: center; gap: 8px; height: 40px; margin: 4px 0; border-radius: var(--q-r-item); color: var(--ink); text-decoration: none; font: 400 14px/20px var(--font);
    background: var(--theme-review); box-shadow: var(--theme-card-edge); transition: background-color var(--t-fast); }
  .side-review:hover { background: var(--theme-review-hover); }
  .side-review .i { width: 16px; height: 16px; }
  /* The promo, as Qoves's dark card: white words on the field's dark accent (Mist's deepest slate, gradient.css
     --g-dark). */
  .side .promo { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 14px 14px; border-radius: var(--q-r-card); overflow: hidden; text-decoration: none;
    color: var(--g-on-dark); background: var(--g-dark); background-color: var(--g-dark-solid);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 8px 20px -12px rgb(var(--g-deep) / .5); transition: transform var(--t-fast) var(--ease-spring); }
  .side .promo:hover { transform: translateY(-1px); }
  .side .promo-tag { padding: 3px 8px; border-radius: var(--radius-pill); background: var(--theme-promo-tag); color: #fff; font: 500 11px/14px var(--font); }
  .side .promo b { font: 400 15px/20px var(--font); letter-spacing: -0.005em; }
  .side .promo-go { display: inline-flex; align-items: center; gap: 6px; font: 400 13px/16px var(--font); color: rgba(255, 255, 255, .9); }
  .side .promo-go .i { width: 14px; height: 14px; }
  /* Folded: the boxes only. */
  .side-folded .side { padding-inline: 12px; }
  .side-folded .side-top { flex-direction: column; padding-left: 0; }
  .side-folded .side-top .wordmark-link { display: none; }
  .side-folded .side-word, .side-folded .side-promo { opacity: 0; pointer-events: none; }
  .side-folded .side-promo { display: none; }
  .side-folded .side-review { width: 42px; gap: 0; }
  .side-folded .side-review .side-word { display: none; }
  @media (prefers-reduced-motion: reduce) { .side { transition: none; } }
}

/* ---------- Avatar (Settings) ---------- */
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--accent); color: var(--on-accent); font: 500 16px/1 var(--font); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Logo files: pixel drawings at whole-number scales only (brand/README.md) ---------- */
.logo { image-rendering: pixelated; flex: none; }
.logo.on-light { display: var(--show-on-light); }
.logo.on-dark { display: var(--show-on-dark); }

/* Inside the simulator's frame: room for the drawn island at the top and the home bar at the bottom. */
.in-sim { --sim-top: 44px; }
.in-sim .trial-strip { height: calc(var(--sim-top) + var(--strip-h)); padding-top: calc(var(--sim-top) + 2px); }
.in-sim .frame { min-height: calc(100dvh - var(--sim-top) - var(--strip-h)); padding-bottom: 14px; }
.in-sim .topbar { top: 0; }

/* ---------- The phone simulator: the app in a phone-sized frame beside the laptop view (?device=phone) ---------- */
.sim { min-height: 100dvh; display: grid; place-items: center; gap: 16px; padding: 24px; background: var(--surface); }
.sim .bezel { position: relative; width: 414px; height: 868px; padding: 12px; border-radius: 60px; background: #0E0E0F; box-shadow: var(--shadow-lift), inset 0 0 0 2px #2A2A2C;
  transform-origin: top center; }
.sim .bezel::before { content: ""; position: absolute; z-index: 2; top: 23px; left: 50%; width: 120px; height: 34px; margin-left: -60px; border-radius: 99px; background: #000; }
.sim iframe { display: block; width: 390px; height: 844px; border: 0; border-radius: 48px; background: var(--paper); }
.sim .caption { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
