/* ============================================
   WORLD-CLASS DESIGN SYSTEM
   Inspired by leading design agencies
   ============================================ */

/* Design Tokens & CSS Custom Properties */
:root {
    /* Color Palette - Refined & Modern */
    --color-primary: #667eea;
    --color-primary-dark: #5568d3;
    --color-primary-light: #7c8ef0;
    --color-secondary: #764ba2;
    --color-secondary-dark: #5d3a7f;
    --color-accent: #f093fb;

    /* Neutral Colors */
    --color-white: #ffffff;
    --color-gray-50: #fafafa;
    --color-gray-100: #f5f5f5;
    --color-gray-200: #e5e5e5;
    --color-gray-300: #d4d4d4;
    --color-gray-400: #a3a3a3;
    --color-gray-500: #737373;
    --color-gray-600: #525252;
    --color-gray-700: #404040;
    --color-gray-800: #262626;
    --color-gray-900: #171717;

    /* Typography Scale - Perfect 4th Ratio */
    --font-size-xs: 0.75rem;
    /* 12px */
    --font-size-sm: 0.875rem;
    /* 14px */
    --font-size-base: 1rem;
    /* 16px */
    --font-size-lg: 1.125rem;
    /* 18px */
    --font-size-xl: 1.25rem;
    /* 20px */
    --font-size-2xl: 1.5rem;
    /* 24px */
    --font-size-3xl: 1.875rem;
    /* 30px */
    --font-size-4xl: 2.25rem;
    /* 36px */
    --font-size-5xl: 3rem;
    /* 48px */

    /* Font Weights */
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;

    /* Line Heights */
    --line-height-tight: 1.25;
    --line-height-snug: 1.375;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.625;
    --line-height-loose: 2;

    /* Spacing Scale - 8px base unit */
    --spacing-1: 0.25rem;
    /* 4px */
    --spacing-2: 0.5rem;
    /* 8px */
    --spacing-3: 0.75rem;
    /* 12px */
    --spacing-4: 1rem;
    /* 16px */
    --spacing-5: 1.25rem;
    /* 20px */
    --spacing-6: 1.5rem;
    /* 24px */
    --spacing-8: 2rem;
    /* 32px */
    --spacing-10: 2.5rem;
    /* 40px */
    --spacing-12: 3rem;
    /* 48px */
    --spacing-16: 4rem;
    /* 64px */
    --spacing-20: 5rem;
    /* 80px */

    /* Border Radius */
    --radius-sm: 0.5rem;
    /* 8px */
    --radius-md: 0.75rem;
    /* 12px */
    --radius-lg: 1rem;
    /* 16px */
    --radius-xl: 1.5rem;
    /* 24px */
    --radius-2xl: 2rem;
    /* 32px */
    --radius-full: 9999px;

    /* Shadows - Layered Depth System */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);

    /* Transitions - Easing Functions */
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);

    /* Animation Durations */
    --duration-fast: 150ms;
    --duration-base: 300ms;
    --duration-slow: 500ms;
    --duration-slower: 750ms;

    /* Z-Index Scale */
    --z-base: 1;
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;

    /* Gradient Definitions */
    --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    --gradient-primary-hover: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-secondary-dark) 100%);
    --gradient-background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --gradient-background-animated: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #4facfe);
    --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);

    /* Backdrop Blur */
    --blur-sm: blur(4px);
    --blur-md: blur(8px);
    --blur-lg: blur(16px);
    --blur-xl: blur(24px);
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */

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

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--color-gray-900);
    background: var(--gradient-background);
    background-size: 400% 400%;
    background-attachment: fixed;
    animation: gradientShift 20s ease infinite;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-5);
    padding: max(var(--spacing-5), env(safe-area-inset-top)) max(var(--spacing-5), env(safe-area-inset-right)) max(var(--spacing-5), env(safe-area-inset-bottom)) max(var(--spacing-5), env(safe-area-inset-left));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    position: relative;
}

