/* Sesvira Custom Styles */

:root {
    --bg-color: #020205;
}

body {
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    font-family: 'Cormorant Garamond', serif;
}

canvas {
    display: block;
}

@keyframes pulse-slow {

    0%,
    100% {
        opacity: 0.8;
        letter-spacing: 0.25em;
    }

    50% {
        opacity: 1;
        letter-spacing: 0.3em;
    }
}

.animate-pulse-slow {
    animation: pulse-slow 8s ease-in-out infinite;
}

/* Glass Modal Styling 2.0 (Crystal Bloom) */
.glass-modal {
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    background: linear-gradient(135deg, rgba(10, 10, 25, 0.7) 0%, rgba(20, 20, 45, 0.4) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        inset 0 0 20px rgba(255, 255, 255, 0.05);
}

/* Prismatic Reflection Effect */
.glass-modal::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(125deg,
            transparent 0%,
            rgba(255, 255, 255, 0.05) 45%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.05) 55%,
            transparent 100%);
    transform: translateX(-100%);
    transition: transform 1.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.glass-modal:hover::before {
    transform: translateX(100%);
}

#star-modal {
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

#star-modal.opacity-100 .glass-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

#star-modal.opacity-0 .glass-modal {
    transform: scale(0.9) translateY(20px);
    opacity: 0;
}

.glass-modal {
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.8s ease;
}

/* Stagger Animation Base */
#modal-text,
#modal-icon,
#resonate-btn,
#resonance-stats {
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

#star-modal.opacity-100 #modal-icon {
    transition-delay: 0.2s;
    opacity: 1;
    transform: translateY(0);
}

#star-modal.opacity-100 #modal-text {
    transition-delay: 0.4s;
    opacity: 1;
    transform: translateY(0);
}

#star-modal.opacity-100 #resonate-btn {
    transition-delay: 0.6s;
    opacity: 1;
    transform: translateY(0);
}

#star-modal.opacity-100 #resonance-stats {
    transition-delay: 0.8s;
    opacity: 1;
    transform: translateY(0);
}

/* Modal Particles */
.modal-particle {
    position: absolute;
    background: white;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0.3;
}

/* Emotion Auras */
.aura-hope {
    filter: drop-shadow(0 0 20px gold);
    color: #ffeb3b;
}

.aura-sadness {
    filter: drop-shadow(0 0 20px deepskyblue);
    color: #00b0ff;
}

.aura-secret {
    filter: drop-shadow(0 0 20px fuchsia);
    color: #e040fb;
}

/* Existing Animations */
@keyframes starFlare {
    0% {
        transform: scale(0);
        opacity: 0;
        filter: blur(10px) brightness(1);
    }

    50% {
        transform: scale(3);
        opacity: 1;
        filter: blur(2px) brightness(5);
    }

    100% {
        transform: scale(1);
        opacity: 0;
        filter: blur(20px) brightness(1);
    }
}

.star-flare {
    position: fixed;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 40px 20px white;
    z-index: 60;
    pointer-events: none;
    animation: starFlare 1.5s ease-out forwards;
}

@keyframes letterDance {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px) rotate(-5deg);
    }

    75% {
        transform: translateX(5px) rotate(5deg);
    }
}

.letter-particle {
    display: inline-block;
    animation: letterDance 3s ease-in-out infinite;
}

/* Floating Animation */
@keyframes crystalFloat {

    0%,
    100% {
        transform: translateY(0) rotate(0);
    }

    50% {
        transform: translateY(-10px) rotate(1deg);
    }
}

.glass-modal {
    animation: crystalFloat 10s ease-in-out infinite;
}

/* Info Panel & Button Styles */
#info-btn {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
}

#info-btn:hover {
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

#info-modal {
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

#info-modal.opacity-100 .glass-modal {
    transform: scale(1);
    opacity: 1;
}

#info-modal.opacity-0 .glass-modal {
    transform: scale(0.92);
    opacity: 0;
}

#info-modal .glass-modal {
    transition: transform 0.8s cubic-bezier(0.34, 1.3, 0.64, 1), opacity 0.6s ease;
}

