:not(:defined) > * {
  display: none;
}

:root {
  --color1: #505050; /* 3d viewer  */
  --color2: #282828; /* control panlel */
  --color3: #ff8200; /* accent colour */
  --color4: #e4e4e4; /* main text colour */
  --color5: #f7f7f7; /* annotation info text colour */
}

html,
body,
#app-container {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  overflow: hidden;
  font-family: "Roboto Regular", "Helvetica Neue", sans-serif;
  -webkit-overflow-scrolling: touch;
}

#app-container {
  height: calc(var(--vh, 1vh) * 100);
  display: flex;
  flex-direction: column;
  background: var(--color2);
}

#viewer-container {
  display: flex;
  width: 100%;
  height: 100%;
  background: var(--color2);
  box-sizing: border-box;
  overflow: hidden;
}

model-viewer {
  flex: 1;
  display: block;
  width: 100%;
  height: auto;
  background: var(--color1);
  border-right: 1px solid #666;
  border-radius: 1px;
  box-shadow: 2px 2px 6px #101010;
  z-index: 3;
}

#controls-panel {
  width: 300px;
  padding: 16px;
  background: var(--color2);
  flex-shrink: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  transition: width 0.3s ease, padding 0.3s ease;
}

#controls-panel::-webkit-scrollbar {
  display: none;
}

#controls-panel.collapsed {
  width: 0;
  padding: 0;
  overflow: hidden;
}

#close-button {
  position: absolute;
  top: 18px;
  right: 346px;
  width: 30px;
  height: 30px;
  background: #959595;
  border: none;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
}

#close-button:hover {
  background: var(--color3);
}

#close-button svg .st0 {
  fill: none;
  stroke: #cfcfcf;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.27px;
  transition: stroke 0.3s ease;
}

#arrow-icon {
  width: 24px;
  height: 24px;
  transition: transform 0.3s ease;
}

#controls-panel.collapsed + #close-button {
  right: 15px;
}

#emissionSlider {
  appearance: none;
  width: 100%;
  height: 10px;
  margin: 20px 0;
  background: #333;
  border-radius: 3px;
  outline: none;
}

#emissionSlider::-webkit-slider-thumb,
#emissionSlider::-moz-range-thumb {
  appearance: none;
  width: 22px;
  height: 22px;
  background: #3e3e3e;
  border: 3px solid var(--color3);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.6);
}

#emissionSlider::-moz-range-track {
  height: 6px;
  background: #333;
  border-radius: 3px;
}

/*  ----- Mobile-----  */

@media screen and (max-width: 860px) {
  #viewer-container {
    flex-direction: column;
    min-height: 100%;
    height: auto;
  }

  model-viewer {
    border-bottom: 1px solid #666;
  }

  #controls-panel {
    width: 100%;
    height: 250px;
    padding: 10px;
    transition: height 0.3s ease, padding 0.3s ease;
  }

  #controls-panel.collapsed {
    height: 0;
  }

  #close-button {
    bottom: 290px;
    left: 30px;
    top: auto;
    transform: translateX(-50%);
  }

  #controls-panel.collapsed ~ #close-button {
    bottom: 20px;
  }

  #controls-panel.collapsed ~ #close-button #arrow-icon {
    transform: rotate(90deg);
  }

  #arrow-icon {
    transform: rotate(90deg);
  }

  .panel {
    padding-right: 180px;
  }

  #logo_brand {
    width: 90px !important;
  }
}

h2 {
  font-size: 15px;
  margin-top: 15px;
  font-weight: 800;
  color: var(--color4);
}

h3 {
  font-size: 12px;
  margin: 15px 10px 15px 5px;
  color: var(--color4);
}

#colour-section {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: #333;
  cursor: pointer;
  z-index: 2;
}

.swatch {
  width: 50px;
  height: 50px;
  margin: 3px;
  border: 2px solid #3a3a3a;
  border-radius: 10px;
  cursor: pointer;
  transition: border 0.5s ease;
}

.swatch:hover {
  border-color: #fff;
}

.swatch.active {
  border-color: var(--color3) !important;
  box-sizing: border-box;
}

.divider {
  width: 100%;
  height: 1px;
  margin: 24px 0px 10px;
  background: #737373;
  opacity: 0.6;
  border: 0;
}

/*  ----- Hotspots -----  */

.Hotspot {
  background: #ffffff;
  height: 16px;
  width: 16px;
  border: 2px solid var(--color3);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
  cursor: pointer;
  position: relative;
  transition: opacity 0.3s;
  z-index: 5;
}

.Hotspot:not([data-visible]) {
  background: transparent;
  border: 2px solid #c6c6c6;
  box-shadow: none;
  pointer-events: none;
}

