/* frappe — the touch layer, loaded after every other stylesheet: what changes on a phone or any touch screen,
   whatever the module. Tap targets of at least 44 px (Apple HIG, WCAG 2.5.5), no hover look left behind by a tap,
   no zoom into a field on focus (iOS zooms into inputs under 16 px), no grey tap flash or double-tap delay.
   The bottom tab bar itself is in style.css; the screen insets (notch, home indicator) in style.css and here. */

button,
a,
input,
select,
textarea,
label,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

@media (pointer: coarse) {
  .g-btn {
    min-height: 2.75rem;
  }
  .g-btn.small {
    min-height: 2.5rem;
    padding: 0.45rem 0.8rem;
    font-size: 0.85rem;
  }
  .g-tab {
    min-height: 2.75rem;
    padding: 0.5rem 0.9rem;
  }
  .mt-opt,
  .g-chip,
  #xp-chip,
  select {
    min-height: 2.75rem;
  }
  .bt-acc button,
  .wt-say {
    min-width: 2.75rem;
    min-height: 2.75rem;
  }
  /* the writing arena's accent keys: a little under 44 px, so the row stays short above the phone's keyboard (whose
     own long-press gives the accents too) */
  .bs-acc button {
    min-width: 2.6rem;
    height: 2.6rem;
  }
  .footer-links a {
    display: inline-block;
    padding: 0.55rem 0.35rem;
  }
}

/* a tap leaves no hover look behind (secondary buttons invert on hover: on a phone they stayed inverted) */
@media (hover: none) {
  .g-btn:not(.primary):not(.ghost):hover {
    background: var(--g-btn-bg, var(--sub-alt));
    color: var(--text);
  }
  .g-btn.ghost:hover {
    background: transparent;
    color: var(--g-gloss);
  }
  .g-card.click:hover {
    transform: none;
    box-shadow: none;
  }
  .bs-acc button:hover {
    background: var(--sub-alt);
    color: var(--text);
  }
}

@media (max-width: 700px) {
  input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: max(16px, 1em);
  }
  /* the footer's links are all in the tab bar's « plus » sheet now */
  #footer {
    display: none;
  }
  /* a battle takes the whole screen: no tab bar under its answer buttons */
  body[data-screen="battle"] #nav {
    display: none;
  }
  /* dialogs fit the visible screen (browser toolbars, keyboard) */
  .g-dialog {
    max-height: calc(100dvh - 2rem);
  }
}

/* the command palette opens above the tab bar */
#modal {
  z-index: 120;
}

/* « installer l'app » on an iPhone / iPad (js/core/pwa.js): the two taps to do */
.pwa-steps {
  margin: 0.8rem 0 1.1rem;
  padding-left: 1.3rem;
  line-height: 1.6;
}
