/*
 * Meijer Holland WebGL template
 * Colours come from meijerholland.nl (amber top bar / buttons, grey footer, dark text)
 * and the MH logo. --mh-scene is the loading background; the game fades in over it.
 */

/* Gill Sans is hosted by the meijerholland theme (same site, no extra third party).
   Source Sans Pro is only loaded from Google on the site itself, so here we use it if the
   visitor has it installed and otherwise fall back to Helvetica/Arial. */
@font-face {
  font-family: "Gill Sans";
  src: url("/wp-content/themes/meijerholland/build/fonts/GillSansStd-ExtraBold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Gill Sans";
  src: url("/wp-content/themes/meijerholland/build/fonts/GillSansStd-Bold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --mh-amber: #f1b432;
  --mh-amber-dark: #e19e0f;
  --mh-orange: #f29100;
  --mh-red: #b61a19;
  --mh-ink: #1d1d1b;
  --mh-text: #414141;
  --mh-muted: #7b7b7b;
  --mh-track: rgba(29, 29, 27, 0.12);

  /* Loading background: the site's light footer grey. */
  --mh-scene: #f2f2f2;

  /* Height of the bar under the game that holds the fullscreen button. */
  --mh-bar-height: 44px;

  /* The game's UI is laid out for 1920x1080 and scales with the screen width, so on screens
     wider than this its elements run into each other. Wider frames get side bars instead.
     Taller shapes (16:10, 4:3, phones) are fine and fill the frame. */
  --mh-max-aspect: 16 / 9;
  --mh-side-bars: #1d1d1b;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
}

body {
  font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--mh-text);
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

/* The frame (the iframe on the page, or the screen in fullscreen) is the game view plus a
   bar underneath. Nothing of ours floats over the game, so its own UI stays free. */
#mh-stage {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--mh-scene);
}

#mh-view {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  container-type: size; /* lets the canvas size itself against the view (cqw/cqh below) */
  background: var(--mh-side-bars);
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  background: transparent;
  outline: none;
  touch-action: none;
}

/* Never wider than --mh-max-aspect: on wider frames the canvas is centred with side bars. */
@supports (width: 1cqh) {
  #unity-canvas {
    width: min(100cqw, 100cqh * var(--mh-max-aspect));
  }
}

/* Amber stripe along the top, like the site's top bar. */
#mh-loader::before,
#mh-error::before,
#mh-gate::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--mh-amber);
}

/* Loading screen */
#mh-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 16px;
  background: var(--mh-scene);
  transition: opacity 0.45s ease;
}

#mh-loader.is-done {
  opacity: 0;
  pointer-events: none;
}

#mh-loader-logo {
  width: clamp(180px, 28vw, 280px);
  height: auto;
}

#mh-progress {
  position: relative;
  width: clamp(200px, 30vw, 300px);
  height: 6px;
  border-radius: 3px;
  background: var(--mh-track);
  overflow: hidden;
}

#mh-progress-fill {
  width: 0;
  height: 100%;
  border-radius: 3px;
  background: var(--mh-amber);
  transition: width 0.2s ease;
}

/* When the server gives no file size, Unity can't report real progress: show a moving bar instead. */
#mh-progress.is-unknown #mh-progress-fill {
  position: absolute;
  width: 35%;
  transition: none;
  animation: mh-slide 1.4s ease-in-out infinite;
}

@keyframes mh-slide {
  0% { left: -35%; }
  100% { left: 100%; }
}

#mh-loader-text {
  font-size: 16px;
  color: var(--mh-text);
  font-variant-numeric: tabular-nums;
}

#mh-loader-note {
  max-width: 340px;
  margin-top: -8px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--mh-muted);
  text-align: center;
  transition: opacity 0.4s ease;
}

/* Bar under the game */
#mh-bar {
  flex: 0 0 var(--mh-bar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 6px 0 14px;
  background: #ffffff;
  border-top: 3px solid var(--mh-amber);
}

#mh-bar-hint {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14px;
  color: var(--mh-muted);
}

#mh-fullscreen {
  flex: none;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 14px 0 11px;
  font-size: 15px;
  white-space: nowrap;
}

#mh-fullscreen:disabled {
  opacity: 0.45;
  cursor: default;
}

#mh-fullscreen svg {
  width: 17px;
  height: 17px;
}

.mh-icon-exit,
.is-fullscreen .mh-icon-enter {
  display: none;
}

.is-fullscreen .mh-icon-exit {
  display: block;
}

#mh-fullscreen:focus-visible,
.mh-button:focus-visible {
  outline: 3px solid var(--mh-ink);
  outline-offset: 2px;
}

/* Cards: phone gate and error screen */
#mh-gate,
#mh-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--mh-scene);
}

.mh-card {
  max-width: 420px;
  padding: 28px 28px 24px;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
  text-align: center;
}

.mh-card-logo {
  width: 170px;
  height: auto;
}

.mh-card h1 {
  margin: 18px 0 8px;
  font-family: "Gill Sans", "Helvetica Neue", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--mh-text);
}

.mh-card p {
  margin: 0 0 20px;
  color: var(--mh-muted);
  font-size: 15px;
  line-height: 1.45;
}

.mh-button {
  padding: 10px 20px;
  border: 0;
  border-radius: 6px;
  background: var(--mh-amber);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.mh-button:hover:not(:disabled) {
  background: var(--mh-amber-dark);
}

/* Only in builds with "Show Diagnostics Overlay" ticked. */
#mh-diagnostics {
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent url("webmemd-icon.png") no-repeat center / contain;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  #mh-loader,
  #mh-progress-fill,
  #mh-fullscreen,
  #mh-loader-note {
    transition: none;
  }
  #mh-progress.is-unknown #mh-progress-fill {
    animation-duration: 3s;
  }
}
