/*
Theme Name: fd-bootstrap5
Theme URI: https://underscores.me/
Author: Underscores.me
Author URI: https://underscores.me/
Description: Custom Bootstrap 5 theme for The Fascia Division
Version: 1.0.0
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: fd-bootstrap5
*/

/* ==========================================================================
   Brand Variables & Tweaks (Matches The Fascia Division Spec)
   ========================================================================== */
:root {
    --primary-red: #ed1b24;
    --primary-red-hover: #c9151c;
    --primary-dark: #1a2530;
    --accent-gray: #f8fafc;
    --border-color: #e2e8f0;
    --text-dark: #1e293b;
    --text-muted: #64748b;
}

/* Prevent horizontal viewport push from off-screen carousel items */
html, body {
    overflow-x: hidden;
}

/* Ensure images scale responsively inside Bootstrap columns */
img {
    max-width: 100%;
    height: auto;
}



/* Header Action Button Hover (slate to brand red) */
.header-ctas .btn-dark:hover {
    background-color: var(--primary-red) !important;
    border-color: var(--primary-red) !important;
    color: #ffffff !important;
}

/* Primary Navbar Link Transitions */
#site-navigation .nav-link {
    transition: color 0.2s ease, background-color 0.2s ease;
}

#site-navigation .nav-link:hover,
#site-navigation .nav-link:focus {
    color: var(--primary-red) !important;
}

/* Navigation link hover and active styling */
#site-navigation .navbar-nav .nav-link {
    transition: color 0.2s ease-in-out;
}

#site-navigation .navbar-nav .nav-link:hover {
    color: #ed1b24 !important;
}

#site-navigation .navbar-nav .nav-link.active {
    color: #ed1b24 !important;
    pointer-events: none;
    cursor: default;
}

/* Customer Journey Card Interactive Lift */
.card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06) !important;
}

/* Screen reader utility from Underscores (Kept for accessibility) */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute !important;
    width: 1px;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    clip-path: none;
    color: #21759b;
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* ==========================================================================
   Accreditations Horizontal Scroll (Mobile & Tablet)
   ========================================================================== */
.accreditation-scroll-row {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Firefox */
}

.accreditation-scroll-row::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
}

/* On mobile/tablet, constrain image heights and give touch snap points */
@media (max-width: 991.98px) {
    .accreditation-scroll-row .col-auto {
        scroll-snap-align: center;
        width: 140px; /* Gives each logo an equal swipe slot */
    }

    .accreditation-img {
        max-height: 48px;
        width: auto;
        object-fit: contain;
    }
}

/* On desktop, restore normal grid flow and let column padding control scale */
@media (min-width: 992px) {
    .accreditation-scroll-row {
        overflow-x: visible !important;
    }
    
    .accreditation-img {
        max-height: 52px;
        width: auto;
        object-fit: contain;
    }
}

/* ==========================================================================
   Hero Responsive Background Image
   ========================================================================== */
.hero-section {
    min-height: 460px;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

/* Mobile (<576px) */
.hero-section.has-bg-image {
    background-image: var(--hero-bg-mobile);
}

/* Tablet (576px - 991px) */
@media (min-width: 576px) {
    .hero-section.has-bg-image {
        background-image: var(--hero-bg-tablet);
    }
}

/* Desktop (>=992px) */
@media (min-width: 992px) {
    .hero-section.has-bg-image {
        background-image: var(--hero-bg-desktop);
    }
}

/* ==========================================================================
   Case Studies Carousel
   ========================================================================== */
#caseStudiesCarousel .carousel-inner .carousel-item {
    padding: 0;
    margin-right: -100%;
}

#caseStudiesCarousel .carousel-inner .carousel-item.active,
#caseStudiesCarousel .carousel-inner .carousel-item-next,
#caseStudiesCarousel .carousel-inner .carousel-item-prev {
    display: flex;
}

