/* ==========================================================================
   Ali Portfolio - Bento Grid Redesign CSS
   Supports Dark / Light Theme & Responsive Bento Grid (Desktop & Mobile)
   ========================================================================== */

:root {
    /* Dark Theme Colors (Default) */
    --bg-body: #09090d;
    --card-bg: #121216;
    --card-hover-bg: #17171d;
    --card-border: rgba(255, 255, 255, 0.08);
    --card-border-hover: rgba(255, 255, 255, 0.16);
    --text-primary: #ffffff;
    --text-secondary: #9494a0;
    --text-muted: #6b6b78;
    
    /* Gradients & Accents */
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-purple: #a855f7;
    --grad-banner: linear-gradient(135deg, #2563eb 0%, #3b82f6 45%, #06b6d4 100%);
    --grad-text: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #38bdf8 100%);
    --notification-purple: #a78bfa;
    --notification-bg: #16151f;
    
    /* Card Specs */
    --radius-card: 26px;
    --radius-pill: 999px;
    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
    --bg-body: #f1f2f6;
    --card-bg: #ffffff;
    --card-hover-bg: #f8fafc;
    --card-border: rgba(0, 0, 0, 0.08);
    --card-border-hover: rgba(0, 0, 0, 0.16);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --notification-bg: #f3f0ff;
    --notification-purple: #7c3aed;
    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
}

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

html {
    scroll-behavior: smooth;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 18px;
    overflow-x: hidden;
}

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

img {
    max-width: 100%;
    display: block;
    object-fit: cover;
}

/* Desktop 100vh & 100vw Layout Directive */
@media (min-width: 961px) {
    html {
        overflow: hidden;
    }

    body {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
        padding: 18px;
        box-sizing: border-box;
    }

    .bento-container {
        width: 100%;
        height: 100%;
        max-width: 1400px;
        margin: 0 auto;
        display: grid;
        grid-template-columns: minmax(280px, 320px) 1fr minmax(280px, 320px);
        gap: 16px;
        align-items: stretch;
    }

    .bento-col {
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 14px;
        min-height: 0;
    }

    /* Left Column stretch */
    .col-left {
        display: flex;
        flex-direction: column;
    }
    .col-left .card-profile { flex: 0 0 auto; }
    .col-left .card-notification { flex: 0 0 auto; }
    .col-left .card-contact { flex: 0 0 auto; }
    .col-left .card-app-row { flex: 0 0 auto; }
    .col-left .card-explore-projects { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
    .col-left .card-explore-projects .explore-scroll-wrapper { flex: 1; min-height: 0; }

    /* Center Column stretch */
    .col-center {
        display: flex;
        flex-direction: column;
    }
    .col-center .card-banner { flex: 0 0 auto; }
    .col-center .card-showcase { flex: 1 1 auto; min-height: 0; }
    .col-center .center-bottom-row { flex: 0 0 auto; }

    /* Right Column stretch */
    .col-right {
        display: flex;
        flex-direction: column;
    }
    .col-right .card-map { flex: 1 1 25%; min-height: 0; }
    .col-right .card-location { flex: 0 0 auto; }
    .col-right .card-photos-row { flex: 1 1 45%; min-height: 0; }
    .col-right .card-photos-row .photo-card { height: 100%; }
    .col-right .card-theme-toggle { flex: 0 0 auto; }
}

/* Mobile & Fallback Layout */
@media (max-width: 960px) {
    .bento-container {
        width: 100%;
        max-width: 1240px;
        margin: 0 auto;
        display: grid;
        grid-template-columns: 320px 1fr 320px;
        gap: 18px;
        align-items: start;
    }

    .bento-col {
        display: flex;
        flex-direction: column;
        gap: 18px;
        min-width: 0;
    }
}

/* Generic Card Base */
.bento-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.bento-card:hover {
    border-color: var(--card-border-hover);
    transform: translateY(-2px);
}

/* ==========================================================================
   DESKTOP BENTO CARDS (Left Column)
   ========================================================================== */

/* 1. Profile Card */
.card-profile {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.profile-avatar-wrapper {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info .profile-name {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

.profile-info .profile-handle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.profile-bio {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.profile-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.btn-icon-mail {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon-mail:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-follow {
    flex: 1;
    height: 44px;
    background: #ffffff;
    color: #000000;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-follow:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

/* 2. Notification Pill Card */
.card-notification {
    background: var(--notification-bg);
    border: 1px solid rgba(167, 139, 250, 0.15);
    border-radius: var(--radius-pill);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--notification-purple);
    text-align: center;
}

/* 3. Freelance Status Card */
.card-freelance {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
}

.freelance-top {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
}

.badge-freelance {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-pill);
    padding: 6px 14px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
}

.status-dot {
    position: relative;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
}

.status-dot::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #22c55e;
    animation: status-dot-pulse 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes status-dot-pulse {
    0% { transform: scale(1); opacity: 0.7; }
    75%, 100% { transform: scale(2.6); opacity: 0; }
}

.freelance-social {
    display: flex;
    align-items: center;
    gap: 8px;
}

.freelance-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition);
}

.freelance-icon-btn:hover {
    color: var(--text-primary);
    border-color: var(--card-border-hover);
    background: rgba(255, 255, 255, 0.06);
}

.freelance-title-wrap {
    width: 100%;
    overflow: hidden;
}

.freelance-title {
    font-size: 1.55rem;
    font-weight: 800;
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1.25;
    letter-spacing: -0.02em;
    text-align: center;
    white-space: nowrap;
}

/* Only engages when script.js detects the title doesn't fit on one line */
.freelance-title-wrap.marquee {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
}

.freelance-title-wrap.marquee .freelance-title-track {
    display: flex;
    width: max-content;
    animation-name: freelance-marquee;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.freelance-title-wrap.marquee .freelance-title {
    text-align: left;
    padding-right: 56px;
    flex-shrink: 0;
}

@keyframes freelance-marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* 4. App Icons Row */
.card-app-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.app-icon-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 22px;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    cursor: pointer;
}

.app-icon-card:hover {
    transform: translateY(-3px);
    border-color: var(--card-border-hover);
}

.app-icon-inner {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.app-icon-dribbble {
    background: linear-gradient(135deg, #ea4c89, #e03368);
    color: #ffffff;
}

.app-icon-behance {
    background: linear-gradient(135deg, #0057ff, #0038b8);
    color: #ffffff;
    font-size: 1.8rem;
    font-weight: 800;
    font-family: sans-serif;
}

/* 5. Explore More Projects Card */
.card-explore-projects {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 22px;
}

.explore-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.explore-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #38bdf8;
}

.explore-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.explore-arrow {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    background: transparent;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.explore-arrow:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--card-border-hover);
}

.explore-arrow:active {
    transform: scale(0.92);
}

.explore-scroll-wrapper {
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
}

.explore-scroll-wrapper::-webkit-scrollbar {
    display: none;
}

.explore-scroll-wrapper.grabbing {
    cursor: grabbing;
    scroll-behavior: auto;
}

.explore-track {
    display: flex;
    align-items: stretch;
    gap: 12px;
    height: 100%;
    width: max-content;
    user-select: none;
}

.explore-item {
    position: relative;
    flex: 0 0 auto;
    width: 170px;
    height: 100%;
    min-height: 0;
    border-radius: 16px;
    overflow: hidden;
    background: #0f172a;
    display: block;
}

.explore-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
}

.explore-item:hover img {
    transform: scale(1.06);
}

.explore-item-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px 12px 9px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.25;
    pointer-events: none;
}

/* ==========================================================================
   DESKTOP BENTO CARDS (Center Column)
   ========================================================================== */

/* 6. Top Gradient Banner */
.card-banner {
    background: var(--grad-banner);
    border: none;
    border-radius: var(--radius-card);
    padding: 22px 30px;
    color: #ffffff;
    text-align: center;
    box-shadow: 0 12px 30px -8px rgba(37, 99, 235, 0.4);
}

.banner-text {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* 7. Main Hero Showcase Card (Ammu's Catering Mockup) */
.card-showcase {
    padding: 0;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
}

.showcase-image-wrapper {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
    touch-action: pan-y;
}

.showcase-image-wrapper:active {
    cursor: grabbing;
}

.showcase-image-wrapper {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
}

.showcase-image-wrapper img {
    -webkit-user-drag: none;
    pointer-events: none;
}

.showcase-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.showcase-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 60%, rgba(0,0,0,0.5) 100%);
    pointer-events: none;
}

.showcase-controls {
    position: relative;
    z-index: 5;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.showcase-chevron {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.showcase-chevron:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.65);
    transform: translateY(-50%) scale(1.05);
}

.showcase-chevron-prev {
    left: 16px;
}

.showcase-chevron-next {
    right: 16px;
}

.carousel-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    padding: 6px 12px;
    border-radius: 999px;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: var(--transition);
}

.dot.active {
    width: 18px;
    border-radius: 999px;
    background: #ffffff;
}

/* 8 & 9. Bottom Split Row in Center Column */
.center-bottom-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.card-contact {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 18px;
}

.btn-whatsapp-pill {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-pill);
    padding: 12px 22px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.95rem;
    transition: var(--transition);
    cursor: pointer;
}

.btn-whatsapp-pill:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.03);
}

