/* meet on a phone: the meetings list at 390.
 *
 * Numbers from the handoff MOBILE-MEET, sections 2 and 3. This is not the
 * desktop table made narrow - the table, the five-control filter row and the
 * nav rail are all gone below 768, and what is left is arranged for a thumb:
 * cards in an agenda, and the two create buttons pinned where they can be
 * reached without scrolling.
 *
 * Everything here is inside one query. Above 768 not a line of it applies.
 */

@media (max-width: 767px) {
  /* 32px, per MOBILE-MEET 2. The ring's colour is the account menu's own
     business - it goes blue while the menu is open. */
  .account-trigger .initials {
    width: 32px;
    height: 32px;
  }

  /* Header: 56px, and no navigation. NavRail is out of bounds below 768
     (MEET-NOW-AND-NAVIGATION 2.6) - the sections hang off the account sheet
     until the menu they belong behind is designed. */
  .top-bar {
    height: 56px;
    padding: 0 16px;
    column-gap: 12px;
  }

  .nav-rail {
    display: none;
  }

  .top-bar .who > span,
  .top-bar .who .role {
    display: none;
  }

  .phone-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-left: auto;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--c-neutral-11);
    cursor: pointer;
    transition:
      background-color var(--transition-default),
      color var(--transition-default);
  }

  .phone-search:hover {
    background: var(--c-neutral-1);
    color: var(--c-white);
  }

  .phone-search[aria-expanded="true"] {
    background: var(--c-neutral-1);
    color: var(--c-white);
  }

  /* The list is the page: its own scroll, and room at the bottom for the
     create bar so the last card is never under it. */
  #panel.panel {
    padding: 18px 16px 20px;
    max-width: none;
  }

  #panel .panel-header {
    display: block;
    margin-bottom: 18px;
  }

  #panel .panel-header h1 {
    font: var(--t-h6-500);
    letter-spacing: var(--ls-h6);
  }

  /* Five dropdowns, none of them the reason the phone was unlocked. */
  #panel .filters {
    display: none;
  }

  #panel.panel-search-open .filters {
    display: block;
  }

  /* The search field is the first control in the row; the other four stay
     desktop-only whether or not the row is showing. */
  #panel.panel-search-open .filters > *:not(:first-child) {
    display: none;
  }

  #panel.panel-search-open .filters {
    margin-bottom: 14px;
  }

  .row-head {
    display: none;
  }

  [data-rows] {
    display: flex;
    flex-direction: column;
    row-gap: 20px;
    padding-bottom: 92px;
  }

  .phone-group-label {
    font: var(--t-body-small-500);
    color: var(--c-neutral-9);
    margin: 0 0 10px;
  }

  .phone-group + .phone-group {
    margin-top: 10px;
  }

  /* A card, not a row. */
  .phone-card {
    display: flex;
    flex-direction: column;
    row-gap: 12px;
    border: 1px solid var(--c-neutral-2);
    border-radius: 12px;
    padding: 14px;
  }

  .phone-card + .phone-card {
    margin-top: 12px;
  }

  /* The live card is the only one with a brighter border and a fill: it is
     nearly always the top card, so the screen answers "is something running
     right now" before anything is read. */
  .phone-card-live {
    border-color: var(--c-neutral-3);
    background: var(--grad-card-hover-fill);
  }

  .phone-live-row {
    display: flex;
    align-items: center;
    column-gap: 8px;
  }

  .phone-live {
    display: inline-flex;
    align-items: center;
    column-gap: 8px;
    font: var(--t-body-small-500);
    color: var(--c-green);
  }

  .phone-live .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--c-green);
    animation: dgpulse 1.8s ease-in-out infinite;
  }

  .phone-live-row .badge {
    margin-left: auto;
  }

  /* Names wrap. On a phone the distinguishing part of a name is usually at
     the end - "... - Northwind Energy" - so an ellipsis hides the half that
     tells two meetings apart. */
  .phone-name {
    font: var(--t-body-primary-500);
    color: var(--c-white);
    margin: 0;
    overflow-wrap: anywhere;
  }

  .phone-card-live .phone-name {
    font: var(--t-body-big-500);
  }

  .phone-meta {
    font: var(--t-body-small-300);
    color: var(--c-neutral-9);
    margin: 0;
  }

  /* The fixed time column is what makes a day group scan as an agenda. */
  .phone-when {
    display: flex;
    column-gap: 12px;
    align-items: baseline;
  }

  .phone-time {
    flex: 0 0 46px;
    font: var(--t-body-primary-500);
    color: var(--c-white);
  }

  .phone-when > div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    row-gap: 6px;
  }

  .phone-actions {
    display: flex;
    column-gap: 8px;
  }

  /* One padding for both, because `flex-basis: 0` is a content-box zero even
     under border-box: leave the variants their own padding and the button
     that confirms changes width by 4px under the finger, which is exactly
     what the confirmation is not allowed to do. */
  .phone-actions .button {
    flex: 1 1 0;
    min-width: 0;
    height: 44px;
    padding: 0 16px;
  }

  .phone-more {
    flex: none;
    width: 44px;
    height: 44px;
    border: 1px solid var(--c-neutral-3);
    border-radius: 8px;
    background: none;
    color: var(--c-neutral-11);
    cursor: pointer;
    transition: background-color var(--transition-default);
  }

  .phone-more:hover {
    background: var(--c-neutral-1);
  }

  /* The create pair never leaves the screen. */
  #panel .panel-header .actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    flex-direction: row-reverse;
    column-gap: 10px;
    padding: 12px 16px max(20px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--c-neutral-2);
    background: var(--c-neutral-0);
  }

  #panel .panel-header .actions .button {
    flex: 1 1 0;
    min-width: 0;
    height: 48px;
  }

  /* Above the create bar, never under it. */
  .toast {
    left: 16px;
    right: 16px;
    bottom: 96px;
    transform: none;
    width: auto;
  }

  #panel .footer,
  .panel-footer {
    display: none;
  }
}

