/* E18 Sykkelstamvei Vollevannet–Oddemarka
   Same visual template as Rv13 Lovraeidet–Rødsliane. */

:root {
  --teal: #589199;
  --teal-dark: #467a82;
  --header-h: 64px;
  /* header incl. the notch area on phones */
  --top: calc(var(--header-h) + env(safe-area-inset-top));
  --sl: env(safe-area-inset-left);
  --sr: env(safe-area-inset-right);
  --sb: env(safe-area-inset-bottom);
  /* visible screen height (iOS Safari: 100vh includes the hidden toolbar) */
  --vh: 100vh;
}
@supports (height: 100dvh) {
  :root { --vh: 100dvh; }
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background-color: #232323;
  font-family: "Segoe UI", "Helvetica", "Arial", sans-serif;
  color: #424242;
}

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

/* ---------- Loader ---------- */
.cover {
  position: fixed;
  inset: 0;
  background: #e2e2e2;
  z-index: 100;
}

.ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20vmin;
  height: 20vmin;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: ripple 4000ms linear infinite;
}

.ring:nth-child(2) { animation-delay: 1000ms; }
.ring:nth-child(3) { animation-delay: 2000ms; }
.ring:nth-child(4) { animation-delay: 3000ms; }

@keyframes ripple {
  from { width: 0; height: 0; opacity: 1; }
  to { width: 60vmin; height: 60vmin; opacity: 0; }
}

/* ---------- Header (white strip) ---------- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--top);
  padding-top: env(safe-area-inset-top) !important;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 130px;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.top-title {
  margin: 0;
  font-size: 2.2rem;
  font-weight: 500;
  color: var(--teal);
  text-align: center;
  line-height: 1.1;
}

.header-logo {
  position: absolute;
  right: calc(16px + var(--sr));
  margin-top: calc(env(safe-area-inset-top) / 2);
  top: 50%;
  transform: translateY(-50%);
  height: 58px;
}

/* RISA · Multiconsult — fixed under the header, top-right, scales with window */
.partner-logo {
  position: fixed;
  z-index: 12;
  top: calc(var(--top) + 12px);
  right: calc(16px + var(--sr));
  width: clamp(150px, 18vw, 342px);
  height: auto;
  pointer-events: none;
  user-select: none;
}

/* ---------- Map ---------- */
#map {
  position: fixed;
  top: var(--top);
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  background: #232323;
  /* the map handles drag + pinch itself */
  touch-action: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#map.dragging {
  cursor: grabbing;
}

#map svg {
  display: block;
  width: 100%;
  height: 100%;
}

#map image {
  pointer-events: none;
}

/* ---------- Zoom buttons ---------- */
#zoom-ctrl {
  position: fixed;
  left: calc(20px + env(safe-area-inset-left));
  bottom: calc(36px + env(safe-area-inset-bottom));
  z-index: 15;
  display: flex;
  flex-direction: column;
  border: 2px solid var(--teal);
  border-radius: 22px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

#zoom-ctrl button {
  width: 42px;
  height: 42px;
  border: 0;
  background: #fff;
  color: var(--teal);
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

#zoom-ctrl button svg {
  display: block;
  width: 24px;
  height: 24px;
  margin: 0 auto;
  fill: currentColor;
}

#zoom-ctrl button + button {
  border-top: 1px solid #d5e4e6;
}

#zoom-ctrl button:hover:not(:disabled) {
  background: var(--teal);
  color: #fff;
}

#zoom-ctrl button:disabled {
  color: #8fb3b8;
  background: #f3f7f8;
  cursor: default;
}

.hotspot {
  cursor: pointer;
  outline: none;
}

.hotspot .hit {
  fill: transparent;
}

.hotspot .ring-hover {
  fill: none;
  stroke: #fff;
  stroke-width: 4;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.hotspot .pulse {
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  transform-box: fill-box;
  transform-origin: center;
  animation: pulse 2.4s ease-out infinite;
  pointer-events: none;
}

.hotspot:hover .ring-hover,
.hotspot:focus .ring-hover {
  opacity: 1;
}

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

#tooltip {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  background: #fff;
  color: var(--teal);
  border: 2px solid var(--teal);
  border-radius: 10px;
  padding: 4px 12px;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 30px));
  opacity: 0;
  transition: opacity 0.15s ease;
}

#tooltip.show {
  opacity: 1;
}

/* ---------- Info button + panel ---------- */
.round-btn {
  position: fixed;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: 15;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.round-btn img {
  display: block;
  width: 50px;
  height: 50px;
}

#btn-info {
  left: calc(20px + var(--sl));
  top: calc(var(--top) + 16px);
}

