/*
 * UIUX-008R directory editorial intro (owner correction).
 *
 * Purpose rule: an editorial image on a directory/landing page sits beside
 * the copy that explains the directory, its real facts and at most one
 * restrained action — never alone beside an empty column. Markup:
 * template-parts/components/directory-editorial-intro.php (and the farming
 * knowledge directory, which keeps its H1 in its own template).
 *
 * Stacked (<768px): heading/context -> image -> facts + action.
 * >=768px: image | content (copy | image for a page-identity H1), the copy group vertically centred beside an
 * image that fills the band height (the band is as tall as the copy, with a
 * floor), so the directory grid follows within the first viewport.
 */

.directory-editorial-intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "heading"
        "media"
        "details";
    gap: var(--space-md);
    margin: var(--space-sm) 0 clamp(1.25rem, 2.4vw, 2rem);
}

.directory-editorial-intro__heading { grid-area: heading; min-width: 0; }
.directory-editorial-intro__media { grid-area: media; min-width: 0; }
.directory-editorial-intro__details { grid-area: details; min-width: 0; }

.directory-editorial-intro__eyebrow {
    margin: 0 0 var(--space-xs);
    color: var(--text-secondary);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1.4;
    text-transform: uppercase;
}

.directory-editorial-intro .directory-editorial-intro__title {
    margin: 0;
    color: var(--text-primary);
    font-size: clamp(1.375rem, 1.9vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -.015em;
    line-height: 1.15;
}

.directory-editorial-intro__lede,
.directory-editorial-intro__note {
    max-width: 34rem;
    margin: var(--space-xs) 0 0;
    color: var(--text-secondary);
    line-height: 1.55;
}

.directory-editorial-intro__note { font-size: .875rem; }

/* Farming knowledge keeps its page identity (eyebrow, H1, scope, disclaimer). */
.directory-editorial-intro .organic-farming-knowledge-directory__intro,
.directory-editorial-intro .organic-farming-knowledge-directory__disclaimer {
    max-width: 34rem;
    margin: var(--space-xs) 0 0;
}

.directory-editorial-intro .organic-farming-knowledge-directory__disclaimer { font-size: .875rem; }

/* Image: controlled crop, one radius, no frame or tinted fill. */
.directory-editorial-intro .editorial-context-image {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: none;
    margin: 0;
    border-radius: 16px;
    overflow: hidden;
}

.directory-editorial-intro .editorial-context-image img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    object-position: 50% 50%;
}

.directory-editorial-intro--ingredients .editorial-context-image img { object-position: 50% 58%; }
.directory-editorial-intro--farming .editorial-context-image img,
.directory-editorial-intro--farming-knowledge .editorial-context-image img { object-position: 35% 40%; }

/* Facts: a short quiet list of real data, not another row of cards. */
.directory-editorial-intro__facts {
    display: grid;
    gap: var(--space-2xs);
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--text-secondary);
    font-size: .875rem;
    line-height: 1.5;
}

.directory-editorial-intro__facts li {
    display: flex;
    align-items: baseline;
    gap: var(--space-xs);
}

.directory-editorial-intro__facts li::before {
    content: "";
    flex: none;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-secondary);
    transform: translateY(-2px);
}

.directory-editorial-intro__facts strong { color: var(--text-primary); font-weight: 700; }

.directory-editorial-intro__action {
    gap: var(--space-xs);
    margin-top: var(--space-sm);
    min-height: 44px;
    padding: .55rem 1.1rem;
    font-size: .9375rem;
}

.directory-editorial-intro__action .aanya-icon { display: inline-flex; flex: none; }
.directory-editorial-intro__action svg { width: 1.1em; height: 1.1em; }
.directory-editorial-intro__action--down svg { transform: rotate(90deg); }

/* The anchored grid/search receives focus from the action. */
.ingredient-archive__grid:focus { outline: none; }
.ingredient-archive__grid:focus-visible {
    outline: 2px solid var(--focus-ring-color);
    outline-offset: 6px;
    border-radius: 4px;
}

@media (min-width: 768px) {
    .directory-editorial-intro {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: 1fr auto auto 1fr;
        grid-template-areas:
            "media ."
            "media heading"
            "media details"
            "media .";
        column-gap: clamp(1.5rem, 3.2vw, 3rem);
        row-gap: 0;
        align-items: start;
    }

    .directory-editorial-intro__media { align-self: stretch; }
    .directory-editorial-intro__details { margin-top: var(--space-md); }

    /* The image fills the band; the band is as tall as the copy, with a floor. */
    .directory-editorial-intro .editorial-context-image img {
        flex: 1 1 0;
        min-height: 15rem;
        height: 0;
        aspect-ratio: auto;
    }
}

/* Page identity (H1) first: copy | image, so reading order matches the visual order. */
@media (min-width: 768px) {
    .directory-editorial-intro--copy-first {
        grid-template-areas:
            ". media"
            "heading media"
            "details media"
            ". media";
    }
}

@media (min-width: 1024px) {
    .directory-editorial-intro .editorial-context-image img { min-height: clamp(16rem, 21vw, 19rem); }
}
