/* journey.css
   "Two People, Many Boarding Passes" interactive map + modal + lightbox.
   Load after sections.css and before responsive.css. */

/* ---------- LAYOUT ---------- */
  .journey {
    margin-top: 96px;
    max-width: 1040px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
  }
  .journey__title {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(28px, 3.6vw, 44px);
    line-height: 1.15;
    letter-spacing: -0.005em;
    color: var(--ink);
    margin-top: 20px;
  }
  .journey__hint {
    margin-top: 18px;
    font-family: var(--sans);
    font-size: 11px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--ink-mute);
    display: inline-flex;
    align-items: center;
    gap: 12px;
  }
  .journey__hint .cue {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 5px oklch(0.42 0.045 135 / 0.18);
    animation: journeyPulse 2200ms ease-out infinite;
  }

/* ---------- MAP CARD ---------- */
  .journey-map {
    position: relative;
    margin: 40px auto 0;
    width: 100%;
    /* aspect-ratio is set inline by journey.js from the pin bounds. */
    background:
      radial-gradient(circle at 30% 20%, oklch(0.985 0.008 88) 0%, transparent 55%),
      radial-gradient(circle at 80% 90%, oklch(0.97 0.014 90) 0%, transparent 55%),
      var(--paper);
    border-radius: 8px;
    overflow: hidden;
    box-shadow:
      0 1px 0 rgba(0,0,0,.04),
      0 30px 60px -34px rgba(0,0,0,.22),
      0 10px 24px -18px rgba(0,0,0,.10);
    touch-action: none;              /* let JS own pinch / pan */
    -webkit-user-select: none;
    user-select: none;
    cursor: grab;
    overscroll-behavior: contain;
  }
  .journey-map.is-grabbing { cursor: grabbing; }
  .journey-map::after {
    /* Faint compass rose marker in a corner — a tiny bit of "map" flavour. */
    content: "N";
    position: absolute;
    top: 22px;
    left: 22px;
    font-family: var(--sans);
    font-size: 10px;
    letter-spacing: 0.32em;
    color: var(--ink-mute);
    opacity: 0.45;
    z-index: 5;
    padding-left: 12px;
  }
  .journey-map__svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;            /* pointer events belong to the map card + pins */
  }
  /* Land fill — a soft tone that reads as continents without competing. */
  .journey-map__land-fill {
    fill: oklch(0.90 0.020 90);
    opacity: 0.55;
  }
  /* Country borders — the "map" layer. Stroke width is display-scale
     invariant so lines stay crisp whether zoomed in on Europe or out to
     the whole trip. */
  .journey-map__borders path {
    fill: transparent;
    stroke: var(--ink);
    stroke-width: 0.4;
    stroke-linejoin: round;
    stroke-linecap: round;
    opacity: 0.22;
    vector-effect: non-scaling-stroke;
  }

/* ---------- MAP CONTROLS ---------- */
  .journey-map__controls {
    position: absolute;
    right: 14px;
    bottom: 14px;
    z-index: 5;
    display: grid;
    gap: 6px;
    grid-auto-flow: row;
  }
  .journey-map__ctrl {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: oklch(0.985 0.008 88 / 0.9);
    border: 1px solid var(--rule);
    color: var(--ink);
    display: grid;
    place-items: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 6px 14px -8px rgba(0,0,0,.2);
    transition: color 200ms ease, border-color 200ms ease, background 200ms ease, transform 160ms ease, opacity 260ms ease;
    -webkit-tap-highlight-color: transparent;
  }
  .journey-map__ctrl:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--paper);
  }
  .journey-map__ctrl:active { transform: scale(0.94); }
  .journey-map__ctrl svg { width: 14px; height: 14px; }
  .journey-map__ctrl--reset {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
  }
  .journey-map.is-zoomed .journey-map__ctrl--reset {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
  }
  .journey-pin.is-offscreen { visibility: hidden; }

