/* ==========================================================================
   EI TILL TODAY - CYBER-INSTITUTIONAL UI
   ========================================================================== */

   :root {
    --bg-dark: #050608;
    --text-main: #E2E8F0;
    --text-muted: #94A3B8;
    --glass-bg: rgba(15, 20, 25, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    /* Default neon accent (overridden by ACF) */
    --neon-accent: #00F2FF;
    --neon-glow: 0 0 10px rgba(0, 242, 255, 0.5), 0 0 20px var(--neon-accent);
}

/* ==========================================================================
   BASE & RESET
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
    transition: all 0.3s ease;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
}

/* ==========================================================================
   PRELOADER (CINEMATIC)
   ========================================================================== */
#ei-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-dark);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.logo-fragments {
    position: absolute;
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 800;
    color: var(--neon-accent);
    text-shadow: var(--neon-glow);
    display: flex;
    gap: 10px;
    z-index: 2;
}

.logo-fragments .frag {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    filter: blur(10px);
}

.donut-loader {
    width: 200px;
    height: 200px;
    position: relative;
    z-index: 1;
}

.donut-loader svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.donut-bg {
    fill: none;
    stroke: rgba(255,255,255,0.05);
    stroke-width: 2;
}

.donut-progress {
    fill: none;
    stroke: var(--neon-accent);
    stroke-width: 2;
    stroke-dasharray: 283; /* 2 * PI * 45 */
    stroke-dashoffset: 283;
    filter: drop-shadow(0 0 5px var(--neon-accent));
    transition: stroke-dashoffset 0.1s ease;
}

.progress-text {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--text-main);
    letter-spacing: 2px;
}

.loader-subtitle {
    margin-top: 60px;
    font-size: 0.8rem;
    letter-spacing: 4px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ==========================================================================
   UTILS & EFFECTS
   ========================================================================== */
.neon-text {
    color: var(--neon-accent);
    text-shadow: var(--neon-glow);
}

.neon-border {
    border: 1px solid var(--neon-accent);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2) inset, 0 0 10px rgba(0, 242, 255, 0.2);
}

.cyber-text {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

.cyber-btn {
    background: transparent;
    color: var(--neon-accent);
    border: 1px solid var(--neon-accent);
    padding: 0.8rem 1.5rem;
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.1) inset;
}

.cyber-btn:hover {
    background: rgba(0, 242, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.3) inset, 0 0 10px var(--neon-accent);
}

.cyber-input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.8rem 1rem;
    font-family: var(--font-body);
    border-radius: 4px;
    outline: none;
    transition: border-color 0.3s ease;
}

.cyber-input:focus {
    border-color: var(--neon-accent);
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.site-header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    background: rgba(5, 6, 8, 0.6);
    backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--glass-border);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.site-header.hide-header {
    transform: translateY(-100%);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-sub {
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 3px;
    color: var(--text-main);
}

.main-navigation ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.main-navigation a {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    letter-spacing: 1px;
    font-weight: 600;
    text-transform: uppercase;
}

.main-navigation a:hover {
    color: var(--neon-accent);
}

/* AI Ticker */
.ai-news-ticker {
    width: 100%;
    background: rgba(0, 242, 255, 0.05);
    border-bottom: 1px solid var(--glass-border);
    padding: 6px 0;
    overflow: hidden;
    position: relative;
    white-space: nowrap;
}

.ticker-track {
    display: inline-block;
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
    font-family: var(--font-body);
    margin-right: 3rem;
    color: var(--text-muted);
}

.ticker-dot {
    width: 6px;
    height: 6px;
    background: var(--neon-accent);
    border-radius: 50%;
    margin-right: 10px;
    box-shadow: var(--neon-glow);
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */
.glass-hero-section {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    padding: 0 2rem;
    overflow: hidden;
}

.hero-title {
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: -2px;
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
}

.hero-desc {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.cyber-grid-bg {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 0;
    transform: perspective(500px) rotateX(60deg) translateY(-100px) scale(3);
    pointer-events: none;
    opacity: 0.3;
}

.floating-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 1;
    opacity: 0.4;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--neon-accent);
    top: 20%;
    left: 10%;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: #6366f1;
    bottom: 10%;
    right: 15%;
}

/* ==========================================================================
   FEED & CARDS (ZERO-EXIT)
   ========================================================================== */
.ei-feed-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
    position: relative;
    z-index: 10;
}

.section-heading-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 4rem;
}

.section-title {
    font-size: 2rem;
    white-space: nowrap;
}

.cyber-line {
    height: 1px;
    width: 100%;
    background: linear-gradient(90deg, var(--neon-accent), transparent);
    opacity: 0.5;
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 3rem;
}

