/* The Open panel (launcher.js) and the app frame's own states (bridge.js). Tokens only; no literal colours.
   Loaded BEFORE the look, so a look restyles all of it with plain selectors. Nothing here touches the shell
   while the panel is closed and no app is open.
   Hooks — launcher: .lr.is-app (an app row) · .lr.soon[aria-disabled] (planned, never pressable) · .lr > .ai (icon slot;
           an app's icon sits on a tile drawn by .ai::before) · .lr mark (typed characters) · .launch h3 > span (a quiet
           note after a section name) · .lempty / .lempty.sub (nothing found).
   Hooks — app frame: see the second half of this file. */

/* ── launcher rows ── */
.lr .ai { position: relative; display: grid; place-items: center; width: 20px; height: 20px; }
.lr .ai svg.ic { position: relative; }
.lr.is-app .ai::before { content: ""; position: absolute; inset: -5px; border-radius: var(--r); background: color-mix(in srgb, var(--ink) 9%, transparent); }
[data-theme="light"] .lr.is-app .ai::before { background: #fff; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent), 0 1px 2px rgb(54 44 24 / .07); }   /* light: a white key, not a grey patch */
.lr.is-app.on .ai::before { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.lr.is-app { column-gap: 16px; }
.lr .n b { flex: none; }
.lr .w { min-width: 0; }
.lr mark { background: none; color: inherit; font: inherit; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-color: var(--accent); }

/* the Open panel sits in the middle of the screen (it was hung from the right edge, over the right half), and it is
   wide enough for its key line. `translate`, not transform: a look's arrival animation keeps working. Held with the
   id so a look's own top/right offsets cannot push it back to the edge. */
body:not(.phone) #launcher > .launch { left: 50%; right: auto; translate: -50% 0; width: min(680px, calc(100vw - 24px)); }

/* planned: listed so the plan is visible; quieter in tone AND in shape (an outlined, dashed tile), never pressable */
.lr.soon { cursor: default; text-align: left; }
.lr.soon, .lr.soon:hover, .lr.soon.on { background: none; box-shadow: none; }
.lr.soon .ai::before { background: none; border: 1px dashed var(--rule-2); }
.lr.soon .ai svg.ic, .lr.soon .n span, .lr.soon .w { color: var(--ink-3); }
.lr.soon .n b { color: var(--ink-2); font-weight: 500; }

.launch h3 > span { font-weight: 400; }
.launch .lbody { overscroll-behavior: contain; }
.launch .lempty { padding-bottom: 4px; color: var(--ink); }
.launch .lempty.sub { padding-top: 0; padding-bottom: 12px; font: var(--meta); color: var(--ink-3); max-width: 52ch; }

/* phone: a full-screen sheet; rows at least 44 px; no key hints */
.phone #launcher .lr { min-height: 48px; }
.phone .lr .n b, .phone .lr .n span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone .lr .w { flex: none; }
.phone .launch .lbody { padding-bottom: env(safe-area-inset-bottom); }
.phone .launch .lempty.sub { max-width: none; }

/* ── app frame: the host bridge.js puts inside .app-b ──
   div.afh[data-app][data-trust=legacy|sandbox] > div.af-ban[data-state=stale|lost][data-kind]? (a line that is true
   for the whole app: lamp, p > b + words, .btn.sm) · div.af-view > iframe.appframe + div.af-wait[data-state=loading|failed]?
   (covers the app while there is nothing true to show: b, p, .btn) · p.af-note? (one quiet line for an unmodified old page). */
.afh { position: absolute; inset: 0; display: flex; flex-direction: column; min-width: 0; }
.af-view { position: relative; flex: 1; min-height: 0; }
.af-view > iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--ground); }
.af-ban { flex: none; display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 16px; background: var(--panel); border-bottom: 1px solid var(--rule); color: var(--ink-2); font: var(--do); }
.af-ban .lamp { flex: none; }
.af-ban p { flex: 1; min-width: 0; margin: 0; }
.af-ban p b { color: var(--ink); font-weight: 600; }
.af-ban .btn { flex: none; }
.af-wait { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; background: var(--ground); color: var(--ink-2); }
.af-wait b { font: var(--lead); color: var(--ink); }
.af-wait p { margin: 0; max-width: 46ch; font: var(--do); }
.af-wait .btn { margin-top: 12px; }
/* "Opening…" is only worth saying when it takes a moment */
.af-wait[data-state="loading"] > * { animation: af-late 120ms linear 400ms both; }
@keyframes af-late { from { opacity: 0; } }
.af-note { flex: none; margin: 0; padding: 4px 16px; border-top: 1px solid var(--rule); background: var(--panel); color: var(--ink-3); font: var(--meta); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.phone .af-ban { flex-wrap: wrap; padding: 10px 12px 10px 16px; }
.phone .af-ban p { flex-basis: calc(100% - 32px); }
.phone .af-ban .btn { height: 44px; margin-left: 21px; }
.phone .af-wait .btn { height: 48px; }
.phone .af-note { text-align: left; }
/* the phone's one-line frame status never cuts a word in half */

/* An app's tile (pc-ui.js appTile): its glyph in a light tint of its own hue on a soft tile of that hue, a hairline
   that catches the light along the top. --app = the app's hue (pc-ui.js HUES; never blue, pink, green, amber or red).
   Hooks: span.ai.atile[style="--app: #rrggbb"] > svg.ic. Used by Home's Apps, Home's two tiles and its open windows. */
.atile { --app: var(--ink-3); position: relative; display: grid; place-items: center; flex: none; width: 52px; height: 52px; --atile-r: var(--r-5, 16px); border-radius: var(--atile-r);
  background: linear-gradient(180deg, color-mix(in oklab, var(--app) 46%, var(--panel)), color-mix(in oklab, var(--app) 27%, var(--panel)));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--app) 22%, transparent), inset 0 1px 0 color-mix(in oklab, #fff 14%, transparent), 0 1px 2px rgb(0 0 0 / .28);
  color: color-mix(in oklab, var(--app) 38%, #fff); }
.atile svg.ic { width: 24px; height: 24px; stroke-width: 1.6; }
/* light: the hue is a wash on white, deep enough that each app is told apart at a glance; the glyph is the hue's ink */
[data-theme="light"] .atile { background: linear-gradient(180deg, color-mix(in oklab, var(--app) 19%, #fff), color-mix(in oklab, var(--app) 35%, #fff));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--app) 34%, transparent), inset 0 1px 0 rgb(255 255 255 / .85), 0 1px 2px rgb(54 44 24 / .08), 0 5px 10px -6px color-mix(in oklab, var(--app) 60%, transparent);
  color: color-mix(in oklab, var(--app) 70%, #000); }
.atile.neutral { --app: var(--ink-3); }
[data-theme="light"] .atile.neutral { background: linear-gradient(180deg, #fff, color-mix(in oklab, var(--ink) 5%, #fff)); color: var(--ink-2);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ink) 11%, transparent), inset 0 1px 0 #fff, 0 1px 2px rgb(54 44 24 / .08), 0 5px 12px -6px rgb(54 44 24 / .22); }

/* Home's Apps (launcher.js grid): a sheet over Home (Home stays dimly visible behind it) that hugs its tiles, a quiet
   title and a clear round close. Hooks: #launcher > .launch-bg + .launch.lapps > .q.lg-h (b, button.lclose) ·
   .lgrid#launchList[role=list] > button.lg[data-app][data-open] > span.ai.atile > svg.ic, span.lgn, i.lamp. */
#launcher:has(> .lapps) > .launch-bg { background: rgb(4 5 8 / .52); }
[data-theme="light"] #launcher:has(> .lapps) > .launch-bg { background: rgb(28 26 22 / .20); }
html body #launcher > .launch.lapps { position: fixed; top: 50%; right: auto; bottom: auto; left: 50%; translate: -50% -50%; width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 64px);
  padding: 0; border: 0; border-radius: var(--r-6, 20px); background: var(--panel); box-shadow: inset 0 1px 0 color-mix(in oklab, #fff 7%, transparent), 0 0 0 1px color-mix(in oklab, var(--ink) 9%, transparent), 0 24px 60px -12px rgb(0 0 0 / .55);
  -webkit-backdrop-filter: none; backdrop-filter: none; animation: lg-in 220ms cubic-bezier(.2, .8, .2, 1) both; }
html[data-theme="light"] body #launcher > .launch.lapps { box-shadow: 0 0 0 1px rgb(40 30 10 / .08), 0 24px 60px -16px rgb(40 30 10 / .30); }
html body #launcher > .launch.lapps .lg-h { height: 56px; gap: 8px; padding: 0 10px 0 22px; border: 0; background: none; }
html body #launcher > .launch.lapps .lg-h > b { flex: 1; font: 500 15px/20px var(--sans); letter-spacing: .01em; color: var(--ink-2); }
.lapps .lclose { flex: none; position: relative; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--ink-2); cursor: pointer; }
.lapps .lclose::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: color-mix(in oklab, var(--ink) 9%, transparent); transition: background-color 120ms; }
.lapps .lclose svg.ic { position: relative; width: 16px; height: 16px; stroke-width: 1.8; }
.lapps .lclose:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.lgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 4px; padding: 2px 14px 24px; overflow-y: auto; overscroll-behavior: contain; }
.lgrid .lg { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 8px; min-height: 92px; padding: 8px 2px 6px; border: 0; border-radius: var(--r-5, 16px); background: none; text-align: center; color: var(--ink); cursor: pointer; }
@media (hover: hover) { .lgrid .lg:hover { background: color-mix(in oklab, var(--ink) 6%, transparent); } .lapps .lclose:hover::before { background: color-mix(in oklab, var(--ink) 15%, transparent); } .lapps .lclose:hover { color: var(--ink); } }
.lgrid .lg:focus-visible { background: color-mix(in oklab, var(--ink) 6%, transparent); }
.lgrid .lg:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lgrid .lg:active .atile { scale: .94; }
.lgrid .lg .atile { transition: scale 120ms; }
.lgrid .lg > .lgn { max-width: 100%; font: 450 12.5px/16px var(--sans); letter-spacing: .005em; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lgrid .lg > .lgn.tight { font-size: 11px; letter-spacing: -.01em; text-overflow: clip; }
.lgrid .lg > .lgn.two { white-space: normal; overflow-wrap: normal; line-height: 14px; text-wrap: balance; }
.lgrid .lg > .lamp { position: absolute; top: 4px; right: calc(50% - 32px); width: 8px; height: 8px; box-shadow: 0 0 0 2px var(--panel); }
.lgrid .lempty { grid-column: 1 / -1; }
/* the phone: a sheet from the bottom edge, 8 px in from the sides, hugging its tiles */
html body.phone #launcher > .launch.lapps { top: auto; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); translate: none; width: auto; max-height: calc(100dvh - 96px); border-radius: var(--r-7, 28px); animation-name: lg-up; animation-duration: 280ms; }
.phone .lgrid { padding: 2px 10px 20px; }
@keyframes lg-in { from { opacity: 0; scale: .97; } }
@keyframes lg-up { from { translate: 0 40px; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { html body #launcher > .launch.lapps { animation: none; } }

/* ── the phone's app sheet (windows.js renderSheet): ONE bar and a compact pill ──
   The bar: ‹ (Home) · the app's tile + name · the mark · the grid; the mark and the grid in the system bar's 44 px
   slots, 10 px apart, glyphs 22 px. No second slab at the bottom: a pill back to the conversation, centred. */
html body.phone #side > .sh-h { height: 52px; gap: 10px; padding: 0 6px 0 4px; border-bottom: 0; background: var(--side, var(--ground)); }
html body.phone #side > .sh-h > .sh-back { width: 44px; height: 44px; margin-right: -4px; }
html body.phone #side > .sh-h > .atile { width: 28px; height: 28px; --atile-r: var(--r-2, 8px); }
html body.phone #side > .sh-h > .atile svg.ic { width: 16px; height: 16px; }
html body.phone #side > .sh-h > .x { font: 600 17px/24px var(--sans); letter-spacing: -.01em; min-width: 0; }
html body.phone #side > .sh-h > .brand { margin: 0; }
html body.phone #side > .sh-f.sh-pill { display: flex; flex: none; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 6px 12px calc(8px + env(safe-area-inset-bottom));
  border: 0; border-radius: 0; background: none; box-shadow: none; }
html body.phone #side > .sh-pill > .btn.back { display: inline-flex; align-items: center; gap: 8px; height: 44px; min-height: 0; max-width: calc(100vw - 88px); padding: 0 20px 0 16px;
  border: 0; border-radius: 999px; background: color-mix(in oklab, var(--ink) 9%, var(--panel)); color: var(--ink); font: 500 14px/18px var(--sans);
  box-shadow: inset 0 1px 0 color-mix(in oklab, #fff 7%, transparent), 0 0 0 1px color-mix(in oklab, var(--ink) 8%, transparent), 0 6px 16px -6px rgb(0 0 0 / .45); }
html[data-theme="light"] body.phone #side > .sh-pill > .btn.back { background: var(--panel); box-shadow: 0 0 0 1px rgb(40 30 10 / .09), 0 6px 16px -8px rgb(40 30 10 / .28); }
html body.phone #side > .sh-pill > .btn.back > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html body.phone #side > .sh-pill > .btn.back svg.ic { width: 18px; height: 18px; color: var(--ink-2); }
html body.phone #side > .sh-pill > .btn.back { position: relative; }
html body.phone #side > .sh-pill[data-state="needs-you"] > .btn.back { background: color-mix(in oklab, var(--hold) 18%, var(--panel)); color: var(--hold-ink); font-weight: 650; box-shadow: inset 0 0 0 1px var(--hold); }
html body.phone #side > .sh-pill > .btn.stop { width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 50%; display: grid; place-items: center; }
