/* --- Components Styles --- */

/* Base styles for buttons (custom or Gutenberg) and form/inline comment buttons
   Centralized so all buttons use the same design tokens (see variables in :root).
*/
.button,
.wp-block-button__link,
.comment-reply-link,
.wp-block-comment-reply-link a,
.comments-link,
.reply a,
a.comments-link,
.comment-form .form-submit input[type="submit"],
.comment-form .form-submit button[type="submit"],
.wpcf7-form input[type="submit"].wpcf7-submit { /* Apply common styles to buttons and comment/form submits */
    display: inline-block;
    padding: 8px 20px;
    border-radius: var(--site-image-border-radius, 12px);
    font-family: var(--button-font-family, var(--font-primary));
    text-decoration: none;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: transform 0.15s ease, background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
    transition: transform 0.15s ease, background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.18s ease;
    cursor: pointer;
    /* Default: neutral button. Use `.button-primary` for the primary variant. */
    color: var(--site-color-text);
    background-color: transparent;
    border: 1px solid var(--site-color-text);
}

.button:hover,
.wp-block-button__link:hover {
    color: var(--site-color-text);
    background-color: var(--site-color-background);
    border-color: var(--site-color-text);
    box-shadow: var(--shadow-sm);
}

.button-primary,
.wp-block-button.is-style-primary-button .wp-block-button__link {
    /* explicit alias for primary style (keeps previous API) */
    color: var(--button-primary-text-color);
    background-color: var(--button-primary-bg-color);
    border: 1.5px solid var(--button-primary-border-color);
}
.button-primary:hover,
.wp-block-button.is-style-primary-button .wp-block-button__link:hover {
    background-color: var(--button-primary-bg-hover-color, var(--site-color-accent-secondary));
    color: var(--button-primary-text-hover-color, var(--site-color-text));
    border-color: var(--button-primary-border-hover-color, var(--site-color-accent-secondary));
}

/* More specific targets for form submits and inputs that have the .button-primary class
   Some selectors (eg. .wpcf7-form input[type="submit"].wpcf7-submit) are more specific
   and can prevent the plain .button-primary rule from applying. Use input.button-primary
   to ensure CF7 and native inputs with this class receive the primary tokens. */
input.button-primary,
button.button-primary,
.wpcf7-form input.button-primary,
.comment-form .form-submit input.button-primary {
    color: var(--button-primary-text-color) !important;
    background-color: var(--button-primary-bg-color) !important;
    border: 1.5px solid var(--button-primary-border-color) !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
input.button-primary:hover,
button.button-primary:hover,
.wpcf7-form input.button-primary:hover,
.comment-form .form-submit input.button-primary:hover {
    background-color: var(--button-primary-bg-hover-color) !important;
    color: var(--button-primary-text-hover-color) !important;
    border-color: var(--button-primary-border-hover-color) !important;
}

.button-secondary,.wp-block-button.is-style-secondary-button .wp-block-button__link {
    background-color: var(--button-secondary-bg-color);
    color: var(--button-secondary-text-color);
    border: 1.5px solid var(--button-secondary-border-color);
}
.button-secondary:hover,
.wp-block-button.is-style-secondary-button .wp-block-button__link:hover {
    background-color: var(--button-secondary-bg-hover-color);
    color: var(--button-secondary-text-hover-color);
    border-color: var(--button-secondary-border-hover-color);
}

/* Back to Top Button */
.back-to-top-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
    background-color: var(--site-color-accent-primary);
    /* Use the accessible on-primary color computed by the theme so the chevron
       automatically adapts (white or dark) depending on contrast). */
    color: var(--site-color-action-text);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    text-align: center;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out, transform 0.2s ease-in-out, background-color 0.15s ease, box-shadow 0.18s ease-in-out;
    box-shadow: var(--shadow-sm);
}

.back-to-top-button svg {
    display: block;
    width: 60%;
    height: 60%;
    margin: 20% auto;
    /* SVG uses stroke="currentColor" so it will follow the computed color above */
}