/* Subtle noise texture overlay for depth */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.03) 1px, transparent 0);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

/* Animated Background Gradient with Enhanced Flow */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
        filter: hue-rotate(0deg);
    }

    33% {
        background-position: 100% 50%;
        filter: hue-rotate(5deg);
    }

    66% {
        background-position: 50% 100%;
        filter: hue-rotate(-5deg);
    }

    100% {
        background-position: 0% 50%;
        filter: hue-rotate(0deg);
    }
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */

.container {
    width: 100%;
    max-width: 540px;
    animation: containerFadeIn var(--duration-slow) var(--ease-out);
    padding: 0 var(--spacing-1);
    position: relative;
    z-index: var(--z-base);
    transform-style: preserve-3d;
    perspective: 1000px;
    isolation: isolate;
}

/* Subtle parallax effect container */
@media (min-width: 768px) {
    .container {
        transition: transform 0.1s ease-out;
    }
}

@keyframes containerFadeIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   PROFILE SECTION
   ============================================ */

.profile {
    text-align: center;
    margin-bottom: var(--spacing-12);
    color: var(--color-white);
    animation: profileFadeIn var(--duration-slow) var(--ease-out) 100ms backwards;
    position: relative;
    z-index: var(--z-base);
}

/* Subtle glow effect around profile */
.profile::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200%;
    height: 200%;
    background: radial-gradient(circle,
            rgba(255, 255, 255, 0.05) 0%,
            transparent 70%);
    pointer-events: none;
    z-index: -1;
    animation: profileGlow 4s var(--ease-in-out) infinite;
}

@keyframes profileGlow {

    0%,
    100% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

@keyframes profileFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.avatar {
    font-size: clamp(4rem, 12vw, 5.5rem);
    margin: 0 auto var(--spacing-6);
    animation: avatarFloat 3s var(--ease-in-out) infinite;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.2));
    will-change: transform;
    display: inline-block;
}

@keyframes avatarFloat {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-12px) scale(1.05);
    }
}

.name {
    font-size: clamp(1.875rem, 5vw, 2.5rem);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--spacing-2);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.02em;
    line-height: var(--line-height-tight);
}

.bio {
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    opacity: 0.95;
    font-weight: var(--font-weight-light);
    letter-spacing: 0.01em;
    line-height: var(--line-height-relaxed);
}

/* ============================================
   LINKS SECTION & TABS
   ============================================ */

.tabs-nav {
    display: flex;
    justify-content: center;
    gap: var(--spacing-2);
    margin-bottom: var(--spacing-8);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    padding: var(--spacing-2);
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-sm);
}

.tab-btn {
    background: transparent;
    border: none;
    padding: var(--spacing-2) var(--spacing-6);
    color: var(--color-white);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-smooth);
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tab-btn.active {
    background: var(--color-white);
    color: var(--color-gray-900);
    box-shadow: var(--shadow-md);
}

.tab-panels {
    position: relative;
    min-height: 300px;
}

.tab-panel {
    display: none;
    animation: panelFadeIn var(--duration-base) var(--ease-out) forwards;
}

.tab-panel.active {
    display: block;
}

@keyframes panelFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.links {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-4);
    margin-bottom: var(--spacing-8);
    position: relative;
}

/* Subtle connecting line effect (optional visual enhancement) */
.links::before {
    content: '';
    position: absolute;
    left: calc(var(--spacing-5) + 32px);
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg,
            transparent 0%,
            rgba(255, 255, 255, 0.1) 20%,
            rgba(255, 255, 255, 0.1) 80%,
            transparent 100%);
    opacity: 0;
    transition: opacity var(--duration-slow) var(--ease-out);
    z-index: 0;
    pointer-events: none;
}

@media (min-width: 600px) {
    .links:hover::before {
        opacity: 1;
    }
}

/* ============================================
   LINK CARDS - Premium Design
   ============================================ */

