/* ==============================================
   Article Card — Liquid Glass Premium Design
   ============================================== */

/* --- Variables --- */
.ed-card {
    --ac-glass-bg: var(--t-glass-bg, rgba(255, 255, 255, 0.04));
    --ac-glass-border: var(--t-glass-border, rgba(255, 255, 255, 0.08));
    --ac-glass-blur: var(--glass-blur-lg);
    --ac-radius: var(--radius-lg);
    --ac-radius-img: 10px;
    --ac-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    --ac-shadow-hover: 0 16px 48px rgba(0, 0, 0, 0.35);

    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    border-radius: var(--ac-radius);
    background: var(--ac-glass-bg);
    backdrop-filter: blur(var(--ac-glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--ac-glass-blur)) saturate(140%);
    border: 1px solid var(--ac-glass-border);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 0 0 0 transparent,
        0 0 0 0 transparent;
    transition: transform 0.5s ease-out,
        box-shadow 0.5s ease-out,
        border-color 0.5s ease-out,
        border-bottom-color 0.5s ease-out;
}

/* --- Gradient border overlay (liquid glass) --- */
.ed-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--ac-radius);
    padding: 1px;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.14),
            rgba(255, 255, 255, 0.02) 40%,
            rgba(255, 255, 255, 0.08));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    pointer-events: none;
    z-index: 3;
    transition: opacity 0.5s ease-out;
}

/* --- Shimmer highlight overlay (desktop only) --- */
.ed-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--ac-radius);
    background: linear-gradient(135deg,
            transparent 30%,
            rgba(255, 255, 255, 0.03) 50%,
            transparent 70%);
    opacity: 0;
    pointer-events: none;
    z-index: 4;
    transition: opacity 0.6s ease-out;
}

/* --- Image --- */
.ed-card__image-wrap {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.ed-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease-out,
        filter 0.5s ease-out;
}

/* ==============================================
   Desktop-only hover animations
   @media (hover: hover) — excludes touch devices
   ============================================== */
@media (hover: hover) {

    /* Base transitions for smooth exit */
    .ed-card__badge {
        transition: transform 0.5s ease-out;
    }

    .ed-card__title {
        transition: color 0.5s ease-out;
    }

    .ed-card__date {
        transition: opacity 0.5s ease-out;
        opacity: 0.6;
    }

    .ed-card:hover {
        transform: translateY(-4px);
        box-shadow:
            0 12px 40px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.08),
            0 0 0 1px rgba(255, 255, 255, 0.06),
            0 0 0 0 transparent;
        border-color: rgba(255, 255, 255, 0.14);
    }

    /* Shimmer — gentle fade in */
    .ed-card:hover::after {
        opacity: 1;
    }

    /* Glass border — subtle intensification */
    .ed-card:hover::before {
        opacity: 1.2;
    }

    /* Image — gentle zoom */
    .ed-card:hover .ed-card__image {
        transform: scale(1.03);
        filter: brightness(1.05);
    }

    /* Badges — micro lift */
    .ed-card:hover .ed-card__badge {
        transform: translateY(-2px);
    }

    .ed-card:hover .ed-card__badge:nth-child(2) {
        transition-delay: 0.04s;
    }

    .ed-card:hover .ed-card__badge:nth-child(3) {
        transition-delay: 0.08s;
    }

    /* Title — accent color only, no glow */
    .ed-card:hover .ed-card__title {
        color: var(--t-accent, #ef4444);
    }

    /* Playlist cards — subtle accent glow */
    .ed-card[data-content-type="playlist"]:hover {
        box-shadow:
            0 12px 40px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.08),
            0 0 0 1px var(--t-accent-muted, rgba(100, 120, 200, 0.12)),
            0 6px 24px -4px var(--t-accent-muted, rgba(100, 120, 200, 0.2));
    }

    .ed-card:hover .ed-card__date {
        opacity: 1;
    }
}

/* --- Badges (over image) --- */
.ed-card__badges {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 2;
}

.ed-card__badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 100px;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.3;
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
}