.Hotspot:focus {
  border: 2px solid var(--color5) !important;
  background: var(--color3);
  outline: none;
  aspect-ratio: 1 / 1 !important;
}

.Hotspot > * {
  opacity: 1;
  transform: translateY(-50%);
}

.HotspotAnnotation {
  position: absolute;
  background: #464646;
  border: 1px solid var(--color5);
  border-radius: 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  color: rgba(0, 0, 0, 1);
  display: block;
  font-size: 15px;
  font-weight: 600;
  max-width: 280px;
  overflow-wrap: break-word;
  padding: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  top: -1em; /* Push it above */
  left: 50%;
  transform: translate(-50%, -100%); /* Centre horizontally, move fully above */
  width: max-content;
  z-index: 20;
}

.Hotspot:not([data-visible]) > * {
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(-50% + 4px));
  transition: transform 0.3s, opacity 0.3s;
}

.Hotspot[data-active] .HotspotAnnotation {
  opacity: 1;
  pointer-events: auto;
}

.hotspot-info {
  color: var(--color5);
  padding: 20px 10px 10px 10px;
  text-align: left;
  line-height: 1.8;
  font-size: 13px !important;
  font-weight: 400;
}

@media screen and (max-width: 860px) {
  .Hotspot {
    background: #ffffff !important;
    font-size: 0 !important;
    width: 15px !important;
    height: 15px !important;
    aspect-ratio: 1 / 1 !important;
    background: var(--color3);
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    z-index: 10;
    box-sizing: border-box;
  }

  .HotspotAnnotation {
    display: block;
    font-size: 15px;
    font-weight: 600;
    padding: 10px;
    top: -1em;
    width: max-content;
  }

  .Hotspot:focus {
    border: 3px solid #222222;
    background: var(--color3) !important;
    outline: none;
  }

  .hotspot-info {
    padding-top: 11px;
    text-align: left;
    line-height: 1.5;
    font-size: 13px !important;
    font-weight: 400;
  }
}

/* Pulsating ring */
.pulse-circle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  background: #fefefe;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(1);
  animation: pulse 1.5s ease-out infinite;
  opacity: 0.5;
  z-index: -1;
}

.pulse-circle {
  background: var(--color3);
  border-radius: 50%;
  position: relative;
  z-index: 0;
}

/* When active, stop pulsing and keep solid */
.Hotspot[data-active] .pulse-circle::before {
  display: none;
}

@keyframes pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.5;
  }
  70% {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
  }
}

.radio-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  border-radius: 5px;
  padding: 5px;
  font-size: 12px;
  cursor: pointer;
  color: var(--color4);
}

.radio-dot {
  width: 14px;
  height: 14px;
  border: 2px solid var(--color3);
  border-radius: 50%;
  position: relative;
}

.radio-toggle.active .radio-dot::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--color3);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/*  ----- Loader -----  */

#loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.5s ease;
}

#loader.fade-out {
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease-in-out;
}

.loader-wrapper {
  width: 250px;
  text-align: center;
}

#loading-text {
  font-size: 12px;
  margin-top: 30px;
  color: var(--color4);
}

.progress-container {
  width: 100%;
  height: 2px;
  background: #2e2e2e;
  border-radius: 1px;
  overflow: hidden;
}

#progress-bar {
  height: 100%;
  width: 0;
  background: var(--color3);
  transition: width 0.5s ease;
}

#logo_brand {
  position: absolute;
  padding: 10px;
  z-index: 1;
}

#logo {
  position: relative;
  width: 180px;
  max-width: 15vw;
  left: 50%;
  padding: 10px;
  transform: translateX(-50%);
}

#logo_brand {
  right: 10px;
  bottom: 10px;
  width: 120px;
}

input:checked + .slider {
  background: rgba(var(--color3), 1);
}

/*  ----- AR -----  */

#ar-button:active {
  background: #aeaeae;
}

#ar-button:focus {
  outline: none;
}

@keyframes circle {
  from {
    transform: translateX(-50%) rotate(0deg) translateX(50px) rotate(0deg);
  }
  to {
    transform: translateX(-50%) rotate(360deg) translateX(50px) rotate(-360deg);
  }
}

@keyframes elongate {
  from {
    transform: translateX(100px);
  }
  to {
    transform: translateX(-100px);
  }
}

model-viewer > #ar-prompt {
  position: absolute;
  left: 50%;
  bottom: 60px;
  display: none;
  animation: elongate 2s infinite ease-in-out alternate;
}

model-viewer[ar-status="session-started"] > #ar-prompt {
  display: block;
}

model-viewer > #ar-prompt > img {
  animation: circle 4s linear infinite;
}
