/**
 * Education News Feed v1.2 – frontend styles
 *
 * Default "list" layout mirrors the reference design: light gray section,
 * thumbnail on the left, and on the right the title, an icon meta row
 * (source + date), a 3-4 line excerpt and an outlined "Read More" button.
 *
 * All colors are driven by CSS custom properties so the widget, shortcode
 * and admin settings can override them per instance:
 *   --enf-accent      accent color (buttons, hover states)
 *   --enf-card-bg     card background (grid cards + detail page)
 *   --enf-section-bg  section background (list wrapper)
 *   --enf-radius      corner radius
 */

.enf-news-section {
        --enf-accent: #2563eb;
        --enf-card-bg: #ffffff;
        --enf-section-bg: #f1f2f4;
        --enf-radius: 12px;
        margin: 1.5rem 0;
        padding: 30px 34px 32px;
        background: var(--enf-section-bg, #f1f2f4);
        border-radius: var(--enf-radius, 12px);
}

.enf-news-section[style*="--enf-section-bg:transparent"] {
        padding-left: 0;
        padding-right: 0;
}

/* Section heading */
.enf-news-heading {
        position: relative;
        margin: 0 0 1.4rem;
        padding-left: 0.8em;
        font-size: clamp(1.35rem, 2.4vw, 1.75rem);
        font-weight: 700;
        line-height: 1.3;
        color: #0f172a;
}

.enf-news-heading::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0.18em;
        bottom: 0.18em;
        width: 0.2em;
        border-radius: 99px;
        background: var(--enf-accent, #2563eb);
}

/* ==================================================================
 * LIST LAYOUT (reference design)
 * ================================================================ */
.enf-news-list {
        display: flex;
        flex-direction: column;
        gap: 26px;
}

.enf-news-item {
        display: grid;
        grid-template-columns: 300px minmax(0, 1fr);
        gap: 30px;
        align-items: flex-start;
}

.enf-item-thumb {
        position: relative;
        display: block;
        aspect-ratio: 16 / 10;
        overflow: hidden;
        border-radius: 6px;
        background: linear-gradient(135deg, #e8ecf3 0%, #dde3ec 100%);
        text-decoration: none !important;
        outline-offset: 3px;
}

.enf-item-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        transition: transform 0.35s ease;
}

.enf-news-item:hover .enf-item-thumb img {
        transform: scale(1.04);
}

.enf-thumb-ph {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #a4b0c2;
}

.enf-thumb-ph svg {
        width: 34px;
        height: 34px;
}

/* Title */
.enf-item-title {
        margin: 2px 0 10px;
        font-size: clamp(1.15rem, 1.8vw, 1.32rem);
        font-weight: 700;
        line-height: 1.4;
        color: #111827;
}

.enf-item-title a {
        color: inherit;
        text-decoration: none !important;
        transition: color 0.2s ease;
}

.enf-item-title a:hover,
.enf-item-title a:focus-visible {
        color: var(--enf-accent, #2563eb);
}

/* Meta row: [rss icon] Source   [calendar icon] 09/09/2026 */
.enf-item-meta {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px 22px;
        margin: 0 0 12px;
        font-size: 0.93rem;
        color: #374151;
}

.enf-meta-item {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        line-height: 1.2;
}

.enf-meta-item svg {
        width: 15px;
        height: 15px;
        flex: none;
}

.enf-meta-item a {
        color: inherit;
        text-decoration: none !important;
        transition: color 0.2s ease;
}

.enf-meta-item a:hover {
        color: var(--enf-accent, #2563eb);
}

/* Excerpt: 3-4 readable lines */
.enf-item-excerpt,
.enf-card-excerpt {
        margin: 0 0 18px;
        font-size: 1rem;
        line-height: 1.66;
        color: #3f4a5a;
        display: -webkit-box;
        -webkit-line-clamp: 4;
        line-clamp: 4;
        -webkit-box-orient: vertical;
        overflow: hidden;
}

/* Outlined "Read More" button */
.enf-readmore {
        display: inline-flex;
        align-items: center;
        gap: 9px;
        padding: 11px 26px;
        background: var(--enf-card-bg, #ffffff);
        border: 1px solid #c9cfd9;
        border-radius: 8px;
        color: #111827;
        font-size: 0.95rem;
        font-weight: 500;
        line-height: 1;
        text-decoration: none !important;
        transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
        outline-offset: 3px;
}

.enf-readmore .enf-arrow {
        width: 6px;
        height: 6px;
        border-top: 2px solid currentColor;
        border-right: 2px solid currentColor;
        transform: rotate(45deg);
        margin-top: -1px;
        transition: transform 0.2s ease;
}

.enf-readmore:hover,
.enf-readmore:focus-visible {
        background: var(--enf-accent, #2563eb);
        border-color: var(--enf-accent, #2563eb);
        color: #ffffff;
        box-shadow: 0 10px 20px -10px rgba(37, 99, 235, 0.55);
}

.enf-readmore:hover .enf-arrow {
        transform: rotate(45deg) translate(2px, -2px);
}

/* "View all news" link */
.enf-view-all {
        margin-top: 22px;
        text-align: right;
}

.enf-view-all a {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: var(--enf-accent, #2563eb);
        font-size: 0.93rem;
        font-weight: 600;
        text-decoration: none !important;
}

.enf-view-all a:hover {
        text-decoration: underline !important;
}

.enf-view-all .enf-arrow {
        width: 6px;
        height: 6px;
        border-top: 2px solid currentColor;
        border-right: 2px solid currentColor;
        transform: rotate(45deg);
}

/* ==================================================================
 * GRID LAYOUT (optional)
 * ================================================================ */
.enf-news-grid {
        display: grid;
        gap: 22px;
        grid-template-columns: repeat(3, 1fr);
}

.enf-news-grid.enf-cols-1 { grid-template-columns: 1fr; }
.enf-news-grid.enf-cols-2 { grid-template-columns: repeat(2, 1fr); }
.enf-news-grid.enf-cols-3 { grid-template-columns: repeat(3, 1fr); }
.enf-news-grid.enf-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
        .enf-news-grid.enf-cols-4 { grid-template-columns: repeat(3, 1fr); }
        .enf-news-grid.enf-cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 782px) {
        .enf-news-grid.enf-cols-4,
        .enf-news-grid.enf-cols-3,
        .enf-news-grid.enf-cols-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
        .enf-news-grid.enf-cols-4,
        .enf-news-grid.enf-cols-3,
        .enf-news-grid.enf-cols-2,
        .enf-news-grid.enf-cols-1 { grid-template-columns: 1fr; }
}

.enf-news-card {
        height: 100%;
        display: flex;
        flex-direction: column;
        background: var(--enf-card-bg, #ffffff);
        border: 1px solid rgba(15, 23, 42, 0.07);
        border-radius: var(--enf-radius, 12px);
        box-shadow:
                0 1px 2px rgba(15, 23, 42, 0.05),
                0 8px 24px -14px rgba(15, 23, 42, 0.14);
        overflow: hidden;
        transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.enf-news-card:hover {
        transform: translateY(-4px);
        border-color: rgba(15, 23, 42, 0.12);
        box-shadow:
                0 4px 10px rgba(15, 23, 42, 0.08),
                0 22px 44px -18px rgba(15, 23, 42, 0.24);
}

.enf-card-thumb {
        position: relative;
        display: block;
        aspect-ratio: 16 / 9;
        overflow: hidden;
        background: linear-gradient(135deg, #e8ecf3 0%, #dde3ec 100%);
        text-decoration: none !important;
}

.enf-card-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        transition: transform 0.35s ease;
}

.enf-news-card:hover .enf-card-thumb img {
        transform: scale(1.045);
}

.enf-card-body {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        gap: 0.55rem;
        padding: 1.15rem 1.2rem 1.25rem;
}

.enf-card-title {
        margin: 0;
        font-size: 1.02rem;
        font-weight: 700;
        line-height: 1.45;
        color: #111827;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
}

.enf-card-title a {
        color: inherit;
        text-decoration: none !important;
        transition: color 0.2s ease;
}

.enf-news-card:hover .enf-card-title a,
.enf-card-title a:focus-visible {
        color: var(--enf-accent, #2563eb);
}

.enf-news-card .enf-item-meta {
        margin-bottom: 0;
        font-size: 0.82rem;
}

.enf-card-excerpt {
        font-size: 0.92rem;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        margin-bottom: 6px;
}

.enf-readmore--sm {
        padding: 9px 18px;
        font-size: 0.86rem;
        margin-top: auto;
        align-self: flex-start;
}

/* ==================================================================
 * SINGLE DETAIL PAGE (opened by "Read More")
 * ================================================================ */
.enf-single {
        max-width: 880px;
        margin: 0 auto;
        padding: 2rem 1rem 3rem;
}

.enf-single-hero {
        margin: 0 0 22px;
}

.enf-single-hero img {
        width: 100%;
        aspect-ratio: 16 / 8;
        object-fit: cover;
        display: block;
        border-radius: var(--enf-radius, 12px);
        background: linear-gradient(135deg, #e8ecf3 0%, #dde3ec 100%);
}

.enf-single-card {
        background: var(--enf-card-bg, #ffffff);
        border: 1px solid rgba(15, 23, 42, 0.07);
        border-radius: var(--enf-radius, 12px);
        padding: clamp(1.4rem, 3.5vw, 2.4rem);
        box-shadow:
                0 1px 2px rgba(15, 23, 42, 0.04),
                0 18px 40px -28px rgba(15, 23, 42, 0.18);
}

.enf-single-title {
        margin: 0 0 14px;
        font-size: clamp(1.45rem, 3vw, 1.95rem);
        font-weight: 700;
        line-height: 1.32;
        color: #0f172a;
}

.enf-single-meta {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px 22px;
        padding-bottom: 16px;
        margin-bottom: 20px;
        border-bottom: 1px solid #e8eaee;
        font-size: 0.93rem;
        color: #4b5563;
}

.enf-single-content {
        color: #1f2937;
        font-size: 1.02rem;
        line-height: 1.78;
        word-wrap: break-word;
}

.enf-single-content p {
        margin: 0 0 1.05em;
}

.enf-single-content p:last-child {
        margin-bottom: 0;
}

.enf-single-content h2,
.enf-single-content h3,
.enf-single-content h4 {
        color: #0f172a;
        line-height: 1.35;
        margin: 1.4em 0 0.6em;
}

.enf-single-content a {
        color: var(--enf-accent, #2563eb);
}

.enf-single-content ul,
.enf-single-content ol {
        margin: 0 0 1.05em;
        padding-left: 1.4em;
}

.enf-single-content blockquote {
        margin: 0 0 1.05em;
        padding: 0.2em 0 0.2em 1.1em;
        border-left: 3px solid var(--enf-accent, #2563eb);
        color: #4b5563;
}

/* Images and figures coming from the feed body. */
.enf-single-content img {
        max-width: 100%;
        height: auto;
        border-radius: 10px;
}

.enf-single-content figure {
        margin: 0 0 1.2em;
}

.enf-single-content figure img {
        display: block;
        margin: 0 auto;
}

.enf-single-content figcaption {
        margin-top: 0.45em;
        font-size: 0.88rem;
        color: #64748b;
        text-align: center;
}

.enf-single-content hr {
        margin: 1.7em 0;
        border: 0;
        border-top: 1px solid #e8eaee;
}

.enf-single-content table {
        width: 100%;
        margin: 0 0 1.2em;
        border-collapse: collapse;
        font-size: 0.95rem;
}

.enf-single-content th,
.enf-single-content td {
        padding: 8px 10px;
        border: 1px solid #e4e7ec;
        text-align: left;
}

.enf-single-content .enf-single-empty {
        background: #f8fafc;
        border: 1px dashed #d3d9e3;
        border-radius: 10px;
        padding: 14px 18px;
        color: #64748b;
        font-size: 0.95rem;
}

/* ==================================================================
 * NEWS ARCHIVE (/{url-base}/ when no page occupies it)
 * ================================================================ */
.enf-archive {
        max-width: 1080px;
        margin: 0 auto;
        padding: 2.2rem 1rem 3rem;
}

.enf-archive-title {
        position: relative;
        margin: 0 0 1.6rem;
        padding-left: 0.8em;
        font-size: clamp(1.5rem, 2.8vw, 1.95rem);
        font-weight: 700;
        line-height: 1.3;
        color: #0f172a;
}

.enf-archive-title::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0.18em;
        bottom: 0.18em;
        width: 0.2em;
        border-radius: 99px;
        background: var(--enf-accent, #2563eb);
}

/* White rows so the archive works on any theme background. */
.enf-archive .enf-news-item {
        background: var(--enf-card-bg, #ffffff);
        border: 1px solid rgba(15, 23, 42, 0.06);
        border-radius: var(--enf-radius, 12px);
        padding: 20px;
}

.enf-archive-empty {
        padding: 1.6rem 1.4rem;
        border: 1px dashed rgba(15, 23, 42, 0.18);
        border-radius: var(--enf-radius, 12px);
        background: rgba(248, 250, 252, 0.65);
        color: #475569;
        text-align: center;
}

.enf-archive-pagination {
        margin-top: 28px;
}

.enf-archive-pagination .nav-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 6px;
}

.enf-archive-pagination .page-numbers {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 38px;
        height: 38px;
        padding: 0 10px;
        border: 1px solid #d5dae2;
        border-radius: 8px;
        background: var(--enf-card-bg, #ffffff);
        color: #374151;
        font-size: 0.92rem;
        text-decoration: none !important;
        transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.enf-archive-pagination .page-numbers:hover,
.enf-archive-pagination .page-numbers:focus-visible {
        border-color: var(--enf-accent, #2563eb);
        color: var(--enf-accent, #2563eb);
}

.enf-archive-pagination .page-numbers.current {
        background: var(--enf-accent, #2563eb);
        border-color: var(--enf-accent, #2563eb);
        color: #ffffff;
}

/* ==================================================================
 * Empty / error states
 * ================================================================ */
.enf-news-empty,
.enf-news-error {
        padding: 1.6rem 1.4rem;
        border: 1px dashed rgba(15, 23, 42, 0.18);
        border-radius: var(--enf-radius, 12px);
        background: rgba(255, 255, 255, 0.55);
        color: #475569;
        text-align: center;
}

.enf-news-empty p,
.enf-news-error {
        margin: 0;
        font-size: 0.95rem;
}

.enf-news-empty p + p,
.enf-news-empty .enf-news-empty-sub {
        margin-top: 0.4rem;
        font-size: 0.85rem;
        color: #94a3b8;
}

.enf-news-error strong {
        color: #0f172a;
}

/* ==================================================================
 * Responsive
 * ================================================================ */
@media (max-width: 820px) {
        .enf-news-section {
                padding: 22px 18px 24px;
        }

        .enf-news-item {
                grid-template-columns: 1fr;
                gap: 16px;
        }

        .enf-item-thumb {
                aspect-ratio: 16 / 9;
        }

        .enf-item-title {
                margin-top: 0;
        }

        .enf-readmore {
                padding: 10px 22px;
        }
}

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
        .enf-news-card,
        .enf-item-thumb img,
        .enf-card-thumb img,
        .enf-readmore,
        .enf-readmore .enf-arrow,
        .enf-item-title a,
        .enf-meta-item a,
        .enf-archive-pagination .page-numbers {
                transition: none;
        }
        .enf-news-card:hover,
        .enf-item-thumb img,
        .enf-card-thumb img {
                transform: none;
        }
}