/* Tablet (md: 768px to 991.98px) - 2 items */
@media (min-width: 768px) and (max-width: 991.98px) {
    #caseStudiesCarousel .carousel-item > div {
        flex: 0 0 50%;
        max-width: 50%;
    }
    #caseStudiesCarousel .carousel-inner .carousel-item-end.active,
    #caseStudiesCarousel .carousel-inner .carousel-item-next {
        transform: translateX(50%);
    }
    #caseStudiesCarousel .carousel-inner .carousel-item-start.active, 
    #caseStudiesCarousel .carousel-inner .carousel-item-prev {
        transform: translateX(-50%);
    }
}

/* Desktop (lg: 992px and up) - 3 items */
@media (min-width: 992px) {
    #caseStudiesCarousel .carousel-item > div {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
    #caseStudiesCarousel .carousel-inner .carousel-item-end.active,
    #caseStudiesCarousel .carousel-inner .carousel-item-next {
        transform: translateX(33.333333%);
    }
    #caseStudiesCarousel .carousel-inner .carousel-item-start.active, 
    #caseStudiesCarousel .carousel-inner .carousel-item-prev {
        transform: translateX(-33.333333%);
    }
}

#caseStudiesCarousel .carousel-inner .carousel-item-end,
#caseStudiesCarousel .carousel-inner .carousel-item-start { 
    transform: translateX(0);
}

/* ==========================================================================
   Hero Quote Form (5-Step Pre-Qualification Widget)
   ========================================================================== */
.fd-quote-widget {
    --fd-red: #ed1b24;
    --fd-slate: #1a2530;
    --fd-blue: #0d5cab;
    --fd-border: #e2e8f0;
    --fd-bg-light: #f8fafc;
    --fd-tier-green-bg: #e6f4ea;
    --fd-tier-green-text: #137333;
    --fd-tier-green-border: #ceedd5;
    --fd-tier-amber-bg: #fef7e0;
    --fd-tier-amber-text: #b06000;
    --fd-tier-amber-border: #fce8b2;
    --fd-tier-red-bg: #fce8e6;
    --fd-tier-red-text: #c5221f;
    --fd-tier-red-border: #fad2cf;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--fd-slate);
    overflow-x: hidden;
}

.fd-quote-widget .fd-main-card,
.fd-quote-widget .fd-main-card:hover {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    transform: none !important;
}

/* Step Visibility */
.fd-quote-widget .hq-step {
    display: none;
}

.fd-quote-widget .hq-step.is-current {
    display: block;
    animation: fdFadeIn 0.25s ease-in-out;
}

@keyframes fdFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Progress Pips */
.fd-quote-widget .hq-pip {
    width: 36px;
    height: 8px;
    border-radius: 50rem;
    background-color: #cbd5e1;
    transition: all 0.3s ease;
}

.fd-quote-widget .hq-pip.is-active {
    width: 52px;
    background-color: var(--fd-red);
}

.fd-quote-widget .hq-pip.is-done {
    background-color: var(--fd-slate);
}

/* Brand Buttons */
.fd-quote-widget .btn-fd-slate {
    background-color: var(--fd-slate);
    color: #fff;
    border: 2px solid var(--fd-slate);
    transition: all 0.2s ease;
}

.fd-quote-widget .btn-fd-slate:hover {
    background-color: var(--fd-red);
    border-color: var(--fd-red);
    color: #fff;
}

.fd-quote-widget .btn-fd-red {
    background-color: var(--fd-red);
    color: #fff;
    border: 2px solid var(--fd-red);
    box-shadow: 0 4px 12px rgba(237, 27, 36, 0.2);
    transition: all 0.2s ease;
}

.fd-quote-widget .btn-fd-red:hover {
    background-color: var(--fd-slate);
    border-color: var(--fd-slate);
    color: #fff;
}

/* Coverage Alert Tiers */
.fd-quote-widget .tier-green { background-color: var(--fd-tier-green-bg); color: var(--fd-tier-green-text); border: 2px solid var(--fd-tier-green-border); }
.fd-quote-widget .tier-amber { background-color: var(--fd-tier-amber-bg); color: var(--fd-tier-amber-text); border: 2px solid var(--fd-tier-amber-border); }
.fd-quote-widget .tier-red   { background-color: var(--fd-tier-red-bg);   color: var(--fd-tier-red-text);   border: 2px solid var(--fd-tier-red-border); }

