* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', 'Space Grotesk', system-ui, sans-serif;
    background: #000;
    color: #fff;
}

/* Preloader açıkken sayfa kaydırmasını kilitle */
body.preloader-lock {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Preloader: sol = typewriter + bar + buton, sağ = 3D animasyon */
.preloader {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #000;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.6s;
}

/* Sol panel: 3D'nin üstünde, okunaklı */
.preloader-left {
    flex: 0 0 30%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    z-index: 1;
    padding: 0 24px;
    background: #000;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-inner {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 32px;
    max-width: 90vw;
    width: fit-content;
}

.preloader-bar {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.15);
    overflow: hidden;
}

.preloader-bar-fill {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #fff, rgba(255,255,255,0.6));
}

.preloader-bar--start .preloader-bar-fill {
    animation: preloaderBar 3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes preloaderBar {
    to { width: 100%; }
}

.preloader-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
}

.preloader-cursor {
    display: inline-block;
    animation: blink 0.7s step-end infinite;
}

.preloader-enter {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    padding: 14px 36px 14px 28px;
    position: relative;
    overflow: hidden;
    transition: color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease, transform 0.25s ease;
    opacity: 0;
    animation: preloaderEnterIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 1.4s forwards;
}

.preloader-enter::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.08), transparent);
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.preloader-enter::after {
    content: '→';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

.preloader-enter:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.preloader-enter:hover::before {
    width: 100%;
}

.preloader-enter:hover::after {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
}

@keyframes preloaderEnterIn {
    to { opacity: 1; }
}

/* Nav */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 40px;
}

.logo {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.logo:hover {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-links a {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: #fff;
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-links a:hover { color: #fff; }
.nav-links a:hover::after { width: 100%; }

.nav-links a.active {
    color: #fff;
}

.nav-links a.active::after {
    width: 100%;
}

@media (max-width: 768px) {
    .nav-links {
        gap: 16px;
    }
}

/* ============================================
   CODE BACKGROUND TEXTURE SYSTEM
   3 layers: (A) drift, (B) parallax, (C) sweep
   ============================================ */

.code-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    --parallax-y: 0px;
    transform: translateY(var(--parallax-y));
}

.code-bg pre {
    position: absolute;
    margin: 0;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
    font-size: 14px;
    line-height: 2;
    letter-spacing: 0.03em;
    white-space: pre;
    color: rgba(255, 255, 255, 0.24);
    will-change: transform;
}

.code-bg--html pre {
    top: 5%;
    right: 8%;
    animation: driftA 55s ease-in-out infinite;
}

.code-bg--ts pre {
    top: 3%;
    right: 5%;
    animation: driftB 48s ease-in-out infinite;
}

.code-bg--seo pre {
    top: 6%;
    right: 8%;
    animation: driftA 42s ease-in-out infinite;
}

.code-bg--perf pre {
    top: 4%;
    right: 10%;
    animation: driftB 50s ease-in-out infinite;
}

.code-bg--deliver pre {
    top: 5%;
    right: 8%;
    animation: driftA 46s ease-in-out infinite;
}

@keyframes driftA {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(6px, -14px); }
    50%  { transform: translate(-4px, -22px); }
    75%  { transform: translate(8px, -10px); }
    100% { transform: translate(0, 0); }
}

@keyframes driftB {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(-5px, 12px); }
    50%  { transform: translate(6px, 18px); }
    75%  { transform: translate(-3px, 8px); }
    100% { transform: translate(0, 0); }
}

/* (C) Micro highlight sweep — ultra-subtle gradient pass */
.code-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 0%,
        transparent 40%,
        rgba(255, 255, 255, 0.025) 48%,
        rgba(255, 255, 255, 0.04) 50%,
        rgba(255, 255, 255, 0.025) 52%,
        transparent 60%,
        transparent 100%
    );
    background-size: 300% 100%;
    animation: sweep 15s ease-in-out infinite;
    pointer-events: none;
}

@keyframes sweep {
    0%, 85%  { background-position: 200% center; }
    100%     { background-position: -100% center; }
}

/* Offscreen pause (toggled by JS IntersectionObserver) */
.code-bg.paused pre { animation-play-state: paused; }
.code-bg.paused::after { animation-play-state: paused; }

/* Hero panel: slightly quieter */
.code-bg--html pre { color: rgba(255, 255, 255, 0.16); }

/* ---- Responsive & accessibility ---- */

@media (max-width: 768px) {
    .code-bg pre {
        font-size: 11px;
        color: rgba(255, 255, 255, 0.12);
        animation-duration: 80s;
    }
    .code-bg::after { animation: none; }
}

