:root {
    /* Color Palette - Deep Navy & Gold */
    --bg-color: #0a192f;
    --text-color: #e6f1ff;
    --text-secondary: #8892b0;
    --primary-color: #64ffda;
    --accent-gold: #d4af37;
    --secondary-bg: #112240;
    --nav-bg: rgba(10, 25, 47, 0.85);

    /* Typography */
    --font-main: 'Outfit', sans-serif;

    /* Spacing */
    --section-padding: 100px 0;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    /* Restored for safety */
    color: var(--text-color);
    line-height: 1.6;
    position: relative;
    width: 100%;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 25px;
}

/* Header & Nav */
header {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: var(--nav-bg);
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 20px 0;
    box-shadow: 0 10px 30px -10px rgba(2, 12, 27, 0.7);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 25px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: 1px;
    transition: var(--transition);
}

.logo:hover {
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    font-size: 0.9rem;
    font-weight: 400;
}

.nav-links a:hover {
    color: var(--accent-gold);
}

/* Sections */
section {
    padding: var(--section-padding);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

h1,
h2,
h3 {
    margin-bottom: 20px;
    color: var(--text-color);
    font-weight: 600;
}

h2 {
    font-size: 2rem;
    position: relative;
    display: inline-block;
    margin-bottom: 40px;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60px;
    height: 2px;
    background-color: var(--accent-gold);
}

/* Hero Specifics */
#hero {
    padding-top: 140px;
    align-items: flex-start;
    padding-left: 0;
    position: relative;
    overflow: hidden;
    /* Restored */
}

#hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(rgba(10, 25, 47, 0.85), rgba(10, 25, 47, 0.7)), url('images/hero_background.webp');
    background-size: cover;
    background-position: center;
    z-index: -1;
    animation: kenburns 30s ease-in-out infinite alternate;
    transform: translateZ(0);
    /* Keep GPU fix */
}

/* Smooth Background Movement */
@keyframes kenburns {
    0% {
        transform: scale(1) translate(0, 0);
    }

    50% {
        transform: scale(1.1) translate(-2%, 1%);
    }

    100% {
        transform: scale(1) translate(2%, -1%);
    }
}

@media (max-width: 768px) {
    #hero::before {
        /* On mobile, simplified background logic to prevent jitter */
        background-attachment: scroll;
        background-size: auto 100vh;
        /* Still allow animation if performance permits, or disable if requested */
    }
}


@media (min-width: 992px) {
    #hero {
        padding-left: 50px;
        padding-right: 50px;
        /* Match left padding */
    }

    .hero-accordion {
        max-width: 800px;
        /* Constrain width to make buttons narrower */
    }
}

#hero .container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.hero-content h1 {
    font-size: clamp(40px, 8vw, 80px);
    line-height: 1.1;
    margin-bottom: 30px;
}

.highlight {
    color: var(--accent-gold);
}

.cta-button {
    display: inline-block;
    margin-top: 30px;
    padding: 18px 28px;
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
    font-weight: 400;
    border-radius: 4px;
    font-size: 1rem;
}

.cta-button:hover {
    background-color: rgba(212, 175, 55, 0.1);
}

/* Split Layout for Images */
.content-split {
    display: flex;
    align-items: center;
    gap: 50px;
    margin-bottom: 40px;
}

.content-split .text {
    flex: 1;
}

.content-split .image {
    flex: 1;
}

.content-split img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 10px 30px -15px rgba(2, 12, 27, 0.7);
    border: 1px solid rgba(212, 175, 55, 0.2);
}

/* Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.service-card {
    background-color: var(--secondary-bg);
    padding: 2rem;
    border-radius: 4px;
    transition: var(--transition);
    box-shadow: 0 10px 30px -15px rgba(2, 12, 27, 0.7);
}

.service-card:hover,
.service-card.scroll-active {
    transform: translateY(-7px);
}

/* Tool Icons on Hover */
.service-card {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.service-card::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 80px;
    height: 80px;
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0;
    transition: all 0.4s ease;
    z-index: -1;
    transform: rotate(15deg) scale(0.8);
}

