/*
 * ========================================
 *  PORTFOLIO — Base Design System
 *  Premium dark-mode first design tokens
 * ========================================
 */

/* ── Google Fonts Import ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Custom Properties (Design Tokens) ── */
:root {
    /* Colors — Dark Institutional */
    --bg-primary: #060611;
    --bg-secondary: #0c0c1d;
    --bg-tertiary: #141428;
    --bg-card: #0f0f22;
    --bg-card-hover: #16162e;
    --bg-elevated: #1a1a35;

    --text-primary: #f0f0f8;
    --text-secondary: #9595b2;
    --text-tertiary: #656585;
    --text-muted: #4a4a68;

    --accent-primary: #2dd4bf;
    --accent-secondary: #14b8a6;
    --accent-tertiary: #f59e0b;
    --accent-gradient: linear-gradient(135deg, #5eead4 0%, #2dd4bf 50%, #0ea5e9 100%);
    --accent-gradient-subtle: linear-gradient(135deg, rgba(45,212,191,0.15), rgba(20,184,166,0.15));

    --success: #00e68a;
    --warning: #ffb347;
    --error: #ff6b6b;

    /* Glass */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-bg-hover: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(255, 255, 255, 0.15);

    /* Typography */
    --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --fs-hero: clamp(2.8rem, 7vw, 7rem);
    --fs-h1: clamp(2rem, 4.5vw, 4rem);
    --fs-h2: clamp(1.6rem, 3vw, 2.8rem);
    --fs-h3: clamp(1.2rem, 2vw, 1.8rem);
    --fs-h4: clamp(1rem, 1.5vw, 1.3rem);
    --fs-body: clamp(0.95rem, 1.1vw, 1.1rem);
    --fs-small: clamp(0.8rem, 0.9vw, 0.9rem);
    --fs-xs: clamp(0.7rem, 0.8vw, 0.8rem);

    --fw-light: 300;
    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;
    --fw-extrabold: 800;

    --lh-tight: 1.1;
    --lh-snug: 1.3;
    --lh-normal: 1.6;
    --lh-relaxed: 1.8;

    --ls-tight: -0.03em;
    --ls-normal: 0;
    --ls-wide: 0.05em;
    --ls-wider: 0.1em;
    --ls-widest: 0.2em;

    /* Spacing — Fluid */
    --space-2xs: clamp(0.25rem, 0.5vw, 0.5rem);
    --space-xs: clamp(0.5rem, 1vw, 0.75rem);
    --space-sm: clamp(0.75rem, 1.5vw, 1rem);
    --space-md: clamp(1rem, 2vw, 1.5rem);
    --space-lg: clamp(1.5rem, 3vw, 2.5rem);
    --space-xl: clamp(2rem, 4vw, 4rem);
    --space-2xl: clamp(3rem, 6vw, 6rem);
    --space-3xl: clamp(4rem, 8vw, 8rem);
    --space-section: clamp(5rem, 10vw, 10rem);

    /* Layout */
    --max-width: 1400px;
    --content-width: 900px;
    --sidebar-width: 300px;
    --nav-height: 80px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 50%;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 60px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 30px rgba(45, 212, 191, 0.15);
    --shadow-glow-strong: 0 0 50px rgba(45, 212, 191, 0.25);

    /* Transitions */
    --ease-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --ease-elastic: cubic-bezier(0.175, 0.885, 0.32, 1.275);

    --duration-fast: 0.15s;
    --duration-normal: 0.3s;
    --duration-slow: 0.5s;
    --duration-slower: 0.8s;

    /* Z-Index Scale */
    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-cursor: 500;
    --z-preloader: 1000;
}

/* ── CSS Reset (Modern) ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: var(--fs-body);
    font-weight: var(--fw-regular);
    line-height: var(--lh-normal);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Smooth scrolling container for Lenis */
html.lenis, html.lenis body {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

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

canvas {
    display: block;
}

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
    border: none;
    outline: none;
    background: none;
}

button {
    cursor: pointer;
}

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

ul,
ol {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--fw-bold);
    line-height: var(--lh-tight);
    letter-spacing: var(--ls-tight);
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

p {
    color: var(--text-secondary);
    line-height: var(--lh-relaxed);
}

/* ── Selection ── */
::selection {
    background: rgba(45, 212, 191, 0.3);
    color: var(--text-primary);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* ── Focus Styles ── */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 3px;
}

/* ── Utility: Container ── */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container--narrow {
    max-width: var(--content-width);
}

/* ── Utility: Section ── */
.section {
    padding: var(--space-section) 0;
    position: relative;
}

.section__header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.section__label {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    letter-spacing: var(--ls-widest);
    text-transform: uppercase;
    color: var(--accent-primary);
    margin-bottom: var(--space-sm);
    padding: var(--space-2xs) var(--space-sm);
    border: 1px solid rgba(45, 212, 191, 0.2);
    border-radius: var(--radius-sm);
    background: rgba(45, 212, 191, 0.05);
}

.section__title {
    font-size: var(--fs-h2);
    margin-bottom: var(--space-sm);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section__subtitle {
    font-size: var(--fs-body);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ── Utility: Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-lg);
    font-family: var(--font-body);
    font-size: var(--fs-small);
    font-weight: var(--fw-semibold);
    letter-spacing: var(--ls-wide);
    text-transform: uppercase;
    border-radius: var(--radius-md);
    transition: all var(--duration-normal) var(--ease-smooth);
    position: relative;
    overflow: hidden;
}

.btn--primary {
    background: var(--accent-gradient);
    color: #000;
    box-shadow: var(--shadow-glow);
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-strong);
}

