:root {
    /* Color Palette (Light Mode Default) */
    --bg-color: #f5f5f7;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --accent-blue: #545bed;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.8);
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
    --hover-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);

    --brand-linkedin: #0077b5;
    --brand-github: #24292e;
    --brand-twitter: #1da1f2;
    --brand-instagram: #e1306c;
    --brand-reddit: #ff4500;
    --brand-email: #6d4aff;

    --card-hover-bg: rgba(255, 255, 255, 0.9);
    --card-hover-border: rgba(0, 0, 0, 0.1);
    --card-icon-bg: rgba(255, 255, 255, 0.5);

    --switch-bg: rgba(0, 0, 0, 0.05);
    --switch-active-bg: #fff;
    --switch-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);

    /* Dynamic element filters and opacities */
    --chart-filter: none;
    --map-filter: grayscale(1) opacity(0.3);
    --map-gradient: linear-gradient(to right, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0) 100%);
    --hdr-btn-opacity: 1;
    --hdr-btn-cursor: pointer;
}

:root.dark-mode {
    /* Dark Mode Palette overrides */
    --bg-color: #000000;
    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --accent-blue: #0a84ff;
    --card-bg: rgba(28, 28, 30, 0.7);
    --card-border: rgba(255, 255, 255, 0.15);
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --hover-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);

    --brand-github: #f0f6fc;
    --card-hover-bg: rgba(44, 44, 46, 0.8);
    --card-hover-border: rgba(255, 255, 255, 0.3);
    --card-icon-bg: rgba(255, 255, 255, 0.1);

    --switch-bg: rgba(255, 255, 255, 0.15);
    --switch-active-bg: #636366;
    --switch-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);

    --chart-filter: invert(1) hue-rotate(180deg) brightness(1.6);
    --map-filter: invert(1) hue-rotate(180deg) grayscale(0.8) opacity(0.35);
    --map-gradient: linear-gradient(to right, rgba(28, 28, 30, 0.9) 0%, rgba(28, 28, 30, 0) 100%);
    --hdr-btn-opacity: 0.5;
    --hdr-btn-cursor: not-allowed;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Atmosphere */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 10% 20%, rgba(84, 91, 237, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(215, 60, 230, 0.1) 0%, transparent 40%);
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
.profile-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 1rem;
    position: relative;
}

/* Theme Selector */
.theme-switch-wrapper {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.hdr-btn {
    background-color: var(--switch-bg);
    border: none;
    padding: 6px 12px;
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: var(--hdr-btn-opacity);
    cursor: var(--hdr-btn-cursor);
    -webkit-tap-highlight-color: transparent;
}

.hdr-btn:hover {
    color: var(--text-primary);
}

.hdr-btn.active {
    background-color: var(--switch-active-bg);
    color: var(--text-primary);
    box-shadow: var(--switch-shadow);
}

:root.dark-mode .hdr-btn:hover,
:root.dark-mode .hdr-btn:active {
    color: var(--text-secondary);
    background-color: var(--switch-bg);
}

@media (hover: none) and (pointer: coarse) {
    :root.dark-mode .hdr-btn {
        pointer-events: none;
    }
}

.theme-switch {
    background-color: var(--switch-bg);
    border-radius: 999px;
    padding: 4px;
    display: flex;
    align-items: center;
    position: relative;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.switch-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.switch-btn:hover,
.switch-btn.active {
    color: var(--text-primary);
}

.switch-bg {
    position: absolute;
    top: 4px;
    left: 4px;
    height: calc(100% - 8px);
    background-color: var(--switch-active-bg);
    border-radius: 999px;
    box-shadow: var(--switch-shadow);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 0;
}

.avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    transition: backdrop-filter 0.3s ease;
}

/* Enhanced HDR Mode Styles */
.avatar.hdr-active {
    filter: brightness(1.2) contrast(1.1) saturate(1.2);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.8), 0 0 60px rgba(255, 255, 255, 0.4);
    animation: hdrGlow 3s ease-in-out infinite alternate;
    border: 2px solid rgba(255, 255, 255, 0.9);
}