.service-card:hover::after,
.service-card.scroll-active::after {
    opacity: 0.15;
    transform: rotate(0) scale(1);
    bottom: 10px;
    right: 10px;
}

.service-card[data-tool="platform"]::after {
    background-image: url('images/tool_platform.svg');
}

.service-card[data-tool="modeling"]::after {
    background-image: url('images/tool_modeling.svg');
}

.service-card[data-tool="scripting"]::after {
    background-image: url('images/tool_scripting.svg');
}

.service-card[data-tool="integration"]::after {
    background-image: url('images/tool_integration.svg');
}

.service-card[data-tool="cloud"]::after {
    background-image: url('images/tool_cloud.svg');
}

.service-card[data-tool="database"]::after {
    background-image: url('images/tool_database.svg');
}

.service-card[data-tool="strategy"]::after {
    background-image: url('images/icon_strategy.svg');
}

.service-card[data-tool="analytics"]::after {
    background-image: url('images/icon_analytics.svg');
}

.service-card h3 {
    color: var(--text-color);
    font-size: 1.4rem;
    margin-bottom: 15px;
}

/* Experience Timeline (Simplified) */
.timeline-item {
    border-left: 2px solid var(--accent-gold);
    padding-left: 20px;
    margin-bottom: 30px;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--bg-color);
    border: 2px solid var(--accent-gold);
}

.timeline-item h3 {
    margin-bottom: 5px;
    font-size: 1.3rem;
}

.timeline-item .date {
    display: block;
    font-family: monospace;
    color: var(--accent-gold);
    margin-bottom: 15px;
    font-size: 0.9rem;
}

/* Contact */
.email-link {
    font-size: clamp(20px, 5vw, 40px);
    font-weight: 600;
    color: var(--text-color);
}

.email-link:hover {
    color: var(--accent-gold);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    background-color: var(--bg-color);
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 50px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    /* Subtle separator */
}

.footer-legal p {
    margin: 10px 0;
    font-size: 0.85rem;
    opacity: 0.8;
}

.footer-legal a {
    color: var(--text-secondary);
    text-decoration: none;
    margin: 0 5px;
    transition: var(--transition);
}

.footer-legal a:hover {
    color: var(--accent-gold);
    text-decoration: underline;
}

/* Animations */
.fade-in-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, visibility;
}

.fade-in-section.visible {
    opacity: 1;
    transform: none;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        /* Simple hide for now, would need a hamburger menu for full mobile support */
    }

    h2 {
        font-size: 1.8rem;
    }

    .content-split {
        flex-direction: column;
        gap: 30px;
    }

    .content-split .image {
        order: -1;
        /* Image on top on mobile */
    }
}

/* Contact Section Styles - Business Card */
.contact-details {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 2rem;
}

.business-card {
    background: rgba(17, 34, 64, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent-gold);
    padding: 2.5rem;
    border-radius: 4px;
    text-align: center;
    box-shadow: 0 20px 50px -20px rgba(2, 12, 27, 0.7);
    max-width: 450px;
    width: 100%;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.business-card:hover,
.business-card.scroll-active {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px -30px rgba(2, 12, 27, 0.9);
}

.business-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent-gold);
    z-index: 2;
}

.business-card::after {
    content: '';
    position: absolute;
    bottom: -30px;
    right: -30px;
    width: 180px;
    height: 180px;
    background-image: url('images/favicon.svg');
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.03;
    transform: rotate(-15deg);
    transition: all 0.5s ease;
    z-index: 0;
    pointer-events: none;
}

.business-card:hover::after,
.business-card.scroll-active::after {
    opacity: 0.08;
    transform: rotate(0deg) scale(1.1);
}

.business-card>* {
    position: relative;
    z-index: 2;
}

