/* Foldable iPhone (iPhone Duo; published specs: 5.4" cover screen 1398x2034 px, 7.6" inner
   screen 1878x2670 px, open device wider than tall). At 3x that is about 466x678 pt closed
   and 890x626 pt open in landscape. Assumed, not tested on a real device. */

/* ---------- Closed: cover screen. Short and wide, so a compact list with no side rail. ---------- */
@media (max-width: 520px) and (min-aspect-ratio: 3/5) and (orientation: portrait) {
  body.orbit-v27 { --content-gutter: 14px; }
  /* One line per task: title on the left, priority and date on the right. Tap the title for details. */
  body.orbit-v27 .task-row { padding-top: 9px; padding-bottom: 9px; min-height: 52px; }
  body.orbit-v27 .task-row .task-list-description,
  body.orbit-v27 .task-row .task-note { display: none !important; }
  /* Up to two lines, so titles aren't cut off mid-word and line up with the check circle. */
  body.orbit-v27 .task-row .task-title-button { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; overflow: hidden; }
  body.orbit-v27 .task-row .task-main { align-self: start; padding-top: 2px; }
  body.orbit-v27 .task-row .task-title { font-size: 15.5px; line-height: 1.3; }
  body.orbit-v27 .task-row .task-list-category { font-size: 12px; }
  body.orbit-v27 .page-heading h1, body.orbit-v27 .view > h1 { font-size: 24px; }
  body.orbit-v27 .shell-toolbar { min-height: 48px; }
  /* Focus: a tighter greeting so the lists start near the top. */
  body.orbit-v27 .focus-home .home-head { margin: 0 0 18px; }
  body.orbit-v27 .focus-home .home-head h1 { font-size: 26px; }
  body.orbit-v27 .focus-home .home-lead { font-size: 15px; margin-top: 6px; }
  body.orbit-v27 .focus-home .home-section { margin-bottom: 24px; }
  body.orbit-v27 .focus-home .home-section-head h2 { font-size: 18px; }
}

/* ---------- Open: inner screen in landscape. Two halves that meet at the fold. ---------- */
@media (min-width: 780px) and (max-width: 1024px) and (max-height: 800px) and (orientation: landscape),
       (horizontal-viewport-segments: 2) {
  body.orbit-v27 { --fold-left: env(viewport-segment-width 0 0, 50vw); --fold-right: env(viewport-segment-left 1 0, 50vw); }
  /* Focus: the Chopping Block. */
  /* Only the visible Focus page: .view hides inactive pages with a weaker rule, so never set display without .active. */
  body.orbit-v27 #view-today.focus-home.active { max-width: none; display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; align-items: start; }
  body.orbit-v27 #view-today.focus-home.active > * { grid-column: 1 / -1; }
  /* Focus is only the Chopping Block now, across the full width. */
  body.orbit-v27 #view-today.focus-home.active > #homeToday { grid-column: 1 / -1; }
  /* A task opens in the right half, beside the list, instead of covering it. The side menu steps
     aside while it is open so the list gets the whole left half. */
  body.orbit-v27.task-pane-open .app-header, body.orbit-v27.task-pane-open .sidebar { display: none !important; }
  body.orbit-v27.task-pane-open main, body.orbit-v27.task-pane-open[data-view="subject"] main { inset: 0 auto 0 0 !important; width: var(--fold-left) !important; }
  body.orbit-v27.task-pane-open #taskFab { right: calc(100vw - var(--fold-left) + 16px); }
  body.orbit-v27 #bridgeTaskDialog.task-sheet[open]:not(:modal) {
    position: fixed; inset: 0 0 0 auto; left: var(--fold-right); width: auto; max-width: none; height: 100dvh; max-height: 100dvh;
    margin: 0; box-shadow: none; border-left: 1px solid var(--o-line-strong); z-index: 60;
  }
}

/* Audit (2026-11-02): small fixes for both foldable screens and narrow phones. */
body.orbit-v27 .focus-home time, body.orbit-v27 .home-need-meta > :last-child { white-space: nowrap; flex: none; }
@media (max-width: 420px) {
  /* Give the category name room next to the big tasks-left count. */
  body.orbit-v27 .subject-page-toolbar .subject-sticky-identity .subject-sticky-photo { display: none !important; }
  body.orbit-v27 .subject-page-toolbar .subject-sticky-count { padding: 3px 10px; }
  body.orbit-v27 .subject-page-toolbar .subject-sticky-count b { font-size: 20px; }
}

/* Categories page cards: never squeeze a card below ~260px. On the Duo opened (or any
   narrow main pane) this drops to two columns instead of cutting titles off. */
body.orbit-v27[data-view="dashboard"][data-dashboard-mode="categories"] #projectGrid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)) !important; }
body.orbit-v27 #projectGrid .category-panel { grid-template-columns: 42% minmax(0, 1fr); min-width: 0; }
body.orbit-v27 #projectGrid .category-panel > div:last-child { min-width: 0; }
body.orbit-v27 #projectGrid .category-panel h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.orbit-v27 #projectGrid .category-panel > :first-child { width: 100%; height: 100%; min-height: 0; overflow: hidden; }
body.orbit-v27 #projectGrid .personal-category-cover .face-user { width: min(96px, 80%) !important; height: auto !important; min-width: 0 !important; min-height: 0 !important; max-width: none !important; max-height: none !important; flex: none !important; aspect-ratio: 1 / 1; }

/* Category page: keep the eye on what's left. Completed is one quiet line under the list. */
body.orbit-v27 #view-subject .completed-section { margin: 14px 0 0; padding: 0; background: none !important; border: 0 !important; border-radius: 0; box-shadow: none; }
body.orbit-v27 #view-subject .completed-list-heading { justify-content: flex-start; gap: 4px; min-height: 40px; margin: 0; padding: 0; border: 0; background: none; }
body.orbit-v27 #view-subject .completed-list-heading > span { font-size: 13px; font-weight: 450; color: var(--o-faint, #8a8a93); }
body.orbit-v27 #view-subject .completed-list-heading > span::before { content: none !important; display: none !important; }
body.orbit-v27 #view-subject .completed-visibility { min-height: 40px; padding: 0 8px; font-size: 13px; color: var(--o-accent-ink, #6cb4ff); background: none !important; border: 0 !important; }
body.orbit-v27 #view-subject .completed-task-list:empty { display: none; }

/* Audit (2026-11-02, second pass) */
/* Categories page: the All / Personal / Businesses… row scrolls sideways instead of pushing the page wider on narrow screens. */
body.orbit-v27 .subject-category-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
body.orbit-v27 .subject-category-nav::-webkit-scrollbar { display: none; }
body.orbit-v27 .subject-category-nav > button { flex: none; }
/* Edit task: "Ask agent" stays on one line on phones. */
body.orbit-v27 #captureDialog .capture-ask-agent { white-space: nowrap; flex: none; }
