/* Phones and other touch screens. Loaded after style.css and polls.css, and changes
   only sizes and spacing, never the design: thumb-sized tap targets (44px), form fields
   that do not make iPhones zoom in, and fixes for the narrowest and shortest screens. */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
#main { min-height: calc(100dvh - 176px); }
.date-block span { font-size: max(.68rem, 12px); }
.toast { bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }

@media (pointer: coarse), (max-width: 720px) {
  /* iOS zooms into any field with text smaller than 16px. */
  input:not([type="radio"]):not([type="checkbox"]),
  select,
  textarea,
  .select-wrap select,
  select.member-category,
  .poll-filter select { font-size: max(16px, 1em); }

  .account, .button, .mini, .pill, .tab,
  .select-wrap select, .member-category, .poll-filter select {
    min-height: 44px;
  }
  .pill { min-width: 44px; }
  button.text-btn,
  a.text-btn:not(p .text-btn) {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-block: 0;
  }
  .brand { min-height: 44px; }
  .primary a { min-height: 44px; }
  .dismiss { width: 44px; height: 44px; top: 12px; right: 12px; }
  .modal-inner h2 { margin-right: 44px; }

  .poll-composer > summary,
  .poll-close > summary,
  .poll-host-controls > a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
  .poll-choice > label.poll-choice-line { min-height: 44px; }
  .poll-choice-line input { width: 1.25rem; height: 1.25rem; }

  .footer { padding-block: 10px 18px; }
  .footer a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}

@media (max-width: 580px) {
  /* The menu grid: links keep their own width (so the underline stays under the word)
     but are never narrower or shorter than a thumb. */
  .top:has(.primary) .primary a { min-width: 44px; padding: 0; }
  .primary a.active::after { bottom: 6px; }

  /* "Event board" stays on one line; the period picker moves below when there is no room. */
  .board > .section-heading { flex-wrap: wrap; row-gap: 4px; }
  .board > .section-heading h2 { white-space: nowrap; }
}

@media (max-width: 380px) {
  /* Leave room for the house name beside a long member name. */
  .bar { column-gap: 10px; }
  .account { max-width: min(180px, 44vw); padding-inline: 10px; }
  .brand { gap: 8px; }
  .brand img { width: 28px; height: 28px; }
  .brand span { font-size: .9rem; }
  .primary a { font-size: .82rem; }
}

@media (max-height: 520px) and (orientation: landscape) {
  /* Phones on their side: keep the event details visible under the picture. */
  .modal-inner .poster { aspect-ratio: auto; height: 96px; }
  dialog { max-height: calc(100dvh - 24px); }
}

@media (pointer: coarse), (max-width: 720px) {
  .theme-switch select { min-height: 44px; font-size: max(16px, 1em); }
}

@media (max-width: 580px) {
  /* Leaderboard: rank and check-in columns stay narrow and never split a word;
     the name column takes the rest. */
  .scoreboard :is(th, td) { padding-inline: 10px; }
  .scoreboard :is(th, td):is(:first-child, :last-child) {
    width: 1%;
    white-space: nowrap;
    overflow-wrap: normal;
  }
}
