/* =================
   MAINTENANCE CURTAIN (#maintenance-screen)
   =================

   Styles the full-screen curtain in resources/html_templates/aqmap-maintenance.html, which is
   inlined into every built page whether maintenance is on or off.

   MUST stay in the blocking list in include_css_js() (R/aqmap/aqmap-functions.R): the
   `display: none` below is what keeps the curtain's markup hidden on normal map loads, so it
   cannot arrive late via the media="print" swap the other stylesheets use.
 */

#maintenance-screen {
  /* Light palette (default). applyTheme() overrides these for dark */
  --m-bg: #eaf6fd;
  --m-line: #5d9bd2;
  --m-title: #4d87c4;
  --m-text: #4f6b85;
  --m-chip-bg: rgba(86, 142, 201, 0.12);
  --m-chip-text: #4d87c4;
  --m-link: #1a6fb5;

  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Above every other layer in the app (next highest: help-tip.css at 20001)*/
  z-index: 30000;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--m-bg);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--m-text);
  cursor: default;
}

#maintenance-screen .m-contact a {
  cursor: pointer;
}

#maintenance-screen * {
  box-sizing: border-box;
}

#maintenance-screen .m-content {
  text-align: center;
  padding: 32px 20px;
  max-height: 100%;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

#maintenance-screen .m-cloud {
  width: 340px;
  max-width: 74vw;
  margin: 0 auto 20px;
  /* One slow horizontal drift on the whole drawing */
  animation: m-float 6s ease-in-out infinite;
  will-change: transform;
  backface-visibility: hidden;
}

#maintenance-screen .m-cloud svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

#maintenance-screen .m-line {
  fill: none;
  stroke: var(--m-line);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Floating smoke animation */
@keyframes m-float {
  0%, 100% { transform: translate3d(-30px, 0, 0); }
  50% { transform: translate3d(30px, 0, 0); }
}

#maintenance-screen .m-block + .m-block {
  margin-top: 16px;
}

#maintenance-screen h1 {
  margin: 0 0 8px;
  font-size: 1.75rem;
  line-height: 1.2;
  font-weight: 700;
  color: var(--m-title);
}

#maintenance-screen p {
  max-width: 650px;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--m-text);
}

#maintenance-screen .m-status {
  display: inline-flex;
  align-items: center;
  margin-top: 24px;
  padding: 9px 17px;
  border-radius: 999px;
  background: var(--m-chip-bg);
  color: var(--m-chip-text);
  font-size: 0.9rem;
  font-weight: 600;
}

#maintenance-screen #maintenance-eta {
  display: none;
  white-space: pre-line;
  margin-top: 20px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--m-title);
}

#maintenance-screen .m-contact {
  margin-top: 18px;
  font-size: 0.9rem;
}

#maintenance-screen .m-contact a {
  color: var(--m-link);
  text-decoration: underline;
}

@media (max-width: 480px) {
  #maintenance-screen h1 { font-size: 1.4rem; }
  #maintenance-screen p { font-size: 0.95rem; }

  #maintenance-screen .m-cloud {
    width: 240px;
    max-width: 62vw;
  }
}

/* Matches the reduced-motion block in css/loader.css. */
@media (prefers-reduced-motion: reduce) {
  /* No animation means no reason to hold a compositor layer. */
  #maintenance-screen .m-cloud {
    animation: none;
    will-change: auto;
    transform: none;
  }
}
