/* =========================================================
   GEOSPATIALREPORTS MOBILE VIEW

   Portrait:
   Ask the user to rotate the phone.

   Landscape:
   Desktop-style side-by-side layout.

   Desktop:
   Completely unaffected.
========================================================= */


/* =========================================================
   MOBILE HEADER
========================================================= */

@media (max-width: 900px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  site-header .topbar {
    width: 100% !important;
    height: 64px !important;
    padding: 0 10px !important;
    gap: 6px !important;
  }

  site-header .leftSide {
    min-width: 0 !important;
    flex-shrink: 1 !important;
    gap: 6px !important;
  }

  site-header .logo {
    width: 34px !important;
    height: 34px !important;
    flex: 0 0 34px !important;
    object-fit: contain !important;
  }

  site-header .brand {
    font-size: 16px !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
  }

  site-header .nav {
    flex: 0 0 auto !important;
    gap: 2px !important;
  }

  site-header .nav a,
  site-header .settingsBtn {
    min-width: 0 !important;
    height: 36px !important;
    padding: 0 7px !important;
    font-size: 12px !important;
    border-radius: 7px !important;
  }

  site-header .settingsBtn {
    width: 34px !important;
    padding: 0 !important;
  }

  site-header .settingsBtn span {
    display: none !important;
  }

  site-header .settingsIcon {
    width: 17px !important;
    height: 17px !important;
  }
}


/* =========================================================
   PORTRAIT PHONE
========================================================= */

@media (max-width: 760px) and (orientation: portrait) {
  body {
    min-height: 100svh !important;
    background: #f3f1eb !important;
    overflow: hidden !important;
  }

  body:not(.mapExpanded) .split {
    display: none !important;
  }

  body:not(.mapExpanded)::after {
    content: "Rotate your phone to view the interactive map and report.";
    position: fixed;
    top: 64px;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 9000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 36px;
    background: #f3f1eb;
    color: #1f2a33;

    font-family: "Inter", sans-serif;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
  }

  body:not(.mapExpanded) #gr-camera-dpad,
  body:not(.mapExpanded) .gr-camera-zoom {
    display: none !important;
  }
}


/* =========================================================
   LANDSCAPE PHONE
   Desktop-style side-by-side layout.
========================================================= */

@media (max-width: 900px) and (orientation: landscape) {
  body {
    height: 100svh !important;
    overflow: hidden !important;
  }

  .split {
    display: flex !important;
    flex-direction: row !important;

    width: 100% !important;
    height: calc(100svh - 64px) !important;
  }

  body:not(.mapExpanded) .left {
    position: relative !important;

    width: 50% !important;
    height: 100% !important;
    min-height: 0 !important;

    padding: 12px !important;
    flex: 0 0 50% !important;
  }

  body:not(.mapExpanded) .right {
    display: flex !important;

    width: 50% !important;
    height: 100% !important;
    min-height: 0 !important;

    flex: 0 0 50% !important;

    padding: 28px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  body:not(.mapExpanded) .globe {
    width: 100% !important;
    height: 100% !important;
  }

  .right h1,
  #rightPanel h1 {
    font-size: clamp(25px, 4vw, 38px) !important;
    line-height: 1.08 !important;
    overflow-wrap: break-word !important;
  }

  .right h2,
  #rightPanel h2 {
    font-size: 25px !important;
    line-height: 1.12 !important;
  }

  .right p,
  #rightPanel p {
    font-size: 15px !important;
    line-height: 1.5 !important;
  }

  .buttonRow {
    margin-top: 18px !important;
    gap: 10px !important;
  }

  .button {
    padding: 11px 17px !important;
    font-size: 13px !important;
  }

  /* ---------------- MAP TOOLBAR ---------------- */

  body:not(.mapExpanded) .toolBelt {
    top: 18px !important;
    left: 18px !important;
    right: 18px !important;

    width: auto !important;
    max-width: calc(100% - 36px) !important;

    flex-wrap: nowrap !important;
    overflow-x: auto !important;
  }

  body:not(.mapExpanded) .toolBelt.viewerMode {
    top: 18px !important;
    left: auto !important;
    right: 18px !important;

    width: auto !important;
    max-width: calc(100% - 36px) !important;
  }

  /* ---------------- LEGEND ---------------- */

  body:not(.mapExpanded) .mapCartouche {
    right: 18px !important;
    bottom: 18px !important;

    width: 180px !important;
    max-height: 190px !important;
  }

  body:not(.mapExpanded) .cartoucheBody {
    max-height: 135px !important;
  }

  body:not(.mapExpanded) .mapMinimalUI {
    left: 28px !important;
    bottom: 20px !important;
  }

  body:not(.mapExpanded) .stpPopup {
    left: 18px !important;
    bottom: 18px !important;

    width: min(300px, calc(100% - 36px)) !important;
    max-height: calc(100% - 130px) !important;
  }

  /* ---------------- D-PAD ---------------- */

  body:not(.mapExpanded) #gr-camera-dpad {
    position: fixed !important;

    top: auto !important;
    right: auto !important;
    bottom: 3px !important;
    left: 25% !important;

    transform: translateX(-50%) scale(0.58) !important;
    transform-origin: center !important;
  }

  body:not(.mapExpanded) .gr-camera-zoom-out {
    position: fixed !important;

    top: auto !important;
    right: auto !important;
    bottom: 40px !important;
    left: calc(25% - 66px) !important;

    transform: translateX(-50%) scale(0.58) !important;
  }

  body:not(.mapExpanded) .gr-camera-zoom-in {
    position: fixed !important;

    top: auto !important;
    right: auto !important;
    bottom: 40px !important;
    left: calc(25% + 66px) !important;

    transform: translateX(-50%) scale(0.58) !important;
  }
}


