/* =========================================================
   GLOBAL DESIGN SYSTEM — MUDRIK DAU PORTFOLIO
   ========================================================= */

/* ---------- RESET ---------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Sora', 'Space Grotesk', system-ui, -apple-system, sans-serif;
    background: var(--bg-0);
    color: var(--text-0);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- THEME FOUC GUARD ---------- */
html {
    background: #05060a;
}
html[data-theme="light"] {
    background: #f7f9fc;
}

body.no-scroll {
    overflow: hidden;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

ul,
ol {
    list-style: none;
}

input,
textarea,
select {
    font: inherit;
    color: inherit;
}

/* ---------- DESIGN TOKENS ---------- */
:root {
    /* Backgrounds */
    --bg-0: #05060a;
    --bg-1: #0a0c14;
    --bg-2: #0f1220;
    --bg-3: #151a2c;

    /* Surfaces */
    --surface-1: rgba(255, 255, 255, 0.03);
    --surface-2: rgba(255, 255, 255, 0.05);
    --surface-3: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(15, 18, 32, 0.55);
    --glass-border: rgba(255, 255, 255, 0.08);

    /* Text */
    --text-0: #f5f7fa;
    --text-1: #b8c0d4;
    --text-2: #7a8299;
    --text-3: #4a5266;

    /* Accents */
    --accent: #00e5ff;
    --accent-2: #0077ff;
    --accent-3: #a855f7;
    --accent-glow: rgba(0, 229, 255, 0.35);
    --accent-soft: rgba(0, 229, 255, 0.12);

    /* Status */
    --green: #22e07a;
    --red: #ff4d6d;

    /* Borders */
    --border-1: rgba(255, 255, 255, 0.06);
    --border-2: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(0, 229, 255, 0.3);

    /* Gradients */
    --grad-accent: linear-gradient(135deg, #00e5ff 0%, #0077ff 100%);
    --grad-accent-2: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    --grad-text: linear-gradient(135deg, #ffffff 0%, #00e5ff 50%, #a855f7 100%);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(0, 229, 255, 0.25);

    /* Radii */
    --r-sm: 8px;
    --r-md: 14px;
    --r-lg: 22px;
    --r-xl: 32px;
    --r-full: 999px;

    /* Layout */
    --container: 1280px;
    --container-pad: 24px;
    --nav-h: 84px;

    /* Motion */
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-2: cubic-bezier(0.65, 0, 0.35, 1);
    --dur-1: 0.25s;
    --dur-2: 0.45s;
    --dur-3: 0.8s;

    /* Typography scale */
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

/* ---------- CONTAINER ---------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--container-pad);
}

/* ---------- BACKGROUND LAYERS ---------- */
.bg-layers {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    background: var(--bg-0);
}

.bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 30%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 30%, transparent 100%);
}

.bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.55;
    will-change: transform;
}

.bg-glow--1 {
    width: 620px;
    height: 620px;
    background: radial-gradient(circle, rgba(0, 229, 255, 0.35), transparent 70%);
    top: -180px;
    left: -180px;
    animation: glowFloat1 22s ease-in-out infinite;
}

.bg-glow--2 {
    width: 720px;
    height: 720px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.28), transparent 70%);
    bottom: -260px;
    right: -220px;
    animation: glowFloat2 26s ease-in-out infinite;
}

.bg-glow--3 {
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, rgba(0, 119, 255, 0.22), transparent 70%);
    top: 45%;
    left: 55%;
    animation: glowFloat3 30s ease-in-out infinite;
}

@keyframes glowFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(80px, 60px) scale(1.15); }
}

@keyframes glowFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-90px, -70px) scale(1.12); }
}

@keyframes glowFloat3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-60px, 80px) scale(0.9); }
}

#particles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.6;
}

/* ---------- SELECTION ---------- */
::selection {
    background: var(--accent);
    color: #05060a;
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-0);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent), var(--accent-3));
    border-radius: 999px;
    border: 2px solid var(--bg-0);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent-3), var(--accent));
}

/* ---------- TYPOGRAPHY HELPERS ---------- */
.section-head {
    max-width: 720px;
    margin-bottom: 64px;
}

.section-head__label {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 18px;
    padding: 6px 14px;
    background: var(--accent-soft);
    border: 1px solid var(--border-accent);
    border-radius: var(--r-full);
}

.section-head__title {
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 18px;
}

.section-head__title em {
    font-style: normal;
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-head__desc {
    color: var(--text-1);
    font-size: 1.02rem;
    max-width: 560px;
}

/* ---------- BUTTONS ---------- */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 15px 26px;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: var(--r-full);
    border: 1px solid transparent;
    cursor: pointer;
    overflow: hidden;
    transition: transform var(--dur-1) var(--ease),
                box-shadow var(--dur-2) var(--ease),
                background var(--dur-2) var(--ease),
                border-color var(--dur-2) var(--ease);
    will-change: transform;
}