#info-panel {
  display: none;
  position: fixed;
  left: calc(36px + var(--sl));
  top: calc(var(--top) + 32px);
  width: 600px;
  max-width: calc(100vw - 72px);
  max-height: calc(100% - var(--top) - 120px);
  -webkit-overflow-scrolling: touch;
  overflow: auto;
  padding: 2rem 2rem 2rem 3rem;
  background: #fff;
  border: 2px solid var(--teal);
  border-radius: 16px;
  color: var(--teal);
  line-height: 1.6;
  font-size: 1.05rem;
  z-index: 14;
}

#info-panel.open {
  display: block;
}

/* ---------- Bottom-right buttons (Oversiktsbilde) ---------- */
#corner-btns {
  position: fixed;
  right: calc(20px + var(--sr));
  bottom: calc(36px + var(--sb));
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.pill-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 20px 6px 6px;
  border: 2px solid var(--teal);
  border-radius: 40px;
  background: #fff;
  color: var(--teal);
  font-family: inherit;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.pill-btn .icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.pill-btn .icon svg {
  width: 26px;
  height: 26px;
  fill: #fff;
}

/* bird glyph: white shape from a mask, so it can swap colour on hover like the film icon */
.pill-btn .bird {
  width: 64%;
  height: 64%;
  background: #fff;
  -webkit-mask: url(../image/icons/bird-mask.png) center / contain no-repeat;
  mask: url(../image/icons/bird-mask.png) center / contain no-repeat;
  transition: background-color 0.2s ease;
}

.pill-btn:hover .bird,
.pill-btn:focus-visible .bird {
  background: var(--teal);
}

.pill-btn:hover,
.pill-btn:focus-visible {
  background: var(--teal);
  color: #fff;
}

.pill-btn:hover .icon,
.pill-btn:focus-visible .icon {
  background: #fff;
}

/* ---------- Map icons (eye / 360) ---------- */
.hotspot .icon {
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}

/* ---------- 360 modal ---------- */
#modal-360 {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.75);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#modal-360.open {
  display: flex;
}

#modal-360 .box {
  position: relative;
  width: min(1600px, calc(100vw - 140px));
  height: calc(var(--vh) - 40px - 56px);
  margin-top: 56px;
  background: #000;
  border: 6px solid var(--teal);
  border-radius: 16px;
}

#pano {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

#pano iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

#modal-360 .close {
  position: absolute;
  top: -48px;
  right: -60px;
  z-index: 2;
}

#modal-360 .close img {
  width: 40px;
  height: 40px;
}

/* ---------- Privacy link + popup (same look as the info panel) ---------- */
#btn-privacy {
  position: fixed;
  left: 50%;
  bottom: calc(8px + var(--sb));
  transform: translateX(-50%);
  z-index: 15;
  padding: 2px 6px;
  border: 0;
  background: none;
  color: #fff;
  font: inherit;
  font-size: 14px;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

#btn-privacy:hover,
#btn-privacy:focus-visible {
  color: #d9f0f2;
}

.popup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.55);
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
}

.popup.open {
  display: flex;
}

.popup-box {
  position: relative;
  width: 640px;
  max-width: 100%;
  max-height: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2rem 2.5rem;
  background: #fff;
  border: 2px solid var(--teal);
  border-radius: 16px;
  color: var(--teal);
  line-height: 1.6;
  font-size: 1.05rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.popup-box h2 {
  margin: 0 2.5rem 0.75rem 0;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.3;
}

.popup-box p {
  margin: 0 0 0.9rem;
}

.popup-box p:last-child {
  margin-bottom: 0;
}

.popup-box .close {
  position: absolute;
  top: 12px;
  right: 12px;
  box-shadow: none;
}

.popup-box .close img {
  width: 40px;
  height: 40px;
}

.popup-box .close {
  width: 40px;
  height: 40px;
}

/* ---------- Credit + mobile hint ---------- */
.credit {
  position: fixed;
  left: calc(84px + var(--sl));
  bottom: calc(38px + var(--sb));
  z-index: 5;
  color: #fff;
  font-size: 21px;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.6);
}

.credit img {
  height: 0.9em;
  width: auto;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.9));
}

#swipe-hint {
  display: none;
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 16;
  background: rgba(255, 255, 255, 0.95);
  color: var(--teal);
  border: 2px solid var(--teal);
  border-radius: 30px;
  padding: 10px 22px;
  font-weight: 600;
  pointer-events: none;
}

/* lightGallery: CSS spinner instead of the missing loading.gif */
.lg-outer .lg-item { background-image: none; }
.lg-outer .lg-item:not(.lg-complete)::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: lg-spin 0.8s linear infinite;
}
@keyframes lg-spin { to { transform: rotate(360deg); } }

