/**
 * ColoringHub Category Page Styles
 *
 * Dense gallery grid for subcategory cards and post thumbnails.
 * 3-col desktop / 2-col mobile. 18 Tailwind hue families via .ch-color-N.
 * Constraint-solver ensures no adjacent cards share a hue on any page.
 *
 * Deploy: SCP to /home/runcloud/webapps/coloringhub-dev/wp-content/themes/coloringhub/ch-category.css
 */

/* Desktop: trust line on its own row. Mobile: flows inline */
.ch-hero-trust {
    display: block;
}

@media (max-width: 1024px) {
    .ch-hero-trust {
        display: inline;
    }
}

/* ── Grid System ────────────────────────────────────────────────────── */
.ch-subcat-grid,
.ch-post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
}

/* ── Grid Card (shared) ─────────────────────────────────────────────── */
.ch-grid-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.ch-grid-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12), 0 4px 10px rgba(0, 0, 0, 0.06);
}

.ch-grid-card:focus-visible {
    outline: 2px solid var(--accent, #482d70);
    outline-offset: 2px;
}

/* ── Thumbnail ──────────────────────────────────────────────────────── */
.ch-thumb {
    flex-shrink: 0;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #fafafa;
    position: relative;
}

.ch-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.35s ease;
}

.ch-grid-card:hover .ch-thumb img {
    transform: scale(1.06);
}

/* Placeholder when no featured image */
.ch-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
}