.floating-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    position: relative;
}

.floating-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(0, 242, 255, 0.1);
    border-color: rgba(0, 242, 255, 0.3);
}

.card-image-wrapper {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/10;
}

.post-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-card:hover .post-thumb {
    transform: scale(1.05);
}

.fallback-neural-bg {
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #0f1419, #1a222a);
    position: relative;
}

.fallback-neural-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.2;
    background-image: radial-gradient(var(--neon-accent) 1px, transparent 1px);
    background-size: 20px 20px;
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(5, 6, 8, 0.9), transparent);
    opacity: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease;
}

.floating-card:hover .card-overlay {
    opacity: 1;
}

.read-more-btn {
    padding: 0.5rem 1rem;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-card:hover .read-more-btn {
    transform: translateY(0);
}

.card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    font-family: var(--font-heading);
    letter-spacing: 1px;
}

.cat-tag {
    font-weight: 700;
    text-transform: uppercase;
}

.post-date {
    color: var(--text-muted);
}

.card-title {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.card-title a:hover {
    color: var(--neon-accent);
}

.card-excerpt {
    margin-bottom: 1rem;
    flex-grow: 1;
}

/* AJAX Loader */
.ajax-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
    gap: 15px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--neon-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.2);
}

@keyframes spin { 100% { transform: rotate(360deg); } }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
    padding: 6rem 2rem 2rem;
    border-top: 1px solid var(--glass-border);
    position: relative;
    z-index: 10;
}

.footer-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 4rem;
    margin-bottom: 4rem;
}

.col-title {
    font-size: 1rem;
    letter-spacing: 2px;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 0.8rem;
}

.footer-col ul a {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-col ul a:hover {
    color: var(--neon-accent);
}

.site-info {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 1px;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 2rem;
}

/* ==========================================================================
   LEAD GEN POPUP
   ========================================================================== */
#ei-lead-popup {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 350px;
    padding: 2rem;
    z-index: 999;
    transform: translateY(150%);
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(5, 6, 8, 0.85); /* Solidified overlay to fix bleeding */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), inset 0 0 0 1px var(--neon-accent);
}

#ei-lead-popup.active {
    transform: translateY(0);
    opacity: 1;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

.close-btn:hover {
    color: var(--text-main);
}

.popup-icon {
    width: 40px;
    height: 40px;
    color: var(--neon-accent);
    margin-bottom: 1rem;
}

#ei-lead-popup h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

#ei-lead-popup p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.lead-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ==========================================================================
   STRICT AI ARTICLE FORMATTING & SINGLE VIEW OVERLAY
   ========================================================================== */
.single-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5,6,8,0.95);
    backdrop-filter: blur(20px);
    z-index: 9999;
    overflow-y: auto;
    padding: 2rem;
}

.single-content-wrapper {
    max-width: 900px;
    margin: 0 auto;
    min-height: 100%;
}

.ai-strict-article {
    padding: 3rem;
    border-radius: 20px;
    position: relative;
}

.close-article-btn {
    position: absolute;
    top: 2rem;
    right: 2rem;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.article-header {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
}

.article-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin: 1rem 0;
}

.article-hero-image {
    width: 100%;
    aspect-ratio: 21/9;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 3rem;
}

.article-hero-image .hero-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* n8n Dynamic Strict Formatting */
.ai-intro-lead {
    font-size: 1.25rem;
    color: var(--text-main);
    line-height: 1.8;
    margin-bottom: 2.5rem;
    border-left: 2px solid var(--neon-accent);
    padding-left: 1.5rem;
}

.ai-highlights-box {
    margin: 3rem 0;
    padding: 2rem;
    background: rgba(0, 242, 255, 0.03);
    border-color: rgba(0, 242, 255, 0.2);
}

.highlights-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    letter-spacing: 2px;
}

.cyber-list {
    list-style: none;
    padding-left: 0;
}

.cyber-list li {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.cyber-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 8px;
    height: 8px;
    background: var(--neon-accent);
    border-radius: 50%;
    box-shadow: var(--neon-glow);
}

.cyber-h2, .cyber-h3 {
    margin: 3rem 0 1.5rem;
    color: var(--text-main);
}

.cyber-h2 span {
    font-weight: 400;
}

.article-body p {
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 992px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .main-navigation {
        display: none; /* Add hamburger logic in JS if needed */
    }
    
    .post-grid {
        grid-template-columns: 1fr;
    }
    
    #ei-lead-popup {
        bottom: 0;
        right: 0;
        width: 100%;
        border-radius: 16px 16px 0 0;
        border-bottom: none;
    }
}
