/**
 * The responsive layers.
 *
 * Three breakpoints, each the one the handoff names:
 *
 *   <= 1000px  the sidebar goes
 *   <=  860px  the sign-in panels stack
 *   <=  760px  the phone layout: mobile header, flat lists, bottom tabs
 *
 * DEVIATION at 1000px: the handoff suggests collapsing the sidebar "to icons or
 * a drawer". It also specifies no icon set, and a drawer needs a control that
 * is not in the design. Rather than invent either, the designed bottom tab bar
 * takes over the navigation at that width. It is a real component from the
 * mocks doing the job it was drawn for, and it needs no new assets.
 */

@media (max-width: 1000px) {
  .sidebar {
    display: none;
  }

  .m-tabs {
    display: flex;
  }

  .content {
    padding: 20px 20px 32px;
  }

  .app-header {
    padding: 20px 20px 14px;
  }
}

@media (max-width: 860px) {
  .auth {
    flex-direction: column;
    min-height: 0;
  }

  .auth-left {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 40px 24px;
  }

  .auth-right {
    padding: 40px 24px 56px;
  }

  .auth-headline {
    font-size: 30px;
  }

  .auth-form {
    max-width: none;
  }
}

/* ---- The phone --------------------------------------------------------- */

@media (max-width: 760px) {
  .app {
    height: 100dvh;
  }

  /* Desktop surfaces off, phone surfaces on. display:none also takes the
   * hidden copy out of the accessibility tree, which is what lets the two
   * headers carry different words. */
  .app-header,
  .today-desktop,
  .week,
  .inbox,
  .settings {
    display: none;
  }

  .m-header {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 20px 12px;
    background: var(--surface-raised);
    border-bottom: 1px solid var(--line);
  }

  .m-header .kicker {
    margin: 0;
    font-size: 10.5px;
  }

  .m-title {
    margin: 0;
    font: 600 20px/1.15 var(--font);
    letter-spacing: -.01em;
    color: var(--ink);
  }

  .m-sub {
    font: 400 12.5px/1.4 var(--font);
    color: var(--ink-3);
  }

  .content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px 20px;
  }

  .agenda-flat,
  .week-list,
  .m-inbox,
  .m-sources {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  /* Today: one flat agenda, no hour rows and no view switcher. */
  .agenda-card-flat {
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 12px;
  }

  .agenda-flat-time {
    width: 46px;
    flex: none;
    font: 400 11px/1.3 var(--mono);
    color: var(--ink-4);
  }

  .agenda-card-flat .item-meta-text {
    font: 400 11px/1 var(--font);
  }

  /* Week: one horizontal card per day. */
  .week-card {
    display: flex;
    gap: 13px;
    padding: 13px 14px;
    border: 1px solid var(--line-2);
    border-radius: 12px;
    background: var(--card-alt);
  }

  .week-card-date {
    width: 42px;
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .week-card .week-dow {
    font-size: 10px;
  }

  .week-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
  }

  .week-line {
    display: flex;
    align-items: baseline;
    gap: 9px;
  }

  .week-line-time {
    width: 44px;
    flex: none;
    font: 400 10px/1.3 var(--mono);
    color: var(--ink-5);
  }

  .week-line-title {
    font: 400 12px/1.3 var(--font);
    color: var(--ink-2);
  }

  .week-card .week-load {
    margin-top: 0;
    font-size: 10px;
  }

  /* Inbox: flat, no grouping and no "add to today" button. */
  .m-inbox-row {
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    min-height: 56px;
    padding: 14px;
    border: 1px solid var(--line-2);
    border-radius: 12px;
    background: var(--card);
    text-align: left;
    cursor: pointer;
  }

  .m-inbox-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .m-inbox-row .row-title {
    font: 500 13.5px/1.3 var(--font);
    color: var(--ink);
  }

  .m-inbox-source {
    font: 400 10.5px/1 var(--mono);
    letter-spacing: .04em;
    color: var(--ink-5);
  }

  /* Sources tab: the onboarding rows at a touch size. */
  .m-sources .source-row {
    min-height: 60px;
    padding: 14px;
    background: var(--card);
  }

  .m-sources .source-btn {
    padding: 10px 14px;
  }

  /* 44px minimum touch targets. The circles stay the size the design drew
   * them; the hit area around them grows to meet the guideline. */
  .inbox-check,
  .carry-check,
  .carry-move {
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
  }

  .empty {
    margin-top: 16px;
  }
}

/* The bottom tab bar. Outside the media query because it is also what carries
 * navigation between 760px and 1000px, where the sidebar is gone. */
.m-tabs {
  flex: none;
  padding: 9px 12px 22px;
  background: var(--surface-raised);
  border-top: 1px solid var(--line);
}

.m-tab {
  flex: 1;
  min-height: 48px;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font: 400 10.5px/1 var(--font);
  color: var(--ink-5);
}

.m-tab.is-active {
  font-weight: 600;
  color: var(--accent);
}

.m-tab:hover {
  color: var(--accent);
}

.m-tab-glyph {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
}

.m-tab-glyph.glyph-square {
  border-radius: 4px;
}