/* ── Card Info (colored footer) ────────────────────────────────────── */
.ch-card-info {
    padding: 16px 16px;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ch-card-title {
    display: block;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.3;
}

.ch-subcat-count {
    display: inline-block;
    font-size: 12px;
    margin-top: 5px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 8px;
    letter-spacing: 0.02em;
}

/* ── 18-Hue Palette (Tailwind 600-shade, constraint-solver assigned) ── */
/* 88 categories mapped to 18 visually distinct hue families.
   Solver ensures no two adjacent cards share a hue on any page.
   CSS custom properties + color-mix() derive card styles from --ch-accent.
   --ch-accent: mid-tone (card badge, placeholder gradient)
   --ch-dark:   dark shade (title text)
   --ch-mid:    medium shade (badge text)
   Generated by: generate-colors.py                                      */
.ch-color-1  { --ch-accent: #dc2626; --ch-dark: #7f1d1d; --ch-mid: #b91c1c; } /* Red */
.ch-color-2  { --ch-accent: #ea580c; --ch-dark: #7c2d12; --ch-mid: #c2410c; } /* Orange */
.ch-color-3  { --ch-accent: #d97706; --ch-dark: #78350f; --ch-mid: #b45309; } /* Amber */
.ch-color-4  { --ch-accent: #ca8a04; --ch-dark: #713f12; --ch-mid: #a16207; } /* Yellow */
.ch-color-5  { --ch-accent: #65a30d; --ch-dark: #365314; --ch-mid: #4d7c0f; } /* Lime */
.ch-color-6  { --ch-accent: #16a34a; --ch-dark: #14532d; --ch-mid: #15803d; } /* Green */
.ch-color-7  { --ch-accent: #059669; --ch-dark: #064e3b; --ch-mid: #047857; } /* Emerald */
.ch-color-8  { --ch-accent: #0d9488; --ch-dark: #134e4a; --ch-mid: #0f766e; } /* Teal */
.ch-color-9  { --ch-accent: #0891b2; --ch-dark: #164e63; --ch-mid: #0e7490; } /* Cyan */
.ch-color-10 { --ch-accent: #0284c7; --ch-dark: #075985; --ch-mid: #0369a1; } /* Sky */
.ch-color-11 { --ch-accent: #2563eb; --ch-dark: #1e3a8a; --ch-mid: #1d4ed8; } /* Blue */
.ch-color-12 { --ch-accent: #4f46e5; --ch-dark: #312e81; --ch-mid: #4338ca; } /* Indigo */
.ch-color-13 { --ch-accent: #7c3aed; --ch-dark: #4c1d95; --ch-mid: #6d28d9; } /* Violet */
.ch-color-14 { --ch-accent: #9333ea; --ch-dark: #581c87; --ch-mid: #7e22ce; } /* Purple */
.ch-color-15 { --ch-accent: #c026d3; --ch-dark: #86198f; --ch-mid: #a21caf; } /* Fuchsia */
.ch-color-16 { --ch-accent: #db2777; --ch-dark: #831843; --ch-mid: #be185d; } /* Pink */
.ch-color-17 { --ch-accent: #e11d48; --ch-dark: #881337; --ch-mid: #be123c; } /* Rose */
.ch-color-18 { --ch-accent: #64748b; --ch-dark: #1e293b; --ch-mid: #475569; } /* Slate */

/* Base card styles — white bg, colored text only, pastel on hover */
.ch-grid-card.ch-subcat-card .ch-card-info {
    background: #fff;
    transition: background 0.25s ease;
}
.ch-grid-card.ch-subcat-card .ch-card-title {
    color: var(--ch-accent, #57534e);
}
.ch-grid-card.ch-subcat-card .ch-subcat-count {
    background: #f1f5f9;
    color: #64748b;
    transition: background 0.25s ease, color 0.25s ease;
}
/* Hover: fill with light pastel */
.ch-grid-card.ch-subcat-card:hover .ch-card-info {
    background: color-mix(in srgb, var(--ch-accent, #78716c) 15%, white);
}
.ch-grid-card.ch-subcat-card:hover .ch-subcat-count {
    background: color-mix(in srgb, var(--ch-accent, #78716c) 30%, white);
    color: var(--ch-mid, #57534e);
}
.ch-grid-card.ch-subcat-card .ch-thumb-placeholder {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--ch-accent, #78716c) 5%, white),
        color-mix(in srgb, var(--ch-accent, #78716c) 25%, white));
    color: var(--ch-accent, #78716c);
}

/* ── Post Cards — Clean Gallery Style ──────────────────────────────── */
/* Article grids: let the coloring page images be the star.
   White footer, subtle text, accent on hover. Subcategory cards keep pastels. */
.ch-grid-card.ch-post-card .ch-card-info {
    background: #fafaf8;
    border-top: 1px solid #eeeee8;
}

.ch-grid-card.ch-post-card .ch-card-title {
    color: #475569;
    font-size: 19px;
    font-weight: 600;
    line-height: 1.35;
}

.ch-grid-card.ch-post-card:hover .ch-card-title {
    color: var(--accent, #482d70);
}

/* Post cards — category accent on subcategory/flat pages (color on grid) */
.ch-post-grid[class*="ch-color-"] .ch-post-card {
    border-bottom: 3px solid color-mix(in srgb, var(--ch-accent, #78716c) 50%, white);
}
.ch-post-grid[class*="ch-color-"] .ch-post-card .ch-card-info {
    background: color-mix(in srgb, var(--ch-accent, #78716c) 6%, white);
    border-top-color: color-mix(in srgb, var(--ch-accent, #78716c) 12%, white);
}
.ch-post-grid[class*="ch-color-"] .ch-post-card .ch-card-title {
    color: var(--ch-dark, #475569);
}
.ch-post-grid[class*="ch-color-"] .ch-post-card:hover .ch-card-title {
    color: var(--ch-accent, #482d70);
}
.ch-post-grid[class*="ch-color-"] .ch-post-card:hover {
    border-bottom-color: var(--ch-accent, #78716c);
}

/* ── Section Headings ───────────────────────────────────────────────── */
.ch-section-heading {
    font-size: 22px;
    font-weight: 700;
    color: var(--contrast-2, #1b1b42);
    margin: 0 0 16px;
}

/* Homepage: centered, larger headings with subtitles */
body.home .ch-section-heading-wrap .ch-section-heading {
    font-size: 28px;
    text-align: center;
    margin-bottom: 8px;
}

.ch-section-subtitle {
    font-size: 16px;
    color: #64748b;
    text-align: center;
    margin: 0;
}

/* ── Sibling Links ──────────────────────────────────────────────────── */
.ch-sibling-links {
    max-width: 1200px;
    margin: 32px auto 0;
    padding: 0 40px;
}

.ch-sibling-links-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.ch-sibling-links-list a {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    background: #f1f5f9;
    color: var(--contrast-2, #1b1b42);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.ch-sibling-links-list a:hover {
    background: var(--accent, #482d70);
    color: #fff;
}

.ch-sibling-links-list a:focus-visible {
    outline: 2px solid var(--accent, #482d70);
    outline-offset: 2px;
}

/* Hub link — same style as siblings, heading provides context */

/* ── Explore More ───────────────────────────────────────────────────── */
.ch-explore-more {
    max-width: 1200px;
    margin: 36px auto 0;
    padding: 24px 40px 0;
    border-top: 1px solid #e5e7eb;
}

.ch-explore-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.ch-explore-links a {
    display: inline-block;
    padding: 9px 20px;
    border-radius: 20px;
    background: #f1f5f9;
    color: var(--contrast-2, #1b1b42);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.ch-explore-links a:hover {
    background: var(--accent, #482d70);
    color: #fff;
}

/* ── Pagination ─────────────────────────────────────────────────────── */
.ch-pagination {
    max-width: 1200px;
    margin: 28px auto 0;
    padding: 0 40px;
    text-align: center;
}

.ch-pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 2px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: var(--contrast-2, #1b1b42);
    background: #f1f5f9;
    transition: background 0.15s ease, color 0.15s ease;
}

.ch-pagination .page-numbers:hover {
    background: #e2e8f0;
}

.ch-pagination .page-numbers.current {
    background: var(--accent, #482d70);
    color: #fff;
}

.ch-pagination .page-numbers.dots {
    background: none;
    cursor: default;
}

.ch-pagination .page-numbers.prev,
.ch-pagination .page-numbers.next {
    font-weight: 400;
}

/* ── Empty State ────────────────────────────────────────────────────── */
.ch-empty-state {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px;
    text-align: center;
    color: #64748b;
}

.ch-empty-state p {
    font-size: 16px;
    margin-bottom: 16px;
}

.ch-empty-state-link {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 6px;
    background: var(--accent, #482d70);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.ch-empty-state-link:hover {
    opacity: 0.9;
}

/* ── Homepage: 4-column grid (category pages stay 3-col) ──────────── */
body.home .ch-subcat-grid {
    grid-template-columns: repeat(4, 1fr);
}

body.home .ch-card-title {
    font-size: 17px;
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .ch-subcat-grid,
    .ch-post-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 0 16px;
    }

    .ch-sibling-links,
    .ch-explore-more,
    .ch-pagination,
    .ch-empty-state {
        padding-left: 16px;
        padding-right: 16px;
    }


    .ch-card-info {
        padding: 10px 10px;
    }

    .ch-card-title {
        font-size: 16px;
    }

    .ch-grid-card.ch-post-card .ch-card-title {
        font-size: 16px;
    }

    .ch-subcat-count {
        font-size: 12px;
    }

    .ch-section-heading {
        font-size: 18px;
    }

    body.home .ch-section-heading-wrap .ch-section-heading {
        font-size: 22px;
    }

    .ch-section-subtitle {
        font-size: 16px;
    }

    body.home .ch-subcat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    body.home .ch-card-title {
        font-size: 16px;
    }

    .ch-section-heading-wrap {
        padding: 0 16px;
    }

    .ch-footer-text {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Sidebar stacks below content on mobile — add breathing room */
    #right-sidebar {
        margin-top: 40px;
    }

}

/* Small phones */
@media (max-width: 480px) {
    .ch-subcat-grid,
    .ch-post-grid {
        gap: 16px;
        padding: 0 12px;
    }

    .ch-thumb-placeholder {
        font-size: 1.8rem;
    }

    .ch-card-info {
        padding: 6px 6px;
    }
}

/* ── Homepage Section Spacing ──────────────────────────────────────── */
.ch-homepage-section {
    margin-top: 24px;  /* was 48px — tightened after wave removal */
}

.ch-section-heading-wrap {
    max-width: 1200px;
    margin: 0 auto 16px;
    padding: 0 40px;
}

/* Homepage: match section gap above with heading gap below */
body.home .ch-section-heading-wrap {
    margin-bottom: 24px;  /* was 48px — matches reduced section margin-top */
}

/* ── App Promo (Homepage Section 5) ────────────────────────────────── */
.ch-app-promo-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    align-items: center;
}

.ch-app-promo-text p {
    font-size: 17px;
    line-height: 1.65;
    color: #475569;
    margin: 12px 0 0;
}

.ch-app-promo-video iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 14px;
    border: none;
}

@media (max-width: 1024px) {
    .ch-app-promo-inner {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 0 16px;
    }
}


/* ── Footer Text (Homepage Section 6) ──────────────────────────────── */
.ch-footer-text {
    max-width: 1200px;
    margin: 48px auto 0;
    padding: 24px 40px 0;
    border-top: 1px solid #e5e7eb;
}

.ch-footer-text p {
    font-size: 16px;
    line-height: 1.7;
    color: #475569;
    max-width: 800px;
    margin: 0 auto 12px;
    text-align: center;
}

.ch-footer-text p:last-child {
    margin-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════════════════
   Post Page Widgets (single posts)
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Download/Print Collapsible Widget ─────────────────────────────── */
.ch-download-widget {
    margin: 0 0 16px;
    border: 1px solid color-mix(in srgb, var(--ch-accent, #64748b) 25%, #e2e8f0);
    border-left: 3px solid var(--ch-accent, #64748b);
    border-radius: 8px;
    background: color-mix(in srgb, var(--ch-accent, #64748b) 5%, white);
    overflow: hidden;
}

.ch-download-widget summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    font-size: 16px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.ch-download-widget summary::-webkit-details-marker {
    display: none;
}

.ch-download-widget summary::after {
    content: "\25BC"; /* ▼ */
    font-size: 11px;
    color: #94a3b8;
    transition: transform 0.2s ease;
}

.ch-download-widget[open] summary::after {
    transform: rotate(180deg);
}

.ch-download-body {
    padding: 0 14px 12px;
    font-size: 15px;
    line-height: 1.5;
    color: #475569;
}

.ch-download-body p {
    margin: 0 0 8px;
}

.ch-download-body ol {
    margin: 0 0 8px;
    padding-left: 20px;
}

.ch-download-body li {
    margin-bottom: 4px;
}

.ch-download-tip {
    font-size: 16px;
    color: #64748b;
    margin-bottom: 0 !important;
}

/* ── H12: Within-Article CTA ──────────────────────────────────────── */
.ch-article-cta {
    margin: 20px 0;
    padding: 14px 20px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--ch-accent, #64748b) 8%, white);
    border-left: 3px solid var(--ch-accent, #64748b);
}

.ch-article-cta p {
    margin: 0;
    font-size: 19px;
    line-height: 1.5;
    color: #334155;
}

.ch-article-cta a {
    color: var(--ch-accent, #482d70);
    font-weight: 600;
    text-decoration: none;
}

.ch-article-cta a:hover {
    text-decoration: underline;
}

/* ── Widget Wrapper ────────────────────────────────────────────────── */
.ch-widgets-wrap {
    margin: 16px 0 0;
}

/* ── H13/H14: Below-Article Widgets ───────────────────────────────── */
.ch-widget {
    margin: 36px 0 0;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.ch-widget-heading {
    font-size: 22px;
    font-weight: 700;
    color: var(--contrast-2, #1b1b42);
    margin: 0 0 16px;
}

.ch-widget-heading a {
    color: inherit;
    text-decoration: none;
}

.ch-widget-heading a:hover {
    color: var(--accent, #482d70);
}

.ch-widget-grid {
    max-width: none;
    padding: 0;
    grid-template-columns: repeat(3, 1fr);
}

/* Widget post cards inherit colored accents from .ch-color-N on the grid wrapper.
   Same bottom border + tinted card-info as subcategory pages. */

.ch-widget-b-group {
    margin-bottom: 24px;
}

.ch-widget-b-group:last-child {
    margin-bottom: 0;
}

.ch-widget-subheading {
    font-size: 19px;
    font-weight: 600;
    color: #475569;
    margin: 0 0 12px;
}

.ch-widget-subheading a {
    color: inherit;
    text-decoration: none;
}

.ch-widget-subheading a:hover {
    color: var(--accent, #482d70);
}

/* ── H15: Sidebar Widget ──────────────────────────────────────────── */

/* Override GP's inner-padding on sidebar widget.
   GP applies ~30px 20px via high-specificity rule — !important needed.
   Wrapped in subtle card to read as self-contained unit. */
.widget_ch_sidebar_widget.inner-padding {
    padding: 10px 20px 10px !important;
    background: color-mix(in srgb, var(--accent, #482d70) 4%, white);
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--accent, #482d70) 15%, #e5e7eb);
}

.ch-sidebar-section {
    margin-bottom: 10px;
}

.ch-sidebar-section:last-child {
    margin-bottom: 0;
}

.ch-sidebar-heading {
    font-size: 19px;
    font-weight: 700;
    color: var(--contrast-2, #1b1b42);
    margin: 0 0 10px;
    padding: 0;
}

.ch-sidebar-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.ch-sidebar-item {
    margin: 0;
}

.ch-sidebar-item a {
    display: block;
    text-decoration: none;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ch-sidebar-item a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ch-sidebar-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

.ch-sidebar-item-name {
    display: block;
    padding: 8px 10px;
    font-size: 17px;
    font-weight: 600;
    color: var(--ch-accent, #475569);
    line-height: 1.3;
    text-align: center;
    background: color-mix(in srgb, var(--ch-accent, #78716c) 6%, white);
}

.ch-sidebar-item a:hover .ch-sidebar-item-name {
    color: var(--ch-dark, #1e293b);
}

/* ── Post Widget Responsive ────────────────────────────────────────── */
@media (max-width: 1024px) {
    .ch-widget-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .ch-widget-heading {
        font-size: 18px;
    }

    .ch-widget-subheading {
        font-size: 19px;
    }

    .ch-article-cta {
        margin: 16px 0;
        padding: 12px 16px;
    }

    .ch-article-cta p {
        font-size: 17px;
    }
}

@media (max-width: 480px) {
    .ch-widget-grid {
        gap: 8px;
    }

    .ch-download-widget summary {
        padding: 7px 12px;
        font-size: 15px;
    }

    .ch-download-body {
        padding: 0 12px 10px;
        font-size: 14px;
    }
}

/* ── GP Spacing Overrides (single posts) ─────────────────────────── */
/* Reduce GP's default site-content padding — hero PB handles the gap now */
body.single .site-content {
    padding-top: 20px !important;
}

/* GP .one-container:not(.page) .inside-article adds 30px bottom padding;
   .site-content adds another 40px. Remove article padding when widgets fill
   the bottom, so there's no double-gap before the footer. */
body.single .inside-article {
    padding-bottom: 0;
}

/* ── 404 Page ──────────────────────────────────────────────────────── */
body.error404 .site-content {
    padding: 0 !important;
    display: block !important;
    max-width: 100% !important;
}
body.error404 #primary {
    margin: 0;
    width: 100% !important;
    max-width: 100% !important;
}
body.error404 #right-sidebar,
body.error404 .sidebar {
    display: none !important;
}
body.error404 .inside-article,
body.error404 .entry-header,
body.error404 .entry-content {
    display: none;
}

.ch-404-wrap {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    text-align: center;
    padding: 158px 20px 48px;  /* top = header clearance (133px header + 25px gap) */
    overflow: hidden;
}
.ch-404-inner {
    position: relative;
    z-index: 1;
    max-width: 620px;
    width: 100%;
}

/* ── Floating decorations ──────────────────────────────────────────── */
.ch-404-deco {
    position: absolute;
    pointer-events: none;
    z-index: 0;
}
.ch-404-deco-1 { top: 8%; left: 6%; width: 50px; animation: ch-float 6s ease-in-out infinite; }
.ch-404-deco-2 { top: 18%; right: 8%; width: 36px; animation: ch-float 5s ease-in-out 1s infinite; }
.ch-404-deco-3 { bottom: 22%; left: 10%; width: 44px; animation: ch-float 7s ease-in-out 0.5s infinite; }
.ch-404-deco-4 { bottom: 30%; right: 6%; width: 38px; animation: ch-float 5.5s ease-in-out 1.5s infinite; }
.ch-404-deco-5 { top: 50%; left: 18%; width: 30px; animation: ch-float 6.5s ease-in-out 2s infinite; }
@keyframes ch-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-12px) rotate(8deg); }
}

/* ── 404 hero: "404" digits + crayon ───────────────────────────────── */
.ch-404-hero {
    position: relative;
    display: inline-flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 12px;
}
.ch-404-number {
    font-size: clamp(110px, 20vw, 160px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    display: flex;
    user-select: none;
}
.ch-404-digit {
    display: inline-block;
    -webkit-text-stroke: 3.5px currentColor;
    paint-order: stroke fill;
    transition: transform 0.3s ease;
}
.ch-404-digit:hover {
    transform: scale(1.08) rotate(-3deg);
}
.ch-404-d1 {
    color: rgba(220, 38, 38, 0.12);
    -webkit-text-stroke-color: #dc2626;
    filter: drop-shadow(2px 3px 0 rgba(220, 38, 38, 0.15));
}
.ch-404-d2 {
    color: rgba(109, 40, 217, 0.12);
    -webkit-text-stroke-color: #6d28d9;
    filter: drop-shadow(2px 3px 0 rgba(109, 40, 217, 0.15));
}
.ch-404-d3 {
    color: rgba(37, 99, 235, 0.12);
    -webkit-text-stroke-color: #2563eb;
    filter: drop-shadow(2px 3px 0 rgba(37, 99, 235, 0.15));
}

/* ── Crayon character ──────────────────────────────────────────────── */
.ch-404-crayon {
    width: 44px;
    flex-shrink: 0;
    transform: rotate(-12deg);
    transform-origin: 50% 95%;
    animation: ch-crayon-rock 3.5s ease-in-out infinite;
    margin-bottom: 8px;
    filter: drop-shadow(1px 2px 3px rgba(109, 40, 217, 0.25));
}
@keyframes ch-crayon-rock {
    0%, 100% { transform: rotate(-12deg); }
    50% { transform: rotate(8deg); }
}

/* ── Scribble ──────────────────────────────────────────────────────── */
.ch-404-scribble {
    position: absolute;
    bottom: -4px;
    right: 2px;
    width: 60px;
    opacity: 0.25;
}

/* ── 404 text ──────────────────────────────────────────────────────── */
.ch-404-title {
    font-size: clamp(24px, 4vw, 30px);
    font-weight: 700;
    color: var(--contrast-2, #1b1b42);
    margin: 0 0 8px;
    line-height: 1.3;
}
.ch-404-subtitle {
    font-size: clamp(15px, 2.5vw, 17px);
    color: #64748b;
    margin: 0 0 26px;
    line-height: 1.55;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

/* ── 404 search bar ────────────────────────────────────────────────── */
.ch-404-search {
    max-width: 480px;
    margin: 0 auto 24px;
}
.ch-404-search form {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 47px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.ch-404-search form:focus-within {
    border-color: var(--accent, #482d70);
    box-shadow: 0 2px 12px rgba(109, 40, 217, 0.15);
}
.ch-404-search input[type="search"] {
    flex: 1;
    border: none;
    padding: 14px 24px;
    font-size: 16px;
    font-family: inherit;
    color: var(--contrast-2, #1b1b42);
    background: transparent;
    outline: none;
}
.ch-404-search input[type="search"]::placeholder {
    color: #94a3b8;
}
.ch-404-search button {
    background: transparent;
    border: none;
    padding: 12px 20px 12px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color 0.2s, transform 0.2s;
    color: #64748b;
}
.ch-404-search button:hover {
    color: var(--accent, #482d70);
    transform: scale(1.1);
}
.ch-404-search button svg {
    width: 22px;
    height: 22px;
}

/* ── 404 category pills ───────────────────────────────────────────── */
.ch-404-browse {
    font-size: 13px;
    color: #94a3b8;
    margin: 0 0 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.ch-404-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}
.ch-404-pill {
    display: inline-block;
    padding: 9px 20px;
    border-radius: 22px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: ch-pill-in 0.4s ease both;
}
@keyframes ch-pill-in {
    from { opacity: 0; transform: translateY(8px) scale(0.92); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.ch-404-pill:hover,
.ch-404-pill:focus-visible {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
    color: #fff;
}
.ch-404-pill:focus-visible {
    outline: 2px solid var(--accent, #482d70);
    outline-offset: 2px;
}

/* ── 404 responsive ────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .ch-404-wrap {
        padding: 112px 16px 36px;  /* top = mobile header clearance */
    }
    .ch-404-deco { display: none; }
    .ch-404-hero {
        gap: 6px;
        margin-bottom: 8px;
    }
    .ch-404-crayon { width: 32px; }
    .ch-404-scribble { width: 42px; }
    .ch-404-title {
        font-size: 22px;
        margin-bottom: 6px;
    }
    .ch-404-subtitle {
        font-size: 15px;
        margin-bottom: 18px;
    }
    .ch-404-search {
        margin-bottom: 18px;
    }
    .ch-404-pills {
        gap: 8px;
    }
    .ch-404-pill {
        padding: 7px 14px;
        font-size: 13px;
    }
}

/* ── Search No-Results Page ─────────────────────────────────────────── */

.ch-search-none-wrap {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    text-align: center;
    padding: 16px 20px 32px;
}
.ch-search-none-inner {
    max-width: 620px;
    width: 100%;
}

/* ── Personified magnifying glass hero ────────────────────────────── */
.ch-search-none-hero {
    margin-bottom: 8px;
}
.ch-search-none-glass {
    width: clamp(56px, 10vw, 72px);
    height: auto;
    animation: ch-glass-bob 4s ease-in-out infinite;
    filter: drop-shadow(2px 3px 6px rgba(109, 40, 217, 0.18));
}
@keyframes ch-glass-bob {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(4deg); }
}

/* ── Search no-results text ────────────────────────────────────────── */
.ch-search-none-title {
    font-size: clamp(22px, 4vw, 28px);
    font-weight: 700;
    color: var(--contrast-2, #1b1b42);
    margin: 0 0 8px;
    line-height: 1.3;
}
.ch-search-none-subtitle {
    font-size: clamp(15px, 2.5vw, 17px);
    color: #64748b;
    margin: 0 auto 26px;
    line-height: 1.55;
    max-width: 480px;
}

/* ── Search no-results responsive ──────────────────────────────────── */
@media (max-width: 1024px) {
    .ch-search-none-wrap {
        padding: 8px 16px 24px;
    }
    .ch-search-none-glass {
        width: 50px;
    }
    .ch-search-none-title {
        font-size: 20px;
        margin-bottom: 6px;
    }
    .ch-search-none-subtitle {
        font-size: 15px;
        margin-bottom: 18px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   Site Footer (GP Element — dark navy section)
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Footer layout — single flex column, uniform gap ─────────────── */
.ch-footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
    padding: 72px 24px 20px;
}
.ch-footer-logo {
    display: block;
    height: 36px;
    width: auto;
    filter: brightness(0) invert(1);
    opacity: 0.85;
}
.ch-footer-brand-name {
    font-size: 20px;
    font-weight: 700;
    color: rgba(255,255,255,0.65);
    margin: 0;
    letter-spacing: 0.01em;
}
.ch-footer-social {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}
.ch-footer-social a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: 50px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.2s;
}
.ch-footer-social a:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}
.ch-footer-social a:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}
.ch-footer-social a svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.ch-social-pinterest  { background: #E60023; }
.ch-social-facebook   { background: #1877F2; }
.ch-social-instagram  { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.ch-social-youtube    { background: #FF0000; }

/* ── Browse links ─────────────────────────────────────────────────── */
.ch-footer-browse-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: 17px;
    line-height: 1.9;
}
.ch-footer-browse-links a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: color 0.15s;
}
.ch-footer-browse-links a:hover,
.ch-footer-browse-links a:focus-visible {
    color: #ffffff;
}
.ch-footer-browse-links a:focus-visible {
    outline: 2px solid rgba(255,255,255,0.5);
    outline-offset: 2px;
    border-radius: 2px;
}
.ch-footer-browse-links .ch-sep {
    color: rgba(255,255,255,0.25);
    user-select: none;
}

/* ── Divider ──────────────────────────────────────────────────────── */
.ch-footer-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    width: 100%;
    max-width: 720px;
    margin: 0;
}

/* ── Legal section ────────────────────────────────────────────────── */
.ch-footer-legal {
    font-size: 16px;
    line-height: 1.7;
    color: rgba(255,255,255,0.65);
}
.ch-footer-legal p {
    margin: 0 0 6px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}
.ch-footer-legal .ch-footer-affiliate {
    font-size: 16px;
}
.ch-footer-legal .ch-footer-sister {
    margin-top: 4px;
    font-size: 17px;
}
.ch-footer-legal .ch-footer-sister a {
    white-space: nowrap;
    color: rgba(255,255,255,0.85);
    text-decoration: underline;
    text-decoration-color: rgba(255,255,255,0.35);
    text-underline-offset: 3px;
}
.ch-footer-legal a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: color 0.15s;
}
.ch-footer-legal a:hover,
.ch-footer-legal a:focus-visible {
    color: #ffffff;
}
.ch-footer-legal a:focus-visible {
    outline: 2px solid rgba(255,255,255,0.5);
    outline-offset: 2px;
    border-radius: 2px;
}
.ch-footer-legal .ch-sep {
    color: rgba(255,255,255,0.2);
    user-select: none;
    margin: 0 3px;
}

/* ── Bottom links ─────────────────────────────────────────────────── */
.ch-footer-bottom-links {
    font-size: 16px;
}
.ch-footer-bottom-links a {
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    transition: color 0.15s;
}
.ch-footer-bottom-links a:hover,
.ch-footer-bottom-links a:focus-visible {
    color: #ffffff;
}
.ch-footer-bottom-links a:focus-visible {
    outline: 2px solid rgba(255,255,255,0.5);
    outline-offset: 2px;
    border-radius: 2px;
}
.ch-footer-bottom-links .ch-sep {
    color: rgba(255,255,255,0.2);
    user-select: none;
    margin: 0 6px;
}

/* ── Footer mobile ────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .ch-footer-inner {
        gap: 16px;
        padding: 52px 16px 16px;
    }
    .ch-footer-logo {
        height: 30px;
    }
    .ch-footer-social {
        gap: 8px;
    }
    .ch-footer-social a {
        padding: 10px 20px;
        font-size: 16px;
        gap: 8px;
    }
    .ch-footer-social a svg {
        width: 18px;
        height: 18px;
    }
    .ch-footer-browse-links {
        gap: 4px 6px;
        font-size: 16px;
    }
    .ch-footer-legal {
        font-size: 16px;
    }
    .ch-footer-legal .ch-footer-affiliate {
        font-size: 16px;
    }
    .ch-footer-legal .ch-footer-sister {
        font-size: 16px;
    }
    .ch-footer-bottom-links {
        font-size: 16px;
    }
}

/* ── Print ──────────────────────────────────────────────────────────── */
@media print {
    .ch-explore-more,
    .ch-sibling-links,
    .ch-pagination,
    .ch-empty-state,
    .ch-widgets-wrap,
    .ch-widget,
    .ch-download-widget,
    .ch-article-cta {
        display: none;
    }
}
