/* ============================================================
   MURAT DEMİRBAY — Personal Site
   ============================================================ */

/* === TOKENS === */
:root {
    --bg:           #06060f;
    --c1:           #00d4ff;   /* cyan  */
    --c2:           #a855f7;   /* purple */
    --c3:           #06ffa5;   /* mint  */
    --text:         #e2e8f0;
    --muted:        #4a5568;
    --glass:        rgba(255,255,255,0.03);
    --glass-b:      rgba(255,255,255,0.07);
    --panel-w:      340px;
    --ease-panel:   cubic-bezier(0.23, 1, 0.32, 1);
}

/* === RESET === */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html, body { cursor: default; }
html { scroll-behavior: smooth; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Space Grotesk', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
}
a { text-decoration: none; color: inherit; cursor: pointer; }
button { background: none; border: none; font: inherit; cursor: pointer; }
canvas { cursor: default; }

/* Disable text selection highlight color */
::selection { background: transparent; }
::-moz-selection { background: transparent; }

/* ============================================================
   LOADER
   ============================================================ */
.loader {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}
.loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loader-logo {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    background: linear-gradient(135deg, var(--c1), var(--c2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.1em;
    opacity: 0;
    animation: fadeIn 0.4s ease 0.2s forwards;
}

.loader-letters {
    display: flex;
    gap: 0.35rem;
}
.loader-letters span {
    font-size: 2.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--c1), var(--c2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: letterBounce 0.7s ease calc(var(--i) * 0.1s) infinite alternate;
    display: inline-block;
}

@keyframes letterBounce {
    from { transform: translateY(0);    opacity: 0.6; }
    to   { transform: translateY(-12px); opacity: 1;   }
}

.loader-bar {
    width: 180px;
    height: 2px;
    background: var(--glass-b);
    border-radius: 99px;
    overflow: hidden;
}
.loader-progress {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--c1), var(--c2));
    border-radius: 99px;
    animation: loadProg 1.6s ease forwards;
}
@keyframes loadProg { to { width: 100%; } }

/* ============================================================
   CUSTOM CURSOR
   ============================================================ */
/* custom cursor removed */
.cursor-dot, .cursor-ring { display: none; }

/* ============================================================
   BACKGROUNDS
   ============================================================ */
#starfield {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    z-index: 0; pointer-events: none;
}

.aurora {
    position: fixed; inset: 0;
    z-index: 0; pointer-events: none;
    background:
        radial-gradient(ellipse 80% 55% at 15% 35%, rgba(0,212,255,0.08)  0%, transparent 65%),
        radial-gradient(ellipse 65% 45% at 85% 65%, rgba(168,85,247,0.08) 0%, transparent 65%),
        radial-gradient(ellipse 50% 60% at 55% 85%, rgba(6,255,165,0.05)  0%, transparent 65%);
    animation: auroraShift 18s ease-in-out infinite alternate;
}
@keyframes auroraShift {
    to {
        background:
            radial-gradient(ellipse 60% 70% at 75% 25%, rgba(0,212,255,0.10)  0%, transparent 65%),
            radial-gradient(ellipse 80% 50% at 25% 75%, rgba(168,85,247,0.10) 0%, transparent 65%),
            radial-gradient(ellipse 45% 45% at 60% 15%, rgba(6,255,165,0.06)  0%, transparent 65%);
    }
}

.grid-overlay {
    position: fixed; inset: 0;
    z-index: 0; pointer-events: none;
    background-image:
        radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 44px 44px;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
    position: relative; z-index: 1;
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 2rem;
    overflow: hidden;
}

.hero-content {
    text-align: center;
    position: relative; z-index: 2;
}

/* Reveal animation system — delay sadece JS tarafında yönetiliyor */
[data-reveal] { opacity: 0; transform: translateY(28px); }
[data-reveal].revealed {
    animation: fadeSlideUp 0.7s var(--ease-panel) forwards;
}

@keyframes fadeSlideUp {
    to { opacity: 1; transform: translateY(0); }
}

/* --- Greeting --- */
.greeting {
    display: flex; align-items: center; justify-content: center;
    gap: 1rem; margin-bottom: 1.5rem;
}
.greeting p {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: var(--c3);
    letter-spacing: 0.35em;
    text-transform: uppercase;
}
.greeting-line {
    flex: 0 0 55px; height: 1px;
    background: linear-gradient(90deg, transparent, var(--c3));
}
.greeting-line:last-child {
    background: linear-gradient(90deg, var(--c3), transparent);
}

