/* ==========================================================================
   Base & reset
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: Georgia, "Times New Roman", serif;
  color: #2a1810;
}

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

/* ==========================================================================
   Map shell — fixed full viewport, no scroll
   ========================================================================== */

.map-shell {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ==========================================================================
   Background image
   ========================================================================== */

.map-bg {
  position: absolute;
  inset: 0;
  background-color: #1a120c;
  background-image: url("background1.png");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
}

/* ==========================================================================
   Treasure path (SVG overlay)
   ========================================================================== */

.treasure-path {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.treasure-path__line {
  stroke: #c42a2a;
  stroke-width: 1.2px;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 3 5;
  shape-rendering: geometricPrecision;
  animation: path-dash var(--path-dash-duration, 9s) linear infinite;
}

@keyframes path-dash {
  to {
    stroke-dashoffset: var(--path-dash-offset, -3);
  }
}

/* ==========================================================================
   Logo (home)
   ========================================================================== */

.site-logo {
  position: absolute;
  z-index: 7;
  top: min(2.5vh, 1.25rem);
  left: min(2.5vw, 1.25rem);
  display: block;
  max-width: min(28vw, 140px);
  opacity: 0.92;
  transition: opacity 0.25s ease, transform 0.25s ease;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.site-logo:hover {
  opacity: 1;
  transform: scale(1.03);
}

.site-logo img {
  display: block;
  width: 100%;
  height: auto;
}

/* ==========================================================================
   Map icons — absolute hotspots
   ========================================================================== */

.map-icons {
  position: absolute;
  inset: 0;
  z-index: 6;
  margin: 0;
  padding: 0;
  list-style: none;
}

.map-icon {
  position: absolute;
  transform: translate3d(-50%, -50%, 0);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.2s ease;
  z-index: 2;
}

/* Donate: aligned with path terminus before Contact (see index.html coords) */
.map-icon--donate {
  left: min(76%, calc(100% - min(18vmin, 165px)));
}

.map-icon--contact .map-icon__glow img {
  width: min(22vmin, 175px);
}

/* Soft backlight only (no visible ring) — layered light + dark separation */
.map-icon__glow {
  position: relative;
  display: block;
  line-height: 0;
  transition: transform 0.2s ease;
}

.map-icon__glow img {
  position: relative;
  z-index: 1;
  display: block;
  width: min(28vmin, 220px);
  height: auto;
  transform-origin: center center;
  transition: filter 0.2s ease;
  /* Lighter glow stack for faster paint */
  filter:
    drop-shadow(0 0 16px rgba(255, 255, 255, 0.34))
    drop-shadow(0 0 30px rgba(255, 240, 210, 0.2))
    drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55));
}

.map-icon--calendar .map-icon__glow img {
  width: min(20vmin, 160px);
}

.map-icon:hover,
.map-icon:focus-visible {
  outline: none;
}

.map-icon:hover .map-icon__glow,
.map-icon:focus-visible .map-icon__glow {
  transform: scale(1.06);
}

.map-icon:hover .map-icon__glow img,
.map-icon:focus-visible .map-icon__glow img {
  filter:
    drop-shadow(0 0 22px rgba(255, 255, 255, 0.45))
    drop-shadow(0 0 44px rgba(255, 230, 190, 0.22))
    drop-shadow(0 3px 8px rgba(0, 0, 0, 0.65));
}

.map-icon:focus-visible {
  outline: 2px solid #f4e4c1;
  outline-offset: 4px;
}

.map-icon:hover .map-icon__label,
.map-icon:focus-visible .map-icon__label {
  text-shadow:
    0 0 12px rgba(255, 248, 220, 0.9),
    0 1px 2px rgba(255, 248, 235, 0.95),
    0 2px 6px rgba(0, 0, 0, 0.6),
    1px 1px 0 rgba(62, 42, 24, 0.35);
}

.map-icon__label {
  margin-top: -0.15rem;
  max-width: 18rem;
  padding: 0;
  font-family: "Pirata One", "Times New Roman", serif;
  font-size: clamp(0.95rem, 2.85vmin, 1.35rem);
  font-weight: 400;
  font-style: normal;
  text-align: center;
  line-height: 1.2;
  letter-spacing: 0.06em;
  color: #1c0f08;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  opacity: 1;
  pointer-events: none;
  /* Legibility on map without a box: soft halo + ink edge */
  text-shadow:
    0 1px 2px rgba(255, 248, 235, 0.85),
    0 2px 5px rgba(0, 0, 0, 0.55),
    1px 1px 0 rgba(62, 42, 24, 0.3);
}

/* ==========================================================================
   Sign — one image; text pinned to the horizontal plank only (no UI “text box”)
   ========================================================================== */

.map-sign {
  position: absolute;
  /* Above path + icons so the plank link stays clickable */
  z-index: 8;
  transform: translate(-50%, -50%);
  width: min(54vmin, 300px);
  pointer-events: none;
}

.map-sign__stack {
  position: relative;
  display: block;
  width: 100%;
  line-height: 0;
  filter:
    drop-shadow(0 0 24px rgba(255, 255, 255, 0.32))
    drop-shadow(0 0 52px rgba(255, 236, 200, 0.16))
    drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
  transform: translate3d(-10%, -10%, 0) rotate(-30deg);
  transform-origin: 50% 45%;
  animation: map-sign-sway 5s ease-in-out infinite;
}

.map-sign__post {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  margin: 0 auto;
  pointer-events: none;
}

@keyframes map-sign-sway {
  0%,
  100% {
    transform: translate3d(-10%, -10%, 0) rotate(-30deg);
  }
  50% {
    transform: translate3d(-10%, -11%, 0) rotate(-28deg);
  }
}

.map-sign__copy {
  position: absolute;
  left: 9%;
  top: 20%;
  width: 82%;
  height: 26%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 7%;
  text-align: center;
  box-sizing: border-box;
  background: transparent;
  /* Hit target above other layers; link remains interactive */
  pointer-events: auto;
  z-index: 2;
}

.map-sign__text {
  margin: 0;
  font-family: "Pirata One", "Times New Roman", serif;
  font-size: clamp(0.88rem, 2.4vmin, 1.2rem);
  font-weight: 400;
  font-style: normal;
  line-height: 1.3;
  letter-spacing: 0.04em;
  color: #1a1510;
  background: transparent;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35),
    0 0 1px rgba(255, 252, 248, 0.5);
}

