/* ==========================================================================
   Trip/Hotel preview — two buttons on the offer card + tabbed modal.

   The modal body is filled on demand with the same `object-detail-block`
   markup the /kombination page renders (image strip + meta + attributes +
   description). That markup's styling lives in combination-detail.css, which
   is NOT loaded on the erlebnisreisen page — so the rules it needs are ported
   here, scoped under `.preview-pane`, to avoid colliding with search-list.css.
   ========================================================================== */

/* ── Card preview links ───────────────────────────────────────────────────
   These used to be the only two controls on the card, styled as full-width
   buttons — which read as "the" action and left the card without one. They are
   now quiet text links sitting in the meta row, one weight below the card's own
   "Reise ansehen & buchen" CTA, because that is what they are: a look inside,
   not the way forward. */
.trip-previews {
  display: inline-flex; align-items: center;
  gap: 6px 14px; flex-wrap: wrap;
  min-width: 0;
}
.trip-preview-btn {
  min-width: 0;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 0;
  border: 0; background: none;
  font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: rgba(90, 104, 118, 0.35);
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color .15s ease, text-decoration-color .15s ease;
}
.trip-preview-btn > span {
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.trip-preview-btn:hover,
.trip-preview-btn:focus-visible {
  color: var(--brand-deep);
  text-decoration-color: currentColor;
}
.trip-preview-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(244, 155, 6, 0.22);
  border-radius: 4px;
}
.trip-preview-btn svg {
  width: 14px; height: 14px; flex-shrink: 0;
  color: var(--muted-2);
  transition: color .15s ease;
}
.trip-preview-btn:hover svg,
.trip-preview-btn:focus-visible svg { color: var(--brand-deep); }
@media (max-width: 640px) {
  /* Comfortable tap targets without turning them back into buttons. */
  .trip-previews { gap: 4px 18px; }
  .trip-preview-btn { min-height: 34px; }
}

/* ── Modal shell ──────────────────────────────────────────────────────── */
body.preview-open { overflow: hidden; }
/* The gallery is opened from inside this modal, so its portal must sit above
   the preview dialog while retaining the normal lightbox layer elsewhere. */
body.preview-open .lb { z-index: 1100; }

.preview-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.preview-modal[hidden] { display: none; }
.preview-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(11, 23, 34, 0.55);
  opacity: 0;
  transition: opacity .2s ease;
}
.preview-modal.is-open .preview-modal__backdrop { opacity: 1; }
.preview-modal__dialog {
  position: relative;
  background: #fff;
  border-radius: var(--radius-md);
  width: min(760px, 100%);
  max-height: 88vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.45);
  transform: translateY(8px) scale(.985);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}
.preview-modal.is-open .preview-modal__dialog { transform: none; opacity: 1; }

/* ── Header + tabs ────────────────────────────────────────────────────── */
.preview-modal__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 12px 16px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.preview-tabs { display: flex; gap: 6px; }
.preview-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font: inherit; font-size: 13.5px; font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.preview-tab svg { width: 15px; height: 15px; }
.preview-tab:hover { color: var(--ink); border-color: #d8dde3; }
.preview-tab.is-active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.preview-tab[hidden] { display: none; }
.preview-modal__close {
  width: 38px; height: 38px; flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  display: grid; place-items: center;
  transition: color .15s ease, border-color .15s ease;
}
.preview-modal__close:hover { color: var(--brand); border-color: #d8dde3; }
.preview-modal__close svg { width: 18px; height: 18px; }

/* ── Body / states ────────────────────────────────────────────────────── */
.preview-modal__body {
  padding: 22px 24px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
.preview-pane[hidden] { display: none; }
.preview-modal__state {
  display: flex; align-items: center; gap: 10px;
  padding: 30px 4px;
  color: var(--muted);
  font-size: 14px;
}
.preview-modal__state[hidden] { display: none; }
.preview-modal__state--error { color: #b4232a; }
.preview-spinner {
  width: 18px; height: 18px; flex: 0 0 auto;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: preview-spin .7s linear infinite;
}
@keyframes preview-spin { to { transform: rotate(360deg); } }

/* ── Footer CTA ───────────────────────────────────────────────────────── */
.preview-modal__foot {
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end;
  flex: 0 0 auto;
}
.preview-modal__foot[hidden] { display: none; }
.preview-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 800; font-size: 14px;
  text-decoration: none;
  transition: background .15s ease, transform .15s ease;
}
.preview-cta:hover { background: var(--brand-deep); transform: translateX(2px); }
.preview-cta svg { width: 16px; height: 16px; }

/* ── Injected object-detail-block content (ported, scoped) ────────────── */
.preview-pane .block h2 {
  font-size: 19px; font-weight: 800; letter-spacing: -0.01em;
  line-height: 1.2; margin: 0 0 12px;
  display: flex; align-items: center; gap: 10px;
}
.preview-pane .block h2 .num { display: none; } /* tab already labels the section */
.preview-pane .object-meta { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }
.preview-pane .object-meta .stars { color: var(--brand); font-weight: 700; }
.preview-pane .attr-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.preview-pane .attr-list .pill {
  font-size: 11px; font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
}

/* Horizontal image strip — each tile opens the shared fullscreen viewer. */
.preview-pane .object-strip { position: relative; max-width: 100%; margin: 0 0 18px; }
.preview-pane .object-strip::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 18px; width: 48px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0), #fff 80%);
  pointer-events: none;
}
.preview-pane .object-strip__track {
  display: flex; gap: 10px;
  overflow-x: auto; overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  padding: 6px 4px 16px; margin: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(11, 23, 34, 0.22) transparent;
}
.preview-pane .object-strip__track::-webkit-scrollbar { height: 8px; }
.preview-pane .object-strip__track::-webkit-scrollbar-thumb { background: rgba(11, 23, 34, 0.22); border-radius: 999px; }
.preview-pane .object-strip__track::-webkit-scrollbar-track { background: transparent; }
.preview-pane .object-strip__tile {
  position: relative; flex: 0 0 auto;
  width: clamp(150px, 42vw, 210px);
  aspect-ratio: 4 / 3;
  border: 0; padding: 0; margin: 0;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  scroll-snap-align: start;
  box-shadow: 0 1px 3px rgba(11, 23, 34, 0.08);
  transition: transform .2s ease, box-shadow .2s ease;
}
.preview-pane .object-strip__tile img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: transform .4s cubic-bezier(.2, .7, .2, 1);
}
.preview-pane .object-strip__tile:hover { box-shadow: 0 8px 20px -6px rgba(11, 23, 34, .28); }
.preview-pane .object-strip__tile:hover img { transform: scale(1.05); }
.preview-pane .object-strip__tile:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand), 0 0 0 5px rgba(244, 155, 6, .25);
}

