/* ==========================================================
   CA›SIN›O Guide  |  Globe landing page (light & friendly)
   ========================================================== */

.globe-page {
  --on-dark: rgba(255,255,255,.72);
  background:
    radial-gradient(ellipse at 72% 45%, rgba(236,217,168,.55) 0%, transparent 55%),
    linear-gradient(180deg, #fffdf8 0%, #f8f1e3 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- Background video ---------- */
.g-video { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.g-video video {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.04);
  filter: saturate(1.1) sepia(.15) brightness(1.05);
  transition: opacity 1.2s var(--ease), transform 8s linear;
}
.g-video video.ready { opacity: 1; transform: scale(1.12); } /* slow push-in while each clip plays */
.video-paused .g-video video.ready { opacity: .6; }

/* Cream veil: solid behind the text, see-through behind the globe */
.g-video-overlay {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(12,10,6,.92) 0%, rgba(12,10,6,.80) 34%, rgba(12,10,6,.50) 64%, rgba(12,10,6,.40) 100%),
    radial-gradient(ellipse at 68% 50%, rgba(201,169,97,.18) 0%, transparent 55%),
    linear-gradient(180deg, rgba(12,10,6,.55) 0%, transparent 22%, transparent 72%, rgba(12,10,6,.75) 100%);
}

.g-video-toggle {
  position: fixed; right: 24px; bottom: 24px; z-index: 15;
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--gold-light);
  background: rgba(255,255,255,.85); color: var(--gold-deep); cursor: pointer;
  display: grid; place-items: center; transition: all .3s;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.g-video-toggle:hover { background: var(--gold); color: var(--white); }
.g-video-toggle .ico-play { display: none; }
.video-paused .g-video-toggle .ico-play { display: block; }
.video-paused .g-video-toggle .ico-pause { display: none; }

.globe-page .lang-switch { background: rgba(255,255,255,.8); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

/* ---------- Header ---------- */
.g-header {
  position: relative; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 48px;
}

/* ---------- Layout ---------- */
.g-main {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: minmax(360px, 500px) 1fr;
  align-items: center; gap: 32px;
  min-height: calc(100vh - 96px);
  padding: 0 48px 40px;
  max-width: 1500px; margin: 0 auto;
}

.g-intro h1 {
  font-size: clamp(34px, 4vw, 52px); font-weight: 500;
  margin: 14px 0 12px; line-height: 1.25;
}
.g-intro h1 em { font-style: normal; }
.g-intro > p { font-size: 17px; max-width: 440px; color: var(--muted); }

/* ---------- Destination cards ---------- */
.loc-list {
  list-style: none; margin: 32px 0 24px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.loc-list li { animation: cardIn .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 80ms); }
.loc-list li:nth-child(1) { --i: 0; } .loc-list li:nth-child(2) { --i: 1; }
.loc-list li:nth-child(3) { --i: 2; } .loc-list li:nth-child(4) { --i: 3; }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }

.loc-item {
  width: 100%; display: block; position: relative; overflow: hidden; isolation: isolate;
  aspect-ratio: 16/11; border: 0; border-radius: 22px; cursor: pointer; padding: 0;
  background: var(--ink); text-align: left; font-family: var(--font-body);
  box-shadow: 0 14px 30px -18px rgba(40,28,8,.6), inset 0 0 0 1px rgba(255,255,255,.12);
  transition: transform .45s var(--ease), box-shadow .45s var(--ease);
}
.loc-item img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2;
  transition: transform 1s var(--ease), filter .5s;
  filter: saturate(1.05);
}
/* Soft gradient so white text always reads */
.loc-item::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(10,8,4,.15) 0%, transparent 35%, rgba(10,8,4,.55) 100%);
}
/* Gold ring for the selected card */
.loc-item::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  padding: 2px; background: var(--gold-gradient);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .4s;
}
.loc-item:hover { transform: translateY(-5px); box-shadow: 0 24px 40px -18px rgba(40,28,8,.6); }
.loc-item:hover img { transform: scale(1.08); }
.loc-item:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.loc-item.active { box-shadow: 0 0 0 4px rgba(201,169,97,.25), 0 24px 44px -16px rgba(140,109,53,.7); }
.loc-item.active::after { opacity: 1; }

/* Top badge */
.loc-badge {
  position: absolute; top: 12px; left: 12px; max-width: calc(100% - 64px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 5px 11px; border-radius: 40px; font-size: 11px; font-weight: 500; letter-spacing: .02em;
  color: var(--white); background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.3);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}