.link-card {
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.98) 0%,
            rgba(255, 255, 255, 0.95) 100%);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    border-radius: var(--radius-xl);
    padding: var(--spacing-5);
    min-height: 72px;
    display: flex;
    align-items: center;
    gap: var(--spacing-4);
    text-decoration: none;
    color: var(--color-gray-900);
    box-shadow: var(--shadow-lg),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all var(--duration-base) var(--ease-smooth),
        box-shadow var(--duration-base) var(--ease-smooth);
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    will-change: transform, box-shadow, filter;
    opacity: 0;
    transform: translateY(20px);
    animation: linkCardFadeIn var(--duration-slow) var(--ease-out) forwards;
    isolation: isolate;
    /* Create new stacking context */
}

.link-card:nth-child(1) {
    animation-delay: 200ms;
}

.link-card:nth-child(2) {
    animation-delay: 300ms;
}

.link-card:nth-child(3) {
    animation-delay: 400ms;
}

.link-card:nth-child(4) {
    animation-delay: 500ms;
}

.link-card:nth-child(5) {
    animation-delay: 600ms;
}

.link-card:nth-child(6) {
    animation-delay: 700ms;
}

.link-card:nth-child(7) {
    animation-delay: 800ms;
}

.link-card:nth-child(8) {
    animation-delay: 900ms;
}

.link-card:nth-child(9) {
    animation-delay: 1000ms;
}

.link-card:nth-child(10) {
    animation-delay: 1100ms;
}

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

/* Glassmorphism Effect with Enhanced Depth */
.link-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-glass);
    opacity: 0;
    transition: opacity var(--duration-base) var(--ease-out);
    pointer-events: none;
    z-index: 1;
    border-radius: inherit;
}

/* Subtle inner glow effect */
.link-card {
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.98) 0%,
            rgba(255, 255, 255, 0.95) 100%);
}

.link-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.3) 30%,
            rgba(255, 255, 255, 0.5) 50%,
            rgba(255, 255, 255, 0.3) 70%,
            transparent 100%);
    transition: left var(--duration-slow) var(--ease-out);
    z-index: 2;
    border-radius: inherit;
}

.link-card:hover::after {
    left: 100%;
}

.link-card:hover {
    transform: translateY(-8px) scale(1.015);
    box-shadow: var(--shadow-2xl),
        0 0 40px rgba(102, 126, 234, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    border-color: rgba(255, 255, 255, 0.5);
    filter: brightness(1.02);
}

.link-card:hover::before {
    opacity: 1;
}

.link-card:active {
    transform: translateY(-2px) scale(0.99);
    transition-duration: var(--duration-fast);
}

.link-card:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .link-card:hover {
        transform: none;
    }

    .link-card:active {
        transform: scale(0.97);
        opacity: 0.9;
    }

    .link-card:hover::after {
        left: -100%;
    }
}

/* ============================================
   LINK ICON
   ============================================ */

.link-icon {
    font-size: clamp(1.5rem, 4vw, 2rem);
    width: clamp(56px, 14vw, 64px);
    height: clamp(56px, 14vw, 64px);
    min-width: 56px;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    flex-shrink: 0;
    transition: all var(--duration-base) var(--ease-spring),
        background var(--duration-base) var(--ease-out);
    position: relative;
    z-index: 3;
    box-shadow: var(--shadow-md),
        0 0 0 0 rgba(102, 126, 234, 0.4);
    overflow: hidden;
}

/* Enhanced icon glow on hover */
.link-card:hover .link-icon {
    box-shadow: var(--shadow-xl),
        0 0 20px rgba(102, 126, 234, 0.3),
        0 0 40px rgba(102, 126, 234, 0.15);
}

.link-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width var(--duration-base) var(--ease-out),
        height var(--duration-base) var(--ease-out);
}

.link-card:hover .link-icon {
    transform: scale(1.1) rotate(8deg);
    box-shadow: var(--shadow-xl);
}

