/* ==========================================================================
   Melting-Mindz v2 — Layout
   Container, grid system, responsive breakpoints, spacing utilities.
   Mobile-first: base styles target phones, then scale up.
   ========================================================================== */

/* ── Container ── */
.mm-container {
    width: 100%;
    max-width: var(--mm-container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--mm-space-4);
    padding-right: var(--mm-space-4);
}

@media (min-width: 768px) {
    .mm-container {
        padding-left: var(--mm-space-6);
        padding-right: var(--mm-space-6);
    }
}

/* ── Page Wrapper (ensures footer sticks to bottom) ── */
.mm-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.mm-page > main {
    flex: 1;
}

/* ── Section Spacing ── */
.mm-section {
    padding-top: var(--mm-space-8);
    padding-bottom: var(--mm-space-8);
}

.mm-section + .mm-section {
    padding-top: 0;
}

.mm-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--mm-space-3);
    margin-bottom: var(--mm-space-5);
}

.mm-section-title {
    font-family: var(--mm-font-heading);
    font-size: var(--mm-text-xl);
    font-weight: 700;
    color: var(--mm-text-heading);
    margin: 0;
}

@media (min-width: 640px) {
    .mm-section-title {
        font-size: var(--mm-text-2xl);
    }
}

/* ── Game Card Grid ── */
.mm-game-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--mm-space-3);
}

@media (min-width: 640px) {
    .mm-game-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--mm-space-4);
    }
}

@media (min-width: 1024px) {
    .mm-game-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--mm-space-5);
    }
}

@media (min-width: 1280px) {
    .mm-game-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: var(--mm-space-5);
    }
}

/* ── Generic Grids ── */
.mm-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--mm-space-4);
}
@media (min-width: 640px) {
    .mm-grid-2 { grid-template-columns: repeat(2, 1fr); }
}

.mm-grid-3 {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--mm-space-4);
}
@media (min-width: 640px) {
    .mm-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
    .mm-grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.mm-grid-4 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--mm-space-4);
}
@media (min-width: 640px) {
    .mm-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
    .mm-grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ── Horizontal Scroll Row (for "Continue Playing", etc.) ── */
.mm-scroll-row {
    display: flex;
    gap: var(--mm-space-3);
    overflow-x: auto;
    padding-bottom: var(--mm-space-2);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--mm-scrollbar-thumb) transparent;
}
.mm-scroll-row::-webkit-scrollbar {
    height: 4px;
}
.mm-scroll-row::-webkit-scrollbar-thumb {
    background: var(--mm-scrollbar-thumb);
    border-radius: 2px;
}

/* ── Two-Column Layout (main + sidebar) ── */
.mm-layout-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--mm-space-6);
}

@media (min-width: 1024px) {
    .mm-layout-main {
        grid-template-columns: 1fr 320px;
    }
}

/* ── Flex Utilities ── */
.mm-flex        { display: flex; }
.mm-flex-col    { display: flex; flex-direction: column; }
.mm-flex-wrap   { flex-wrap: wrap; }
.mm-flex-center { display: flex; align-items: center; justify-content: center; }
.mm-items-center { align-items: center; }
.mm-justify-between { justify-content: space-between; }
.mm-gap-1 { gap: var(--mm-space-1); }
.mm-gap-2 { gap: var(--mm-space-2); }
.mm-gap-3 { gap: var(--mm-space-3); }
.mm-gap-4 { gap: var(--mm-space-4); }
.mm-gap-6 { gap: var(--mm-space-6); }

/* ── Spacing Utilities ── */
.mm-mt-0 { margin-top: 0; }
.mm-mt-2 { margin-top: var(--mm-space-2); }
.mm-mt-4 { margin-top: var(--mm-space-4); }
.mm-mt-6 { margin-top: var(--mm-space-6); }
.mm-mt-8 { margin-top: var(--mm-space-8); }
.mm-mb-0 { margin-bottom: 0; }
.mm-mb-2 { margin-bottom: var(--mm-space-2); }
.mm-mb-4 { margin-bottom: var(--mm-space-4); }
.mm-mb-6 { margin-bottom: var(--mm-space-6); }

/* ── Text Utilities ── */
.mm-text-center { text-align: center; }
.mm-text-muted  { color: var(--mm-text-secondary); }
.mm-text-sm     { font-size: var(--mm-text-sm); }

/* ── Divider ── */
.mm-divider {
    border: none;
    border-top: 1px solid var(--mm-border);
    margin: var(--mm-space-6) 0;
}

/* ── Hide/Show by breakpoint ── */
.mm-hide-mobile {
    display: none;
}

@media (min-width: 640px) {
    .mm-hide-mobile { display: revert; }
    .mm-hide-desktop { display: none; }
    /* Restore table-cell for hidden table cells */
    th.mm-hide-mobile,
    td.mm-hide-mobile { display: table-cell; }
}

/* Ensure hamburger shows on mobile even though .mm-hide-desktop has no base rule */
@media (max-width: 639px) {
    .mm-hamburger.mm-hide-desktop {
        display: flex;
    }
}

/* ── Animations ── */
@keyframes mm-fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes mm-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes mm-slide-in-right {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes mm-pulse-glow {
    0%, 100% { box-shadow: var(--mm-shadow-md); }
    50%      { box-shadow: var(--mm-shadow-md), var(--mm-shadow-glow); }
}

.mm-animate-fade-up {
    animation: mm-fade-up 0.5s var(--mm-ease) both;
}

/* ── Email verification banner ── */
.mm-verify-banner {
    background: rgba(246,173,85,0.12);
    border-bottom: 1px solid rgba(246,173,85,0.35);
    color: var(--mm-text-primary);
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: var(--mm-text-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.mm-verify-resend {
    background: var(--mm-accent);
    color: #fff;
    border: none;
    border-radius: var(--mm-radius-full);
    padding: 0.2rem 0.8rem;
    font-size: var(--mm-text-xs);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.mm-verify-resend:hover { opacity: 0.85; }

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;  /* only !important in the entire codebase — for a11y */
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
