/* Travel Portal vNext layer (#3419) — additive on top of the historical stylesheets.
   Scope: SRS-PERF-001 (reserved heights), SRS-A11Y-001 (focus, hit areas, contrast), SRS-UX-015 (tokens, type floor),
   SRS-UX-016 (dates-only calendar). Nothing here changes price semantics, order of content or product idea. */

:root {
  --tp-accent: #006b5f;
  --tp-accent-strong: #004f46;
  --tp-accent-soft: #e6f3f0;
  --tp-ink: #101620;
  --tp-ink-2: #344054;
  --tp-ink-muted: #5f6877;
  --tp-ink-unavailable: #667085;
  --tp-line: #d9dee7;
  --tp-soft: #f5f7fa;
  --tp-surface: #ffffff;
  --tp-radius: 10px;
  --tp-radius-lg: 14px;
  --tp-space-1: 4px;
  --tp-space-2: 8px;
  --tp-space-3: 12px;
  --tp-space-4: 16px;
  --tp-space-6: 24px;
  --tp-shadow-1: 0 1px 2px rgba(16, 22, 32, 0.06), 0 1px 6px rgba(16, 22, 32, 0.04);
  --tp-shadow-2: 0 10px 28px rgba(16, 22, 32, 0.12);
  --tp-font-floor: 12px;
  --tp-font-body: 14px;
  --tp-font-input: 16px;
  --tp-line-height: 1.5;
  --tp-target: 44px;
  --tp-motion: 160ms;
}

