/* --- RENK DEĞİŞKENLERİ VE TEMA YÖNETİMİ --- */
:root {
    /* Gündüz Modu */
    --bg-color: #f6f6f6;
    --heading-color: #18181b; /* Daha doygun bir siyah */
    --secondary-text: #52525b; /* Biraz daha yumuşak bir gri */
    --main-font: 'Inter', sans-serif;
    
    /* Buton Renkleri */
    --button-bg: #18181b; /* Ana başlık rengiyle aynı */
    --button-text: #f4f4f5; /* Saf beyaz yerine çok hafif kırık beyaz */
    --mail-bg: transparent; 
    --mail-border: #dddddd; 
    --mail-border-width: 1.5px; 
    --button-height: 50px; 
    --button-gap: 10px; 

    /* Toggle Renkleri Gündüz */
    --toggle-bg: transparent; 
    --toggle-border: #dddddd; 

    /* Boyutlar */
    --h1-size-main: 4rem; 
    --h2-size-main: 1.7rem; 
    --h1-size-sub: 2.2rem; 
    --h2-size-header: 0.9rem; 

    /* Konumlar */
    --icon-group-spacing: 40px; 
    --icon-group-top-spacing: 40px; /* Değer azaltıldı, ikon yukarı kaydırıldı */
    --header-spacing: 40px; 
    
}

body.dark-mode {
    /* Gece Modu */
    --bg-color: #09090b; /* Daha derin, saf siyaha yakın bir arka plan */
    --heading-color: #f4f4f5; /* Daha parlak, okunabilir bir beyaz */
    --secondary-text: #a1a1aa; /* Kontrastı daha iyi olan bir gri */
    
    /* Gece Buton Renkleri */
    --button-bg: #f4f4f5; /* Ana başlık rengiyle aynı */
    --button-text: #18181b; /* Arka plan rengiyle kontrastlı */

    /* Mail Renkleri */
    --mail-bg: transparent;
    --mail-border: #333333; 
    --mail-border-width: 1.5px; 

    /* Toggle Renkleri Gece */
    --toggle-bg: transparent; 
    --toggle-border: #333333; 
}

/* --- ANİMASYONLAR --- */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
 
/* --- GENEL SAYFA AYARLARI --- */
html, body {
    height: 100%;
    overflow-x: hidden; 
    color: var(--heading-color); 
}
body {
    margin: 0;
    padding: 0;
    font-family: var(--main-font); 
    background-color: var(--bg-color);
    transition: background-color 0.4s ease, color 0.4s ease;
    position: relative; 
    cursor: default;
}

.main-content, #icon-group, #page-header {
    z-index: 10;
}

/* --- BAŞLIK VE GERİ BUTONU (SABİT ÜST BAR) --- */
#page-header {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    padding: var(--header-spacing);
    box-sizing: border-box;
    
    background-color: var(--bg-color);
    z-index: 20; 
    
    text-align: left;
    cursor: pointer;
    transition: background-color 0.4s ease, opacity 0.3s;
    display: none; 
}
#page-header h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.4rem;
    margin: 0;
    color: var(--heading-color);
}
#page-header h2 {
    font-weight: 400;
    font-size: var(--h2-size-header);
    color: var(--secondary-text);
    margin: 3px 0 0 0;
}

.back-button {
    margin-top: 40px; 
    margin-bottom: 40px; 
    
    display: none; 
    font-weight: 700;
    color: var(--heading-color);
    background: var(--bg-color);
    border: var(--mail-border-width) solid var(--heading-color);
    height: var(--button-height);
    padding: 0 24px; /* Yatay boşluk ayarlandı */
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    font-family: 'Poppins', sans-serif;    
    gap: 8px; /* İkon ve yazı arasına boşluk eklendi */
}
.back-button span {
    font-size: 1rem; /* Yazı boyutu ayarlandı */
}
.back-button svg {
    width: 18px; /* İkon boyutu ayarlandı */
    height: 18px;
}
.back-button:hover { opacity: 0.9; transform: translateY(-1px); }

/* --- İKON GRUBU (SAĞ ÜST) --- */
#icon-group {
    position: fixed; 
    top: var(--icon-group-top-spacing); 
    right: 0; 
    padding-right: var(--icon-group-spacing); 
    padding-top: 0; 
    padding-bottom: 0;
    padding-left: 10px;
    box-sizing: border-box;
    
    background-color: var(--bg-color); 
    z-index: 21; 
    
    display: flex; 
    gap: 10px;
    transition: background-color 0.4s ease;
}
/* Arka planı temizlemek için */
#icon-group::before {
     content: '';
     position: absolute;
     top: 0;
     right: 0;
     width: 100%;
     height: 100%;
     background-color: var(--bg-color);
     z-index: -1;
     transition: background-color 0.4s ease;
}