/* ---------- PINS ---------- */
  .journey-map__pins {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;            /* let the map card own pan/pinch on empty space */
  }
  .journey-pin {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    display: grid;
    place-items: center;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto;            /* pins are interactive again */
    opacity: 0;
    animation: journeyPinIn 900ms cubic-bezier(.22,.61,.36,1) forwards;
    animation-delay: var(--pin-delay, 0ms);
  }
  @keyframes journeyPinIn {
    from { opacity: 0; transform: translate(-50%, -60%); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
  }
  .journey-pin__dot {
    position: relative;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow:
      0 0 0 3px oklch(0.42 0.045 135 / 0.18),
      0 2px 6px -1px rgba(0,0,0,0.25);
    transition: transform 260ms cubic-bezier(.22,.61,.36,1), box-shadow 260ms ease;
    z-index: 2;
  }
  .journey-pin__pulse {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.55;
    animation: journeyPulse 2400ms ease-out infinite;
    animation-delay: var(--pin-delay, 0ms);
  }
  @keyframes journeyPulse {
    0%   { transform: scale(1);   opacity: 0.55; }
    80%  { transform: scale(3.4); opacity: 0;    }
    100% { transform: scale(3.4); opacity: 0;    }
  }
  .journey-pin__label {
    position: absolute;
    top: calc(50% + 12px);
    left: 50%;
    transform: translate(-50%, -4px);
    padding: 5px 10px;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 2px;
    white-space: nowrap;
    font-family: var(--sans);
    font-size: 9.5px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--ink);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease, transform 260ms cubic-bezier(.22,.61,.36,1);
    box-shadow: 0 6px 14px -8px rgba(0,0,0,.25);
  }
  .journey-pin:hover .journey-pin__label,
  .journey-pin:focus-visible .journey-pin__label {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  .journey-pin:hover .journey-pin__dot,
  .journey-pin:focus-visible .journey-pin__dot {
    transform: scale(1.3);
    box-shadow:
      0 0 0 5px oklch(0.42 0.045 135 / 0.22),
      0 3px 8px -1px rgba(0,0,0,0.3);
  }
  .journey-pin:focus-visible {
    outline: none;
  }

/* ---------- SPARKLE BURST (Phú Quốc easter egg) ---------- */
  .journey-sparkles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 400;
    overflow: hidden;
  }
  .journey-sparkles__spark {
    position: absolute;
    display: block;
    will-change: transform, opacity;
    filter:
      drop-shadow(0 0 6px rgba(233, 196, 106, 0.75))
      drop-shadow(0 0 2px rgba(255, 240, 180, 0.95));
  }
  .journey-sparkles__spark svg {
    width: 100%;
    height: 100%;
    display: block;
  }
  .journey-sparkles__flash {
    position: absolute;
    display: block;
    width: 110px;
    height: 110px;
    pointer-events: none;
    will-change: transform, opacity;
    background: radial-gradient(circle,
      rgba(255, 240, 180, 0.9) 0%,
      rgba(233, 196, 106, 0.5) 35%,
      rgba(233, 196, 106, 0) 70%);
  }

/* ---------- MODAL ---------- */
  body.journey-lock { overflow: hidden; }

  .journey-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100dvh;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 24px;
  }
  .journey-modal[hidden] { display: none; }
  .journey-modal__backdrop {
    position: absolute;
    inset: 0;
    background: oklch(0.22 0.015 60 / 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 320ms ease;
  }
  .journey-modal.is-open .journey-modal__backdrop { opacity: 1; }

  .journey-modal__card {
    position: relative;
    width: min(720px, 100%);
    max-height: calc(100vh - 48px);
    overflow: hidden;
    background: var(--paper);
    border-radius: 8px;
    box-shadow:
      0 40px 80px -30px rgba(0,0,0,.35),
      0 10px 30px -12px rgba(0,0,0,.18);
    padding: 40px 36px 32px;
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    transition: opacity 380ms cubic-bezier(.22,.61,.36,1),
                transform 460ms cubic-bezier(.22,.61,.36,1);
    display: flex;
    flex-direction: column;
    gap: 18px;
    text-align: left;
  }
  .journey-modal.is-open .journey-modal__card {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  .journey-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    color: var(--ink-mute);
    display: grid;
    place-items: center;
    transition: color 200ms ease, border-color 200ms ease, background 200ms ease, transform 200ms ease;
    z-index: 3;
  }
  .journey-modal__close:hover {
    color: var(--ink);
    border-color: var(--rule);
    background: oklch(0.97 0.014 90);
  }
  .journey-modal__close svg { width: 14px; height: 14px; }

  .journey-modal__eyebrow {
    font-family: var(--sans);
    font-size: 12px;
    letter-spacing: 0.36em;
    text-transform: uppercase;
    color: var(--ink-mute);
    display: flex;
    align-items: center;
    column-gap: 10px;
    row-gap: 6px;
    /* Any translation can push the eyebrow past the card width once
       uppercase letter-spacing is applied — never assume the English
       string's width. The card clips overflow, so wrap instead; each
       phrase keeps its own nowrap below so a word never splits. */
    flex-wrap: wrap;
    white-space: normal;
  }
  .journey-modal__eyebrow > .journey-modal__date,
  .journey-modal__eyebrow > .journey-modal__country {
    white-space: nowrap;
  }
  .journey-modal__eyebrow .dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
    flex-shrink: 0;
  }

  .journey-modal__title {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(30px, 4.2vw, 44px);
    line-height: 1.05;
    color: var(--ink);
    margin: -2px 0 0;
  }