.map-sign__link {
  color: #5c1010;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 700;
  background: transparent;
  pointer-events: auto;
  position: relative;
  z-index: 1;
  cursor: pointer;
}

.map-sign__link:hover {
  color: #3a0808;
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .treasure-path__line {
    animation: none;
  }

  .map-sign__stack {
    animation: none;
  }

  .map-icon,
  .map-icon__glow {
    transition-duration: 0.15s;
  }

  .map-icon:hover .map-icon__glow,
  .map-icon:focus-visible .map-icon__glow {
    transform: none;
  }
}

@media (max-width: 900px) {
  .site-logo {
    top: max(0.55rem, env(safe-area-inset-top, 0px));
    left: max(0.55rem, env(safe-area-inset-left, 0px));
    max-width: min(36vw, 128px);
  }

  .map-icon__label {
    font-size: clamp(0.82rem, 2.9vw, 1rem);
    max-width: 8.5rem;
    letter-spacing: 0.03em;
    line-height: 1.15;
  }

  .map-sign {
    width: min(46vw, 240px);
  }

  .map-sign__text {
    font-size: clamp(0.74rem, 2.2vw, 0.95rem);
    line-height: 1.2;
  }
}

@media (max-width: 600px) {
  .map-icon__glow img {
    width: min(24vmin, 128px);
  }

  .map-icon--calendar .map-icon__glow img {
    width: min(19vmin, 96px);
  }

  .map-icon--contact .map-icon__glow img {
    width: min(20vmin, 104px);
  }

  .treasure-path__line {
    stroke-width: 1px !important;
  }
}
