/* Module landing page — scoped under .ml-page per mvc-ui-ux-design.md §3 */

.ml-page {
    /* Ink scale */
    --ink:       #0b1b34;
    --ink-soft:  #2d3a52;
    --muted:     #6b7487;

    /* Paper scale */
    --hair:      #e5e7ef;
    --paper:     #fbfbfd;
    --wash:      #f3f5fb;

    /* Brand — tenant-driven, never literal */
    --brand:      var(--zf-primary,   #1870d1);
    --brand-deep: var(--zf-secondary, #0f4ea3);
    --teal:       #07c3d6;

    /* Semantic states */
    --current:    #0f8b5a;  --current-bg: #e6f4ed;
    --past:       #64748b;  --past-bg:    #eef0f6;

    position: relative;
    color: var(--ink);
    font-family: "Montserrat", sans-serif;
    line-height: 1.5;
}

html[data-theme="dark"] .ml-page {
    --ink:        #e8ecf5;
    --ink-soft:   #c6cbd8;
    --muted:      #8d95a8;
    --hair:       #2a3142;
    --paper:      #161a25;
    --wash:       #1c2231;
    --past:       #a4adc0;
    --past-bg:    #232a3a;
    --current-bg: rgba(15, 139, 90, 0.18);
}

html[data-theme="dark"] .ml-stats-strip,
html[data-theme="dark"] .ml-screenshot__frame,
html[data-theme="dark"] .ml-testimonial {
    background: #161a25;
}

.ml-page > section { padding: clamp(3rem, 6vw, 5rem) 0; }

/* -----------------------------------------------------------------------
   Hero
   ----------------------------------------------------------------------- */
.ml-hero {
    position: relative;
    text-align: center;
    padding: clamp(5rem, 9vw, 8rem) 1.5rem clamp(3.5rem, 7vw, 5.5rem);
    background: linear-gradient(180deg, var(--wash) 0%, transparent 100%);
}
html[data-theme="dark"] .ml-hero {
    background: linear-gradient(180deg, rgba(24, 112, 209, 0.10) 0%, transparent 100%);
}

/* Optional admin-uploaded hero background image (URLs supplied as custom properties). */
.ml-hero--has-bg {
    background-image: var(--ml-hero-bg-light);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
html[data-theme="dark"] .ml-hero--has-bg {
    background-image: var(--ml-hero-bg-dark);
}
/* Readability wash between the image and the hero copy. */
.ml-hero--has-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(251, 251, 253, 0.88) 0%, rgba(251, 251, 253, 0.74) 100%);
}
html[data-theme="dark"] .ml-hero--has-bg::before {
    background: linear-gradient(180deg, rgba(11, 16, 26, 0.84) 0%, rgba(11, 16, 26, 0.70) 100%);
}

.ml-hero__cluster { max-width: 780px; margin: 0 auto; position: relative; z-index: 1; }
.ml-hero__eyebrow {
    display: inline-block;
    padding: 6px 18px;
    background: #fff;
    border: 1px solid var(--hair);
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 11px; font-weight: 700;
    color: var(--brand-deep);
    margin-bottom: 1rem;
}
html[data-theme="dark"] .ml-hero__eyebrow {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--ink);
}
.ml-hero__title {
    font-size: clamp(1.9rem, 3.4vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.018em;
    color: var(--ink);
    margin-bottom: 0.75rem;
    line-height: 1.15;
}
.ml-hero__title em { color: var(--brand); font-style: normal; font-weight: 700; display: block; }
.ml-hero__title > span { display: block; color: var(--ink); }
.ml-hero__subtitle {
    color: var(--muted);
    max-width: 55ch;
    margin: 0 auto 1.75rem;
    font-size: 1.05rem;
}
.ml-hero__actions {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.85rem;
    margin-bottom: 2.5rem;
}
.ml-hero__cta {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.ml-hero__cta--primary {
    background: var(--brand);
    color: #fff;
}
.ml-hero__cta--primary:hover { background: var(--brand-deep); transform: translateY(-1px); }
.ml-hero__cta--secondary {
    background: transparent;
    color: var(--ink);
    border: 1.5px solid var(--hair);
}
.ml-hero__cta--secondary:hover { border-color: var(--brand); color: var(--brand); }
.ml-hero__preview {
    position: relative;
    margin-top: 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--hair);
    background: #fff;
    padding: 0.75rem;
    box-shadow: 0 30px 60px -28px rgba(11, 27, 52, 0.22);
}
html[data-theme="dark"] .ml-hero__preview { background: #161a25; }
.ml-hero__preview-img { display: block; width: 100%; height: auto; border-radius: 14px; }
.ml-hero__preview-img--dark { display: none; }
html[data-theme="dark"] .ml-hero__preview-img--light { display: none; }
html[data-theme="dark"] .ml-hero__preview-img--dark { display: block; }

/* -----------------------------------------------------------------------
   Features — alternating image/text rows
   ----------------------------------------------------------------------- */
.ml-features__list {
    display: flex;
    flex-direction: column;
    gap: clamp(3rem, 6vw, 5rem);
}
.ml-feature {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
}
.ml-feature--media-right .ml-feature__media { order: 2; }
.ml-feature--media-right .ml-feature__copy { order: 1; }
.ml-feature__media {
    border-radius: 20px;
    border: 1px solid var(--hair);
    background: #fff;
    padding: 0.6rem;
    box-shadow: 0 20px 42px -26px rgba(11, 27, 52, 0.2);
}
html[data-theme="dark"] .ml-feature__media { background: #1c2231; }
.ml-feature__media img { display: block; width: 100%; height: auto; border-radius: 14px; object-fit: cover; }
.ml-feature__heading {
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.018em;
    color: var(--ink);
    margin-bottom: 1rem;
    line-height: 1.2;
}
.ml-feature__body { color: var(--ink-soft); line-height: 1.7; font-size: 15px; }
.ml-feature__body p { margin-bottom: 1rem; }
.ml-feature__body p:last-child { margin-bottom: 0; }
.ml-feature__body ul, .ml-feature__body ol { padding-left: 1.25rem; margin-bottom: 1rem; }
.ml-feature__body li { margin-bottom: 0.4rem; }

@media (max-width: 1080px) {
    .ml-feature,
    .ml-feature--media-right {
        grid-template-columns: 1fr;
    }
    .ml-feature--media-right .ml-feature__media,
    .ml-feature--media-right .ml-feature__copy,
    .ml-feature .ml-feature__media,
    .ml-feature .ml-feature__copy {
        order: initial;
    }
    .ml-feature__media { max-width: 560px; margin: 0 auto; }
}

/* -----------------------------------------------------------------------
   Stats strip
   ----------------------------------------------------------------------- */
.ml-stats-strip {
    /* auto-fit so the columns always match the number of stats — empty tracks
       collapse instead of exposing the grey container background (the old fixed
       repeat(4) left grey filler cells whenever the count wasn't a multiple of 4). */
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2px;
    background: var(--hair);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 30px 60px -28px rgba(11, 27, 52, 0.18);
    margin: 0 auto;
    max-width: 1080px;
}
.ml-stat {
    background: #fff;
    padding: clamp(1.4rem, 2.6vw, 2.25rem) clamp(1rem, 2vw, 1.75rem);
    text-align: center;
}
.ml-stat__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(40px, 4vw, 52px);
    height: clamp(40px, 4vw, 52px);
    border-radius: 14px;
    margin: 0 auto 0.85rem;
    background: color-mix(in srgb, var(--brand) 12%, #fff);
    color: var(--brand);
    font-size: clamp(20px, 2vw, 24px);
}
html[data-theme="dark"] .ml-stat__icon {
    background: color-mix(in srgb, var(--brand) 22%, #161a25);
    color: #cfe0ff;
}
.ml-stat__value {
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.018em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.ml-stat__label {
    font-size: 13px; font-weight: 500;
    color: var(--ink-soft);
    line-height: 1.5;
    margin-top: 0.5rem;
}
html[data-theme="dark"] .ml-stat { background: #161a25; }

/* No fixed column override at mobile — auto-fit's 150px min already yields ~2 columns
   on narrow screens without leaving an empty (grey) trailing cell for odd counts. */

/* -----------------------------------------------------------------------
   Section heading (shared by Gallery, Testimonials)
   ----------------------------------------------------------------------- */
.ml-section-head {
    text-align: center;
    max-width: 720px;
    margin: 0 auto clamp(2rem, 4vw, 3rem);
}
.ml-section-head__eyebrow {
    display: block;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    color: var(--brand);
    margin-bottom: 0.6rem;
}
.ml-section-head__title {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--ink);
    margin: 0;
}
.ml-section-head__accent {
    background: linear-gradient(90deg, var(--brand) 0%, var(--teal) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* -----------------------------------------------------------------------
   Screenshots gallery
   ----------------------------------------------------------------------- */
.ml-screenshots__gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(1.25rem, 2.5vw, 1.75rem);
}
.ml-screenshot { margin: 0; }
.ml-screenshot__frame {
    border-radius: 18px;
    border: 1px solid var(--hair);
    background: #fff;
    padding: 0.5rem;
    overflow: hidden;
    box-shadow: 0 18px 38px -24px rgba(11, 27, 52, 0.2);
    transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.25, 1), box-shadow 0.3s cubic-bezier(0.2, 0.7, 0.25, 1);
}
.ml-screenshot__frame:hover {
    transform: translateY(-4px);
    box-shadow: 0 26px 46px -22px rgba(11, 27, 52, 0.28);
}
.ml-screenshot__frame img {
    display: block;
    width: 100%;
    /* Uniform tiles regardless of the uploaded image's own dimensions — the image is
       cropped to fill a fixed 4:3 frame (Instagram-style) instead of stretching, so a
       gallery of mixed portrait/landscape uploads lines up cleanly. */
    aspect-ratio: 4 / 3;
    height: auto;
    border-radius: 12px;
    object-fit: cover;
}
.ml-screenshot__caption {
    margin-top: 0.65rem;
    font-size: 13px;
    color: var(--muted);
    text-align: center;
}

@media (max-width: 1080px) {
    .ml-screenshots__gallery { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
    .ml-screenshots__gallery { grid-template-columns: 1fr; }
}

/* -----------------------------------------------------------------------
   Testimonials
   ----------------------------------------------------------------------- */
.ml-testimonials__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(1.25rem, 2.5vw, 1.75rem);
}
.ml-testimonial {
    margin: 0;
    background: #fff;
    border: 1px solid var(--hair);
    border-radius: 20px;
    padding: 1.75rem 1.6rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.25, 1), box-shadow 0.3s cubic-bezier(0.2, 0.7, 0.25, 1), border-color 0.3s ease;
}
.ml-testimonial:hover {
    transform: translateY(-4px);
    border-color: rgba(24, 112, 209, 0.28);
    box-shadow: 0 22px 40px -22px rgba(11, 27, 52, 0.22);
}
.ml-testimonial__quote { margin: 0; position: relative; }
.ml-testimonial__quote-mark { color: var(--brand); font-size: 1.5rem; opacity: 0.5; }
.ml-testimonial__quote p {
    color: var(--ink-soft);
    font-size: 15px;
    line-height: 1.7;
    margin: 0.5rem 0 0;
}
.ml-testimonial__author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}
.ml-testimonial__photo {
    width: 44px; height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.ml-testimonial__photo--initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
}
.ml-testimonial__author-info { display: flex; flex-direction: column; }
.ml-testimonial__author-name { font-weight: 700; color: var(--ink); font-size: 14px; }
.ml-testimonial__author-role { font-size: 12.5px; color: var(--muted); }

@media (max-width: 1080px) {
    .ml-testimonials__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
    .ml-testimonials__grid { grid-template-columns: 1fr; }
}

/* -----------------------------------------------------------------------
   Entrance animation — used by every section's items
   ----------------------------------------------------------------------- */
.ml-rise {
    opacity: 0;
    transform: translateY(8px);
    animation: ml-rise 0.5s cubic-bezier(0.2, 0.7, 0.25, 1) forwards;
}
.ml-rise:nth-child(1) { animation-delay: 0.05s; }
.ml-rise:nth-child(2) { animation-delay: 0.12s; }
.ml-rise:nth-child(3) { animation-delay: 0.19s; }
.ml-rise:nth-child(4) { animation-delay: 0.26s; }
.ml-rise:nth-child(5) { animation-delay: 0.33s; }
.ml-rise:nth-child(6) { animation-delay: 0.40s; }
@keyframes ml-rise { to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
    .ml-rise {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    .ml-screenshot__frame,
    .ml-testimonial,
    .ml-hero__cta {
        transition: none !important;
    }
}
