/* ============================================================
   HERBS — Билки и подправки (inc/herbs.php, docs/bilki.md).

   Loaded on is_singular('herb') on top of entry.css, and on the
   /bilki/ listing on top of archive.css. One file for both because
   they share the season bar and are small.
   ============================================================ */

/* ---- The season bar: twelve months, the picking ones lit ---------- */
.herb-season {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 3px;
}

.herb-season__m {
    display: grid;
    place-items: center;
    height: 22px;
    border-radius: 4px;
    background: var(--c-surface-tint);
    color: var(--c-ink-faint);
    font-family: var(--font-display);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}

.herb-season__m.is-on {
    background: var(--c-lime);
    color: #fff;
}

/* This month, so "is it the season now" needs no calendar: the accent
   ring and a dot under the cell. A bare ring on an empty cell read as "0". */
.herb-season__m.is-now {
    position: relative;
    box-shadow: inset 0 0 0 2px var(--c-accent);
    color: var(--c-accent);
}

.herb-season__m.is-on.is-now {
    color: #fff;
}

.herb-season__m.is-now::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 50%;
    width: 4px;
    height: 4px;
    margin-left: -2px;
    border-radius: 50%;
    background: var(--c-accent);
}

/* ---- Single: header extras ---------------------------------------- */
/* .entry-meta is set in small capitals; a binomial is never written in
   capitals, so the Latin name gets its own case and size. */
.herb-taxon {
    align-items: baseline;
}

.herb-taxon__latin {
    color: var(--c-ink-soft);
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-style: italic;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.herb-photo {
    margin-left: 0;
    margin-right: 0;
}

.image-credit {
    margin: 8px 0 0;
    color: var(--c-ink-faint);
    font-size: 0.78rem;
    line-height: 1.4;
}

.image-credit a {
    color: inherit;
}

/* ---- Single: layout ------------------------------------------------
   One column: the passport is a band under the photo, then the text at
   the full width of the page, as on a place page (single-place.css).
   The padding matches .entry-header so the band lines up with the photo. */
.herb-layout {
    display: flex;
    flex-direction: column;
    gap: clamp(28px, 4vw, 44px);
    max-width: 1480px;
    margin: 0 auto;
    padding: clamp(28px, 4vw, 44px) clamp(20px, 4vw, 56px) 64px;
}

.herb-main {
    min-width: 0;
}

/* ---- Single: the passport band ------------------------------------ */
.herb-card {
    padding: clamp(20px, 3vw, 30px);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--c-lime) 9%, transparent), transparent 160px),
        var(--c-surface);
    box-shadow: 0 1px 3px var(--c-shadow);
}

/* The kicker on the left, the season bar filling the rest of the row. */
.herb-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 28px;
    margin-bottom: clamp(18px, 2.4vw, 24px);
}

.herb-card__kicker {
    flex: none;
    margin: 0;
    padding: 6px 18px;
    border-radius: var(--radius-badge);
    background: var(--c-ink);
    color: var(--c-surface);
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.herb-card__season {
    display: flex;
    flex: 1 1 420px;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.herb-card__season .herb-fact__label {
    flex: none;
    margin: 0;
}

.herb-card__season .herb-season {
    flex: 1;
    max-width: 560px;
}

/* Facts as tiles that share a row; a long one takes a wider tile. */
.herb-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0;
}

.herb-fact {
    flex: 1 1 190px;
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-surface);
}

.herb-fact--wide {
    flex-basis: 380px;
}

