/* Troubadour web UI - breakpoints. Three claims, each verified in the
   pixel suites: >= 1024 the sidebar is docked, < 1024 it is a drawer,
   < 768 the sandbox pane is a bottom sheet and the header is compact. */

@media (min-width: 1024px) {
  /* Center jump-to-latest over .main rather than the full viewport (sidebar-aware). */
  .newmsg { left: calc(var(--sidebar-w) + (100vw - var(--sidebar-w)) / 2); }
  .shell.has-pane .newmsg { left: calc(var(--sidebar-w) + (100vw - var(--sidebar-w) - var(--pane-w)) / 2); }
}

@media (max-width: 1180px) {
  /* labels leave the header buttons before the tab strip has to scroll */
  .header__toggle .btn__text { display: none; }
  .header__toggle { width: 38px; padding: 0; justify-content: center; }
  .avatar__text { display: none; }
  .avatar { padding: 0 4px; }
}

@media (max-width: 1023px) {
  .sidebar { position: fixed; top: 0; left: 0; height: 100%; z-index: 30; transform: translateX(-100%);
    transition: transform 0.2s ease; box-shadow: var(--shadow-3); }
  .sidebar.open { transform: translateX(0); }
  .sidebar__scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 29; }
  .hamburger { display: flex; }
  .settings-layout { grid-template-columns: 1fr; gap: var(--s3); }
  .field-grid { grid-template-columns: 1fr; }
  .settings-quiet__times { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s2) var(--s3); }
  .settings-quiet__times input { min-width: 0; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none;
    padding-bottom: var(--s1); }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav button { white-space: nowrap; flex: 0 0 auto; }
}

@media (max-width: 767px) {
  /* gh #59: the long takeover label costs the header room it lacks */
  .header__takeover__long { display: none; }
  .header__takeover__short { display: inline; }
  .header { padding: 0 var(--s2); gap: var(--s1); }
  .header__title { display: block; }
  /* seven tabs cannot share a 375 px header, and a half-cut label is
     worse than none: the strip becomes a bottom bar, icon over label, the
     one thumb-reachable place on a phone */
  .header__tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0;
    overflow: visible; background: var(--bg); border-top: 1px solid var(--border);
    padding: 4px 4px env(safe-area-inset-bottom); height: calc(58px + env(safe-area-inset-bottom)); }
  .tab { flex-direction: column; justify-content: center; gap: 2px; height: auto; min-height: 50px;
    padding: 4px 1px; border-radius: 10px; font-size: 10.5px; }
  .tab .icon { width: 21px; height: 21px; }
  .tab__label { font-size: 10px; font-weight: 600; letter-spacing: -0.01em; max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; }
  .tab__badge { position: absolute; top: 1px; left: 50%; margin: 0 0 0 6px; min-width: 16px;
    line-height: 16px; font-size: 10px; padding: 0 4px; }
  .main { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .newmsg { bottom: calc(58px + 104px + env(safe-area-inset-bottom)); }
  .pane { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 66vh; width: 100%;
    border-left: none; border-top: 1px solid var(--border); border-radius: 18px 18px 0 0;
    transform: translateY(100%); transition: transform 0.22s ease; z-index: 35; box-shadow: var(--shadow-3); }
  .pane.open { transform: translateY(0); }
  .pane__head { height: 52px; }
  .content { padding: var(--s4) var(--s3) var(--s6); }
  .page-head { margin-bottom: var(--s4); }
  .bubble { max-width: 92%; }
  .chat__scroll { padding-top: var(--s3); }
  .auth__card { padding: var(--s6) var(--s5) var(--s5); }
  .feed-row { grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; padding: var(--s3); }
  .feed-tile { width: 40px; height: 40px; border-radius: 12px; }
  .list-item { padding: var(--s3); }
  .btn, .tab { min-height: 40px; }
  .btn--sm { min-height: 36px; }
  .sidebar__new { min-height: 48px; height: auto; padding: 12px var(--s4); font-size: var(--fs-md); }
  .modal__card { padding: var(--s4); }
  .modal__card.proj-modal { width: calc(100vw - 16px); max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px); border-radius: 14px; }
  .proj-modal__head, .proj-modal__body, .proj-modal__foot { padding-inline: var(--s3); }
  .proj-modal__head { padding-block: var(--s3); }
  .proj-modal__body { padding-block: var(--s3); }
  .proj-modal__foot { padding-block: var(--s2); }
  .shell-banners { padding: 0 var(--s2); }
  .toasts { left: var(--s3); right: var(--s3); max-width: none; align-items: center;
    bottom: calc(66px + var(--s3) + env(safe-area-inset-bottom)); }
  body.has-composer .toasts { bottom: calc(66px + 92px + env(safe-area-inset-bottom)); }
}

@media (max-height: 520px) {
  body.has-composer .toasts { bottom: 84px; }
  .modal__card.proj-modal { width: calc(100vw - 12px); max-width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px); border-radius: 12px; }
  .proj-modal__head { padding: var(--s2) var(--s3); }
  .proj-modal__body { padding: var(--s2) var(--s3); gap: var(--s3); }
  .proj-modal__foot { padding: var(--s2) var(--s3); }
  .proj-review__summary { max-height: 5.5rem; }
  .project-verdicts--compact { max-height: 8.5rem; }
}

@media (max-width: 400px) {
  .content { padding: var(--s3) 10px var(--s5); }
  .composer__ta { min-height: 44px; }
  .composer__send, .composer__clip { width: 44px; height: 44px; }
  .brand__name { font-size: 16px; }
}
