/*
 * Sunrise Holiday Homes - custom styles
 *
 * Loaded after css/theme.min.css (see inc/enqueue.php).
 *
 * The compiled theme.css / theme.min.css are built from SASS sources that are
 * not bundled with this install, so hand-edits there are easily lost. Put new
 * styles in this file instead - it is plain CSS and needs no build step.
 *
 * Brand colours: $primary #191a66 | $secondary #ed9336 | dark grey #333333
 */


/* ==========================================================================
   Responsive embedded media

   Product descriptions embed YouTube videos via oEmbed, which bakes fixed
   width/height attributes into the markup (540x960 for the phone-shot
   portrait clips, 640x360 for landscape). Neither Bootstrap's reboot nor the
   theme's `max-width: 100%` image rule covers iframes, so on a phone the
   video pushed the document out to 555px against a 375px viewport.

   `body { overflow-x: hidden }` hid the sideways scroll, which is why this
   only showed up as a blank band when pinch-zooming out, and why the video's
   fullscreen control sat off-screen.

   js/custom.js additionally restores each embed's aspect ratio; this rule is
   what stops the overflow, and works on its own if that script fails.
   ========================================================================== */

iframe,
embed,
object,
video {
  max-width: 100%;
}


/* ==========================================================================
   Header - logo
   ========================================================================== */

/*
 * The logo was capped at 250px and sat tight against the top of the navbar.
 * The source image is 400x112, so it can scale up to 400px without blurring.
 */
#main-nav .navbar-brand.custom-logo-link {
  max-width: 240px;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  margin-right: 1rem;
}

@media (min-width: 768px) {
  #main-nav .navbar-brand.custom-logo-link {
    max-width: 280px;
  }
}

@media (min-width: 992px) {
  #main-nav .navbar-brand.custom-logo-link {
    max-width: 300px;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
}

@media (min-width: 1200px) {
  #main-nav .navbar-brand.custom-logo-link {
    max-width: 340px;
  }
}

@media (min-width: 1400px) {
  #main-nav .navbar-brand.custom-logo-link {
    max-width: 380px;
  }
}


/* ==========================================================================
   Header - contact strip
   ========================================================================== */

#above-nav .above-nav__contact p {
  white-space: nowrap;
}

#above-nav .above-nav__contact a:hover {
  color: #ed9336;
}


/* ==========================================================================
   Main navigation - mobile
   Orange dividers between items while the navbar is collapsed.
   ========================================================================== */

@media (max-width: 991.98px) {

  #main-nav #navbarNavDropdown .navbar-nav .nav-item {
    border-bottom: 1px solid #ed9336;
  }

  #main-nav #navbarNavDropdown .navbar-nav > .nav-item:last-child {
    border-bottom: none;
  }

  /* The desktop separator between links makes no sense stacked. */
  #main-nav #navbarNavDropdown .navbar-nav .nav-item .nav-link {
    border-right: none;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  /* Sub-menu items get a lighter divider and an indent so the level reads. */
  #main-nav #navbarNavDropdown .navbar-nav .nav-item .dropdown-menu {
    border-left: 3px solid #ed9336;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0.25rem;
    box-shadow: none;
  }

  #main-nav #navbarNavDropdown .navbar-nav .nav-item .dropdown-menu .nav-item {
    border-bottom: 1px solid rgba(237, 147, 54, 0.45);
  }

  #main-nav #navbarNavDropdown .navbar-nav .nav-item .dropdown-menu .nav-item:last-child {
    border-bottom: none;
  }

  #main-nav #navbarNavDropdown .navbar-nav .nav-item .dropdown-menu .dropdown-item {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
    white-space: normal;
  }
}


/* ==========================================================================
   Product filters (WooCommerce layered nav widgets, left sidebar)
   ========================================================================== */

.filter-options-title {
  margin: 0.5rem 0 1.5rem 0;
  font-size: 1.75rem;
  color: #191a66;
}

.filter-options-title:after {
  background: #ed9336;
  bottom: -8px;
  content: "";
  display: block;
  height: 3px;
  position: relative;
  width: 80px;
}

.woocommerce-widget-layered-nav-list {
  padding-left: 0;
  margin-bottom: 0;
}

.woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item {
  list-style: none;
  padding: 0.35rem 0;
  margin: 0;
}

.woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item a {
  position: relative;
  display: inline-block;
  color: #343a40;
  text-decoration: none;
}

/*
 * The indent that makes room for the tick box needs its own rule.
 * WooCommerce core sets `padding: 1px 0` on this link with a three-class
 * selector, which beats a two-class one - without matching that specificity
 * the padding is dropped and the tick box sits on top of the label text.
 * `.woocommerce` and `.widget_layered_nav` are both on the widget's <aside>.
 */
.woocommerce.widget_layered_nav .woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item a,
.woocommerce .woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item a {
  padding: 1px 0 1px 1.9rem;
}

.woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item a:hover {
  color: #191a66;
}

/*
 * These filters are links, not real inputs, so the tick box is drawn here.
 * The ::before rule also overrides WooCommerce's own "chosen" state, which
 * renders a red cross in the WooCommerce icon font.
 */
.woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item a::before {
  content: "" !important;
  font-family: inherit !important;
  position: absolute;
  left: 0;
  top: 0.25rem;
  width: 1.15rem;
  height: 1.15rem;
  background-color: #fff;
  border: 2px solid #191a66;
  border-radius: 3px;
  color: transparent !important;
  transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item a:hover::before {
  border-color: #ed9336;
}

/* Selected filter: filled box with a white tick. */
.woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item--chosen a,
.woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item.chosen a {
  color: #191a66;
  font-weight: 700;
}

.woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item--chosen a::before,
.woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item.chosen a::before {
  background-color: #ed9336;
  border-color: #ed9336;
}

.woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item--chosen a::after,
.woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item.chosen a::after {
  content: "";
  position: absolute;
  left: 0.4rem;
  top: 0.4rem;
  width: 0.3rem;
  height: 0.62rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Keyboard focus needs to be visible now the box is the only affordance. */
.woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item a:focus::before {
  outline: 2px solid #191a66;
  outline-offset: 2px;
}

.woocommerce-widget-layered-nav-list .woocommerce-widget-layered-nav-list__item .count {
  color: #6c757d;
  font-size: 0.85rem;
}


/* ==========================================================================
   Product cards - image carousel
   Lets shoppers page through a lodge's photos from the listing page.
   ========================================================================== */

/*
 * Stop the carousel blowing out its container.
 *
 * A Swiper track is far wider than the box that clips it, and a flex item's
 * automatic minimum size is its content's min-content width. Left alone, that
 * width propagates up through the product grid to the content column, which
 * then refuses to shrink: on the category pages it pushed the whole product
 * grid below the filter sidebar, and in the narrow sidebar on the FAQ page it
 * stretched a single card to over 12,000px. `min-width: 0` down the chain lets
 * each box shrink to its container again.
 */
#primary,
.content-area,
.woocommerce ul.products li.product,
.woocommerce ul.products li.product .featured-image {
  min-width: 0;
}

.woocommerce ul.products li.product .featured-image .product-thumb-swiper {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.product-thumb-swiper .swiper-slide {
  max-width: 100%;
}

.product-thumb-swiper .swiper-slide img {
  width: 100%;
  max-width: 100%;
}

/* Sits above the slides, below the arrows. */
.woocommerce ul.products li.product .featured-image .featured-price {
  z-index: 2;
}

.product-thumb-nav {
  position: absolute;
  top: calc(50% - 1.25rem);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background-color: rgba(255, 255, 255, 0.85);
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.product-thumb-nav:hover,
.product-thumb-nav:focus {
  background-color: #fff;
  opacity: 1;
  outline: none;
}

.product-thumb-nav:focus-visible {
  outline: 2px solid #191a66;
  outline-offset: 2px;
}

.product-thumb-nav svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: #ed9336;
  pointer-events: none;
}

.product-thumb-prev {
  left: 0.5rem;
}

.product-thumb-next {
  right: 0.5rem;
}

/* Swiper hides these itself when there is only one slide. */
.product-thumb-nav.swiper-button-disabled {
  opacity: 0.3;
  cursor: default;
}

/* Cards are narrow on small screens - keep the arrows out of the way there
   and let touch users swipe instead. */
@media (max-width: 767.98px) {

  .product-thumb-nav {
    width: 1.9rem;
    height: 1.9rem;
    top: calc(50% - 0.95rem);
  }

  .product-thumb-nav svg {
    width: 1.1rem;
    height: 1.1rem;
  }

  .product-thumb-prev {
    left: 0.25rem;
  }

  .product-thumb-next {
    right: 0.25rem;
  }
}

.product-thumb-counter {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 3;
  padding: 0.1rem 0.55rem;
  font-size: 0.75rem;
  color: #fff;
  background-color: rgba(0, 0, 0, 0.6);
  border-radius: 1rem;
}


/* ==========================================================================
   FAQ accordion (Yoast FAQ block on /frequently-asked-questions/)
   Styles apply only once JS has added .faq-accordion - without JS the
   questions and answers stay open and readable.
   ========================================================================== */

.faq-accordion .schema-faq-section {
  border: 1px solid rgba(25, 26, 102, 0.15);
  border-left: 4px solid #ed9336;
  border-radius: 0.35rem;
  margin-bottom: 0.75rem;
  background-color: #fff;
  overflow: hidden;
}

.faq-accordion .schema-faq-question {
  position: relative;
  display: block;
  padding: 1.1rem 3rem 1.1rem 1.25rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #191a66;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  transition: background-color 0.15s ease-in-out;
}

.faq-accordion .schema-faq-question:hover {
  background-color: rgba(237, 147, 54, 0.08);
}

.faq-accordion .schema-faq-question:focus-visible {
  outline: 2px solid #191a66;
  outline-offset: -2px;
}

/* Chevron, rotated when the answer is open. */
.faq-accordion .schema-faq-question::after {
  content: "";
  position: absolute;
  right: 1.5rem;
  top: 1.5rem;
  width: 0.6rem;
  height: 0.6rem;
  border: solid #ed9336;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
  transform-origin: center;
  transition: transform 0.2s ease-in-out;
}

.faq-accordion .schema-faq-section.is-open .schema-faq-question::after {
  transform: rotate(-135deg);
  top: 1.75rem;
}

.faq-accordion .schema-faq-answer {
  margin: 0;
  padding: 0 1.25rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease-in-out, padding 0.25s ease-in-out;
}

.faq-accordion .schema-faq-section.is-open .schema-faq-answer {
  padding: 0.25rem 1.25rem 1.25rem 1.25rem;
  max-height: 200rem;
}

/* Yoast puts a leading <br> in most answers; it leaves a gap when collapsed. */
.faq-accordion .schema-faq-answer > br:first-child {
  display: none;
}
