/* ===========================
   CSS Variables & Theme Setup
   =========================== */
:root {
    --bg-dark: #1A1A2E;
    --tile-dark: #2C2C40;
    --accent-cyan: #00FFFF;
    --text-primary-dark: #FFFFFF;
    --text-secondary-dark: #94A3B8;
    --bg-light: #afb4bb;
    --tile-light: #ffffff;
    --accent-light: #0D9488;
    --text-primary-light: #0F172A;
    --text-secondary-light: #64748B;

    /* Chart Colors - Dark */
    --chart-d-1: #00FFFF;
    /* Cyan */
    --chart-d-2: #D946EF;
    /* Fuchsia */
    --chart-d-3: #22D3EE;
    /* Sky Blue */

    /* Chart Colors - Light */
    --chart-l-1: #0D9488;
    /* Teal */
    --chart-l-2: #6366F1;
    /* Indigo */
    --chart-l-3: #3B82F6;
    /* Blue */
}

/* ===========================
   Base Styles
   =========================== */
body {
    font-family: 'Inter', sans-serif;
    transition: background-color 0.5s ease, color 0.5s ease;
}

.theme-dark {
    background-color: var(--bg-dark);
    color: var(--text-primary-dark);
    --accent-primary: var(--accent-cyan);
    --accent-primary-rgb: 0, 255, 255;
    --btn-text-color: var(--bg-dark);
    /* Dark text for Cyan bg */
    --chart-p1: var(--chart-d-1);
    --chart-p2: var(--chart-d-2);
    --chart-p3: var(--chart-d-3);
}

.theme-light {
    background-color: var(--bg-light);
    color: var(--text-primary-light);
    --accent-primary: var(--accent-light);
    --accent-primary-rgb: 13, 148, 136;
    --btn-text-color: var(--text-primary-dark);
    /* Page BG color for Teal bg */
    --chart-p1: var(--chart-l-1);
    --chart-p2: var(--chart-l-2);
    --chart-p3: var(--chart-l-3);
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

/* ===========================
   Spotlight Effect
   =========================== */
.spotlight {
    position: fixed;
    width: 450px;
    height: 450px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    will-change: transform;
    filter: blur(40px);
}

.theme-dark .spotlight {
    background: radial-gradient(circle,
            rgba(var(--accent-primary-rgb), 0.35) 0%,
            rgba(var(--accent-primary-rgb), 0.25) 25%,
            rgba(var(--accent-primary-rgb), 0.15) 50%,
            rgba(var(--accent-primary-rgb), 0.05) 70%,
            transparent 100%);
}

.theme-light .spotlight {
    background: radial-gradient(circle,
            rgba(var(--accent-primary-rgb), 0.3) 0%,
            rgba(var(--accent-primary-rgb), 0.2) 25%,
            rgba(var(--accent-primary-rgb), 0.1) 50%,
            rgba(var(--accent-primary-rgb), 0.03) 70%,
            transparent 100%);
}

.spotlight.active {
    opacity: 1;
}

/* ===========================
   Drag and Drop Styles
   =========================== */

/* Ghost element - shows where card will be dropped */
.tile-ghost {
    opacity: 0.3 !important;
    border: 2px dashed var(--accent-primary) !important;
}

/* Chosen element - card being selected for drag */
.tile-chosen {
    cursor: grabbing !important;
}

/* Dragging state - the card while being dragged */
.tile-dragging {
    opacity: 0.8 !important;
    transform: rotate(2deg) !important;
    z-index: 1000 !important;
}

.theme-dark .tile-dragging {
    box-shadow: 0 25px 50px -12px rgba(var(--accent-primary-rgb), 0.3) !important;
}

.theme-light .tile-dragging {
    box-shadow: 0 25px 50px -12px rgba(var(--accent-primary-rgb), 0.3) !important;
}

/* Fallback for browsers without native drag support */
.tile-fallback {
    opacity: 0.8;
}

/* Add grab cursor to tiles on desktop ONLY when enabled */
@media (min-width: 640px) {
    .bento-grid.drag-enabled .tile {
        cursor: grab;
    }

    .bento-grid.drag-enabled .tile:active {
        cursor: grabbing;
    }
}

/* ===========================
   Bento Grid Layout
   =========================== */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(180px, auto);
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

/* ===========================
   Tile Components
   =========================== */
.tile {
    border-radius: 2rem;
    padding: 2.25rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}

.theme-dark .tile {
    background: var(--tile-dark);
    box-shadow: 0 10px 30px -15px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.05);
}

