/* Base project styles */

:root {
    --gate-bg-color: #0d111d;
    --gate-frame-bg-start: rgba(25, 30, 50, 0.96);
    --gate-frame-bg-end: rgba(15, 20, 40, 0.96);
    --gate-frame-border: rgba(255, 255, 255, 0.15);
    --gate-artwork-bg-start: #848688;
    /* Facebook Blue */
    --gate-artwork-bg-end: #ffffff;
    /* LinkedIn Blue */
    --gate-artwork-text: #ffffff;
    --gate-text-color: #e0e6f0;
    --gate-error-color: #ff6b6b;
    --gate-progress-color-start: #6a11cb;
    --gate-progress-color-end: #2575fc;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f7fafc;
    color: #333;
}

.gate-body-locked {
    overflow: hidden;
    touch-action: none;
}

/* Premium Glassmorphism Overlay */
/* FIX: Use Transitions instead of Keyframes for container to prevent 'Flash on Load' */
.gate-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 17, 29, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    padding: 1.5rem;

    /* Default Hidden State (prevents flash) */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    /* Smooth Transition */
    transition: opacity 0.4s ease, visibility 0.4s ease, backdrop-filter 0.4s ease;
}

/* Active State (When .gate-hidden is REMOVED by JS) */
.gate-overlay:not(.gate-hidden) {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Ensure .gate-hidden reinforces the hidden state */
.gate-overlay.gate-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.gate-frame {
    position: relative;
    width: min(450px, 95vw);
    max-height: 90vh;
    border-radius: 20px;
    overflow: hidden;
    color: var(--gate-text-color);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
    background: linear-gradient(145deg, var(--gate-frame-bg-start), var(--gate-frame-bg-end));
    padding: 2rem 1.75rem;
    transform: scale(0.95);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    opacity: 0;
    /* Hidden initially */
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.27), opacity 0.3s ease;
}

/* Only animate frame when overlay is visible */
.gate-overlay:not(.gate-hidden) .gate-frame {
    transform: scale(1);
    opacity: 1;
    /* Optional: Add a small delay so it pops in after background starts fading */
    transition-delay: 0.1s;
}


.gate-overlay.gate-processing .gate-frame::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--gate-progress-color-start), var(--gate-progress-color-end));
    animation: gate-progress 1.5s linear infinite;
    z-index: 10;
    border-radius: 4px;
}

@keyframes gate-progress {
    0% {
        transform: translateX(-100%) scaleX(0);
    }

    50% {
        transform: translateX(0%) scaleX(1);
    }

    100% {
        transform: translateX(100%) scaleX(0);
    }
}

.gate-close-btn {
    display: none;
}

/* Clickable Artwork Area */
.gate-artwork {
    position: relative;
    border-radius: 16px;
    padding: 2.5rem 1.5rem;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, var(--gate-artwork-bg-start), var(--gate-artwork-bg-end));
    overflow: hidden;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.27), box-shadow 0.2s ease;
    transform: translateY(0);
}

.gate-artwork:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

.gate-artwork:active {
    transform: translateY(-2px) scale(0.99);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Pulse effect */
.gate-artwork::after {
    content: '';
    position: absolute;
    inset: -2px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    animation: pulseBorder 2s infinite ease-out;
    pointer-events: none;
    opacity: 0;
}

@keyframes pulseBorder {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }

    50% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(1.1);
        opacity: 0;
    }
}

.gate-artwork:hover::after {
    animation: none;
    opacity: 1;
    transform: scale(1);
    border-color: rgba(255, 255, 255, 0.3);
}


.gate-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-weight: 700;
    letter-spacing: 0.05em;
    font-size: 0.8rem;
    color: var(--gate-artwork-text);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

.gate-step-indicator {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

.gate-visual {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    margin-top: 0.5rem;
}

.gate-visual::before,
.gate-visual::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(25px);
    opacity: 0.3;
    background: radial-gradient(circle, rgba(140, 150, 255, 0.4), transparent 70%);
    animation: floatingGlow 15s ease-in-out infinite alternate;
}

.gate-visual::before {
    width: 120px;
    height: 120px;
    left: 10%;
    top: 10%;
    animation-delay: 0s;
}

.gate-visual::after {
    width: 180px;
    height: 180px;
    right: 15%;
    bottom: 5%;
    animation-delay: 2s;
    animation-duration: 18s;
}

@keyframes floatingGlow {
    0% {
        transform: translateX(0) translateY(0) scale(1);
        opacity: 0.3;
    }

    100% {
        transform: translateX(20px) translateY(10px) scale(1.05);
        opacity: 0.4;
    }
}


.gate-artwork-image {
    position: relative;
    z-index: 2;
    display: block;
    width: 100%;
    height: auto;
    max-height: 280px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.gate-logo {
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--gate-artwork-text);
    text-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}

