/* ============================================================
 * Bromo Paradiso Theme - Custom Styles
 * Mobile-first approach: base styles are mobile,
 * then sm/md/lg breakpoints scale up.
 * ============================================================ */

/* -------------------------------------------------------
 * NAVIGATION & STICKY HEADER
 *
 * On front page: nav starts transparent (inside hero),
 * becomes solid/sticky on scroll.
 * On inner pages: nav is always solid dark.
 * ------------------------------------------------------- */

/* Nav link colors — bright white matching original design.
 * WordPress menu items must inherit this explicitly
 * since wp_nav_menu() adds its own classes. */
#primary-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

#primary-menu li {
    display: list-item;
}

#primary-menu li a,
#primary-menu > li > a {
    color: rgba(255, 255, 255, 0.9);
    transition: color 0.2s;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    display: inline-block;
}

#primary-menu li a:hover,
#primary-menu li a:focus {
    color: #6b8e23; /* brand-500 */
}

#primary-menu li.current-menu-item > a,
#primary-menu li.current_page_item > a,
#primary-menu li.current-menu-ancestor > a {
    color: #6b8e23; /* brand-500 */
}

/* Hero-transparent state: nav overlaying hero background.
 * No background, text is white against hero image. */
.nav-hero-transparent {
    background: transparent !important;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.nav-hero-transparent #primary-menu li a,
.nav-hero-transparent #primary-menu > li > a {
    color: rgba(255, 255, 255, 0.9);
}

.nav-hero-transparent #primary-menu li a:hover,
.nav-hero-transparent #primary-menu li a:focus {
    color: #6b8e23;
}

/* Sticky state: nav detaches and sticks to top with solid bg. */
.nav-sticky {
    position: fixed !important;
    top: 0 !important;
    left: 0;
    right: 0;
    z-index: 50 !important;
    background: #1f2937 !important; /* brand-dark */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease-out;
}

.nav-sticky .container {
    /* Slightly tighter padding when sticky. */
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* -------------------------------------------------------
 * CUSTOM LOGO — full image display
 *
 * When a logo image is uploaded via Customizer, it replaces
 * the fallback icon. The logo should display as a full
 * image (not constrained to a small square). The <a> wrapper
 * from the_custom_logo() already links to the homepage.
 * ------------------------------------------------------- */

/* The <a> wrapper that WordPress puts around the logo. */
.custom-logo-link {
    display: flex;
    align-items: center;
    line-height: 0; /* prevent extra bottom space */
}

/* The <img> element itself — scales responsively, mobile-first.
 * Sizes doubled from previous version per design request. */
img.custom-logo {
    height: auto;
    max-height: 5rem;     /* 80px mobile (was 40px) */
    width: auto;
    object-fit: contain;
    display: block;
}

@media (min-width: 640px) {
    img.custom-logo {
        max-height: 5.5rem;  /* 88px sm (was 44px) */
    }
}

@media (min-width: 768px) {
    img.custom-logo {
        max-height: 6rem;    /* 96px md (was 48px) */
    }
}

@media (min-width: 1024px) {
    img.custom-logo {
        max-height: 7rem;    /* 112px lg (was 56px) */
    }
}

/* When sticky, tighten the logo slightly but still larger than before. */
.nav-sticky img.custom-logo {
    max-height: 5rem;        /* 80px (was 40px) */
}

/* Also handle the fallback icon sizing to match. */
.site-logo-icon {
    width: 6rem;             /* 96px (was 48px) */
    height: 6rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    flex-shrink: 0;
}

.site-logo-icon-i {
    color: #6b8e23; /* brand-500 */
    font-size: 3rem;         /* 48px (was 24px) */
}

.nav-sticky .site-logo-icon {
    width: 5rem;             /* 80px (was 40px) */
    height: 5rem;
}

.nav-sticky .site-logo-icon-i {
    font-size: 2.5rem;       /* 40px (was 20px) */
}

/* Polaroid Effect */
.polaroid {
    background: white;
    padding: 0.5rem 0.5rem 2rem 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Section Title Line */
.title-line {
    display: inline-block;
    width: 2rem;
    height: 2px;
    background-color: #6b8e23;
    vertical-align: middle;
}

/* Mobile menu
 * Default state on mobile: hidden via display:none.
 * When .mobile-menu-active is added by JS, slide it down.
 * On md+ (≥768px), it's always hidden because Tailwind .md:hidden
 * adds display:none at md breakpoint.
 */
.mobile-menu {
    display: none;
    background: #1f2937; /* brand-dark */
    position: relative;
    z-index: 30;
}

.mobile-menu.mobile-menu-active {
    display: block;
    animation: mobileMenuSlideDown 0.25s ease-out;
}

/* Mobile menu toggle button — ensure it's always interactive,
 * never blocked by overlapping hero content. */
#mobile-menu-toggle {
    position: relative;
    z-index: 50;
    pointer-events: auto;
    -webkit-tap-highlight-color: rgba(107, 142, 35, 0.3);
    touch-action: manipulation;
}

#mobile-menu-toggle * {
    pointer-events: none; /* clicks pass through icons to the button */
}

