/* public/passport-home.css
 * Etherwave Passport — home page (the view that loads after splash).
 * All styles scoped to #passport-home-container to avoid collision with the
 * existing list/map/carousel views.
 */

#passport-home-container {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #050308;
  font-family: 'Mulish', -apple-system, system-ui, sans-serif;
  color: #f0e9dd;
  overflow: hidden;
}

/* ── Cosmic background — vertical twilight gradient ────────────────────── */
#passport-home-container .ph-space {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 92%,
      rgba(200, 100, 55, 0.32) 0%,
      rgba(120, 50, 50, 0.20) 18%,
      rgba(40, 22, 38, 0.0)  45%,
      transparent 70%),
    linear-gradient(180deg,
      #060410 0%,
      #0e0a1c 28%,
      #1a1020 55%,
      #1a0e14 80%,
      #060306 100%);
  z-index: 0;
}

#passport-home-container .ph-stars,
#passport-home-container .ph-stars-far {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 1px;
  background: transparent;
  z-index: 1;
  pointer-events: none;
}

#passport-home-container .ph-stars {
  box-shadow:
    -540px 80px 0 #fff, -460px 150px 0 #d4af6a, -380px 70px 0 #fff,
    -300px 120px 0 #fff, -220px 200px 0.5px #fff, -140px 100px 0 #d4af6a,
    -60px 180px 0 #fff, 20px 90px 0 #fff, 100px 140px 0 #d4af6a,
    180px 60px 0 #fff, 260px 130px 0 #fff, 340px 90px 0.5px #fff,
    420px 170px 0 #fff, 500px 110px 0 #d4af6a, 580px 80px 0 #fff,
    -620px 220px 0 #fff, -500px 280px 0 #fff, -380px 240px 0 #d4af6a,
    -260px 300px 0 #fff, -140px 260px 0 #fff, -20px 320px 0 #fff,
    100px 280px 0 #d4af6a, 220px 240px 0 #fff, 340px 300px 0 #fff,
    460px 260px 0.5px #fff, 580px 220px 0 #fff,
    -600px 360px 0 #fff, -480px 400px 0 #d4af6a, -360px 380px 0 #fff,
    -240px 420px 0 #fff, -120px 360px 0 #fff, 0px 400px 0 #d4af6a,
    120px 380px 0 #fff, 240px 420px 0 #fff, 360px 360px 0 #fff,
    480px 400px 0.5px #fff, 600px 380px 0 #fff,
    -680px 480px 0.5px #fff, -560px 520px 0 #fff, -440px 500px 0 #d4af6a,
    -320px 540px 0 #fff, -200px 480px 0 #fff, -80px 520px 0 #fff,
    40px 540px 0 #d4af6a, 160px 500px 0 #fff, 280px 540px 0 #fff,
    400px 480px 0 #fff, 520px 520px 0.5px #fff, 640px 500px 0 #fff;
  animation: ph-twinkle 4s ease-in-out infinite;
}

#passport-home-container .ph-stars-far {
  box-shadow:
    -700px 50px 0 rgba(255,255,255,0.3), -550px 90px 0 rgba(255,255,255,0.4),
    -400px 30px 0 rgba(255,255,255,0.3), -250px 60px 0 rgba(255,255,255,0.5),
    -100px 110px 0 rgba(255,255,255,0.3), 50px 40px 0 rgba(255,255,255,0.4),
    200px 80px 0 rgba(255,255,255,0.3), 350px 50px 0 rgba(255,255,255,0.4),
    500px 100px 0 rgba(255,255,255,0.3), 650px 70px 0 rgba(255,255,255,0.4),
    -650px 180px 0 rgba(255,255,255,0.3), -500px 220px 0 rgba(255,255,255,0.4),
    -350px 160px 0 rgba(255,255,255,0.3), -200px 240px 0 rgba(255,255,255,0.4),
    -50px 200px 0 rgba(255,255,255,0.3), 100px 250px 0 rgba(255,255,255,0.4),
    250px 200px 0 rgba(255,255,255,0.3), 400px 260px 0 rgba(255,255,255,0.4),
    550px 220px 0 rgba(255,255,255,0.3), 700px 180px 0 rgba(255,255,255,0.4);
  animation: ph-twinkle 6s ease-in-out infinite reverse;
}