.back-to-top-button.show {
    /* More visible when shown: fully opaque so the accent appears vivid */
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top-button:hover,
.back-to-top-button:active,
.back-to-top-button:focus {
    color: var(--site-color-action-text);
    opacity: 1;
    box-shadow: var(--shadow-md);
}

/* Apply hover styles only if the device supports hover */
@media (hover: hover) and (pointer: fine) {
    .back-to-top-button:hover {
        background-color: var(--site-color-accent-primary-hover);
    }
}

/* Responsive Map */
.map-responsive {
    overflow: hidden;
    padding-bottom: 56.25%;
    position: relative;
    height: 0;
    margin-top: 2em;
    margin-bottom: 2em;
}

.map-responsive iframe {
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    max-width: 100%; /* Ensure iframe does not exceed its container's width */
    position: absolute;
    border: 0;
}

/* Search Widget (WordPress Block) */
.widget_block.widget_search {
    margin-bottom: 1.5em;
}

.widget_block.widget_search .wp-block-search__label {
    display: block;
    font-size: 1em;
    color: var(--site-color-text);
    /* margin-top: 2.5em;  */
    margin-bottom: 0.8em;
    font-weight: bold;
    text-align: left;
}

.widget_block.widget_search .wp-block-search__inside-wrapper {
    width: 100% !important;
    border: 1px solid var(--site-color-accent-secondary);
    border-radius: 5px;
    background-color: var(--site-color-background-light);
    margin-top: 15px;
    padding: 0;
}

.widget_block.widget_search .wp-block-search__input {
    width: 100%;
    padding: 10px 12px;
    border: none;
    font-family: var(--font-body);
    font-size: 0.95em;
    color: var(--site-color-text);
    background-color: transparent;
    box-sizing: border-box;
    border-radius: 5px;
}

.widget_block.widget_search .wp-block-search__input:focus {
    outline: none;
}

/* H3 Titles in Sidebar Widgets */
#sidebar .widget_block h3 {
    font-size: 1em;
    color: var(--site-color-text);
    margin-bottom: 0.8em;
    font-weight: bold;
}

/* Latest Comments block: remove extra left indentation so items line up
   with other widget content while preserving list markers (numbers). */
#sidebar .wp-block-latest-comments,
#sidebar .wp-block-latest-comments ol,
#sidebar .wp-block-latest-comments ul {
    padding-left: 0;
    margin-left: 0;
    list-style-position: inside; /* keep markers but flush to content */
}

#sidebar .wp-block-latest-comments li {
    margin-left: 0;
    padding-left: 0;
}

/* Categories List in Block Widget */
.widget_block .wp-block-categories-list.wp-block-categories {
    list-style-type: none;
    padding-left: 0;
}

/* --- Shared list styling for content, pages, posts and common block wrappers ---
   Ensure our custom bullet replacement applies across templates (pages, posts,
   and Gutenberg blocks). Some themes/blocks rely on native ::marker; to replace
   the marker reliably we remove native markers and inject our own via ::before. */
/* Target common content wrappers used by themes and blocks */
.entry-content ul,
.entry-content ol,
.entry-content ul.wp-block-list,
.entry-content ol.wp-block-list,
.tab-pane ul,
.tab-pane ol,
.page-content ul,
.page-content ol,
.post-content ul,
.post-content ol,
.wp-block ul,
.wp-block ol,
.entry-content .wp-block ul,
.entry-content .wp-block ol,
ul.wp-block-list,
ul[class*="wp-block-list"],
.wp-block-list ul,
.wp-block-list {
    margin-left: 2em;
    margin-bottom: 1.5em;
    line-height: 1.7;
    list-style: none !important; /* Remove default native bullets/markers */
    padding-left: 0;
    counter-reset: list-item;
}

.entry-content li,
.tab-pane li,
.wp-block-list li,
ul.wp-block-list li,
ul[class*="wp-block-list"] li {
    margin-bottom: 0.8em;
    position: relative;
    padding-left: 1em; /* Space for the custom bullet */
}