/* lightGallery: keep the caption readable */
.lg-sub-html h4 {
  margin: 0;
  font-size: 18px;
  color: #fff;
}

/* ---------- Responsive ---------- */
html, body {
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

@media (max-width: 1300px) {
  .top-title { font-size: 1.7rem; }
}

@media (max-width: 900px) {
  .header { padding: 0 calc(96px + var(--sr)) 0 calc(16px + var(--sl)); justify-content: flex-start; }
  .top-title { font-size: 1.15rem; text-align: left; }
  .header-logo { height: 44px; }
}

/* Phones (portrait) */
@media (max-width: 600px) {
  :root { --header-h: 58px; }
  .top-title { font-size: 0.95rem; }
  .header-logo { height: 38px; right: calc(10px + var(--sr)); }
  .partner-logo { width: 140px; top: calc(var(--top) + 10px); right: calc(10px + var(--sr)); }
  #corner-btns { bottom: calc(28px + var(--sb)); right: calc(14px + var(--sr)); gap: 10px; }
  .pill-btn { padding: 5px; }
  .pill-btn .label { display: none; }
  #modal-360 { padding: 8px; }
  #modal-360 .box { width: 100%; height: calc(var(--vh) - 16px - 48px); margin-top: 48px; border-width: 3px; border-radius: 10px; }
  #pano { border-radius: 7px; }
  #modal-360 .close { top: -51px; right: -3px; }
  #modal-360 .close, #modal-360 .close img { width: 40px; height: 40px; }
  #zoom-ctrl { left: calc(14px + var(--sl)); bottom: calc(28px + var(--sb)); }
  #btn-info { left: calc(14px + var(--sl)); }
  #info-panel {
    left: calc(14px + var(--sl));
    right: calc(14px + var(--sr));
    width: auto;
    max-width: none;
    padding: 1.25rem 1.25rem 1.25rem 2.2rem;
    font-size: 0.95rem;
  }
  .credit { font-size: 15px; gap: 5px; left: calc(72px + var(--sl)); bottom: calc(30px + var(--sb)); }
  #btn-privacy { font-size: 12px; bottom: calc(5px + var(--sb)); }
  .popup { padding: 16px 14px; }
  .popup-box { padding: 1.25rem 1.25rem; font-size: 0.95rem; }
  .popup-box h2 { font-size: 1.1rem; }
}

/* Phones held sideways: little height, so slim everything down */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --header-h: 44px; }
  .header { padding: 0 calc(90px + var(--sr)) 0 calc(16px + var(--sl)); justify-content: center; }
  .top-title { font-size: 1.05rem; text-align: center; }
  .header-logo { height: 36px; }
  .partner-logo { width: 130px; top: calc(var(--top) + 8px); }
  .round-btn, .round-btn img { width: 40px; height: 40px; }
  #btn-info { top: calc(var(--top) + 10px); left: calc(14px + var(--sl)); }
  #info-panel {
    top: calc(var(--top) + 22px);
    left: calc(26px + var(--sl));
    max-height: calc(100% - var(--top) - 40px);
    padding: 1rem 1.25rem 1rem 2.4rem;
    font-size: 0.92rem;
    width: 520px;
  }
  #corner-btns { bottom: calc(14px + var(--sb)); right: calc(14px + var(--sr)); gap: 8px; }
  .pill-btn { padding: 4px; }
  .pill-btn .label { display: none; }
  #modal-360 { padding: 6px; }
  #modal-360 .box { width: calc(100% - 100px); height: calc(var(--vh) - 12px); margin-top: 0; border-width: 3px; border-radius: 10px; }
  #pano { border-radius: 7px; }
  #modal-360 .close { top: -3px; right: -50px; }
  .pill-btn .icon { width: 38px; height: 38px; }
  #zoom-ctrl { bottom: calc(14px + var(--sb)); left: calc(14px + var(--sl)); flex-direction: row; }
  #zoom-ctrl button { width: 38px; height: 38px; font-size: 22px; }
  #zoom-ctrl button + button { border-top: 0; border-left: 1px solid #d5e4e6; }
  .credit { font-size: 14px; gap: 5px; left: calc(104px + var(--sl)); bottom: calc(22px + var(--sb)); }
  #btn-privacy { font-size: 12px; bottom: calc(3px + var(--sb)); }
  .popup { padding: 10px 14px; }
  .popup-box { padding: 1rem 1.5rem; font-size: 0.92rem; line-height: 1.5; }
  .popup-box h2 { font-size: 1.05rem; margin-bottom: 0.5rem; }
}