#mobile-menu-toggle:active {
    transform: scale(0.95);
}

/* Keep mobile menu hidden on tablet/desktop. */
@media (min-width: 768px) {
    .mobile-menu,
    .mobile-menu.mobile-menu-active {
        display: none !important;
    }
}

@keyframes mobileMenuSlideDown {
    from {
        opacity: 0;
        transform: translateY(-0.5rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile menu link styles — bright white text. */
.mobile-menu a,
#mobile-menu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s, background-color 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-decoration: none;
}

.mobile-menu a:hover,
.mobile-menu a:focus,
#mobile-menu a:hover,
#mobile-menu a:focus {
    color: #6b8e23;
    background: rgba(255, 255, 255, 0.05);
}

.mobile-menu .current-menu-item > a,
#mobile-menu .current-menu-item > a {
    color: #6b8e23;
}

/* Mobile menu list reset (the <ul> wrapper from wp_nav_menu). */
#mobile-menu-list,
.mobile-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Desktop menu current item (fallback when wp_nav_menu is used)
 * This is redundant with the #primary-menu rules above but kept
 * as a safety net for any menu container. */
.current-menu-item > a,
.current_page_item > a {
    color: #6b8e23 !important;
}

/* Testimonial carousel */
.testimonial-slide {
    display: none;
}

.testimonial-slide.is-active {
    display: flex;
}

/* Line clamp utility */
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Gallery item hover */
.gallery-item img {
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* WordPress alignment classes */
.alignleft {
    float: left;
    margin-right: 1.5em;
    margin-bottom: 1em;
}

.alignright {
    float: right;
    margin-left: 1.5em;
    margin-bottom: 1em;
}

.aligncenter {
    clear: both;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.alignwide {
    max-width: calc(100% + 4rem);
    margin-left: -2rem;
    margin-right: -2rem;
}

@media (min-width: 768px) {
    .alignwide {
        max-width: calc(100% + 8rem);
        margin-left: -4rem;
        margin-right: -4rem;
    }
}

.alignfull {
    max-width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
}

/* WordPress caption */
.wp-caption {
    max-width: 100%;
}

.wp-caption-text {
    font-size: 0.875rem;
    color: #6b7280;
    text-align: center;
    margin-top: 0.5rem;
}

/* Screen reader text */
.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;
    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;
}

/* Post content styles */
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
    color: #1f2937;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    margin-top: 2em;
    margin-bottom: 0.75em;
}

.entry-content h2 {
    font-size: 1.875rem;
    line-height: 1.3;
}

.entry-content h3 {
    font-size: 1.5rem;
    line-height: 1.3;
}

.entry-content p {
    margin-bottom: 1.5em;
    line-height: 1.75;
}

.entry-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

.entry-content a {
    color: #6b8e23;
    text-decoration: underline;
}

.entry-content a:hover {
    color: #5a7b1b;
}

.entry-content ul,
.entry-content ol {
    margin-bottom: 1.5em;
    padding-left: 2em;
}

.entry-content li {
    margin-bottom: 0.5em;
}

.entry-content blockquote {
    border-left: 4px solid #6b8e23;
    padding-left: 1.5rem;
    margin: 2em 0;
    font-style: italic;
    color: #4b5563;
}