.link-card:hover .link-icon::before {
    width: 120%;
    height: 120%;
}

.link-card:active .link-icon {
    transform: scale(1.05) rotate(4deg);
}

/* ============================================
   LINK CONTENT
   ============================================ */

.link-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
    position: relative;
    z-index: 3;
    min-width: 0;
    /* Prevent overflow */
}

.link-title {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    font-weight: var(--font-weight-semibold);
    color: var(--color-gray-900);
    line-height: var(--line-height-snug);
    letter-spacing: -0.01em;
}

.link-subtitle {
    font-size: clamp(0.75rem, 2vw, 0.875rem);
    color: var(--color-gray-600);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    letter-spacing: 0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================
   LINK ARROW
   ============================================ */

.link-arrow {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    color: var(--color-primary);
    transition: all var(--duration-base) var(--ease-out);
    flex-shrink: 0;
    min-width: 24px;
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.link-card:hover .link-arrow {
    transform: translateX(8px);
    color: var(--color-primary-dark);
}

.link-card:active .link-arrow {
    transform: translateX(4px);
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    text-align: center;
    color: var(--color-white);
    opacity: 0.85;
    font-size: clamp(0.75rem, 2vw, 0.875rem);
    margin-top: var(--spacing-6);
    padding-bottom: env(safe-area-inset-bottom);
    font-weight: var(--font-weight-light);
    letter-spacing: 0.05em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: var(--z-base);
    animation: footerFadeIn var(--duration-slow) var(--ease-out) 1s backwards;
}

@keyframes footerFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 0.85;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVE DESIGN - Mobile First
   ============================================ */

/* Small devices (phones, 600px and down) */
@media (max-width: 600px) {
    body {
        padding: var(--spacing-4);
        padding: max(var(--spacing-4), env(safe-area-inset-top)) max(var(--spacing-4), env(safe-area-inset-right)) max(var(--spacing-4), env(safe-area-inset-bottom)) max(var(--spacing-4), env(safe-area-inset-left));
    }

    .container {
        padding: 0 var(--spacing-1);
    }

    .profile {
        margin-bottom: var(--spacing-10);
    }

    .links {
        gap: var(--spacing-3);
    }

    .link-card {
        padding: var(--spacing-4);
        min-height: 68px;
    }
}

/* Extra small devices (phones in portrait, 400px and down) */
@media (max-width: 400px) {
    body {
        padding: var(--spacing-3);
        padding: max(var(--spacing-3), env(safe-area-inset-top)) max(var(--spacing-3), env(safe-area-inset-right)) max(var(--spacing-3), env(safe-area-inset-bottom)) max(var(--spacing-3), env(safe-area-inset-left));
    }

    .container {
        padding: 0;
    }

    .profile {
        margin-bottom: var(--spacing-8);
    }

    .links {
        gap: var(--spacing-2);
    }

    .link-card {
        padding: var(--spacing-3);
        border-radius: var(--radius-lg);
    }
}

/* Landscape orientation on mobile */
@media (max-width: 900px) and (orientation: landscape) {
    .profile {
        margin-bottom: var(--spacing-6);
    }

    .avatar {
        font-size: 3.5rem;
        margin-bottom: var(--spacing-4);
    }

    .name {
        font-size: 1.75rem;
    }

    .links {
        gap: var(--spacing-2);
        margin-bottom: var(--spacing-4);
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
    :root {
        --gradient-background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f1419 100%);
    }

    .link-card {
        background: rgba(255, 255, 255, 0.95);
    }
}

/* ============================================
   REDUCED MOTION - Accessibility
   ============================================ */

@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;
    }

    body {
        animation: none;
    }

    .avatar {
        animation: none;
    }

    .link-card {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */

@media (prefers-contrast: high) {
    .link-card {
        border: 2px solid var(--color-gray-900);
    }

    .link-card:focus-visible {
        outline-width: 4px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    body {
        background: white;
        color: black;
    }

    .link-card {
        background: white;
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
}