@media (max-width: 480px) {
    .code-bg { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .code-bg pre { animation: none; }
    .code-bg::after { animation: none; }
}

/* Panels - full viewport, vertical scroll snap */
.panels {
    display: block;
}

.panel {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 80px 60px;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    overflow: hidden;
}

.hero-panel {
    background: #000;
}

.hero-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.02) 0%, transparent 40%);
    pointer-events: none;
}

.hero-panel::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 80%;
    height: 200%;
    background: conic-gradient(from 180deg at 50% 50%, transparent 0deg, rgba(255,255,255,0.015) 60deg, transparent 120deg);
    animation: heroGlow 20s linear infinite;
    pointer-events: none;
}

@keyframes heroGlow {
    to { transform: rotate(360deg); }
}

.hero-panel h1, .work-panel a, .work-panel h2, .about-panel h2, .contact-panel h2, .about-headline {
    font-family: 'Space Grotesk', sans-serif;
}

.panel > *:not(.code-bg) {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: clamp(48px, 8vw, 96px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
    min-height: 2.2em;
}

.cursor {
    display: inline-block;
    color: #fff;
    font-weight: 300;
    animation: blink 0.7s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.hero-line {
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #fff, transparent);
    margin-top: 24px;
    animation: lineExpand 1s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
}

@keyframes lineExpand {
    to { width: 120px; }
}

.hero-sub {
    margin-top: 32px;
    font-size: 14px;
    color: #666;
    opacity: 0;
    animation: heroFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards, scrollBounce 2s ease-in-out 1.5s infinite;
}

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

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

.work-panel {
    background: #000;
}

.work-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 120px,
            rgba(255,255,255,0.015) 120px,
            rgba(255,255,255,0.015) 121px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 120px,
            rgba(255,255,255,0.015) 120px,
            rgba(255,255,255,0.015) 121px
        );
    pointer-events: none;
}

.work-panel::after {
    content: '';
    position: absolute;
    bottom: -20%;
    left: -10%;
    width: 50%;
    height: 60%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.025) 0%, transparent 70%);
    pointer-events: none;
}

.work-panel h2 {
    font-size: 14px;
    font-weight: 500;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 48px;
}

.work-list {
    display: flex;
    flex-direction: column;
    max-width: 700px;
}

.work-item {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-decoration: none;
    color: #fff;
    transition: padding-left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.work-item:first-child {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.work-item:hover {
    padding-left: 16px;
}

.work-index {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    color: #444;
    min-width: 28px;
    transition: color 0.3s ease;
}

.work-item:hover .work-index {
    color: #888;
}

.work-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(22px, 3vw, 32px);
    font-weight: 600;
    flex: 1;
    transition: letter-spacing 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.work-item:hover .work-name {
    letter-spacing: 0.02em;
}

.work-arrow {
    font-size: 18px;
    color: #333;
    transition: color 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.work-item:hover .work-arrow {
    color: #fff;
    transform: translate(4px, -4px);
}

/* Reveal on scroll */
.reveal {
    opacity: 0;
    transform: translateY(40px) scale(0.96);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.work-item.reveal {
    transition-delay: calc(var(--i, 0) * 80ms);
    transform: translateY(30px);
}

.work-item.reveal.show {
    transform: translateY(0);
}

/* About — Panel 3: Story */
.about-panel--story {
    background: #000;
}

.about-panel--story::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.02) 25%, transparent 25%),
        linear-gradient(225deg, rgba(255,255,255,0.02) 25%, transparent 25%),
        linear-gradient(45deg, rgba(255,255,255,0.02) 25%, transparent 25%),
        linear-gradient(315deg, rgba(255,255,255,0.02) 25%, transparent 25%);
    background-size: 60px 60px;
    background-position: 0 0, 0 30px, 30px -30px, -30px 0;
    pointer-events: none;
    opacity: 0.5;
}

.about-panel h2 {
    font-size: 14px;
    font-weight: 500;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 32px;
}

.about-headline {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(32px, 5vw, 52px);
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
    margin-bottom: 40px;
}

.about-headline em {
    font-style: italic;
    color: #999;
}

.about-story {
    max-width: 560px;
}

.about-story p {
    font-size: 16px;
    color: #bbb;
    line-height: 1.75;
    margin-bottom: 18px;
}

/* About — Panel 4: Services */
.about-panel--services {
    background: #000;
}

.services-layout {
    max-width: 600px;
}

.services-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
    margin-bottom: 40px;
}

.services-heading em {
    font-style: italic;
    color: #666;
}