.ed-card__badge--tag {
    background: var(--t-accent, #ef4444);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.ed-card__badge--severity {
    background: rgba(0, 0, 0, 0.5);
    color: rgba(255, 255, 255, 0.85);
}

/* --- Severity dot inside badge --- */
.severity-led {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.severity-led--defcon1,
.severity-led--critical {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.8);
    animation: led-blink 1.5s ease-in-out infinite;
}

.severity-led--high {
    background: #f97316;
    box-shadow: 0 0 4px rgba(249, 115, 22, 0.6);
}

.severity-led--medium {
    background: #eab308;
    box-shadow: 0 0 4px rgba(234, 179, 8, 0.4);
}

.severity-led--low {
    background: #6b7280;
}

@keyframes led-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* --- Content type badge (playlist/article) --- */
.ed-card__badge--playlist {
    background: var(--t-accent-muted, rgba(100, 120, 200, 0.2));
    color: var(--t-accent-solid, #6478c8);
    border: 1px solid var(--t-accent-muted, rgba(100, 120, 200, 0.3));
}

.ed-card__badge--article {
    background: var(--t-badge-bg, rgba(255, 255, 255, 0.08));
    color: var(--t-text-muted, rgba(255, 255, 255, 0.5));
    border: 1px solid var(--t-glass-border, rgba(255, 255, 255, 0.06));
}

/* --- Content type glow (bottom border accent) --- */
.ed-card[data-content-type="playlist"] {
    border-bottom: 2px solid var(--t-accent-muted, rgba(100, 120, 200, 0.25));
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 0 0 0 transparent,
        0 4px 16px -4px var(--t-accent-muted, rgba(100, 120, 200, 0.15));
}

.ed-card[data-content-type="article"] {
    border-bottom: 2px solid var(--t-glass-border, rgba(255, 255, 255, 0.04));
}

/* --- Body --- */
.ed-card__body {
    padding: 14px 16px 16px;
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* --- Title --- */
.ed-card__title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--t-card-title, #fff);
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin: 0 0 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.5s ease-out;
    text-shadow: none;
}

/* hover → see @media (hover: hover) block above */

/* --- Excerpt --- */
.ed-card__excerpt {
    font-size: 0.825rem;
    line-height: 1.55;
    color: var(--t-card-text, #9ca3af);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Footer (date) --- */
.ed-card__date {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.6rem;
    color: var(--t-text-muted, rgba(255, 255, 255, 0.4));
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: auto;
    padding-top: 10px;
}

/* --- Featured card (first 2) --- larger title */
.ed-card--featured .ed-card__title {
    font-size: 1.1rem;
}

/* ==============================================
   Editorial Grid — Layout
   ============================================== */
.editorial-grid {
    display: grid;
    gap: 20px;
    padding-bottom: 3rem;
    grid-template-columns: 1fr;
}

/* ==============================================
   Responsive
   ============================================== */

/* Tablet */
@media (min-width: 640px) {
    .editorial-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .editorial-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .ed-card--featured {
        grid-column: span 1;
    }
}

/* ==============================================
   Mobile optimizations
   ============================================== */
@media (max-width: 639px) {
    .ed-card {
        --ac-glass-blur: var(--glass-blur-md);
        --ac-radius: 14px;
    }
}

/* ==============================================
   Reduced motion
   ============================================== */
@media (prefers-reduced-motion: reduce) {

    .ed-card,
    .ed-card__image,
    .ed-card__badge,
    .ed-card__title,
    .ed-card__date {
        transition: none;
    }

    .ed-card:hover {
        transform: none;
    }

    .ed-card:hover .ed-card__image {
        transform: none;
        filter: none;
    }

    .ed-card::after {
        display: none;
    }

    .severity-led--defcon1,
    .severity-led--critical {
        animation: none;
    }
}

/* ==============================================
   Fallback (no backdrop-filter support)
   ============================================== */
@supports not (backdrop-filter: blur(16px)) {
    .ed-card {
        background: var(--t-card-bg, rgba(10, 5, 5, 0.85));
    }

    .ed-card__badge {
        background: rgba(0, 0, 0, 0.75);
    }
}