/* ---------- CAROUSEL ---------- */
  .journey-carousel {
    position: relative;
    margin-top: 8px;
  }
  .journey-carousel__viewport {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    background: oklch(0.94 0.014 88);
    aspect-ratio: 4 / 3;
  }
  .journey-carousel__track {
    display: flex;
    height: 100%;
    transition: transform 520ms cubic-bezier(.22,.61,.36,1);
    will-change: transform;
  }
  .journey-carousel__slide {
    flex: 0 0 100%;
    height: 100%;
    display: block;
  }
  .journey-carousel__slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
  }
  .journey-carousel__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: oklch(0.985 0.008 88 / 0.9);
    color: var(--ink);
    display: grid;
    place-items: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 6px 16px -8px rgba(0,0,0,.35);
    transition: background 200ms ease, transform 200ms ease, color 200ms ease;
    z-index: 2;
  }
  .journey-carousel__nav svg { width: 14px; height: 14px; }
  .journey-carousel__nav:hover { background: var(--paper); color: var(--accent); }
  .journey-carousel__nav:active { transform: translateY(-50%) scale(0.94); }
  .journey-carousel__nav--prev { left: 12px; }
  .journey-carousel__nav--next { right: 12px; }

  .journey-carousel__counter {
    position: absolute;
    top: 12px;
    right: 14px;
    padding: 4px 9px;
    background: oklch(0.22 0.015 60 / 0.55);
    color: oklch(0.97 0.012 85);
    font-family: var(--sans);
    font-size: 10px;
    letter-spacing: 0.24em;
    border-radius: 999px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    font-variant-numeric: tabular-nums;
    z-index: 2;
  }

  .journey-carousel__dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
  }
  .journey-carousel__dot {
    width: 6px;
    height: 6px;
    padding: 0;
    border-radius: 50%;
    background: var(--rule);
    border: none;
    cursor: pointer;
    transition: width 240ms ease, background 240ms ease;
  }
  .journey-carousel__dot.is-active {
    background: var(--accent);
    width: 18px;
    border-radius: 3px;
  }

  .journey-carousel.is-single .journey-carousel__dots,
  .journey-carousel.is-single .journey-carousel__nav { display: none; }

