/* ===========================
   Media Center — Page Styles
   All classes prefixed with .media-
   =========================== */

/* ===========================
   Entrance Animation (bottom → top, triggered via ?tag=)
   =========================== */
@keyframes mediaSlideUp {
    from {
        opacity: 0;
        transform: translateY(80px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.media-page--animate .media-hero {
    animation: mediaSlideUp 1.4s ease-out forwards;
}

.media-page--animate .media-grid-section {
    opacity: 0;
    animation: mediaSlideUp 1.4s 0.3s ease-out forwards;
}

.media-page--animate .media-follow {
    opacity: 0;
    animation: mediaSlideUp 1.4s 0.6s ease-out forwards;
}

.media-page--animate ~ .site-footer {
    opacity: 0;
    animation: mediaSlideUp 1.4s 0.8s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
    .media-page--animate .media-hero,
    .media-page--animate .media-grid-section,
    .media-page--animate .media-follow,
    .media-page--animate ~ .site-footer {
        animation: none;
        opacity: 1;
    }
}

/* ===========================
   Section 1: Media Hero
   =========================== */
.media-hero {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.media-hero-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.media-hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.8s ease;
    pointer-events: none;
}

    .media-hero-slide.active {
        opacity: 1;
        pointer-events: auto;
    }

.media-hero-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.media-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient( to top, rgba(var(--color-bg-1-rgb), 0.95) 0%, rgba(var(--color-bg-1-rgb), 0.7) 30%, rgba(var(--color-bg-1-rgb), 0.3) 60%, transparent 100% );
    z-index: 1;
}

.media-hero-slide > .section-container {
    position: relative;
    height: 100%;
    z-index: 2;
}

.media-hero-content {
    position: absolute;
    bottom: 120px;
    inset-inline-start: var(--content-padding);
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 700px;
}

.media-hero-quote {
    display: block;
    width: 52px;
    height: 47px;
    margin-bottom: 16px;
}

.media-hero-text-block {
    border-inline-start: 3px solid var(--color-primary-light);
    padding-inline-start: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 50vw;
}

.media-hero-title {
    font-weight: 900;
    font-size: clamp(24px, 3vw, 38px);
    line-height: 1.25;
    text-transform: uppercase;
    color: var(--color-white);
    margin: 0;
}

.media-hero-time {
    font-weight: 400;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

/* Hero Nav Arrows */
.media-hero-nav-container {
    position: absolute;
    bottom: 40px;
    inset-inline-start: 0;
    inset-inline-end: 0;
    z-index: 3;
}

.media-hero-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
}

.media-hero-arrow {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(var(--color-bg-1-rgb), 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--color-white);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    position: relative;
}

    .media-hero-arrow::before {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: 50%;
        padding: 1px;
        background: linear-gradient(184deg, var(--color-primary) 0.91%, var(--color-primary-light) 82.1%);
        -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
        -webkit-mask-composite: xor;
        mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
        mask-composite: exclude;
        pointer-events: none;
    }

    .media-hero-arrow:hover:not(:disabled) {
        opacity: 0.8;
    }

    .media-hero-arrow:disabled {
        opacity: 0.4;
        cursor: default;
    }

/* ===========================
   Section 2: Article Grid
   =========================== */
.media-grid-section {
    padding-top: 80px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px 24px;
}

.media-card {
    position: relative;
    height: 409px;
    border-radius: var(--radius-s);
    overflow: visible;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: linear-gradient(230deg, var(--color-primary-light) 0%, var(--color-primary) 80%);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(0, 0, 0, 0.8);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.media-card-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-s);
    z-index: 1;
}

.media-card-date {
    position: absolute;
    top: -15px;
    inset-inline-start: 20px;
    background: var(--color-secondary);
    color: var(--color-white);
    font-size: 14px;
    line-height: 20px;
    padding: 5px 8px;
    border-radius: var(--radius-xs);
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 5;
    white-space: nowrap;
}

.media-card-bottom {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 194px;
    padding: 48px 32px 40px;
    background: linear-gradient(180deg, rgba(var(--color-secondary-rgb), 0) 0%, rgba(var(--color-secondary-rgb), 0.85) 100%);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    border-radius: 0 0 var(--radius-s) var(--radius-s);
}

.media-card-text {
    font-size: 14px;
    line-height: 20px;
    color: var(--color-white);
    text-align: justify;
    padding-inline-end: 24px;
    margin: 0;
}

.media-card-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    line-height: 24px;
    color: var(--color-white);
    text-decoration: underline;
    text-underline-offset: 3px;
}

    .media-card-link img {
        transform: rotate(-90deg);
    }

/* Hidden cards — initially only 2 rows visible */
.media-card.media-card--hidden {
    display: none;
}