/* Round arrow button */
.loc-go {
  position: absolute; top: 10px; right: 10px;
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  color: var(--ink); background: rgba(255,255,255,.92);
  transition: transform .45s var(--ease), background .3s;
}
.loc-item:hover .loc-go { transform: rotate(45deg); }
.loc-item.active .loc-go { background: var(--gold-gradient); transform: rotate(45deg); }

/* Frosted glass info bar */
.loc-glass {
  position: absolute; left: 8px; right: 8px; bottom: 8px;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 16px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.28);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  color: var(--white);
  transition: background .4s;
}
.loc-item:hover .loc-glass, .loc-item.active .loc-glass { background: rgba(255,255,255,.24); }
.loc-num {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center;
  font-family: "Cormorant Garamond", serif; font-size: 15px; font-weight: 600;
  color: var(--ink); background: var(--gold-gradient);
}
.loc-text { min-width: 0; }
.loc-name { display: block; font-family: var(--font-display-th); font-size: 18px; font-weight: 500; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[lang="en"] .loc-name { font-family: var(--font-display-en); font-size: 20px; font-weight: 600; }
.loc-region { display: block; font-size: 11.5px; opacity: .85; line-height: 1.3; }

.g-skip { font-size: 14px; color: var(--gold-deep); border-bottom: 1px solid var(--gold-light); padding-bottom: 2px; }
.g-skip:hover { color: var(--ink); }

/* ---------- Globe stage ---------- */
.g-stage { position: relative; display: flex; flex-direction: column; align-items: center; transition: padding .5s var(--ease); }
/* Make room for the detail card so it never covers the globe */
@media (min-width: 1101px) { .panel-open .g-stage { padding-right: 380px; } }
.globe-wrap {
  position: relative; width: 100%; aspect-ratio: 1; max-width: 720px; max-height: calc(100vh - 150px);
  touch-action: none;
}
/* Soft floor shadow under the globe */
.globe-wrap::after {
  content: ""; position: absolute; left: 22%; right: 22%; bottom: 1%; height: 6%;
  background: radial-gradient(ellipse, rgba(120,90,30,.28) 0%, transparent 70%);
  z-index: -1;
}
#globe { width: 100%; height: 100%; display: block; cursor: ew-resize; }
#globe.dragging { cursor: grabbing; }
.globe-wrap { touch-action: pan-y; } /* vertical page scroll still works on touch */

.g-hint {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
  background: rgba(255,255,255,.8); border: 1px solid var(--line); border-radius: 40px; padding: 6px 16px; margin-top: 6px;
}
.g-hint svg { color: var(--gold); }

/* Loading ring */
.globe-loading { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; transition: opacity .6s; }
.globe-loading span {
  width: 52px; height: 52px; border-radius: 50%;
  border: 2px solid rgba(201,169,97,.25); border-top-color: var(--gold);
  animation: spin 1s linear infinite;
}
.globe-loading.done { opacity: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Markers (HTML overlay, positioned by JS) ---------- */
.markers { position: absolute; inset: 0; pointer-events: none; }
.marker {
  position: absolute; left: 0; top: 0; pointer-events: auto;
  background: none; border: 0; cursor: pointer; padding: 0;
  transition: opacity .3s; font-family: var(--font-body);
}
.marker.hidden { opacity: 0; pointer-events: none; }
.marker-dot {
  position: absolute; left: -8px; top: -8px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--gold-gradient); border: 3px solid var(--white);
  box-shadow: 0 2px 8px rgba(80,60,20,.4);
}
.marker-pulse {
  position: absolute; left: -8px; top: -8px; width: 16px; height: 16px; border-radius: 50%;
  background: rgba(201,169,97,.5); animation: pulse 2s ease-out infinite;
}
@keyframes pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(3.2); opacity: 0; } }

.marker-label {
  position: absolute; top: calc(-17px + var(--ly, 0px)); white-space: nowrap;
  padding: 6px 14px; font-size: 14px; font-weight: 500; color: var(--ink);
  background: var(--white); border-radius: 40px;
  box-shadow: 0 6px 16px -6px rgba(80,60,20,.45);
  transition: background .3s, color .3s;
}
.marker.right .marker-label { left: 18px; }
.marker.left .marker-label { right: 18px; }
.marker:hover .marker-label, .marker.active .marker-label { background: var(--gold-gradient); }
.marker.active .marker-dot { transform: scale(1.25); }