/* Mobile optimizations for info modal */
@media (max-width: 768px) {
    #info-modal .glass-modal {
        padding: 2.5rem 1.5rem;
        margin: 1rem;
    }

    #info-modal h2 {
        font-size: 2.5rem;
    }
}
/* =========================================================
   Duygu paleti (script.js içindeki EMOTIONS ile aynı)
   ========================================================= */
:root {
    --emo-hope: #ffcf7a;
    --emo-sadness: #7fb2ff;
    --emo-secret: #c79bff;
    --emo-neutral: #e6e9f2;
}

/* Modal ikon auraları paletle uyumlu */
.aura-hope { filter: drop-shadow(0 0 18px rgba(255, 207, 122, 0.8)); color: var(--emo-hope); }
.aura-sadness { filter: drop-shadow(0 0 18px rgba(127, 178, 255, 0.8)); color: var(--emo-sadness); }
.aura-secret { filter: drop-shadow(0 0 18px rgba(199, 155, 255, 0.8)); color: var(--emo-secret); }
.aura-neutral { filter: drop-shadow(0 0 18px rgba(230, 233, 242, 0.6)); color: var(--emo-neutral); }

/* =========================================================
   Yıldız etkileşimi
   ========================================================= */
body.is-over-star,
body.is-over-star * {
    cursor: pointer;
}

#star-tooltip {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 45;
    max-width: 260px;
    padding: 0.7rem 1rem 0.8rem;
    border-radius: 16px;
    background: rgba(10, 10, 24, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    font-family: 'Cormorant Garamond', serif;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

#star-tooltip.is-visible {
    opacity: 1;
}

#star-tooltip .tooltip-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

#tooltip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

#tooltip-emotion {
    font-size: 0.68rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

#tooltip-text {
    font-size: 1.05rem;
    font-style: italic;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

/* =========================================================
   Duygu göstergesi / filtre
   ========================================================= */
#emotion-legend {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-family: 'Cormorant Garamond', serif;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.85rem 0.35rem 0.6rem;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.78rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.4s, background 0.4s, border-color 0.4s, opacity 0.4s;
}

.legend-item:hover,
.legend-item:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    outline: none;
}

.legend-item.is-active {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
}

.legend-item.is-muted {
    opacity: 0.35;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--emo);
    box-shadow: 0 0 10px var(--emo), 0 0 2px var(--emo);
    flex-shrink: 0;
}

.legend-count {
    margin-left: auto;
    padding-left: 0.6rem;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.35);
    font-variant-numeric: tabular-nums;
}

/* =========================================================
   Mesaj kutusu
   ========================================================= */
#send-btn {
    position: absolute;
    right: 0.25rem;
    bottom: 0.35rem;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.02);
    transition: color 0.4s, border-color 0.4s, background 0.4s, box-shadow 0.4s, transform 0.4s;
}

#send-btn.is-ready {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.45);
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.18);
}

#send-btn.is-ready:hover {
    background: #fff;
    color: #05050c;
    transform: translateY(-2px);
}

#send-btn:disabled {
    cursor: default;
}

.send-icon {
    width: 1.05rem;
    height: 1.05rem;
}

.send-spinner {
    display: none;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    animation: sendSpin 0.8s linear infinite;
}

#send-btn.is-sending,
#send-btn.is-sending:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    transform: none;
}

#send-btn.is-sending .send-icon { display: none; }
#send-btn.is-sending .send-spinner { display: block; }

@keyframes sendSpin {
    to { transform: rotate(360deg); }
}

#star-input:disabled {
    opacity: 0.5;
}

#input-meta {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.35);
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.4s, transform 0.4s;
}

#input-meta.is-visible {
    opacity: 1;
    transform: translateY(0);
}

#char-counter {
    font-variant-numeric: tabular-nums;
    transition: color 0.3s;
}

#char-counter.is-near { color: var(--emo-hope); }
#char-counter.is-over { color: #ff8a8a; }

.input-shell.is-shaking {
    animation: inputShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes inputShake {
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* Rezonans düğmesi: verildikten sonra dolu kalır */
#resonate-btn.is-resonated {
    background: #fff;
    color: #05050c;
}

/* =========================================================
   Telefon
   ========================================================= */
@media (max-width: 768px) {
    #emotion-legend {
        top: 1rem;
        left: 50%;
        transform: translateX(-50%);
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.15rem;
        width: calc(100% - 2rem);
    }

    .legend-item {
        padding: 0.3rem 0.55rem;
        font-size: 0.66rem;
        letter-spacing: 0.18em;
        gap: 0.4rem;
    }

    .legend-count {
        padding-left: 0.2rem;
    }

    #star-tooltip {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .atmo-layer { transition: none; }
    .input-shell.is-shaking { animation: none; }
}

