/* ============================================
   OPTIMA INGÉNIERIE - Responsive Stylesheet
   Tablet & Mobile breakpoints
   ============================================ */

/* ---------- TABLET (max 1024px) ---------- */
@media (max-width: 1024px) {
    .header__container {
        height: 64px;
    }

    .header__nav-link {
        font-size: 13px;
        padding: 8px 12px;
    }

    .header__cta {
        font-size: 12px;
        padding: 8px 16px;
    }

    /* Hero */
    .hero {
        margin-top: 64px;
        height: calc(100vh - 64px);
    }

    .hero__left {
        flex: 0 0 55%;
        padding: 60px 40px 60px 5%;
    }

    .hero__right {
        flex: 0 0 45%;
    }

    .hero__title {
        font-size: clamp(20px, 2.5vw, 32px);
    }

    .hero__subtitle {
        font-size: 16px;
    }

    .hero__cta {
        font-size: 12px;
        padding: 13px 24px;
    }

    .expertise__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .expertise__grid--5 {
        grid-template-columns: repeat(3, 1fr);
    }

    .services__container--2cols {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer__container {
        gap: 32px;
    }
}

/* ---------- TABLET PORTRAIT (max 768px) ---------- */
@media (max-width: 768px) {
    /* ---------- Header ---------- */
    .header__container {
        height: 60px;
        padding: 0 20px;
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }

    .header__logo-img {
        height: 40px;
    }

    /* ---------- Mobile Nav Drawer ---------- */
    .header__nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 86%;
        max-width: 340px;
        height: 100dvh;
        min-height: 100vh;
        background: linear-gradient(160deg, #042d37 0%, #021c24 100%);
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        padding: 92px 28px 40px;
        padding-top: max(92px, env(safe-area-inset-top) + 76px);
        padding-bottom: max(40px, env(safe-area-inset-bottom) + 24px);
        transition: right 0.45s cubic-bezier(0.22, 1, 0.36, 1);
        box-shadow: -12px 0 40px rgba(0, 0, 0, 0.35);
        z-index: 999;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .header__nav::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 3px;
        background: linear-gradient(to right, transparent, var(--green), transparent);
        opacity: 0.8;
    }

    .header__nav.open {
        right: 0;
    }

    .header__nav-list {
        flex-direction: column;
        gap: 2px;
        width: 100%;
    }

    .header__nav-list li {
        opacity: 0;
        transform: translateX(20px);
        transition: opacity 0.4s ease, transform 0.4s ease;
    }

    .header__nav.open .header__nav-list li {
        opacity: 1;
        transform: translateX(0);
    }

    .header__nav.open .header__nav-list li:nth-child(1) { transition-delay: 0.12s; }
    .header__nav.open .header__nav-list li:nth-child(2) { transition-delay: 0.18s; }
    .header__nav.open .header__nav-list li:nth-child(3) { transition-delay: 0.24s; }
    .header__nav.open .header__nav-list li:nth-child(4) { transition-delay: 0.30s; }
    .header__nav.open .header__nav-list li:nth-child(5) { transition-delay: 0.36s; }

    .header__nav-link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 15px;
        font-weight: 500;
        letter-spacing: 0.8px;
        padding: 16px 18px;
        border-radius: var(--radius-sm);
        width: 100%;
        color: rgba(255, 255, 255, 0.82);
        border-left: 2px solid transparent;
        transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, padding-left 0.25s ease;
    }

    .header__nav-link::after {
        content: '›';
        font-size: 20px;
        color: rgba(255, 255, 255, 0.25);
        transition: transform 0.25s ease, color 0.25s ease;
    }

    .header__nav-link:hover,
    .header__nav-link.active {
        background: rgba(100, 148, 67, 0.12);
        color: var(--white);
        border-left-color: var(--green);
        padding-left: 22px;
    }

    .header__nav-link:hover::after,
    .header__nav-link.active::after {
        color: var(--green);
        transform: translateX(4px);
    }

    .header__cta {
        display: none;
    }

    .header__burger {
        display: flex;
    }

    /* Overlay */
    .mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(2, 18, 24, 0.6);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.35s ease, visibility 0.35s ease;
    }

    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* ---------- Hero ---------- */
    .hero {
        flex-direction: column-reverse;
        min-height: auto;
        height: auto;
        max-height: none;
        margin-top: 60px;
    }

    .hero__left {
        flex: none;
        width: 100%;
        padding: 48px 24px 56px;
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
        text-align: center;
    }

    .hero__left::after {
        display: none;
    }

    .hero__left::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 56px;
        height: 3px;
        background: var(--green);
        border-radius: 0 0 3px 3px;
    }

    .hero__content {
        max-width: 100%;
        margin: 0 auto;
    }

    .hero__title {
        font-size: clamp(22px, 5.5vw, 32px);
        line-height: 1.25;
        letter-spacing: 0.8px;
    }

    .hero__subtitle {
        font-size: 15px;
        margin-bottom: 32px;
        max-width: 440px;
        margin-left: auto;
        margin-right: auto;
    }

    .hero__actions {
        justify-content: center;
        gap: 12px;
    }

    .hero__cta {
        font-size: 13px;
        padding: 15px 30px;
        min-height: 48px;
    }

    .hero__right {
        flex: none;
        width: 100%;
        height: 60vw;
        min-height: 280px;
        max-height: 360px;
        position: relative;
    }

    .hero__right-overlay {
        background: linear-gradient(to top,
            var(--blue-dark) 0%,
            rgba(4, 45, 55, 0.45) 35%,
            rgba(4, 45, 55, 0.1) 75%,
            transparent 100%);
    }

    /* ---------- Services ---------- */
    .services {
        padding: 64px 0 72px;
    }

    .services__container {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 520px;
        padding: 0 20px;
    }

    .services__card {
        padding: 36px 28px;
        border-radius: var(--radius-md);
    }

    .services__icon {
        width: 72px;
        height: 72px;
        margin-bottom: 20px;
    }

    .services__container--2cols {
        grid-template-columns: 1fr;
        max-width: 520px;
    }

    /* ---------- About ---------- */
    .about {
        padding: 72px 0;
    }

    .about__container {
        padding: 0 24px;
    }

    .about__title {
        font-size: clamp(22px, 5.5vw, 28px);
    }

    .about__text {
        font-size: 15.5px;
        line-height: 1.75;
    }

    .about__cta {
        min-height: 48px;
        padding: 14px 30px;
    }

    /* ---------- Expertise ---------- */
    .expertise {
        padding: 72px 0;
    }

    .expertise__header {
        gap: 14px;
        margin-bottom: 40px;
    }

    .expertise__line {
        max-width: 48px;
    }

    .expertise__title {
        font-size: 17px;
        white-space: normal;
        text-align: center;
        letter-spacing: 1px;
    }

    .expertise__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .expertise__grid--5 {
        grid-template-columns: repeat(2, 1fr);
    }

    .expertise__card-image {
        height: 140px;
    }

    .expertise__card-label {
        font-size: 11px;
        padding: 12px 8px;
        letter-spacing: 1px;
        line-height: 1.3;
    }

    .expertise__cta-wrap {
        margin-top: 36px;
    }

    .expertise__cta {
        min-height: 48px;
        padding: 15px 34px;
    }

    /* ---------- Réalisations ---------- */
    .realisations {
        padding: 72px 0;
    }

    .realisations__subtitle {
        font-size: 15px;
        margin-bottom: 36px;
    }

    .realisations__grid {
        grid-template-columns: 1fr;
        gap: 22px;
        max-width: 500px;
        margin-left: auto;
        margin-right: auto;
    }

    .realisations__image {
        height: 220px;
    }

    .realisations__cta {
        min-height: 48px;
        padding: 14px 30px;
    }

    /* ---------- Chiffres ---------- */
    .chiffres {
        padding: 72px 0;
    }

    .chiffres__text {
        font-size: 15.5px;
        margin-bottom: 44px;
    }

    .chiffres__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 28px 20px;
        max-width: 420px;
        margin-left: auto;
        margin-right: auto;
    }

    .chiffres__item:last-child {
        grid-column: 1 / -1;
    }

    .chiffres__number {
        font-size: 36px;
    }

    .chiffres__icon {
        width: 56px;
        height: 56px;
    }

    /* ---------- Contact CTA ---------- */
    .contact-cta {
        padding: 60px 0;
    }

    .contact-cta__title {
        font-size: clamp(22px, 6vw, 28px);
    }

    .contact-cta__btn {
        min-height: 48px;
        padding: 15px 34px;
    }

    /* ---------- Footer ---------- */
    .footer {
        padding: 52px 0 0;
    }

    .footer__container {
        grid-template-columns: 1fr;
        gap: 32px;
        text-align: center;
        padding-bottom: 44px;
    }

    .footer__col--brand {
        justify-content: center;
    }

    .footer__col + .footer__col {
        padding-top: 28px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .footer__col h3 {
        margin-bottom: 18px;
        padding-bottom: 14px;
    }

    .footer__col h3::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .footer__social-icons {
        justify-content: center;
    }

    .footer__bottom {
        padding: 20px 24px calc(20px + env(safe-area-inset-bottom));
    }
}

