/* iPhone/browser build only (loaded after style.css). The Mac window is >= 560 px wide; phones are ~375-430 px. */
html.work-caller-web { -webkit-text-size-adjust: 100%; }
html.work-caller-web body {
  min-width: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  box-sizing: border-box;
}
html.work-caller-web main { height: auto; min-height: 100vh; min-height: 100dvh; box-sizing: border-box; }
/* Row 1100: the rule above (html.work-caller-web main, more specific than mail.css's main.mail-mode) made the mail
   view's main content-tall in the browser build, so .mv-columns had no definite height: neither the list nor the
   reader scrolled and the header was clipped. Bound it to the viewport again (dvh; minus the body's safe-area
   padding); the narrow branch below keeps its own height. The Mac app does not load this file. */
html.work-caller-web main.mail-mode {
  height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  min-height: 0;
}
html.work-caller-web input, html.work-caller-web textarea, html.work-caller-web select { font-size: 16px; } /* no iOS zoom on focus */
/* Tiles are drag-sortable on the Mac (touch-action: none); on a phone the page must scroll when you swipe over them. */
html.work-caller-web .app-tile, html.work-caller-web button { touch-action: manipulation; }
@media (max-width: 520px) {
  html.work-caller-web main { padding-left: 12px; padding-right: 12px; }
  html.work-caller-web .app-grid { flex: none; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: none;
    grid-auto-rows: minmax(96px, auto); gap: 8px; }
  html.work-caller-web .view-header { flex-wrap: wrap; gap: 8px; }
}
html.work-caller-web .tv-body { padding:2px; -webkit-overflow-scrolling:touch; }
html.work-caller-web .tv-chip, html.work-caller-web .tv-project, html.work-caller-web .tv-view, html.work-caller-web .tv-pause, html.work-caller-web .tv-all { min-height:40px; }
html.work-caller-web .tv-memory-btn, html.work-caller-web .tv-memory-close, html.work-caller-web .tv-memory-refresh { min-height:40px; }
html.work-caller-web .tv-memory-overlay { padding:0; }
html.work-caller-web .tv-memory-box { width:100%; height:100%; max-height:100%; border-radius:0; }
html.work-caller-web main.terminal-views-mode { max-width: none; padding-left: 8px; padding-right: 8px; }
html.work-caller-web #terminal-views-root { max-width: 100%; overflow-x: hidden; }
html.work-caller-web .tv-single { max-width: 100%; }
/* Phone portrait: project row and view row are each one horizontally scrollable line (no wrapping), touch targets >= 40px. */
@media (max-width: 520px) {
  html.work-caller-web .tv-bar { flex-wrap: wrap; }
  html.work-caller-web .tv-projects { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  html.work-caller-web .tv-chooser { flex: 1 1 0; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  html.work-caller-web .tv-projects button, html.work-caller-web .tv-chooser button { flex: 0 0 auto; white-space: nowrap; min-height: 40px; }
  html.work-caller-web .tv-bar > button { flex: 0 0 auto; }
}
html.work-caller-web .status-tile-cards { grid-template-columns:1fr; }
html.work-caller-web #status-view-root { max-width:100%; overflow-x:hidden; }

/* Fullscreen view (row tv-fullscreen): >= 40px touch targets in the thin bar, safe areas come from style.css. */
html.work-caller-web .tv-fs, html.work-caller-web .tv-fs-close { min-height:40px; }
html.work-caller-web .tv-fullscreen .tv-bar select { min-height:40px; font-size:16px; }
html.work-caller-web .tv-fullscreen .tv-bar .tv-fs-close { min-width:40px; }
html.work-caller-web #terminal-views-root.tv-fullscreen { overflow:hidden; }
@media (max-width: 520px) { html.work-caller-web .tv-bar > button.tv-fs { flex: 0 0 auto; } }

/* These workspaces scroll their own panels. On a short phone the document can
   also scroll, so headers and the footer cannot squeeze a list to zero rows. */
@media (max-width: 800px), (max-width: 950px) and (max-height: 520px) {
  html.work-caller-web {
    --wc-usable-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  @supports (height: 100dvh) {
    html.work-caller-web {
      --wc-usable-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }
  }
  html.work-caller-web:not(.terminal-views-fullscreen) body { min-height: 0; }
  html.work-caller-web:where(:not(.terminal-views-fullscreen)) main { min-height: var(--wc-usable-height); }
  html.work-caller-web main:is(.files-mode, .mail-mode, .spotify-room-mode) {
    height: var(--wc-usable-height);
    min-height: 34rem;
  }
  /* Row 1141 review 1: the mail workspace has a single scrolling area (its list or reader). A fixed 34rem (544 px)
     minimum taller than a landscape or short phone viewport added a page scroll on top of it, so mail is bounded to
     the usable height only (the footer is inside main). Files and Spotify keep their minimum. */
  html.work-caller-web main.mail-mode { min-height: 0; }
  html.work-caller-web .app-footer {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 2px;
  }
  html.work-caller-web .app-footer small { text-align: start; }

  /* Keep the native details controls inside the panel's scrollable flow. An
     absolute list under a sticky heading is otherwise clipped by fv-browser. */
  #files-root .fv-shell.narrow .fv-heading { position: static; }
  #files-root .fv-shell.narrow.big .fv-browser { display: none; }
  #files-root .fv-shell.narrow .fv-columns.active {
    grid-template-rows: minmax(5rem, var(--fv-split, 28%)) 14px minmax(0, 1fr);
  }
  #files-root .fv-shell.narrow .fv-folders[open],
  #files-root .fv-shell.narrow .fv-menu[open] { flex: 1 0 100%; }
  #files-root .fv-shell.narrow .fv-folders[open] ul,
  #files-root .fv-shell.narrow .fv-menu[open] .fv-actions {
    position: static;
    width: 100%;
    max-height: none;
    margin-top: 4px;
    box-shadow: none;
  }
  #files-root .fv-shell.narrow .fv-preview:has(.fv-menu[open]) { height: auto; min-height: 100%; }
  /* Let the folder chooser use the whole list panel while a preview is open. */
  #files-root .fv-shell.narrow .fv-columns.active:has(.fv-folders[open]) {
    grid-template-rows: minmax(0, 1fr) 0 0;
  }
  #files-root .fv-shell.narrow .fv-columns.active:has(.fv-folders[open]) > :is(.fv-sep, .fv-right) {
    visibility: hidden;
  }

  html.work-caller-web .device-picker-menu:not(.hidden) {
    position: static;
    display: block;
    margin-top: 5px;
  }
  /* JS positions this library menu at its trigger on desktop. On phones the
     last track may be on the bottom edge; keep the entire menu reachable. */
  #spotify-room-root .sr-ctx-menu:not([hidden]) {
    left: max(8px, env(safe-area-inset-left)) !important;
    top: auto !important;
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    max-height: calc(var(--wc-usable-height) - 16px);
    min-width: 0;
    overflow-y: auto;
  }
}
/* Row 1048: call-forward buttons on an iPhone-width screen: two columns, large tap targets, the big code fits. */
@media (max-width: 520px) {
  html.work-caller-web .cf-buttons { grid-template-columns:repeat(2,minmax(0,1fr)); }
  html.work-caller-web .cf-button { min-height:52px; font-size:15px; }
  html.work-caller-web .cf-big-code { font-size:22px; }
}

/* Adele's decorative signature at the end of the Work Caller web header. */
html.work-caller-web #home-view > .home-header {
  flex-wrap: nowrap;
}

html.work-caller-web #home-view > .home-header > div:nth-child(2) {
  min-width: 0;
}

html.work-caller-web #home-view > .home-header::after {
  content: "";
  display: block;
  flex: 0 0 auto;
  align-self: center;
  margin-inline-start: auto;
  width: clamp(50px, 13vw, 76px);
  aspect-ratio: 1;
  background: url("/app/assets/adele-viuhka-3.png") center / contain no-repeat;
}

@media (max-width: 400px) {
  html.work-caller-web #home-view > .home-header { column-gap: 10px; }
}