@keyframes ph-twinkle {
  0%, 100% { opacity: 0.85; }
  50%      { opacity: 0.45; }
}

/* ── 3D globe canvas ────────────────────────────────────────────────────
   Stage shifted down 100px (was top: 0) so the globe and glow sit lower,
   leaving a sky-only band at the top for the twilight gradient to breathe. */
#passport-home-container .ph-globe-stage {
  position: absolute;
  top: 100px;             /* was 0 — 100px sky gap above the globe */
  left: 50%;
  transform: translateX(-50%);
  width: 145vh;
  height: 145vh;
  max-width: 1600px;
  max-height: 1600px;
  z-index: 2;
  pointer-events: none;
}

#passport-home-container #ph-globe-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#passport-home-container .ph-globe-stage::after {
  content: '';
  position: absolute;
  inset: 6% 6% 6% 6%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 55%,
      rgba(232, 120, 60, 0.24) 0%,
      rgba(190, 90, 55, 0.12) 28%,
      rgba(120, 60, 70, 0.04) 55%,
      transparent 72%);
  filter: blur(28px);
  z-index: -1;
  pointer-events: none;
}

/* ── City label overlay ─────────────────────────────────────────────────
   Sibling of the canvas inside .ph-globe-stage. Each .ph-city-label is
   positioned absolutely; transforms set per frame from passport-home.js. */
#passport-home-container .ph-city-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

#passport-home-container .ph-city-label {
  position: absolute;
  top: 0;
  left: 0;
  font-family: 'Mulish', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(240, 233, 221, 0.62);
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.85),
    0 0 6px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  /* No CSS transition — labels update every frame, transitions would lag. */
  will-change: transform, opacity;
}

/* ── Foreground page ───────────────────────────────────────────────────── */
#passport-home-container .ph-page {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Icon nav ──────────────────────────────────────────────────────────── */
#passport-home-container .ph-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px;
}

#passport-home-container .ph-nav-icons {
  display: flex;
  gap: 10px;
}

#passport-home-container .ph-nav-icon,
#passport-home-container .ph-nav-avatar-btn {
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid rgba(184, 150, 62, 0.30);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d4af6a;
  cursor: pointer;
  transition: all .2s;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  font-family: inherit;
}

#passport-home-container .ph-nav-icon svg,
#passport-home-container .ph-nav-avatar-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#passport-home-container .ph-nav-icon:hover,
#passport-home-container .ph-nav-avatar-btn:hover {
  background: rgba(184, 150, 62, 0.14);
  border-color: #b8963e;
  color: #f0e9dd;
  box-shadow: 0 0 18px rgba(184, 150, 62, 0.28);
  transform: translateY(-1px);
}

#passport-home-container .ph-nav-icon:active,
#passport-home-container .ph-nav-avatar-btn:active {
  transform: translateY(0);
}

/* ── Passport card ─────────────────────────────────────────────────────── */
#passport-home-container .ph-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px 60px;
}

#passport-home-container .ph-passport-card {
  width: 100%;
  max-width: 580px;
  background: rgba(20, 16, 10, 0.40);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  border: 1px solid rgba(184, 150, 62, 0.22);
  border-radius: 18px;
  padding: 32px 36px 0;
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.65),
    0 0 90px rgba(184, 150, 62, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 1px 0 rgba(212, 175, 106, 0.20) inset;
  position: relative;
  overflow: hidden;
}

#passport-home-container .ph-passport-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(184, 150, 62, 0.35), transparent);
  z-index: 1;
}

#passport-home-container .ph-passport-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at 25% 0%, rgba(212,175,106,0.07), transparent 55%);
  z-index: 0;
}

#passport-home-container .ph-passport-card > * {
  position: relative;
  z-index: 2;
}

/* ── Header ────────────────────────────────────────────────────────────── */
#passport-home-container .ph-card-header {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(184, 150, 62, 0.22);
}

#passport-home-container .ph-eyebrow {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: #b8963e;
  font-weight: 700;
  margin-bottom: 6px;
}

#passport-home-container .ph-holder-name {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.05;
  color: #f0e9dd;
  margin: 0;
}

#passport-home-container .ph-holder-sub {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: rgba(240, 233, 221, 0.52);
  font-weight: 600;
}

#passport-home-container .ph-header-meta {
  margin-top: 14px;
  display: flex;
  gap: 22px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: rgba(240, 233, 221, 0.55);
  font-weight: 600;
}