.entry-content li::before,
.tab-pane li::before,
.wp-block-list li::before,
ul.wp-block-list li::before,
ul[class*="wp-block-list"] li::before {
    /* Support either a character bullet or an image logo supplied by the Customizer.
       The server emits --list-bullet-url when an image is set, otherwise --list-bullet-char
       contains a character (default •). We always reserve space via padding on the LI. */
    content: var(--list-bullet-char);
    color: var(--list-bullet-color);
    font-weight: bold;
    font-size: var(--list-bullet-size);
    display: inline-block;
    width: var(--list-bullet-size);
    height: var(--list-bullet-size);
    margin-left: var(--list-bullet-left-offset);
    position: absolute;
    left: 0;
    top: 0;
    /* If an image URL is present, use it as background and hide the character (server sets --list-bullet-char to '' in that case) */
    background-image: var(--list-bullet-url);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Hide native ::marker for targeted containers so our ::before replacement
   doesn't compete with browser markers (some pages used ::marker by default). */
.entry-content li::marker,
.tab-pane li::marker,
.page-content li::marker,
.post-content li::marker,
.wp-block li::marker,
.wp-block-list li::marker,
ul.wp-block-list li::marker,
ul[class*="wp-block-list"] li::marker {
    content: none;
}

.entry-content ol li::before,
.tab-pane ol li::before {
    content: counter(list-item) ".";
    counter-increment: list-item;
    color: var(--list-bullet-color);
    font-weight: bold;
    display: inline-block;
    width: auto;
    margin-left: -2em;
    position: absolute;
    left: 0;
    top: 0.1em;
    text-align: right;
    min-width: 1.5em;
}



/* --- Special Info Message --- */
.special-info-message {
    /* background-color: var(--site-color-text-dark-safe); */
    /* color: var(--site-color-text-light-safe);  */
    padding: 0.25em 0.25em;
    margin-bottom: 1em; 
    /* border-radius: 5px; */
    text-align: center !important;
    font-size: 0.9em;
    /* line-height: 1.6; */
    width: 100%;
    box-sizing: border-box;
    margin-left: -20px;
    margin-right: -20px;
    width: calc(100% + 40px); 
}

/* Ensure text inside the container is centered and bold on desktop */
.special-info-message .container,
.special-info-message p {
    text-align: center !important;
}

/* Bold only when the modifier class is present */
.special-info-message.special-info-message--bold .container,
.special-info-message.special-info-message--bold p {
    font-weight: 700;
}

.special-info-message .container {
    /* Center the inner container to match site layout while allowing
       the parent banner to extend full-bleed. Use the theme content
       width token and keep a small horizontal padding to respect
       header gutter. */
    max-width: var(--content-width, 1200px);
    margin: 0 auto;
    padding: 0 20px;
}

.special-info-message p {
    margin: 0; /* Resets paragraph margins */
}

/* Styles for links inside the message */
.special-info-message a {
    color: var(--site-color-text);
    text-decoration: underline;
    font-weight: bold;
}

.special-info-message a:hover {
    text-decoration: none;
}

/* -----------------------------------------------------------------
   Footer separator (when footer has same background as page)
   Applied when PHP adds the class `has-footer-separator` to the footer
----------------------------------------------------------------- */
.site-footer.has-footer-separator {
    border-top: 1px solid var(--site-color-border-light, rgba(0,0,0,0.06));
}

.site-footer.has-footer-separator .site-info {
    /* Give a small visual separation so the line isn't flush against content */
    padding-top: 18px;
}

/* LIGHTBOX CSS */

/* Hide the lightbox by default */
.lightbox-overlay {
    visibility: hidden; 
    opacity: 0;
    
    /* Position the overlay to cover the entire viewport */
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    
    /* Semi-transparent background color */
    background: rgba(0, 0, 0, 0.85); 
    
    /* Ensure the overlay is above everything */
    z-index: 99999; 
    
    /* Transition for open/close effect */
    transition: opacity 0.3s, visibility 0.3s; 
    
    /* Center the content */
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Prevent scrolling of content behind */
    overflow-y: auto; 
}

/* Display the Lightbox when the anchor is targeted */
.lightbox-overlay:target {
    visibility: visible;
    opacity: 1;
}

/* Container for the image */
.lightbox-content {
    max-width: 90%; /* Limit the size so it doesn't take up the entire window */
    max-height: 90%;
    margin: auto;
    position: relative;
    background: #fff; /* Background of the image (if the image is not 100% of the box) */
    padding: 10px; /* Small spacing around the image */
}

/* The image itself */
.lightbox-content img {
    max-width: 100%;
    max-height: 80vh; /* Limit the height relative to the viewport */
    height: auto;
    display: block;
}

/* 5. Close button (the cross) */
.lightbox-close {
    /* Position the cross at the top right */
    position: absolute;
    top: 10px;
    right: 30px; 
    
    /* Visual styles for the cross */
    color: #fff; 
    font-size: 40px;
    line-height: 1;
    font-weight: bold;
    text-decoration: none;
    transition: color 0.2s;
    z-index: 100000;
}
.lightbox-close:hover {
    color: var(--site-color-text); /* Use the theme's action text color for accessible text */
}

/* Caption */
.lightbox-caption {
    text-align: center;
    color: #fff;
    margin-top: 10px;
}

/* Layout grid */
.services-grid-archive {    
    margin-top: 2em;
    display: flex;
    flex-wrap: wrap; 
    justify-content: center; 
    align-items: flex-start; 
    gap: 30px;     
}

/* Styles for flipping cards */
.flip-card {
    /* width: 100%;  */
    width: calc(33.333% - 30px);
    height: 500px; 
    perspective: 1000px; 
    cursor: pointer;
    background: none !important;
    perspective-origin: center top; 
    /* overflow: hidden; */
    transform: translateZ(0); /* Force hardware acceleration to fix flickering */
}

@keyframes initial-flip-hint {
    /* 0% : The card is slightly turned, ready to flip */
    0% {
        /* Rotation Y for the flip, translation Z for the depth effect */
        transform: perspective(1000px) rotateY(3deg) translateZ(-50px); 
        opacity: 0.5; 
    }
    
    /* 100% : Return to the normal position */
    100% {
        transform: perspective(1000px) rotateY(0deg) translateZ(0); 
        opacity: 1; 
    }
}

/* Style for cards without images (Front Face) */
.flip-card.no-image .flip-card-front {
    background: linear-gradient(to top right, var(--site-color-accent-primary), var(--site-color-accent-secondary));    
    color: var(--site-color-site-text, #fff);     
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
    transform-origin: center center;
    /* Avoid initial translateZ which can cause subtle size differences between faces.
       Keep transform only for the flipping rotation so front/back maintain identical sizing. */
    transform: none;
    will-change: transform;
}

/* Trigger the flip on PC (Hover) */
.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}
/* Trigger the flip on mobile (with the class added by JS) */
.flip-card.is-flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    padding: 10px;
    box-sizing: border-box;
    /* display: flex; */
    /* flex-direction: column; */
    /* justify-content: center; */
    align-items: center;
    text-align: center;
    border-radius: var(--site-image-border-radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.flip-card-front {
    /* Style for the front face (image, title) */
    background-color: transparent;
    color: var(--site-color-text);
    justify-content: space-between;
    /* Avoid per-face scaling or translateZ which can produce mismatched sizes when rotated. */
    transform: none;
}

.flip-card-back {
    /* Style for the back face (price, details) */
    /* Use a theme-provided variable so flip-card colors adapt to the site tokens.
       Fallback to the previous tokens if the variable is not present. */
    background-color: var(--flip-card-back, var(--site-color-background-light));
    color: var(--flip-card-back-text, var(--site-color-text-dark-safe));
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ---- Flip-card back: content-specific rules (service details) ---- */
/* Support both the current markup (`service-details`) and older `service-details-list`. */
.flip-card-back .service-type-title {
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 6px;
}

.flip-card-back .main-price {
    font-size: 1.8em;
    font-weight: bold;
    margin: 5px 0;
}

.flip-card-back .additional-info {
    font-size: 0.8em;
    margin: 10px 0 10px 0;
    font-style: italic;
    /* color: var(--site-color-text-light-safe); */
}

/* List styling: center by default, remove native bullets and shrink width for visual balance.
   We include !important on text-align/padding/margin to override inline styles present in templates. */
.flip-card-back .service-details-list,
.flip-card-back .service-details {
    list-style: none;
    padding: 0 !important;
    margin: 10px auto !important;
    width: 90%;
    text-align: center !important;
}

.flip-card-back .service-details li,
.flip-card-back .service-details-list li {
    padding: 12px 0;
    margin: 0;
    border-bottom: 1px solid var(--site-color-accent-secondary); /* Separation line: Bottom border, very faint color */
    font-size: 0.95em;
    line-height: 1.4;
}

/* Remove separator on the last item for a clean look */
.flip-card-back .service-details li:last-child,
.flip-card-back .service-details-list li:last-child {
    border-bottom: none;
}


/* Styles for the image if present */
.flip-card-front img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;   
    object-fit: cover;
    /* Ensure the image follows the parent's border-radius */
    border-radius: inherit;
}

.flip-card-front .card-content, .flip-card-front .card-content h3, .flip-card-front .card-content h2 {
    position: absolute;
    bottom: 0; /* Alignment at the bottom of the card */
    left: 0;
    width: 100%;
    /* Increase overlay height and padding so multi-line titles remain readable */
    min-height: 35%;
    box-sizing: border-box;

    /* Creating a larger mask/gradient for readability: keep a stronger opaque base
       and extend the semi-opaque area to cover more vertical space. */
    background: linear-gradient(
        to top,
        rgba(255,255,255,1) 0%,    /* fully opaque at the very bottom */
        rgba(255,255,255,0.97) 20%,
        rgba(255,255,255,0.88) 40%,
        rgba(255,255,255,0.6) 60%,
        rgba(255,255,255,0.3) 80%,
        rgba(0,0,0,0) 100%
    );
    padding: 24px; 
    text-align: center;
    color: var(--site-color-text-dark-safe) !important; /* Ensure text is readable over the overlay */
}

.flip-card-front .card-content h3,
.flip-card-front .card-content h2 { /* Include h2 in case of changing the tag */
    margin-top: 0;
    margin-bottom: 0; 
    font-weight: 600;
    text-transform: uppercase;
}


.flip-card-back .button-details {
    display: inline-block;
    /* padding: 10px 18px; */
    /* border-radius: 5px; */
    font-weight: bold;
    color: var(--site-color-accent-primary);
    background: transparent; /* Neutralize the default white background of the browser */
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* .flip-card-back .button-details:hover {
    color: white;
} */

@media (max-width: 1024px) {
    .flip-card {
        /* Calculate the width for 2 cards: (100% - 1x the gap) / 2 */
        width: calc(50% - 10px); 
    }
}

@media (max-width: 767px) {
    .flip-card {
        /* Maximum width of 90% to leave a margin on the edges */
        width: 90%; 
        max-width: 350px; /* Limits the size on large mobiles */
        height: 450px; /* Slightly reduces the height on mobile */
    }
}

/* --- Styles for the logos carousel --- */

.logos-section  {
    margin-top: 2em;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
    padding: 20px 0;
    box-sizing: border-box;
}
/* Ensure the wrapper is a horizontal flex container */
.logos-carousel .swiper-wrapper {
    display: flex !important; 
    align-items: center;
    transition-timing-function: linear;
}

/* Ensure the slides do not have a width of 100% on mobile */
.logos-carousel .swiper-slide {
    position: relative; 
}

/* Limit the size of the images (so they are not too wide) */
.logos-carousel .logo-item img {
    max-height: 80px; 
    max-width: 150px; /* Limit the maximum width of the image (adjust this value) */
    width: auto;
    object-fit: contain;
}

/* Define the width of the Swiper-slide container */
.logos-carousel .swiper-slide.logo-item {
    /* Slide width = (Max logo width) + (internal margin) */
    width: 250px;
    display: flex; 
    justify-content: center;
    align-items: center;
    flex-shrink: 0; 
    overflow: hidden;
    /* padding: 0 15px; */
}

/* Responsive for mobile */
@media (max-width: 600px) {
    .logos-carousel .swiper-slide.logo-item {
        max-width: 150px; 
    }
}
