/* ==========================================================================
   LANGUAGE SWITCH (TR / EN)
   ========================================================================== */
.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    margin-right: 10px;
    padding: 0 4px 0 11px;
    border-radius: 999px;
    border: 1px solid var(--px-border-2);
    background: var(--px-surface);
    color: var(--px-text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.lang-switch:hover {
    border-color: var(--px-blue-2);
    box-shadow: 0 4px 14px rgba(47, 85, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.lang-globe {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: var(--px-cyan);
    stroke-width: 1.7;
    opacity: 0.9;
    transition: transform 0.6s var(--px-ease);
}
.lang-switch[data-lang="en"] .lang-globe { transform: rotate(180deg); }

.lang-track {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 30px;
    padding: 2px;
    border-radius: 999px;
    background: rgba(4, 10, 32, 0.45);
}
.lang-thumb {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 2px;
    width: calc(50% - 2px);
    border-radius: 999px;
    background: var(--px-grad);
    box-shadow: 0 4px 14px -2px rgba(47, 85, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: transform 0.45s var(--px-ease);
}
.lang-switch[data-lang="en"] .lang-thumb { transform: translateX(100%); }

.lang-track button {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-width: 36px;
    margin: 0;
    padding: 0 10px;
    line-height: 1;
    box-shadow: none;
    transform: none;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--px-text);
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    opacity: 0.55;
    cursor: pointer;
    transition: opacity 0.25s ease, color 0.25s ease;
}
.lang-track button:hover { opacity: 0.9; }
.lang-track button[aria-checked="true"] { color: #fff; opacity: 1; }
.lang-track button:focus-visible { outline: 2px solid var(--px-cyan); outline-offset: 1px; }

html[data-theme="light"] .lang-switch {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(18, 32, 78, 0.04);
}
html[data-theme="light"] .lang-track { background: rgba(29, 69, 220, 0.07); }

/* Dil geçişi sırasında içerik yumuşak geçsin */
main { transition: opacity 0.18s ease, filter 0.18s ease, transform 0.18s ease; }
body.lang-out main { opacity: 0; filter: blur(6px); transform: translateY(4px); }
body.lang-in main { animation: lang-in 0.42s var(--px-ease) both; }
@keyframes lang-in {
    from { opacity: 0; filter: blur(6px); transform: translateY(-4px); }
    to { opacity: 1; filter: none; transform: none; }
}
/* Kayıtlı tercih İngilizce ise Türkçe metin bir an görünmesin */
html[data-lang-pending] main,
html[data-lang-pending] header { visibility: hidden; }

/* CSS ile üretilen metinler */
html[lang="en"] #index-grid button.ix-card[aria-current=true]::after { content: "Now"; }

@media (max-width: 760px) {
    .lang-switch { flex-shrink: 0; margin-left: auto; margin-right: 6px; height: 34px; padding: 0 2px; }
    .lang-globe { display: none; }
    .lang-track { height: 28px; }
    .lang-track button { min-width: 30px; padding: 0 6px; font-size: 10px; }
    #theme-toggle, #motion, #overview { flex-shrink: 0; }
    #theme-toggle { margin-left: 0; }
}
@media (max-width: 480px) {
    #overview { width: 34px; padding: 0; justify-content: center; }
    #overview span { display: none; }
}
/* İlk yüklemede seçici kaymadan yerinde başlasın */
.lang-switch.no-anim .lang-thumb,
.lang-switch.no-anim .lang-globe { transition: none; }
@media print {
    .lang-switch { display: none !important; }
}
