:root {
  --bg: #050a1a;
  --bg-2: #0b1430;
  --card: rgba(14, 24, 52, 0.72);
  --text: #eef3ff;
  --muted: rgba(214, 224, 247, 0.66);
  --edge: rgba(148, 178, 255, 0.14);
  --sky: #7dd3fc;
  --pink: #f472b6;
  --gold: #fbbf24;
  --gradient: linear-gradient(110deg, #7dd3fc, #c4b5fd 50%, #f472b6);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.3, 1.45, 0.5, 1);
  --serif: "Fraunces", Georgia, serif;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: dark;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 70px;
}

body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(1200px 700px at 70% 10%, #102356 0%, transparent 60%), var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 3px;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
}

.grad {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-style: italic;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* A slow drift of stars behind everything. */
.stars {
  position: fixed;
  inset: -50% 0 0;
  z-index: -1;
  background-image:
    radial-gradient(1px 1px at 20px 30px, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 120px 80px, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 200px 150px, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 300px 40px, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 360px 200px, rgba(255, 255, 255, 0.6), transparent);
  background-size: 400px 260px;
  opacity: 0.6;
  animation: drift 120s linear infinite;
}

/* ============ Header ============ */

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px var(--gutter);
  background: linear-gradient(rgba(5, 10, 26, 0.9), rgba(5, 10, 26, 0.6));
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--edge);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
}
.logo svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--sky);
  stroke-width: 1.8;
  animation: spin 24s linear infinite;
}
.nav nav {
  display: flex;
  gap: 20px;
  margin-left: auto;
}
.nav nav a {
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
}
.nav nav a:hover {
  color: var(--text);
}
.trip-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.08);
  font-weight: 600;
  cursor: pointer;
}
.count:not(:empty) {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--pink);
  color: #2a0718;
  font-size: 0.78rem;
  font-weight: 700;
}
.count.bump {
  animation: bump 0.5s var(--spring);
}

/* ============ Explore: list on the left, globe on the right ============ */

.explore {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.25fr);
  min-height: calc(100svh - 64px);
}
.panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 36px var(--gutter) 30px;
  max-height: calc(100svh - 64px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 178, 255, 0.25) transparent;
}
.intro > * {
  opacity: 0;
  translate: 0 18px;
  transition:
    opacity 0.8s var(--ease),
    translate 0.9s var(--ease);
}
.ready .intro > * {
  opacity: 1;
  translate: none;
}
.intro > :nth-child(2) {
  transition-delay: 0.08s;
}
.intro > :nth-child(3) {
  transition-delay: 0.16s;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--sky);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
h1 {
  margin: 0 0 12px;
  font-size: clamp(2.6rem, 5.5vw, 4.4rem);
}
.lede {
  margin: 0;
  color: var(--muted);
}
.filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 7px 14px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: 0.88rem;
  cursor: pointer;
  transition:
    background-color 0.25s,
    color 0.25s,
    transform 0.25s var(--spring);
}
.chip:hover {
  color: var(--text);
  transform: translateY(-1px);
}
.chip[aria-pressed="true"] {
  border-color: transparent;
  background: var(--gradient);
  color: #0a1024;
  font-weight: 600;
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}
.toggle input {
  position: absolute;
  opacity: 0;
}
.switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(148, 178, 255, 0.2);
  transition: background-color 0.25s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.3s var(--spring);
}
.toggle input:checked + .switch {
  background: var(--sky);
}
.toggle input:checked + .switch::after {
  transform: translateX(18px);
}
.toggle input:focus-visible + .switch {
  outline: 2px solid var(--sky);
  outline-offset: 3px;
}

.places {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.places.in li {
  animation: rise 0.45s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 35ms);
}
.place {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--edge);
  border-radius: 16px;
  background: var(--card);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.25s,
    background-color 0.25s,
    transform 0.25s var(--ease);
}
.place:hover {
  border-color: rgba(125, 211, 252, 0.4);
  transform: translateX(4px);
}
.place[aria-pressed="true"] {
  border-color: var(--pink);
  background: linear-gradient(90deg, rgba(244, 114, 182, 0.14), var(--card));
}
.place-name {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 700;
}
.place-name small {
  margin-left: 8px;
  color: var(--muted);
  font-family: "Inter", sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
}
.place-meta {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.85rem;
}
.now-badge {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.16);
  color: #6ee7b7;
  font-size: 0.75rem;
  font-weight: 600;
}
.in-trip {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  color: var(--pink);
  font-weight: 700;
}
.empty {
  margin: 0;
  color: var(--muted);
}

.globe-wrap {
  position: sticky;
  top: 64px;
  height: calc(100svh - 64px);
  overflow: hidden;
}
#globe {
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: scale(0.92);
  transition:
    opacity 1.2s var(--ease),
    transform 1.4s var(--ease);
  touch-action: none;
}
.has-3d #globe {
  opacity: 1;
  transform: none;
}
.globe-fallback,
.globe-hint {
  position: absolute;
  left: 50%;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  translate: -50% 0;
}
.globe-fallback {
  top: 45%;
}
.globe-hint {
  top: 16px;
  letter-spacing: 0.08em;
}
.pin-label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(5, 10, 26, 0.85);
  border: 1px solid rgba(244, 114, 182, 0.5);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  translate: -50% calc(-100% - 14px);
}

