/* ============================================================
   FIELD ATLAS — Carl & Rachel's travel globe
   same house style as photo.carlfung.dev
   ============================================================ */

:root {
  --ink: #0b0b0c;
  --ink-2: #131315;
  --bone: #ece7de;
  --bone-dim: rgba(236, 231, 222, 0.55);
  --vermilion: #e6402e;
  --hairline: rgba(236, 231, 222, 0.14);
  --serif: "Bodoni Moda", serif;
  --sans: "Archivo", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--ink);
  color: var(--bone);
  font-family: var(--sans);
  font-weight: 300;
  overflow: hidden;
}

::selection { background: var(--vermilion); color: var(--ink); }

/* ---------- grain ---------- */
.grain {
  position: fixed; inset: -100%;
  pointer-events: none; z-index: 50;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 250 250' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
  opacity: 0.06;
  animation: grain 0.9s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 3%); }
  50% { transform: translate(3%, -2%); }
  75% { transform: translate(-3%, -3%); }
  100% { transform: translate(2%, 2%); }
}

/* ---------- header ---------- */
.head {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px clamp(20px, 4vw, 56px);
  pointer-events: none;
}
.head__brand {
  display: flex; flex-direction: column; gap: 3px;
  pointer-events: auto;
}
.head__logo {
  font-family: var(--serif); font-size: 22px;
  color: var(--bone); text-decoration: none;
  line-height: 1;
}
.head__logo sup { font-size: 0.45em; }
.head__gallery {
  font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--bone-dim); text-decoration: none;
  transition: color 0.3s ease;
}
.head__gallery:hover { color: var(--vermilion); }
.head__title {
  font-family: var(--serif); font-size: 18px; letter-spacing: 0.04em;
}
.head__title em { color: var(--vermilion); }
.head__stats {
  display: flex; align-items: center; gap: 12px;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--bone-dim);
}
.head__stats b { color: var(--bone); font-weight: 500; }
.head__dot { width: 4px; height: 4px; border-radius: 50%; background: var(--vermilion); }

/* ---------- globe ---------- */
#globe { position: fixed; inset: 0; z-index: 1; }
#globe canvas { outline: none; }

/* ---------- hero title ---------- */
.hero-title {
  position: fixed; left: clamp(20px, 4vw, 56px); bottom: clamp(20px, 5vh, 48px);
  z-index: 10;
  font-family: var(--serif);
  font-weight: 480;
  font-size: clamp(40px, 7vw, 110px);
  line-height: 0.88;
  pointer-events: none;
  mix-blend-mode: exclusion;
}
.hero-title__line { display: block; overflow: hidden; }
.hero-title__line--italic { font-style: italic; color: var(--vermilion); }

/* ---------- place index ---------- */
.places {
  position: fixed; right: clamp(20px, 4vw, 56px);
  top: 76px; bottom: 56px;
  z-index: 20;
  display: flex; flex-direction: column; gap: 0;
  text-align: right;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  /* fade the top/bottom edges so the scroll reads cleanly */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%);
}
.places::-webkit-scrollbar { display: none; }
.place-btn {
  background: none; border: none; cursor: pointer;
  color: var(--bone-dim);
  font-family: var(--sans); font-size: 11px; font-weight: 300;
  letter-spacing: 0.16em; text-transform: uppercase;
  padding: 3.5px 0;
  flex: 0 0 auto;
  display: flex; align-items: baseline; justify-content: flex-end; gap: 10px;
  transition: color 0.3s ease;
}
.place-btn i {
  font-style: normal; font-family: var(--serif); font-size: 10px;
  color: var(--vermilion); opacity: 0;
  transition: opacity 0.3s ease;
}
.place-btn:hover, .place-btn.is-active { color: var(--bone); }
.place-btn:hover i, .place-btn.is-active i { opacity: 1; }
.place-btn--upcoming { opacity: 0.45; }
.place-btn--upcoming::after { content: "·soon"; font-size: 9px; color: var(--vermilion); margin-left: 6px; }
.places__rule {
  border: none; border-top: 1px solid var(--hairline);
  margin: 10px 0;
}
.places__continent {
  display: flex; align-items: baseline; justify-content: flex-end; gap: 9px;
  font-size: 11px; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--bone);
  margin: 22px 0 4px;
  padding-top: 11px;
  border-top: 1px solid var(--hairline);
  cursor: pointer;
  transition: color 0.3s ease;
}
.places__continent:first-child { border-top: none; padding-top: 0; margin-top: 2px; }
.places__continent:hover, .places__continent.is-active { color: var(--vermilion); }
.places__continent span {
  font-size: 9px; letter-spacing: 0.12em; color: var(--vermilion);
}
.places__country {
  display: flex; align-items: baseline; justify-content: flex-end; gap: 8px;
  font-family: var(--serif); font-style: italic;
  font-size: 14px; letter-spacing: 0.02em;
  color: var(--bone-dim);
  margin: 9px 0 3px;
  cursor: pointer;
  transition: color 0.3s ease;
}
.places__country:hover, .places__country.is-active { color: var(--vermilion); }
.places__country--upcoming { color: var(--bone-dim); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; font-family: var(--sans); font-style: normal; }