.services-items {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.s-item {
    display: flex;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.s-item:first-child {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.s-num {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    color: #444;
    min-width: 24px;
    padding-top: 2px;
}

.s-item strong {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.s-item p {
    font-size: 14px;
    color: #777;
    line-height: 1.5;
}

/* Panel 5: Deliver */
.deliver-panel {
    background: #000;
}

.deliver-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 160px,
            rgba(255,255,255,0.012) 160px,
            rgba(255,255,255,0.012) 161px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 160px,
            rgba(255,255,255,0.012) 160px,
            rgba(255,255,255,0.012) 161px
        );
    pointer-events: none;
}

.deliver-panel::after {
    content: '';
    position: absolute;
    top: -20%;
    right: -15%;
    width: 60%;
    height: 80%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.02) 0%, transparent 65%);
    pointer-events: none;
}

.deliver-panel h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 48px;
}

.deliver-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    max-width: 900px;
}

.deliver-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 28px 24px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: border-color 0.35s ease, background 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
}

.deliver-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.03);
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}

.deliver-icon {
    font-size: 22px;
    color: #444;
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.deliver-card:hover .deliver-icon {
    color: #fff;
}

.deliver-card strong {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #ddd;
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

.deliver-card:hover strong {
    color: #fff;
}

.deliver-card p {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    transition: color 0.3s ease;
}

.deliver-card:hover p {
    color: #999;
}

.deliver-card.reveal {
    transition-delay: calc(var(--i, 0) * 80ms);
    transform: translateY(30px);
}

.deliver-card.reveal.show {
    transform: translateY(0);
}

.deliver-card.reveal.show:hover {
    transform: translateY(-6px);
}

@media (max-width: 900px) {
    .deliver-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .deliver-grid {
        grid-template-columns: 1fr;
    }
}

/* 2. sayfa (panel-6): farklı tasarım — koyu zemin, listeli kartlar, sol çizgi vurgu */
.deliver-panel--alt {
    background: #000;
}

.deliver-panel--alt::before {
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 80px,
        rgba(255,255,255,0.015) 80px,
        rgba(255,255,255,0.015) 81px
    );
}

.deliver-panel--alt::after {
    top: 20%;
    left: -10%;
    right: auto;
    width: 50%;
    height: 60%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.025) 0%, transparent 70%);
}

.deliver-panel--alt h2 {
    color: #555;
}

.deliver-grid--alt {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    max-width: 720px;
}

.deliver-card--alt {
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    padding: 24px 28px;
    border: none;
    border-left: 3px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.02);
}

.deliver-card--alt:hover {
    border-left-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.04);
}

.deliver-card--alt .deliver-icon {
    margin-bottom: 0;
    font-size: 20px;
    flex-shrink: 0;
}

.deliver-card--alt strong {
    margin-bottom: 6px;
}

.code-bg--deliver-alt pre {
    top: 15%;
    left: 10%;
    color: rgba(255, 255, 255, 0.1);
    animation: driftB 52s ease-in-out infinite;
}

@media (max-width: 600px) {
    .deliver-grid--alt {
        grid-template-columns: 1fr;
    }
    .deliver-card--alt {
        flex-direction: column;
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .services-layout {
        grid-template-columns: 1fr;
    }
}

.contact-panel {
    background: #000;
}

.contact-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 70% 30%, rgba(255,255,255,0.035) 0%, transparent 40%),
        radial-gradient(circle at 30% 70%, rgba(255,255,255,0.02) 0%, transparent 35%);
    pointer-events: none;
}

.contact-panel::after {
    content: '';
    position: absolute;
    bottom: 10%;
    right: 5%;
    width: 300px;
    height: 300px;
    border: 1px solid rgba(255,255,255,0.04);
    transform: rotate(45deg);
    pointer-events: none;
}

.contact-panel h2 {
    font-size: 14px;
    font-weight: 500;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 24px;
}

.contact-panel a {
    font-size: 24px;
    color: #fff;
    text-decoration: none;
    margin-bottom: 32px;
    display: inline-block;
}

.contact-panel a {
    transition: opacity 0.3s ease;
}

.contact-panel a:hover { opacity: 0.8; }

.contact-panel button {
    background: #fff;
    color: #000;
    border: none;
    padding: 16px 32px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
    width: fit-content;
    max-width: 100%;
    align-self: flex-start;
}

.contact-panel button:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 40px rgba(255,255,255,0.2);
}

/* Hide scrollbar */
body::-webkit-scrollbar {
    height: 6px;
}

body::-webkit-scrollbar-track {
    background: #000;
}

body::-webkit-scrollbar-thumb {
    background: #333;
}

@media (max-width: 768px) {
    .panel { padding: 60px 24px; }
    .work-grid { grid-template-columns: 1fr; }
}