/* Reveal — slide up from bottom */
@keyframes mediaCardReveal {
    from {
        opacity: 0;
        transform: translateY(60px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.media-card.media-card--reveal {
    animation: mediaCardReveal 1.4s ease-out forwards;
}

/* Load More */
.media-load-more {
    display: none;
    justify-content: center;
    padding-top: 48px;
}

    .media-load-more.visible {
        display: flex;
    }

.media-load-btn {
    height: 48px;
    padding: 0 40px;
    font-size: 16px;
    font-weight: 700;
    border-radius: var(--radius-l);
    min-width: 180px;
}

    /* Loading state — progress line around border */
    .media-load-btn.loading {
        pointer-events: none;
        position: relative;
        overflow: hidden;
        background: transparent;
        border: 2px solid rgba(255, 255, 255, 0.15);
        color: var(--color-white);
    }

        .media-load-btn.loading::before {
            content: '';
            position: absolute;
            inset: 0;
            border-radius: inherit;
            background: var(--gradient-primary);
            transform-origin: left;
            transform: scaleX(0);
            animation: mediaProgressFill 1.8s ease-in-out forwards;
            z-index: 0;
        }

[dir="rtl"] .media-load-btn.loading::before {
    transform-origin: right;
}

.media-load-btn.loading span {
    position: relative;
    z-index: 1;
    mix-blend-mode: difference;
}

@keyframes mediaProgressFill {
    0% {
        transform: scaleX(0);
    }

    100% {
        transform: scaleX(1);
    }
}

/* Fade out when done */
.media-load-btn.done {
    transition: opacity 0.4s ease;
    opacity: 0;
}

/* ===========================
   Section 3: Follow Our Latest News
   =========================== */
.media-follow {
    padding-top: 100px;
    padding-bottom: 60px;
}

.media-follow-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 48px;
}

.media-follow-title {
    font-weight: 900;
    font-size: 66px;
    line-height: 1.1;
    text-transform: uppercase;
    margin: 0;
    flex-shrink: 0;
    background: linear-gradient(40deg, var(--color-white) 4%, var(--color-secondary-dark) 63%, var(--color-secondary) 87%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.media-follow-desc {
    font-weight: 400;
    font-size: 16px;
    line-height: 26px;
    color: var(--color-white);
    max-width: 550px;
    margin: 0;
    padding-top: 20px;
}

/* Tweet Cards */
.media-tweets {
    display: flex;
    gap: 24px;
}

.media-tweet-card {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 30px 28px;
    background: #17202a;
    border-radius: 4px;
}

.media-tweet-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.media-tweet-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.media-tweet-info {
    display: flex;
    flex-direction: column;
}

.media-tweet-name {
    font-weight: 600;
    font-size: 11px;
    color: #d9d9d9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.media-tweet-verified {
    color: #1d9bf0;
    font-size: 11px;
}

.media-tweet-handle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.media-tweet-text {
    font-size: 14px;
    line-height: 21.5px;
    color: #8a99a6;
    text-transform: capitalize;
    margin: 0;
}

.media-tweet-image {
    width: 100%;
    height: 198px;
    object-fit: cover;
    border-radius: 10px;
}

.media-tweet-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-weight: 500;
    font-size: 9px;
}

.media-tweet-time {
    color: var(--color-white);
}

.media-tweet-views {
    color: #4d9eea;
}

/* Tweet Pagination (mobile only) */
.media-tweets-pagination {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
}

.media-tweets-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: transparent;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

    .media-tweets-dot.active {
        width: 40px;
        border-radius: 52px;
        background: var(--color-white);
        border-color: var(--color-white);
    }

/* ===========================
   Responsive — 1200px
   =========================== */
@media (max-width: 1200px) {
    .media-follow-title {
        font-size: 52px;
    }

    .media-card {
        height: 360px;
    }
}

/* ===========================
   Responsive — 991px (Mobile)
   =========================== */
@media (max-width: 991px) {
    /* Hero */
    .media-hero {
        height: 80vh;
    }

    .media-hero-content {
        bottom: 100px;
        max-width: 100%;
    }

    .media-hero-quote {
        width: 42px;
        height: 38px;
    }

    .media-hero-text-block {
        border-inline-start: none;
        padding-inline-start: 0;
        max-width: 90%;
    }

    .media-hero-title {
        font-size: 24px;
    }

    .media-hero-nav {
        justify-content: flex-start;
        padding-inline-start: 2rem;
    }

    .media-hero-nav-container {
        bottom: 20px;
    }

    .media-hero-arrow {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }

    /* Grid */
    .media-grid-section {
        padding-top: 50px;
    }

    .media-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .media-card {
        height: 363px;
    }

    .media-card-bottom {
        height: 214px;
        padding: 40px 32px 30px;
    }

    /* Follow */
    .media-follow {
        padding-top: 60px;
        padding-bottom: 40px;
    }

    .media-follow-header {
        flex-direction: column;
        gap: 20px;
        margin-bottom: 32px;
    }

    .media-follow-title {
        font-size: 40px;
    }

    .media-follow-desc {
        max-width: 100%;
        padding-top: 0;
    }

    /* Tweets — single card scroll */
    .media-tweets {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }

        .media-tweets::-webkit-scrollbar {
            display: none;
        }

    .media-tweet-card {
        min-width: 100%;
        flex: 0 0 100%;
        scroll-snap-align: start;
    }

    .media-tweets-pagination {
        display: flex;
    }
}

/* ===========================
   Responsive — 576px (Small Mobile)
   =========================== */
@media (max-width: 576px) {
    .media-hero {
        height: 70vh;
    }

    .media-hero-content {
        bottom: 80px;
    }

    .media-hero-quote {
        width: 36px;
        height: 32px;
    }

    .media-hero-title {
        font-size: 20px;
    }

    .media-hero-arrow {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }

    .media-card {
        height: 363px;
    }

    .media-card-text {
        font-size: 13px;
        padding-inline-end: 0;
    }

    .media-follow-title {
        font-size: 34px;
    }

    .media-tweet-image {
        height: 140px;
    }
}

/* ===========================
   RTL Overrides
   =========================== */
[dir="rtl"] .media-follow-title {
    line-height: 1.2;
}

[dir="rtl"] .media-hero-quote {
    transform: scaleX(-1);
}

[dir="rtl"] .media-card-link img {
    transform: rotate(90deg);
}

[dir="rtl"] .media-hero-arrow .bi-chevron-left::before {
    content: "\F285";
}

[dir="rtl"] .media-hero-arrow .bi-chevron-right::before {
    content: "\F284";
}
