/* ==========================================================================
   Ipswich Combat Academy - 360 virtual tour skin
   Brand-matched replacement for the stock Marzipano interface.
   ========================================================================== */

:root {
  --brand-red: #d62828;
  --ink: #111418;
  --paper: #ffffff;
  --glass: rgba(17, 20, 24, 0.62);
  --glass-hover: rgba(17, 20, 24, 0.82);
  --hairline: rgba(255, 255, 255, 0.16);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.42);
  --radius: 14px;
  --bar-pad: clamp(0.75rem, 2vw, 1.25rem);
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Outfit", var(--font-body);
}

/* The tour is a full-bleed canvas that never scrolls, so no scrollbar gutter is
   reserved - one would show as a dead band down the right-hand edge. */
html {
  overflow: hidden;
  height: 100%;
}

body {
  overflow: hidden;
  width: 100%;
  height: 100%;
  margin: 0;
  background: #0b0d10;
  color: var(--paper);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

#pano {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

#pano:active {
  cursor: grabbing;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------- loader -- */

#loader {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: radial-gradient(circle at 50% 45%, #1b2027 0%, #0b0d10 70%);
  transition: opacity 0.55s ease, visibility 0.55s ease;
}

#loader.is-done {
  opacity: 0;
  visibility: hidden;
}

.loader__mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
}

.loader__ring {
  position: absolute;
  inset: 0;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--brand-red);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.loader__logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.loader__text {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.66);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* -------------------------------------------------------------- top bar -- */

#topBar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: var(--bar-pad);
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
  pointer-events: none;
}

#topBar > * {
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.5rem 0.95rem 0.5rem 0.55rem;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.brand__logo {
  flex: none;
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.brand__name {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand__scene {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--paper);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.controls {
  display: flex;
  gap: 0.5rem;
}

/* A control hidden by script must actually disappear. `display: grid` below
   outranks the user agent's [hidden] { display: none }, so hiding the
   fullscreen button on a browser that cannot do fullscreen left a fully
   visible, completely inert button on screen. */
.ctrl[hidden] {
  display: none;
}

.ctrl {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--paper);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--hairline);
  border-radius: 50%;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.ctrl:hover {
  background: var(--glass-hover);
}

.ctrl:active {
  transform: scale(0.94);
}

.ctrl:focus-visible {
  outline: 3px solid var(--brand-red);
  outline-offset: 3px;
}

.ctrl__icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ctrl__icon--pause,
.ctrl__icon--play {
  fill: currentColor;
  stroke: none;
}

/* Only one icon of each pair is visible, driven by aria-pressed. */
.ctrl__icon--play,
.ctrl__icon--contract {
  display: none;
}

#autorotateToggle[aria-pressed="false"] .ctrl__icon--pause,
#fullscreenToggle[aria-pressed="true"] .ctrl__icon--expand {
  display: none;
}

#autorotateToggle[aria-pressed="false"] .ctrl__icon--play,
#fullscreenToggle[aria-pressed="true"] .ctrl__icon--contract {
  display: block;
}

/* ------------------------------------------------------------ scene bar -- */

#sceneBar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 2.5rem var(--bar-pad) var(--bar-pad);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.62), transparent);
}

#sceneList {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  margin: 0;
  padding: 0.15rem;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: none;
}

#sceneList::-webkit-scrollbar {
  display: none;
}

.scene-btn {
  position: relative;
  flex: none;
  display: block;
  width: 116px;
  padding: 0;
  overflow: hidden;
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.22s ease;
}

.scene-btn:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.4);
}

.scene-btn:focus-visible {
  outline: 3px solid var(--brand-red);
  outline-offset: 3px;
}

.scene-btn[aria-current="true"] {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 2px var(--brand-red), var(--shadow);
}

.scene-btn__img {
  display: block;
  width: 100%;
  height: 64px;
  object-fit: cover;
  opacity: 0.72;
  transition: opacity 0.22s ease;
}

.scene-btn:hover .scene-btn__img,
.scene-btn[aria-current="true"] .scene-btn__img {
  opacity: 1;
}

.scene-btn__label {
  display: block;
  padding: 0.45rem 0.5rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: center;
  color: rgba(255, 255, 255, 0.82);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scene-btn[aria-current="true"] .scene-btn__label {
  color: var(--paper);
}

/* ------------------------------------------------------------- hotspots -- */

.hotspot {
  position: relative;
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.hotspot:focus-visible {
  outline: 3px solid var(--brand-red);
  outline-offset: 6px;
  border-radius: 50%;
}

/* Link hotspot - a pulsing ring that walks you to the next scene */
.hotspot--link {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: var(--paper);
  background: rgba(214, 40, 40, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease, background 0.2s ease;
}

.hotspot--link::before {
  content: "";
  position: absolute;
  inset: -6px;
  border: 2px solid rgba(214, 40, 40, 0.65);
  border-radius: 50%;
  animation: pulse 2.4s ease-out infinite;
}

.hotspot--link:hover {
  transform: translate(-50%, -50%) scale(1.12);
  background: var(--brand-red);
}

.hotspot--link svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hotspot__tip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.35rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--paper);
  background: var(--glass-hover);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.hotspot--link:hover .hotspot__tip,
.hotspot--link:focus-visible .hotspot__tip {
  opacity: 1;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.9;
  }
  70% {
    transform: scale(1.55);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

/* Info hotspot - a dot that expands into a caption */
.hotspot--info {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: max-content;
  max-width: 15rem;
  padding: 0.4rem 0.9rem 0.4rem 0.45rem;
  color: var(--paper);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--hairline);
  /* A pill only reads well on one line; longer captions get a rounded card. */
  border-radius: 1.6rem;
  box-shadow: var(--shadow);
  transition: background 0.2s ease;
}

.hotspot--info:hover {
  background: var(--glass-hover);
}

.hotspot--info__dot {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--brand-red);
  border-radius: 50%;
}

.hotspot--info__label {
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
}

/* ----------------------------------------------------------------- hint -- */

#hint {
  position: absolute;
  left: 50%;
  bottom: clamp(7rem, 18vh, 9.5rem);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.9);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  box-shadow: var(--shadow);
  pointer-events: none;
  transition: opacity 0.45s ease;
}

#hint.is-hidden {
  opacity: 0;
}

#hint svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: nudge 2s ease-in-out infinite;
}

@keyframes nudge {
  0%, 100% {
    transform: translateX(-2px);
  }
  50% {
    transform: translateX(2px);
  }
}

/* ---------------------------------------------------------- small print -- */

@media (max-width: 640px) {
  .brand__name {
    display: none;
  }

  .scene-btn {
    width: 96px;
  }

  .scene-btn__img {
    height: 54px;
  }

  #sceneList {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loader__ring,
  .hotspot--link::before,
  #hint svg {
    animation: none;
  }

  .scene-btn,
  .ctrl,
  .hotspot--link {
    transition: none;
  }
}