/* Search form */
.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-form .search-field {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.search-form .search-submit {
    padding: 0.5rem 1.25rem;
    background-color: #6b8e23;
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-form .search-submit:hover {
    background-color: #5a7b1b;
}

/* Pagination */
.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 3rem;
}

.nav-links .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
    transition: all 0.2s;
}

.nav-links .page-numbers:hover {
    background-color: #6b8e23;
    color: white;
    border-color: #6b8e23;
}

.nav-links .page-numbers.current {
    background-color: #6b8e23;
    color: white;
    border-color: #6b8e23;
}

/* 404 page */
.error-404 .page-content {
    text-align: center;
    padding: 4rem 1rem;
}

/* -------------------------------------------------------
 * FLOATING WHATSAPP BUTTON
 *
 * Mobile-first: small circular button in the bottom-right.
 * On md+, expands to show the label on hover.
 * Has a subtle pulse animation to draw attention.
 * ------------------------------------------------------- */
.bromo-whatsapp-float {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 60;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 3.5rem;
    height: 3.5rem;
    padding: 0;
    border-radius: 9999px;
    background-color: #25D366; /* WhatsApp green */
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.45),
                0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s, padding 0.3s, gap 0.3s;
    overflow: hidden;
    white-space: nowrap;
    animation: bromoWhatsappPulse 2.4s ease-in-out infinite;
}

.bromo-whatsapp-float i {
    font-size: 1.75rem;
    line-height: 1;
}

.bromo-whatsapp-float__label {
    width: 0;
    opacity: 0;
    font-size: 0.875rem;
    font-weight: 600;
    transition: width 0.3s ease, opacity 0.2s ease 0.05s;
    overflow: hidden;
}

.bromo-whatsapp-float:hover,
.bromo-whatsapp-float:focus {
    background-color: #128C7E;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(18, 140, 126, 0.5),
                0 4px 10px rgba(0, 0, 0, 0.2);
    animation-play-state: paused;
    outline: none;
}

.bromo-whatsapp-float:focus-visible {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6),
                0 0 0 6px #25D366,
                0 12px 28px rgba(18, 140, 126, 0.5);
}

.bromo-whatsapp-float:active {
    transform: translateY(0) scale(0.96);
}

/* Larger spacing on tablet/desktop. */
@media (min-width: 640px) {
    .bromo-whatsapp-float {
        right: 1.5rem;
        bottom: 1.5rem;
        width: 3.75rem;
        height: 3.75rem;
    }
    .bromo-whatsapp-float i {
        font-size: 1.875rem;
    }
}

/* On md+, expand on hover to reveal the label. */
@media (min-width: 768px) {
    .bromo-whatsapp-float {
        right: 2rem;
        bottom: 2rem;
    }
    .bromo-whatsapp-float:hover .bromo-whatsapp-float__label,
    .bromo-whatsapp-float:focus .bromo-whatsapp-float__label {
        width: auto;
        opacity: 1;
        margin-left: 0.625rem;
        margin-right: 0.5rem;
    }
    .bromo-whatsapp-float:hover,
    .bromo-whatsapp-float:focus {
        width: auto;
        padding: 0 1.25rem 0 1.125rem;
        gap: 0.5rem;
    }
}

/* When the floating button is over the footer (which is dark green-bordered),
 * keep enough breathing room — the body padding-bottom prevents overlap of
 * any sticky CTA on inner pages. */
body {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

@keyframes bromoWhatsappPulse {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(37, 211, 102, 0.45),
                    0 2px 8px rgba(0, 0, 0, 0.15),
                    0 0 0 0 rgba(37, 211, 102, 0.55);
    }
    70% {
        box-shadow: 0 8px 24px rgba(37, 211, 102, 0.45),
                    0 2px 8px rgba(0, 0, 0, 0.15),
                    0 0 0 14px rgba(37, 211, 102, 0);
    }
}

/* Reduce motion: disable pulse for users who prefer it. */
@media (prefers-reduced-motion: reduce) {
    .bromo-whatsapp-float {
        animation: none;
    }
}

/* -------------------------------------------------------
 * FOOTER MENU (when wp_nav_menu has theme_location 'footer')
 * Apply the same chevron + hover style as the fallback list.
 * ------------------------------------------------------- */