/* =========================================================
   EXPANDED MAP
   Works in portrait and landscape.
========================================================= */

@media (max-width: 900px) {
  body.mapExpanded {
    width: 100vw !important;
    height: 100svh !important;
    overflow: hidden !important;
  }

  body.mapExpanded::after {
    display: none !important;
    content: none !important;
  }

  body.mapExpanded .split {
    display: block !important;
    width: 100vw !important;
    height: 100svh !important;
  }

  body.mapExpanded .left {
    position: fixed !important;
    inset: 0 !important;

    display: block !important;

    width: 100vw !important;
    height: 100svh !important;
    min-height: 0 !important;

    padding: 0 !important;
    z-index: 9999 !important;
  }

  body.mapExpanded .globe {
    width: 100% !important;
    height: 100% !important;

    border: 0 !important;
    border-radius: 0 !important;
  }

  body.mapExpanded #rightPanel {
    display: none !important;
  }

  body.mapExpanded .toolBelt {
    top: 12px !important;
    left: 12px !important;
    right: 12px !important;

    width: auto !important;
    max-width: calc(100% - 24px) !important;

    transform: none !important;
    overflow-x: auto !important;
  }

  body.mapExpanded .toolBelt.viewerMode {
    left: auto !important;
    right: 12px !important;
    width: auto !important;
  }

  body.mapExpanded .mapCartouche {
    right: 14px !important;
    bottom: 14px !important;
  }

  body.mapExpanded .mapMinimalUI {
    left: 22px !important;
    bottom: 18px !important;
  }

  body.mapExpanded #gr-camera-dpad {
    position: fixed !important;

    display: grid !important;

    top: auto !important;
    right: auto !important;
    bottom: 5px !important;
    left: 50% !important;

    transform: translateX(-50%) scale(0.68) !important;
    transform-origin: center !important;
  }

  body.mapExpanded .gr-camera-zoom {
    display: flex !important;
  }

  body.mapExpanded .gr-camera-zoom-out {
    position: fixed !important;

    top: auto !important;
    right: auto !important;
    bottom: 43px !important;
    left: calc(50% - 74px) !important;

    transform: translateX(-50%) scale(0.68) !important;
  }

  body.mapExpanded .gr-camera-zoom-in {
    position: fixed !important;

    top: auto !important;
    right: auto !important;
    bottom: 43px !important;
    left: calc(50% + 74px) !important;

    transform: translateX(-50%) scale(0.68) !important;
  }
}

@media (max-width: 900px) {
  #gr-camera-dpad,
  .gr-camera-zoom {
    display: none !important;
  }
}