/* ==========================================================================
   Popup - a native <dialog> any page can open (inc/popup.php, popup.js),
   plus the sections that can sit in one.

   Loaded on every page that has at least one published popup, after the
   global layer. Every value comes from tokens.css.
   ========================================================================== */

/* --- Shell ------------------------------------------------------------------ */
.popup {
  width: min(var(--popup-max), 100% - 2 * var(--gutter));
  max-width: none;
  max-height: calc(100dvh - 2 * var(--gutter));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-popup);
  background: var(--c-surface);
  color: var(--c-ink-pure);
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Still scrolls by wheel, touch and keyboard - only the bar is hidden. */
  scrollbar-width: none;
}

.popup::-webkit-scrollbar {
  display: none;
}

.popup[open] {
  display: flex;
  flex-direction: column;
  animation: popup-in var(--dur) var(--ease-out);
}

.popup::backdrop {
  background: var(--c-backdrop);
  animation: popup-fade var(--dur) var(--ease-out);
}

/* The page behind stays where it is while the dialog scrolls on its own. */
html:has(.popup[open]) {
  overflow: hidden;
}

@keyframes popup-in {
  from { opacity: 0; transform: translateY(var(--reveal-dist)) scale(0.98); }
}

@keyframes popup-fade {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .popup[open],
  .popup::backdrop {
    animation: none;
  }
}

/* Sticky so it stays reachable when a long popup scrolls on a phone. The
   negative bottom margin takes it out of the flow - the body starts at the
   top edge, as in the design, with the button floating over its corner.
   21px is the design's inset from that corner. */
.popup__close {
  --popup-close-inset: 21px;
  position: sticky;
  top: var(--popup-close-inset);
  z-index: 1;
  align-self: flex-end;
  display: grid;
  place-items: center;
  margin: var(--popup-close-inset) var(--popup-close-inset) calc(-32px - var(--popup-close-inset));
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--c-surface);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}

.popup__close:hover {
  background: var(--c-tab-bg);
}

.popup__close img {
  width: 32px;
  height: 32px;
}

.popup__body {
  padding: var(--space-3xl) var(--space-lg);
}

/* --- Section: tours ------------------------------------------------------- */
.tours {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

.tours__head {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  width: 100%;
}

.tours__title {
  margin: 0;
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-page-title);
  line-height: var(--lh-normal);
  text-align: center;
  text-transform: uppercase;
  color: var(--c-ink-pure);
}

.tours__tabs {
  display: flex;
  gap: var(--space-md);
}

.tours__tab {
  flex: 1 1 0;
  min-width: 0;
  padding: var(--space-sm) var(--space-md);
  border: 0;
  border-radius: var(--radius-card);
  background: var(--c-tab-bg);
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-xl);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-org);
  color: var(--c-tab-ink);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.tours__tab:hover {
  color: var(--c-primary);
}

.tours__tab[aria-selected="true"] {
  background: var(--c-primary-tint);
  color: var(--c-primary);
}

/* The icon is the Figma asset used as a mask, so it takes --c-danger instead
   of the red it was drawn in. */
.tours__notice {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  width: 100%;
  min-height: 56px;
  margin: 0;
  padding: var(--space-sm) var(--space-xl) var(--space-sm) 20px;
  border-radius: var(--radius-md);
  background: var(--c-danger-soft);
  font-family: var(--font-display);
  font-weight: var(--fw-medium);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-field);
  color: var(--c-danger);
}

.tours__notice::before {
  content: "";
  flex: none;
  width: 24px;
  height: 24px;
  background: currentColor;
  -webkit-mask: url("../img/icon-info-danger.svg") center / contain no-repeat;
  mask: url("../img/icon-info-danger.svg") center / contain no-repeat;
}

.tours__footnote {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-h4);
  line-height: var(--lh-normal);
  text-align: center;
  color: var(--c-ink-pure);
}

/* --- One region: its route cards side by side ------------------------------ */
.tours__panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
  width: 100%;
}

.tours__panel[hidden] {
  display: none;
}

/* --- One route: photo card ------------------------------------------------- */
/* Text block on top, button pinned to the bottom-left corner. */
.tour {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
  min-height: 500px;
  padding: var(--space-xl) var(--space-2xl);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--c-ink-ocean);
  color: var(--c-on-dark);
}

.tour__photo {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tour::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--c-tour-overlay);
}

.tour__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.tour__title {
  margin: 0;
  font-family: var(--font-body);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h2);
  line-height: var(--lh-normal);
  text-transform: capitalize;
  color: var(--c-on-dark);
}

/* Design: 9px between the text chips, 12px under the icon chip row. */
.tour__chips {
  --tour-chip-gap: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--tour-chip-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tour__chip-row:not(:last-child) {
  margin-bottom: calc(var(--space-sm) - var(--tour-chip-gap));
}

.tour__chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.tour__chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--c-chip-dark-border);
  border-radius: var(--radius-sm);
  background: var(--c-chip-dark-bg);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  color: var(--c-on-dark-strong);
}

.tour__chip img {
  flex: none;
  width: 20px;
  height: 20px;
}

/* A text-only chip may wrap inside itself - the partner list is a sentence,
   not a label. */
.tour__chip--line {
  display: block;
  max-width: 100%;
  padding-inline: var(--space-md);
}

.tour__desc {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-xl);
  line-height: var(--lh-normal);
  color: var(--c-on-dark);
}

.tour__cta {
  flex: none;
}

/* --- Tablet and phone ------------------------------------------------------ */
@media (max-width: 1023px) {
  .popup {
    border-radius: var(--radius-lg);
  }

  /* Top padding clears the close button: the heading wraps to full width. */
  .popup__body {
    padding: var(--space-4xl) var(--space-md) var(--space-xl);
  }

  .tours__head {
    gap: var(--space-lg);
  }

  .tours__tabs {
    gap: var(--space-xs);
  }

  .tours__tab {
    font-size: var(--fs-body);
  }

  .tours__panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .tour {
    align-items: stretch;
    min-height: 0;
    padding: var(--space-lg) var(--space-md);
  }

  .tour::before {
    background: var(--c-tour-overlay-sm);
  }

  .tour__title {
    font-size: var(--fs-h3);
  }

  .tour__desc {
    font-size: var(--fs-body);
  }

  .tour__cta {
    align-self: stretch;
  }
}

@media (max-width: 479px) {
  .popup {
    width: calc(100% - 2 * var(--space-md));
    max-height: calc(100dvh - 2 * var(--space-md));
    border-radius: var(--radius-md);
  }

  .tours__tab {
    padding-inline: var(--space-xs);
    font-size: var(--fs-sm);
  }

  .tours__notice {
    align-items: flex-start;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--fs-sm);
    line-height: var(--lh-copy);
  }

  .tour__chip {
    font-size: var(--fs-label);
  }
}
