/**
 * Tema geçiş — hamburger menü ile uyumlu kare düğme
 */

.theme-toggle {
    --toggle-teal: #01b1af;
    position: relative;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    color: #ffffff;
    cursor: pointer;
    z-index: 9650;
    pointer-events: auto !important;
    overflow: hidden;
    transition: color 0.22s ease;
    -webkit-tap-highlight-color: transparent;
}

.theme-toggle::after {
    display: none;
}

.theme-toggle:hover {
    color: #ffffff;
}

.theme-toggle:focus-visible {
    outline: 2px solid rgba(1, 177, 175, 0.45);
    outline-offset: 2px;
}

/* ---- SVG glifler ---- */
.theme-toggle__glyph {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    pointer-events: none;
    transition:
        opacity 0.32s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.36s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle__svg {
    display: block;
    width: 100%;
    height: 100%;
}

.theme-toggle__glyph--sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
    color: #ffffff;
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.45));
}

.theme-toggle__glyph--sun .theme-toggle__svg :is(circle, path) {
    stroke-width: 1.45;
}

.theme-toggle:hover .theme-toggle__glyph--sun {
    color: #ffffff;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.65));
}

.theme-toggle__glyph--moon {
    opacity: 0;
    transform: rotate(-20deg) scale(0.75);
    color: #b8eceb;
}

body.light-mode .theme-toggle__glyph--sun {
    opacity: 0;
    transform: rotate(20deg) scale(0.75);
}

body.light-mode .theme-toggle__glyph--moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
    color: #0f172a;
    filter: none;
}

body.light-mode .top-nav.scrolled .theme-toggle__glyph--moon,
body.light-mode .top-nav.is-scrolled .theme-toggle__glyph--moon {
    color: #0f172a;
    filter: none;
}

body.light-mode .containers:has(.hero-slider) .top-nav:not(.scrolled):not(.is-scrolled) .theme-toggle__glyph--moon,
body.light-mode .containers:has(.hero-section) .top-nav:not(.scrolled):not(.is-scrolled) .theme-toggle__glyph--moon {
    color: #ffffff;
    filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.45));
}

body.light-mode .theme-toggle {
    color: #0f172a;
}

body.light-mode .containers:has(.hero-slider) .top-nav:not(.scrolled):not(.is-scrolled) .theme-toggle,
body.light-mode .containers:has(.hero-section) .top-nav:not(.scrolled):not(.is-scrolled) .theme-toggle {
    color: #ffffff;
}

body.light-mode .theme-toggle:focus-visible {
    outline-color: rgba(1, 138, 136, 0.4);
}

/* Masaüstü */
@media (min-width: 992px) {
    .theme-toggle__glyph {
        width: 18px;
        height: 18px;
    }
}

/* Mobil — hamburger ile aynı kutu */
@media (max-width: 991px) {
    .theme-toggle {
        position: fixed !important;
        top: calc(env(safe-area-inset-top, 0px) + 10px) !important;
        right: calc(max(10px, env(safe-area-inset-right, 0px)) + 60px) !important;
        left: auto !important;
        z-index: 9622 !important;
    }

    .theme-toggle__glyph {
        width: 22px;
        height: 22px;
    }
}

@media (max-width: 576px) {
    .theme-toggle {
        right: calc(max(10px, env(safe-area-inset-right, 0px)) + 60px) !important;
    }

    .theme-toggle__glyph {
        width: 20px;
        height: 20px;
    }
}

/* Mobil aydınlık mod — ay ikonu her zaman koyu (hero beyaz override kapalı) */
@media (max-width: 991px) {
    body.light-mode .theme-toggle,
    body.light-mode .theme-toggle__glyph--moon,
    body.light-mode .theme-toggle__glyph--moon .theme-toggle__svg :is(path, circle) {
        color: #0f172a !important;
        stroke: #0f172a !important;
        fill: #0f172a !important;
        filter: none !important;
    }

    body.light-mode .containers:has(.hero-slider) .top-nav .theme-toggle,
    body.light-mode .containers:has(.hero-slider) .top-nav .theme-toggle__glyph--moon,
    body.light-mode .containers:has(.hero-section) .top-nav .theme-toggle,
    body.light-mode .containers:has(.hero-section) .top-nav .theme-toggle__glyph--moon,
    body.light-mode .containers:has(.mh) .top-nav .theme-toggle,
    body.light-mode .containers:has(.mh) .top-nav .theme-toggle__glyph--moon {
        color: #0f172a !important;
        filter: none !important;
    }

    body.light-mode .containers:has(.hero-slider) .top-nav .theme-toggle__glyph--moon .theme-toggle__svg :is(path, circle),
    body.light-mode .containers:has(.hero-section) .top-nav .theme-toggle__glyph--moon .theme-toggle__svg :is(path, circle),
    body.light-mode .containers:has(.mh) .top-nav .theme-toggle__glyph--moon .theme-toggle__svg :is(path, circle) {
        stroke: #0f172a !important;
        fill: #0f172a !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .theme-toggle__glyph {
        transition-duration: 0.12s;
    }
}