/* --- Name --- */
.name {
    font-size: clamp(3.8rem, 11vw, 9.5rem);
    font-weight: 700;
    line-height: 1;
    margin-bottom: 1.6rem;
    letter-spacing: -0.03em;
}
.name-first {
    display: block;
    background: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.name-last {
    display: block;
    background: linear-gradient(135deg, var(--c1) 0%, var(--c2) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 45px rgba(0,212,255,0.35));
    transition: filter 0.3s ease;
}
.name-last:hover { filter: drop-shadow(0 0 70px rgba(0,212,255,0.6)); }

/* --- Typewriter --- */
.typewriter-wrapper {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.95rem, 2.2vw, 1.25rem);
    color: var(--muted);
    margin-bottom: 2.5rem;
    min-height: 2rem;
    display: flex; align-items: center; justify-content: center; gap: 2px;
}
.cursor-blink {
    color: var(--c1);
    animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* --- Badges --- */
.hero-badges {
    display: flex; gap: 0.7rem;
    justify-content: center; flex-wrap: wrap;
    margin-bottom: 4rem;
}
.badge {
    padding: 0.38rem 1rem;
    border: 1px solid var(--glass-b);
    border-radius: 999px;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    background: var(--glass);
    backdrop-filter: blur(12px);
    color: var(--muted);
    transition: all 0.3s ease;
}
.badge:hover {
    border-color: var(--c1);
    color: var(--c1);
    box-shadow: 0 0 20px rgba(0,212,255,0.18), inset 0 0 10px rgba(0,212,255,0.05);
}

/* --- Scroll hint --- */
.hero-scroll-hint {
    position: absolute;
    bottom: 2rem; left: 50%;
    transform: translateX(-50%);
}
.scroll-mouse {
    width: 22px; height: 36px;
    border: 2px solid var(--glass-b);
    border-radius: 999px;
    display: flex; justify-content: center; padding-top: 6px;
}
.scroll-wheel {
    width: 3px; height: 8px;
    background: var(--c1);
    border-radius: 999px;
    animation: scrollDown 2s ease-in-out infinite;
    box-shadow: 0 0 8px var(--c1);
}
@keyframes scrollDown {
    0%   { transform: translateY(0);   opacity: 1; }
    80%  { transform: translateY(12px); opacity: 0; }
    100% { transform: translateY(0);   opacity: 0; }
}

/* --- Orbs --- */
.orb {
    position: absolute; border-radius: 50%;
    filter: blur(90px); pointer-events: none; z-index: 0;
}
.orb-1 {
    width: 520px; height: 520px;
    background: radial-gradient(circle, rgba(0,212,255,0.11) 0%, transparent 70%);
    top: -120px; right: -160px;
    animation: floatOrb 9s ease-in-out infinite;
}
.orb-2 {
    width: 420px; height: 420px;
    background: radial-gradient(circle, rgba(168,85,247,0.09) 0%, transparent 70%);
    bottom: -100px; left: -110px;
    animation: floatOrb 11s ease-in-out infinite reverse;
}
.orb-3 {
    width: 320px; height: 320px;
    background: radial-gradient(circle, rgba(6,255,165,0.07) 0%, transparent 70%);
    top: 50%; left: 50%; transform: translate(-50%,-50%);
    animation: pulseOrb 7s ease-in-out infinite;
}
@keyframes floatOrb {
    0%,100% { transform: translateY(0)    scale(1);    }
    50%      { transform: translateY(-28px) scale(1.06); }
}
@keyframes pulseOrb {
    0%,100% { opacity: 0.5; transform: translate(-50%,-50%) scale(1);   }
    50%      { opacity: 1;   transform: translate(-50%,-50%) scale(1.18); }
}

/* ============================================================
   PROJECTS TOGGLE BUTTON
   ============================================================ */
.projects-toggle {
    position: fixed;
    right: 0; top: 50%;
    transform: translateY(-50%);
    z-index: 200;
    display: flex; flex-direction: column;
    align-items: center; gap: 0.5rem;
    padding: 1rem 0.7rem;
    background: linear-gradient(180deg, var(--c1), var(--c2));
    border-radius: 10px 0 0 10px;
    box-shadow: -4px 0 28px rgba(0,212,255,0.3);
    transition: right 0.5s var(--ease-panel),
                padding 0.3s ease,
                box-shadow 0.3s ease;
}
.projects-toggle:hover {
    padding-left: 1.1rem;
    box-shadow: -6px 0 40px rgba(0,212,255,0.5);
}
.projects-toggle.open {
    right: var(--panel-w);
}

.toggle-arrow {
    display: flex; align-items: center;
    color: #fff; width: 16px; height: 16px;
    transition: transform 0.4s var(--ease-panel);
}
.toggle-arrow svg { width: 16px; height: 16px; }
.projects-toggle.open .toggle-arrow { transform: rotate(180deg); }

.toggle-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: #fff;
}

/* ============================================================
   PROJECTS PANEL
   ============================================================ */