.theme-light .tile {
    background: var(--tile-light);
    box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.12);
    border-color: rgba(0, 0, 0, 0.08);
}

.theme-dark .tile:hover,
.theme-light .tile:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
}

.theme-dark .tile:hover {
    box-shadow: 0 20px 40px -20px rgba(var(--accent-primary-rgb), 0.15);
}

.theme-light .tile:hover {
    box-shadow: 0 12px 35px -10px rgba(var(--accent-primary-rgb), 0.25);
}

/* Tile Grid Spans */
.tile-hero {
    grid-column: span 3;
    grid-row: span 3;
    min-height: 600px;
}

.tile-skills {
    grid-column: span 1;
    grid-row: span 3;
}

.tile-featured {
    grid-column: span 2;
    grid-row: span 2;
}

/* Remove padding when carousel is inside */
.tile-featured:has(.carousel-container) {
    padding: 0;
}

.carousel-container {
    position: relative;
    height: 100%;
    border-radius: 2rem;
    overflow: hidden;
}

.tile-exp {
    grid-column: span 2;
    grid-row: span 2;
}

.tile-stat {
    grid-column: span 1;
    grid-row: span 1;
}

.tile-contact {
    grid-column: span 2;
    grid-row: span 1;
}

/* ===========================
   Details Overlay
   =========================== */
.details-overlay {
    position: absolute;
    inset: 0;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 2.25rem;
    z-index: 10;
}

.theme-dark .details-overlay {
    background: var(--tile-dark);
}

.theme-light .details-overlay {
    background: var(--tile-light);
}

.tile:hover .details-overlay {
    transform: translateY(0);
}



/* ===========================
   Drag Toggle Button
   =========================== */
#toggle-drag.active {
    background-color: rgba(var(--accent-primary-rgb), 0.1);
    color: var(--text-primary);
    border-color: var(--accent-primary);
    opacity: 1;
    box-shadow: 0 0 15px rgba(var(--accent-primary-rgb), 0.1);
}

#toggle-drag.active #drag-status-dot {
    background-color: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-primary), 0 0 12px var(--accent-primary);
}

/* ===========================
   Side Dock Navigation
   =========================== */
.side-dock {
    position: fixed;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 50;
}

