/* All Modules listing page (/modules) — scoped under .am-page per mvc-ui-ux-design.md §3 */

.am-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;

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

html[data-theme="dark"] .am-page {
    --ink:        #e8ecf5;
    --ink-soft:   #c6cbd8;
    --muted:      #8d95a8;
    --hair:       #2a3142;
    --paper:      #161a25;
    --wash:       #1c2231;
}

html[data-theme="dark"] .am-card,
html[data-theme="dark"] .am-empty {
    background: #161a25;
}

/* ============================================================
   HERO
   ============================================================ */
.am-hero {
    position: relative;
    text-align: center;
    padding: clamp(4.5rem, 8vw, 7rem) 1.5rem clamp(3rem, 6vw, 4.5rem);
    background: radial-gradient(ellipse at 15% 10%, rgba(196, 181, 253, 0.28), transparent 55%),
                radial-gradient(ellipse at 85% 15%, rgba(253, 245, 180, 0.28), transparent 55%),
                var(--paper);
}
html[data-theme="dark"] .am-hero {
    background: radial-gradient(ellipse at 15% 10%, rgba(80, 70, 180, 0.3), transparent 55%),
                radial-gradient(ellipse at 85% 15%, rgba(90, 110, 40, 0.18), transparent 55%),
                var(--paper);
}

.am-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"] .am-hero__eyebrow {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--ink);
}

.am-hero__title {
    font-size: clamp(1.9rem, 2.8vw, 2.6rem);
    font-weight: 700;
    letter-spacing: -0.018em;
    color: var(--ink);
    margin-bottom: 0.75rem;
    line-height: 1.15;
}
.am-hero__title em { color: var(--brand); font-style: normal; font-weight: 700; display: block; }
.am-hero__title > span { display: block; color: var(--ink); }

.am-hero__subtitle {
    color: var(--muted);
    max-width: 60ch;
    margin: 0 auto 1.5rem;
}

.am-hero__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.35rem;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}
.am-hero__cta:hover {
    background: var(--brand-deep);
    color: #fff;
    transform: translateY(-1px);
}

/* ============================================================
   CARD GRID
   ============================================================ */
.am-grid-section {
    padding: clamp(2.5rem, 5vw, 4rem) 0 clamp(4rem, 7vw, 5.5rem);
}

.am-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: clamp(1.25rem, 2.5vw, 1.75rem);
}

.am-card {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 2rem 1.6rem 1.65rem;
    background: #fff;
    border: 1px solid var(--hair);
    border-radius: 20px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    opacity: 0;
    transform: translateY(8px);
    animation: am-rise 0.5s cubic-bezier(0.2, 0.7, 0.25, 1) forwards;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.am-card:nth-child(1) { animation-delay: 0.05s; }
.am-card:nth-child(2) { animation-delay: 0.12s; }
.am-card:nth-child(3) { animation-delay: 0.19s; }
.am-card:nth-child(4) { animation-delay: 0.26s; }
.am-card:nth-child(5) { animation-delay: 0.33s; }
.am-card:nth-child(6) { animation-delay: 0.40s; }

/* Brand→teal accent bar across the top — scales in from the left on hover */
.am-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand) 0%, var(--teal) 100%);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.25, 1);
    z-index: 2;
}

.am-card:hover {
    transform: translateY(-4px);
    border-color: rgba(24, 112, 209, 0.28);
    box-shadow:
        0 22px 40px -22px rgba(11, 27, 52, 0.25),
        0 10px 18px -12px rgba(11, 27, 52, 0.10);
    color: inherit;
}
.am-card:hover::before { transform: scaleX(1); }
.am-card:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 3px;
}

.am-card__icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px; height: 56px;
    border-radius: 14px;
    background: var(--zf-tenant-gradient, linear-gradient(135deg, var(--brand), var(--brand-deep)));
    margin-bottom: 1.1rem;
    box-shadow: 0 12px 24px -10px rgba(24, 112, 209, 0.45);
    overflow: hidden;
}
.am-card__icon {
    width: 32px;
    height: 32px;
    max-width: 100%;
    object-fit: contain;
}

.am-card__title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.012em;
    color: var(--ink);
    margin: 0 0 0.55rem;
    line-height: 1.3;
}

.am-card__desc {
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 1rem;
}

.am-card__link {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 13px;
    font-weight: 700;
    color: var(--brand);
}
.am-card__link i { font-size: 12px; transition: transform 0.22s ease; }
.am-card:hover .am-card__link i { transform: translateX(3px); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.am-empty {
    text-align: center;
    padding: clamp(3rem, 6vw, 4.5rem) 1.5rem;
    background: #fff;
    border: 1px dashed var(--hair);
    border-radius: 20px;
}
.am-empty__icon {
    font-size: 2.25rem;
    color: var(--muted);
    margin-bottom: 1rem;
    display: inline-block;
}
.am-empty__text {
    color: var(--muted);
    font-size: 15px;
    margin: 0;
}

@keyframes am-rise { to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
    .am-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

@media (max-width: 720px) {
    .am-grid { grid-template-columns: 1fr; }
    .am-hero { padding: 3.5rem 1.25rem 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .am-card { animation: none; opacity: 1; transform: none; }
}