.herb-fact__label {
    margin: 0 0 4px;
    color: var(--c-ink-faint);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.herb-fact__value {
    margin: 0;
    color: var(--c-ink);
    font-size: 0.95rem;
    line-height: 1.5;
}

.herb-status__label {
    display: block;
    font-weight: 700;
}

.herb-status__note {
    display: block;
    margin-top: 4px;
    color: var(--c-ink-soft);
    font-size: 0.85rem;
}

.herb-status--restricted,
.herb-status--protected {
    border-color: color-mix(in srgb, var(--c-warn) 40%, transparent);
    background: var(--c-warn-bg);
}

.herb-status--restricted .herb-status__label,
.herb-status--protected .herb-status__label {
    color: var(--c-warn);
}

@media (max-width: 600px) {
    .herb-card__season {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .herb-card__season .herb-season {
        max-width: none;
    }

    /* Two short facts to a row, or the band is a screen and a half long. */
    .herb-fact {
        flex-basis: calc(50% - 6px);
        padding: 12px;
    }

    .herb-fact--wide {
        flex-basis: 100%;
    }
}

/* ---- Single: the text column -------------------------------------- */
.herb-warning {
    margin: 0 0 28px;
    padding: 16px 20px;
    border-left: 4px solid var(--c-warn);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    background: var(--c-warn-bg);
}

.herb-warning__title {
    margin: 0 0 4px;
    color: var(--c-warn);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.herb-warning__text {
    margin: 0;
    color: var(--c-ink);
    line-height: 1.6;
}

.herb-lead {
    margin: 0 0 32px;
    padding-left: 20px;
    border-left: 3px solid var(--c-lime);
    color: var(--c-ink);
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 500;
    line-height: 1.45;
}

.herb-related {
    margin-top: 48px;
}

.herb-related__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
}

.herb-related__item {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 100%;
    padding: 10px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-surface);
    color: var(--c-ink);
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
}

.herb-related__item:hover {
    border-color: var(--c-accent);
}

.herb-related__item img {
    flex: none;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.herb-related__item small {
    display: block;
    color: var(--c-ink-faint);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ---- Listing ------------------------------------------------------ */
.herb-archive {
    max-width: 1480px;
    margin: 0 auto;
    padding: clamp(20px, 3vw, 32px) clamp(20px, 4vw, 56px) 64px;
}

.herb-filters {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: clamp(24px, 3vw, 36px);
    padding: 18px 20px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    background: var(--c-surface);
}

.herb-filters__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
}

.herb-filters__label {
    flex: none;
    width: 120px;
    margin: 0;
    color: var(--c-ink-faint);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.herb-chips {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.herb-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 4px 14px;
    border: 1px solid var(--c-border-strong);
    border-radius: 999px;
    background: var(--c-surface);
    color: var(--c-ink);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.herb-chip:hover {
    border-color: var(--c-accent);
    color: var(--c-accent);
}

.herb-chip[aria-current="true"] {
    border-color: var(--c-accent);
    background: var(--c-accent);
    color: #fff;
}

.herb-chip.is-now:not([aria-current="true"]) {
    border-color: var(--c-lime);
}

.herb-chip__count {
    min-width: 22px;
    margin-right: -6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--c-surface-tint);
    color: var(--c-ink-soft);
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
}

.herb-chip[aria-current="true"] .herb-chip__count {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.herb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: clamp(16px, 2vw, 24px);
}

.herb-item {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    background: var(--c-surface);
    box-shadow: 0 1px 3px var(--c-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.herb-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px var(--c-shadow);
}

.herb-item__media {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: linear-gradient(135deg, color-mix(in srgb, var(--c-lime) 55%, var(--c-surface-tint)), var(--c-surface-tint));
}

.herb-item__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.herb-item__initial {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.85);
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 800;
}

.herb-item__flag {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-badge);
    background: var(--c-warn);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
}

.herb-item__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px 18px;
}

.herb-item__kinds {
    margin: 0;
    color: var(--c-ink-faint);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.herb-item__title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.25rem;
    line-height: 1.2;
}

.herb-item__title a {
    color: var(--c-ink);
    text-decoration: none;
}

.herb-item__title a:hover {
    color: var(--c-accent);
}

.herb-item__latin {
    margin: 0 0 6px;
    color: var(--c-ink-soft);
    font-size: 0.85rem;
    font-style: italic;
}

/* The months in words first, the bar under them as the picture of it. */
.herb-item__season {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--c-border);
}

/* Baseline, not center: the small capitals label and the months are two
   sizes, and centring them left the label riding above the text. */
.herb-item__months {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    margin: 0;
    color: var(--c-ink);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
}

.herb-item__now {
    align-self: center;
}

.herb-item__months-label {
    color: var(--c-ink-faint);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.herb-item__now {
    padding: 1px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--c-lime) 22%, transparent);
    color: var(--c-ink);
    font-size: 0.7rem;
    font-weight: 700;
}

.herb-item .herb-season {
    gap: 2px;
    margin-bottom: 6px;
}

.herb-item .herb-season__m {
    height: 18px;
    border-radius: 3px;
    font-size: 0.58rem;
}

@media (max-width: 600px) {
    .herb-filters__label {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .herb-item,
    .herb-chip {
        transition: none;
    }

    .herb-item:hover {
        transform: none;
    }
}
