/* ==========================================================================
   WayUgo — Responsive Layer

   Approach: mobile-first. Card grids use auto-fit and need no queries; this
   file only handles (a) fixed multi-column shells that must earn their extra
   columns, and (b) the small-screen behaviour of the header and search widget.

   Breakpoints (the familiar ones, so a framework added later lines up):
     sm  ≥ 576px   phones landscape
     md  ≥ 768px   tablets
     lg  ≥ 992px   laptops        ← main desktop switch
     xl  ≥ 1200px  desktops
     xxl ≥ 1400px  large screens
   ========================================================================== */

/* --------------------------------------------------------------------------
   MOBILE-ONLY BASE (< 992px)
   The desktop nav is hidden until lg; the drawer takes over.
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  :root {
    --wu-header-height: var(--wu-header-height-mobile);
    --wu-fs-3xl: 1.875rem;
    --wu-fs-4xl: 2.25rem;
  }

  .wu-nav { display: none; }

  .wu-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 44px, not 42: the primary control on every mobile page, and 44 is the
       comfortable target size both platform guidelines settle on. */
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: var(--wu-radius);
    background: transparent;
    color: inherit;
    cursor: pointer;
    order: -1;
  }
  .wu-nav-toggle svg { width: 22px; height: 22px; }

  .wu-header-inner { gap: var(--wu-space-3); }
  .wu-topbar { display: none; }

  /* Transparent headers go solid on small screens — text over hero art is
     unreliable once the hero crops to portrait. */
  .wu-header-transparent {
    position: relative;
    background-color: var(--wu-surface);
    border-bottom-color: var(--wu-border);
  }
  .wu-header-transparent .wu-nav-link,
  .wu-header-transparent .wu-icon-btn,
  .wu-header-transparent .wu-logo { color: var(--wu-text); }
  /* header.css tô riêng .wu-logo-mark màu trắng cho header trong suốt; rule
     của .wu-logo ở trên không chạm tới nó, nên thiếu dòng này thì nửa sau
     của tên thương hiệu thành chữ trắng trên nền trắng. */
  .wu-header-transparent .wu-logo-mark { color: var(--wu-primary); }
  /* Cùng lý do với nút Trip: header.css cho nó viền, nền và icon màu trắng.
     Giá trị ở đây chép từ .wu-header-transparent.is-stuck — cùng một trạng
     thái "nền đặc", chỉ là tới bằng breakpoint thay vì bằng cuộn trang. */
  .wu-header-transparent .wu-trip-btn {
    border-color: var(--wu-border);
    background: var(--wu-surface);
    color: var(--wu-text);
  }
  .wu-header-transparent .wu-trip-btn .wu-trip-ico { color: var(--wu-primary); }
  .wu-header-transparent .wu-logo-light { display: none; }
  .wu-header-transparent .wu-logo-dark  { display: block; }

  /* Search widget: stack every field, full-width submit.
     The widget drops below the hero rather than overlapping it, so the overlap
     token goes to zero and the hero stops reserving space for it. */
  :root { --wu-search-overlap: 0rem; }
  .wu-search-floating { margin-top: var(--wu-space-5); }
  .wu-search-panels   { padding: var(--wu-space-4); }
  .wu-search-row      { grid-template-columns: 1fr; }
  .wu-search-submit .wu-btn { width: 100%; }

  /* Stacked fields turn the seam horizontal - but the seam is NOT the second
     input's top edge, because a label now sits between the two inputs. The
     run of space between the two input boxes is the row gap, plus the label,
     plus the field's own gap below it; anchoring to the input's top edge put
     the button at the bottom of that run, 21px low, overlapping the label and
     reading as part of the "To" field rather than as the control that swaps
     the two. Half that run puts it back on the centre of the gap, clear of
     both inputs, over the empty right-hand end of the label.

     Every term is the token that creates the space, so this stays correct if
     the label size or the gaps are retuned. */
  .wu-swap-btn {
    top: calc(
      (var(--wu-space-3) + var(--wu-fs-sm) * var(--wu-lh-base) + var(--wu-space-2)) / -2);
    left: auto;
    /* Logical, so an RTL build mirrors it to the other end on its own. */
    inset-inline-end: var(--wu-space-3);
    transform: translateY(-50%);
  }
  .wu-swap-btn:hover { transform: translateY(-50%) rotate(180deg); }

  /* List cards fall back to the vertical card layout. */
  .wu-card-list { flex-direction: column; }
  .wu-card-list .wu-card-media { width: 100%; aspect-ratio: 16 / 9; }
  .wu-card-list .wu-card-footer {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: start;
    border-inline-start: 0;
    border-top: 1px solid var(--wu-border);
  }

  .wu-masonry { column-count: 1; }

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

  .wu-sticky { position: static; }
}