.projects-panel {
    position: fixed;
    right: 0; top: 0;
    width: var(--panel-w); height: 100vh;
    background: rgba(7,7,18,0.96);
    backdrop-filter: blur(32px) saturate(180%);
    border-left: 1px solid var(--glass-b);
    z-index: 199;
    padding: 2.8rem 1.8rem;
    display: flex; flex-direction: column; gap: 1.8rem;
    transform: translateX(100%);
    transition: transform 0.5s var(--ease-panel);
    overflow-y: auto;
}
.projects-panel.open { transform: translateX(0); }

/* scrollbar */
.projects-panel::-webkit-scrollbar { width: 3px; }
.projects-panel::-webkit-scrollbar-thumb { background: var(--glass-b); border-radius: 99px; }

.panel-title-row {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 0.3rem;
}
.panel-title {
    font-size: 1.75rem; font-weight: 700;
    background: linear-gradient(135deg, var(--c1), var(--c2));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.panel-close {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border: 1px solid var(--glass-b);
    border-radius: 8px;
    color: var(--muted);
    transition: all 0.2s ease;
    flex-shrink: 0; margin-top: 4px;
}
.panel-close svg { width: 16px; height: 16px; }
.panel-close:hover { border-color: var(--c1); color: var(--c1); }

.panel-sub {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 0.08em;
}

/* --- Project cards --- */
.projects-list {
    display: flex; flex-direction: column; gap: 0.65rem;
    flex: 1;
}

.project-card {
    display: flex; align-items: center; gap: 0.9rem;
    padding: 0.9rem 1rem;
    background: var(--glass);
    border: 1px solid var(--glass-b);
    border-radius: 12px;
    color: var(--text);
    transition: all 0.3s ease;
    position: relative; overflow: hidden;
}
.project-card::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg,
        rgba(0,212,255,0.05),
        rgba(168,85,247,0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
}
.project-card:hover::after { opacity: 1; }
.project-card:hover {
    border-color: rgba(0,212,255,0.3);
    transform: translateX(-5px);
    box-shadow: 5px 0 22px rgba(0,212,255,0.1);
}
.project-card.coming-soon { opacity: 0.45; pointer-events: none; }

.project-icon { font-size: 1.4rem; flex-shrink: 0; }
.project-info { flex: 1; min-width: 0; }
.project-info h3 {
    font-size: 0.88rem; font-weight: 600;
    margin-bottom: 0.18rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.project-info p {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem; color: var(--muted);
}
.project-arrow {
    color: var(--c1); font-size: 1rem;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}
.project-card:hover .project-arrow { transform: translateX(4px); }

/* --- Panel footer --- */
.panel-footer {
    display: flex; align-items: center; gap: 0.6rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-b);
}
.status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--c3);
    box-shadow: 0 0 10px var(--c3);
    animation: statusPulse 2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes statusPulse {
    0%,100% { opacity: 1;   transform: scale(1);   }
    50%      { opacity: 0.4; transform: scale(1.4); }
}
.panel-footer p {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem; color: var(--muted);
    letter-spacing: 0.08em;
}

/* ============================================================
   OVERLAY
   ============================================================ */
.overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(3px);
    z-index: 198;
    opacity: 0; pointer-events: none;
    transition: opacity 0.35s ease;
}
.overlay.active { opacity: 1; pointer-events: all; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    position: fixed; bottom: 1.5rem; left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--muted);
    letter-spacing: 0.12em;
    opacity: 0;
    animation: fadeIn 1s ease 2.5s forwards;
}

/* ============================================================
   SHARED UTILITIES
   ============================================================ */
@keyframes fadeIn { to { opacity: 1; } }

/* ============================================================
   GLITCH KEYFRAMES  (triggered via JS class)
   ============================================================ */
.name-last.glitch {
    animation: glitch 0.45s steps(1) forwards !important;
    -webkit-text-fill-color: transparent;
}
@keyframes glitch {
    0%  { clip-path: polygon(0 10%, 100% 10%, 100% 30%, 0 30%); transform: translateX(-4px); }
    20% { clip-path: polygon(0 50%, 100% 50%, 100% 70%, 0 70%); transform: translateX(4px);  }
    40% { clip-path: polygon(0 70%, 100% 70%, 100% 90%, 0 90%); transform: translateX(-2px); }
    60% { clip-path: polygon(0 0,   100% 0,   100% 20%, 0 20%); transform: translateX(3px);  }
    80% { clip-path: none; transform: translateX(0); }
    100%{ clip-path: none; transform: translateX(0); filter: drop-shadow(0 0 45px rgba(0,212,255,0.35)); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    :root { --panel-w: 290px; }
    body { cursor: auto; }
    .cursor-dot, .cursor-ring { display: none; }
    .projects-toggle { padding: 0.8rem 0.55rem; }
    .toggle-label { font-size: 0.58rem; letter-spacing: 0.15em; }
    .hero-scroll-hint { bottom: 5rem; }
}

@media (max-width: 480px) {
    :root { --panel-w: 100vw; }
    .name { letter-spacing: -0.02em; }
}
