/* Improved Layout CSS for PlebMoe Portal
   - Better stage title card positioning
   - Improved two-card layout for stages 2+
   - More transparent modals that don't occlude the background
*/

/* Stage Title Card - Centered and prominent */
.stage-title-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 140, 0, 0.3);
    border-radius: 16px;
    padding: 24px 40px;
    text-align: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 5;
    min-width: 300px;
}

.stage-title-card h2 {
    color: #ff8c00;
    font-size: 28px;
    font-weight: bold;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.stage-title-card p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

/* Two-card layout for bottom section */
.content-cards-wrapper {
    position: fixed;
    bottom: 100px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    pointer-events: none;
}

.content-cards-container {
    pointer-events: auto;
    position: fixed;
    /* LOCKED RESPONSIVE CONTENT AREA.
       v14.6.html measures the fixed header (#topAuthButtons) and the bottom
       UI stack (#bottomButtons) and publishes the free region between them as
       --content-top / --content-bottom (re-measured on resize, iOS URL-bar
       changes and per-stage description wrapping). Pinning both edges here
       means cards fill the space below the auth buttons and can never overlap
       the description/title/progress/nav cluster. !important neutralizes the
       inline top:65% / translate(-50%,-50%) rules in v14.6.html; the fallback
       values apply only before the first measurement runs. */
    top: var(--content-top, 90px) !important;
    bottom: var(--content-bottom, 320px) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 0;
    z-index: 10;
}

/* Pyramid layout for any 3-card stage (1 on top, 2 on bottom). The two rows
   split the locked content area evenly, so card HEIGHT is relative to the
   space actually available on this device. */
.content-cards-container.pyramid-layout {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: min(2.5vh, 24px) !important;
}

.content-cards-container.pyramid-layout .pyramid-top,
.content-cards-container.pyramid-layout .pyramid-bottom {
    display: flex !important;
    justify-content: center !important;
    align-items: stretch !important;
    /* Bottom row: 7.5% margin + 40% card + 5% gap + 40% card + 7.5% margin */
    gap: min(5vw, 48px) !important;
    flex: 1 1 0;
    min-height: 0;
    max-height: 260px;
    width: 100%;
}

.content-cards-container.pyramid-layout .compact-card {
    width: clamp(150px, 40vw, 260px) !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 100% !important;     /* fill the row → height tracks the area */
    min-height: 0 !important;
    max-height: 100%;
    container-type: size;        /* enables cqw/cqh type scaling below */
    padding: clamp(8px, 2.5vw, 20px) !important;
}

/* Standard layout for 2 cards side by side */
.content-cards-container.standard-layout {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    /* center, NOT stretch: the container is pinned to the full locked area,
       so stretch would blow cards up to its entire height. */
    align-items: center !important;
    gap: min(5vw, 48px) !important;
}

/* Same 40vw-cap width spec as the pyramid; height stays content-driven but is
   capped by the locked area. Overrides the fixed height clamp in v14.6.html. */
.content-cards-container.standard-layout .compact-card {
    width: clamp(150px, 40vw, 260px) !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: clamp(110px, 18vh, 150px) !important;
    max-height: 100%;
}

/* Quad layout (4 cards, 2×2 grid in v14.6.html) — keep cards inside 2×40vw */
.content-cards-container.quad-layout .compact-card {
    width: clamp(140px, 40vw, 260px) !important;
    min-width: 0 !important;
    height: auto !important;
}

/* Events feed (stage 7): keep its block scroll region but center it inside
   the locked area instead of top-anchoring it. */
.content-cards-container.events-feed {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}

/* Redesigned compact cards */
.compact-card {
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 140, 0, 0.25);
    border-radius: 14px;
    padding: clamp(10px, 2.5vw, 24px);
    width: clamp(150px, 40vw, 280px);
    min-height: 140px;
    /* Row/column gaps own the spacing; !important beats the runtime-injected
       mobile margin (12px 8px) from enhanced_mobile_content.js that pushed
       cards out of the locked area. Same for justify-content. */
    margin: 0 !important;
    justify-content: center !important;
    /* Allow shrinking on very narrow screens (v14.6.html sets flex-shrink:0) */
    flex-shrink: 1;
    /* Card becomes a size container so its text can scale with it (cqw/cqh) */
    container-type: inline-size;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    opacity: 0;
    transform: translateY(30px);
    animation: cardFadeIn 0.6s ease forwards;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.compact-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg,
        rgba(255, 140, 0, 0.05) 0%,
        transparent 50%,
        rgba(0, 255, 255, 0.02) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.compact-card:hover::before {
    opacity: 1;
}

.compact-card:hover {
    border-color: rgba(255, 140, 0, 0.5);
    background: rgba(0, 0, 0, 0.7);
    transform: translateY(-6px) scale(1.04);
    box-shadow: 0 16px 50px rgba(255, 140, 0, 0.15);
}

/* Typography scales with the card itself via container-query units, so
   titles/descriptions shrink to fit their card instead of clipping.
   (In browsers without container queries, cq units fall back to viewport
   units and the clamp() caps keep sizes sane.) */
.compact-card h4 {
    color: #ff8c00;
    font-size: clamp(11px, 8cqw, 18px) !important;
    font-weight: bold;
    margin-bottom: clamp(5px, 2cqw, 14px);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
    position: relative;
    z-index: 1;
}

.compact-card p {
    color: rgba(255, 255, 255, 0.85);
    font-size: clamp(10px, 6.5cqw, 14px) !important;
    line-height: 1.4;
    margin: 0;
    position: relative;
    z-index: 1;
}

/* Pyramid cards are height-constrained too (they fill their row), so factor
   the card's HEIGHT into the type size as well — no vertical cut-off. */
.pyramid-layout .compact-card h4 {
    font-size: clamp(10px, min(8cqw, 11cqh), 18px) !important;
    margin-bottom: min(12px, 3cqh);
}

.pyramid-layout .compact-card p {
    font-size: clamp(9px, min(6.5cqw, 8.5cqh), 14px) !important;
}

/* More transparent modal overlay */
.info-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.4) !important;
    z-index: 1000 !important;
    display: none;
    backdrop-filter: blur(2px) !important;
    -webkit-backdrop-filter: blur(2px) !important;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.info-modal.show {
    display: flex !important;
    justify-content: center;
    align-items: center;
    opacity: 1 !important;
}