.btn__text {
    position: relative;
    z-index: 2;
}

.btn__icon {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--dur-2) var(--ease);
}

.btn:hover .btn__icon {
    transform: translateX(4px);
}

.btn--primary {
    background: var(--grad-accent);
    color: #05060a;
    box-shadow: 0 8px 30px rgba(0, 229, 255, 0.35);
}

.btn--primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #ffffff 0%, #00e5ff 100%);
    opacity: 0;
    transition: opacity var(--dur-2) var(--ease);
}

.btn--primary:hover::before {
    opacity: 1;
}

.btn--primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 44px rgba(0, 229, 255, 0.5);
}

.btn--ghost {
    background: var(--surface-2);
    color: var(--text-0);
    border-color: var(--border-2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.btn--ghost:hover {
    background: var(--surface-3);
    border-color: var(--border-accent);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 229, 255, 0.15);
}

.btn--outline {
    background: transparent;
    color: var(--text-0);
    border-color: var(--border-accent);
}

.btn--outline:hover {
    background: var(--accent-soft);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 229, 255, 0.2);
}


.link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--accent);
    transition: gap var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}

.link-arrow:hover {
    gap: 16px;
    color: #ffffff;
}

/* ---------- DOT ---------- */
.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 12px var(--green);
}

.dot--live {
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* ---------- LOADER ---------- */
.loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--bg-0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s var(--ease), visibility 0.6s var(--ease);
}

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

.loader__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.loader__logo {
    display: flex;
    gap: 6px;
    font-family: 'Sora', sans-serif;
    font-weight: 800;
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    letter-spacing: -0.02em;
}

.loader__letter {
    display: inline-block;
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    transform: translateY(30px) rotateX(-90deg);
    animation: loaderLetter 0.8s var(--ease) forwards;
}

.loader__letter:nth-child(1) { animation-delay: 0.1s; }
.loader__letter:nth-child(2) { animation-delay: 0.25s; }
.loader__letter:nth-child(3) { animation-delay: 0.4s; }

@keyframes loaderLetter {
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0);
    }
}

.loader__bar {
    width: 260px;
    height: 2px;
    background: var(--surface-3);
    border-radius: var(--r-full);
    overflow: hidden;
    position: relative;
}

.loader__bar-fill {
    height: 100%;
    width: 0%;
    background: var(--grad-accent);
    border-radius: var(--r-full);
    transition: width 0.15s linear;
    box-shadow: 0 0 12px var(--accent-glow);
}

.loader__text {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    color: var(--text-2);
    text-transform: uppercase;
}

.loader__dots {
    display: inline-block;
    width: 24px;
    animation: dotsBlink 1.2s steps(4, end) infinite;
    overflow: hidden;
    vertical-align: bottom;
}

@keyframes dotsBlink {
    0% { width: 0; }
    100% { width: 24px; }
}

/* ---------- THEME TRANSITION ---------- */
body,
.navbar,
.menu__bg,
.project-card,
.footer,
.btn,
.ctrl-btn,
.lang__dropdown,
.quick-about__grid {
    transition:
        background-color 0.5s var(--ease),
        color 0.5s var(--ease),
        border-color 0.5s var(--ease);
}

/* ---------- CUSTOM CURSOR ---------- */
.cursor {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99998;
    pointer-events: none;
    mix-blend-mode: difference;
    display: none;
}

@media (hover: hover) and (pointer: fine) {
    .cursor { display: block; }
}

.cursor__dot,
.cursor__ring {
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    will-change: transform, width, height;
}

.cursor__dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    transition: transform 0.08s linear;
    box-shadow: 0 0 14px var(--accent-glow);
}

.cursor__ring {
    width: 38px;
    height: 38px;
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    transition: transform 0.18s var(--ease),
                width 0.25s var(--ease),
                height 0.25s var(--ease),
                border-color 0.25s var(--ease),
                background 0.25s var(--ease);
}

.cursor.is-hover .cursor__ring {
    width: 64px;
    height: 64px;
    border-color: var(--accent);
    background: rgba(0, 229, 255, 0.08);
}

.cursor.is-hover .cursor__dot {
    transform: translate(-50%, -50%) scale(0.5);
}

.cursor.is-click .cursor__ring {
    width: 26px;
    height: 26px;
    background: rgba(0, 229, 255, 0.25);
}

/* ---------- FOOTER ---------- */
.footer {
    position: relative;
    margin-top: 120px;
    padding: 40px 0;
    border-top: 1px solid var(--border-1);
    background: rgba(5, 6, 10, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.footer__brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.footer__brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--grad-accent);
    color: #05060a;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 0 20px var(--accent-glow);
}

.footer__brand-name {
    display: block;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.footer__brand-sub {
    display: block;
    font-size: 0.78rem;
    color: var(--text-2);
}

.footer__copy {
    font-size: 0.84rem;
    color: var(--text-2);
}

/* ---------- UTILITIES ---------- */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}