/* Shared components: WhatsApp contact, project cards, project gallery.
   Loaded on every page after the page stylesheet. Uses the existing brand palette:
   #1e3a5f (navy), #2c5282, #152d4a, #0f1f3a (dark navy). */

/* ===== WhatsApp icon (single definition, tinted with currentColor) ===== */
.wa-icon {
    display: inline-block;
    width: 1.25em;
    height: 1.25em;
    flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 0 1-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 0 1-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 0 1 2.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0 0 12.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 0 0 5.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 0 0-3.48-8.413z'/></svg>") center / contain no-repeat;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 0 1-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 0 1-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 0 1 2.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0 0 12.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 0 0 5.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 0 0-3.48-8.413z'/></svg>") center / contain no-repeat;
}

/* ===== Navbar additions ===== */
.nav-links {
    align-items: center;
}

.nav-links a.nav-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1.1rem;
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    border-radius: 50px;
    color: white;
    transition: background-color 0.3s, color 0.3s;
}

.nav-links a.nav-whatsapp:hover {
    background-color: white;
    color: #1e3a5f;
}

@media (max-width: 1024px) and (min-width: 769px) {
    .nav-links {
        gap: 1.75rem;
    }
}

@media (max-width: 768px) {
    .nav-links a.nav-whatsapp {
        margin-top: 0.5rem;
    }
}

/* ===== Buttons ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background-color: #1e3a5f;
    color: white;
    padding: 0.9rem 2.25rem;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1.05rem;
    text-decoration: none;
    transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
}

.btn-primary:hover {
    background-color: #2c5282;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(30, 58, 95, 0.25);
}

/* ===== Floating WhatsApp button ===== */
.whatsapp-float {
    position: fixed;
    left: max(20px, env(safe-area-inset-left));
    bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    height: 58px;
    min-width: 58px;
    padding: 0 17px;
    border-radius: 50px;
    background-color: #1e3a5f;
    color: white;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(15, 31, 58, 0.35);
    transition: background-color 0.3s, box-shadow 0.3s, opacity 0.25s, visibility 0.25s;
}

.whatsapp-float .wa-icon {
    width: 24px;
    height: 24px;
}

.whatsapp-float::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid #1e3a5f;
    animation: whatsapp-pulse 2.4s ease-out infinite;
    pointer-events: none;
}

.whatsapp-float-label {
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    font-weight: bold;
    transition: max-width 0.35s ease;
}

.whatsapp-float:hover,
.whatsapp-float:focus-visible {
    background-color: #2c5282;
    box-shadow: 0 8px 26px rgba(15, 31, 58, 0.45);
}

.whatsapp-float:hover .whatsapp-float-label,
.whatsapp-float:focus-visible .whatsapp-float-label {
    max-width: 160px;
}

@keyframes whatsapp-pulse {
    0% { transform: scale(1); opacity: 0.6; }
    70%, 100% { transform: scale(1.35); opacity: 0; }
}

.gallery-open .whatsapp-float {
    opacity: 0;
    visibility: hidden;
}