/* Interactive Selection Cards (Steps 2, 3, 4) */
.fd-quote-widget .fd-choice-label {
    position: relative;
    cursor: pointer;
    display: block;
    height: 100%;
    margin: 0;
}

/* Pin visually-hidden inputs inside their card so focusing never scrolls the viewport horizontally */
.fd-quote-widget .fd-choice-input {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    margin: 0 !important;
    pointer-events: none;
}

.fd-quote-widget .fd-choice-card {
    border: 2px solid var(--fd-border);
    transition: all 0.2s ease;
    background: #fff;
    color: var(--fd-slate);
}

.fd-quote-widget .fd-choice-card:hover {
    border-color: #94a3b8;
    transform: translateY(-2px);
}

.fd-quote-widget .fd-choice-card--dark {
    background-color: #2c353d;
    color: #ffffff;
    border-color: #2c353d;
}

.fd-quote-widget .fd-choice-card--olive {
    background-color: #73704c;
    color: #ffffff;
    border-color: #73704c;
}

/* Checked States for Radio & Checkbox Cards */
.fd-quote-widget .fd-choice-input:checked + .fd-choice-card {
    border-color: var(--fd-blue) !important;
    box-shadow: 0 0 0 4px rgba(13, 92, 171, 0.2) !important;
    transform: translateY(-2px);
}

.fd-quote-widget .fd-choice-input:checked + .fd-choice-card .fd-select-indicator {
    background-color: var(--fd-blue);
    border-color: var(--fd-blue);
    color: #ffffff;
}

.fd-quote-widget .fd-card-media {
    height: 180px;
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
}

.fd-quote-widget .fd-house-icon {
    height: 140px;
    background-size: contain;
    background-position: top center;
    background-repeat: no-repeat;
}

.fd-quote-widget .fd-timescale-media {
    background: #ffffff;
    height: 160px;
    overflow: hidden;
}

.fd-quote-widget .fd-timescale-media svg {
    width: 100%;
    height: 100%;
    max-height: 150px;
    display: block;
}

/* Make Step 4 Timescale card headers equal height when text wraps */
#step-timescale .fd-choice-card > div:first-child {
    min-height: 92px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#step-timescale .fd-choice-card > div:first-child span {
    line-height: 1.25;
    display: block;
}

/* Mobile-only (< 768px): 100px image heights & top-aligned cropping (top: 0) */
@media (max-width: 767.98px) {
    .fd-quote-widget .fd-card-media,
    .fd-quote-widget .fd-house-icon {
        height: 100px;
        background-position: center 0; /* Crops from top: 0 so roofs/tops are never cut off */
    }

    .fd-quote-widget .fd-timescale-media,
    #step-timescale .fd-choice-card > div:nth-child(2) {
        height: 100px !important;
        align-items: flex-start !important; /* Overrides Bootstrap's align-items-center so SVG pins to top: 0 */
        overflow: hidden;
        padding-top: 4px !important;
        padding-bottom: 4px !important;
    }

    .fd-quote-widget .fd-timescale-media svg,
    #step-timescale .fd-choice-card svg {
        height: 92px !important;
        max-height: 92px !important;
        width: auto !important;
        margin: 0 auto;
        display: block;
    }
}

/* Style Ideal Postcodes injected inputs with Bootstrap look */
#postcode_lookup input {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
}

#postcode_lookup button {
    background-color: var(--fd-slate);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

#postcode_lookup select {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    margin-top: 0.5rem;
}

/* Prevents anchor links (#price-form) from hiding behind the sticky header */
#price-form {
    scroll-margin-top: 110px;
}

@media (max-width: 767.98px) {
    #price-form {
        scroll-margin-top: 80px;
    }
}

/* ==========================================================================
   Horizontal Swipe Carousel for Quote Form Options (Mobile & Tablet < 992px)
   ========================================================================== */
.fd-swipe-hint {
    display: none;
}

