/* Below-the-fold widgets shared by every page (WhatsApp, cookie consent, mobile CTA).
   Loaded non-render-blocking from partials/head.php; these were inline <style> blocks before,
   which added ~21 KB of CSS to the HTML of every page. */

/* ---- WhatsApp chat widget (partials/whatsapp-button.php) ---- */
    .whatsapp-widget {
        --wa-size: 56px;
        /* --wa-gap used to clear room for the HubSpot chat bubble; the chat
           widget is disabled (head.php), so the button sits in the corner. */
        --wa-offset-right: 16px;
        --wa-offset-bottom: 16px;
        --wa-gap: 0px;
    }

    /* Phones: 60px button inset 8px from the viewport's right/bottom edges. */
    @media (max-width: 767px) {
        .whatsapp-widget {
            --wa-size: 60px;
            --wa-offset-right: 8px;
            --wa-offset-bottom: 8px;
            --wa-gap: 0px;
        }
    }

    @media (min-width: 768px) {
        .whatsapp-widget {
            --wa-size: 60px;
            --wa-gap: 0px;
        }
    }

    .whatsapp-float {
        position: fixed;
        right: calc(var(--wa-offset-right) + var(--wa-gap));
        bottom: calc(var(--wa-offset-bottom) + env(safe-area-inset-bottom, 0px));
        z-index: 999997;
        width: var(--wa-size);
        height: var(--wa-size);
        border-radius: 50%;
        background: #25D366;
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: calc(var(--wa-size) * 0.5);
        text-decoration: none;
        box-shadow: 0 4px 16px rgba(0,42,77, .22), 0 0 0 0 rgba(37, 211, 102, .5);
        animation: whatsapp-pulse 2.4s ease-out infinite;
        transition: transform .2s ease, box-shadow .2s ease;
        /* Mobile WebKit draws its default tap-highlight and the focus
           outline below as a rectangle, ignoring border-radius — without
           this it shows as a black square over the circular button on
           tap/active. box-shadow (used for the focus ring) does follow
           border-radius, so we rely on that instead of outline. */
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }

    /* Inline SVG instead of the fa-brands icon font: this widget renders on
       every page, and fa-brands (117KB woff2) was otherwise only needed by
       a handful of specific pages (blog share icons, team LinkedIn links,
       contact page) — fonts are only fetched when a glyph from them is
       actually rendered, so this stops the sitewide download for pages that
       don't otherwise use any brand icon. Sizing matches the previous
       font-size-based icon (0.5 * --wa-size) exactly. */
    .whatsapp-float-icon {
        width: calc(var(--wa-size) * 0.5);
        height: calc(var(--wa-size) * 0.5);
        fill: currentColor;
    }

    .whatsapp-widget[data-open="true"] .whatsapp-float {
        animation-play-state: paused;
    }

    .whatsapp-float:hover,
    .whatsapp-float:focus-visible {
        transform: scale(1.08) translateY(-2px);
        color: #fff;
        animation-play-state: paused;
    }

    .whatsapp-float:focus-visible {
        /* outline ignores border-radius on WebKit and renders as a square
           around this circular button — box-shadow doesn't, so the focus
           ring is built from box-shadow only, no outline. */
        outline: none;
        box-shadow: 0 0 0 4px rgba(255,179,26, .9), 0 4px 16px rgba(0,42,77, .22);
    }

    @keyframes whatsapp-pulse {
        0% { box-shadow: 0 4px 16px rgba(0,42,77, .22), 0 0 0 0 rgba(37, 211, 102, .45); }
        70% { box-shadow: 0 4px 16px rgba(0,42,77, .22), 0 0 0 14px rgba(37, 211, 102, 0); }
        100% { box-shadow: 0 4px 16px rgba(0,42,77, .22), 0 0 0 0 rgba(37, 211, 102, 0); }
    }

    /* --- Popup card --------------------------------------------------- */

    .whatsapp-popup {
        position: fixed;
        right: var(--wa-offset-right);
        left: var(--wa-offset-right);
        bottom: calc(var(--wa-offset-bottom) + env(safe-area-inset-bottom, 0px) + var(--wa-size) + 12px);
        z-index: 999997;
        max-width: 340px;
        margin-left: auto;
        background: #fff;
        border-radius: 14px;
        overflow: hidden;
        box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
        opacity: 0;
        visibility: hidden;
        transform: translateY(12px) scale(.98);
        transform-origin: bottom right;
        transition: opacity .18s ease, transform .18s ease, visibility .18s;
    }

    .whatsapp-popup[data-visible="true"] {
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
    }

    @media (min-width: 480px) {
        .whatsapp-popup {
            right: calc(var(--wa-offset-right) + var(--wa-gap));
            left: auto;
            width: 340px;
        }
    }

    @media (min-width: 768px) {
        .whatsapp-popup {
            width: 360px;
        }
    }

    .whatsapp-popup-header {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 16px 18px;
        background: #075E54;
        color: #fff;
    }

    .whatsapp-popup-avatar-wrap {
        position: relative;
        flex-shrink: 0;
    }

    .whatsapp-popup-avatar {
        display: block;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        object-fit: cover;
        background: #fff;
    }

    .whatsapp-popup-avatar-status {
        position: absolute;
        right: -1px;
        bottom: -1px;
        width: 11px;
        height: 11px;
        border-radius: 50%;
        background: #4ade80;
        border: 2px solid #075E54;
    }

    .whatsapp-popup-heading {
        flex: 1;
        min-width: 0;
    }

    .whatsapp-popup-title {
        margin: 0;
        font-family: var(--font-heading, sans-serif);
        font-size: 16px;
        font-weight: 700;
        line-height: 1.3;
    }

    .whatsapp-popup-subtitle {
        display: flex;
        align-items: center;
        gap: 5px;
        margin: 3px 0 0;
        font-family: var(--font-body, 'Hanken Grotesk', sans-serif);
        font-size: 12px;
        color: rgba(255, 255, 255, .85);
        line-height: 1.3;
    }

    .whatsapp-popup-subtitle-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #4ade80;
        flex-shrink: 0;
    }

    .whatsapp-popup-close {
        flex-shrink: 0;
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        border-radius: 50%;
        background: transparent;
        color: #fff;
        cursor: pointer;
        transition: background .15s ease;
    }

    .whatsapp-popup-close:hover {
        background: rgba(255, 255, 255, .15);
    }

    .whatsapp-popup-close:focus-visible {
        outline: 2px solid #fff;
        outline-offset: 2px;
    }

    .whatsapp-popup-close svg {
        width: 16px;
        height: 16px;
    }

    .whatsapp-popup-body {
        padding: 16px;
        background-color: #e5ddd5;
        background-image:
            radial-gradient(rgba(0, 0, 0, .035) 1px, transparent 1px),
            radial-gradient(rgba(0, 0, 0, .035) 1px, transparent 1px);
        background-size: 26px 26px;
        background-position: 0 0, 13px 13px;
    }

    /* Gerçek WhatsApp, ilk mesajdan önce her sohbette bu iki "sistem" balonunu
       gösterir: uçtan uca şifreleme notu ve bir tarih ayracı. Bunlar olmadan
       balon havada asılı kalan bir demo gibi görünüyordu. */
    .whatsapp-popup-notice {
        display: flex;
        align-items: center;
        gap: 6px;
        max-width: 92%;
        margin: 0 auto 10px;
        padding: 7px 12px;
        background: #fef7cd;
        color: #54656f;
        font-family: var(--font-body, 'Hanken Grotesk', sans-serif);
        font-size: 11.5px;
        line-height: 1.4;
        text-align: center;
        border-radius: 8px;
        box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
    }

    .whatsapp-popup-notice svg {
        width: 12px;
        height: 12px;
        flex-shrink: 0;
        color: #8a7a2b;
    }

    .whatsapp-popup-date {
        display: block;
        width: fit-content;
        margin: 0 auto 10px;
        padding: 5px 12px;
        background: rgba(255, 255, 255, .9);
        color: #54656f;
        font-family: var(--font-body, 'Hanken Grotesk', sans-serif);
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .03em;
        border-radius: 8px;
        box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
    }

    .whatsapp-popup-bubble-row {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .whatsapp-popup-bubble {
        position: relative;
        max-width: 88%;
        background: #fff;
        border-radius: 8px;
        border-top-left-radius: 0;
        padding: 8px 10px 6px;
        font-family: var(--font-body, 'Hanken Grotesk', sans-serif);
        font-size: 14px;
        line-height: 1.5;
        color: var(--primary-dark-matte, #002A4D);
        box-shadow: 0 1px 1px rgba(0, 0, 0, .12);
    }

    .whatsapp-popup-bubble::before {
        content: "";
        position: absolute;
        top: 0;
        left: -7px;
        width: 0;
        height: 0;
        border-style: solid;
        border-width: 0 8px 8px 0;
        border-color: transparent #fff transparent transparent;
    }

    /* Karşı taraf yazarken görünen "..." balonu — mesaj daha az "hazır
       bekleyen bir metin", daha çok gerçek zamanlı gelen bir yanıt gibi
       hissettirir. JS kapalıyken (veya reduced-motion) hiç görünmez, gerçek
       mesaj balonu doğrudan görünür durumda kalır — yani ilerlemeli
       geliştirme: JS olmadan da sohbet tam ve okunabilir. */
    .whatsapp-popup-typing {
        display: none;
        align-items: center;
        gap: 4px;
        padding: 11px 12px;
    }

    .whatsapp-popup-typing[data-active="true"] {
        display: inline-flex;
    }

    .whatsapp-popup-typing-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: rgba(0,42,77, .35);
        animation: whatsapp-typing-bounce 1.2s ease-in-out infinite;
    }

    .whatsapp-popup-typing-dot:nth-child(2) { animation-delay: .15s; }
    .whatsapp-popup-typing-dot:nth-child(3) { animation-delay: .3s; }

    @keyframes whatsapp-typing-bounce {
        0%, 60%, 100% { transform: translateY(0); opacity: .5; }
        30% { transform: translateY(-4px); opacity: 1; }
    }

    .whatsapp-popup-bubble.wa-message {
        opacity: 1;
        transform: translateY(0);
        transition: opacity .25s ease, transform .25s ease;
    }

    .whatsapp-popup-bubble.wa-message[data-pending="true"] {
        display: none;
    }

    .whatsapp-popup-bubble.wa-message[data-revealing="true"] {
        display: block;
        opacity: 0;
        transform: translateY(6px);
    }

    .whatsapp-popup-time {
        display: block;
        margin-top: 4px;
        font-family: var(--font-body, 'Hanken Grotesk', sans-serif);
        font-size: 10px;
        color: rgba(0,42,77, .45);
        text-align: right;
    }

    .whatsapp-popup-compose {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 12px;
        background: #f0f0f0;
    }

    .whatsapp-popup-input {
        flex: 1;
        min-width: 0;
        border: none;
        border-radius: 999px;
        padding: 11px 16px;
        background: #fff;
        font-family: var(--font-body, 'Hanken Grotesk', sans-serif);
        font-size: 14px;
        color: var(--primary-dark-matte, #002A4D);
        box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
    }

    .whatsapp-popup-input::placeholder {
        color: rgba(0,42,77, .45);
    }

    .whatsapp-popup-input:focus-visible {
        outline: none;
        box-shadow: inset 0 0 0 1.5px #25D366;
    }

    .whatsapp-popup-send {
        flex-shrink: 0;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        border-radius: 50%;
        background: #25D366;
        color: #fff;
        cursor: pointer;
        transition: background .15s ease, transform .1s ease;
    }

    .whatsapp-popup-send:hover {
        background: #1ebc59;
    }

    .whatsapp-popup-send:active {
        transform: scale(.94);
    }

    .whatsapp-popup-send:focus-visible {
        outline: 2px solid var(--primary-dark-matte, #002A4D);
        outline-offset: 2px;
    }

    .whatsapp-popup-send svg {
        width: 18px;
        height: 18px;
        margin-left: -2px;
    }

    /* Hidden while the mobile hamburger menu overlay is open — otherwise it
       sits on top of the overlay's contact row and CTA button (z-index 999997
       vs the overlay's 9999). Class is toggled by assets/js/global.js. */
    body.mobile-menu-open .whatsapp-widget {
        display: none;
    }

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

        .whatsapp-popup {
            transition: opacity .01s linear, visibility .01s linear;
            transform: none;
        }
    }

/* ---- Cookie consent banner and settings modal (partials/cookie-consent.php) ---- */
.ylw-cc-banner,
.ylw-cc-modal { font-family: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #002A4D; }

.ylw-cc-banner {
    position: fixed; left: 24px; bottom: 24px; z-index: 999998;
    width: 420px; max-width: calc(100vw - 32px);
    background: #ffffff; color: #002A4D;
    border: 1px solid #e8e8e8; border-radius: 14px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
    transform: translateY(20px); opacity: 0;
    transition: transform .35s ease, opacity .35s ease;
}
.ylw-cc-banner[data-visible="true"] { transform: translateY(0); opacity: 1; }
.ylw-cc-body { padding: 22px 22px 20px; }
.ylw-cc-heading { font-family: var(--font-heading); font-size: 18px; font-weight: 700; line-height: 1.2; margin: 0 0 8px; color: #002A4D; }
.ylw-cc-text { font-size: 13.5px; line-height: 1.55; color: #4b5563; margin: 0 0 16px; }
.ylw-cc-link { color: #002A4D; text-decoration: underline; font-weight: 600; }
.ylw-cc-link:hover { color: #FFB31A; }
.ylw-cc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.ylw-cc-btn {
    font-family: inherit; font-size: 13.5px; font-weight: 600;
    padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
    cursor: pointer; transition: all .18s ease; line-height: 1.2;
}
.ylw-cc-btn-primary { background: #002A4D; color: #ffffff; border-color: #002A4D; }
.ylw-cc-btn-primary:hover { background: #FFB31A; color: #002A4D; border-color: #FFB31A; }
.ylw-cc-btn-secondary { background: transparent; color: #002A4D; border-color: #002A4D; }
.ylw-cc-btn-secondary:hover { background: #002A4D; color: #ffffff; }
.ylw-cc-btn-link { background: transparent; color: #4b5563; border: none; padding: 10px 8px; text-decoration: underline; }
.ylw-cc-btn-link:hover { color: #002A4D; }

.ylw-cc-modal {
    position: fixed; inset: 0; z-index: 999999;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.ylw-cc-modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(2px); }
.ylw-cc-modal-panel {
    position: relative; width: 100%; max-width: 640px; max-height: 88vh;
    background: #ffffff; border-radius: 16px; overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,.25);
    display: flex; flex-direction: column;
}
.ylw-cc-modal-close {
    position: absolute; top: 14px; right: 14px;
    width: 32px; height: 32px; border-radius: 50%;
    border: 1px solid #e5e7eb; background: #ffffff; color: #002A4D;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all .18s ease; z-index: 2;
}
.ylw-cc-modal-close:hover { background: #002A4D; color: #ffffff; border-color: #002A4D; }
.ylw-cc-modal-content { padding: 28px 28px 24px; overflow-y: auto; }
.ylw-cc-modal-heading { font-family: var(--font-heading); font-size: 22px; font-weight: 700; line-height: 1.2; margin: 0 0 12px; color: #002A4D; }
.ylw-cc-modal-intro { font-size: 14px; line-height: 1.6; color: #4b5563; margin: 0 0 22px; }

.ylw-cc-category { border: 1px solid #eef0f3; border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; background: #F7F4EC; }
.ylw-cc-cat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.ylw-cc-cat-title { font-weight: 700; font-size: 14.5px; color: #002A4D; }
.ylw-cc-always { font-size: 12.5px; color: #6b7280; font-weight: 500; }
.ylw-cc-cat-desc { font-size: 13px; line-height: 1.55; color: #4b5563; }

.ylw-cc-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.ylw-cc-switch input { opacity: 0; width: 0; height: 0; }
.ylw-cc-slider {
    position: absolute; inset: 0; background: #d1d5db; border-radius: 999px;
    transition: background .2s ease; cursor: pointer;
}
.ylw-cc-slider::before {
    content: ""; position: absolute; top: 3px; left: 3px;
    width: 18px; height: 18px; background: #ffffff; border-radius: 50%;
    transition: transform .2s ease; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.ylw-cc-switch input:checked + .ylw-cc-slider { background: #FFB31A; }
.ylw-cc-switch input:checked + .ylw-cc-slider::before { transform: translateX(18px); }
.ylw-cc-switch input:focus-visible + .ylw-cc-slider { outline: 2px solid #FFB31A; outline-offset: 2px; }

.ylw-cc-modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid #eef0f3; }

@media (max-width: 640px) {
    .ylw-cc-banner { left: 0; right: 0; bottom: 0; width: 100%; max-width: 100%; border-radius: 14px 14px 0 0; border-left: none; border-right: none; border-bottom: none; }
    .ylw-cc-body { padding: 18px 18px 18px; }
    .ylw-cc-heading { font-size: 16.5px; }
    .ylw-cc-text { font-size: 13px; margin-bottom: 12px; }
    .ylw-cc-actions { gap: 6px; }
    .ylw-cc-btn { padding: 9px 14px; font-size: 13px; }
    .ylw-cc-btn-link { padding: 9px 6px; }
    .ylw-cc-modal-content { padding: 22px 18px 18px; }
    .ylw-cc-modal-heading { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .ylw-cc-banner { transition: none; }
}

/* ---- Mobile sticky CTA (partials/mobile-sticky-cta.php) ---- */
    /* Persistent mobile CTA that scrolls with the page, appearing once the
       visitor has scrolled a bit rather than sitting fixed from page load.
       Modeled on the already-tested .sticky-cta-btn pattern used across the
       ad-landing microsites (e.g. corporate/style.css + corporate/script.js),
       adapted so it works the same way on every page type on the main site
       (no per-page "hero" selector to keep in sync — see mobileStickyCta.js
       logic below for why a scroll-distance trigger was used instead). */
    .mobile-sticky-cta {
        display: none;
        position: fixed;
        left: 50%;
        bottom: 20px;
        /* Slide-in animates transform only (translateY), not bottom — bottom
           is a layout-affecting property and animating it triggers a layout
           on every frame (Lighthouse's "Avoid non-composited animations"
           flag); transform/opacity are compositor-only. */
        transform: translateX(-50%) translateY(140px);
        z-index: 999;
        width: 90%;
        max-width: 400px;
        justify-content: center;
        align-items: center;
        gap: 10px;
        padding: 14px 24px;
        border-radius: 50px;
        background: var(--primary-yellow, #FFB31A);
        color: var(--primary-dark-matte, #002A4D);
        font-family: var(--font-body, sans-serif);
        font-size: 15px;
        font-weight: 700;
        text-decoration: none;
        box-shadow: 0 10px 25px rgba(0, 0, 0, .25);
        opacity: 0;
        visibility: hidden;
        transition: transform .4s cubic-bezier(.68, -.55, .265, 1.55), opacity .3s, visibility .3s;
    }

    .mobile-sticky-cta.visible {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .mobile-sticky-cta:hover,
    .mobile-sticky-cta:focus {
        color: var(--primary-dark-matte, #002A4D);
        text-decoration: none;
    }

    /* Lift the WhatsApp bubble above this pill instead of overlapping it —
       both are bottom-fixed and the pill is wide enough to reach under the
       bubble's usual position. --wa-offset-bottom is read by
       templates/partials/whatsapp-button.php. */
    body.sticky-cta-visible .whatsapp-widget {
        --wa-offset-bottom: 90px;
    }

    @media (max-width: 991px) {
        .mobile-sticky-cta {
            display: flex;
        }

        /* "Quiet zones": while an element marked [data-floating-quiet] (e.g. the
           newsletter form) is on screen, the floating pill and the WhatsApp
           bubble step aside so they never cover its fields or button. */
        body.floating-quiet .whatsapp-widget:not([data-open="true"]) .whatsapp-float {
            opacity: 0;
            visibility: hidden;
            transform: scale(.85);
            pointer-events: none;
            transition: opacity .2s, transform .2s, visibility .2s;
        }
    }
