/* ============================================================
   CP News Widgets — Frontend Styles
   ============================================================ */

/* --- Shared --- */
.cp-widget {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1a1a1a;
    box-sizing: border-box;
}
.cp-widget *, .cp-widget *::before, .cp-widget *::after {
    box-sizing: inherit;
}
.cp-empty {
    color: #777;
    font-style: italic;
    padding: 16px;
    border: 1px dashed #ccc;
    text-align: center;
}
.cp-byline { color: #c0392b; font-size: 12px; font-weight: 600; display: block; }
.cp-date   { color: #888;    font-size: 12px; display: block; margin-top: 4px; }

/* --- Widget Header --- */
.cp-widget-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 2px solid #c0392b;
    margin-bottom: 12px;
}
.cp-logo {
    background: #c0392b;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    padding: 2px 8px;
    border-radius: 3px;
}
.cp-widget-title {
    font-weight: 700;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================================
   GRID SYSTEM — cp-grid + cp-grid-{1..6}
   ============================================================ */
.cp-grid {
    display: grid;
    gap: 20px;
}
.cp-grid-1 { grid-template-columns: 1fr; }
.cp-grid-2 { grid-template-columns: repeat(2, 1fr); }
.cp-grid-3 { grid-template-columns: repeat(3, 1fr); }
.cp-grid-4 { grid-template-columns: repeat(4, 1fr); }
.cp-grid-5 { grid-template-columns: repeat(5, 1fr); }
.cp-grid-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 900px) {
    .cp-grid-4, .cp-grid-5, .cp-grid-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
    .cp-grid-3, .cp-grid-4, .cp-grid-5, .cp-grid-6 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .cp-grid { grid-template-columns: 1fr !important; }
}

/* --- Headlines (list mode) --- */
.cp-headline-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.cp-headline-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}
.cp-headline-item:last-child { border-bottom: none; }
.cp-headline-thumb {
    width: 72px;
    height: 50px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
}
.cp-headline-text { flex: 1; min-width: 0; }
.cp-headline-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.3;
}
.cp-headline-meta {
    font-size: 11px;
    color: #888;
}

/* --- Headlines (grid/card mode) --- */
.cp-headline-card {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.cp-headline-card-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}
.cp-headline-card-body {
    padding: 10px 12px;
}

/* --- Photo Story --- */
.cp-photo-list {}
.cp-photo-item {
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid #eee;
}
.cp-photo-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

/* single-column layout: side by side */
.cp-photo-list > .cp-photo-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 600px) {
    .cp-photo-list > .cp-photo-item { grid-template-columns: 1fr; }
}

/* multi-column card mode */
.cp-photo-item--card {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.cp-photo-item--card .cp-photo-content { padding: 12px; }

.cp-photo-figure { margin: 0; }
.cp-photo-figure img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}
.cp-photo-item--card .cp-photo-figure img { border-radius: 0; }
.cp-photo-figure figcaption {
    font-size: 11px;
    color: #555;
    margin-top: 6px;
    font-style: italic;
}
.cp-photo-headline {
    font-size: 20px;
    font-weight: 700;
    margin: 8px 0;
    line-height: 1.3;
}
.cp-photo-item--card .cp-photo-headline { font-size: 15px; }
.cp-photo-extended {
    font-size: 15px;
    color: #444;
    margin: 4px 0 10px;
}
.cp-photo-body {
    font-size: 14px;
    line-height: 1.7;
    color: #333;
}
.cp-photo-summary {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
}

/* --- Video --- */
.cp-video-item {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
}
.cp-video-player {
    width: 100%;
    display: block;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}
.cp-video-meta {
    background: #fff;
    padding: 10px 12px;
}
.cp-video-meta strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
    line-height: 1.3;
}

/* --- Audio --- */
.cp-audio-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
}
.cp-audio-icon {
    font-size: 24px;
    color: #c0392b;
    flex-shrink: 0;
    width: 36px;
    text-align: center;
}
.cp-audio-content { flex: 1; min-width: 0; }
.cp-audio-headline {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}
.cp-audio-player {
    width: 100%;
    margin-top: 8px;
    height: 32px;
}

/* All card galleries swipe on phones; a headline list remains a list. */
@media (max-width: 767px) {
    .cp-widget .cp-grid, .cp-audio-list.cp-grid, .cp-widget .cp-photo-list {
        display: flex !important;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 20px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        padding: 4px 4px 16px;
        max-width: 100%;
        min-width: 0;
    }
    .cp-widget .cp-grid > *, .cp-audio-list.cp-grid > *, .cp-widget .cp-photo-list > * {
        flex: 0 0 88%; min-width: 0; margin: 0;
        scroll-snap-align: start;
    }
    .cp-widget .cp-grid > :only-child, .cp-audio-list.cp-grid > :only-child, .cp-widget .cp-photo-list > :only-child { flex-basis: 100%; }
}