/* phone.css
   The look of the phone shell (phone-shell.js): the same views as on the
   PC, made for a narrow screen and a finger. Every rule starts with
   .phone-shell, so nothing changes on the PC.

     ┌───────────────────────────┐
     │ ‹ Overview             ⋯  │  .phone-bar
     │ Inbox           5 waiting │  the view's own header, as a large title
     │ [ Type a note …         ] │
     │ ┌ card ────────────────┐  │  only the list scrolls
     │ folder status / notice    │  .phone-status
     └───────────────────────────┘

   Calm and monochrome as everywhere (DESIGN-GUIDELINES.md). Fingers need
   room: everything you tap is at least 44 px high (Apple's own rule). */

/* The whole screen, also under the iPhone's notch and home bar ("safe
   area"); 100dvh is the height that is really visible in Safari. */
.phone-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: clip;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  box-sizing: border-box;
}

/* ---- the bar: ‹ back, and ⋯ ----------------------------------------------- */

.phone-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 0.25rem;
}

.phone-back,
.phone-more {
  min-height: 44px;
  min-width: 44px;
  border: none;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
  padding: 0 0.6rem;
}

.phone-back { max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.phone-back[hidden] { display: block; visibility: hidden; } /* keeps ⋯ on the right */
.phone-more { margin-left: auto; font-size: 1.4rem; line-height: 1; }

/* ---- the status line at the bottom: folder status, or a short notice -------- */

.phone-status {
  min-height: 1.2rem;
  padding: 0.35rem 1rem calc(0.35rem + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35; /* a longer notice (a conflict) wraps instead of being cut off */
  border-top: 1px solid var(--line);
}

.phone-status.read-only { color: var(--ink); font-weight: 600; }

/* ---- the views, for a narrow screen ---------------------------------------- */

.phone-shell .phone-view-place { padding: 0; }

/* No frame around the view: the screen is the frame. */
.phone-shell .view { border: none; }

/* The view's own header is the large title, as in Apple Mail. */
.phone-shell .view-header { padding: 0.25rem 1rem 0.6rem; border-bottom: none; }
.phone-shell .view-header h2 { font-size: 1.6rem; font-weight: 600; }

/* No keys on a phone: no hint bars, no "Esc back to the list". */
.phone-shell .key-hints,
.phone-shell .open-card .view-header .view-count { display: none; }

/* 16 px or more: smaller text makes Safari zoom in when you start typing. */
.phone-shell .new-card-box { margin: 0 1rem 0.5rem; font-size: 16px; min-height: 44px; box-sizing: border-box; }

.phone-shell .card-list {
  padding: 0.25rem 1rem 1rem;
  -webkit-overflow-scrolling: touch;
}

/* A card is something to tap: no text selection or iOS's own long-press
   bubble on it (the long press is the app's menu). */
.phone-shell .card-list .card {
  min-height: 44px;
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* No lasting "selected" card on a phone: the card you came back from is
   marked for a moment, so you see where you were, then it fades. */
.phone-shell .card.selected {
  animation: phone-was-here 1.6s ease-out forwards;
}

@keyframes phone-was-here {
  from { border-color: var(--focus); box-shadow: 0 0 0 1.5px var(--focus); }
  to   { border-color: var(--line-mid); box-shadow: none; }
}

/* ---- the open card ------------------------------------------------------- */

.phone-shell .open-card .view-header { display: none; } /* ‹ already says where you came from */

.phone-shell .card-sheet {
  margin: 0;
  width: 100%;
  border: none;
  border-radius: 0;
  padding: 0.5rem 1rem 1rem;
}

.phone-shell .card-kind { right: 1rem; top: 0.9rem; }
.phone-shell .card-title-field { font-size: 1.5rem; margin-right: 6rem; min-width: 0; background: transparent; color: var(--ink); }
.phone-shell .block-editor { font-size: 17px; } /* at least 16 px: no zooming in (see above) */

/* ---- menus and choosers: room for a finger ---------------------------------- */

body:has(.phone-shell) .app-menu li { min-height: 44px; align-items: center; }
/* A long menu (the open card's ⋯) scrolls instead of running off the screen;
   shared/menu.js measures it after this, so it is placed fully on screen. */
body:has(.phone-shell) .app-menu { max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; box-sizing: border-box; }
body:has(.phone-shell) .jump-input { font-size: 16px; }
body:has(.phone-shell) .app-menu .menu-key { display: none; } /* no keys on a phone */