/* ---------- detail panel ---------- */
.panel {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 30;
  width: min(420px, 92vw);
  background: rgba(11, 11, 12, 0.92);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--hairline);
  padding: 90px clamp(22px, 3vw, 40px) 40px;
  visibility: hidden; /* gsap reveals + positions via xPercent */
  overflow-y: auto;
}
.panel__close {
  position: absolute; top: 24px; right: 22px;
  background: none; border: 1px solid var(--hairline); border-radius: 50%;
  width: 38px; height: 38px;
  color: var(--bone); font-size: 18px; cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease;
}
.panel__close:hover { border-color: var(--vermilion); color: var(--vermilion); }
.panel__country {
  font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--vermilion);
  margin-bottom: 10px;
}
.panel__city {
  font-family: var(--serif); font-weight: 480; font-style: italic;
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1;
  margin-bottom: 14px;
}
.panel__note {
  font-size: 13px; line-height: 1.6; color: var(--bone-dim);
  max-width: 34ch;
  margin-bottom: 20px;
}
.panel__share {
  background: none; cursor: pointer;
  border: 1px solid var(--hairline); border-radius: 999px;
  color: var(--bone);
  font-family: var(--sans); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  padding: 9px 16px;
  margin-bottom: 28px;
  transition: border-color 0.3s ease, color 0.3s ease;
}
.panel__share:hover { border-color: var(--vermilion); color: var(--vermilion); }
.panel__photos { display: flex; flex-direction: column; gap: 18px; }
.panel__photo { position: relative; overflow: hidden; }
.panel__photo img {
  width: 100%; display: block;
  filter: grayscale(1) brightness(0.92);
  transform: scale(1.04);
  transition: filter 0.6s ease, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.panel__photo:hover img { filter: grayscale(0) brightness(1); transform: scale(1); }
.panel__photo figcaption {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 0 0;
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--bone-dim);
}
.panel__photo figcaption span { font-family: var(--serif); font-size: 14px; letter-spacing: 0; text-transform: none; color: var(--bone); }

/* ---------- bottom control bar ---------- */
.controls {
  position: fixed; left: 50%; bottom: 52px; transform: translateX(-50%);
  z-index: 20;
  display: flex; align-items: center; gap: 14px;
}
.mode-toggle {
  display: flex; align-items: center;
  border: 1px solid var(--hairline); border-radius: 999px;
  padding: 3px;
  background: rgba(11, 11, 12, 0.5);
  backdrop-filter: blur(8px);
}
.mode-btn {
  background: none; border: none; cursor: pointer;
  color: var(--bone-dim);
  font-family: var(--sans); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  padding: 8px 16px; border-radius: 999px;
  transition: color 0.3s ease, background 0.3s ease;
}
.mode-btn.is-active { color: var(--ink); background: var(--bone); }
.mode-btn:not(.is-active):hover { color: var(--bone); }
.shuffle-btn {
  background: rgba(11, 11, 12, 0.5);
  backdrop-filter: blur(8px);
  border: 1px solid var(--hairline); border-radius: 999px;
  color: var(--bone); cursor: pointer;
  font-family: var(--sans); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  padding: 11px 18px;
  transition: border-color 0.3s ease, color 0.3s ease;
}
.shuffle-btn:hover { border-color: var(--vermilion); color: var(--vermilion); }

/* ---------- hint ---------- */
.hint {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 10;
  font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--bone-dim);
}
body.is-wishlist .hint { color: var(--vermilion); }

/* ---------- pin marker (html elements on globe) ---------- */
.pin {
  position: relative;
  width: 14px; height: 14px;
  cursor: pointer;
  pointer-events: auto;
}
.pin::before {
  content: ""; position: absolute; inset: 4px;
  border-radius: 50%;
  background: var(--vermilion);
  box-shadow: 0 0 12px rgba(230, 64, 46, 0.9);
}
.pin::after {
  content: ""; position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(230, 64, 46, 0.8);
  animation: ping 2.2s ease-out infinite;
}
@keyframes ping {
  0% { transform: scale(0.6); opacity: 1; }
  80%, 100% { transform: scale(2.4); opacity: 0; }
}
.pin--home::before { background: var(--bone); box-shadow: 0 0 10px rgba(236, 231, 222, 0.8); }
.pin--home::after { border-color: rgba(236, 231, 222, 0.7); }
.pin--upcoming::before, .pin--wish::before { background: transparent; border: 1px solid var(--vermilion); box-shadow: none; }
.pin--upcoming::after, .pin--wish::after { border-color: rgba(230, 64, 46, 0.6); }
.pin__label {
  position: absolute; left: 20px; top: -3px;
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--bone);
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(11, 11, 12, 0.9);
  opacity: 0; transition: opacity 0.3s ease;
}
.pin:hover .pin__label { opacity: 1; }

@media (max-width: 760px) {
  .places { display: none; }
  .hero-title { font-size: clamp(34px, 11vw, 60px); }
}