.whatsapp-icon {
    width: 22px;
    height: 22px;
    fill: #25D366;
}

/* Hero Snippet Card */
.card-hero-snippet {
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
}

.snippet-preview-box {
    width: 100%;
    height: 90px;
    border-radius: 14px;
    overflow: hidden;
    background: #000000;
    position: relative;
    border: 1px solid var(--card-border);
}

.snippet-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================================
   DESKTOP BENTO CARDS (Right Column)
   ========================================================================== */

/* 10. Map Card */
.card-map {
    padding: 0;
    height: 210px;
    border-radius: var(--radius-card);
    overflow: hidden;
    position: relative;
}

.map-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.map-overlay-pin {
    position: absolute;
    top: 45%;
    left: 55%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.3), 0 0 15px #38bdf8;
}

/* 11. Location Label Card */
.card-location {
    text-align: center;
    padding: 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.location-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.location-main {
    font-size: 1.45rem;
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: -0.01em;
}

/* 12. Photos Row Card */
.card-photos-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.photo-card {
    border-radius: 22px;
    height: 220px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    transition: var(--transition);
}

.photo-card:hover {
    transform: scale(1.02);
}

.photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 13. Theme Toggle Card */
.card-theme-toggle {
    padding: 6px;
    border-radius: var(--radius-pill);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
}

.theme-toggle-bar {
    width: 100%;
    display: flex;
    align-items: center;
}

.theme-btn {
    flex: 1;
    height: 44px;
    border-radius: var(--radius-pill);
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.theme-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-blue);
}

