/* =====================================================
   Ayudas España — Homepage CSS (front-page.php only)
   ===================================================== */

/* ── Hero ──────────────────────────────────────────── */
.hero {
    position: relative;
    background: var(--navy);
    color: var(--white);
    text-align: center;
    padding: 3rem var(--pad) 4rem;
    overflow: hidden;
    min-height: 380px;
    display: flex;
    align-items: center;
}
.hero__bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 1;
}
/* Capa de oscuridad sobre la imagen (controlada desde Personalizar) */
.hero__bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,var(--hero-overlay-opacity, .60));
}
/* Franja bandera española */
.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--red) 33%, var(--gold) 33% 66%, var(--red) 66%);
}
.hero__inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}
.hero h1 {
    color: var(--white);
    margin-bottom: .75rem;
    text-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.hero__subtitle {
    font-size: 1rem;
    opacity: .9;
    margin-bottom: 1.75rem;
    line-height: 1.5;
}
.hero__ctas {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    align-items: center;
}
.hero__ctas .btn { width: 100%; max-width: 300px; }

/* Desktop: botones en fila */
@media (min-width: 600px) {
    .hero__ctas {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }
    .hero__ctas .btn { width: auto; max-width: none; }
}

/* ── Convocatorias Destacadas ──────────────────────── */
.featured-section { padding: var(--section) 0; }

.featured-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.featured-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.featured-card__icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: .25rem;
}
.featured-card__icon--red   { background: #FEE2E2; }
.featured-card__icon--blue  { background: #DBEAFE; }
.featured-card__icon--green { background: #D1FAE5; }
.featured-card__icon--gold  { background: #FEF3C7; }

.featured-card h3 {
    font-size: .95rem;
    margin: 0;
    color: var(--navy);
}
.featured-card .amount {
    font-size: .85rem;
    color: var(--red);
    font-weight: 700;
}
.featured-card .organismo {
    font-size: .8rem;
    color: var(--gray-600);
}
.featured-card__excerpt {
    font-size: .82rem;
    color: var(--gray-600);
    line-height: 1.5;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.featured-card .cta-link {
    font-size: .85rem;
    font-weight: 700;
    color: var(--red);
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}
.featured-card .cta-link::after { content: '→'; }

/* ── Segments: Encuentra Ayudas para Ti ────────────── */
.segments-section { padding: var(--section) 0; background: var(--gray-50); }

.segment-grid {
    display: grid;
    grid-template-columns: repeat(var(--seg-cols, 2), 1fr);
    gap: .75rem;
}

/* Mobile: 1 columna siempre */
@media (max-width: 599px) {
    .segment-grid { grid-template-columns: 1fr; }
    .segment-card { height: auto; min-height: var(--seg-height, 200px); }
}
/* Tablet: máximo 2 columnas */
@media (min-width: 600px) and (max-width: 1023px) {
    .segment-grid { grid-template-columns: repeat(2, 1fr); }
}
.segment-card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    height: var(--seg-height, 280px);
    display: flex;
    align-items: flex-end;
    text-decoration: none;
}
.segment-card:hover .segment-card__label { filter: brightness(.85); }
.segment-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* Placeholder cuando no hay imagen */
.segment-card__placeholder {
    position: absolute;
    inset: 0;
    background: var(--navy);
    opacity: .7;
}
.segment-card__label {
    position: relative;
    z-index: 1;
    width: 100%;
    background: var(--red); /* sobreescrito por inline style del Customizer */
    color: var(--white);
    padding: .5rem .75rem;
    font-weight: 700;
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: .4rem;
    transition: filter .2s;
}
.segment-card__icon { font-size: 1rem; }

/* ── Comunidades Autónomas ─────────────────────────── */
.comunidades-section { padding: var(--section) 0; }

.comunidades-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: center;
}
.comunidad-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .45rem .9rem;
    background: var(--pill-bg, var(--white));
    border: 1px solid var(--pill-border, var(--gray-200));
    border-radius: 99px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--pill-color, var(--navy));
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}
.comunidad-pill:hover {
    background: var(--pill-hover, var(--red));
    color: #fff;
    border-color: var(--pill-hover, var(--red));
    text-decoration: none;
}
.comunidad-pill__icon { font-size: 1rem; }

/* ── Últimos Artículos ─────────────────────────────── */
.latest-section { padding: var(--section) 0; background: var(--gray-50); }

/* Grid — usa --latest-cols inyectado desde PHP */
.latest-grid {
    display: grid;
    grid-template-columns: repeat(var(--latest-cols, 3), 1fr);
    gap: 1rem;
}

/* Forzar 1 columna en mobile independientemente del valor de --latest-cols */
@media (max-width: 599px) {
    .latest-grid { grid-template-columns: 1fr; }
}
@media (min-width: 600px) and (max-width: 1023px) {
    .latest-grid { grid-template-columns: repeat(min(var(--latest-cols, 3), 2), 1fr); }
}

/* Layout en lista: tarjetas horizontales */
.latest--list .latest-grid {
    grid-template-columns: 1fr;
}
.latest--list .article-card {
    flex-direction: row;
}
.latest--list .card__img-wrap {
    flex: 0 0 160px;
    width: 160px;
}
.latest--list .card__img {
    height: 100% !important;
    min-height: 120px;
}
.latest--list .card__img--placeholder {
    height: 120px;
}
@media (max-width: 599px) {
    .latest--list .article-card { flex-direction: column; }
    .latest--list .card__img-wrap { flex: none; width: 100%; }
    .latest--list .card__img { height: 170px !important; }
}

/* Tarjeta artículo */
.article-card { text-decoration: none; color: inherit; }
.article-card:hover { text-decoration: none; }
.article-card .card__title { font-size: .95rem; }

/* Imagen wrapper */
.card__img-wrap {
    display: block;
    overflow: hidden;
    flex-shrink: 0;
}
.card__img-wrap .card__img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    transition: transform .3s;
}
.card__img-wrap:hover .card__img { transform: scale(1.04); }

/* Placeholder sin imagen */
.card__img--placeholder {
    width: 100%;
    height: 170px;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--gray-400);
}

/* Categoría / tipo */
.card__category {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--red);
    margin-bottom: .35rem;
    text-decoration: none;
}
.card__category:hover { text-decoration: underline; }

/* Footer: fecha y autor */
.card__footer {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .75rem;
    align-items: center;
    padding: .6rem 1rem;
    border-top: 1px solid var(--gray-200);
    font-size: .78rem;
    color: var(--gray-600);
}
.card__date { white-space: nowrap; }
.card__author a { color: var(--gray-600); }
.card__author a:hover { color: var(--red); text-decoration: none; }

/* ── Footer Nav 3 columnas ─────────────────────────── */
/* Ya definido en main.css .footer-grid */