.card.hdr-active {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 32px rgba(255, 255, 255, 0.3), inset 0 0 20px rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease, border-color 0.3s ease;
    animation: hdrCardGlow 3s ease-in-out infinite alternate;
}

.card.hdr-active:hover {
    transform: translateY(-6px) scale(1.02);
    background: rgba(255, 255, 255, 1);
    border-color: rgba(255, 255, 255, 1);
    animation: hdrCardGlowHover 3s ease-in-out infinite alternate;
}

.card.hdr-active .card-icon {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
}

@keyframes hdrGlow {
    0% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.6), 0 0 40px rgba(255, 255, 255, 0.2);
    }

    100% {
        box-shadow: 0 0 40px rgba(255, 255, 255, 1), 0 0 80px rgba(255, 255, 255, 0.6);
    }
}

@keyframes hdrCardGlow {
    0% {
        box-shadow: 0 8px 32px rgba(255, 255, 255, 0.3), inset 0 0 20px rgba(255, 255, 255, 0.5), 0 0 20px rgba(255, 255, 255, 0.4);
    }

    100% {
        box-shadow: 0 8px 32px rgba(255, 255, 255, 0.4), inset 0 0 20px rgba(255, 255, 255, 0.6), 0 0 40px rgba(255, 255, 255, 0.8);
    }
}

@keyframes hdrCardGlowHover {
    0% {
        box-shadow: 0 12px 48px rgba(255, 255, 255, 0.5), inset 0 0 30px rgba(255, 255, 255, 0.8), 0 0 30px rgba(255, 255, 255, 0.6);
    }

    100% {
        box-shadow: 0 12px 48px rgba(255, 255, 255, 0.6), inset 0 0 30px rgba(255, 255, 255, 0.9), 0 0 50px rgba(255, 255, 255, 1);
    }
}

/* True HDR Display Support */
@media (dynamic-range: high) {
    .hdr-btn.active {
        background-color: color(display-p3 1 1 1);
        color: #000;
        box-shadow: 0 0 15px color(display-p3 1 1 1);
    }

    .avatar.hdr-active {
        filter: brightness(1.4) contrast(1.2) saturate(1.3);
        box-shadow: 0 0 40px color(display-p3 1 1 1), 0 0 80px color(display-p3 1 1 1 / 0.5);
        border-color: color(display-p3 1 1 1);
        animation: hdrGlowP3 3s ease-in-out infinite alternate;
    }

    .card.hdr-active {
        background: color(display-p3 1 1 1 / 0.95);
        border-color: color(display-p3 1 1 1);
        animation: hdrCardGlowP3 3s ease-in-out infinite alternate;
    }

    .card.hdr-active:hover {
        background: color(display-p3 1 1 1);
        border-color: color(display-p3 1 1 1);
        animation: hdrCardGlowHoverP3 3s ease-in-out infinite alternate;
    }

    .card.hdr-active .card-icon {
        background: color(display-p3 1 1 1 / 0.9);
        box-shadow: 0 0 20px color(display-p3 1 1 1 / 0.7);
    }

    @keyframes hdrGlowP3 {
        0% {
            box-shadow: 0 0 30px color(display-p3 1 1 1 / 0.7), 0 0 60px color(display-p3 1 1 1 / 0.3);
        }

        100% {
            box-shadow: 0 0 60px color(display-p3 1 1 1), 0 0 120px color(display-p3 1 1 1 / 0.8);
        }
    }

    @keyframes hdrCardGlowP3 {
        0% {
            box-shadow: 0 8px 40px color(display-p3 1 1 1 / 0.4), inset 0 0 30px color(display-p3 1 1 1 / 0.6), 0 0 30px color(display-p3 1 1 1 / 0.5);
        }

        100% {
            box-shadow: 0 8px 40px color(display-p3 1 1 1 / 0.5), inset 0 0 30px color(display-p3 1 1 1 / 0.7), 0 0 60px color(display-p3 1 1 1 / 0.9);
        }
    }

    @keyframes hdrCardGlowHoverP3 {
        0% {
            box-shadow: 0 12px 60px color(display-p3 1 1 1 / 0.7), inset 0 0 40px color(display-p3 1 1 1 / 0.9), 0 0 40px color(display-p3 1 1 1 / 0.7);
        }

        100% {
            box-shadow: 0 12px 60px color(display-p3 1 1 1 / 0.8), inset 0 0 40px color(display-p3 1 1 1 / 1.0), 0 0 80px color(display-p3 1 1 1 / 1.0);
        }
    }
}