.dock-item {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.theme-dark .dock-item {
    background: rgba(44, 44, 64, 0.8);
    color: var(--text-secondary-dark);
    backdrop-filter: blur(8px);
}

.theme-light .dock-item {
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-secondary-light);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.theme-dark .dock-item:hover,
.theme-light .dock-item:hover {
    background: var(--accent-primary);
    transform: translateX(8px);
}

.theme-dark .dock-item:hover {
    color: #000;
}

.theme-light .dock-item:hover {
    color: #fff;
}

/* ===========================
   Theme Switcher
   =========================== */
.theme-switcher {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.theme-dark .theme-switcher {
    background: var(--tile-dark);
    color: var(--accent-primary);
}

.theme-light .theme-switcher {
    background: #E2E8F0;
    color: var(--text-primary-light);
}

.theme-toggle-light,
.theme-toggle-dark {
    display: none;
}

.theme-dark .theme-toggle-light {
    display: block;
}

.theme-light .theme-toggle-dark {
    display: block;
}

/* ===========================
   UI Components
   =========================== */
.glass-pill {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    backdrop-filter: blur(4px);
}

.theme-dark .glass-pill {
    background: rgba(var(--accent-primary-rgb), 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(var(--accent-primary-rgb), 0.2);
}

.theme-light .glass-pill {
    background: rgba(var(--accent-primary-rgb), 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(var(--accent-primary-rgb), 0.2);
}

/* ===========================
   Skills Groups
   =========================== */
.skills-groups {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.skill-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.skill-title-wrapper {
    overflow: hidden;
    width: 100%;
    position: relative;
    background: var(--accent-primary);
    border-radius: 0.05rem;
    padding: 0rem 1rem;
}

.skill-group-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #0F172A;
    opacity: 1;
    white-space: nowrap;
    display: inline-block;
    animation: scroll-title 5s linear infinite;
    margin: 0;
    will-change: transform;
}

.theme-light .skill-group-title {
    color: #FFFFFF;
}

@keyframes scroll-title {
    from {
        transform: translateX(0%);
    }

    to {
        transform: translateX(-25%);
    }
}

.skill-list {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.8;
    opacity: 0.7;
    font-weight: 500;
}

/* ===========================
   Typewriter Animation
   =========================== */
.typewriter-text {
    opacity: 0;
    /* Hidden initially to prevent flash */
}

/* Blinking dot animation */
.blinking-dot {
    color: var(--accent-primary);
}

.blinking-dot.active {
    animation: blink 0.7s infinite;
}

@keyframes blink {

    0%,
    49% {
        opacity: 1;
    }

    50%,
    100% {
        opacity: 0;
    }
}

/* Typewriter Opacity Animation */
.char-hidden {
    opacity: 0;
}

.char-visible {
    opacity: 1;
    transition: opacity 0.1s ease-out;
}

/* ===========================
   Stat Charts
   =========================== */
.chart-overlay {
    position: absolute;
    inset: 0;
    background: var(--tile-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20;
}

.theme-light .chart-overlay {
    background: var(--tile-light);
}

.tile:hover .chart-overlay {
    transform: translateY(0);
}

.donut-chart {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    position: relative;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.donut-chart::before {
    content: '';
    position: absolute;
    inset: 12px;
    background: var(--tile-dark);
    border-radius: 50%;
    transition: background-color 0.3s;
}

.theme-light .donut-chart::before {
    background: var(--tile-light);
}

.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'JetBrains Mono', monospace;
    opacity: 0.8;
}

.legend-color {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 6px;
}

/* ===========================
   Experience Carousel
   =========================== */
.exp-carousel {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    height: 100%;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
}

.exp-carousel::-webkit-scrollbar {
    display: none;
}

.exp-carousel:active {
    cursor: grabbing;
}

.carousel-track {
    display: flex;
    height: 100%;
    width: 300%;
    /* Ensure track is wide enough for 3 slides */
}

.carousel-slide {
    flex: 0 0 33.333%;
    /* 100% / 3 slides */
    width: 33.333%;
    height: 100%;
    position: relative;
    overflow: hidden;
    scroll-snap-align: start;
}

/* Navigation Buttons - Bootstrap Style (Outside scroll container) */
.carousel-nav {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 30;
    pointer-events: none;
}

.carousel-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.5);
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: auto;
}

.carousel-container:hover .carousel-btn {
    opacity: 1;
}

.carousel-btn:hover {
    background: var(--accent-primary);
    color: #000;
    border-color: var(--accent-primary);
    transform: scale(1.15);
}

.theme-light .carousel-btn {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.1);
}



/* Hide Dots */
.carousel-dots {
    display: none;
}

/* Slide Content */
.slide-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 2.25rem;
    position: relative;
    z-index: 10;
}

/* Slide Overlay (Partial & Peek) */
.slide-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 67%;
    /* Cover more content, leaving only project name visible */
    background: var(--tile-dark);
    /* Peek state: Translate down so only title shows? 
       Actually user said "Key Achievements visible partially". 
       So we peek the top of the overlay. */
    transform: translateY(calc(100% - 60px));
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 25;
    padding: 1.5rem 2.25rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}

.slide-overlay h4 {
    text-align: center;
}

