/*
 Theme Name:   GeneratePress Child
 Theme URI:    https://generatepress.com
 Description:  Default GeneratePress child theme
 Author:       Tom Usborne
 Author URI:   https://tomusborne.com
 Template:     generatepress
 Version:      0.1
*/
/*
Theme Name: ColoringBookFun Child
Theme URI: https://coloringbookfun.com
Description: GeneratePress child theme for coloring pages with 2-column grid layout
Author: ColoringBookFun
Author URI: https://coloringbookfun.com
Template: generatepress
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: coloringbookfun-child
*/

/* ============================================================================
   Global Mobile Overflow Fix
   ============================================================================ */

.entry-content img {
    max-width: 100%;
    height: auto;
}

/* GenerateBlocks Pro section inners have fixed pixel widths (e.g. 900px) that overflow on mobile */
@media (max-width: 900px) {
    .gbp-section__inner {
        max-width: 100% !important;
        box-sizing: border-box;
    }
}

/* ============================================================================
   Coloring Page Grid Layout
   ============================================================================ */

/**
 * Main grid container (2 columns on desktop, 1 column on mobile)
 */
.coloring-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 15px 0;
    padding: 0;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/**
 * Individual grid item
 */
.coloring-grid .grid-item {
    text-align: center;
    background: #f9f9f9;
    padding: 3px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.coloring-grid .grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/**
 * Grid item images — constrained to prevent oversized display
 * width/height attrs in HTML reserve space for lazy-loaded images
 */
.coloring-grid .grid-item img {
    width: 100%;
    max-width: 400px;
    height: auto;
    aspect-ratio: 3 / 4;
    border: 2px solid #ddd;
    border-radius: 4px;
    margin: 0 auto 15px auto;
    display: block;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.coloring-grid .grid-item img:hover {
    border-color: var(--accent, #A0432E);
}

/**
 * Grid item headings (image captions)
 */
.coloring-grid .grid-item h3 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--accent, #A0432E);
    line-height: 1.4;
    font-family: Merriweather, serif;
}

/**
 * Grid item links (remove default styling)
 */
.coloring-grid .grid-item a {
    text-decoration: none;
    color: inherit;
    display: block;
}

/**
 * Caption link styling (clickable text)
 */
.coloring-grid .grid-item a.caption-link {
    transition: color 0.3s ease;
}

.coloring-grid .grid-item a.caption-link:hover {
    color: var(--accent-2, #D1543C);
}

.coloring-grid .grid-item a.caption-link h3 {
    transition: color 0.3s ease;
}

/* ============================================================================
   Related Topics Section
   ============================================================================ */

/**
 * Related topics container
 */
.related-topics {
    padding: 20px 0;
    margin: 30px 0;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/**
 * Related topics headline - tagline pill style
 */
.related-topics .section-tagline {
    display: inline-flex;
    align-items: flex-start;
    background-color: var(--base, #D9D2C7);
    color: var(--contrast-3, #3a4b62);
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    border: 2px solid #938785;
    border-radius: 9999px;
    padding: 10px 20px;
    margin: 0 0 16px 0;
    font-family: Merriweather, serif;
    max-width: 100%;
    box-sizing: border-box;
    text-align: center;
    word-break: break-word;
}

/**
 * Related topics grid - flexbox wrap for pill buttons
 */
.related-topics-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/**
 * Individual topic button - accent pill style (smaller)
 */
.related-topics-grid .topic-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent, #A0432E);
    color: #fff;
    padding: 8px 18px;
    border-radius: 9999px;
    font-size: 0.9em;
    font-weight: 600;
    font-family: Open Sans, sans-serif;
    text-decoration: none;
    text-align: center;
    transition: background 0.3s ease;
    box-shadow: none;
    border: none;
    cursor: pointer;
}

.related-topics-grid .topic-card:hover {
    background: var(--accent-2, #D1543C);
}

.related-topics-grid .topic-card:visited {
    color: #fff;
}

/* ============================================================================
   Featured Image (Inline)
   ============================================================================ */

/**
 * Featured image displayed inline after title/meta, before description
 */
.featured-image-inline {
    margin: 10px 0;
    text-align: center;
}

.featured-image-inline img {
    width: 85%;
    height: auto;
    border-radius: 8px;
    border: 3px solid var(--base, #D9D2C7);
    display: block;
    margin: 0 auto;
}

/* ============================================================================
   Topic Description
   ============================================================================ */

/**
 * Main topic description paragraphs
 */
.topic-description {
    font-size: 16px;
    line-height: 1.8;
    margin: 10px 0;
    color: var(--contrast, #333);
    font-family: Open Sans, sans-serif;
}

.topic-description p {
    margin-bottom: 15px;
}

.topic-description p:last-child {
    margin-bottom: 0;
}

/* ============================================================================
   Download PDF Button
   ============================================================================ */

/**
 * PDF download button styling - matches primary button
 */
.download-pdf {
    display: inline-block;
    background: #32373c;
    color: #fff;
    padding: calc(.667em + 2px) calc(1.333em + 2px);
    border-radius: 9999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.125em;
    font-family: Open Sans, sans-serif;
    margin-top: 10px;
    transition: opacity 0.3s ease;
}

.download-pdf:hover {
    opacity: 0.85;
    color: #fff;
}

/* ============================================================================
   Category Archive Pages
   ============================================================================ */

/**
 * Category archive description
 */
.category-archive .archive-description {
    font-size: 18px;
    margin-bottom: 30px;
    line-height: 1.6;
    color: #555;
}

/**
 * Category page title
 */
.category .page-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #32373c;
}

/* ============================================================================
   Mobile Responsiveness
   ============================================================================ */

/**
 * Tablet (768px and below)
 */
@media (max-width: 768px) {
    /* Single column grid on mobile */
    .coloring-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin: 15px 0;
    }

    .coloring-grid .grid-item {
        padding: 3px;
    }

    .coloring-grid .grid-item h3 {
        font-size: 16px;
    }

    .related-topics {
        padding: 15px 0;
        margin: 20px 0;
    }

    .related-topics .section-tagline {
        font-size: 1.1rem;
        padding: 8px 16px;
    }

    .related-topics-grid {
        gap: 8px;
    }

    .related-topics-grid .topic-card {
        font-size: 0.85em;
    }

    .topic-description {
        font-size: 15px;
        line-height: 1.7;
    }
}

/**
 * Mobile (480px and below)
 */
@media (max-width: 480px) {
    .coloring-grid {
        gap: 12px;
        margin: 15px 0;
    }

    .coloring-grid .grid-item {
        padding: 10px;
    }

    .coloring-grid .grid-item h3 {
        font-size: 14px;
    }

    .related-topics {
        padding: 10px 0;
        margin: 15px 0;
    }

    .related-topics .section-tagline {
        font-size: 1rem;
        padding: 6px 14px;
    }

    .related-topics-grid {
        gap: 6px;
    }

    .related-topics-grid .topic-card {
        font-size: 0.8em;
        padding: 6px 14px;
    }

    .topic-description {
        font-size: 14px;
    }

    .download-pdf {
        width: 100%;
        text-align: center;
    }
}

/* ============================================================================
   Print Styles
   ============================================================================ */

/**
 * Hide unnecessary elements when printing
 */
@media print {
    .related-topics,
    .download-pdf,
    header,
    footer,
    .site-navigation {
        display: none !important;
    }

    .coloring-grid {
        display: block;
    }

    .coloring-grid .grid-item {
        page-break-inside: avoid;
        margin-bottom: 20px;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ============================================================================
   Accessibility Improvements
   ============================================================================ */

/**
 * Focus styles for keyboard navigation
 */
.coloring-grid .grid-item a:focus,
.related-topics-grid .topic-card:focus,
.download-pdf:focus {
    outline: 3px solid #32373c;
    outline-offset: 2px;
}

/**
 * Skip to content link (for screen readers)
 */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #32373c;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* ============================================================================
   Loading States (Optional)
   ============================================================================ */

/**
 * Image loading placeholder
 */
.coloring-grid .grid-item img[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================================================
   Additional Utility Classes
   ============================================================================ */

/**
 * Center-aligned text
 */
.text-center {
    text-align: center;
}

/**
 * No margin bottom
 */
.mb-0 {
    margin-bottom: 0 !important;
}

/**
 * No margin top
 */
.mt-0 {
    margin-top: 0 !important;
}
