/* ── Home, as the app's since You and Home became one (HomeRest,
   ProfilePage's MeStage; user, 2026-11-23: Ding Web "matches the new ui of
   two main ui's instead of three, and to match more how it looks on
   mobile"). chat-home.js says how it is (#view-home.resting, .picking or
   .making):

   At rest: you on a stage in the theme's ink, from the top of the window
   (under the bar, which is drawn in the stage's ink over it) down to round
   corners: your picture in a halo of dots with a pencil on it, your name,
   your username; your four places as one row of tiles on it; Echoes' door
   on its left edge, level with your picture. Under it, on the page's
   paper: the glass pill "Send a Ding to", then Add, Record and how it
   rings, and a line saying what that does. By day the stage is the ink
   and what's on it the paper; at night it's a faint lift off the page,
   written in the ink (MeStage.field / ink).

   Picking: everyone, in the stage's place (the comb, chat.css). Making:
   who it's for, big, and the composer's trays over the buttons.

   On a computer the stage runs across the window, you and the tiles in
   its middle at a comfortable width, the foot under it in the middle. ── */

:root {
  --stage-field: var(--ink);
  --stage-ink: #FFFFFF;
  --stage-on-ink: var(--ink);
  --stage-faint: 0.3;
  --stage-faint-mix: 30%;
  --stage-glass: rgba(255, 255, 255, 0.085);
  --stage-glass-over: rgba(255, 255, 255, 0.13);
  --stage-edge: rgba(255, 255, 255, 0.14);
  --home-pad: 16px;
  --face: clamp(84px, 13.5vh, 108px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --stage-field: color-mix(in srgb, var(--ink) 12%, var(--mist-2));
    --stage-ink: var(--ink);
    --stage-on-ink: var(--mist-2);
    --stage-faint: 0.16;
    --stage-faint-mix: 16%;
    --stage-glass: rgba(255, 255, 255, 0.05);
    --stage-glass-over: rgba(255, 255, 255, 0.09);
    --stage-edge: rgba(255, 255, 255, 0.09);
  }
}
:root[data-theme="dark"] {
  --stage-field: color-mix(in srgb, var(--ink) 12%, var(--mist-2));
  --stage-ink: var(--ink);
  --stage-on-ink: var(--mist-2);
  --stage-faint: 0.16;
  --stage-faint-mix: 16%;
  --stage-glass: rgba(255, 255, 255, 0.05);
  --stage-glass-over: rgba(255, 255, 255, 0.09);
  --stage-edge: rgba(255, 255, 255, 0.09);
}

/* The bar over the stage: in the stage's ink, no glass of its own, and
   going up with the page (the stage is the page's top). */