/* ---------- LIGHTBOX ---------- */
  .journey-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100dvh;
    z-index: 300;
    display: grid;
    place-items: center;
    background: oklch(0.14 0.010 60 / 0.92);
    padding: 32px;
    opacity: 0;
    transition: opacity 280ms ease;
  }
  .journey-lightbox[hidden] { display: none; }
  .journey-lightbox.is-open { opacity: 1; }
  .journey-lightbox__img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 20px 50px -20px rgba(0,0,0,.6);
    transform: scale(0.96);
    transition: transform 340ms cubic-bezier(.22,.61,.36,1);
  }
  .journey-lightbox.is-open .journey-lightbox__img { transform: scale(1); }
  .journey-lightbox__close,
  .journey-lightbox__nav {
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: oklch(0.985 0.008 88 / 0.1);
    color: oklch(0.97 0.012 85);
    border: 1px solid oklch(0.97 0.012 85 / 0.25);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 200ms ease, transform 200ms ease, border-color 200ms ease;
  }
  .journey-lightbox__close svg,
  .journey-lightbox__nav svg { width: 16px; height: 16px; }
  .journey-lightbox__close:hover,
  .journey-lightbox__nav:hover {
    background: oklch(0.985 0.008 88 / 0.2);
    border-color: oklch(0.97 0.012 85 / 0.55);
  }
  .journey-lightbox__close { top: 22px; right: 22px; }
  .journey-lightbox__nav { top: 50%; transform: translateY(-50%); }
  .journey-lightbox__nav:active { transform: translateY(-50%) scale(0.94); }
  .journey-lightbox__nav--prev { left: 22px; }
  .journey-lightbox__nav--next { right: 22px; }
  .journey-lightbox__counter {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 14px;
    background: oklch(0.985 0.008 88 / 0.14);
    color: oklch(0.97 0.012 85);
    border: 1px solid oklch(0.97 0.012 85 / 0.25);
    border-radius: 999px;
    font-family: var(--sans);
    font-size: 10px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
  }

/* ---------- RESPONSIVE ---------- */
  @media (max-width: 760px) {
    .journey { margin-top: 72px; }
    .journey__hint { font-size: 10px; letter-spacing: 0.24em; text-align: center; }
    .journey-map { border-radius: 6px; margin-top: 32px; }
    .journey-map::after { top: 14px; left: 14px; font-size: 9px; padding-left: 10px; }
    .journey-map__controls { right: 10px; bottom: 10px; gap: 5px; }
    .journey-map__ctrl { width: 30px; height: 30px; }
    .journey-map__ctrl svg { width: 13px; height: 13px; }
    .journey-pin { width: 34px; height: 34px; }
    .journey-pin__label {
      font-size: 8.5px;
      letter-spacing: 0.20em;
      padding: 4px 8px;
      top: calc(50% + 10px);
    }
    .journey-modal {
      padding:
        max(12px, env(safe-area-inset-top))
        12px
        max(12px, env(safe-area-inset-bottom));
      align-items: center;
    }
    .journey-modal__card {
      padding: 30px 20px 22px;
      gap: 14px;
      max-height: 100%;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      border-radius: 10px;
    }
    .journey-modal__title { font-size: clamp(26px, 7vw, 34px); }
    .journey-modal__close { top: 10px; right: 10px; }
    .journey-carousel__nav { width: 34px; height: 34px; }
    .journey-carousel__nav--prev { left: 8px; }
    .journey-carousel__nav--next { right: 8px; }
    .journey-carousel__counter { top: 8px; right: 10px; padding: 3px 8px; }
    .journey-lightbox {
      padding:
        max(14px, env(safe-area-inset-top))
        14px
        max(14px, env(safe-area-inset-bottom));
    }
    .journey-lightbox__close { top: 12px; right: 12px; width: 40px; height: 40px; }
    .journey-lightbox__nav { width: 40px; height: 40px; }
    .journey-lightbox__nav--prev { left: 10px; }
    .journey-lightbox__nav--next { right: 10px; }
    .journey-lightbox__counter { bottom: 14px; padding: 5px 12px; font-size: 9px; }
  }

  @media (max-width: 480px) {
    /* Labels crowd a small map — the pin dot + pulse is enough of a cue,
       and tapping opens the full details anyway. */
    .journey-pin__label { display: none; }
    .journey-pin { width: 40px; height: 40px; }   /* larger tap target */
    .journey-map__controls { right: 8px; bottom: 8px; }
    .journey-modal__card { padding: 28px 16px 20px; }
    .journey-carousel__viewport { aspect-ratio: 3 / 2; }
  }

  @media (prefers-reduced-motion: reduce) {
    .journey-pin { animation: none; opacity: 1; }
    .journey-pin__pulse { animation: none; opacity: 0; }
    .journey__hint .cue { animation: none; }
    .journey-modal__card,
    .journey-modal__backdrop,
    .journey-lightbox,
    .journey-lightbox__img,
    .journey-carousel__track,
    .journey-map__ctrl--reset { transition: none; }
  }