@media (max-width: 991.98px) {
    .fd-swipe-hint {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.35rem;
        font-size: 0.85rem;
        font-weight: 600;
        color: #64748b;
        margin-bottom: 0.75rem;
    }

    .fd-quote-widget .row.fd-mobile-carousel {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 0.25rem 0.25rem 1rem;
        scrollbar-width: none; /* Firefox */
    }

    .fd-quote-widget .row.fd-mobile-carousel::-webkit-scrollbar {
        display: none; /* Chrome / Safari / iOS */
    }

    /* Mobile phones (< 576px): 1 card centered with next card peeking */
    .fd-quote-widget .row.fd-mobile-carousel > [class*="col-"] {
        flex: 0 0 82% !important;
        width: 82% !important;
        max-width: 82% !important;
        scroll-snap-align: center;
    }

    .fd-quote-widget .row.fd-mobile-carousel.fd-mobile-carousel--compact > [class*="col-"] {
        flex: 0 0 68% !important;
        width: 68% !important;
        max-width: 68% !important;
        scroll-snap-align: center;
    }
}

/* Tablets / Small Laptops (576px to 991.98px): slightly narrower cards so ~2 cards show */
@media (min-width: 576px) and (max-width: 991.98px) {
    .fd-quote-widget .row.fd-mobile-carousel > [class*="col-"] {
        flex: 0 0 58% !important;
        width: 58% !important;
        max-width: 58% !important;
    }

    .fd-quote-widget .row.fd-mobile-carousel.fd-mobile-carousel--compact > [class*="col-"] {
        flex: 0 0 44% !important;
        width: 44% !important;
        max-width: 44% !important;
    }
}

/* Responsive Button: Small/Compact on Mobile (<768px), Large on Tablet/Desktop (768px+) */
.btn-responsive {
    padding: 0.375rem 0.75rem;
    font-size: 0.9rem;
    border-radius: 0.375rem;
}

@media (min-width: 768px) {
    .btn-responsive {
        padding: 0.5rem 1rem;
        font-size: 1.25rem;
        border-radius: 0.5rem;
    }
}

/* Mobile & Tablet Native <details> Accordion */
.journey-accordion summary {
    list-style: none;
    cursor: pointer;
}

.journey-accordion summary::-webkit-details-marker {
    display: none;
}

.journey-chevron {
    transition: transform 0.2s ease;
}

.journey-accordion details[open] .journey-chevron {
    transform: rotate(180deg);
}

 .btn-danger,
    .df-popup-button {
        color: #fff;
        background: #e51c23 linear-gradient(180deg, #e93e44, #e51c23) repeat-x;
        border-color: #e51c23;
        font-weight: bold;
        text-transform: uppercase;
        margin-top: 25px;
    }

    .btn-danger:hover,
    .df-popup-button:hover {
        color: #fff;
        background: #c4161d linear-gradient(180deg, #cd393f, #c4161d) repeat-x;
        border-color: #b9151b;
    }

    .btn-danger:focus,
    .df-popup-button:focus,
    .btn-danger.focus,
    .focus.df-popup-button {
        color: #fff;
        background: #c4161d linear-gradient(180deg, #cd393f, #c4161d) repeat-x;
        border-color: #b9151b;
        box-shadow: 0 0 0 .2rem rgb(233 62 68 / .5);
    }

    .btn-danger.disabled,
    .navbar-nav .dropdown-menu .active.nav-item a.btn-danger,
    .navbar-nav .dropdown-menu .active.nav-item a.df-popup-button,
    #banner-quote .menu li.current_page_item a.btn-danger,
    #banner-quote .menu li.current_page_item a.df-popup-button,
    .disabled.df-popup-button,
    .btn-danger:disabled,
    .df-popup-button:disabled {
        color: #fff;
        background-color: #e51c23;
        border-color: #e51c23;
        background-image: none;
    }

    .btn-danger:not(:disabled):not(.disabled):active,
    .df-popup-button:not(:disabled):not(.disabled):active,
    .btn-danger:not(:disabled):not(.disabled).active,
    .df-popup-button:not(:disabled):not(.disabled).active,
    .show > .btn-danger.dropdown-toggle,
    .show > .dropdown-toggle.df-popup-button,
    .btn-danger.dropdown-toggle.show,
    .dropdown-toggle.df-popup-button.show {
        color: #fff;
        background-color: #b9151b;
        background-image: none;
        border-color: #ad1419;
    }

    .btn-danger:not(:disabled):not(.disabled):active:focus,
    .df-popup-button:not(:disabled):not(.disabled):active:focus,
    .btn-danger:not(:disabled):not(.disabled).active:focus,
    .df-popup-button:not(:disabled):not(.disabled).active:focus,
    .show > .btn-danger.dropdown-toggle:focus,
    .show > .dropdown-toggle.df-popup-button:focus,
    .btn-danger.dropdown-toggle.show:focus,
    .dropdown-toggle.df-popup-button.show:focus {
        box-shadow: 0 0 0 .2rem rgb(233 62 68 / .5);
    }

    /* ==========================================================================
   Footer Menus & Collapsible Widgets (Bootstrap 5)
   ========================================================================== */