body[data-view="home"]:has(#view-home.resting) {
  --bar-ink: var(--stage-ink);
  --bar-quiet: color-mix(in srgb, var(--stage-ink) 40%, transparent);
  --bar-ground: var(--stage-field);
}
body[data-view="home"]:has(#view-home.resting) .bar { position: relative; }
body[data-view="home"]:has(#view-home.resting) .bar::before { opacity: 0; }
body[data-view="home"]:has(#view-home.resting) .bar-ask {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 6px 18px rgba(0, 0, 0, 0.3);
}

/* ── The page ── */
#app .page:has(> #view-home:not([hidden])) { padding: 0 var(--home-pad); }
#view-home.home { gap: 0; animation: none; height: var(--fit-h, calc(100dvh - var(--bar-h))); }
/* At rest it's as tall as the window, or as what's on it (then it scrolls). */
#view-home.home.resting { height: auto; min-height: var(--fit-h, calc(100dvh - var(--bar-h))); }
#view-home.resting .home-head, #view-home.resting .home-comb { display: none; }
#view-home:not(.resting) .home-stage, #view-home:not(.resting) .home-to { display: none; }
#view-home .home-head { padding-top: 10px; }
#view-home .home-left:not(:has(> :not([hidden]))) { display: none; }

/* ── The stage ── */
.home-stage {
  position: relative; flex: none; display: flex; flex-direction: column; align-items: center;
  margin: calc(-1 * (var(--bar-h) + env(safe-area-inset-top, 0px))) calc(-1 * var(--home-pad)) 0;
  padding: calc(var(--bar-h) + env(safe-area-inset-top, 0px) + 2px) 14px clamp(16px, 2.8vh, 26px);
  background: var(--stage-field); color: var(--stage-ink);
  border-radius: 0 0 36px 36px;
}
.stage-me { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; max-width: 100%; }
.stage-face {
  position: relative; display: block; width: var(--face); height: var(--face); border-radius: 999px;
  margin: calc(var(--face) * 0.2) 0 calc(var(--face) * 0.2 + 2px); color: inherit; text-decoration: none;
  transition: transform 0.18s ease;
}
.stage-face:hover { transform: scale(1.03); }
.stage-face:active { transform: scale(0.97); }
.stage-face:focus-visible, .stage-handle:focus-visible, .stage-tile:focus-visible, .stage-door:focus-visible { outline: 2px solid var(--stage-ink); outline-offset: 3px; }
/* The halo: two rings of dots, the picture's radius 50 of its 160. */
.stage-halo {
  position: absolute; left: -30%; top: -30%; width: 160%; height: 160%; pointer-events: none;
  fill: none; stroke: var(--stage-ink); stroke-linecap: round;
}
.stage-pic { display: block; width: 100%; height: 100%; border-radius: 999px; overflow: hidden; }
.stage-pic .avatar { font-size: calc(var(--face) * 0.36); font-weight: 700; }
.stage-pencil {
  position: absolute; right: -3px; bottom: -1px; width: 31px; height: 31px; border-radius: 999px; display: grid; place-items: center;
  background: var(--stage-ink); color: var(--stage-on-ink); box-shadow: 0 0 0 3px var(--stage-field);
}
.stage-pencil svg { width: 15px; height: 15px; stroke-width: 2.3; }
.stage-name {
  max-width: 100%; font-size: clamp(27px, 4.4vh, 33px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.12;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stage-handle {
  margin-top: 2px; padding: 3px 10px; border: 0; border-radius: 999px; background: none; cursor: pointer;
  font: inherit; font-size: 16px; font-weight: 500; color: color-mix(in srgb, var(--stage-ink) 60%, transparent);
  transition: color 0.2s ease;
}
.stage-handle:hover { color: var(--stage-ink); }

/* Your places: one row of glass tiles on the stage. */
.stage-tiles {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
  width: 100%; max-width: 420px; margin-top: clamp(14px, 3.4vh, 34px);
}
.stage-tile {
  position: relative; min-width: 0; min-height: clamp(92px, 13vh, 106px); padding: 12px 3px 10px; border-radius: 26px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-align: center;
  background: var(--stage-glass); border: 1px solid var(--stage-edge); color: var(--stage-ink); text-decoration: none;
  -webkit-user-drag: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
  transition: transform 0.15s ease, background 0.2s ease;
}
.stage-tile:hover { background: var(--stage-glass-over); }
.stage-tile:active { transform: scale(0.96); }
.stage-mark { display: block; width: 36px; height: 36px; margin-bottom: 6px; flex: none; }
.stage-mark svg { display: block; width: 100%; height: 100%; fill: currentColor; stroke: none; }
.stage-mark .faint { opacity: var(--stage-faint); }
.stage-mark .cut { fill: none; stroke: var(--stage-field); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.stage-mark .ring { fill: none; stroke: currentColor; stroke-width: 1.9; opacity: 0.5; }
.stage-mark .disc { fill: var(--stage-field); stroke: currentColor; stroke-width: 1.6; }
.stage-mark .line { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.stage-tile b { max-width: 100%; font-size: 14px; font-weight: 700; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-line {
  max-width: 100%; font-size: 12.5px; line-height: 1.25; color: color-mix(in srgb, var(--stage-ink) 55%, transparent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* How many wait in it, on its corner; File Share's added and not sent, on the other. */
.stage-tile .stage-disc {
  position: absolute; top: -5px; right: -3px; margin: 0; min-width: 20px; height: 20px; padding: 0 5.5px;
  background: var(--stage-ink); color: var(--stage-on-ink); box-shadow: 0 0 0 2.5px var(--stage-field);
  font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.stage-tile .pill-unsent {
  position: absolute; top: -5px; left: -3px; display: inline-flex; align-items: center; justify-content: center; gap: 1px;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; box-sizing: border-box;
  background: var(--stage-field); color: var(--stage-ink); box-shadow: inset 0 0 0 1.5px var(--stage-ink);
  font-size: 11px; font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1;
}
.stage-tile .pill-unsent[hidden] { display: none; }
.stage-tile .pill-unsent svg { width: 9px; height: 9px; stroke: currentColor; stroke-width: 3.4; fill: none; }

/* Echoes' door: friends coming in from the left edge, the nearest the
   biggest, level with your picture; "Echoes" under them. */
.stage-door {
  position: absolute; left: 0; width: 104px; height: 120px; color: var(--stage-ink); text-decoration: none;
  top: calc(var(--bar-h) + env(safe-area-inset-top, 0px) + 2px + var(--face) * 0.7 - 62px);
  -webkit-user-drag: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
  transition: transform 0.18s ease;
}
.stage-door:hover { transform: translateX(3px); }
.stage-door:active { transform: scale(0.96); }
.door-row { position: absolute; inset: 0; }
.door-disc {
  position: absolute; top: 62px; border-radius: 999px; display: grid; place-items: center; overflow: hidden;
  transform: translate(-50%, -50%); background: var(--stage-field); box-shadow: 0 0 0 2.5px var(--stage-field);
  animation: door-in 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.12) backwards;
}
.door-disc.d1 { left: 63px; width: 50px; height: 50px; animation-delay: 0.15s; }
.door-disc.d2 { left: 26px; width: 36px; height: 36px; animation-delay: 0.24s; }
.door-disc.d3 { left: -1px; width: 26px; height: 26px; animation-delay: 0.33s; }
.door-disc .avatar { font-size: 13px; }
.door-disc.d2 .avatar { font-size: 10px; }
.door-disc.d3 .avatar { font-size: 0; }
.door-disc.none { background: color-mix(in srgb, var(--stage-ink) var(--stage-faint-mix), var(--stage-field)); }
.door-disc.d2.none { background: color-mix(in srgb, var(--stage-ink) calc(var(--stage-faint-mix) * 0.7), var(--stage-field)); }
.door-disc.d3.none { background: color-mix(in srgb, var(--stage-ink) calc(var(--stage-faint-mix) * 0.4), var(--stage-field)); }
.door-disc svg { width: 20px; height: 20px; stroke-width: 2.8; }
/* A new Echo: a ring of the stage's ink round them, a little out. */
.door-disc.fresh { box-shadow: 0 0 0 2px var(--stage-field), 0 0 0 3.5px var(--stage-ink), 0 0 0 6px var(--stage-field); }
.stage-door b { position: absolute; left: 46px; top: 105px; transform: translate(-50%, -50%); font-size: 13px; font-weight: 700; white-space: nowrap; }
.stage-door .door-count {
  position: absolute; left: 85px; top: 40px; transform: translate(-50%, -50%); margin: 0; min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--stage-ink); color: var(--stage-on-ink); box-shadow: 0 0 0 2.5px var(--stage-field); font-size: 11.5px; font-weight: 800;
}
@keyframes door-in { from { opacity: 0; transform: translate(calc(-50% - 70px), -50%); } }

/* ── The foot: who it goes to, and the buttons that make it ── */
.home-foot {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 2vh, 18px); min-width: 0;
  padding: clamp(12px, 2.2vh, 18px) 0 max(6px, env(safe-area-inset-bottom));
}
/* At rest: the pill just under the stage, the buttons in the middle of the
   room under it. */
#view-home.resting .home-foot { flex: 1; }
#view-home.resting .home-dock { margin: auto 0; }
#view-home .home-sent, #view-home .home-out { margin: 0; }
#view-home .home-sent { max-width: 520px; }

/* "Send a Ding to": one pill of glass, as wide as what's in it. */
.home-to {
  display: inline-flex; align-items: center; gap: 9px; height: 50px; max-width: 100%; padding: 0 16px 0 9px; border-radius: 999px;
  color: var(--ink); cursor: pointer; font: inherit; text-align: left; transition: transform 0.15s ease;
}
.home-to:active { transform: scale(0.97); }
.home-to-face {
  flex: none; width: 32px; height: 32px; margin: 0 3px; border-radius: 999px; display: grid; place-items: center;
  box-shadow: 0 0 0 2.5px var(--glass-strong), 0 0 0 4px var(--ink);
}
.home-to-face .avatar { font-size: 11.5px; }
.home-to-face .avatar.device svg { width: 60%; height: 60%; }
.home-to-face.nobody { box-shadow: none; }
.home-to-face.nobody svg { width: 30px; height: 30px; stroke-width: 1.6; }
.home-to-words { display: flex; flex-direction: column; min-width: 0; line-height: 1.18; }
.home-to-words i { font-style: normal; font-size: 11px; font-weight: 600; color: var(--steel); white-space: nowrap; }
.home-to-words b { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.home-to-name { min-width: 0; max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-to-words svg { flex: none; width: 12px; height: 12px; stroke-width: 3.2; color: var(--steel); }

/* The composer on Home: no bar round it, three buttons on the paper. */
#view-home .home-dock { width: 100%; }
#view-home .home-composer-box { max-width: 820px; margin: 0 auto; }
.composer.home-composer {
  padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.home-composer .home-bar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; justify-items: center; gap: 0 10px;
  width: 100%; max-width: 400px; margin: 0 auto;
}
.home-composer .home-side { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 16px; min-width: 0; }
.home-composer .home-circle {
  position: relative; width: 64px; height: 64px; padding: 0; border-radius: 999px; display: grid; place-items: center;
  color: var(--ink); cursor: pointer; transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.home-composer .home-circle:active { transform: scale(0.94); }
.home-composer .home-circle svg { width: 26px; height: 26px; stroke-width: 2.2; }
.home-composer .ring-glyph { display: grid; place-items: center; }
.home-composer .ring-glyph svg.bold { stroke-width: 3; }
.home-composer .home-cap { max-width: 100%; font-size: 13px; font-weight: 600; color: var(--steel); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-composer .home-mid { display: flex; align-items: center; justify-content: center; gap: 12px; }
.home-composer .home-mid .mic, .home-composer .home-mid .send {
  width: 96px; height: 96px; margin: 0;
  box-shadow: 0 16px 30px -12px color-mix(in srgb, var(--ink) 50%, transparent);
}
.home-composer .home-mid .mic { --halo: 12px; }
.home-composer .home-mid .mic svg, .home-composer .home-mid .send svg { width: 38px; height: 38px; stroke-width: 2; }
/* Record and Send side by side (things added, no voice yet): both smaller. */
.home-composer .home-mid:has(.mic:not([hidden])):has(.send:not([hidden])) .mic,
.home-composer .home-mid:has(.mic:not([hidden])):has(.send:not([hidden])) .send { width: 76px; height: 76px; margin-top: 10px; }
.home-composer .home-mid:has(.mic:not([hidden])):has(.send:not([hidden])) svg { width: 30px; height: 30px; }
/* How it rings, in its colour round its circle when it isn't Normal; a
   time's and a reminder's marks on its corner. */
.home-composer:not([data-ring="notification"]) .ring-circle { box-shadow: 0 0 0 2.5px var(--ring-tint, var(--ink)), var(--shadow); }
.home-composer .ring-badges { position: absolute; top: -4px; right: -7px; display: flex; pointer-events: none; }
.home-composer .ring-badge {
  width: 21px; height: 21px; border-radius: 999px; display: grid; place-items: center;
  background: var(--ink); color: var(--on-ink); box-shadow: 0 0 0 2px var(--mist-1);
}
.home-composer .ring-badge + .ring-badge { margin-left: -4px; }
.home-composer .ring-badge svg { width: 11px; height: 11px; stroke-width: 2.6; }
.home-ring-line { margin: clamp(8px, 1.8vh, 16px) 0 0; text-align: center; font-size: 14px; color: var(--steel); }
.home-composer .composer-note { text-align: center; }
.home-composer .composer-note:empty { display: none; }

/* ── A computer: the stage across the window, its middle a comfortable width. ── */
@media (min-width: 761px) {
  :root { --home-pad: var(--gutter); --face: clamp(88px, 14vh, 128px); }
  .home-stage { padding-bottom: clamp(18px, 3.4vh, 34px); border-radius: 0 0 44px 44px; }
  .stage-name { font-size: clamp(28px, 4.6vh, 40px); }
  .stage-handle { font-size: 17px; }
  .stage-tiles { max-width: 600px; gap: 12px; margin-top: clamp(14px, 3.6vh, 36px); }
  .stage-tile { min-height: clamp(96px, 15vh, 132px); border-radius: 30px; padding: 14px 6px 12px; }
  .stage-mark { width: clamp(34px, 5vh, 44px); height: clamp(34px, 5vh, 44px); margin-bottom: 8px; }
  .stage-tile b { font-size: 16px; }
  .stage-line { font-size: 14px; }
  /* The door, a little bigger, still from the window's edge. */
  .stage-door { transform-origin: 0 62px; transform: scale(1.25); }
  .stage-door:hover { transform: scale(1.25) translateX(3px); }
  .stage-door:active { transform: scale(1.2); }
  .home-to { height: 54px; }
  .home-ring-line { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .door-disc { animation: none; }
  .stage-face, .stage-tile, .stage-door, .home-to, .home-composer .home-circle { transition: none; }
}
