/* Room Rates — visibility states for the card price block.
 *
 * Paired with room-rates.js and loaded on the same two pages. The price starts
 * hidden and is revealed only when a real rate has been written into it, so a
 * failed or slow request never flashes the placeholder number.
 *
 * Height is reserved while hidden, so revealing the price does not shift the
 * card layout underneath it. */

[data-room-rate="wrap"] {
  visibility: hidden;
  transition: opacity 0.2s ease;
  opacity: 0;
}

[data-room-rate="wrap"][data-room-rate-status="ready"] {
  visibility: visible;
  opacity: 1;
}

/* Sold out beyond the search horizon, or not mapped to a Cloudbeds room type.
 * Stays invisible but keeps occupying its space, so cards with and without a
 * price stay the same height in the grid. */
[data-room-rate="wrap"][data-room-rate-status="unavailable"] {
  visibility: hidden;
  opacity: 0;
}

/* The struck-out undiscounted rate.
 *
 * Hidden unless the script finds a genuine saving, so a room with no discount
 * shows nothing rather than a stray number — which is what every room becomes
 * on any day no promotion is running. display:none rather than visibility so
 * the block collapses instead of reserving empty space.
 *
 * Two rules, because the number has a "THB" label as a SIBLING rather than a
 * child. Hiding only the number would strand that label on its own. The second
 * rule hides whichever direct child of the wrap contains the number, which also
 * covers the extra nesting level the /rooms markup has. Both are written with
 * :not() rather than a paired show rule, so a revealed element keeps whatever
 * display Webflow gave it instead of being forced to block. */
[data-room-rate="base"]:not([data-room-rate-status="ready"]) {
  display: none;
}

[data-room-rate="wrap"]
  > *:has([data-room-rate="base"]:not([data-room-rate-status="ready"])) {
  display: none;
}

/* Struck through across the whole original-price row, so the "THB" label is
 * struck along with the figure rather than sitting upright beside it.
 * text-decoration propagates to descendants and cannot be cancelled by them,
 * so setting it on the row covers both without touching either child.
 *
 * The second rule is the fallback for markup that places the number directly
 * in the wrap with no row around it, which the row selector cannot match. */
[data-room-rate="wrap"] > *:has([data-room-rate="base"]) {
  text-decoration: line-through;
}

[data-room-rate="base"] {
  text-decoration: line-through;
}

@media (prefers-reduced-motion: reduce) {
  [data-room-rate="wrap"] {
    transition: none;
  }
}
