/* ==========================================================================
   Responsive behaviour
   Tested widths: 320, 375, 768, 1024, 1440
   ========================================================================== */

/* ---------- ≤ 1280 ---------- */
@media (max-width: 1280px) {
  .nav__link {
    padding-inline: 0.6rem;
  }

  .nav__link::after {
    left: 0.6rem;
    right: 0.6rem;
  }

  .search-panel {
    grid-template-columns: 1.3fr 1fr 1fr 1fr;
    row-gap: var(--s-1);
  }

  .search-panel .field:nth-child(5)::before {
    display: none;
  }

  .search-panel__submit {
    grid-column: span 2;
    margin-left: 0;
    width: 100%;
    min-height: 56px;
  }

  .article-layout {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .article-layout > .article-aside {
    grid-column: 2;
  }
}

/* ---------- ≤ 1100: compact header ---------- */
@media (max-width: 1100px) {
  .nav,
  .btn--header,
  .header-account,
  .header-currency {
    display: none;
  }

  .menu-toggle {
    display: inline-grid;
  }

  .header-actions {
    margin-left: auto;
  }

  .style-grid {
    grid-template-columns: repeat(5, minmax(220px, 1fr));
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    padding-bottom: var(--s-4);
    scrollbar-width: none;
  }

  .style-grid::-webkit-scrollbar {
    display: none;
  }

  .style-grid > * {
    scroll-snap-align: start;
  }

  .style-grid .card-cat:nth-child(even) {
    margin-top: 0;
  }

  .scroller--4 {
    grid-auto-columns: minmax(280px, 42%);
  }

  .season-panel {
    grid-template-columns: repeat(2, 1fr);
  }

  .season-intro {
    grid-column: 1 / -1;
  }

  .footer-top {
    grid-template-columns: repeat(3, 1fr);
  }

  .footer-about {
    grid-column: 1 / -1;
  }

  .type-tiles {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- ≤ 1024: tablet ---------- */
@media (max-width: 1024px) {
  :root {
    --header-h: 68px;
  }

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

  .dest-mosaic {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    height: auto;
  }

  .dest-mosaic .card-dest {
    aspect-ratio: 4 / 5;
  }

  .dest-mosaic__lead {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .dest-mosaic .dest-mosaic__lead {
    aspect-ratio: 16 / 10;
  }

  /* Filters become a full-screen drawer */
  .listing {
    grid-template-columns: minmax(0, 1fr);
  }

  .filters {
    position: fixed;
    inset: 0;
    z-index: var(--z-drawer);
    display: flex;
    flex-direction: column;
    max-height: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    overflow: hidden;
    visibility: hidden;
    transform: translateY(100%);
    transition: transform var(--t-base) var(--ease-out), visibility var(--t-base);
  }

  .filters.is-open {
    visibility: visible;
    transform: none;
  }

  .filters__head {
    display: none;
  }

  .filters__mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--s-3) var(--gutter);
    border-bottom: 1px solid var(--c-line);
  }

  .filters [data-filters-form] {
    flex: 1;
    overflow-y: auto;
    padding: 0 var(--gutter);
  }

  .filters__mobile-foot {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: var(--s-3);
    padding: var(--s-4) var(--gutter);
    border-top: 1px solid var(--c-line);
    background: var(--c-white);
  }

  .filters-open {
    display: inline-flex;
  }

  /* Detail pages: single column, sticky bottom CTA */
  .detail-layout,
  .booking-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-aside {
    order: -1;
  }

  .detail-aside .sticky-aside,
  .booking-layout .sticky-aside {
    position: static;
  }

  .detail-aside--booking {
    order: 1;
  }

  .mobile-cta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: calc(var(--z-header) - 1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-4);
    padding: var(--s-3) var(--gutter);
    padding-bottom: calc(var(--s-3) + env(safe-area-inset-bottom));
    background: var(--c-white);
    border-top: 1px solid var(--c-line);
    box-shadow: 0 -8px 24px -12px rgba(20, 45, 58, 0.2);
    transform: translateY(110%);
    transition: transform var(--t-base) var(--ease-out);
  }

  .mobile-cta.is-visible {
    transform: none;
  }

  .has-mobile-cta .site-footer {
    padding-bottom: 80px;
  }

  .has-mobile-cta .compare-bar,
  .has-mobile-cta .toast-region {
    bottom: 90px;
  }

  .subnav__cta {
    display: none;
  }

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

  .article-layout > .article-aside {
    grid-column: auto;
  }

  .toc {
    display: none;
  }

  .why__inner {
    grid-template-columns: 1fr;
  }

  .why__media {
    max-width: 560px;
  }

  .why__card {
    right: var(--s-4);
  }

  .guides-feature {
    grid-template-columns: 1fr;
    gap: var(--s-8);
  }

  .about-intro {
    grid-template-columns: 1fr;
  }

  .contact-layout {
    grid-template-columns: 1fr;
  }

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

  .side-nav {
    position: sticky;
    top: var(--header-h);
    z-index: 5;
    margin-inline: calc(var(--gutter) * -1);
    padding: var(--s-2) var(--gutter);
    background: rgba(247, 248, 245, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--c-line);
  }

  .side-nav ul {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .side-nav ul::-webkit-scrollbar {
    display: none;
  }

  .side-nav a,
  .side-nav button {
    width: auto;
    white-space: nowrap;
  }

  .side-nav .side-nav__extra {
    display: none;
  }
}

/* ---------- ≤ 900 ---------- */
@media (max-width: 900px) {
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .faq-split,
  .newsletter {
    grid-template-columns: 1fr;
  }

  .newsletter {
    gap: var(--s-8);
  }

  .promise-grid {
    grid-template-columns: 1fr;
    gap: var(--s-6);
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .timeline-h {
    grid-template-columns: repeat(2, 1fr);
    row-gap: var(--s-10);
  }

  .is-list .card-trip,
  .is-list .card-dest-row {
    flex-direction: column;
  }

  .is-list .card-trip .card__media,
  .is-list .card-dest-row .card__media {
    width: 100%;
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .booking-item {
    grid-template-columns: 140px minmax(0, 1fr);
  }

  .booking-item > :last-child {
    grid-column: 1 / -1;
  }

  .hero__credit {
    display: none;
  }
}

/* ---------- ≤ 768: large phones / small tablets ---------- */
@media (max-width: 768px) {
  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s-4);
  }

  .section-head--center {
    align-items: center;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: var(--s-8);
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }

  .gallery-mosaic {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 2fr 1fr;
    height: clamp(320px, 90vw, 520px);
  }

  .gallery-mosaic button:first-child {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .gallery-mosaic button:nth-child(n + 4) {
    display: none;
  }

  .date-row {
    grid-template-columns: 1fr auto;
    row-gap: var(--s-2);
  }

  .date-row > :nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }

  .date-row > :nth-child(3) {
    grid-row: 2;
  }

  .date-row > :nth-child(4) {
    grid-row: 2;
    grid-column: 2;
  }

  .climate__chart {
    gap: 3px;
    height: 180px;
  }

  .climate__rain {
    display: none;
  }

  .compare-bar__label {
    display: none;
  }

  .trust-head {
    align-items: flex-start;
  }

  .about-collage img:last-child {
    margin-top: var(--s-8);
  }

  .article-hero__media {
    aspect-ratio: 4 / 3;
  }

  .booking-step {
    padding: var(--s-5);
  }

  .modal {
    padding: 0;
    align-items: end;
  }

  .modal__dialog {
    max-height: 92vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }

  .lightbox__stage {
    padding: 0 var(--s-2);
  }

  .lightbox__nav {
    top: auto;
    bottom: -56px;
    transform: none;
  }

  .lightbox__caption {
    padding-inline: 64px;
  }
}

/* ---------- ≤ 640: phones ---------- */
@media (max-width: 640px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero {
    min-height: 100svh;
    align-items: flex-end;
    padding-bottom: 7.5rem;
  }

  .hero::before {
    background: linear-gradient(180deg, rgba(10, 26, 34, 0.5) 0%, rgba(10, 26, 34, 0.38) 30%, rgba(10, 26, 34, 0.62) 60%, rgba(10, 26, 34, 0.88) 100%);
  }

  .hero__actions .btn {
    flex: 1 1 100%;
  }

  .hero__proof {
    gap: var(--s-2);
    flex-direction: column;
    margin-top: var(--s-6);
  }

  .hero-search {
    margin-top: -4.5rem;
  }

  /* Stacked, touch-friendly search */
  .search-panel {
    grid-template-columns: 1fr 1fr;
    padding: var(--s-3);
    gap: var(--s-2);
  }

  .search-panel .field {
    padding: 0.75rem 0.9rem;
    border: 1.5px solid var(--c-line);
    border-radius: var(--r-sm);
  }

  .search-panel .field::before {
    display: none;
  }

  .search-panel .field--dest,
  .search-panel .field--travellers {
    grid-column: 1 / -1;
  }

  .search-panel input,
  .search-panel select,
  .search-panel .field-trigger {
    min-height: 32px;
    font-size: var(--fs-base);
  }

  .search-panel__submit {
    grid-column: 1 / -1;
  }

  .popover {
    max-width: calc(100vw - 2 * var(--gutter) - 1.5rem);
  }

  .suggest-item {
    min-width: 0;
  }

  .travellers-pop {
    left: 0;
    right: 0;
    min-width: 0;
    width: auto;
  }

  .dest-mosaic {
    grid-template-columns: 1fr;
  }

  .dest-mosaic .card-dest,
  .dest-mosaic .dest-mosaic__lead {
    aspect-ratio: 4 / 5;
  }

  .card-dest .card__text {
    max-height: none;
    opacity: 1;
  }

  .season-panel {
    grid-template-columns: 1fr;
  }

  .season-panel .card-dest {
    min-height: 380px;
  }

  .scroller--4 {
    grid-auto-columns: 84%;
  }

  .guides-feature__list .card-guide {
    grid-template-columns: 110px 1fr;
    gap: var(--s-4);
  }

  .rating-summary {
    width: 100%;
  }

  .footer-top {
    grid-template-columns: 1fr;
  }

  .newsletter-form__row {
    flex-direction: column;
    border-radius: var(--r-md);
  }

  .newsletter-form__row input {
    min-height: 48px;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar__controls {
    width: 100%;
  }

  .toolbar__controls .select {
    flex: 1;
  }

  .view-toggle span {
    display: none;
  }

  .detail-hero__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .booking-item {
    grid-template-columns: 1fr;
  }

  .stats {
    gap: var(--s-4);
  }

  .timeline::before {
    left: 19px;
  }

  .timeline__item {
    padding-left: 54px;
  }

  .timeline__marker {
    width: 40px;
    height: 40px;
    font-size: 0.65rem;
  }

  .compare-bar {
    padding-left: var(--s-3);
  }

  .compare-bar__thumb {
    width: 42px;
    height: 42px;
  }

  .why__card {
    position: relative;
    right: auto;
    bottom: auto;
    max-width: none;
    margin-top: calc(var(--s-12) * -1);
    margin-inline: var(--s-4);
  }

  .type-tiles {
    grid-template-columns: repeat(2, 1fr);
  }

  .tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
    padding-inline: 0.75rem;
  }
}

/* ---------- ≤ 380: small phones (320–375) ---------- */
@media (max-width: 380px) {
  .logo__text small {
    display: none;
  }

  .logo {
    font-size: 1.15rem;
  }

  .header-actions .icon-btn {
    width: 40px;
  }

  .search-panel {
    grid-template-columns: 1fr;
  }

  .search-panel .field {
    grid-column: 1 / -1;
  }

  .btn--lg {
    padding-inline: 1.25rem;
  }

  .card__body {
    padding: var(--s-4) var(--s-5) var(--s-5);
  }

  .exp-facts {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .timeline-h {
    grid-template-columns: 1fr;
  }
}

/* ---------- Large screens ---------- */
@media (min-width: 1600px) {
  :root {
    --container: 1400px;
  }
}

/* ---------- Print ---------- */
@media print {
  .site-header,
  .site-footer,
  .mobile-cta,
  .compare-bar,
  .subnav,
  .heart-btn,
  .nav-drawer,
  .search-overlay {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .detail-hero {
    min-height: 0;
    color: var(--c-ink);
  }

  .detail-hero__media {
    display: none;
  }

  details {
    display: block;
  }

  details > * {
    display: block !important;
  }
}

@media (max-width: 640px) {
  .booking-nav {
    flex-wrap: wrap;
  }

  .booking-nav__total {
    order: -1;
    width: 100%;
    text-align: right;
  }

  .booking-nav [data-next] {
    flex: 1;
  }
}

@media (max-width: 900px) {
  .timeline-h li::before {
    right: 0;
  }
}

@media (max-width: 640px) {
  .detail-main .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fact__icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }
}

@media (max-width: 640px) {
  .hero__proof li + li::before {
    display: none;
  }
}
