/* The phone in WhatsApp's shapes (task #258, ADR 0282), at a phone's width: linked before
   phone.css, which stays the last stylesheet. Quartio's own colours, type and icons. */

/* The header is one row, as WhatsApp's chat header: the controls at the left (the menu, back,
   Rozmowa's list), the title on one line with what Quartio does now under it (as "pisze…"),
   "Udostępnij" as an icon at the right ("Przełącz miejsce" is in the account menu, task #306). Aktywność's trigger is the whole
   block of the title, its line the status: pressed anywhere there, as WhatsApp's header, its
   panel opens under the header across the screen. The title stands over it, so a press on the
   title itself is the title's (a conversation's is renamed so). */
@media (max-width: 760px) {
  .workspace .topbar { display: grid; grid-template-columns: auto auto auto minmax(0, 1fr) auto; grid-template-rows: 30px 26px; align-items: center; height: auto; padding: 2px 4px; gap: 0; }
  .workspace .topbar .topbar-start { display: contents; }
  .workspace .topbar :is(.mobile-menu, .back-button, .history-slot, .share-slot) { grid-row: 1 / 3; }
  .workspace .topbar .mobile-menu { grid-column: 1; }
  .workspace .topbar .back-button { grid-column: 2; }
  /* (On Rozmowa the way back is its list's arrow: the app's back would be a second arrow.) */
  .workspace .topbar:has(.history-slot:not(:empty)) .back-button { display: none; }
  .workspace .topbar .history-slot { grid-column: 3; display: flex; }
  .workspace .topbar .history-slot:empty { display: none; }
  .workspace .topbar .breadcrumbs { grid-column: 4; grid-row: 1; align-self: end; position: relative; z-index: 1; width: fit-content; max-width: 100%; padding-left: 8px; font-size: 16px; }
  /* Only the page's own name: back leads to the page above it. */
  .workspace .topbar .breadcrumbs > :not(.current) { display: none; }
  /* (A conversation's title is renamed by a press: its box is a finger's 44 px, reaching into
     the rows above and under it, its words where they stand.) */
  .workspace .topbar .breadcrumbs .current { display: block; max-width: 100%; min-height: 0; font-weight: 550; line-height: 1.35; }
  .workspace .topbar #page-title[data-renamable] { padding: 12px 0; margin: -12px 0; }
  .workspace .topbar .topbar-end { grid-column: 4; grid-row: 1 / 3; align-self: stretch; position: static; min-width: 0; margin: 0; }
  .workspace .topbar .activity-trigger { width: 100%; height: 100%; max-width: none; min-height: 44px; align-items: flex-end; padding: 0 0 5px 8px; border: 0; border-radius: 0; background: none; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
  /* The status stands at the block's bottom, so the dot would too: lifted by half of what the
     line (the body's 1.55, named here as the lift counts on it) is taller than it, its middle is
     the words' middle (task #279). */
  .workspace .topbar .activity-trigger .now-dot { margin-bottom: calc((1.55em - 7px) / 2); }
  .workspace .topbar .activity-trigger.is-running { color: var(--olive-ink); }
  .workspace .topbar .activity-trigger:hover { background: none; }
  .workspace .topbar .activity-panel { position: fixed; top: calc(64px + env(safe-area-inset-top)); left: 10px; right: 10px; width: auto; }
  .workspace .topbar .share-slot { grid-column: 5; display: flex; }
  .workspace .topbar .share-slot:empty { display: none; }
  /* Icons, as WhatsApp's: their words for screen readers (their names) and nothing beside them. */
  .workspace .topbar :is(.share-button, .share-owner-more) { width: 44px; height: 44px; padding: 0; justify-content: center; border: 0; background: none; }
  .workspace .topbar .share-button[data-shared=true] .icon { color: var(--olive-ink); }
  .workspace .topbar :is(.share-button-word, .share-state, .share-outside-words, .share-owner-name, .share-owner-access) { display: none; }
  .workspace .topbar .share-header { flex-wrap: nowrap; gap: 0; }
  .workspace .topbar .share-outside { width: 28px; justify-content: center; }
}

/* The bar of the person's pages at the bottom, as WhatsApp's tabs (`app/tab-bar.js`): each its
   icon over its name, the open one's icon on a pill; "Więcej" opens the menu, so ☰ is gone. Not
   in a conversation (the screen over Rozmowa's list, or Quartio's Praca w tle with its own box)
   nor while the keyboard is open. It floats in
   glass over the page (task #367, ADR 0359): off the screen's edges, rounded, translucent and
   blurred; the page area runs on under it and keeps room for it under what it shows. */
.tab-bar { display: none; }
@media (max-width: 760px) {
  /* (A size under WhatsApp's own, task #277: each entry still a finger's 44 px and more.) */
  :root { --bar-room: 74px; }
  .workspace { position: relative; }
  /* (One layer under Rozmowa's column, 30 under 1050 px: a row's menu opening near its foot stands
     over the bar.) */
  .tab-bar { position: absolute; left: 12px; right: 12px; bottom: 8px; z-index: 29; display: flex; gap: 2px; padding: 3px; border: 1px solid var(--q-glass-line); border-radius: 26px; background: var(--q-glass); -webkit-backdrop-filter: blur(20px) saturate(1.8); backdrop-filter: blur(20px) saturate(1.8); box-shadow: 0 10px 30px var(--q-shadow-deep), 0 1px 3px var(--q-shadow); }
  .workspace > .page { padding-bottom: var(--bar-room); scroll-padding-bottom: var(--bar-room); }
  .app-shell:is(:has(.chat-layout > .history:not(.open)), :has(.sa-composer:not([hidden]))) .workspace > .page, html.keyboard .workspace > .page { padding-bottom: 0; scroll-padding-bottom: 0; }
  /* (A note over the page stands over the bar and over a conversation's box.) */
  .toast-root { bottom: calc(var(--bar-room) + 8px + env(safe-area-inset-bottom)); }
  .tab-bar .nav-item { flex: 1 1 0; min-width: 0; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 2px; border-radius: 22px; font-size: 12px; color: var(--muted); text-decoration: none; }
  .tab-bar .nav-item .icon { width: 20px; height: 20px; padding: 2px 14px; box-sizing: content-box; border-radius: 14px; transition: background-color 160ms ease; }
  /* (The keyboard's ring inside the entry, within the bar's round edge.) */
  .tab-bar .nav-item:focus-visible { outline-offset: -2px; }
  .tab-bar .nav-item.active { color: var(--ink); font-weight: 600; }
  .tab-bar .nav-item.active .icon { background: var(--sage); color: var(--olive-ink); }
  .tab-bar .nav-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tab-bar .soon { display: none; }
  .workspace .topbar .mobile-menu { display: none; }
  .app-shell:is(:has(.chat-layout > .history:not(.open)), :has(.sa-composer:not([hidden]))) .tab-bar, html.keyboard .tab-bar { display: none; }
  /* The menu "Więcej" opens: a sheet from the left, rounded and lifted over the page. */
  .navigation { border-radius: 0 22px 22px 0; box-shadow: 0 10px 40px var(--q-shadow-deep); }
}
