/* React.church on a folding phone: one layout for the closed (cover) screen and
   one for the opened (inner) screen, switched by width alone so folding or
   unfolding mid-answer re-lays the same form out without touching it. Loaded
   after the inline <style> in index.html, so these rules win at equal weight. */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { min-height: 100vh; min-height: 100dvh; overscroll-behavior-y: none; }
button, select, summary { touch-action: manipulation; }

.app {
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
}
.welcome { min-height: 80vh; min-height: 80dvh; }
.loading-screen, .error-screen { min-height: 70vh; min-height: 70dvh; }

.app > .welcome,
.app > .loading-screen,
.app > .error-screen,
.app > .empty-screen,
.app > .done-screen {
  width: 100%;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.submit-btn {
  position: sticky;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  min-height: 52px;
  box-shadow: 0 -10px 18px -6px var(--bg), 0 4px 14px rgba(173, 26, 64, 0.22);
  z-index: 5;
}

@media (pointer: coarse) {
  .svc-picker select { min-height: 44px; }
  .stoplight { gap: 10px; }
}

/* Closed: the narrow cover screen. Thumb-sized dots, a note button that stays
   at the far edge, and room above the home indicator. */
@media (max-width: 699px) {
  .dot, .comment-toggle { width: 48px; height: 48px; }
  .header h2 { font-size: 21px; }
  .prompt-row { padding: 14px; }
}

@media (max-height: 480px) and (orientation: landscape) {
  .app { padding-top: calc(6px + env(safe-area-inset-top, 0px)); }
  .header { margin-bottom: 8px; padding: 4px 0; }
  .welcome, .loading-screen, .error-screen, .empty-screen, .done-screen { min-height: 0; padding-top: 12px; padding-bottom: 12px; }
}

/* Opened: the near-square inner screen. Header, weekend picker, headcount and
   service flow run across the top; the questions sit two across beneath them,
   so the form is read like a page instead of scrolled like a strip. */
@media (min-width: 700px) {
  .app {
    max-width: 1040px;
    padding-left: max(28px, env(safe-area-inset-left, 0px));
    padding-right: max(28px, env(safe-area-inset-right, 0px));
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 14px;
    row-gap: 10px;
    align-content: start;
  }
  .app > * { grid-column: 1 / -1; min-width: 0; }
  .app > .prompt-row {
    grid-column: auto;
    margin-bottom: 0;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
  }
  .app > .prompt-row .stoplight { margin-top: auto; }
  .app > .welcome,
  .app > .loading-screen,
  .app > .error-screen,
  .app > .empty-screen,
  .app > .done-screen {
    grid-column: 1 / -1;
    justify-self: center;
  }
  .header h2 { font-size: 26px; }
  .header .me { font-size: 14px; }
  .prompt-text { font-size: 17px; }
  .observation-card { margin-top: 6px; }
  .submit-btn { margin-top: 10px; justify-self: center; max-width: 420px; }

  .flow-panel {
    position: static;
    width: auto;
    max-height: none;
    overflow: visible;
    left: auto;
    top: auto;
    margin-bottom: 0;
  }
  .flow-toggle { cursor: default; pointer-events: none; }
  .flow-chevron { display: none; }
  .flow-body[hidden] { display: block; }
  .flow-list { display: block; columns: 2; column-gap: 28px; }
  .flow-list li { break-inside: avoid; margin-bottom: 5px; }
  .flow-list li.flow-header { margin-top: 10px; }
}

@media (min-width: 700px) and (max-height: 480px) and (orientation: landscape) {
  .app { row-gap: 8px; }
}

.wn-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
  padding-bottom: 8px;
  font-size: 13px;
  color: var(--text-2);
}
.wn-footer button {
  background: none;
  border: none;
  padding: 12px 8px;
  font: inherit;
  color: var(--teal-dark);
  text-decoration: underline;
  cursor: pointer;
}
.wn-footer label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.wn-footer input { width: 20px; height: 20px; }