/* Smaller, more transparent modal content */
.modal-content {
    background: rgba(10, 10, 10, 0.8) !important;
    border: 1px solid rgba(255, 140, 0, 0.25) !important;
    border-radius: 18px !important;
    padding: 32px !important;
    padding-top: 52px !important;
    width: 85% !important;
    max-width: 520px !important;
    max-height: 65vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    box-shadow:
        0 25px 70px rgba(0, 0, 0, 0.7),
        0 0 40px rgba(255, 140, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.info-modal.show .modal-content {
    transform: scale(1);
}

/* Modal close button improvements */
.modal-close {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    width: 36px !important;
    height: 36px !important;
    background: rgba(255, 140, 0, 0.2) !important;
    border: 1px solid rgba(255, 140, 0, 0.4) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 20px !important;
    cursor: pointer !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    z-index: 10 !important;
}

.modal-close:hover {
    background: rgba(255, 140, 0, 0.3) !important;
    border-color: rgba(255, 140, 0, 0.6) !important;
    transform: scale(1.1) !important;
}

/* Animation for cards */
@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation delay for second card */
.compact-card:nth-child(2) {
    animation-delay: 0.15s;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .stage-title-card {
        top: 40%;
        padding: 20px 30px;
        min-width: 280px;
    }

    .stage-title-card h2 {
        font-size: 22px;
    }

    .content-cards-wrapper {
        bottom: 80px;
    }

    /* Mobile: the locked content area (--content-top/--content-bottom) already
       positions the container; only the gaps need tightening. Card widths use
       the same 40vw spec as desktop: 7.5% + 40% + 5% + 40% + 7.5% = 100%. */
    .content-cards-container.pyramid-layout {
        gap: min(2vh, 16px) !important;
    }

    .content-cards-container.pyramid-layout .pyramid-top,
    .content-cards-container.pyramid-layout .pyramid-bottom,
    .content-cards-container.standard-layout {
        gap: 5vw !important;
    }

    .content-cards-container.standard-layout .compact-card {
        min-height: clamp(100px, 16vh, 140px) !important;
    }

    .modal-content {
        width: 92% !important;
        max-height: 75vh !important;
        padding: 24px !important;
        padding-top: 44px !important;
    }
}

/* Small mobile devices */
@media (max-width: 380px) {
    .stage-title-card h2 {
        font-size: 20px;
    }

    .stage-title-card p {
        font-size: 13px;
    }

    /* Card typography now scales with the card via container-query units
       (see .compact-card h4 / p above) — no fixed overrides needed here. */
}