/* --------------------------------------------------------------------------
   PHONES (< 576px)
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
  :root {
    --wu-fs-2xl: 1.5rem;
    --wu-fs-3xl: 1.625rem;
    --wu-fs-4xl: 2rem;
  }

  /* Roughly half the desktop rhythm, which moved up a step. */
  .wu-section    { padding-block: var(--wu-space-7); }
  .wu-section-lg { padding-block: var(--wu-space-8); }
  /* The inner-page banner kept its 48px desktop rhythm on a phone while every
     content band halved around it, which read as dead space above the fold. */
  .wu-page-head  { padding-block: var(--wu-space-5); }

  .wu-container { padding-inline: var(--wu-space-4); }

  .wu-grid,
  .wu-grid-2,
  .wu-grid-4 { grid-template-columns: 1fr; }

  .wu-panel { padding: var(--wu-space-4); }

  /* Step labels drop away; the numbered dots still convey progress. */
  .wu-steps li span { display: none; }
  .wu-steps li { flex: 1 1 0; }

  /* Option rows stack so prices don't crush the title. */
  .wu-option { flex-wrap: wrap; }
  .wu-option-price { width: 100%; text-align: start; }
  .wu-option img { width: 100%; }

  .wu-footer-main { grid-template-columns: 1fr; }
  .wu-newsletter-form { flex-direction: column; }
  .wu-newsletter-form .wu-btn { width: 100%; }

  /* The toolbar wraps to three rows on a phone: [Filters] [count], then the
     sort select, then the view switcher. The select already asked for 100%,
     but it is inside a .wu-cluster that shrinks to its content, so 100% of
     that was not 100% of the bar - and the switcher below it sat stranded at
     156px with the rest of the row empty. Let the cluster take the full row
     and both children fill it. */
  .wu-filter-bar { padding: var(--wu-space-3); }
  .wu-filter-bar .wu-select { width: 100%; min-width: 0; }
  .wu-filter-bar > .wu-cluster { flex: 1 1 100%; }

  /* The count keeps the Filters button company on the first row rather than
     leaving a gap between them and the edge. */
  .wu-filter-bar .wu-filter-bar-count { margin-inline-start: auto; }

  /* Three equal segments across the bar, so the switcher reads as a control
     and not as an orphaned block. */
  .wu-filter-bar .wu-view-switch { display: flex; width: 100%; }
  .wu-filter-bar .wu-view-switch button,
  .wu-filter-bar .wu-view-switch a { flex: 1; width: auto; }

  .wu-to-top { right: var(--wu-space-4); bottom: var(--wu-space-4); width: 42px; height: 42px; }

  /* Full-width popovers beat clipped ones on a 360px viewport. */
  .wu-popover { position: fixed; left: var(--wu-space-4); right: var(--wu-space-4); min-width: 0; }
}

/* --------------------------------------------------------------------------
   TABLETS (≥ 576px)
   -------------------------------------------------------------------------- */
@media (min-width: 576px) {
  .wu-masonry { column-count: 2; }
}

/* --------------------------------------------------------------------------
   MEDIUM (≥ 768px)
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
  .wu-footer-main { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wu-section-head { flex-wrap: nowrap; }
}

/* --------------------------------------------------------------------------
   DESKTOP (≥ 992px) — the main layout switch
   -------------------------------------------------------------------------- */
@media (min-width: 992px) {
  .wu-listing        { grid-template-columns: 300px minmax(0, 1fr); }
  .wu-booking-layout { grid-template-columns: minmax(0, 1fr) 360px; }

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

  .wu-masonry { column-count: 3; }

  /* Drawer is desktop-irrelevant — make sure a stale .is-open can't leak. */
  .wu-nav-drawer,
  .wu-drawer-backdrop { display: none; }

  /* Filter sidebar scrolls with the results column. */
  .wu-listing-sidebar {
    position: sticky;
    top: calc(var(--wu-header-height) + var(--wu-space-4));
    max-height: calc(100vh - var(--wu-header-height) - var(--wu-space-6));
    overflow-y: auto;
  }
}

/* --------------------------------------------------------------------------
   LARGE (≥ 1200px)
   -------------------------------------------------------------------------- */
@media (min-width: 1200px) {
  .wu-listing { grid-template-columns: 320px minmax(0, 1fr); }
  .wu-masonry { column-count: 3; }
}

/* --------------------------------------------------------------------------
   EXTRA LARGE (≥ 1400px)
   -------------------------------------------------------------------------- */
@media (min-width: 1400px) {
  :root { --wu-container-max: 1320px; }
  .wu-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* --------------------------------------------------------------------------
   TOUCH DEVICES
   Hover-only affordances must have a resting state on touch.
   -------------------------------------------------------------------------- */
@media (hover: none) {
  .wu-card:hover { transform: none; }
  .wu-card:hover .wu-card-media img { transform: none; }
  .wu-card-wish { background: rgba(255, 255, 255, .95); }
  .wu-hover-underline::after { display: none; }
}

/* --------------------------------------------------------------------------
   NARROWEST PHONES (≤ 380px)
   A 320px viewport is 288px of usable width. Three places asked for more than
   that and could not shrink, because a flex item never goes below its
   min-content width - so instead of wrapping they widened the whole page.
   -------------------------------------------------------------------------- */
@media (max-width: 380px) {
  /* Checkout header: logo (159px) + "Secure checkout" (135px) = 294px.
     The note drops to its own line rather than pushing the page sideways. */
  [data-page="booking"] .wu-header-inner {
    flex-wrap: wrap;
    height: auto;
    padding-block: var(--wu-space-3);
  }
  [data-page="booking"] .wu-header-actions { margin-inline-start: 0; }

  /* Two full-width buttons rather than two half-width ones that do not fit. */
  .wu-booking-nav > .wu-btn { flex: 1 1 100%; justify-content: center; }
}