/* --- BÖLÜMLERİN GENEL STİLİ --- */
section {
    position: absolute;
    top: 50%;
    left: 50%; 
    transform: translate(-50%, -50%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none; 
    transition: opacity 0.4s ease, visibility 0.4s;
    max-width: 900px;
    width: 90%;
    box-sizing: border-box;
    text-align: left; 
}
 
/* KAYDIRILABİLİR İÇERİK İÇİN DÜZENLEME */
section:not(#home) {
    top: 0; 
    transform: translateX(-50%);
    height: 100vh;
    overflow-y: auto; 
    
    /* ÜST BOŞLUK */
    padding-top: 145px; 
    
    padding-bottom: 20px;
    -ms-overflow-style: none; 
    scrollbar-width: none; 
    z-index: 5; 
}
section:not(#home)::-webkit-scrollbar {
    display: none; 
}
/* ANA SAYFA İÇERİĞİ ORTADA KALSIN */
#home {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

section.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* --- İÇERİK STİLLERİ --- */
#home h1 { 
    font-size: var(--h1-size-main); 
    font-weight: 600; margin-bottom: 0.2rem; 
    color: var(--heading-color); 
    font-family: 'Poppins', sans-serif; 

    /* Giriş Animasyonu */
    opacity: 0; /* Animasyon için başlangıç durumu */
    animation: fade-in-up 0.8s ease-out forwards;
    animation-delay: 0.2s;
}
#home h2.slogan { 
    font-size: var(--h2-size-main); 
    font-weight: 300; margin-top: 0; margin-bottom: 1.5rem; 
    color: var(--secondary-text); 
    font-family: 'Poppins', sans-serif;

    /* Giriş Animasyonu */
    opacity: 0; /* Animasyon için başlangıç durumu */
    animation: fade-in-up 0.8s ease-out forwards;
    animation-delay: 0.4s;
}

/* Buton Grubu */
.action-group {
    display: flex;
    align-items: center;
    gap: var(--button-gap); 
    flex-wrap: nowrap;
}
 
.base-button-style {
    display: flex;
    align-items: center;
    justify-content: center; 
    border-radius: 8px; 
    cursor: pointer; 
    transition: all 0.3s;
    line-height: 1; 
    font-weight: 700;
    height: var(--button-height); 
    font-family: 'Poppins', sans-serif; 
    flex-shrink: 0;
}

/* Sosyal Medya İkonları */
.social-icons {
    display: flex;
    gap: 20px;
    margin-bottom: 1.5rem;
}
.social-icons a {
    color: var(--heading-color);
    text-decoration: none;
    border-bottom: none;
    transition: all 0.2s ease;
}
.social-icons a:hover {
    opacity: 0.8;
    transform: translateY(-2px);
}
.social-icons svg {
    width: 26px;
    height: 26px;
}

/* Ana Butonlar (Projeler) */
.btn-main {
    padding: 0 28px; 
    font-size: 1.1rem; 
    text-decoration: none;
    text-transform: none; 
    
    background: var(--button-bg); 
    color: var(--button-text); 
    border: none;
}
.btn-main:hover { 
    opacity: 0.9;
    transform: scale(0.98); 
}

/* Mail İkonu Stili (Kare ve Ters Çerçeve) */
.mail-icon-link {
    width: 50px; 
    text-decoration: none;
    
    background: var(--mail-bg); 
    color: var(--heading-color); 
    border-style: solid;
    border-width: var(--mail-border-width); 
    border-color: var(--heading-color); 
}
.mail-icon-link:hover {
    opacity: 0.9;
    transform: scale(0.98);
}
.mail-icon-link svg {
    width: 24px;
    height: 24px;
}
 
/* --- ALT SAYFA (#projects) STİLİ --- */
#projects h1 {
    font-family: 'Poppins', sans-serif;
    font-size: var(--h1-size-sub);
    margin-bottom: 1rem;
    color: var(--heading-color);
    cursor: pointer; 
    margin-top: 0; 
}
section p {
    margin-top: 0; /* Üst boşlukları sıfırlayarak daha tutarlı aralıklar sağlıyoruz */
    margin-bottom: 1.2em;
    font-size: 1.1rem;
    line-height: 1.6;
}
/* Projeler bölümünü flex container yapıyoruz */
#projects {
    display: flex;
    flex-direction: column;
}
/* Proje içeriklerinin esneyip boşluğu doldurmasını engelliyoruz */
#projects p, #projects h1, #projects .back-btn-container {
    flex-shrink: 0;
}
section p {
    margin-bottom: 1.2em;
    font-size: 1.1rem;
    line-height: 1.6;
}
section strong {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.15rem; 
}
section a {
    font-weight: 700;
    color: inherit;
    text-decoration: none;
    border-bottom: none;
    transition: opacity 0.2s;
}
section a:hover {
    opacity: 0.7;
}
section p a {
    border-bottom: 1px solid currentColor;
}
.inactive-link {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Geri butonu için konteyner */
.back-btn-container {
    display: flex;
    justify-content: flex-start;
    width: 100%;
}

/* --- FOOTER --- */
footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Footer'ın kalan boşluğu doldurarak en alta itilmesini sağlıyoruz */
    margin-top: auto; 
    width: 100%;
    flex-wrap: wrap; /* Mobil için sığmazsa alt satıra geçsin */
}
footer p.copyright {
    margin: 0;
    font-size: 0.8rem;
    color: var(--heading-color);
}
.footer-right-group {
    display: flex;
    align-items: center;
    gap: 24px; /* Ayırıcı etrafındaki boşluk */
}
.footer-socials {
    display: flex;
    gap: 20px;
}
.footer-socials a {
    color: var(--secondary-text);
    border-bottom: none;
    transition: all 0.2s ease;
}
.footer-socials a:hover {
    color: var(--heading-color);
    transform: translateY(-2px);
    opacity: 1;
}
/* X ikonu fill kullandığı için rengini color ile değiştiriyoruz */
.x-icon-link {
    color: var(--secondary-text);
}
.footer-socials svg {
    width: 22px;
    height: 22px;
}
.github-icon-link svg {
    stroke: var(--secondary-text);
    transition: stroke 0.2s ease;
}
.github-icon-link:hover svg {
    stroke: var(--heading-color);
}
.footer-mail-icon svg {
    stroke: var(--secondary-text);
    transition: stroke 0.2s ease;
}
.footer-mail-icon:hover svg {
    stroke: var(--heading-color);
}