@media (prefers-reduced-motion: reduce) {
  :root { --tp-motion: 0ms; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ---------- SRS-PERF-001: reserve the space late content will take, and keep progress out of the flow ---------- */
/* A pending search (URL has a destination, SSR seed not yet available) keeps the list area reserved until results arrive. */
body.is-search-pending .result-list { min-height: 80vh; }
/* Cold path (no SSR cards yet): the reserved area shows quiet card placeholders instead of a blank screen. */
body.is-search-pending .result-list:empty {
  background-image: repeating-linear-gradient(180deg, rgba(17, 24, 39, .045) 0, rgba(17, 24, 39, .045) 148px, transparent 148px, transparent 160px);
  border-radius: 16px;
}
/* The result status line wraps to two lines on the phone while counts change; keep its box stable.
   The sort control always owns the second row: letting flex-wrap decide from status length moved the whole list by 46px. */
@media (max-width: 700px) {
  body.has-search-results .toolbar { flex-direction: column !important; flex-wrap: nowrap !important; align-items: stretch !important; }
  body.has-search-results .toolbar > div:first-child { width: 100%; min-width: 0; }
  body.has-search-results .toolbar .sort { width: 100%; }
  .toolbar #resultStatus, .toolbar .muted { min-height: 26px; }
}
.recent-searches { min-height: 59px; }
.result-card .price-box { min-height: 107px; }
.price-coverage-status { min-height: 22px; }
.price-calendar-grid { min-height: 52px; }
/* The price-progress card used to appear above the list and push every card down (CLS 0.5 on the phone).
   It now floats as a status toast above the mobile navigation / at the bottom of the desktop viewport. */
.search-progress.active {
  position: fixed;
  left: 50%;
  bottom: calc(48px + 10px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 20px));
  margin: 0;
  z-index: 40;
  box-shadow: var(--tp-shadow-2);
}
@media (min-width: 701px) {
  .search-progress.active { bottom: 16px; }
}

/* ---------- SRS-A11Y-001: one visible focus ring everywhere ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
.result-card:focus-visible,
.price-calendar-day:focus-visible,
.recent-chip:focus-visible,
.popular-preset-chip:focus-visible {
  outline: 3px solid var(--tp-accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--tp-surface);
}
.field:focus-within {
  box-shadow: 0 0 0 3px rgba(0, 107, 95, 0.28);
  border-color: var(--tp-accent);
}
.field:focus-within input:focus-visible,
.field:focus-within select:focus-visible { outline: none; box-shadow: none; }

/* ---------- SRS-A11Y-001: hit areas at least 44px on the primary journey ---------- */
.check-row { min-height: var(--tp-target); padding-top: 8px; padding-bottom: 8px; }
.check-row input { width: 20px; height: 20px; flex: 0 0 20px; }
.check-row.is-filter-unavailable { color: var(--tp-ink-unavailable); }
.check-row.is-filter-unavailable input { opacity: 0.8; }
/* Lighthouse a11y (exact tree, 02.09.2026): unavailable filter group titles, their counters, the photo fallback and the
   mobile summary tag were below 4.5:1 — every text keeps its meaning at AA contrast. */
.filter-subtitle.is-filter-unavailable { color: var(--tp-ink-unavailable); }
.filter-subtitle.is-filter-unavailable .filter-subtitle-count { color: #5b6573; }
.thumb, .thumb .image-fallback-text { color: #3d4b5a; }
.mobile-search-summary strong { color: #00665b; }
.mobile-nav a { min-height: var(--tp-target); display: flex; align-items: center; justify-content: center; font-size: var(--tp-font-floor); padding: 0; }
.mobile-search-summary strong { font-size: 13px; }
.mobile-search-summary span { font-size: var(--tp-font-floor); }
.topbar .brand { min-height: var(--tp-target); display: inline-flex; align-items: center; }
.topbar .nav a { min-height: var(--tp-target); display: inline-flex; align-items: center; padding-left: 6px; padding-right: 6px; }
@media (pointer: coarse), (max-width: 700px) {
  /* .mobile-search-summary stays at the #3244 budget (<= 42px sticky bar); still above the WCAG 2.5.8 24px minimum */
  .btn, .ghost-btn, .recent-chip, .popular-preset-chip, .active-filter-reset, .quick-filter-chip, .mobile-card-details-toggle,
  .result-card .save-row .ghost-btn, .price-actions .btn, .price-actions .ghost-btn { min-height: var(--tp-target); }
  .toolbar select, .toolbar .field { min-height: var(--tp-target); }
  .site-footer a, .travel-trust-footer a { display: inline-block; padding-top: 6px; padding-bottom: 6px; }
}

/* ---------- SRS-UX-015: type floor and rhythm (service text 12px, body 14px, inputs 16px) ---------- */
.filter-subtitle-count, .hotel-group-cell small, .mobile-search-summary strong { font-size: max(var(--tp-font-floor), 1em); }
.date-range-segment small, .date-range-weekdays span, .intent-group-label, .filter-section-label, .filter-subtitle,
.price-calendar-day small, .offer-cell small, .search-map-pin span, .search-map-pin-actions .btn, .search-map-pin-actions .ghost-btn,
body.has-search-results .toolbar .muted, body.has-search-results .result-card .meta { font-size: var(--tp-font-floor); }
.mobile-price-overlay .price-caption { font-size: 13px; }
.description-line, .amenity-line, .match-line, .trust-line, .included-line { line-height: var(--tp-line-height); }
input, select, textarea { font-size: max(var(--tp-font-input), 1em); }

/* ---------- SRS-UX-016: flexible-date calendar as quiet date chips when nothing is priced ---------- */
.price-calendar[data-calendar-mode="dates-only"] .price-calendar-grid { display: flex; flex-wrap: wrap; gap: var(--tp-space-2); }
.price-calendar[data-calendar-mode="dates-only"] .price-calendar-day {
  min-height: var(--tp-target);
  min-width: 0;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--tp-line);
  border-radius: 999px;
  background: var(--tp-surface);
  text-decoration: none;
  color: var(--tp-ink-2);
}
.price-calendar[data-calendar-mode="dates-only"] .price-calendar-day strong { font-size: var(--tp-font-body); font-weight: 600; }
.price-calendar[data-calendar-mode="dates-only"] .price-calendar-day.is-active { border-color: var(--tp-accent); background: var(--tp-accent-soft); color: var(--tp-accent-strong); }

/* ---------- Visual system: calm surfaces, two elevations, one accent (no structural change) ---------- */
.result-card { border-radius: var(--tp-radius-lg); box-shadow: var(--tp-shadow-1); transition: box-shadow var(--tp-motion) ease, transform var(--tp-motion) ease; }
@media (hover: hover) { .result-card:hover { box-shadow: var(--tp-shadow-2); } }
.btn { border-radius: var(--tp-radius); font-weight: 700; }
.ghost-btn { border-radius: var(--tp-radius); }
.badge { border-radius: 999px; }

/* ---------- SRS-MAP-001..003: provider-agnostic map surface, pins, clusters, bottom sheet ---------- */
.search-map-real { position: relative; min-height: 360px; height: clamp(360px, 55vh, 640px); border: 1px solid var(--tp-line); border-radius: var(--tp-radius-lg); overflow: hidden; background: #eef3f1; }
.search-map-real[data-map-state="none"] { display: none; }
.tp-map-canvas { position: absolute; inset: 0; }
.tp-map-fake { background:
  linear-gradient(0deg, rgba(0, 107, 95, 0.06) 1px, transparent 1px) 0 0 / 40px 40px,
  linear-gradient(90deg, rgba(0, 107, 95, 0.06) 1px, transparent 1px) 0 0 / 40px 40px,
  radial-gradient(circle at 30% 70%, #d7ebe6 0, #e9f1ee 40%, #eef3f1 70%); }
.tp-map-overlay { position: absolute; inset: 0; pointer-events: none; }
.tp-map-pin, .tp-map-cluster {
  position: absolute; left: 0; top: 0; pointer-events: auto; margin: 0; z-index: 2;
  transform-origin: 50% 100%; min-height: 36px; padding: 6px 12px; border-radius: 999px;
  border: 2px solid var(--tp-surface); background: var(--tp-ink); color: #fff; font-weight: 700; font-size: 13px; line-height: 1.2;
  box-shadow: var(--tp-shadow-1); cursor: pointer; white-space: nowrap; transition: background var(--tp-motion) ease;
}
.tp-map-pin { translate: -50% -100%; }
.tp-map-cluster { translate: -50% -50%; min-width: 44px; min-height: 44px; border-radius: 999px; background: var(--tp-accent); font-size: 15px; display: inline-flex; align-items: center; justify-content: center; }
.tp-map-pin[data-price-state="request_only"] { background: var(--tp-surface); color: var(--tp-ink); border-color: var(--tp-line); }
.tp-map-pin.is-selected, .tp-map-pin:hover { background: var(--tp-accent); color: #fff; border-color: var(--tp-surface); z-index: 3; }
.tp-map-controls { position: absolute; top: 10px; right: 10px; z-index: 4; display: flex; gap: 8px; }
.tp-map-search-here { background: var(--tp-surface); box-shadow: var(--tp-shadow-1); }
.tp-map-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--tp-surface); border-top: 1px solid var(--tp-line); border-radius: var(--tp-radius-lg) var(--tp-radius-lg) 0 0; box-shadow: var(--tp-shadow-2);
}
.tp-map-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tp-map-sheet-head strong { font-size: 16px; line-height: 1.3; }
.tp-map-sheet-close { min-width: 44px; min-height: 44px; padding: 0; font-size: 22px; line-height: 1; }
.tp-map-sheet-price { margin-top: 4px; font-size: 18px; font-weight: 700; }
.tp-map-sheet-caption { color: var(--tp-ink-muted); font-size: 13px; margin-top: 2px; }
.tp-map-sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tp-map-sheet-actions .btn, .tp-map-sheet-actions .ghost-btn { min-height: var(--tp-target); }
@media (min-width: 701px) {
  .tp-map-sheet { left: auto; right: 12px; bottom: 12px; width: min(360px, calc(100% - 24px)); border-radius: var(--tp-radius-lg); border: 1px solid var(--tp-line); }
}
@media (max-width: 700px) {
  .results-panel.is-map-mode .search-map-real { height: calc(100vh - 220px); min-height: 420px; }
}
/* Mobile keeps the list/map switch once a real provider is configured (#3244 hid it while the map was disabled). */
@media (max-width: 700px) {
  html[data-map-provider]:not([data-map-provider="none"]) body.has-search-results .view-switch { display: grid !important; grid-template-columns: 1fr 1fr; width: 100%; margin: 0 0 10px; }
  html[data-map-provider]:not([data-map-provider="none"]) .view-switch-btn { min-height: var(--tp-target); }
  html[data-map-provider]:not([data-map-provider="none"]) body.has-search-results .search-map-panel:not([hidden]) { display: grid !important; }
  html[data-map-provider]:not([data-map-provider="none"]) body.has-search-results .results-panel.is-map-mode .search-map-real { height: calc(100vh - 240px); min-height: 420px; }
}

/* ---------- SRS-UX-016: mobile page economy on the home page (rails instead of 18 screens of stacked cards) ---------- */
@media (max-width: 700px) {
  .dest-rail.popular-grid, .dest-rail.all-russia-grid, .collection-grid {
    display: flex; flex-wrap: nowrap; gap: 10px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
    padding: 4px 4px 12px; margin: 0 -4px; scrollbar-width: thin; -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 28px), transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 28px), transparent 100%);
  }
  .dest-rail.popular-grid > *, .collection-grid > * { flex: 0 0 min(78vw, 300px); scroll-snap-align: start; }
  .dest-rail.all-russia-grid > * { flex: 0 0 min(62vw, 240px); scroll-snap-align: start; }
  #trust .trust-grid {
    display: flex; flex-wrap: nowrap; gap: 10px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
    padding: 4px 4px 12px; margin: 0 -4px; scrollbar-width: thin;
    mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 28px), transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 28px), transparent 100%);
  }
  #trust .trust-grid > .trust-item { flex: 0 0 min(80vw, 320px); scroll-snap-align: start; }
}
