html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  background-color: var(--background-color);
  background-image: var(--placeholder-image, var(--background-image));
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}

body[data-background-image]::before,
.image-stage[data-background-image]::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: var(--background-image) center / 100% 100% no-repeat;
  transition: opacity 450ms ease;
}

body[data-background-image]::before {
  position: fixed;
  background-size: contain;
}

body.background-loaded::before,
.image-stage.background-loaded::before {
  opacity: 1;
}

.image-stage {
  position: fixed;
  isolation: isolate;
  overflow: hidden;
  top: 50%;
  left: 50%;
  width: min(100vw, calc(100vh * 1672 / 941));
  aspect-ratio: 1672 / 941;
  background-image: var(--placeholder-image, var(--background-image));
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  transform: translate(-50%, -50%);
}

.region-link {
  --region-color: 238, 115, 29;
  --region-dark: 126, 54, 10;
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  color: #fff;
  text-decoration: none;
  border-radius: 12px;
  cursor: pointer;
}

.kowloon-link {
  top: 42.5%;
  left: 76.3%;
  width: 22.4%;
  height: 28.5%;
}

.new-territories-west-link {
  --region-color: 103, 70, 160;
  --region-dark: 66, 43, 108;
  top: 1.2%;
  left: 1.2%;
  width: 21.1%;
  height: 41.7%;
}

.new-territories-east-link {
  --region-color: 61, 151, 48;
  --region-dark: 38, 104, 31;
  top: 1.2%;
  left: 76.4%;
  width: 22.4%;
  height: 40%;
}

.sha-tin-link {
  --region-color: 24, 103, 190;
  --region-dark: 13, 67, 128;
  top: 19.8%;
  left: 1.8%;
  width: 18.7%;
  height: 21.2%;
}

.tsuen-wan-link {
  --region-color: 205, 72, 91;
  --region-dark: 128, 38, 52;
  top: 40.5%;
  left: 80.6%;
  width: 17.5%;
  height: 22.8%;
}

.tai-mo-shan-country-park-link {
  --region-color: 50, 125, 66;
  --region-dark: 24, 82, 39;
  top: 3.8%;
  left: 27%;
  width: 16.1%;
  height: 20.6%;
}

.shing-mun-country-park-link {
  --region-color: 63, 132, 67;
  --region-dark: 29, 83, 39;
  top: 3.8%;
  left: 44.1%;
  width: 16.5%;
  height: 20.6%;
}

.discovery-park-link {
  --region-color: 232, 146, 25;
  --region-dark: 153, 83, 10;
  top: 28.5%;
  left: 35.4%;
  width: 15%;
  height: 19.3%;
}

.tsuen-wan-west-link {
  --region-color: 104, 74, 174;
  --region-dark: 64, 43, 116;
  top: 25.2%;
  left: 1.4%;
  width: 15.8%;
  height: 19.5%;
}

.tsuen-wan-promenade-link {
  --region-color: 33, 142, 205;
  --region-dark: 16, 86, 133;
  top: 3.8%;
  left: 79.6%;
  width: 18.1%;
  height: 20.6%;
}

.belvedere-garden-link {
  --region-color: 55, 142, 190;
  --region-dark: 22, 84, 124;
  top: 28.4%;
  left: 80.5%;
  width: 16.8%;
  height: 18.7%;
}

.region-link::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: 0 10px 28px rgba(var(--region-dark), 0.38);
  transition: none;
}

.region-link::after {
  content: "";
  position: absolute;
  inset: 10px;
  opacity: 0;
  visibility: hidden;
  border-radius: 6px;
  pointer-events: none;
  background:
    linear-gradient(#fff, #fff) left top / 24px 3px no-repeat,
    linear-gradient(#fff, #fff) left top / 3px 24px no-repeat,
    linear-gradient(#fff, #fff) right top / 24px 3px no-repeat,
    linear-gradient(#fff, #fff) right top / 3px 24px no-repeat,
    linear-gradient(#fff, #fff) left bottom / 24px 3px no-repeat,
    linear-gradient(#fff, #fff) left bottom / 3px 24px no-repeat,
    linear-gradient(#fff, #fff) right bottom / 24px 3px no-repeat,
    linear-gradient(#fff, #fff) right bottom / 3px 24px no-repeat;
  transition: none;
}

.region-link span {
  position: absolute;
  right: 0;
  bottom: 12px;
  left: 0;
  z-index: 1;
  width: max-content;
  margin-inline: auto;
  padding: 8px 12px;
  border-radius: 999px;
  opacity: 0;
  visibility: hidden;
  background: rgb(var(--region-dark));
  box-shadow: 0 5px 16px rgba(56, 24, 4, 0.22);
  font-family: "Microsoft YaHei", sans-serif;
  font-size: clamp(12px, 1vw, 16px);
  letter-spacing: 0.04em;
  transition: none;
}

.region-link span::after {
  content: " ↗";
  margin-left: 4px;
}

.region-link:hover::before,
.region-link:focus-visible::before {
  opacity: 1;
  visibility: visible;
}

.region-link:hover::after,
.region-link:focus-visible::after {
  opacity: 0.95;
  visibility: visible;
}

.region-link:hover span,
.region-link:focus-visible span {
  opacity: 1;
  visibility: visible;
}

.region-link:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  body[data-background-image]::before,
  .image-stage[data-background-image]::before,
  .region-link::before,
  .region-link::after,
  .region-link span {
    transition: none;
  }
}

.back-link {
  position: fixed;
  z-index: 2;
  top: 50%;
  left: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 13px 9px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  color: #fff;
  background: rgba(14, 55, 85, 0.68);
  box-shadow: 0 6px 20px rgba(10, 40, 60, 0.2);
  backdrop-filter: blur(8px);
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 13px;
  text-decoration: none;
  transform: translateY(-50%);
  transition: background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.back-link__arrow {
  font-size: 18px;
  line-height: 1;
}

.back-link__text {
  writing-mode: vertical-rl;
  letter-spacing: 0.18em;
  line-height: 1;
}

.back-link:hover,
.back-link:focus-visible {
  background: rgba(10, 46, 72, 0.9);
  box-shadow: 0 8px 24px rgba(10, 40, 60, 0.3);
  transform: translate(4px, -50%);
}

.back-links {
  position: fixed;
  z-index: 2;
  top: 50%;
  left: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateY(-50%);
}

.back-links .back-link {
  position: static;
  transform: none;
}

.back-links .back-link:hover,
.back-links .back-link:focus-visible {
  transform: translateX(3px);
}

.back-link--parent {
  background: rgba(16, 94, 116, 0.76);
}

.back-link--home {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(25, 57, 73, 0.68);
}