.gate-error {
    margin-top: 1rem;
    color: var(--gate-error-color);
    font-size: 0.95rem;
    text-align: center;
    font-weight: 500;
}

.gate-fallback-button {
    width: 100%;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--gate-text-color);
    transition: all 0.2s ease;
}

.gate-fallback-button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

.gate-fallback-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gate-content.gate-locked {
    filter: blur(5px) grayscale(0.5);
    pointer-events: none;
    user-select: none;
    transition: filter 0.4s ease;
}

/* Existing styles for article, home, admin, etc. */

.post-article {
    position: relative;
}

.post-title {
    font-size: 2.5rem;
    font-weight: 700;
}

.post-metrics {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    color: #64748b;
    font-size: 0.95rem;
    flex-wrap: wrap;
}

.post-views-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
    color: #475569;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.post-views-icon {
    font-size: 1rem;
    line-height: 1;
}

.post-views-label {
    line-height: 1;
}

.jump-main {
    display: flex;
    justify-content: center;
}

.section-video {
    width: 100%;
    max-height: 78vh;
    background: #000;
    border-radius: 0.75rem;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.section-content {
    line-height: 1.7;
    white-space: pre-line;
}

@media (max-width: 576px) {
    .gate-frame {
        padding: 1.25rem 1rem;
    }

    .gate-artwork {
        padding: 2rem 1rem;
    }

    .post-title {
        font-size: 2rem;
    }

    .section-video {
        max-height: 65vh;
    }
}

/* Admin dashboard enhancements */
.admin-posts-table .actions-cell .action-buttons .action-form {
    margin: 0;
}

.admin-posts-table .actions-cell .action-buttons .action-form button {
    height: 100%;
}

@media (max-width: 768px) {
    .admin-posts-table {
        border-collapse: separate;
        border-spacing: 0 1rem;
    }

    .admin-posts-table thead {
        display: none;
    }

    .admin-posts-table tbody {
        display: block;
    }

    .admin-posts-table tr {
        display: block;
        margin-bottom: 1rem;
        background: #ffffff;
        border: 1px solid rgba(15, 23, 42, 0.08);
        border-radius: 1rem;
        padding: 1rem 1rem 0.75rem;
        box-shadow: 0 14px 32px -18px rgba(15, 23, 42, 0.4);
    }

    .admin-posts-table tr:last-child {
        margin-bottom: 0;
    }

    .admin-posts-table td {
        display: block;
        width: 100%;
        padding: 0.35rem 0;
        border: none;
        text-align: left !important;
    }

    .admin-posts-table td+td {
        margin-top: 0.5rem;
    }

    .admin-posts-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #6c757d;
        margin-bottom: 0.15rem;
        font-weight: 600;
    }

    .admin-posts-table td[colspan]::before {
        display: none;
    }

    .admin-posts-table td.actions-cell {
        padding-top: 0.75rem;
    }

    .admin-posts-table td.actions-cell::before {
        margin-bottom: 0.5rem;
    }

    .admin-posts-table td.actions-cell .action-buttons {
        justify-content: flex-start !important;
    }

    .admin-posts-table td.actions-cell .action-buttons>* {
        flex: 1 1 100%;
    }

    .admin-posts-table td.actions-cell .action-buttons .btn,
    .admin-posts-table td.actions-cell .action-buttons .action-form button {
        width: 100%;
    }
}

/* Media input state */
.media-input-area.media-disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* Home hero styling */
.app-main.home-hero {
    position: relative;
    max-width: 100%;
    width: 100%;
    margin-top: 0 !important;
    padding: clamp(4rem, 12vh, 8rem) clamp(1.25rem, 6vw, 4rem);
    border-radius: 0;
    background-image: linear-gradient(135deg,
            #0f172a 0%,
            #1b2740 12%,
            #2c3a75 25%,
            #462f88 37%,
            #6d2fa3 50%,
            #a136b2 62%,
            #d462c1 75%,
            #a855f7 87%,
            #38bdf8 100%);
    background-size: 400% 400%;
    animation: auroraShift 24s linear infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #f8fafc;
    min-height: calc(100vh - 4rem);
}


.app-main.home-hero::before,
.app-main.home-hero::after {
    content: "";
    position: absolute;
    inset: -35%;
    background: radial-gradient(circle at center, rgba(250, 250, 255, 0.32), transparent 70%);
    opacity: 0.35;
    filter: blur(80px);
    animation: auroraDrift 22s linear infinite;
}

.app-main.home-hero::after {
    inset: -45%;
    background: conic-gradient(from 90deg,
            rgba(99, 102, 241, 0.45),
            rgba(14, 165, 233, 0.35),
            rgba(147, 51, 234, 0.45),
            transparent,
            rgba(59, 130, 246, 0.35),
            rgba(8, 47, 73, 0.45));
    mix-blend-mode: screen;
    animation-duration: 32s;
    animation-direction: reverse;
}

.app-main.home-hero .home-hero-content {
    position: relative;
    z-index: 2;
    display: grid;
    place-items: center;
    gap: 1.5rem;
    max-width: 720px;
    width: 100%;
}

.home-hero-title {
    font-size: clamp(2.5rem, 9vw, 6rem);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #f8fafc;
    text-shadow: 0 25px 50px rgba(15, 23, 42, 0.45);
    background-image: linear-gradient(120deg,
            #38bdf8 0%,
            #0ea5e9 14%,
            #7dd3fc 28%,
            #c084fc 42%,
            #d946ef 56%,
            #f472b6 70%,
            #a855f7 84%,
            #4338ca 100%);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: auroraShift 20s linear infinite reverse;
}

.home-hero-orbit {
    position: absolute;
    inset: auto 50% 10%;
    width: clamp(320px, 60vw, 640px);
    height: clamp(320px, 60vw, 640px);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.4), transparent 70%);
    filter: blur(18px);
    transform: translateX(-50%);
    animation: orbitPulse 18s ease-in-out infinite;
}