.name {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.05rem;
    margin-bottom: 0.5rem;
}

.bio {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.bio a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 600;
}

.bio-secondary {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Bento Grid */
.bento-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding-bottom: 3rem;
}

/* Card Styles */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--hover-shadow);
    background: var(--card-hover-bg);
    border-color: var(--card-hover-border);
}

.card:active {
    transform: scale(0.98);
}

.card-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--card-icon-bg);
}

.card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Specific Card Colors */
.linkedin .card-icon {
    color: var(--brand-linkedin);
}

.github .card-icon {
    color: var(--brand-github);
}

.twitter-codes .card-icon {
    color: var(--brand-twitter);
}

.twitter-personal .card-icon {
    color: var(--text-secondary);
}

.instagram .card-icon {
    color: var(--brand-instagram);
}

.reddit .card-icon {
    color: var(--brand-reddit);
}

.daily-dev .card-icon {
    color: var(--text-primary);
}

.location .card-icon {
    color: #EA4335;
}

.email .card-icon {
    color: var(--brand-email);
}

/* Github Chart & Maps styling utilizing unified CSS vars */
.gh-chart {
    margin-top: 1rem;
    border-radius: 8px;
    overflow: hidden;
    opacity: 0.8;
}

.gh-chart img {
    width: 100%;
    height: auto;
    display: block;
    filter: var(--chart-filter);
}

.card-bg-map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: inherit;
}

.card-bg-map iframe {
    position: absolute;
    top: -50px;
    left: -50px;
    width: calc(100% + 100px);
    height: calc(100% + 100px);
    border: none !important;
    filter: var(--map-filter);
    pointer-events: none;
}

.card-bg-map::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 60%;
    height: 100%;
    background: var(--map-gradient);
    z-index: 1;
    pointer-events: none;
}

/* Grid Layouts for Larger Screens */
@media (min-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-auto-rows: minmax(180px, auto);
        gap: 1.5rem;
    }

    .card-large {
        grid-column: span 2;
        grid-row: span 2;
    }

    .card-medium {
        grid-column: span 2;
    }

    .card-wide {
        grid-column: span 2;
        grid-row: span 1;
    }

    .card-small {
        grid-column: span 1;
        grid-row: span 1;
    }
}

.linkedin .card-content {
    justify-content: space-between;
}

.linkedin .card-icon {
    font-size: 3rem;
    width: 64px;
    height: 64px;
}

/* Animation utilities */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.card.animate-in {
    opacity: 0;
    animation: fadeIn 0.6s ease-out forwards;
}

.card:nth-child(1) {
    animation-delay: 0.1s;
}

.card:nth-child(2) {
    animation-delay: 0.2s;
}

.card:nth-child(3) {
    animation-delay: 0.3s;
}

.card:nth-child(4) {
    animation-delay: 0.4s;
}

.card:nth-child(5) {
    animation-delay: 0.5s;
}

.card:nth-child(6) {
    animation-delay: 0.6s;
}

.card:nth-child(7) {
    animation-delay: 0.7s;
}

.card:nth-child(8) {
    animation-delay: 0.8s;
}

.card:nth-child(9) {
    animation-delay: 0.9s;
}

.card:nth-child(10) {
    animation-delay: 1.0s;
}