/* 1. Reset WordPress Widget Menu Lists (.site-footer .menu -> list-unstyled) */
.site-footer .menu,
#footerMenu1 ul,
#footerMenu2 ul,
#footerMenu3 ul,
#footerMenu4 ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 1.5rem;
}

/* 2. Desktop Column Headings (h4) */
.site-footer h4 {
  color: #000;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  padding-bottom: 0.65rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  position: relative;
}

/* Red accent bar under desktop headings */
.site-footer h4::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 40px;
  height: 2px;
  background-color: #ed1b24;
}

/* 3. Mobile Accordion Toggle Buttons (#button1 - #button4) */
#button1,
#button2,
#button3,
#button4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.05);
  color: #000000;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.375rem;
  padding: 0.85rem 1rem;
  margin-bottom: 0;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

#button1:hover,
#button2:hover,
#button3:hover,
#button4:hover,
#button1[aria-expanded="true"],
#button2[aria-expanded="true"],
#button3[aria-expanded="true"],
#button4[aria-expanded="true"] {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: #ed1b24;
}

/* Caret Icon Rotation & Accent Colour */
#button1 .bi-caret-down-fill,
#button2 .bi-caret-down-fill,
#button3 .bi-caret-down-fill,
#button4 .bi-caret-down-fill {
  width: 1.25em;
  height: 1.25em;
  color: #ed1b24;
  transition: transform 0.25s ease;
}

#button1[aria-expanded="true"] .bi-caret-down-fill,
#button2[aria-expanded="true"] .bi-caret-down-fill,
#button3[aria-expanded="true"] .bi-caret-down-fill,
#button4[aria-expanded="true"] .bi-caret-down-fill {
  transform: rotate(180deg);
}

/* 4. Footer Menu Links & List Items */
.site-footer .menu li,
#footerMenu1 li,
#footerMenu2 li,
#footerMenu3 li,
#footerMenu4 li {
  margin-bottom: 0;
  padding-bottom: 0 !important; /* Overrides inline pb-3 for consistent spacing */
}

.site-footer .menu li a,
#footerMenu1 li a,
#footerMenu2 li a,
#footerMenu3 li a,
#footerMenu4 li a {
  color: #000000;
  text-decoration: none;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s ease, transform 0.15s ease;
}

.site-footer .menu li a:hover,
#footerMenu1 li a:hover,
#footerMenu2 li a:hover,
#footerMenu3 li a:hover,
#footerMenu4 li a:hover {
  color: #ddd;
  text-decoration: underline;
}

/* Latest Installations Arrow Icon (Column 4) */
#footerMenu4 .bi-arrow-right-short {
  color: #ed1b24 !important; /* Replaces Bootstrap default blue (.text-primary) with brand red */
  transition: transform 0.15s ease;
  margin-left: 0.15rem;
}

#footerMenu4 li a:hover .bi-arrow-right-short {
  transform: translateX(3px);
}

/* 5. Always Expand Collapse Containers on Desktop (md: 768px and up) */
@media (min-width: 768px) {
  .collapse.dont-collapse-md {
    display: block !important;
    height: auto !important;
    visibility: visible !important;
  }

  #button1,
  #button2,
  #button3,
  #button4 {
    display: none !important;
  }
}

/* Mobile Collapse Inner Spacing */
@media (max-width: 767.98px) {
  #footerMenu1,
  #footerMenu2,
  #footerMenu3,
  #footerMenu4 {
    padding: 0.5rem 0.75rem 0.75rem;
  }
}