.card-company {
    font-size: 2rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.card-roles {
    color: var(--accent-gold);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.card-divider {
    border: 0;
    height: 1px;
    background: rgba(212, 175, 55, 0.3);
    margin: 1.5rem auto;
    width: 60%;
}

.card-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0.8rem 0;
    transition: var(--transition);
}

.card-link span {
    color: var(--accent-gold);
    font-size: 1.2rem;
}

.card-link:hover {
    color: var(--text-color);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.mobile-menu-btn span {
    width: 30px;
    height: 3px;
    background: var(--accent-gold);
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

/* Scroll to Top Button */
#scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--accent-gold);
    color: var(--bg-color);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
    z-index: 999;
}

#scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
}

#scroll-top-btn:hover {
    transform: translateY(-5px);
    background-color: #f0c43f;
}

/* Footer Updates */
.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.footer-links {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 10px;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--accent-gold);
}

.separator {
    color: var(--text-secondary);
}

/* Responsive Updates - Mobile Menu */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .nav-links {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 70%;
        background-color: var(--secondary-bg);
        padding-top: 80px;
        transition: right 0.3s ease-in-out;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
    }

    .nav-links.active {
        right: 0;
        display: flex;
        /* Ensure it's displayed when active */
    }

    .nav-links li {
        margin: 20px 0;
        text-align: center;
    }

    /* Hamburger Animation */
    .mobile-menu-btn.open span:nth-child(1) {
        transform: rotate(45deg);
    }

    .mobile-menu-btn.open span:nth-child(2) {
        opacity: 0;
        transform: translateX(20px);
    }

    .mobile-menu-btn.open span:nth-child(3) {
        transform: rotate(-45deg);
    }
}

/* Hero Tags (Floating Expertise) */
.hero-tags {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 4rem;
    padding-bottom: 2rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 10;
}

.tag-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(17, 34, 64, 0.85);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 10px 30px -10px rgba(2, 12, 27, 0.7);
    transition: var(--transition);
    cursor: default;
}

.tag-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-gold);
    box-shadow: 0 20px 30px -15px rgba(2, 12, 27, 0.7);
    background: rgba(17, 34, 64, 0.95);
}




.tag-card img {
    width: 40px;
    height: 40px;
}

.tag-card span {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .nav-links {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 70%;
        background-color: var(--secondary-bg);
        padding-top: 80px;
        transition: right 0.3s ease-in-out;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
    }

    .nav-links.active {
        right: 0;
        display: flex;
    }

    .nav-links li {
        margin: 20px 0;
        text-align: center;
    }

    .mobile-menu-btn {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 30px;
        height: 25px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 1001;
    }

    .mobile-menu-btn span {
        width: 30px;
        height: 3px;
        background: var(--accent-gold);
        border-radius: 10px;
        transition: all 0.3s linear;
        position: relative;
        transform-origin: 1px;
    }

    .mobile-menu-btn.open span:nth-child(1) {
        transform: rotate(45deg);
    }

    .mobile-menu-btn.open span:nth-child(2) {
        opacity: 0;
        transform: translateX(20px);
    }

    .mobile-menu-btn.open span:nth-child(3) {
        transform: rotate(-45deg);
    }

    h2 {
        font-size: 1.8rem;
    }

    .content-split {
        flex-direction: column;
        gap: 30px;
    }

    .content-split .image {
        order: -1;
    }

    .hero-tags {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        margin-top: 2rem;
    }

    .tag-card {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }

    #hero {
        padding-top: 120px;
        padding-left: 0 !important;
        align-items: center;
        /* Center align on mobile looks better usually */
        text-align: center;
    }

    #hero .container {
        align-items: center;
        justify-content: center;
    }

    .hero-content h1 {
        font-size: 2.5rem;
        /* Slightly smaller font for mobile readability */
    }
}

/* Alternating Section Backgrounds */
#services {
    background-image: linear-gradient(rgba(10, 25, 47, 0.5), rgba(10, 25, 47, 0.45)), url('images/bg_services.svg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
}

#experience {
    background-image: linear-gradient(rgba(10, 25, 47, 0.5), rgba(10, 25, 47, 0.45)), url('images/bg_experience.svg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
    padding-bottom: 50px;
}