.home-hero-orbit--secondary {
    inset: 5% 50% auto;
    background: radial-gradient(circle, rgba(147, 51, 234, 0.4), transparent 70%);
    animation-duration: 24s;
    animation-delay: -8s;
    mix-blend-mode: screen;
}

.app-main.home-hero.container {
    padding-left: 0;
    padding-right: 0;
}

@keyframes auroraShift {
    0% {
        background-position: 0% 50%;
    }

    25% {
        background-position: 50% 0%;
    }

    50% {
        background-position: 100% 50%;
    }

    75% {
        background-position: 50% 100%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes auroraDrift {
    0% {
        transform: rotate(0deg) scale(1);
        opacity: 0.3;
    }

    50% {
        transform: rotate(180deg) scale(1.05);
        opacity: 0.45;
    }

    100% {
        transform: rotate(360deg) scale(1);
        opacity: 0.3;
    }
}

@keyframes orbitPulse {

    0%,
    100% {
        transform: translateX(-50%) scale(0.95);
        opacity: 0.4;
    }

    50% {
        transform: translateX(-50%) scale(1.05);
        opacity: 0.65;
    }
}

@media (max-width: 768px) {
    .home-hero-title {
        letter-spacing: 0.2em;

    }
}

/* Homepage listing */
.home-heading {
    max-width: 720px;
    margin: 0 auto 2rem;
}

.home-title {
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 700;
}

.home-subtitle {
    font-size: 1rem;
}

.home-post-card {
    border-radius: 1rem;
}

.home-post-title {
    color: #111827;
}

.home-post-title:hover {
    color: #0d6efd;
}

.home-post-meta {
    font-size: 0.9rem;
}

.home-post-summary {
    font-size: 1rem;
    color: #4b5563;
}

.home-pagination {
    margin-top: 2rem;
}

@media (max-width: 768px) {
    .home-heading {
        margin-bottom: 1.5rem;
    }

    .home-post-card {
        padding: 0.25rem;
    }
}

.home-hero-content {
    position: relative;
    display: grid;
    place-items: center;
    gap: 1.5rem;
    padding: clamp(4rem, 12vh, 8rem) clamp(1.25rem, 6vw, 4rem);
    text-align: center;
}

.home-hero-message {
    color: rgba(248, 250, 252, 0.88);
    max-width: 640px;
    margin: 0 auto;
    font-size: 1.05rem;
}

.home-heading-title {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 700;
}

.home-article {
    border-radius: 1.25rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.home-article:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 55px rgba(15, 23, 42, 0.16);
}

.home-article-thumbnail {
    display: block;
    width: 600px;
    max-width: 100%;
    aspect-ratio: 3 / 2;
    border-radius: 1rem;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.08);
}

.home-article-thumbnail__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 768px) {
    .home-article-thumbnail {
        width: 100%;
    }
}

.home-article-title a {
    color: #111827;
}

.home-article-title a:hover {
    color: #0d6efd;
}

.home-article-meta {
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.home-article-meta__dot {
    color: rgba(100, 116, 139, 0.65);
}

.home-article-views {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 600;
    color: #0f172a;
}

.home-article-views-icon {
    font-size: 0.95rem;
    line-height: 1;
}

.home-article-views-label {
    line-height: 1;
}

.home-article-summary {
    color: #4b5563;
    font-size: 1rem;
}

@media (max-width: 768px) {
    .home-article {
        border-radius: 1rem;
    }

    .home-hero-message {
        font-size: 0.95rem;
    }
}