/**
 * Plants Infographic Styles
 *
 * Family-based accordion layout for Mongolian plant taxonomy.
 * Groups by family → genus → species (nested accordion).
 * cat_code: [1-1-4-3] (Biological Sciences > Botany)
 */

/* =========================================================
   1. PAGE SETUP
   ========================================================= */

body.plants-infographic-page .dict-alpha-nav {
    display: none;
}

.plants-infographic {
    max-width: 1100px;
    margin: 0 auto;
}

/* =========================================================
   2. HEADER
   ========================================================= */

.plants-infographic__header {
    margin-bottom: 2rem;
}

.plants-infographic__meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.plants-infographic__stats {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--ink-soft, #5a4943);
}

.plants-infographic__stats span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* =========================================================
   3. ACCORDION SECTIONS (shared base)
   ========================================================= */

.plants-accordion {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.plants-accordion--genus {
    gap: 0.25rem;
}

.plants-section {
    border: 1px solid var(--line-gray, #e0e0e0);
    border-radius: var(--radius-main, 12px);
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.plants-section:hover {
    border-color: var(--wood-orange, #e07a00);
}

/* --- Section header (shared) --- */

.plants-section__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: var(--entry-bg, #fffaf0);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-dark, #3b2411);
    transition: background 0.2s ease;
}

.plants-section__header:hover {
    background: #fff5e6;
}

.plants-section__header:focus-visible {
    outline: 2px solid var(--wood-orange, #e07a00);
    outline-offset: -2px;
}

/* Arrow icon */

.plants-section__arrow {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
    color: var(--wood-orange, #e07a00);
}

.plants-section.is-open>.plants-section__header .plants-section__arrow {
    transform: rotate(90deg);
}

/* Title spans */

.plants-section__title-mn {
    font-weight: 700;
    font-size: 1.05rem;
}

.plants-section__title-jp {
    color: var(--ink-soft, #5a4943);
    font-size: 0.9rem;
}

.plants-section__title-lat {
    font-style: italic;
    color: #888;
    font-size: 0.85rem;
}

/* Count badge */

.plants-section__count {
    margin-left: auto;
    flex-shrink: 0;
    background: var(--wood-orange, #e07a00);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    min-width: 24px;
    text-align: center;
}

/* Accordion body (collapse/expand) */

.plants-section__body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.plants-section.is-open>.plants-section__body {
    max-height: none;
}

.plants-section__inner {
    padding: 1rem 1.25rem 1.25rem;
}

/* =========================================================
   3a. FAMILY-LEVEL overrides
   ========================================================= */

.plants-section--family>.plants-section__header {
    background: var(--wood-orange, #e07a00);
    color: #fff;
    padding: 0.75rem 1.25rem;
}

.plants-section--family>.plants-section__header:hover {
    background: #c96d00;
}

.plants-section--family>.plants-section__header .plants-section__arrow {
    color: #fff;
}

.plants-section--family>.plants-section__header .plants-section__title-mn {
    font-size: 1.1rem;
    letter-spacing: 0.02em;
}

.plants-section--family>.plants-section__header .plants-section__count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* =========================================================
   3b. GENUS-LEVEL overrides
   ========================================================= */

.plants-section--genus {
    border: none;
    border-left: 3px solid var(--wood-orange, #e07a00);
    border-radius: 0;
    overflow: visible;
}

.plants-section--genus:hover {
    border-color: var(--wood-orange, #e07a00);
}

.plants-section--genus>.plants-section__header {
    background: var(--entry-bg, #fffaf0);
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
}

.plants-section--genus>.plants-section__header:hover {
    background: #fff5e6;
}

.plants-section--genus .plants-section__arrow {
    width: 14px;
    height: 14px;
}

.plants-section--genus .plants-section__title-mn {
    font-size: 0.95rem;
}

.plants-section--genus .plants-section__count {
    font-size: 0.7rem;
    padding: 1px 6px;
    min-width: 20px;
}

.plants-section--genus .plants-section__inner {
    padding: 0.75rem 1rem 1rem;
}

/* =========================================================
   4. CARD GRID
   ========================================================= */

.plants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
}

/* =========================================================
   5. PLANT CARDS
   ========================================================= */

.plant-card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--line-gray, #e0e0e0);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.plant-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    border-color: var(--wood-orange, #e07a00);
}

/* Linked card (wrapped in <a>) */

a.plant-card--linked {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Sub-species card */

.plant-card--sub {
    border-left: 3px solid var(--wood-orange, #e07a00);
    padding-left: 0.875rem;
}

/* Card content */

.plant-card__mn {
    font-weight: 700;
    font-size: 0.95rem;
    margin: 0 0 0.25rem;
    color: var(--text-dark, #3b2411);
    line-height: 1.3;
}

.plant-card__jp {
    font-size: 0.85rem;
    margin: 0 0 0.2rem;
    color: var(--ink-soft, #5a4943);
    line-height: 1.4;
}

.plant-card__lat {
    font-size: 0.8rem;
    font-style: italic;
    color: #999;
    margin: 0;
    line-height: 1.3;
}

.plant-card__unknown {
    color: #bbb;
    font-size: 0.75rem;
}

/* =========================================================
   6. EXPAND/COLLAPSE CONTROLS
   ========================================================= */

.plants-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    justify-content: flex-end;
}

.plants-controls__btn {
    background: none;
    border: 1px solid var(--line-gray, #e0e0e0);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    color: var(--ink-soft, #5a4943);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.plants-controls__btn:hover {
    border-color: var(--wood-orange, #e07a00);
    color: var(--wood-orange, #e07a00);
}

/* =========================================================
   7. FOOTER
   ========================================================= */

.plants-footer {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line-gray, #e0e0e0);
    text-align: center;
}

.plants-footer__total {
    font-size: 0.9rem;
    color: var(--ink-soft, #5a4943);
    margin-bottom: 1rem;
}

/* =========================================================
   8. RESPONSIVE
   ========================================================= */

@media (max-width: 900px) {
    .plants-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 640px) {
    .plants-section__header {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .plants-section__inner {
        padding: 0.75rem 1rem 1rem;
    }

    .plants-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .plants-controls {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .plants-section__title-lat {
        display: none;
    }

    .plant-card {
        padding: 0.625rem 0.875rem;
    }
}

/* =========================================================
   9. PRINT
   ========================================================= */

@media print {
    .plants-controls {
        display: none;
    }

    .plants-section__body {
        max-height: none !important;
    }

    .plants-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}