/*
Theme Name: GeneratePress Child - CompanionWise
Theme URI: https://companionwise.com
Template: generatepress
Description: CompanionWise child theme for GeneratePress.
Author: CompanionWise
Author URI: https://companionwise.com
Version: 2.1.0
*/

/* ==========================================================================
   Experience Score — Visual Hierarchy
   RULE: .cw-safety-score > .cw-experience-score — ALWAYS
   Safety: 2rem, Experience: 1rem (half the size)
   ========================================================================== */

.cw-experience-score-meta {
    font-size: 0.75rem;
    color: var(--cw-text-muted, #6b7280);
    font-weight: 400;
    display: block;
    margin-top: 0.25rem;
}

.cw-experience-score__grade {
    font-size: 1rem; /* safety grade = 2rem — experience is 1rem (half) */
    font-weight: 600;
    background-color: var(--cw-surface-muted, #f3f4f6);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    margin-right: 0.5rem;
}

.cw-experience-score__public-score {
    font-size: 0.875rem;
    color: var(--cw-text-muted, #6b7280);
}

.cw-experience-score__summary {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.cw-experience-score__helper {
    font-size: 0.8rem;
    color: var(--cw-text-muted, #6b7280);
    margin-bottom: 1rem;
}

.cw-experience-score__dims-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.cw-experience-score__dims-table th,
.cw-experience-score__dims-table td {
    text-align: left;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--cw-border, #e5e7eb);
}

.cw-experience-score__bar-track {
    background-color: var(--cw-surface-muted, #f3f4f6);
    border-radius: 2px;
    height: 8px;
    width: 100%;
    min-width: 80px;
}

.cw-experience-score__bar-fill {
    background-color: var(--cw-text-muted, #6b7280);
    border-radius: 2px;
    height: 100%;
}

.cw-experience-score--null .cw-experience-score__coming-soon {
    color: var(--cw-text-muted, #6b7280);
    font-style: italic;
    font-size: 0.875rem;
}

/* Value for Money — separated unweighted display */
.cw-experience-score__value-aside {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--cw-border, #e5e7eb);
}
.cw-experience-score__value-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}
.cw-experience-score__value-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--cw-text-muted, #6b7280);
}
.cw-experience-score__value-note {
    font-style: italic;
    font-size: 0.6875rem;
    color: var(--cw-text-muted, #9ca3af);
}
.cw-experience-score__value-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.cw-experience-score__value-score {
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 55px;
    color: var(--cw-text-muted, #6b7280);
}


/* ==========================================================================
   Story 9.4 — Breadcrumb Polish (unified CSS)
   ========================================================================== */

.cw-breadcrumbs {
    font-size: 0.8125rem;
    color: var(--cw-text-secondary);
    margin-bottom: var(--cw-space-4);
}
.cw-breadcrumbs ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0;
    margin: 0;
}
.cw-breadcrumbs li::after {
    content: '\203A';
    margin-left: 0.25rem;
    color: var(--cw-text-muted);
}
.cw-breadcrumbs li:last-child::after {
    content: '';
}
.cw-breadcrumbs a {
    color: var(--cw-text-secondary);
    text-decoration: none;
}
.cw-breadcrumbs a:hover {
    color: var(--cw-primary-dark);
    text-decoration: underline;
}


/* ==========================================================================
   Story 9.1 — Key Takeaways Styled Box
   ========================================================================== */

.cw-key-takeaways {
    background-color: #FFF8E7;
    border-radius: var(--cw-radius-md);
    padding: var(--cw-space-6);
    margin: var(--cw-space-6) 0;
}
.cw-key-takeaways__heading {
    font-family: var(--cw-font-display);
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0 0 var(--cw-space-3) 0;
    color: var(--cw-text-primary);
}
.cw-key-takeaways ul {
    margin: 0;
    padding-left: 1.25rem;
}
.cw-key-takeaways li {
    margin-bottom: var(--cw-space-2);
    line-height: 1.6;
}


/* ==========================================================================
   Story 9.2 — Author Byline
   ========================================================================== */

.cw-byline {
    display: flex;
    flex-wrap: wrap;
    gap: var(--cw-space-3);
    align-items: center;
    padding: var(--cw-space-4) 0;
    border-bottom: 1px solid var(--cw-border);
    margin-bottom: var(--cw-space-6);
    font-size: 0.875rem;
    color: var(--cw-text-secondary);
}
.cw-byline__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.cw-byline__avatar--team {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    overflow: visible;
}
.cw-byline__avatar--team svg {
    width: 40px;
    height: 40px;
}
.cw-byline__credits {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.cw-byline__author {
    font-weight: 600;
    color: var(--cw-text-primary);
    line-height: 1.35;
}
.cw-byline__editor {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    line-height: 1.35;
}
.cw-byline__editor-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.cw-byline__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--cw-space-2);
    margin-left: auto;
}
.cw-byline__separator {
    color: var(--cw-text-muted);
}
.cw-byline__badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--cw-success-text, #065F46);
    background: var(--cw-success-light, #D1FAE5);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.cw-byline__badge::before {
    content: '\2713';
    font-weight: 700;
}

@media (max-width: 768px) {
    .cw-byline__meta {
        margin-left: 0;
        width: 100%;
    }
}


/* ==========================================================================
   Story 9.3 — Quiz CTA Banner
   ========================================================================== */

.cw-quiz-cta-banner {
    background-color: var(--cw-primary-dark, #0F766E);
    color: var(--cw-text-inverted, #ffffff);
    padding: var(--cw-space-8) var(--cw-space-6);
    border-radius: var(--cw-radius-md);
    margin: var(--cw-space-8) 0;
    text-align: left;
}
.cw-quiz-cta-banner__heading {
    font-family: var(--cw-font-display);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 var(--cw-space-2) 0;
    color: var(--cw-primary-light, #CCFBF1);
}
.cw-quiz-cta-banner__text {
    font-size: 1rem;
    margin: 0 0 var(--cw-space-4) 0;
    opacity: 0.9;
}
.cw-btn--inverted {
    background: white;
    color: var(--cw-primary-dark, #0F766E);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: var(--cw-space-3) var(--cw-space-6);
    border-radius: var(--cw-radius-sm);
    text-decoration: none;
    display: inline-block;
}
.cw-btn--inverted:hover {
    background: var(--cw-primary-light, #CCFBF1);
}
.cw-quiz-cta-banner__trust {
    font-size: 0.8rem;
    margin: var(--cw-space-2) 0 0 0;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .cw-quiz-cta-banner__btn {
        width: 100%;
    }
}


/* ==========================================================================
   Mobile Responsiveness Fix — cw_review pages
   Root cause: .cw-review in design-system.css has no padding-left/right,
   and .cw-page-review .inside-article padding was zeroed.
   Fix applied in child theme to avoid editing server design-system.css.
   ========================================================================== */

/* Add horizontal padding and prevent horizontal scroll */
.cw-review {
    padding-left: var(--cw-space-4, 16px);
    padding-right: var(--cw-space-4, 16px);
    box-sizing: border-box;
    overflow-x: hidden;
    max-width: 100%;
}

/* Zero out GP's .site-content container padding on all CPT pages —
   GP adds 30px padding which shifts content right, causing overflow.
   Let .cw-review / .cw-container handle their own padding instead.
   max-width: none overrides GP's 1170px cap so .cw-container controls width. */
.cw-page-review > .site-content,
.cw-page-review .site-content,
.cw-page-bestof > .site-content,
.cw-page-bestof .site-content,
.cw-page-guide > .site-content,
.cw-page-guide .site-content,
.cw-page-faq > .site-content,
.cw-page-faq .site-content,
.cw-page-comparison > .site-content,
.cw-page-comparison .site-content {
    padding-left: 0;
    padding-right: 0;
    overflow-x: hidden;
    max-width: none;
}

.cw-page-review .inside-article,
.cw-page-bestof .inside-article,
.cw-page-guide .inside-article,
.cw-page-faq .inside-article,
.cw-page-comparison .inside-article {
    overflow-x: hidden;
    padding: 0;
}

/* Prevent text overflow on all review content sections */
.cw-review__bottom-line,
.cw-review__content,
.cw-review__safety-widget,
.cw-review__experience-score,
.cw-review__audience,
.cw-review__pros-cons,
.cw-review__competition {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Mobile-specific refinements for 375px and similar viewports */
@media (max-width: 767px) {
    .cw-review {
        padding-left: var(--cw-space-4, 16px);
        padding-right: var(--cw-space-4, 16px);
    }

    .cw-review__bottom-line-text {
        font-size: var(--cw-text-sm, 16px);
    }

    .cw-review__safety-widget-inner {
        flex-direction: column;
        gap: var(--cw-space-4, 16px);
    }

    .cw-review__competition-grid {
        grid-template-columns: 1fr;
    }
}

/* Fully clickable competition cards (linked state) */
.cw-review__competition-card--linked {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s, transform 0.1s;
    cursor: pointer;
}
.cw-review__competition-card--linked:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}
.cw-review__competition-card--linked:active {
    transform: translateY(0);
}
.cw-review__competition-card--linked .cw-review__competition-link {
    color: #0B8578;
    font-weight: 600;
    font-size: 0.875rem;
}
.cw-review__competition-card--linked:hover .cw-review__competition-link {
    text-decoration: underline;
}


/* ==========================================================================
   Story 3.1 — Evidence Summary + How We Scored narrative sections
   ========================================================================== */

.cw-safety-page__evidence-summary,
.cw-safety-page__methodology {
    background-color: var(--cw-surface, #ffffff);
    border-radius: var(--cw-radius-md, 8px);
    box-shadow: var(--cw-shadow-sm);
    padding: var(--cw-space-6, 24px);
    margin-bottom: var(--cw-space-6, 24px);
}

.cw-safety-page__narrative {
    font-size: var(--cw-text-body, 18px);
    line-height: 1.7;
    color: var(--cw-text-primary);
}

.cw-safety-page__narrative p {
    margin-bottom: var(--cw-space-4, 16px);
}

.cw-safety-page__narrative p:last-child {
    margin-bottom: 0;
}

.cw-safety-page__narrative ul,
.cw-safety-page__narrative ol {
    padding-left: 1.25rem;
    margin-bottom: var(--cw-space-4, 16px);
}

.cw-safety-page__narrative li {
    margin-bottom: var(--cw-space-2, 8px);
}

/* Safety Score label above the /100 number */
.cw-safety-page__score-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cw-text-secondary, #6b7280);
    margin-bottom: 0.25rem;
}


/* ==========================================================================
   Story 6-3 — Quiz Results: Share & Retake Section
   ========================================================================== */

.cw-quiz-results__actions {
    text-align: center;
    padding: var(--cw-space-8, 32px) 0;
    margin-top: var(--cw-space-6, 24px);
    border-top: 1px solid var(--cw-border, #e5e7eb);
}

.cw-quiz-results__share {
    margin-bottom: var(--cw-space-6, 24px);
}

.cw-quiz-results__share-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--cw-text-primary, #1F2937);
    margin: 0 0 var(--cw-space-4, 16px) 0;
}

.cw-quiz-results__share-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--cw-space-3, 12px);
}

.cw-btn--share {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cw-text-secondary, #6B7280);
    background-color: var(--cw-surface, #ffffff);
    border: 1px solid var(--cw-border, #e5e7eb);
    border-radius: var(--cw-radius-sm, 6px);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    line-height: 1;
}

.cw-btn--share:hover {
    background-color: var(--cw-surface-muted, #f3f4f6);
    border-color: var(--cw-primary, #4F46E5);
    color: var(--cw-primary, #4F46E5);
}

.cw-btn--share:focus-visible {
    outline: 2px solid var(--cw-primary, #4F46E5);
    outline-offset: 2px;
}

.cw-btn--share svg {
    flex-shrink: 0;
}

.cw-btn--share-copied {
    background-color: var(--cw-success-light, #D1FAE5);
    border-color: var(--cw-success-text, #065F46);
    color: var(--cw-success-text, #065F46);
}

/* Retake button spacing */
.cw-quiz-results__actions > .cw-btn--outline {
    display: inline-block;
}

@media (max-width: 480px) {
    .cw-quiz-results__share-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .cw-btn--share {
        justify-content: center;
    }
}

/* ==========================================================================
   Homepage Latest App Reviews — Card Image
   ========================================================================== */

.cw-review-excerpt__img {
    margin: -1.25rem -1.25rem 1rem -1.25rem; /* bleed to card edges */
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    position: relative;
}

.cw-review-excerpt__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 0;
}


/* ==========================================================================
   Homepage Review Cards — Interaction & Border Fixes
   ========================================================================== */

/* Remove tier-based left border from homepage cards */
.cw-review-excerpt {
    border-left: none !important;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

/* Hover lift effect */
.cw-review-excerpt:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.10);
}

/* Invisible overlay link covers the whole card */
.cw-review-excerpt__overlay-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

/* Keep text links clickable above the overlay */
.cw-review-excerpt .cw-link--teal {
    position: relative;
    z-index: 2;
}


/* ==========================================================================
   Homepage Review Cards — Enhancements (pill, icon overlay)
   ========================================================================== */

/* "Review" type label pill */
.cw-review-excerpt__type-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cw-primary-dark, #0d6e64);
    background: rgba(13, 110, 100, 0.10);
    padding: 2px 9px;
    border-radius: 20px;
    margin-bottom: 3px;
}

/* App icon badge overlaid on card image */
.cw-review-excerpt__img-icon {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    background: #fff;
    z-index: 2;
}

.cw-review-excerpt__img-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}


/* ==========================================================================
   Global: prevent horizontal scroll caused by CKY cookie plugin
   Root cause: .cky-preference-center is position:static at 845px with
   visibility:hidden but display:flex — expands document body beyond viewport,
   which in turn causes block-level layout calculations to use 836px+ widths
   instead of the 375px viewport. overflow-x:clip (not hidden) avoids
   breaking position:fixed elements.
   ========================================================================== */

body {
    overflow-x: clip;
}

/* Constrain the CKY panel itself so it can't contribute to layout width */
.cky-preference-center {
    max-width: 100vw !important;
    box-sizing: border-box !important;
}

/* ==========================================================================
   Reviews Hub — Quiz banner CTA button: use teal (primary), not violet (accent)
   Same override pattern as .cw-quiz .cw-btn--accent in design-system.css
   ========================================================================== */
.cw-reviews-hub__quiz-banner .cw-btn--accent {
    background-color: var(--cw-primary)      !important;
    border-color:     var(--cw-primary)      !important;
}
.cw-reviews-hub__quiz-banner .cw-btn--accent:hover {
    background-color: var(--cw-primary-dark) !important;
    border-color:     var(--cw-primary-dark) !important;
}

/* ==========================================================================
   Reviews Hub — Mobile layout fix
   ========================================================================== */

/* GP double-padding fix: both div.site-content (GP wrapper) and
   main.site-content.cw-reviews-hub have the .site-content class and
   both get 30px L/R padding, leaving only 223px of grid space in a
   375px viewport. Zero both out on this page; .cw-container still
   provides 16px L/R inner padding for readable content margins. */
body.cw-page-reviews-hub .site-content {
    padding-left: 0;
    padding-right: 0;
}

/* Force hub grid and cards to stay within viewport */
.cw-reviews-hub .cw-container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* CSS Grid gotcha: 1fr has implicit min of auto (content width).
   minmax(0, 1fr) sets min to 0 so the column shrinks to container width. */
.cw-reviews-hub__grid {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
}

.cw-app-card {
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

/* Prevent card text and identity block from overflowing.
   NOTE: .cw-app-card__name is intentionally excluded — it uses
   white-space:nowrap + text-overflow:ellipsis and word-break would
   cause character-level line breaks in compressed layouts. */
.cw-app-card__identity,
.cw-app-card__tagline,
.cw-app-card__excerpt {
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

@media (max-width: 767px) {
    .cw-reviews-hub__title {
        font-size: 1.75rem;
    }

    .cw-reviews-hub__intro {
        max-width: 100%;
    }
}


/* ==========================================================================
   Safety Rating Page — Mobile polish
   ========================================================================== */

/* Title: hide "Index" suffix on mobile — saves space, context is clear from URL/breadcrumb */
@media (max-width: 767px) {
    .cw-safety-page__title-suffix {
        display: none;
    }

    /* Tighten section heading size on small screens */
    .cw-safety-page__section-heading {
        font-size: 1.25rem;
        margin-bottom: var(--cw-space-4, 16px);
    }

    /* Reduce body text size inside narrative blocks for readability */
    .cw-safety-page__narrative {
        font-size: 1rem;
        line-height: 1.65;
    }

    /* Tighten card padding further on very small viewports */
    .cw-safety-page__header {
        padding: var(--cw-space-4, 16px);
    }
}

/* Review cross-link aside — styled as a teal CTA strip */
.cw-safety-page__review-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--cw-space-3, 12px);
    background: var(--cw-primary-pale, #F0FDFA);
    border: 1px solid var(--cw-primary-light, #CCFBF1);
    border-radius: var(--cw-radius-md, 8px);
    padding: var(--cw-space-4, 16px) var(--cw-space-6, 24px);
    margin-bottom: var(--cw-space-8, 32px);
}

.cw-safety-page__review-link .cw-experience-score-meta {
    font-size: 0.8125rem;
    color: var(--cw-primary-darker, #115E59);
    font-weight: 600;
    display: block;
    margin: 0;
}

.cw-safety-page__review-link-anchor {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--cw-primary-dark, #0F766E);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.cw-safety-page__review-link-anchor:hover {
    color: var(--cw-primary-darker, #115E59);
    text-decoration: underline;
}

/* Evidence tags — make them slightly more readable */
.cw-safety-page__evidence-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--cw-radius-sm, 4px);
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--cw-primary-pale, #F0FDFA);
    color: var(--cw-primary-darker, #115E59);
    border: 1px solid var(--cw-primary-light, #CCFBF1);
}

/* Section heading */
.cw-safety-page__section-heading {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--cw-text-primary);
    margin-top: 0;
    margin-bottom: var(--cw-space-6, 24px);
}

/* Safety page container: prevent horizontal overflow (same body widening issue as reviews hub) */
main.cw-safety-page {
    overflow-x: hidden;
    max-width: 100vw;
}

main.cw-safety-page .cw-container {
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
}


/* ========== Safety Rating Page — Full Layout Styles ========== */


/* ==========================================================================
   Header / Hero block
   ========================================================================== */

.cw-safety-page__header {
    background-color: var(--cw-surface, #ffffff);
    border-radius: var(--cw-radius-md, 8px);
    box-shadow: var(--cw-shadow-sm);
    padding: var(--cw-space-8, 32px);
    margin-bottom: var(--cw-space-8, 32px);
}

.cw-safety-page__title {
    font-family: var(--cw-font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--cw-text-primary);
    margin-bottom: var(--cw-space-4, 16px);
    line-height: 1.2;
}

.cw-safety-page__title-suffix {
    color: var(--cw-text-secondary, #6b7280);
    font-weight: 400;
    margin-left: 8px;
}

/* Badges row: tier pill + grade badge side by side */
.cw-safety-page__badges {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--cw-space-3, 12px);
    margin-bottom: 20px;
}

.cw-safety-page__tier-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    border-radius: 9999px;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1;
}

.cw-safety-page__tier-icon {
    margin-right: 6px;
    font-size: 1.1em;
    line-height: 1;
}

.cw-safety-page__tier-label {
    text-transform: uppercase;
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
    margin-right: 4px;
}

.cw-safety-page__tier-name {
    font-size: 0.75rem;
    opacity: 0.8;
}

.cw-safety-page__grade-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: var(--cw-radius-md, 8px);
    font-size: 2rem;
    font-weight: 800;
    color: #ffffff;
    flex-shrink: 0;
    line-height: 1;
}

/* Scores row: large number + /100 unit */
.cw-safety-page__scores {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: var(--cw-space-2, 8px);
    margin-bottom: var(--cw-space-4, 16px);
}

.cw-safety-page__score-pair {
    display: flex;
    flex-direction: column;
}

.cw-safety-page__score-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--cw-text-primary);
    line-height: 1;
}

.cw-safety-page__score-unit {
    font-size: 1rem;
    color: var(--cw-text-secondary, #6b7280);
    font-weight: 400;
    align-self: flex-end;
    margin-bottom: 0.15em;
}

/* Meta row: scored date, version, methodology link */
.cw-safety-page__meta {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    margin-top: var(--cw-space-3, 12px);
    font-size: 0.8125rem;
    color: var(--cw-text-secondary, #6b7280);
}

.cw-safety-page__meta-item {
    display: inline;
}

.cw-safety-page__meta-link {
    color: var(--cw-primary, #0B8578);
    text-decoration: none;
    font-weight: 600;
}

.cw-safety-page__meta-link:hover {
    text-decoration: underline;
}


/* ==========================================================================
   Dimension progress bars
   ========================================================================== */

.cw-safety-page__dimensions {
    background-color: var(--cw-surface, #ffffff);
    border-radius: var(--cw-radius-md, 8px);
    box-shadow: var(--cw-shadow-sm);
    padding: var(--cw-space-6, 24px);
    margin-bottom: var(--cw-space-6, 24px);
}

.cw-safety-page__dim-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* dim-item: no extra styles needed — gap on parent handles spacing */

.cw-safety-page__dim-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.cw-safety-page__dim-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--cw-text-primary);
}

.cw-safety-page__dim-score {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--cw-text-secondary, #6b7280);
    flex-shrink: 0;
    margin-left: var(--cw-space-4, 16px);
}

.cw-safety-page__bar-track {
    height: 10px;
    background: var(--cw-surface-muted, #f3f4f6);
    border-radius: 9999px;
    overflow: hidden;
}

.cw-safety-page__bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.4s ease;
}

.cw-safety-page__dim-pending {
    font-size: 0.875rem;
    color: var(--cw-text-muted, #6b7280);
    font-style: italic;
}


/* ==========================================================================
   Risk descriptor pills
   ========================================================================== */

.cw-safety-page__risk-labels {
    background-color: var(--cw-surface, #ffffff);
    border-radius: var(--cw-radius-md, 8px);
    box-shadow: var(--cw-shadow-sm);
    padding: var(--cw-space-6, 24px);
    margin-bottom: var(--cw-space-6, 24px);
}

.cw-safety-page__risk-intro {
    font-size: 0.875rem;
    color: var(--cw-text-secondary, #6b7280);
    margin-bottom: var(--cw-space-4, 16px);
}

.cw-safety-page__risk-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cw-safety-page__risk-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.cw-safety-page__risk-pill--warning {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.cw-safety-page__risk-pill--danger {
    background: #FEE2E2;
    color: #7F1D1D;
    border: 1px solid #FECACA;
}


/* ==========================================================================
   Version history
   ========================================================================== */

.cw-safety-page__version-history {
    background-color: var(--cw-surface, #ffffff);
    border-radius: var(--cw-radius-md, 8px);
    box-shadow: var(--cw-shadow-sm);
    padding: var(--cw-space-6, 24px);
    margin-bottom: var(--cw-space-6, 24px);
}

.cw-safety-page__history-entries {
    display: flex;
    flex-direction: column;
    gap: var(--cw-space-3, 12px);
}

.cw-safety-page__history-entry {
    padding: var(--cw-space-3, 12px);
    background: var(--cw-surface-muted, #f3f4f6);
    border-radius: var(--cw-radius-sm, 6px);
}

.cw-safety-page__history-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.cw-safety-page__history-date {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--cw-text-primary);
}

.cw-safety-page__history-dim {
    font-size: 0.8125rem;
    color: var(--cw-text-secondary, #6b7280);
}

.cw-safety-page__history-scores {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.cw-safety-page__history-old {
    font-size: 0.9375rem;
    color: var(--cw-text-muted, #6b7280);
    text-decoration: line-through;
}

.cw-safety-page__history-arrow {
    color: var(--cw-text-muted, #6b7280);
}

.cw-safety-page__history-new {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--cw-text-primary);
}

.cw-safety-page__history-reason {
    font-size: 0.875rem;
    color: var(--cw-text-secondary, #6b7280);
    margin: 0;
}

/* <details> toggle for older history entries */
.cw-safety-page__history-toggle {
    margin-top: var(--cw-space-3, 12px);
}

.cw-safety-page__history-toggle > summary,
.cw-safety-page__history-summary {
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--cw-primary, #0B8578);
    font-weight: 600;
    list-style: none; /* remove default triangle in some browsers */
}

.cw-safety-page__history-toggle > summary::-webkit-details-marker,
.cw-safety-page__history-summary::-webkit-details-marker {
    display: none;
}


/* ==========================================================================
   Footer
   ========================================================================== */

.cw-safety-page__footer {
    margin-top: var(--cw-space-8, 32px);
    padding-top: var(--cw-space-4, 16px);
    border-top: 1px solid var(--cw-border, #e5e7eb);
}

.cw-safety-page__correction {
    font-size: 0.875rem;
    color: var(--cw-text-secondary, #6b7280);
}

.cw-safety-page__correction a {
    color: var(--cw-primary, #0B8578);
    font-weight: 600;
}

/* Pending / not-yet-scored state */
.cw-safety-page__pending {
    text-align: center;
    padding: 48px var(--cw-space-6, 24px);
}

.cw-safety-page__pending h1 {
    margin-bottom: var(--cw-space-4, 16px);
}

.cw-safety-page__pending p {
    color: var(--cw-text-secondary, #6b7280);
}


/* ==========================================================================
   Safety Rating Page — Mobile responsive additions
   ========================================================================== */

@media (max-width: 767px) {
    /* Stack header badges vertically and tighten card padding */
    .cw-safety-page__header {
        padding: var(--cw-space-4, 16px);
    }

    .cw-safety-page__badges {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Smaller grade badge on mobile */
    .cw-safety-page__grade-badge {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }

    /* Tighten the score value on mobile */
    .cw-safety-page__score-value {
        font-size: 2rem;
    }

    /* Slightly tighter dimension list on small screens */
    .cw-safety-page__dim-list {
        gap: 12px;
    }
}

/* ========== Safety Ratings Hub — Archive Page Styles ========== */

/* Hub container top breathing room */
main.cw-safety-hub {
    padding-top: 0;
}

/* Hub header */
.cw-safety-hub__header {
    margin-bottom: var(--cw-space-8, 32px);
}

.cw-safety-hub__title {
    font-family: var(--cw-font-display, inherit);
    font-size: 2rem;
    font-weight: 800;
    color: var(--cw-text-primary, #1F2937);
    margin-bottom: var(--cw-space-3, 12px);
}

.cw-safety-hub__intro {
    font-size: 1.0625rem;
    color: var(--cw-text-secondary, #6b7280);
    line-height: 1.7;
    max-width: 680px;
}

.cw-safety-hub__intro a {
    color: var(--cw-primary, #0B8578);
    font-weight: 600;
    text-decoration: none;
}

.cw-safety-hub__intro a:hover {
    text-decoration: underline;
}

/* Filter buttons */
.cw-safety-hub__filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--cw-space-2, 8px);
    margin-bottom: var(--cw-space-8, 32px);
}

.cw-safety-hub__filter-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    background: var(--cw-surface-muted, #f3f4f6);
    color: var(--cw-text-secondary, #6b7280);
    transition: all 0.15s ease;
    line-height: 1;
}

.cw-safety-hub__filter-btn:hover {
    background: var(--cw-surface, #ffffff);
    border-color: var(--cw-border, #e5e7eb);
}

/* Default active state (All button) */
.cw-safety-hub__filter-btn--active {
    background: var(--cw-text-primary, #1F2937);
    color: #ffffff;
    border-color: var(--cw-text-primary, #1F2937);
}

/* Tier-colored active states — class toggled by JS */
.cw-safety-hub__filter-btn--active.cw-safety-hub__filter-btn--green {
    background: #065F46;
    border-color: #065F46;
    color: #ffffff;
}

.cw-safety-hub__filter-btn--active.cw-safety-hub__filter-btn--yellow {
    background: #92400E;
    border-color: #92400E;
    color: #ffffff;
}

.cw-safety-hub__filter-btn--active.cw-safety-hub__filter-btn--red {
    background: #7F1D1D;
    border-color: #7F1D1D;
    color: #ffffff;
}

/* App cards grid */
.cw-safety-hub__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: var(--cw-space-10, 48px);
}

.cw-safety-hub__card {
    display: flex;
    flex-direction: column;
    gap: var(--cw-space-4, 16px);
    background: var(--cw-surface, #ffffff);
    border-radius: 12px;
    padding: var(--cw-space-6, 24px);
    box-shadow: var(--cw-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.08));
    border: 1px solid var(--cw-border, #e5e7eb);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.cw-safety-hub__card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: var(--cw-primary-light, #CCFBF1);
}

.cw-safety-hub__card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--cw-space-3, 12px);
}

.cw-safety-hub__card-name {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--cw-text-primary, #1F2937);
    margin: 0;
    line-height: 1.3;
    flex: 1;
}

/* Tier badges */
.cw-safety-hub__tier-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.cw-safety-hub__tier-badge--green {
    background: #D1FAE5;
    color: #065F46;
}

.cw-safety-hub__tier-badge--yellow {
    background: #FEF3C7;
    color: #92400E;
}

.cw-safety-hub__tier-badge--red {
    background: #FEE2E2;
    color: #7F1D1D;
}

/* Score block */
.cw-safety-hub__card-scores {
    display: flex;
    align-items: center;
    gap: var(--cw-space-4, 16px);
}

.cw-safety-hub__card-grade {
    font-size: 2rem;
    font-weight: 800;
    color: var(--cw-text-primary, #1F2937);
    line-height: 1;
    min-width: 2ch;
}

.cw-safety-hub__card-numbers {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cw-safety-hub__card-score-primary {
    font-size: 1rem;
    font-weight: 700;
    color: var(--cw-text-primary, #1F2937);
}

.cw-safety-hub__card-score-secondary {
    font-size: 0.8125rem;
    color: var(--cw-text-muted, #6b7280);
}

/* CTA link at card bottom */
.cw-safety-hub__card-link {
    margin-top: auto;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--cw-primary-dark, #0F766E);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Empty state */
.cw-safety-hub__empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--cw-text-secondary, #6b7280);
    font-style: italic;
}

/* ---- Mobile — single column ---- */
@media (max-width: 767px) {
    .cw-safety-hub__title {
        font-size: 1.5rem;
    }

    .cw-safety-hub__grid {
        grid-template-columns: 1fr;
    }

    .cw-safety-hub__card {
        padding: var(--cw-space-4, 16px);
    }
}