/* Footer Tema Değiştirici */
.footer-separator {
    width: 1px;
    height: 22px;
    background-color: var(--secondary-text);
    opacity: 0.5;
}
.theme-switcher {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    padding-bottom: 2px;
}
.theme-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    /* SVG'ler currentColor kullandığı için 'color' özelliğini değiştiriyoruz */
    color: var(--secondary-text);
    transition: color 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-btn:hover {
    color: var(--heading-color);
    transform: translateY(-2px);
}
.theme-btn.active {
    color: var(--heading-color);
    opacity: 1;
    position: relative;
}
.theme-btn.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 1px;
    background-color: var(--heading-color);
}
.theme-btn svg {
    width: 20px;
    height: 20px;
}
/* Güneş ikonunu diğerlerinden biraz daha büyük yapıyoruz */
#theme-light svg {
    width: 22px; height: 22px;
}
.btn-main, .mail-icon-link {
    transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, transform 0.3s, opacity 0.3s;
}


/* --- MOBİL UYUMLULUK --- */
@media (max-width: 768px) {
    :root {
        --button-height: 44px; 
        --button-gap: 8px;
        
        /* Mobil Font Boyutları */
        --h1-size-main: 2.2rem; 
        --h2-size-main: 1.1rem; 
        --h1-size-sub: 1.8rem;
        
        /* Mobil Konumlar */
        --icon-group-spacing: 20px; 
        --icon-group-top-spacing: 20px; /* Değer azaltıldı, ikon yukarı kaydırıldı */
        --header-spacing: 20px;
    }

    /* Alt sayfa kaydırma boşlukları mobil için düzeltildi */
    section:not(#home) {
        /* Mobil için üst boşluk 115px */
        padding-top: 115px; 
    }
    .back-button {
        font-size: 0.95rem;
        margin-bottom: 20px;
        border-radius: 10px;
    }
    
    #home h2.slogan {
        margin-bottom: 1.2rem;
    }

    .mail-icon-link {
        width: 44px;
    }
    .mail-icon-link svg {
        width: 20px;
        height: 20px;
    }
    footer {
        margin-top: 40px;
    }
    /* Mobil için footer elemanlarını ortala */
    footer {
        flex-direction: column;
        gap: 25px;
        justify-content: center; /* Mobil için ortala */
    }
    /* Mobil'de .footer-right-group içindeki flex-direction:column kaldırıldı, ikonlar yan yana geldi. */

    .theme-btn svg,
    .footer-socials svg {
        width: 20px;
        height: 20px;
    }
    .social-icons {
        margin-bottom: 1.2rem;
    }
    .social-icons svg {
        width: 22px;
        height: 22px;
    }
}

/* --- 404 SAYFASI --- */
#error-section {
    display: flex;
    flex-direction: column;
    text-align: center;
    /* İçeriği dikey olarak ortalamak için */
    justify-content: center;
    /* Bu bölüm zaten 'section' genel stilinden ortalama özelliklerini alıyor */
}
#error-section h1 {
    font-size: 10rem; /* Yazı boyutu büyütüldü */
    font-family: 'Poppins', sans-serif;
    font-weight: 300; /* Yazı kalınlığı azaltıldı */
    margin: 0;
    line-height: 1;
    color: var(--heading-color);
}
#error-section h2 {
    font-size: 1.8rem; /* Yazı boyutu büyütüldü */
    font-weight: 300;
    margin: 2rem 0; /* Dikey boşluk ayarlandı */
    color: var(--heading-color); /* Renk ana başlık rengi yapıldı */
}
#error-section .back-button {
    /* Butonun sadece içerik kadar yer kaplamasını sağlar */
    align-self: center; 
    /* Butonun görünür olmasını sağlar */
    display: flex;
    /* Diğer elemanlarla arasını açar */
    margin-top: 1rem;
}

/* Mobil için 404 sayfası özel stilleri */
@media (max-width: 768px) {
    #error-section h1 { 
        font-size: 7rem; 
    }
    #error-section h2 { 
        font-size: 1.4rem; 
        margin: 1.5rem 0; 
    }
    #error-section .back-button { 
        margin-top: 0.5rem; 
    }
}