/* =========================================================
   v2 — Gezilebilir gökyüzü
   ========================================================= */

/* Sürükleme dokunmatik ekranda da çalışsın */
html,
body {
    touch-action: none;
    overscroll-behavior: none;
}

main,
#canvas-container {
    cursor: grab;
}

body.is-dragging,
body.is-dragging * {
    cursor: grabbing !important;
    user-select: none;
}

/* ---------- Sinematik açılış ---------- */
#hero {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 15;
    white-space: nowrap;
    transform: translate(-50%, -50%) scale(1);
    transform-origin: center top;
    transition:
        top 2.4s cubic-bezier(0.65, 0, 0.2, 1),
        transform 2.4s cubic-bezier(0.65, 0, 0.2, 1),
        opacity 2s ease;
    animation: heroReveal 3.2s cubic-bezier(0.2, 0.6, 0.2, 1) backwards;
}

@keyframes heroReveal {
    from {
        opacity: 0;
        filter: blur(18px);
    }

    to {
        opacity: 1;
        filter: blur(0);
    }
}

/* Açılış bitince başlık küçük bir imzaya dönüşür */
body:not(.is-intro) #hero {
    top: 1.5rem;
    transform: translate(-50%, 0) scale(0.26);
    opacity: 0.85;
}

#tagline {
    transition: opacity 1.2s ease;
}

body:not(.is-intro) #tagline {
    opacity: 0;
}

/* Arayüz açılıştan sonra belirir */
#emotion-legend,
#message-container,
#ui-controls {
    transition: opacity 1.8s ease 0.6s;
}

body.is-intro #emotion-legend,
body.is-intro #message-container,
body.is-intro #ui-controls {
    opacity: 0;
    pointer-events: none;
}

#explore-hint {
    position: fixed;
    left: 50%;
    bottom: 9.5rem;
    transform: translateX(-50%);
    z-index: 20;
    margin: 0;
    white-space: nowrap;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1rem;
    letter-spacing: 0.22em;
    color: rgba(255, 255, 255, 0.6);
    pointer-events: none;
    opacity: 0;
    transition: opacity 2s ease;
}

#explore-hint.is-visible {
    opacity: 1;
}

/* ---------- Gökyüzü fısıltıları ---------- */
#sky-whisper {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 12;
    margin: 0;
    width: max-content;
    max-width: 250px;
    padding-left: 1.6rem;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.82);
    text-shadow: 0 0 18px var(--emo, #fff), 0 1px 10px rgba(0, 0, 0, 0.9);
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.6s ease;
    will-change: transform, opacity;
}

/* Yıldızdan metne uzanan ince çizgi */
#sky-whisper::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.72em;
    width: 1.1rem;
    height: 1px;
    background: linear-gradient(90deg, var(--emo, #fff), transparent);
    opacity: 0.8;
}

#sky-whisper > * {
    display: inline;
}

#sky-whisper.is-visible {
    opacity: 1;
}

/* Sağ kenara yakın yıldızlarda metin sola açılır */
#sky-whisper.is-flipped {
    padding-left: 0;
    padding-right: 1.6rem;
    text-align: right;
    margin-left: -250px;
    width: 250px;
}

#sky-whisper.is-flipped::before {
    left: auto;
    right: 0;
    background: linear-gradient(270deg, var(--emo, #fff), transparent);
}

/* ---------- Yıldız penceresi ---------- */
#star-life {
    margin: -0.75rem 0 0;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.85rem;
    letter-spacing: 0.18em;
    color: rgba(255, 255, 255, 0.38);
}

.resonance-ring {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 140px;
    height: 140px;
    margin: -70px 0 0 -70px;
    border-radius: 50%;
    border: 1px solid #fff;
    pointer-events: none;
    opacity: 0;
    animation: resonanceRing 1.7s cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
}

@keyframes resonanceRing {
    0% {
        transform: scale(0.3);
        opacity: 0.9;
    }

    100% {
        transform: scale(7);
        opacity: 0;
    }
}