@media (max-width: 768px) {
    .whatsapp-float {
        left: max(16px, env(safe-area-inset-left));
        bottom: max(16px, env(safe-area-inset-bottom));
        height: 54px;
        min-width: 54px;
        padding: 0 15px;
    }

    /* no hover on touch screens — keep it a compact round button */
    .whatsapp-float-label {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .whatsapp-float::before {
        animation: none;
    }
}

/* ===== WhatsApp contact card (homepage + contact page) ===== */
.whatsapp-card {
    background: linear-gradient(135deg, #1a2b4a 0%, #2d4a7c 100%);
    color: white;
    padding: 3rem 2.5rem;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.whatsapp-card-icon {
    width: 76px;
    height: 76px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.12);
    border: 1.5px solid rgba(255, 255, 255, 0.35);
}

.whatsapp-card-icon .wa-icon {
    width: 38px;
    height: 38px;
}

.whatsapp-card h2,
.whatsapp-card h3 {
    color: white;
    font-size: 1.9rem;
    margin-bottom: 1rem;
}

.whatsapp-card p {
    color: rgba(255, 255, 255, 0.88);
    font-size: 1.1rem;
    line-height: 1.8;
    max-width: 440px;
    margin: 0 auto 2rem;
}

.whatsapp-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    background-color: white;
    color: #1e3a5f;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-size: 1.15rem;
    font-weight: bold;
    text-decoration: none;
    transition: transform 0.3s, box-shadow 0.3s;
}

.whatsapp-button .wa-icon {
    width: 26px;
    height: 26px;
}

.whatsapp-button:hover {
    color: #1e3a5f;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

.whatsapp-card-note {
    display: block;
    margin-top: 1.25rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
}

@media (max-width: 768px) {
    .whatsapp-card {
        padding: 2.25rem 1.5rem;
    }

    .whatsapp-card h2,
    .whatsapp-card h3 {
        font-size: 1.6rem;
    }

    .whatsapp-button {
        width: 100%;
        padding: 1rem 1.5rem;
    }
}

/* Button row inside a .whatsapp-card (WhatsApp + secondary link) */
.cta-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-outline-light {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2.25rem;
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    border-radius: 50px;
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.3s, color 0.3s;
}

.btn-outline-light:hover {
    background-color: white;
    color: #1e3a5f;
}

@media (max-width: 768px) {
    .cta-actions a {
        width: 100%;
    }
}

/* ===== Project cards ===== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.project-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    text-align: right;
    font: inherit;
    color: inherit;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.project-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 28px rgba(30, 58, 95, 0.22);
}

.project-card:focus-visible {
    outline: 3px solid #2c5282;
    outline-offset: 3px;
}

.project-card-media {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background-color: #e4e9f0;
}

.project-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
}

.project-card:hover .project-card-media img {
    transform: scale(1.06);
}

.project-card-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 31, 58, 0.75) 0%, rgba(15, 31, 58, 0) 55%);
    opacity: 0;
    transition: opacity 0.35s;
}

.project-card:hover .project-card-media::after {
    opacity: 1;
}

.project-card-count {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    z-index: 1;
    padding: 0.2rem 0.75rem;
    border-radius: 50px;
    background-color: rgba(15, 31, 58, 0.78);
    color: white;
    font-size: 0.85rem;
}

.project-card-view {
    position: absolute;
    bottom: 1rem;
    right: 50%;
    z-index: 1;
    padding: 0.45rem 1.4rem;
    border: 1.5px solid white;
    border-radius: 50px;
    color: white;
    font-weight: bold;
    font-size: 0.95rem;
    opacity: 0;
    transform: translate(50%, 10px);
    transition: opacity 0.35s, transform 0.35s;
}

.project-card:hover .project-card-view,
.project-card:focus-visible .project-card-view {
    opacity: 1;
    transform: translate(50%, 0);
}

.project-card-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 1.25rem 1.4rem 1.5rem;
    flex: 1;
}

.project-card-category {
    padding: 0.15rem 0.75rem;
    border-radius: 50px;
    background-color: #e8eef5;
    color: #1e3a5f;
    font-size: 0.85rem;
    font-weight: bold;
}

.project-card-title {
    color: #1e3a5f;
    font-size: 1.2rem;
    font-weight: bold;
    line-height: 1.5;
}

.project-card-location {
    color: #666;
    font-size: 0.95rem;
}

.project-card-description {
    color: #666;
    line-height: 1.7;
}

.projects-actions {
    text-align: center;
    margin-top: 3rem;
}

@media (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 640px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

@media (hover: none) {
    /* touch: show the "view photos" hint without hover */
    .project-card-media::after,
    .project-card-view {
        opacity: 1;
    }

    .project-card-view {
        transform: translate(50%, 0);
    }
}

/* ===== Project gallery modal ===== */
.gallery-open,
.gallery-open body {
    overflow: hidden;
}

.gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background-color: rgba(10, 21, 40, 0.92);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.gallery-modal[hidden] {
    display: none;
}

.gallery-modal.is-open {
    opacity: 1;
}

.gallery-dialog {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1100px;
    max-height: 100%;
    background-color: #0f1f3a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.96) translateY(12px);
    transition: transform 0.25s ease;
}

.gallery-modal.is-open .gallery-dialog {
    transform: none;
}

.gallery-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.5rem;
    color: white;
    border-bottom: 1px solid #2a3a5a;
}

.gallery-title {
    font-size: 1.4rem;
    line-height: 1.4;
}

.gallery-meta {
    color: #b8c4d6;
    font-size: 0.95rem;
}

.gallery-close {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.9rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.3s;
}

.gallery-close:hover,
.gallery-close:focus-visible {
    background-color: rgba(255, 255, 255, 0.25);
}

.gallery-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: min(64vh, 640px);
    background-color: #0a1528;
    touch-action: pan-y;
}

.gallery-main {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    transition: opacity 0.25s ease;
}

.gallery-main.is-loading {
    opacity: 0.25;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background-color: rgba(15, 31, 58, 0.75);
    color: white;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.3s;
}

.gallery-nav:hover,
.gallery-nav:focus-visible {
    background-color: #2c5282;
}

.gallery-prev {
    right: 1rem;
}

.gallery-next {
    left: 1rem;
}

.gallery-counter {
    position: absolute;
    bottom: 0.85rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.15rem 0.85rem;
    border-radius: 50px;
    background-color: rgba(15, 31, 58, 0.75);
    color: white;
    font-size: 0.9rem;
    direction: ltr;
}

.gallery-thumbs {
    display: flex;
    gap: 0.6rem;
    padding: 0.9rem 1.5rem;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #2c5282 transparent;
}

.gallery-thumb {
    flex: 0 0 auto;
    width: 92px;
    height: 68px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    background: #1e3a5f;
    opacity: 0.55;
    cursor: pointer;
    transition: opacity 0.25s, border-color 0.25s;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-thumb:hover,
.gallery-thumb:focus-visible {
    opacity: 0.9;
}

.gallery-thumb.is-active {
    opacity: 1;
    border-color: white;
}

.gallery-modal.is-single .gallery-nav,
.gallery-modal.is-single .gallery-counter,
.gallery-modal.is-single .gallery-thumbs {
    display: none;
}

@media (max-width: 768px) {
    .gallery-modal {
        padding: 0;
    }

    .gallery-dialog {
        height: 100%;
        border-radius: 0;
    }

    .gallery-header {
        padding: max(0.9rem, env(safe-area-inset-top)) 1rem 0.9rem;
    }

    .gallery-title {
        font-size: 1.15rem;
    }

    .gallery-stage {
        flex: 1;
        height: auto;
        min-height: 0;
    }

    .gallery-nav {
        width: 44px;
        height: 44px;
    }

    .gallery-prev {
        right: 0.5rem;
    }

    .gallery-next {
        left: 0.5rem;
    }

    .gallery-thumbs {
        padding: 0.75rem 1rem max(0.75rem, env(safe-area-inset-bottom));
    }

    .gallery-thumb {
        width: 72px;
        height: 54px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-modal,
    .gallery-dialog,
    .project-card,
    .project-card-media img {
        transition: none;
    }
}