/* The sections the rail carries above 768 are in the account sheet below it,
   and only below it. */
.account-sections {
  display: none;
}

@media (max-width: 767px) {
  .account-sections {
    display: block;
  }
}

/* New meeting on a phone: the same two steps, as a full-height sheet
   (MOBILE-MEET 8). The wizard's own content is unchanged - what changes is
   the container, the title bar it gets, and the primary action sitting at the
   bottom edge where a thumb is. */
@media (max-width: 767px) {
  .modal-backdrop:has(.modal-wizard) {
    padding: 0;
    align-items: stretch;
  }

  .modal.modal-wizard {
    width: 100%;
    max-width: none;
    height: 100vh;
    max-height: 100vh;
    border: 0;
    border-radius: 0;
    padding: 0 20px 20px;
    row-gap: 16px;
  }

  /* The title bar: 56px, with the way out on the right. The step marker
     Step 1 of 2 keeps its place beside the title underneath. */
  .modal.modal-wizard .wizard-head {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: 0 -20px;
    padding: 14px 20px;
    background: var(--c-neutral-0);
    border-bottom: 1px solid var(--c-neutral-2);
  }

  /* Pinned, not merely last: the step's primary action has to be reachable
     without scrolling to the end of a form (MOBILE-MEET 8). `margin-top: auto`
     only puts it at the bottom of the content, which on a full step is below
     the fold. */
  .modal.modal-wizard .modal-actions {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    padding: 16px 0 max(0px, env(safe-area-inset-bottom));
    background: var(--c-neutral-0);
    border-top: 1px solid var(--c-neutral-2);
  }

  .modal.modal-wizard .modal-actions .button {
    height: 48px;
    flex: 1 1 0;
    min-width: 0;
    padding: 0 16px;
  }

  /* One field per row: date, time and duration side by side do not fit a
     thumb. */
  .modal.modal-wizard .grid-three {
    display: flex;
    flex-direction: column;
    row-gap: 14px;
  }
}
