/**
 * AcadStore — responsive global (public + admin)
 * Breakpoints alignés Tailwind : sm 640 · md 768 · lg 1024 · xl 1280 · 2xl 1536
 */

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

html,
body {
    overflow-x: hidden;
    max-width: 100vw;
}

img,
video,
svg,
canvas,
iframe {
    max-width: 100%;
    height: auto;
}

/* Typographie fluide */
.acad-landing h1,
.acad-main h1 {
    font-size: clamp(1.5rem, 1.1rem + 2vw, 3.25rem);
    line-height: 1.15;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.acad-landing h2,
.acad-main h2 {
    font-size: clamp(1.25rem, 1.05rem + 1vw, 1.875rem);
    line-height: 1.25;
    word-wrap: break-word;
}

.acad-landing p,
.acad-main p {
    overflow-wrap: break-word;
}

/* Grilles cartes standards */
.acad-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 640px) {
    .acad-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
}
@media (min-width: 1024px) {
    .acad-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
}
@media (min-width: 1280px) {
    .acad-card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; }
}

/* Tables : scroll horizontal contrôlé */
.acad-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.75rem;
}
.acad-table-wrap table {
    min-width: 640px;
    width: 100%;
}
.acad-table-wrap::-webkit-scrollbar { height: 6px; }
.acad-table-wrap::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}

/* Boutons tactiles */
.btn-acad,
button.btn-acad,
a.btn-acad {
    min-height: 2.75rem;
    touch-action: manipulation;
}

@media (max-width: 639px) {
    .btn-acad,
    button:not(.acad-icon-btn),
    a.btn-acad {
        min-height: 2.75rem;
    }
}

/* Modales responsive */
.acad-modal {
    padding: 0.75rem;
    align-items: flex-end;
}
@media (min-width: 640px) {
    .acad-modal { align-items: center; padding: 1rem; }
}
.acad-modal-card {
    width: 95%;
    max-width: 26rem;
    max-height: min(90vh, 40rem);
    overflow-y: auto;
    margin: 0 auto;
}
.acad-report-card {
    width: 95% !important;
    max-width: 24rem;
    max-height: min(90vh, 36rem);
    overflow-y: auto;
}

/* Header mobile drawer */
.acad-nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.acad-nav-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}
.acad-mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 55;
    width: min(20rem, 88vw);
    height: 100vh;
    height: 100dvh;
    background: #fff;
    border-left: 1px solid #e2e8f0;
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.12);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 1rem;
}
.acad-mobile-drawer.is-open {
    transform: translateX(0);
}
body.acad-nav-locked {
    overflow: hidden;
}

/* Toast : safe area mobile */
.acad-toast-root {
    right: max(0.75rem, env(safe-area-inset-right));
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    left: auto;
    max-width: min(22rem, calc(100vw - 1.5rem));
}

/* Commentaires : réponses sur petit écran */
@media (max-width: 639px) {
    .acad-comment-card.is-reply {
        margin-left: 0.65rem;
        padding-left: 0.75rem;
    }
    .comment-replies {
        margin-left: 0.5rem;
        padding-left: 0.65rem;
    }
    .acad-comment-avatar {
        width: 2rem;
        height: 2rem;
        font-size: 0.8rem;
    }
}

/* Conteneurs : éviter débordement */
.acad-main,
.acad-landing section,
.acad-landing article {
    max-width: 100%;
}

/* Formulaires : champs pleine largeur */
@media (max-width: 639px) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    select,
    textarea {
        max-width: 100%;
        width: 100%;
    }
}

/* Hero stats : éviter compression extrême */
@media (max-width: 374px) {
    .stat-card .text-xl { font-size: 1rem; }
    .acad-header .acad-logo--md .acad-logo__word { font-size: 1rem; }
}

/* Process timeline déjà en CSS landing — renforcement mobile */
@media (max-width: 639px) {
    .acad-process-timeline {
        grid-template-columns: 1fr !important;
    }
}
