/*
 * Jansen&Heuning WebGL template
 * Brand colours come from the J&H logo. --jh-scene should match the 3D scene's background,
 * so the loading screen fades into the first frame without a flash. Change it per project.
 */

/* Fonts are the ones jh.nl already hosts (same site, so no extra download or third party).
   Off jh.nl, e.g. when testing locally, the fallback fonts are used. */
@font-face {
  font-family: "Source Sans Pro";
  src: url("/wp-content/themes/jh/build/fonts/SourceSansPro-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans Pro";
  src: url("/wp-content/themes/jh/build/fonts/SourceSansPro-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Gill Sans";
  src: url("/wp-content/themes/jh/build/fonts/GillSansStd-ExtraBold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --jh-green: #32ad76;
  --jh-green-dark: #07975e;
  --jh-yellow: #f6bd46;
  --jh-ink: #1a1919;
  --jh-muted: #5b6064;
  --jh-track: rgba(26, 25, 25, 0.12);

  /* Screw conveyor scene: grey at the top fading to white. */
  --jh-scene: linear-gradient(180deg, #cdcdcd 0%, #dfdfdf 50%, #ffffff 100%);

  /* Where the fullscreen button sits. Top right keeps it clear of the scene's bottom UI bar. */
  --jh-button-top: 12px;
  --jh-button-right: 12px;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
}

body {
  font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--jh-ink);
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

/* The game fills the whole frame (the iframe on the page, or the screen in fullscreen). */
#jh-stage {
  position: fixed;
  inset: 0;
  background: var(--jh-scene);
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
  outline: none;
  touch-action: none;
}

/* Loading screen */
#jh-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--jh-scene);
  transition: opacity 0.45s ease;
}

#jh-loader.is-done {
  opacity: 0;
  pointer-events: none;
}

#jh-loader-logo {
  width: clamp(150px, 24vw, 230px);
  height: auto;
}

#jh-progress {
  width: clamp(180px, 28vw, 280px);
  height: 6px;
  border-radius: 3px;
  background: var(--jh-track);
  overflow: hidden;
}

#jh-progress-fill {
  width: 0;
  height: 100%;
  border-radius: 3px;
  background: var(--jh-green);
  transition: width 0.2s ease;
}

#jh-loader-text {
  font-size: 15px;
  color: var(--jh-muted);
  font-variant-numeric: tabular-nums;
}

/* Fullscreen button */
#jh-fullscreen {
  position: absolute;
  top: var(--jh-button-top);
  right: var(--jh-button-right);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--jh-green);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: background-color 0.15s ease;
}

#jh-fullscreen:hover {
  background: var(--jh-green-dark);
}

#jh-fullscreen:focus-visible,
#jh-retry:focus-visible {
  outline: 3px solid var(--jh-yellow);
  outline-offset: 2px;
}

#jh-fullscreen svg {
  width: 20px;
  height: 20px;
}

.jh-icon-exit,
.is-fullscreen .jh-icon-enter {
  display: none;
}

.is-fullscreen .jh-icon-exit {
  display: block;
}

/* Phone tip ("use fullscreen, turn your phone") */
#jh-hint {
  position: absolute;
  top: 12px;
  right: 64px;
  max-width: calc(100% - 88px);
  padding: 9px 12px;
  border-radius: 4px;
  background: #ffffff;
  border-left: 4px solid var(--jh-green);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  font-size: 14px;
  line-height: 1.3;
  transition: opacity 0.3s ease;
}

#jh-hint.is-leaving {
  opacity: 0;
}

/* Error screen */
#jh-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--jh-scene);
}

.jh-error-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;
}

.jh-error-logo {
  width: 140px;
  height: auto;
}

#jh-error-title {
  margin: 18px 0 8px;
  font-family: "Gill Sans", "Helvetica Neue", sans-serif;
  font-size: 20px;
  font-weight: 700;
}

#jh-error-text {
  margin: 0 0 20px;
  color: var(--jh-muted);
  font-size: 15px;
  line-height: 1.45;
}

#jh-retry {
  padding: 10px 20px;
  border: 0;
  border-radius: 4px;
  background: var(--jh-green);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#jh-retry:hover {
  background: var(--jh-green-dark);
}

/* Only in builds with "Show Diagnostics Overlay" ticked. */
#jh-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) {
  #jh-loader,
  #jh-progress-fill,
  #jh-fullscreen,
  #jh-hint {
    transition: none;
  }
}