[data-theme="light"] .theme-btn.active {
    background: rgba(0, 0, 0, 0.08);
    color: var(--accent-blue);
}

.theme-btn svg {
    width: 20px;
    height: 20px;
}

/* ==========================================================================
   MOBILE MEMOJI HERO CARD (Shown on Mobile View)
   ========================================================================== */
.card-memoji-hero {
    display: none; /* Hidden on Desktop, Visible on Mobile */
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 36px 24px 28px;
    gap: 16px;
}

.memoji-avatar-ring {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0) 70%);
}

.memoji-avatar-img {
    width: 90px;
    height: 90px;
    object-fit: contain;
}

.memoji-title {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.memoji-subtitle {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-primary);
}

.memoji-dots {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

/* ==========================================================================
   RESPONSIVE LAYOUT BREAKPOINTS (Mobile Stack img2 View)
   ========================================================================== */

@media (max-width: 960px) {
    body {
        padding: 16px;
    }

    .bento-container {
        display: flex;
        flex-direction: column;
        max-width: 500px;
        gap: 16px;
    }

    .bento-col {
        width: 100%;
        gap: 16px;
    }

    /* Show Mobile Memoji Hero Card at the very top */
    .card-memoji-hero {
        display: flex;
    }

    /* Adjust Column Order to match img2 Mobile sequence */
    .col-center {
        order: 1;
    }
    
    .col-left {
        order: 2;
    }

    .col-right {
        order: 3;
    }

    /* Hide Desktop Hero Showcase & Hero Snippet on Mobile */
    .card-showcase,
    .card-hero-snippet,
    .card-map {
        display: none;
    }

    .center-bottom-row {
        grid-template-columns: 1fr;
    }

    .card-banner {
        padding: 18px 20px;
    }

    .banner-text {
        font-size: 0.98rem;
    }

    .freelance-title {
        font-size: 1.35rem;
    }

    /* Explore More Projects carousel needs an explicit height on mobile —
       the desktop flex:1 stretch trick has nothing to stretch against here. */
    .card-explore-projects {
        height: auto;
    }

    .explore-scroll-wrapper {
        height: 170px;
        min-height: 170px;
    }

    .explore-item {
        height: 170px;
        min-height: 170px;
        width: 150px;
    }
}