#passport-home-container .ph-header-meta .ph-item .ph-lbl {
  display: block;
  margin-bottom: 2px;
}

#passport-home-container .ph-header-meta .ph-item .ph-v {
  color: #d4af6a;
  font-weight: 600;
  letter-spacing: 0.08em;
}

/* ── Year tabs ─────────────────────────────────────────────────────────── */
#passport-home-container .ph-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
  overflow-x: auto;
  scrollbar-width: none;
}

#passport-home-container .ph-tabs::-webkit-scrollbar {
  display: none;
}

#passport-home-container .ph-tab {
  flex-shrink: 0;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 18px;
  color: rgba(240, 233, 221, 0.55);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

#passport-home-container .ph-tab.active {
  background: rgba(184, 150, 62, 0.14);
  border-color: rgba(184, 150, 62, 0.35);
  color: #d4af6a;
}

#passport-home-container .ph-tab:hover:not(.active) {
  color: #f0e9dd;
  border-color: rgba(184, 150, 62, 0.22);
}

/* ── Stats grid ────────────────────────────────────────────────────────── */
#passport-home-container .ph-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: rgba(184, 150, 62, 0.22);
  border: 1px solid rgba(184, 150, 62, 0.22);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 22px;
}

#passport-home-container .ph-stat {
  background: rgba(10, 8, 6, 0.55);
  padding: 14px 18px 16px;
}

#passport-home-container .ph-stat .ph-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: rgba(240, 233, 221, 0.62);
  font-weight: 700;
  margin-bottom: 5px;
}

#passport-home-container .ph-stat .ph-value {
  font-size: 32px;
  font-weight: 700;
  color: #f0e9dd;
  line-height: 1;
  letter-spacing: -0.02em;
}

#passport-home-container .ph-stat .ph-value .ph-accent {
  color: #d4af6a;
  font-size: 14px;
  font-weight: 500;
  margin-left: 5px;
  letter-spacing: 0;
}

#passport-home-container .ph-stat .ph-sub {
  margin-top: 5px;
  font-size: 11px;
  color: rgba(240, 233, 221, 0.62);
  font-weight: 500;
}

#passport-home-container .ph-stat.disabled .ph-value {
  color: rgba(240, 233, 221, 0.40);
  font-size: 20px;
}

#passport-home-container .ph-stat.disabled .ph-sub {
  color: rgba(184, 150, 62, 0.48);
  font-style: italic;
}

#passport-home-container .ph-stat.span-2 {
  grid-column: span 2;
}

/* ── Flag strip ────────────────────────────────────────────────────────── */
#passport-home-container .ph-flags-block {
  margin-bottom: 20px;
}

#passport-home-container .ph-flags-heading {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(240, 233, 221, 0.62);
  font-weight: 700;
  margin-bottom: 10px;
}

#passport-home-container .ph-flags-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(184, 150, 62, 0.35) transparent;
  mask-image: linear-gradient(90deg, transparent 0%, black 4%, black 96%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 4%, black 96%, transparent 100%);
}

#passport-home-container .ph-flags-row::-webkit-scrollbar {
  height: 4px;
}

#passport-home-container .ph-flags-row::-webkit-scrollbar-thumb {
  background: rgba(184, 150, 62, 0.35);
  border-radius: 2px;
}

#passport-home-container .ph-flag-tile {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: rgba(10, 8, 6, 0.45);
  border: 1px solid rgba(184, 150, 62, 0.22);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  transition: transform .18s ease, border-color .18s, background .18s, box-shadow .18s;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#passport-home-container .ph-flag-tile:hover {
  transform: translateY(-2px) scale(1.08);
  border-color: #b8963e;
  background: rgba(184, 150, 62, 0.10);
  box-shadow: 0 4px 14px rgba(184, 150, 62, 0.22);
}

#passport-home-container .ph-flag-more-pill {
  flex-shrink: 0;
  align-self: center;
  padding: 4px 12px;
  margin-left: 4px;
  background: rgba(184, 150, 62, 0.12);
  color: #d4af6a;
  border: 1px solid rgba(184, 150, 62, 0.35);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  height: 40px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  transition: background .18s, color .18s;
}