.btn--outline {
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
}

.btn--outline:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(45, 212, 191, 0.05);
    transform: translateY(-2px);
}

.btn--ghost {
    color: var(--text-secondary);
    padding: var(--space-xs) var(--space-sm);
}

.btn--ghost:hover {
    color: var(--accent-primary);
}

.btn svg,
.btn i {
    width: 18px;
    height: 18px;
}

/* ── Utility: Tags ── */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    letter-spacing: var(--ls-wide);
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-secondary);
    transition: all var(--duration-fast) var(--ease-smooth);
}

.tag:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(45, 212, 191, 0.05);
}

/* ── Utility: Dividers ── */
.divider {
    width: 100%;
    height: 1px;
    background: var(--glass-border);
    margin: var(--space-xl) 0;
}

.divider--gradient {
    background: var(--accent-gradient);
    opacity: 0.3;
}

/* ── Utility: Text Gradient ── */
.text-gradient {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Utility: Glass Card ── */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    transition: all var(--duration-normal) var(--ease-smooth);
}

.glass-card:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    box-shadow: var(--shadow-lg);
}

/* ── Reveal Animations ── */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

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

.reveal-left {
    opacity: 0;
    transform: translateX(-40px);
}

.reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(40px);
}

.reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* ── Noise Overlay ── */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    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");
}

/* ── Grid Background (subtle) ── */
.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 60px 60px;
}

.site-depth-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.64;
    mix-blend-mode: screen;
}

/* ── Preloader ── */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: var(--z-preloader);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

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

.preloader__counter {
    font-family: var(--font-display);
    font-size: clamp(4rem, 10vw, 8rem);
    font-weight: var(--fw-extrabold);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.preloader__bar {
    width: 200px;
    height: 2px;
    background: var(--glass-border);
    border-radius: 2px;
    margin-top: var(--space-md);
    overflow: hidden;
}

.preloader__progress {
    height: 100%;
    width: 0%;
    background: var(--accent-gradient);
    border-radius: 2px;
    transition: width 0.1s linear;
}

/* ── Custom Cursor ── */
.cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    border: 2px solid var(--accent-primary);
    border-radius: var(--radius-full);
    pointer-events: none;
    z-index: var(--z-cursor);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease, border-color 0.3s ease, background 0.3s ease;
    mix-blend-mode: difference;
}

.cursor.hover {
    width: 50px;
    height: 50px;
    background: rgba(45, 212, 191, 0.1);
    border-color: var(--accent-secondary);
}

.cursor-dot {
    position: fixed;
    width: 6px;
    height: 6px;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
    pointer-events: none;
    z-index: var(--z-cursor);
    transform: translate(-50%, -50%);
    mix-blend-mode: difference;
}

/* Hide custom cursor on touch devices */
@media (hover: none) and (pointer: coarse) {
    .cursor,
    .cursor-dot {
        display: none !important;
    }
}
