/* ==========================================================================
   V2.6.0 — installed application: install/update bar, bottom navigation,
   and the touch sizes an older pair of hands needs.

   Everything here is additive. No existing selector is redefined, so a phone
   that never installs ROOTS keeps exactly the appearance it had in 2.5.0.
   ========================================================================== */

/* ---- install / update bar ------------------------------------------------ */
.ubar {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  width: min(46rem, calc(100vw - 1.5rem));
  padding: .8rem 1rem;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
  font-size: .95rem;
}
.ubar-msg { flex: 1 1 16rem; }
.ubar .btn { min-height: 44px; padding: .5rem 1rem; }
.ubar-later { background: none; border: 0; padding: .5rem .25rem; min-height: 44px; }

/* On a phone the bar sits above the bottom navigation, never over it. */
@media (max-width: 720px) {
  .ubar { bottom: calc(4.9rem + env(safe-area-inset-bottom)); }
}

/* ---- bottom navigation --------------------------------------------------- */
.bottomnav { display: none; }

@media (max-width: 720px) {
  .bottomnav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    inset: auto 0 0 0;
    z-index: 30;
    background: var(--card);
    border-top: 1px solid var(--line);
    padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
    gap: .1rem;
  }
  .bottomnav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .15rem;
    min-height: 52px;
    padding: .35rem .2rem;
    border-radius: 8px;
    font-size: .7rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-soft);
    text-decoration: none;
  }
  .bottomnav a[aria-current="page"] {
    color: var(--accent);
    background: var(--paper);
    font-weight: 700;
  }
  .bottomnav .glyph { font-size: 1.05rem; line-height: 1; letter-spacing: 0; }
  /* the raised centre action: adding a relative must never need the family home */
  .bottomnav a.add {
    background: var(--accent);
    color: var(--accent-ink);
    border-radius: 12px;
    min-height: 52px;
  }
  .bottomnav a.add .glyph { font-size: 1.3rem; }

  body.has-bottomnav main { padding-bottom: 5.6rem; }
  body.has-bottomnav .foot { padding-bottom: 5.4rem; }
}

/* ---- touch and readability ----------------------------------------------- */
@media (max-width: 720px) {
  .btn, button, input[type="submit"] { min-height: 44px; }
  input[type="text"], input[type="email"], input[type="password"], input[type="date"],
  input[type="number"], select, textarea {
    min-height: 44px;
    font-size: 1rem;          /* 16 px minimum: below that, iOS zooms the page on focus */
  }
  label { display: block; margin-block: .35rem; }
  .row { flex-wrap: wrap; }
  .row > * { flex: 1 1 100%; }
  h1 { font-size: 1.6rem; line-height: 1.25; }
  /* the tree needs the width more than the padding does */
  .tree, .tree-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (prefers-reduced-motion: reduce) {
  .ubar { transition: none; }
}

/* ---- offline page -------------------------------------------------------- */
.offline { max-width: 44rem; }
.offline .btn { display: inline-block; text-decoration: none; }
.small { font-size: .9rem; }
