/* 
  Web Mapper GPT — dark image-map viewer styles
  ------------------------------------------------
  The visual system keeps the image dominant while borrowing a dark,
  luminous control language: low-contrast charcoal surfaces, warm-gold
  hairlines, and soft cyan glows that stay behind the content.
*/

:root {
  --bg-0: #05060b;
  --bg-1: #090b13;
  --bg-2: #101521;
  --ink: #edf3ff;
  --muted: rgba(237, 243, 255, 0.66);
  --line: rgba(255, 213, 139, 0.24);
  --line-strong: rgba(255, 213, 139, 0.48);
  --glass: rgba(9, 12, 22, 0.72);
  --glass-hover: rgba(18, 23, 36, 0.88);
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.48);
  --button-radius: 3px;
  --edge-pad: 4px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 14%, rgba(49, 140, 170, 0.17), transparent 33vmax),
    radial-gradient(circle at 82% 88%, rgba(197, 139, 50, 0.10), transparent 32vmax),
    linear-gradient(145deg, var(--bg-0), var(--bg-1) 55%, #070a11);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

/* Subtle site-like depth without distracting from the artwork. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255,255,255,0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, rgba(0,0,0,0.72), transparent 76%);
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 1;
  padding: var(--edge-pad);
  overflow: hidden;
  user-select: none;
  touch-action: none;
  cursor: grab;
  isolation: isolate;
}

.viewer.is-dragging {
  cursor: grabbing;
}

.map-image {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  opacity: 0;
  transform-origin: 0 0;
  box-shadow:
    0 0 0 1px rgba(255, 232, 185, 0.10),
    0 20px 70px rgba(0, 0, 0, 0.62);
  transition: opacity 180ms ease;
  will-change: transform;
  backface-visibility: hidden;
}

.map-image.is-ready {
  opacity: 1;
}

.toolbar {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 7px;
}

.tool-button,
.sources-button,
.modal__close {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: var(--button-radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.025)),
    var(--glass);
  color: var(--ink);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255,255,255,0.10);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(15px) saturate(1.12);
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 120ms ease,
    box-shadow 120ms ease;
}

.tool-button {
  min-width: 39px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.tool-button--icon {
  width: 39px;
  padding: 0;
}

.tool-button:hover,
.tool-button:focus-visible,
.sources-button:hover,
.sources-button:focus-visible,
.modal__close:hover,
.modal__close:focus-visible {
  border-color: var(--line-strong);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.13), rgba(255,255,255,0.038)),
    var(--glass-hover);
  box-shadow:
    0 17px 46px rgba(0, 0, 0, 0.52),
    0 0 0 3px rgba(101, 204, 230, 0.11),
    inset 0 1px 0 rgba(255,255,255,0.14);
  outline: none;
}

.tool-button:active,
.sources-button:active,
.modal__close:active {
  transform: translateY(1px);
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sources-button {
  position: fixed;
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 10;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  font-family: Georgia, serif;
  font-size: 0.95rem;
  font-style: italic;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  gap: 12px;
  align-content: center;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 213, 139, 0.08), transparent 30vmax),
    rgba(5, 6, 11, 0.82);
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.loading.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.loading__mark {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 213, 139, 0.22);
  border-top-color: rgba(114, 224, 244, 0.72);
  border-radius: 999px;
  animation: spin 950ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(1, 3, 8, 0.62);
  backdrop-filter: blur(8px);
}

.modal[hidden] {
  display: none;
}

.modal__panel {
  position: relative;
  width: min(540px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.026)),
    rgba(10, 13, 23, 0.96);
  box-shadow:
    0 24px 90px rgba(0, 0, 0, 0.70),
    inset 0 1px 0 rgba(255,255,255,0.09);
}

.modal__panel h2 {
  margin: 0 44px 14px 0;
  color: var(--ink);
  font-size: 1rem;
  letter-spacing: 0.03em;
}

.modal__panel p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.modal__panel code {
  color: #ffe1a5;
}

.modal__panel a {
  color: #8be9ff;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.modal__made {
  margin-top: 18px !important;
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.noscript {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 50;
  max-width: 420px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 10, 18, 0.94);
  color: var(--muted);
  font-size: 0.85rem;
}

.noscript a {
  color: #8be9ff;
}

@media (max-width: 560px) {
  .toolbar {
    gap: 6px;
  }

  .tool-button {
    height: 36px;
    min-width: 37px;
    padding: 0 10px;
  }

  .tool-button--icon {
    width: 37px;
    padding: 0;
  }

  .tool-button__text {
    display: none;
  }

  .icon {
    width: 17px;
    height: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-image,
  .loading,
  .tool-button,
  .sources-button,
  .modal__close {
    transition: none;
  }

  .loading__mark {
    animation: none;
  }
}
