/* ==========================================================================
   Istwanou Code Henry — v1.2.0
   3-column grid, progressive disclosure, sticky filters, share buttons
   ========================================================================== */

.ich-page-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}
.ich-page-header { margin-bottom: 28px; }
.ich-page-title { font-size: 28px; font-weight: 700; color: #1a3a5c; margin: 0 0 8px; }
.ich-page-desc { font-size: 15px; line-height: 1.7; color: #5f5e5a; margin: 0; max-width: 680px; }

/* --- Sticky filter bar --- */
.ich-filters-sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(248, 247, 244, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    margin: 0 -20px;
    padding: 12px 20px;
    border-bottom: 1px solid #e2e0d8;
    transition: box-shadow 0.2s ease;
}
.ich-filters-sticky.is-stuck {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
.ich-filters {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
}
.ich-filter-group { display: flex; align-items: center; gap: 6px; }
.ich-filter-label { font-size: 12px; font-weight: 600; color: #5f5e5a; text-transform: uppercase; letter-spacing: 0.04em; }
.ich-filter-select { padding: 5px 8px; border: 1px solid #d3d1c7; border-radius: 6px; font-size: 13px; background: #fff; color: #2c2c2a; cursor: pointer; }
.ich-lang-toggle { display: flex; gap: 3px; margin-left: auto; }
.ich-lang-btn { padding: 5px 12px; border: 1px solid #d3d1c7; border-radius: 6px; background: #fff; font-size: 12px; cursor: pointer; color: #5f5e5a; transition: all 0.15s ease; }
.ich-lang-btn:hover { background: #f1efe8; }
.ich-lang-btn.active { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }

/* --- Search --- */
.ich-search-wrap { margin: 16px 0; }
.ich-search { width: 100%; padding: 9px 14px; border: 1px solid #d3d1c7; border-radius: 8px; font-size: 14px; background: #fff; color: #2c2c2a; box-sizing: border-box; }
.ich-search:focus { outline: none; border-color: #1a3a5c; box-shadow: 0 0 0 3px rgba(26, 58, 92, 0.1); }

/* --- 3-Column Card Grid --- */
.ich-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

/* --- Card — collapsed (default) --- */
.ich-card {
    background: #fff;
    border: 1px solid #e2e0d8;
    border-radius: 10px;
    padding: 18px;
    cursor: pointer;
    transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    display: flex;
    flex-direction: column;
}
.ich-card:hover { border-color: #afa9ec; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07); transform: translateY(-1px); }

.ich-card-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.ich-card-num-wrap { width: 36px; height: 36px; border-radius: 50%; background: #eeedfe; border: 1.5px solid #afa9ec; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ich-card-num { font-size: 13px; font-weight: 700; color: #3c3489; }
.ich-card-meta { flex: 1; min-width: 0; }
.ich-card-title { display: block; font-size: 14px; font-weight: 600; color: #2c2c2a; text-decoration: none; line-height: 1.3; }
.ich-card-title:hover { color: #1a3a5c; }
.ich-card-subtitle { display: block; font-size: 11px; color: #888780; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ich-badge { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 5px; white-space: nowrap; flex-shrink: 0; margin-top: 2px; }
.ich-badge--worker-protection    { background: #eeedfe; color: #3c3489; }
.ich-badge--healthcare           { background: #e1f5ee; color: #085041; }
.ich-badge--elder-care           { background: #faeeda; color: #633806; }
.ich-badge--labor-rights         { background: #e6f1fb; color: #0c447c; }
.ich-badge--land-rights          { background: #eaf3de; color: #27500a; }
.ich-badge--land-management      { background: #eaf3de; color: #27500a; }
.ich-badge--mutual-aid           { background: #fbeaf0; color: #72243e; }
.ich-badge--military-discipline  { background: #f1efe8; color: #444441; }
.ich-badge--reciprocal-duty      { background: #eeedfe; color: #3c3489; }
.ich-badge--revenue-sharing      { background: #faeeda; color: #633806; }
.ich-badge--public-works         { background: #f1efe8; color: #444441; }
.ich-badge--agriculture          { background: #eaf3de; color: #27500a; }
.ich-badge--livestock            { background: #faeeda; color: #633806; }
.ich-badge--food-security        { background: #e1f5ee; color: #085041; }
.ich-badge--penalties            { background: #fcebeb; color: #791f1f; }

/* Preview — 3-line clamp, always visible when collapsed */
.ich-card-preview {
    font-size: 13px; line-height: 1.6; color: #5f5e5a;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
    flex: 1;
}

/* Expand hint */
.ich-card-expand-hint {
    display: flex; align-items: center; justify-content: center;
    margin-top: 10px; font-size: 11px; color: #afa9ec; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em; gap: 4px;
}
.ich-expand-chevron { transition: transform 0.2s ease; display: inline-block; }

/* Full body + footer — hidden by default */
.ich-card-body { display: none; margin-top: 14px; padding-top: 14px; border-top: 1px solid #e2e0d8; }
.ich-card-footer { display: none; border-top: 1px solid #e2e0d8; padding-top: 12px; margin-top: 14px; font-size: 13px; line-height: 1.6; color: #5f5e5a; }
.ich-lesson-label { font-weight: 600; color: #3c3489; }

.ich-text p { font-size: 14px; line-height: 1.75; color: #2c2c2a; margin: 0 0 8px; }
.ich-text p:last-child { margin-bottom: 0; }
.ich-text--fr p { font-style: italic; }

/* Close button */
.ich-card-close {
    display: none; position: absolute; top: 14px; right: 14px;
    width: 28px; height: 28px; border-radius: 50%; border: 1px solid #d3d1c7;
    background: #fff; cursor: pointer; font-size: 14px; color: #888780;
    line-height: 26px; text-align: center;
}
.ich-card-close:hover { background: #f1efe8; color: #2c2c2a; }

/* --- Expanded state --- */
.ich-card.is-expanded {
    grid-column: 1 / -1;
    max-width: 720px;
    cursor: default;
    border-color: #afa9ec;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transform: none;
    position: relative;
}
.ich-card.is-expanded .ich-card-preview { display: none; }
.ich-card.is-expanded .ich-card-expand-hint { display: none; }
.ich-card.is-expanded .ich-card-body { display: block; }
.ich-card.is-expanded .ich-card-footer { display: block; }
.ich-card.is-expanded .ich-card-close { display: block; }

/* --- Daily Lesson --- */
.ich-daily-lesson { max-width: 640px; margin: 0 auto; }
.ich-daily-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.ich-daily-label { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #3c3489; }
.ich-daily-date { font-size: 13px; color: #888780; }
.ich-daily-lesson .ich-card { grid-column: 1 / -1; border-color: #afa9ec; border-width: 2px; }

/* --- Pagination --- */
.ich-pagination { margin-top: 24px; text-align: center; }
.ich-pagination .page-numbers { display: inline-block; padding: 6px 12px; margin: 0 2px; border: 1px solid #d3d1c7; border-radius: 6px; font-size: 14px; color: #2c2c2a; text-decoration: none; }
.ich-pagination .page-numbers.current { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }

.ich-no-results { text-align: center; padding: 40px 20px; color: #888780; font-size: 15px; grid-column: 1 / -1; }

/* --- Breadcrumb --- */
.ich-breadcrumb { font-size: 13px; color: #888780; margin-bottom: 24px; }
.ich-breadcrumb a { color: #1a3a5c; text-decoration: none; }
.ich-breadcrumb a:hover { text-decoration: underline; }
.ich-breadcrumb-sep { margin: 0 6px; color: #d3d1c7; }

/* --- Single article page --- */
.ich-single-card { background: #fff; border: 1px solid #e2e0d8; border-radius: 12px; padding: 28px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); max-width: 720px; }
.ich-single-header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.ich-single-num-wrap { width: 52px; height: 52px; border-radius: 50%; background: #eeedfe; border: 2px solid #afa9ec; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ich-single-num { font-size: 18px; font-weight: 700; color: #3c3489; }
.ich-single-title { font-size: 20px; font-weight: 700; color: #2c2c2a; margin: 0; }
.ich-single-subtitle { font-size: 13px; color: #888780; margin: 2px 0 0; }
.ich-single-context { background: #f8f7f4; border-radius: 8px; padding: 14px 18px; margin-bottom: 20px; }
.ich-context-row { font-size: 13px; line-height: 1.8; color: #5f5e5a; }
.ich-context-label { font-weight: 600; color: #2c2c2a; }
.ich-context-en { font-style: italic; color: #888780; }
.ich-single-lang-toggle { display: flex; gap: 4px; margin-bottom: 20px; }
.ich-single-body { margin-bottom: 20px; }
.ich-single-body .ich-text p { font-size: 16px; line-height: 1.8; }
.ich-single-lesson { border-top: 1px solid #e2e0d8; padding-top: 16px; margin-top: 4px; font-size: 15px; line-height: 1.7; color: #5f5e5a; }
.ich-single-notes { margin-top: 12px; font-size: 13px; line-height: 1.6; color: #888780; }
.ich-notes-label { font-weight: 600; color: #5f5e5a; }

/* --- Article navigation --- */
.ich-article-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; padding-top: 20px; border-top: 1px solid #e2e0d8; max-width: 720px; }
.ich-article-nav a { font-size: 14px; color: #1a3a5c; text-decoration: none; font-weight: 600; }
.ich-article-nav a:hover { text-decoration: underline; }
.ich-nav-back { font-weight: 400 !important; color: #888780 !important; }

/* --- Responsive: 2-col tablet --- */
@media (max-width: 900px) {
    .ich-cards { grid-template-columns: repeat(2, 1fr); }
    .ich-page-wrap { padding: 30px 16px 50px; }
}

/* --- Responsive: 1-col mobile --- */
@media (max-width: 600px) {
    .ich-cards { grid-template-columns: 1fr; }
    .ich-filters { flex-direction: column; align-items: stretch; gap: 8px; }
    .ich-lang-toggle { margin-left: 0; justify-content: center; }
    .ich-filters-sticky { margin: 0 -16px; padding: 10px 16px; }
    .ich-card-header { flex-wrap: wrap; }
    .ich-badge { margin-top: 4px; }
    .ich-single-card { padding: 18px; }
    .ich-single-header { flex-wrap: wrap; }
    .ich-article-nav { flex-direction: column; gap: 10px; text-align: center; }
    .ich-share-buttons { flex-wrap: wrap; }
}

/* --- Share bar (card — expanded only) --- */
.ich-card-share {
    display: none;
    border-top: 1px solid #e2e0d8;
    padding-top: 12px;
    margin-top: 12px;
    gap: 6px;
    flex-wrap: wrap;
}
.ich-card.is-expanded .ich-card-share { display: flex; }

/* --- Share bar (single page) --- */
.ich-single-share {
    border-top: 1px solid #e2e0d8;
    padding-top: 16px;
    margin-top: 16px;
}
.ich-share-heading {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888780;
    margin-bottom: 10px;
}
.ich-share-buttons { display: flex; gap: 6px; flex-wrap: wrap; }

/* --- Share button base --- */
.ich-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid #d3d1c7;
    border-radius: 6px;
    background: #fff;
    font-size: 12px;
    color: #5f5e5a;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
}
.ich-share-btn:hover {
    background: #f1efe8;
    border-color: #afa9ec;
    color: #3c3489;
}
.ich-share-btn svg { flex-shrink: 0; }
.ich-share-btn.ich-share-copied {
    background: #e1f5ee;
    border-color: #085041;
    color: #085041;
}
.ich-share-label { white-space: nowrap; }

/* --- Native share: mobile vs desktop --- */
/* Native share button hidden on desktop, shown on mobile */
.ich-share-native { display: none; }
/* Platform buttons shown on desktop, hidden on mobile */
@media (max-width: 600px) {
    .ich-share-native { display: inline-flex; }
    .ich-share-desktop { display: none; }
}