#passport-home-container .ph-flag-more-pill:hover {
  background: rgba(184, 150, 62, 0.20);
  color: #f0e9dd;
}

/* ── MRZ footer ────────────────────────────────────────────────────────── */
#passport-home-container .ph-mrz {
  margin: 0 -36px;
  padding: 14px 24px;
  background: rgba(184, 150, 62, 0.05);
  border-top: 1px solid rgba(184, 150, 62, 0.35);
  border-radius: 0 0 18px 18px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  color: #d4af6a;
  line-height: 1.5;
  overflow-x: auto;
  white-space: nowrap;
  text-align: center;
  scrollbar-width: none;
}

#passport-home-container .ph-mrz::-webkit-scrollbar {
  display: none;
}

#passport-home-container .ph-mrz .ph-glyph {
  color: #d4af6a;
}

#passport-home-container .ph-mrz .ph-symbol {
  color: #b8963e;
}

/* ── Home button injected into sub-views ──────────────────────────────── */
.ph-home-btn-injected {
  /* Inherits .mapicons.orange styling — see existing CSS */
}

/* ── Mobile ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #passport-home-container .ph-nav {
    padding: 16px 18px;
  }
  #passport-home-container .ph-nav-icon,
  #passport-home-container .ph-nav-avatar-btn {
    width: 40px;
    height: 40px;
  }
  #passport-home-container .ph-nav-icon svg,
  #passport-home-container .ph-nav-avatar-btn svg {
    width: 19px;
    height: 19px;
  }
  #passport-home-container .ph-stage {
    padding: 6px 14px 60px;
  }
  #passport-home-container .ph-passport-card {
    padding: 24px 22px 0;
    border-radius: 16px;
    background: rgba(20, 16, 10, 0.32);
  }
  #passport-home-container .ph-card-header {
    margin-bottom: 18px;
    padding-bottom: 14px;
  }
  #passport-home-container .ph-holder-name {
    font-size: 26px;
  }
  #passport-home-container .ph-tabs {
    margin-bottom: 18px;
  }
  #passport-home-container .ph-stats {
    margin-bottom: 18px;
  }
  #passport-home-container .ph-stat {
    padding: 12px 14px 14px;
  }
  #passport-home-container .ph-stat .ph-value {
    font-size: 26px;
  }
  #passport-home-container .ph-stat.disabled .ph-value {
    font-size: 17px;
  }
  #passport-home-container .ph-flag-tile {
    width: 36px;
    height: 36px;
    font-size: 20px;
    border-radius: 7px;
  }
  #passport-home-container .ph-flag-more-pill {
    height: 36px;
  }
  #passport-home-container .ph-mrz {
    margin: 0 -22px;
    font-size: 9px;
    padding: 12px 16px;
    border-radius: 0 0 16px 16px;
  }
  /* Mobile globe stage — smaller sky gap (mobile viewport is shorter) */
  #passport-home-container .ph-globe-stage {
    top: 60px;
    width: 130vh;
    height: 130vh;
  }
  /* Smaller labels on mobile so they don't crowd the sphere */
  #passport-home-container .ph-city-label {
    font-size: 8px;
    letter-spacing: 0.08em;
  }
}

@media (max-width: 380px) {
  #passport-home-container .ph-holder-name {
    font-size: 22px;
  }
  #passport-home-container .ph-stat .ph-value {
    font-size: 22px;
  }
  #passport-home-container .ph-header-meta {
    gap: 16px;
    font-size: 9px;
  }
}

/* ── Anti-flash: prevent sub-views from showing through the passport ──── */
#passport-home-container:not([style*="none"]) ~ #country-list-container,
#passport-home-container:not([style*="none"]) ~ #carousell-container,
#passport-home-container:not([style*="none"]) ~ .map-container {
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ── Mobile scroll: allow passport page to scroll on short viewports ──── */
#passport-home-container .ph-page {
  overflow-y: auto;
  max-height: 100vh;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#passport-home-container .ph-page::-webkit-scrollbar {
  display: none;
}

/* ── Splash → passport reveal transition ──────────────────────────────── */
.ph-passport-card {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.ph-passport-card.ph-revealed {
  opacity: 1;
  transform: translateY(0);
}
.ph-nav {
  opacity: 0;
  transition: opacity 0.6s ease 0.3s;
}
.ph-nav.ph-revealed {
  opacity: 1;
}