/* ---------- Ortam sesi düğmesi ---------- */
#sound-btn {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
}

#sound-btn .sound-bar {
    transform-origin: center;
    transform: scaleY(0.35);
    transition: transform 0.5s ease;
}

#sound-btn.is-on {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 22px rgba(255, 255, 255, 0.2);
}

#sound-btn.is-on .sound-bar {
    animation: soundBar 1.4s ease-in-out infinite;
}

#sound-btn.is-on .sound-bar:nth-child(2) { animation-delay: -0.5s; }
#sound-btn.is-on .sound-bar:nth-child(3) { animation-delay: -0.9s; }
#sound-btn.is-on .sound-bar:nth-child(4) { animation-delay: -0.2s; }

@keyframes soundBar {
    0%, 100% { transform: scaleY(0.35); }
    50% { transform: scaleY(1); }
}

/* ---------- Telefon ---------- */
@media (max-width: 768px) {
    body:not(.is-intro) #hero {
        top: 1rem;
        transform: translate(-50%, 0) scale(0.34);
    }

    #emotion-legend {
        top: 3.4rem;
    }

    #explore-hint {
        font-size: 0.85rem;
        letter-spacing: 0.12em;
        bottom: 8.5rem;
    }

    #sky-whisper {
        max-width: 180px;
        font-size: 1rem;
    }

    #sky-whisper.is-flipped {
        width: 180px;
        margin-left: -180px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #hero {
        animation: none;
        transition: opacity 1s ease;
    }

    #sound-btn.is-on .sound-bar {
        animation: none;
        transform: scaleY(1);
    }
}

/* Telefonda mesaj kutusu, sağ alttaki düğmelerle üst üste gelmesin */
@media (max-width: 768px) {
    #message-container {
        bottom: 5.75rem;
    }

    #explore-hint {
        bottom: 11.5rem;
    }
}

/* Çeviri düğmesi (yıldız penceresinde, mesajın altında) */
#translate-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: -2.25rem auto 1.75rem;
    padding: 0.2rem 0.4rem;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.95rem;
    letter-spacing: 0.14em;
    color: rgba(255, 255, 255, 0.45);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    transition: color 0.4s, border-color 0.4s;
}

#translate-btn:hover:not(:disabled) {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
}

#translate-btn:disabled {
    cursor: progress;
    color: rgba(255, 255, 255, 0.6);
}

#translate-btn[hidden] {
    display: none;
}

/* =========================================================
   Dil seçici
   ========================================================= */
#lang-btn {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
}

#lang-btn[aria-expanded="true"] {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
}

#lang-code {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
}

#lang-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.75rem);
    min-width: 10.5rem;
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    border-radius: 18px;
    background: rgba(10, 10, 24, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
    animation: langMenuIn 0.25s ease-out;
}

#lang-menu[hidden] {
    display: none;
}

@keyframes langMenuIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

#lang-menu a {
    display: block;
    padding: 0.5rem 0.9rem;
    border-radius: 12px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.62);
    text-decoration: none;
    transition: background 0.3s, color 0.3s;
}

#lang-menu a:hover,
#lang-menu a:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
    outline: none;
}

#lang-menu a[aria-current] {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* =========================================================
   Sağdan sola diller (Arapça)
   ========================================================= */
[dir="rtl"] #emotion-legend {
    left: auto;
    right: 2rem;
}

[dir="rtl"] .legend-count {
    margin-left: 0;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0.6rem;
}

[dir="rtl"] #ui-controls {
    right: auto;
    left: 2rem;
}

[dir="rtl"] #lang-menu {
    right: auto;
    left: 0;
}

[dir="rtl"] #star-input {
    padding-left: 3rem;
    padding-right: 1rem;
}

[dir="rtl"] #send-btn {
    right: auto;
    left: 0.25rem;
}

/* Arapça harfler birbirine bağlıdır; harf aralığı bu bağı koparır.
   Latin harfli "Sesvira" logosu (h1) hariç. */
html[lang="ar"] body :not(h1) {
    letter-spacing: normal !important;
}

@media (max-width: 768px) {
    [dir="rtl"] #emotion-legend {
        right: auto;
        left: 50%;
    }

    [dir="rtl"] .legend-count {
        padding-right: 0.2rem;
    }
}