.footer-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-menu li {
    margin: 0;
    padding: 0;
}

.footer-menu li + li {
    margin-top: 0.75rem;
}

.footer-menu a {
    color: #d1d5db;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: color 0.2s, transform 0.2s;
    padding: 0.25rem 0.25rem 0.25rem 0;
    border-radius: 0.25rem;
}

.footer-menu a::before {
    content: "\f054"; /* Font Awesome chevron-right */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.625rem;
    color: #6b8e23;
    margin-right: 0.75rem;
    transition: transform 0.2s;
}

.footer-menu a:hover {
    color: #ffffff;
}

.footer-menu a:hover::before {
    transform: translateX(0.25rem);
}
/* -------------------------------------------------------
 * GALLERY LIGHTBOX
 *
 * Mobile-first overlay lightbox. Built with vanilla JS.
 * The DOM is created at runtime by main.js and appended to <body>.
 * ------------------------------------------------------- */
.bromo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
}

.bromo-lightbox.is-open {
    display: flex;
    animation: bromoLightboxFadeIn 0.2s ease-out;
}

.bromo-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    cursor: zoom-out;
}

.bromo-lightbox__figure {
    position: relative;
    z-index: 1;
    margin: 0;
    padding: 1rem;
    max-width: min(96vw, 1400px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none; /* let backdrop receive clicks except on image */
}

.bromo-lightbox__img {
    max-width: 100%;
    max-height: 78vh;
    width: auto;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    background: #111;
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: auto;
    object-fit: contain;
}

.bromo-lightbox__img.is-loaded {
    opacity: 1;
    transform: scale(1);
}

.bromo-lightbox__caption {
    margin-top: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    text-align: center;
    max-width: 100%;
    pointer-events: auto;
    line-height: 1.4;
}

.bromo-lightbox__counter {
    margin-top: 0.5rem;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    pointer-events: auto;
}

.bromo-lightbox__spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2.5rem;
    height: 2.5rem;
    margin-left: -1.25rem;
    margin-top: -1.25rem;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #25D366;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.bromo-lightbox__spinner.is-visible {
    opacity: 1;
    animation: bromoLightboxSpin 0.8s linear infinite;
}

.bromo-lightbox__btn {
    position: absolute;
    z-index: 2;
    width: 2.75rem;
    height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s, color 0.2s;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.bromo-lightbox__btn i {
    font-size: 1.125rem;
    pointer-events: none;
}

.bromo-lightbox__btn:hover,
.bromo-lightbox__btn:focus-visible {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    outline: none;
}

.bromo-lightbox__btn:active {
    transform: scale(0.95);
}

.bromo-lightbox__close {
    top: 1rem;
    right: 1rem;
}

.bromo-lightbox__prev,
.bromo-lightbox__next {
    top: 50%;
    transform: translateY(-50%);
}

.bromo-lightbox__prev { left: 0.5rem; }
.bromo-lightbox__next { right: 0.5rem; }

.bromo-lightbox__prev:active,
.bromo-lightbox__next:active {
    transform: translateY(-50%) scale(0.95);
}

@media (min-width: 640px) {
    .bromo-lightbox__btn {
        width: 3rem;
        height: 3rem;
    }
    .bromo-lightbox__btn i {
        font-size: 1.25rem;
    }
    .bromo-lightbox__close { top: 1.5rem; right: 1.5rem; }
    .bromo-lightbox__prev  { left: 1.25rem; }
    .bromo-lightbox__next  { right: 1.25rem; }
}

@media (min-width: 1024px) {
    .bromo-lightbox__btn {
        width: 3.25rem;
        height: 3.25rem;
    }
    .bromo-lightbox__close { top: 2rem; right: 2rem; }
    .bromo-lightbox__prev  { left: 2rem; }
    .bromo-lightbox__next  { right: 2rem; }
    .bromo-lightbox__caption {
        font-size: 0.9375rem;
    }
}

@keyframes bromoLightboxFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes bromoLightboxSpin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .bromo-lightbox.is-open,
    .bromo-lightbox__img,
    .bromo-lightbox__spinner {
        animation: none !important;
        transition: none !important;
    }
}