/* The detail card rises over the bottom of the globe. */
.detail {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  max-width: 460px;
  padding: 22px 24px;
  border: 1px solid var(--edge);
  border-radius: 22px;
  background: rgba(8, 16, 38, 0.82);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
}
.detail.swap {
  animation: card-in 0.55s var(--ease);
}
.detail .close {
  position: absolute;
  top: 14px;
  right: 14px;
}
.detail-country {
  margin: 0;
  color: var(--sky);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.detail h2 {
  margin: 4px 0 6px;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}
.detail-weather {
  margin: 0 0 10px;
  color: #fde68a;
  font-size: 0.9rem;
}
.detail-blurb {
  margin: 0 0 14px;
  color: var(--muted);
}
.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}
.facts dt {
  color: var(--muted);
  font-size: 0.75rem;
}
.facts dd {
  margin: 2px 0 0;
  font-weight: 600;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.25s var(--spring),
    background-color 0.25s;
}
.button:hover {
  transform: translateY(-2px);
}
.button.primary {
  border-color: transparent;
  background: var(--gradient);
  color: #0a1024;
}
.button.primary[aria-pressed="true"] {
  background: rgba(244, 114, 182, 0.18);
  color: var(--pink);
  border-color: rgba(244, 114, 182, 0.5);
}
.button.small {
  padding: 7px 14px;
  font-size: 0.88rem;
}
.close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: transform 0.3s var(--spring);
}
.close:hover {
  transform: rotate(90deg);
}

/* ============ How it works ============ */

.how {
  padding: 100px var(--gutter);
  border-top: 1px solid var(--edge);
}
.how h2 {
  margin: 0 0 40px;
  font-size: clamp(2rem, 4vw, 3rem);
  text-align: center;
}
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}
.steps li {
  padding: 28px;
  border: 1px solid var(--edge);
  border-radius: 24px;
  background: var(--card);
}
.steps h3 {
  margin: 16px 0 8px;
  font-size: 1.4rem;
}
.steps p {
  margin: 0;
  color: var(--muted);
}
.step-icon svg {
  width: 52px;
  height: 52px;
  fill: none;
  stroke: var(--sky);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.step-icon .dash {
  stroke: var(--pink);
  stroke-dasharray: 4 5;
  animation: march 1.4s linear infinite;
}
.reveal {
  opacity: 0;
  translate: 0 30px;
  transition:
    opacity 0.8s var(--ease),
    translate 0.9s var(--ease);
  transition-delay: calc(var(--i, 0) * 110ms);
}
.reveal.in {
  opacity: 1;
  translate: none;
}

/* ============ Trip bar and drawer ============ */

.trip-bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 8px 8px 18px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: rgba(8, 16, 38, 0.9);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  font-size: 0.9rem;
  animation: bar-in 0.5s var(--spring);
}
/* On wide screens the bar sits under the list, clear of the details card on the globe. */
@media (min-width: 901px) {
  .trip-bar {
    left: var(--gutter);
  }
}

.trip {
  width: min(440px, 100%);
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--edge);
  background: #081028;
  color: var(--text);
}
.trip[open] {
  display: flex;
  flex-direction: column;
  animation: slide-in 0.45s var(--ease);
}
.trip::backdrop {
  background: rgba(2, 5, 14, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.trip > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--edge);
}
.trip h2 {
  margin: 0;
  font-size: 1.6rem;
}
.stops {
  flex: 1;
  margin: 0;
  padding: 12px 22px;
  overflow-y: auto;
  list-style: none;
  counter-reset: stop;
}
.stops li {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  animation: rise 0.4s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 50ms);
}
/* A dotted route line joins the numbered stops. */
.stops li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 46px;
  bottom: -12px;
  border-left: 2px dotted rgba(244, 114, 182, 0.5);
}
.stop-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gradient);
  color: #0a1024;
  font-weight: 700;
}
.stops strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.1rem;
}
.stops span {
  color: var(--muted);
  font-size: 0.82rem;
}
.stop-actions {
  display: flex;
  gap: 4px;
}
.icon {
  width: 30px;
  height: 30px;
  border: 1px solid var(--edge);
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.icon:disabled {
  opacity: 0.3;
  cursor: default;
}
.trip .empty {
  flex: 1;
  padding: 24px 22px;
}
.trip-summary {
  padding: 18px 22px 24px;
  border-top: 1px solid var(--edge);
}
.totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.totals dt {
  color: var(--muted);
  font-size: 0.75rem;
}
.totals dd {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 700;
}
.note {
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 0.8rem;
}
.trip-actions {
  display: flex;
  gap: 10px;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 26px var(--gutter) 90px;
  border-top: 1px solid var(--edge);
  color: var(--muted);
  font-size: 0.84rem;
}
.footer p {
  margin: 0;
}

/* ============ Keyframes ============ */

@keyframes drift {
  to {
    transform: translateY(50%);
  }
}
@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
}
@keyframes bump {
  40% {
    transform: scale(1.35);
  }
}
@keyframes march {
  to {
    stroke-dashoffset: -18;
  }
}
@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
}
@keyframes bar-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
}

/* ============ Smaller screens ============ */

@media (max-width: 900px) {
  .nav nav {
    display: none;
  }
  .trip-button {
    margin-left: auto;
  }
  .explore {
    grid-template-columns: minmax(0, 1fr);
  }
  .globe-wrap {
    position: relative;
    top: 0;
    order: -1;
    height: auto;
  }
  #globe {
    height: 54svh;
  }
  .globe-hint {
    display: none;
  }
  .panel {
    max-height: none;
    overflow: visible;
    padding-top: 10px;
  }
  /* Below the globe on phones, so the chosen pin stays in sight. */
  .detail {
    position: relative;
    inset: auto;
    max-width: none;
    margin: -24px 12px 4px;
    padding: 16px 18px;
  }
  .detail-blurb {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .steps {
    grid-template-columns: minmax(0, 1fr);
  }
  .trip-bar {
    width: calc(100% - 24px);
    justify-content: space-between;
    translate: -50% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .intro > *,
  .reveal,
  #globe {
    opacity: 1;
    translate: none;
    transform: none;
  }
}