.slide-overlay ul {
    max-width: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.theme-light .slide-overlay {
    background: var(--tile-light);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* On hover, slide up to full height (67%) */
.carousel-slide:hover .slide-overlay {
    transform: translateY(0);
}

/* ===========================
   Responsive Media Queries
   =========================== */

/* Mobile Devices (< 640px) */
@media (max-width: 639px) {

    /* Body Padding */
    body {
        padding: 1rem !important;
    }

    /* Bento Grid - Single Column */
    .bento-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: minmax(150px, auto);
        gap: 1rem;
    }

    /* Reset all tile spans to single column */
    .tile-hero,
    .tile-skills,
    .tile-featured,
    .tile-exp,
    .tile-stat,
    .tile-contact {
        grid-column: span 1;
        grid-row: auto;
        min-height: auto;
    }

    /* Reorder for Mobile: Experience above Skills */
    .tile-hero {
        order: 1;
    }

    .tile-stat {
        order: 2;
    }

    .tile-featured {
        order: 3;
    }

    /* Experience Carousel */
    .tile-skills {
        order: 4;
    }

    .tile-contact {
        order: 5;
    }

    /* Hero Section */
    .tile-hero {
        min-height: auto;
        padding: 1.5rem;
    }

    .tile-hero h1 {
        font-size: 3rem !important;
        line-height: 0.9 !important;
        margin-bottom: 1rem !important;
    }

    .tile-hero p {
        font-size: 0.9rem !important;
        margin-bottom: 0.75rem;
    }

    .tile-hero .mt-12 {
        margin-top: 1rem !important;
        display: flex;
        gap: 0.75rem;
        align-items: center;
    }

    /* Compact Download Button */
    .tile-hero a {
        padding: 0 !important;
        width: 48px;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 12px;
        font-size: 0 !important;
        gap: 0 !important;
    }

    .tile-hero a span {
        font-size: 1.5rem !important;
        margin: 0 !important;
    }

    /* Hero Social Links (Mobile Only) */
    .mobile-social-link {
        width: 48px;
        height: 48px;
        display: flex !important;
        align-items: center;
        justify-content: center;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-secondary-dark);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .theme-light .mobile-social-link {
        background: rgba(0, 0, 0, 0.05);
        color: var(--text-secondary-light);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }

    /* Hide text inside button but keep icon */
    .tile-hero a {
        font-size: 0;
    }

    /* Header */
    header {
        flex-direction: row;
        align-items: center !important;
        justify-content: space-between;
        gap: 1rem;
        margin-bottom: 2rem !important;
        padding: 0 !important;
    }

    header>div:first-child {
        flex: 1;
    }

    header h2 {
        font-size: 1.5rem !important;
    }

    header p {
        font-size: 0.65rem !important;
    }

    header .flex.items-center.gap-4 {
        width: auto;
        justify-content: flex-end;
    }

    /* Hide "Available for hire" on mobile */
    header .hidden.sm\:flex {
        display: none !important;
    }

    /* Tiles - Reduced Padding */
    .tile {
        padding: 1.5rem;
        border-radius: 1.5rem;
    }

    /* Skills Section */
    .tile-skills {
        min-height: auto;
    }

    .skills-groups {
        gap: 1rem;
    }

    .skill-group {
        gap: 0.5rem;
    }

    .skill-group-title {
        font-size: 0.7rem;
    }

    .skill-list {
        font-size: 0.65rem;
        line-height: 1.6;
    }

    /* Stats */
    .tile-stat {
        min-height: 140px;
    }

    .tile-stat span:first-child {
        font-size: 3rem !important;
    }

    .tile-stat .mono {
        font-size: 0.55rem !important;
    }

    /* Carousel */
    .tile-featured {
        min-height: 400px;
    }

    .carousel-container {
        border-radius: 1.5rem;
        min-height: 400px;
    }

    .slide-content {
        padding: 1.5rem;
    }

    .slide-content h3 {
        font-size: 1.5rem !important;
    }

    .slide-content p {
        font-size: 0.8rem !important;
    }

    .slide-overlay {
        padding: 1rem 1.5rem;
        transform: translateY(calc(100% - 50px));
    }

    .slide-overlay h4 {
        font-size: 0.9rem !important;
        margin-bottom: 0.75rem !important;
    }

    .slide-overlay ul {
        gap: 0.5rem;
    }

    .slide-overlay li {
        font-size: 0.7rem !important;
    }

    .carousel-btn {
        width: 40px;
        height: 40px;
    }

    .carousel-nav {
        padding: 0 0.5rem;
    }

    /* Contact Tile */
    .tile-contact {
        flex-direction: row;
        align-items: center !important;
        justify-content: space-between;
        gap: 1rem;
    }

    .tile-contact>div {
        flex: 1;
    }

    .tile-contact h3 {
        font-size: 1.5rem !important;
    }

    .tile-contact p {
        font-size: 0.75rem !important;
    }

    .tile-contact button {
        width: 48px;
        height: 48px;
    }

    /* Footer */
    footer {
        margin-top: 4rem !important;
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
        flex-direction: column;
        gap: 1.5rem !important;
        text-align: center;
    }

    footer .flex.gap-10 {
        gap: 1.5rem !important;
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Spotlight - Smaller for Performance */
    .spotlight {
        width: 300px;
        height: 300px;
        filter: blur(30px);
    }

    /* Chart Overlay */
    .donut-chart {
        width: 60px;
        height: 60px;
    }

    .legend-item {
        font-size: 0.55rem;
    }

    /* Glass Pill */
    .glass-pill {
        padding: 0.4rem 0.8rem;
        font-size: 0.65rem;
    }
}

/* Tablet Devices (640px - 1024px) */
@media (min-width: 640px) and (max-width: 1023px) {

    /* Body Padding */
    body {
        padding: 2rem !important;
    }

    /* Bento Grid - Two Columns */
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: minmax(160px, auto);
        gap: 1.25rem;
    }

    /* Hero Section */
    .tile-hero {
        grid-column: span 2;
        grid-row: span 2;
        min-height: 500px;
        padding: 2rem;
    }

    .tile-hero h1 {
        font-size: 5rem !important;
        line-height: 0.85 !important;
    }

    .tile-hero p {
        font-size: 1.1rem !important;
    }

    .tile-hero a {
        padding: 1.25rem 2.5rem !important;
        font-size: 0.8rem !important;
    }

    /* Header */
    header {
        margin-bottom: 3rem !important;
        padding: 0 0.5rem !important;
    }

    header h2 {
        font-size: 2rem !important;
    }

    /* Skills Section */
    .tile-skills {
        grid-column: span 2;
        grid-row: span 1;
    }

    .skills-groups {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    /* Featured Carousel */
    .tile-featured {
        grid-column: span 2;
        grid-row: span 2;
    }

    /* Stats - Single Column Each */
    .tile-stat {
        grid-column: span 1;
        grid-row: span 1;
        min-height: 160px;
    }

    /* Contact */
    .tile-contact {
        grid-column: span 2;
        grid-row: span 1;
    }

    /* Tiles */
    .tile {
        padding: 2rem;
        border-radius: 1.75rem;
    }

    /* Carousel */
    .slide-content h3 {
        font-size: 2rem !important;
    }

    .carousel-btn {
        width: 44px;
        height: 44px;
    }

    /* Footer */
    footer {
        margin-top: 6rem !important;
        gap: 2rem !important;
    }

    /* Spotlight */
    .spotlight {
        width: 400px;
        height: 400px;
    }
}

/* Desktop Optimizations (> 1024px) */
@media (min-width: 1024px) {

    /* Ensure proper grid on desktop */
    .bento-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Hide mobile download button on desktop */
    body>button.lg\:hidden {
        display: none;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {

    /* Increase touch targets */
    .carousel-btn,
    .theme-switcher,
    .dock-item {
        min-width: 44px;
        min-height: 44px;
    }

    /* Always show carousel buttons on touch devices */
    .carousel-btn {
        opacity: 1;
    }

    /* Disable hover effects on touch devices */
    .tile:hover {
        transform: none;
    }

    /* Show overlay on tap instead of hover */
    .carousel-slide:active .slide-overlay {
        transform: translateY(0);
    }

    .tile:active .chart-overlay {
        transform: translateY(0);
    }
}

/* Landscape Orientation Adjustments for Mobile */
@media (max-width: 896px) and (orientation: landscape) {
    .tile-hero {
        min-height: 400px;
    }

    .tile-hero h1 {
        font-size: 2.5rem !important;
    }

    .bento-grid {
        grid-auto-rows: minmax(120px, auto);
    }
}

/* High Resolution Displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    /* Optimize for retina displays */
    .tile {
        border-width: 0.5px;
    }
}