/* ---------- MOBILE SMALL (max 480px) ---------- */
@media (max-width: 480px) {
    .header__container {
        padding: 0 16px;
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        height: 56px;
    }

    .header__logo-img {
        height: 36px;
    }

    .header__nav {
        width: 100%;
        max-width: none;
        padding: 84px 24px 32px;
        padding-top: max(84px, env(safe-area-inset-top) + 68px);
    }

    /* Hero */
    .hero {
        margin-top: 56px;
    }

    .hero__left {
        padding: 42px 20px 46px;
    }

    .hero__title {
        font-size: 21px;
        line-height: 1.3;
        letter-spacing: 0.5px;
    }

    .hero__subtitle {
        font-size: 14.5px;
        margin-bottom: 26px;
        line-height: 1.65;
    }

    .hero__actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        max-width: 280px;
        margin: 0 auto;
    }

    .hero__cta {
        font-size: 12.5px;
        padding: 14px 24px;
        width: 100%;
        text-align: center;
    }

    .hero__right {
        height: 240px;
        min-height: 220px;
    }

    /* Services */
    .services {
        padding: 56px 0 64px;
    }

    .services__container {
        padding: 0 16px;
        gap: 16px;
    }

    .services__card {
        padding: 32px 22px;
    }

    .services__icon {
        width: 64px;
        height: 64px;
    }

    .services__title {
        font-size: 15px;
    }

    /* About */
    .about {
        padding: 60px 0;
    }

    .about__container {
        padding: 0 20px;
    }

    .about__title {
        font-size: 22px;
    }

    .about__text {
        font-size: 15px;
    }

    /* Expertise */
    .expertise {
        padding: 60px 0;
    }

    .expertise__container {
        padding: 0 16px;
    }

    .expertise__title {
        font-size: 15px;
        letter-spacing: 0.8px;
    }

    .expertise__line {
        max-width: 32px;
    }

    .expertise__grid {
        grid-template-columns: 1fr;
        gap: 16px;
        max-width: 340px;
        margin-left: auto;
        margin-right: auto;
    }

    .expertise__grid--5 {
        grid-template-columns: 1fr;
    }

    .expertise__card-image {
        height: 180px;
    }

    .expertise__card-label {
        font-size: 12px;
        padding: 14px 12px;
    }

    /* Réalisations */
    .realisations {
        padding: 60px 0;
    }

    .realisations__container {
        padding: 0 16px;
    }

    .realisations__image {
        height: 200px;
    }

    .realisations__info {
        padding: 20px 18px;
    }

    .realisations__cta {
        font-size: 12px;
        padding: 13px 26px;
    }

    /* Chiffres */
    .chiffres {
        padding: 60px 0;
    }

    .chiffres__container {
        padding: 0 20px;
    }

    .chiffres__title {
        font-size: 21px;
    }

    .chiffres__text {
        font-size: 15px;
        margin-bottom: 36px;
    }

    .chiffres__grid {
        grid-template-columns: 1fr;
        gap: 28px;
        max-width: 240px;
    }

    .chiffres__item:last-child {
        grid-column: auto;
    }

    .chiffres__number {
        font-size: 34px;
    }

    /* Contact CTA */
    .contact-cta {
        padding: 56px 0;
    }

    .contact-cta__container {
        padding: 0 20px;
    }

    .contact-cta__title {
        font-size: 22px;
    }

    .contact-cta__text {
        font-size: 15px;
    }

    .contact-cta__btn {
        padding: 14px 28px;
        font-size: 12px;
    }

    /* Footer */
    .footer__container {
        padding: 0 20px;
        padding-bottom: 40px;
    }

    .footer__logo-img {
        height: 44px;
    }

    .footer__social-link {
        width: 42px;
        height: 42px;
    }
}

/* ---------- SMALL MOBILE (max 360px) ---------- */
@media (max-width: 360px) {
    .hero__title {
        font-size: 19px;
    }

    .hero__subtitle {
        font-size: 13.5px;
    }

    .expertise__card-image {
        height: 160px;
    }
}

/* ---------- Accessibilité : reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .header__nav,
    .header__nav-list li,
    .mobile-overlay,
    .header__nav-link,
    .header__burger span {
        transition: none !important;
        animation: none !important;
    }
}