/* ---------- Selected panel ---------- */
.loc-panel {
  position: fixed; right: 40px; bottom: 40px; z-index: 20; width: 360px;
  background: var(--white); border-radius: 20px; overflow: hidden;
  box-shadow: 0 30px 60px -20px rgba(60,45,15,.4);
  animation: panelIn .5s var(--ease);
}
.loc-panel[hidden] { display: none; }
@keyframes panelIn { from { opacity: 0; transform: translateY(24px); } }
.loc-panel-img { aspect-ratio: 16/9; }
.loc-panel-body { padding: 22px 24px 24px; }
.loc-panel h2 { font-size: 30px; margin: 2px 0 8px; }
.loc-panel p { font-size: 15px; color: var(--muted); line-height: 1.7; }
.loc-panel-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.loc-panel-stats li {
  font-size: 12px; color: var(--gold-deep); background: var(--gold-pale);
  padding: 4px 12px; border-radius: 40px;
}
.loc-panel .btn { width: 100%; justify-content: center; border-radius: 40px; }
.loc-panel-close {
  position: absolute; top: 12px; right: 12px; z-index: 2; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.92); color: var(--ink);
  font-size: 20px; line-height: 1; cursor: pointer; transition: all .3s;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.loc-panel-close:hover { background: var(--gold); }

/* ---------- Page transition ---------- */
.g-curtain {
  position: fixed; inset: 0; z-index: 100; pointer-events: none;
  background: var(--gold-gradient); transform: scaleY(0); transform-origin: bottom;
  transition: transform .7s var(--ease);
}
.g-curtain.show { transform: scaleY(1); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .g-video-overlay {
    background: linear-gradient(180deg, rgba(12,10,6,.75) 0%, rgba(12,10,6,.45) 18%, rgba(12,10,6,.55) 42%, rgba(12,10,6,.90) 62%, rgba(12,10,6,.95) 100%);
  }
  .g-main { grid-template-columns: 1fr; padding: 0 24px 40px; }
  .g-intro { text-align: center; max-width: 560px; margin: 0 auto; }
  .g-intro > p { margin: 0 auto; }
  .g-stage { order: -1; }
  .globe-wrap { max-width: 520px; max-height: none; }
}

@media (max-width: 640px) {
  .g-header { padding: 16px; }
  .g-video-toggle { right: 16px; bottom: 16px; }
  .g-header .logo-mark { font-size: 20px; }
  .g-main { padding: 0 16px 140px; gap: 8px; }
  .g-intro h1 { font-size: 30px; }
  .loc-list { gap: 10px; }
  .loc-name { font-size: 16px; }
  .loc-item { border-radius: 18px; }
  .loc-num { display: none; }
  .marker-label { font-size: 12px; padding: 4px 10px; top: calc(-14px + var(--ly, 0px)); }
  .loc-panel { left: 0; right: 0; bottom: 0; width: auto; border-radius: 20px 20px 0 0; }
  .loc-panel-img { aspect-ratio: 21/9; }
  .loc-panel-body { padding: 18px 20px 22px; }
  .loc-panel h2 { font-size: 26px; }
}

/* ---------- Dark video theme: light text on the left ---------- */
.globe-page { background: #0f0d09; color: var(--on-dark); }
.globe-page .g-intro h1 { color: var(--white); }
.globe-page .g-intro > p { color: var(--on-dark); }
.globe-page .logo-guide { color: var(--white); }
.globe-page .logo-sub { color: rgba(255,255,255,.45); }
.globe-page .lang-switch { background: rgba(12,10,6,.45); }
.globe-page .lang-switch button { color: var(--gold-light); }
.globe-page .lang-switch button.active { color: var(--ink); }
.globe-page .g-skip { color: var(--gold-light); border-bottom-color: rgba(201,169,97,.5); }
.globe-page .g-skip:hover { color: var(--white); }
.globe-page .g-hint { background: rgba(12,10,6,.5); border-color: rgba(201,169,97,.35); color: rgba(255,255,255,.75); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.globe-page .g-video-toggle { background: rgba(12,10,6,.55); color: var(--gold-light); border-color: rgba(201,169,97,.5); }
.globe-page .g-video-toggle:hover { background: var(--gold); color: var(--ink); }
.globe-page .globe-wrap::after { background: radial-gradient(ellipse, rgba(0,0,0,.55) 0%, transparent 70%); }
.globe-page .loc-item { box-shadow: 0 16px 34px -16px rgba(0,0,0,.8), inset 0 0 0 1px rgba(255,255,255,.14); }

/* When a label is pushed down to avoid a neighbour, draw a short leader line back to the pin */
.marker.nudged .marker-label::after {
  content: ""; position: absolute; top: 50%; width: 1px; height: var(--ly); transform: translateY(-100%);
  background: rgba(255,255,255,.6);
}
.marker.nudged.right .marker-label::after { left: -10px; }
.marker.nudged.left .marker-label::after { right: -10px; }