#contact {
    background-image: linear-gradient(rgba(10, 25, 47, 0.5), rgba(10, 25, 47, 0.45)), url('images/bg_contact.svg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
}

/* Client Logo Slider */
#clients {
    padding: 60px 0;
    min-height: auto;
    background-color: var(--secondary-bg);
    overflow: hidden;
}

#clients h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 1.8rem;
    color: var(--text-secondary);
}

#clients h2::after {
    left: 50%;
    transform: translateX(-50%);
}

.slider {
    height: 100px;
    margin: auto;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.slider::before,
.slider::after {
    background: linear-gradient(to right, var(--secondary-bg) 0%, rgba(17, 34, 64, 0) 100%);
    content: "";
    height: 100px;
    position: absolute;
    width: 100px;
    z-index: 2;
}

.slider::after {
    right: 0;
    top: 0;
    transform: rotateZ(180deg);
}

.slider::before {
    left: 0;
    top: 0;
}

.slide-track {
    animation: scroll 30s linear infinite;
    display: flex;
    width: calc(200px * 16);
}

.slide {
    height: 80px;
    width: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
}

.slide img {
    max-width: 100%;
    max-height: 60px;
    filter: grayscale(1) opacity(0.5);
    transition: var(--transition);
}

.slide img:hover {
    filter: grayscale(0) opacity(1);
    transform: scale(1.1);
}


@keyframes scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(calc(-200px * 8));
    }
}

/* Hero Accordion */
.hero-accordion {
    display: flex;
    gap: 15px;
    width: 100%;
    margin-top: 50px;
    min-height: 140px;
    /* Base height for small buttons */
    align-items: flex-start;
    /* Allows items to expand independently */
}

.accordion-item {
    flex: 1;
    background: rgba(17, 34, 64, 0.5);
    /* 50% opacity as requested */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    /* Closing Transition: Delay shrinking properties by 0.15s to allow content fade-out completely */
    /* Update desktop shrink delay to 0.2s to match new safe timing */
    transition: flex 0.3s ease-out 0.2s, min-height 0.3s ease-out 0.2s, padding 0.3s ease 0.2s, background-color 0.3s ease;

    /* Smoother specific transitions */
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    /* Prevent layout jump on close */
    min-height: 140px;
    /* Default small button height */
}

.accordion-item:hover {
    background: var(--secondary-bg);
    border-color: var(--accent-gold);
}

.accordion-item.active {
    flex: 3;
    /* Expands to take more width */
    background: var(--secondary-bg);
    border-color: var(--accent-gold);
    /* Align items inherited from base (flex-start) */
    cursor: pointer;
    /* Keep pointer to indicate "click to close" */
    min-height: 380px;
    /* Reduced active height */
    /* Opening Transition: Immediate expansion (0s delay) */
    transition: flex 0.3s ease-out 0s, min-height 0.3s ease-out 0s, padding 0.3s ease 0s, background-color 0.3s ease;
}

.accordion-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    /* Closing Transition: Delay margin/padding changes by 0.15s */
    transition: all 0.3s ease 0.15s;
    margin-top: 10px;
    /* Stable top spacing */
}

/* Keep header layout stable (column) even when active */
.accordion-item.active .accordion-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    /* Opening Transition: Instant (0s) */
    transition: all 0.3s ease 0s;
}

.accordion-header img {
    width: 50px;
    height: 50px;
    margin-bottom: 15px;
    /* Closing Transition: Delay size change by 0.15s */
    transition: all 0.3s ease 0.15s;
}

.accordion-item.active .accordion-header img {
    /* Keep icon size stable or slightly smaller, but no huge shifts */
    width: 50px;
    height: 50px;
    margin-bottom: 15px;
    /* Opening Transition: Instant */
    transition: all 0.3s ease 0s;
}

