/* The page around the app. A file rather than a <style> block in index.html: the security headers
   (public/_headers) only load stylesheets from this site. */

/* react-native-web's recommended reset: the root fills the screen and the page itself never scrolls.
   Every screen scrolls inside its own ScrollView, as it does on the phone. */
html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  /* No rubber-banding of the whole page, and no pull-to-refresh of it. */
  overscroll-behavior: none;
  /* The splash's violet, so the first paint matches it. Every screen paints its own background. */
  background-color: #2e147c;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  /* Text in the app isn't selectable, as on the phone, and a long press doesn't open Safari's
     callout over a button. Fields stay selectable. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

input,
textarea {
  -webkit-user-select: text;
  user-select: text;
}

#root {
  display: flex;
  height: 100%;
  flex: 1;
}

/* In a window wider than a phone the app is a website: it fills the window, with its links along
   the top and its pages in columns (src/lib/wide.ts). Modal screens are a card in the middle (below),
   and so are the violet code screens (transparent modals), with the page dimmed around them rather
   than their code and buttons stretched across the window. */
@media (min-width: 768px) {
  [data-vaul-drawer][class*='transparentDrawerContent'] {
    top: 50% !important;
    bottom: auto !important;
    left: 50% !important;
    right: auto !important;
    width: 440px !important;
    height: min(820px, 92dvh) !important;
    margin: calc(min(820px, 92dvh) / -2) 0 0 -220px;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 0 0 100vmax rgba(22, 18, 31, 0.45);
  }
}

/* A mouse gets a quiet scrollbar where a list shows one. */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(128, 128, 128, 0.45) transparent;
}

/* Modal screens (presentation: 'modal': the event form, edit profile, apply, the scanner) come from
   Expo's web modal stack, which draws them with vaul. On a phone they're a sheet that stops below
   the status bar, over the screen that opened them pushed back (#root is vaul's wrapper), as on an
   iPhone. The violet code screens are transparent modals: they stay full screen. */
@media (max-width: 767px) {
  /* vaul moves the screen behind down by the safe area plus 14px; the sheet starts 10px below that,
     so the edge of the screen behind shows above it. */
  [data-vaul-drawer]:not([class*='transparentDrawerContent']) {
    top: calc(env(safe-area-inset-top) + 24px) !important;
    height: auto !important;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    overflow: hidden;
  }
}

/* On a wider screen the same screens are a card in the middle: sized like a phone, so they read as
   the app's own screens rather than a desktop dialog. */
:root {
  --expo-router-modal-width: 440px;
  --expo-router-modal-max-width: min(440px, 92vw);
  --expo-router-modal-height: min(880px, 92dvh);
  --expo-router-modal-border-radius: 28px;
  --expo-router-modal-overlay-background: rgba(22, 18, 31, 0.45);
}

/* Matches StampLoader: the 124px stamp in the middle of the violet. */
.splash {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 124px;
  height: 124px;
  margin: -62px 0 0 -62px;
}
