
/* ==========================================
   ABC PLAYGROUND
   SUBTOPIC PAGE STYLES
   ========================================== */


/* ==========================================
   MAIN PAGE LAYOUT
   ========================================== */

.page-layout.subtopic-page-layout {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 20px;
}

/* Main content fills available space */
.subtopic-page-layout .subject-content {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
    min-width: 0;
}

/* Prevent content overflow */
.subtopic-page-layout .content-panel,
.subtopic-page-layout .topic-section {
    min-width: 0;
    max-width: 100%;
}


/* ==========================================
   WORKSHEET PREVIEW GRID
   ========================================== */

/* Large desktop: 5 columns */
.page-layout.subtopic-page-layout
.topic-links.subtopic-worksheet-grid {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    column-gap: 18px;
    row-gap: 28px;
    padding: 15px;
    width: 100%;
    min-width: 0;
}

/* Individual worksheet cards */
.subtopic-page-layout .ws_pv_img_cont {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-width: 0;
    margin-bottom: 10px;
}

/* Preview image wrapper */
.subtopic-page-layout .ws_pv_image {
    width: 100%;
    text-align: center;
}

/* Match topic-page preview image sizing */
.subtopic-page-layout .ws_pv_img {
    display: block;
    width: 100%;
    max-width: 180px;
    height: auto;
    margin: 0 auto;
    border: 1px solid #000;
}

/* Worksheet title beneath preview */
.subtopic-page-layout .ws_pv_title {
    width: 100%;
    margin-top: 10px;
    padding-left: 8px;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 600;
    text-align: left;
    overflow-wrap: anywhere;
}

.subtopic-page-layout .ws_pv_title a {
    color: #008db3;
    text-decoration: none;
}

.subtopic-page-layout .ws_pv_title a:hover {
    color: #006f90;
    text-decoration: underline;
}

/* Spelling and other subtopic headings */
.subtopic-page-layout .subtopic-heading {
    grid-column: 1 / -1;
    width: 100%;
}


/* ==========================================
   MEDIUM DESKTOP: 4 COLUMNS
   ========================================== */

@media (max-width: 1200px) {

    .page-layout.subtopic-page-layout
    .topic-links.subtopic-worksheet-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }

}


/* ==========================================
   TABLET: 3 COLUMNS
   ========================================== */

@media (max-width: 900px) {

    .page-layout.subtopic-page-layout
    .topic-links.subtopic-worksheet-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

}


/* ==========================================
   MOBILE: 2 COLUMNS
   ========================================== */

@media (max-width: 700px) {

    /* Stack page layout */
    .page-layout.subtopic-page-layout {
        display: flex;
        flex-direction: column;
        width: 100%;
        padding: 0 10px;
        margin: 10px auto;
        gap: 12px;
    }

    /* Hide desktop advertising columns */
    .subtopic-page-layout .subject-sidebar,
    .subtopic-page-layout .side-container,
    .subtopic-page-layout .large-left-container {
        display: none;
    }

    /* Full-width main content */
    .subtopic-page-layout .subject-content {
        display: block;
        flex: none;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin: 0;
        padding: 0;
        overflow: visible;
        border-radius: 0;
    }

    .subtopic-page-layout .content-panel {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    /* Breadcrumbs */
    .subtopic-page-layout .breadcrumbs {
        padding: 10px 12px;
        font-size: 12px;
        line-height: 1.6;
        overflow-wrap: anywhere;
    }

    /* Page title */
    .subtopic-page-layout .page-title-bar {
        padding: 12px 14px;
    }

    .subtopic-page-layout .page-title-bar h1 {
        font-size: 21px;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    /* Section headings */
    .subtopic-page-layout .topic-heading {
        padding: 10px 12px;
    }

    .subtopic-page-layout .topic-heading h2 {
        font-size: 18px;
        line-height: 1.4;
    }

    /* Two worksheet previews per row */
    .page-layout.subtopic-page-layout
    .topic-links.subtopic-worksheet-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        column-gap: 12px;
        row-gap: 18px;
        padding: 10px;
    }

    /* Keep preview cards responsive */
    .subtopic-page-layout .ws_pv_img_cont {
        width: 100%;
        min-width: 0;
        margin-bottom: 8px;
    }

    .subtopic-page-layout .ws_pv_img {
        width: 100%;
        max-width: 180px;
        height: auto;
    }

    /* Mobile worksheet titles */
    .subtopic-page-layout .ws_pv_title {
        margin-top: 7px;
        padding-left: 0;
        font-size: 13px;
        line-height: 1.4;
    }

    /* Spelling headings */
    .subtopic-page-layout .subtopic-heading {
        grid-column: 1 / -1;
        padding: 10px 12px;
        font-size: 17px;
        line-height: 1.4;
    }

}


/* ==========================================
   MOBILE MEMBERSHIP SIGNUP MODAL
   ========================================== */

@media (max-width: 700px) {

    .membership-modal {
        width: 96%;
        max-width: 96%;
        max-height: 90dvh;
        overflow-y: auto;
        padding: 35px 12px 16px;
        box-sizing: border-box;
    }

    .membership-modal h2 {
        font-size: 17px;
        line-height: 1.35;
        margin: 0 12px 12px;
    }

    .membership-modal .modal-close {
        top: 5px;
        right: 10px;
        font-size: 30px;
        line-height: 1;
    }

    /* Keep Free and VIP side by side */
    .membership-modal .membership-columns {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-top: 12px;
        align-items: start;
    }

    .membership-modal .membership {
        width: 100%;
        min-width: 0;
        margin: 0;
        padding: 0;
    }

    .membership-modal .membership img {
        display: block;
        width: 100%;
        max-width: 100%;
        height: auto;
        margin: 0 auto;
    }

}