.preview-pane .object-desc {
  position: relative;
  font-size: 14px; line-height: 1.65; color: #2a333c;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 20px 22px;
  background: var(--surface-2);
}
/* Same clamp as the offer page. The pane scrolls as one column, so the
   description must not open a second scroll area inside it. */
.preview-pane .object-desc--clamped {
  max-height: 240px;
  overflow: hidden;
  transition: max-height .38s cubic-bezier(.4, .2, .2, 1);
}
.preview-pane .object-desc--clamped::after {
  content: "";
  position: absolute;
  inset: auto 1px 1px;
  height: 96px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: linear-gradient(180deg, rgba(247, 248, 250, 0) 0%, rgba(247, 248, 250, .92) 62%, var(--surface-2) 100%);
  transition: opacity .28s ease;
  pointer-events: none;
}
.preview-pane .object-desc--clamped.is-expanded::after { opacity: 0; }
.preview-pane .object-desc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.preview-pane .object-desc-toggle:hover { border-color: var(--brand); background: #fff8ed; }
.preview-pane .object-desc-toggle:focus-visible { outline: 3px solid rgba(244, 155, 6, 0.4); outline-offset: 2px; }
.preview-pane .object-desc-toggle__chevron {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor;
  stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .28s cubic-bezier(.4, .2, .2, 1);
}
.preview-pane .object-desc-toggle[aria-expanded="true"] .object-desc-toggle__chevron { transform: rotate(180deg); }
.preview-pane .object-desc img, .preview-pane .object-desc table { max-width: 100%; }
.preview-pane .object-desc p { margin: 0 0 12px; }
.preview-pane .object-desc p:last-child { margin-bottom: 0; }
.preview-pane .object-desc strong, .preview-pane .object-desc b { color: var(--ink); font-weight: 700; }
.preview-pane .object-desc ul, .preview-pane .object-desc ol { margin: 4px 0 16px; padding-left: 22px; }
.preview-pane .object-desc ul { list-style: disc; }
.preview-pane .object-desc ol { list-style: decimal; }
.preview-pane .object-desc li { margin: 0 0 6px; padding-left: 4px; }
.preview-pane .object-desc li::marker { color: var(--brand); }

@media (prefers-reduced-motion: reduce) {
  .preview-modal__backdrop, .preview-modal__dialog { transition: none; }
  .preview-spinner { animation-duration: 1.4s; }
  .preview-pane .object-strip__tile,
  .preview-pane .object-strip__tile img,
  .preview-pane .object-desc--clamped,
  .preview-pane .object-desc--clamped::after,
  .preview-pane .object-desc-toggle,
  .preview-pane .object-desc-toggle__chevron { transition: none; }
}

@media (max-width: 560px) {
  .preview-modal { padding: 0; }
  .preview-modal__dialog {
    width: 100%; height: 100%; max-height: 100%;
    height: 100dvh; max-height: 100dvh;
    border-radius: 0;
  }
  .preview-tab { min-height: 44px; padding: 8px 13px; font-size: 12.5px; }
  .preview-modal__close { width: 44px; height: 44px; }
  .preview-modal__body { padding: 18px 16px; }
  .preview-modal__foot { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .trip-preview-btn { min-height: 44px; font-size: 12px; padding: 8px 10px; }
  .preview-pane .object-desc { padding: 18px 16px; }
  .preview-pane .object-desc--clamped { max-height: 200px; }
  .preview-pane .object-desc-toggle { width: 100%; justify-content: center; }
}
