﻿/* ============================================================
   LAYOUT.CSS — Header, Nav, Buttons, Cursor, Global Base
   ============================================================ */

/* RESET & BASE */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-height);
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--surface-page);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--brand-400);
    color: white;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

img {
    max-width: 100%;
    display: block;
}

/* NOISE TEXTURE OVERLAY */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.02;
    z-index: 9999;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* LAYOUT */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* HEADER */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    z-index: 1000;
    transition: all 0.4s var(--ease-out-expo);
}

    .header::before {
        content: '';
        position: absolute;
        inset: 0;
        background: var(--surface-glass);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border-subtle);
        opacity: 0;
        transition: opacity 0.4s;
    }

    .header.scrolled::before {
        opacity: 1;
    }

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    position: relative;
    z-index: 1;
}

/* LOGO */
.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: var(--gradient-brand);
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    color: white;
    font-size: 22px;
    position: relative;
    overflow: hidden;
}

    .logo-icon::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.3) 50%, transparent 60%);
        transform: translateX(-100%);
        transition: transform 0.6s;
    }

.logo:hover .logo-icon::before {
    transform: translateX(100%);
}

/* NAV */
.nav {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
}

.nav-list {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    list-style: none;
}

.nav-link {
    padding: var(--space-sm) var(--space-md);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    position: relative;
    transition: all 0.3s var(--ease-out-expo);
}

    .nav-link::before {
        content: '';
        position: absolute;
        bottom: 6px;
        left: 50%;
        width: 0;
        height: 2px;
        background: var(--brand-400);
        border-radius: 1px;
        transition: all 0.3s var(--ease-out-expo);
        transform: translateX(-50%);
    }

    .nav-link:hover {
        color: var(--text-primary);
    }

        .nav-link:hover::before {
            width: calc(100% - 32px);
        }

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* THEME TOGGLE */
.theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    color: var(--text-secondary);
    font-size: 20px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

    .theme-toggle:hover {
        background: var(--surface-sunken);
        color: var(--text-primary);
    }

    .theme-toggle i {
        transition: transform 0.5s var(--ease-spring);
    }

    .theme-toggle:hover i {
        transform: rotate(360deg);
    }

/* MOBILE TOGGLE */
.mobile-toggle {
    display: none;
    width: 44px;
    height: 44px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

    .mobile-toggle span {
        width: 24px;
        height: 2px;
        background: var(--text-primary);
        border-radius: 1px;
        transition: all 0.3s var(--ease-out-expo);
    }

    .mobile-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }

    .mobile-toggle.active span:nth-child(2) {
        opacity: 0;
        transform: translateX(-10px);
    }

    .mobile-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

/* MOBILE MENU */
.mobile-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface-base);
    z-index: 999;
    padding: var(--space-xl);
    transform: translateX(100%);
    transition: transform 0.5s var(--ease-out-expo);
    display: none;
}

    .mobile-menu.active {
        transform: translateX(0);
    }

    .mobile-menu .nav-list {
        flex-direction: column;
        gap: var(--space-xs);
    }

    .mobile-menu .nav-link {
        display: block;
        padding: var(--space-md);
        font-size: 18px;
        border-radius: var(--radius-lg);
    }

    .mobile-menu .nav-actions {
        flex-direction: column;
        margin-top: var(--space-xl);
    }

    .mobile-menu .btn {
        width: 100%;
        justify-content: center;
    }

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 24px;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-lg);
    transition: all 0.4s var(--ease-out-expo);
    position: relative;
    overflow: hidden;
}

    .btn::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.2) 50%, transparent 60%);
        transform: translateX(-100%) skewX(-15deg);
        transition: transform 0.6s;
    }

    .btn:hover::before {
        transform: translateX(100%) skewX(-15deg);
    }

.btn-primary {
    background: var(--gradient-brand);
    color: white;
    box-shadow: 0 4px 20px rgba(106, 137, 181, 0.4);
}

    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 30px rgba(106, 137, 181, 0.5);
    }

.btn-secondary {
    background: var(--surface-base);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-sm);
}

    .btn-secondary:hover {
        border-color: var(--brand-400);
        box-shadow: var(--shadow-md);
    }

.btn-ghost {
    color: var(--text-secondary);
    padding: 12px 16px;
}

    .btn-ghost:hover {
        color: var(--text-primary);
        background: var(--surface-sunken);
    }

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
    border-radius: var(--radius-xl);
}

.btn-xl {
    padding: 20px 40px;
    font-size: 18px;
    border-radius: var(--radius-xl);
}

/* SECTION SHARED */
.section-header {
    text-align: center;
    max-width: 600px;
    margin: 0 auto var(--space-4xl);
}

.section-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 6px 16px;
    background: var(--brand-50);
    color: var(--brand-600);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-full);
    margin-bottom: var(--space-lg);
    border: 1px solid var(--brand-100);
}

[data-theme="dark"] .section-badge {
    background: rgba(106, 137, 181, 0.1);
    border-color: rgba(106, 137, 181, 0.2);
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(36px, 4vw, 56px);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.section-desc {
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* SCROLL REVEAL */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s var(--ease-out-expo);
}

    .reveal.visible {
        opacity: 1;
        transform: translateY(0);
    }

.reveal-delay-1 {
    transition-delay: 0.1s;
}

.reveal-delay-2 {
    transition-delay: 0.2s;
}

.reveal-delay-3 {
    transition-delay: 0.3s;
}

.reveal-delay-4 {
    transition-delay: 0.4s;
}

.reveal-delay-5 {
    transition-delay: 0.5s;
}

.reveal-delay-6 {
    transition-delay: 0.6s;
}

/* RESPONSIVE — header/nav */
@media (max-width: 992px) {
    .nav {
        display: none;
    }

    .mobile-toggle {
        display: flex;
    }

    .mobile-menu {
        display: block;
    }
}