.accordion-header h3 {
    color: var(--accent-gold);
    font-size: 1.1rem;
    margin: 0;
    text-align: center;
    white-space: nowrap;
    /* Closing Transition: Delay font-size snap by 0.15s */
    transition: font-size 0.3s ease 0.15s;
}

.accordion-item.active .accordion-header h3 {
    font-size: 1.4rem;
    /* Opening Transition: Instant */
    transition: font-size 0.3s ease 0s;
}

.accordion-content {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    /* Closing Transition: Fade out FAST (0.05s), THEN Shrink (starts after 0.2s) */
    /* Added visibility transition to ensure paint removal */
    transition: opacity 0.05s ease 0s, visibility 0s linear 0.1s, max-height 0.3s ease-out 0.2s;
    /* Animate height smoothly */
    width: 100%;
    text-align: left;
    will-change: max-height, opacity;
    transform: translateZ(0);
    /* Avoid sub-pixel jitter */
}

.accordion-item.active .accordion-content {
    opacity: 1;
    max-height: 400px;
    /* Reduced max height */
    /* Opening Transition: Grow FAST (0s delay), THEN Fade in (0.3s delay) */
    transition: max-height 0.5s ease-out 0s, opacity 0.4s ease 0.3s, visibility 0s linear 0s;

    overflow: visible;
}


.accordion-content p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 20px;
    color: var(--text-color);
}

.why-me {
    background: rgba(212, 175, 55, 0.05);
    border-left: 3px solid var(--accent-gold);
    padding: 15px;
    border-radius: 4px;
    transition: all 0.3s ease;
    cursor: pointer;
    /* Explicit pointer for the link action */
}

.why-me:hover {
    background: rgba(212, 175, 55, 0.15);
    /* Highlight on hover */
    transform: translateX(5px);
    /* Subtle visual feedback */
}

.why-me strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.why-me p {
    margin-bottom: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Mobile Responsiveness for Accordion */
@media (max-width: 768px) {
    .hero-accordion {
        flex-direction: column;
        /* Stack vertically */
        height: auto;
        /* Height adapts to content */
        opacity: 1 !important;
        /* Force visibility on mobile to prevent Android glitches */
        visibility: visible !important;
    }

    /* Fix Background Movement: Detach from flow on mobile */
    #hero::before {
        position: fixed;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        bottom: 0;
        /* Anchor bottom */
        z-index: -1;
    }

    .accordion-item {
        width: 100%;
        flex: none;
        height: auto;
        /* Allow auto height always */
        min-height: 60px;
        /* Compact floor */
        flex-direction: column;
        /* ALWAYS COLUMN */
        justify-content: flex-start;
        align-items: flex-start;
        padding: 22px 20px 8px 20px;
        /* Stronger bias (22px top) for final optical centering */
        position: relative;
        z-index: 10;
        pointer-events: auto;
        -webkit-tap-highlight-color: transparent;
        /* Container follows content size change after delay matches content delay */
        transition: background-color 0.3s ease;
    }

    .accordion-item.active {
        flex: none;
        height: auto;
        min-height: 60px;
        /* Match collapsed */
        padding: 22px 20px 20px 20px;
        /* Restore bottom breathing room when open */
        align-items: flex-start;
        z-index: 20;
        /* No min-height transition needed on mobile if content drives it */
        transition: background-color 0.3s ease;
    }

    .accordion-header {
        position: relative;
        /* Back in flow */
        width: 100%;
        margin: 0;
        flex-direction: row;
        gap: 15px;
        justify-content: flex-start;
        align-items: center;
        /* Ensure icon and text are vertically aligned */
        pointer-events: none;
        /* Clicks pass through */
    }

    /* Remove spacer since header is in flow */
    .accordion-content {
        margin-top: 15px;
        /* Small gap between header and text */
        width: 100%;
    }

    .accordion-header img {
        width: 30px;
        height: 30px;
        margin-bottom: 0;
    }

    .accordion-header h3 {
        font-size: 1.1rem;
        text-align: left;
    }

    /* Remove interfering active margin logic since header is absolute */
    .accordion-item.active .accordion-header {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }
}