/* frontend/public/css/main.css */
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ========== 1. VARIABLES & RESETS ========== */
:root {
    --bg: #070707;
    --bg-2: #0d0d0d;
    --bg-3: #121212;
    --surface: rgba(18, 18, 18, 0.72);
    --surface-strong: rgba(20, 20, 20, 0.92);
    --border: rgba(255, 255, 255, 0.08);
    --text: #f5f5f5;
    --muted: #b7b7b7;
    --muted-2: #8c8c8c;
    --primary: #d61f26;
    --primary-2: #ff4a4f;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
    --radius-xl: 30px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --container: 1180px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background:
        radial-gradient(circle at top, rgba(214, 31, 38, 0.13), transparent 32%),
        linear-gradient(180deg, #050505 0%, #090909 45%, #050505 100%);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    line-height: 1.65;
    overflow-x: hidden;
}

img, video {
    display: block;
    max-width: 100%;
}

button, a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
}

/* ========== 2. TYPOGRAPHY & UTILITIES ========== */
h1, h2, h3, h4, .eyebrow, .btn, .nav-links a {
    font-family: 'Oswald', sans-serif;
    letter-spacing: 0.5px;
}

h1, h2, h3, h4 {
    text-transform: uppercase;
    line-height: 1.47;
}

.text-primary {
    color: var(--primary);
}

.container {
    width: min(100% - 32px, var(--container));
    margin-inline: auto;
}

.page-home {
    position: relative;
}

/* ========== 3. HEADER & NAV ========== */
.navbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 28px;
    background: linear-gradient(180deg, rgba(6, 6, 6, 0.94), rgba(6, 6, 6, 0.76));
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(14px);
}

.nav-brand h1 {
    font-size: 1.3rem;
    letter-spacing: 2px;
    color: var(--text);
}

.brand-logo {
    max-height: 60px; 
    width: auto;
    object-fit: contain;
    transform: scale(1.7);
    transform-origin: left center; 
    transition: transform 0.2s ease;
}

.nav-brand a:hover .brand-logo {
    transform: scale(1.75);
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 26px;
}

.nav-links a {
    position: relative;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-size: 0.98rem;
    text-transform: uppercase;
    transition: color 0.25s ease, transform 0.25s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), transparent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: #fff;
    transform: translateY(-1px);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    transform: scaleX(1);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    z-index: 1001;
}

.menu-toggle .bar {
    width: 28px;
    height: 2px;
    border-radius: 999px;
    background: #fff;
    transition: transform 0.25s ease, opacity 0.25s ease, background 0.25s ease;
}

body.nav-open {
    overflow: hidden;
}

/* ========== 4. HERO SECTION ========== */
.hero {
    position: relative;
    min-height: 100svh;
    padding-top: 84px;
    display: grid;
    align-items: center;
    overflow: clip;
}

.hero__media, .hero__video, .hero__fallback, .hero__veil {
    position: absolute;
    inset: 0;
}

.hero__media {
    background: #050505;
}

.hero__video, .hero__fallback {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero__fallback {
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    filter: saturate(0.95) contrast(1.08);
    transform: scale(1.03);
}

.hero__video {
    opacity: 0;
    transition: opacity 0.45s ease;
}

.hero.is-video-ready .hero__video {
    opacity: 1;
}

.hero__veil {
    background:
        linear-gradient(90deg, rgba(4, 4, 4, 0.84) 0%, rgba(4, 4, 4, 0.48) 48%, rgba(4, 4, 4, 0.82) 100%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.26) 0%, rgba(0, 0, 0, 0.76) 100%);
}

.hero__inner {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(290px, 0.75fr);
    gap: 28px;
    align-items: end;
    padding-block: 42px 58px;
}

.hero__copy {
    max-width: 760px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.88rem;
    letter-spacing: 2.4px;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.eyebrow::before {
    content: '';
    width: 34px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), rgba(214, 31, 38, 0.1));
}

.hero h1 {
    font-size: clamp(3rem, 7vw, 6.3rem);
    line-height: 0.92;
    letter-spacing: 1px;
    text-wrap: balance;
    text-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
}

.hero__lead {
    margin-top: 18px;
    max-width: 720px;
    color: rgba(245, 245, 245, 0.85);
    font-size: clamp(1rem, 1.7vw, 1.16rem);
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 28px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 22px;
    border-radius: 999px;
    border: 1px solid transparent;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.92rem;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    will-change: transform;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn--primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    box-shadow: 0 18px 40px rgba(214, 31, 38, 0.28);
}

.btn--ghost {
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
}

/* Container chứa các ảnh */
.hero__slideshow {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #050505;
}

/* Base style cho từng ảnh */
.hero__slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    /* Hiệu ứng Ken Burns: Tổng thời gian 18s cho 3 hình (6s/hình) */
    animation: heroCrossfade 18s ease-in-out infinite;
}

/* Canh độ trễ cho từng hình để chúng hiện lên lần lượt */
.hero__slide:nth-child(1) {
    animation-delay: 0s;
}
.hero__slide:nth-child(2) {
    animation-delay: 6s;
}
.hero__slide:nth-child(3) {
    animation-delay: 12s;
}
.hero__slide:nth-child(4) {
    animation-delay: 18s;
}

/* 
  Khung thời gian Animation:
  0% - 8%: Mờ dần hiện lên (Fade in)
  8% - 33%: Hiển thị rõ nét
  33% - 41%: Mờ dần mất đi (Fade out)
  41% - 100%: Ẩn hoàn toàn chờ lượt mới
  Đồng thời hình ảnh sẽ từ từ phóng to (scale từ 1 lên 1.1) để tạo cảm giác chuyển động.
*/
@keyframes heroCrossfade {
    0% {
        opacity: 0;
        transform: scale(1);
    }
    8% {
        opacity: 1;
    }
    33% {
        opacity: 1;
    }
    41% {
        opacity: 0;
    }
    100% {
        opacity: 0;
        transform: scale(1.1); /* Zoom nhẹ 10% */
    }
}

/* ========== 5. GLOBAL CARDS & COMPONENTS ========== */
.hero__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 28px;
}

/* Base Card Style */
.stat-card,
.glass-card,
.mini-card,
.about-card,
.media-card,
.info-card,
.workshop-card,
.video-card,
.showcase-card,
.timeline__item,
.cta-banner {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.stat-card {
    padding: 18px;
}

.stat-card strong {
    display: block;
    margin-bottom: 5px;
    font-size: 1.06rem;
}

.stat-card span {
    color: var(--muted);
    font-size: 0.92rem;
}

.hero__panel {
    display: grid;
    gap: 16px;
    align-self: stretch;
}

.glass-card {
    padding: 22px;
    background: linear-gradient(180deg, rgba(27, 27, 27, 0.92), rgba(15, 15, 15, 0.74));
}

.glass-card--accent {
    border-color: rgba(214, 31, 38, 0.24);
    box-shadow: 0 18px 60px rgba(214, 31, 38, 0.08);
}

.glass-card__label,
.timeline__date,
.info-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(214, 31, 38, 0.12);
    color: #ff7d82;
    border: 1px solid rgba(214, 31, 38, 0.28);
    letter-spacing: 1px;
}

.glass-card__label {
    padding: 6px 12px;
    font-size: 0.76rem;
    margin-bottom: 12px;
}

.glass-card h2, .section__head h2, .about-card h3, .media-card h3,
.info-card h3, .workshop-card h2, .showcase-card h3,
.timeline__item h3, .cta-banner h2 {
    font-size: clamp(1.5rem, 2.8vw, 2.4rem);
}

.glass-card p, .section__head p, .about-card p, .media-card p,
.info-card p, .workshop-card p, .showcase-card p,
.timeline__item p, .cta-banner p {
    color: var(--muted);
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.mini-card {
    padding: 18px;
    background: rgba(17, 17, 17, 0.7);
}

.mini-card span {
    display: block;
    margin-bottom: 10px;
    font-size: 0.8rem;
    letter-spacing: 1.6px;
    color: #ff8b8f;
}

.mini-card strong {
    font-size: 0.98rem;
    line-height: 1.45;
}

.scroll-hint {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 3;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
}

.scroll-hint span {
    width: 22px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.36);
    border-radius: 999px;
    position: relative;
}

.scroll-hint span::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 7px;
    width: 4px;
    height: 8px;
    border-radius: 999px;
    background: #fff;
    transform: translateX(-50%);
    animation: scroll-dot 1.6s ease-in-out infinite;
}

@keyframes scroll-dot {
    0% { transform: translate(-50%, 0); opacity: 0.35; }
    50% { transform: translate(-50%, 10px); opacity: 1; }
    100% { transform: translate(-50%, 0); opacity: 0.35; }
}

/* ========== 6. SECTIONS & LAYOUTS ========== */
.section {
    padding: 88px 0;
}

.section--contrast {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01)),
        radial-gradient(circle at top, rgba(214, 31, 38, 0.09), transparent 35%);
}

.section__head {
    max-width: 760px;
    margin-bottom: 28px;
}

.section__head--center {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.section__head--center .eyebrow {
    justify-content: center;
}

.about-grid,
.split-layout,
.media-grid,
.timeline,
.card-grid {
    display: grid;
    gap: 18px;
}

.about-grid {
    grid-template-columns: 1.1fr 0.9fr;
}

.about-card, .media-card, .workshop-card,
.video-card, .showcase-card, .timeline__item, .info-card {
    overflow: hidden;
}

.about-card, .workshop-card {
    padding: 39px;
}

.about-card--large {
    display: grid;
    align-content: start;
    gap: 16px;
}

.feature-list {
    list-style: none;
    display: grid;
    gap: 10px;
    margin-top: 6px;
}

.feature-list li {
    position: relative;
    padding-left: 22px;
    color: var(--muted);
}

.feature-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.72em;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 0 0 4px rgba(214, 31, 38, 0.12);
    transform: translateY(-50%);
}

.media-card {
    display: grid;
    grid-template-rows: auto 1fr;
}

.media-card__image-wrap {
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.media-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.45s ease;
}

.media-card:hover .media-card__image {
    transform: scale(1.03);
}

.media-card__body, .video-card__overlay {
    padding: 20px;
}

.card-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.info-card {
    padding: 24px;
    display: grid;
    gap: 14px;
}

.info-card__icon {
    width: fit-content;
    min-width: 52px;
    height: 52px;
    padding-inline: 16px;
    font-size: 1rem;
}

.split-layout {
    grid-template-columns: 0.95fr 1.05fr;
    align-items: stretch;
}

.workshop-card {
    display: grid;
    gap: 36px;
    align-content: center;
}

.video-card {
    position: relative;
    min-height: 420px;
    background: linear-gradient(180deg, rgba(20, 20, 20, 0.94), rgba(10, 10, 10, 0.94));
}

.video-card__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-card__overlay {
    position: relative;
    z-index: 1;
    margin-top: auto;
    align-self: end;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.0), rgba(0, 0, 0, 0.72));
}

.timeline {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.timeline__item {
    padding: 24px;
    display: grid;
    gap: 12px;
}

.timeline__date {
    width: fit-content;
    padding: 7px 12px;
    font-size: 0.76rem;
}

.section--cta {
    padding-top: 0;
}

.cta-banner {
    padding: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background:
        linear-gradient(135deg, rgba(214, 31, 38, 0.2), rgba(10, 10, 10, 0.92)),
        radial-gradient(circle at top right, rgba(255, 74, 79, 0.18), transparent 40%);
}

.cta-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

/* ========== 7. MEDIA GALLERY BENTO-GRID ========== */
.media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: minmax(220px, 25vw); 
    gap: 18px; /* Đã đồng bộ gap 18px với toàn trang */
    grid-auto-flow: dense; 
}

.showcase-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background-color: var(--surface);
}

.showcase-card img,
.showcase-card video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    transition: transform 0.45s ease;
}

/* Hiệu ứng hover cho thư viện ảnh */
.showcase-card:hover img,
.showcase-card:hover video {
    transform: scale(1.03);
}

.showcase-card__body {
    position: relative;
    z-index: 2;
    padding: 20px;
    background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
    color: #ffffff;
}

.showcase-card__body h3 {
    margin: 0 0 4px 0;
    font-weight: 700;
}

.showcase-card__body p {
    margin: 0;
    opacity: 0.85;
}

/* Các biến thể ngang/dọc */
.showcase-card--wide, 
.showcase-card--landscape {
    grid-column: span 2;
    grid-row: span 1;
}

.showcase-card--portrait {
    grid-column: span 1;
    grid-row: span 2;
}

.showcase-card--square {
    grid-column: span 1;
    grid-row: span 1;
}

/* ========== VIDEO CLICK-TO-PLAY STYLES ========== */
.showcase-card--video {
    cursor: pointer;
}

/* Ảnh Poster/Banner đại diện */
.showcase-card__poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2; /* Đè lên thẻ video */
    transition: opacity 0.35s ease, transform 0.45s ease;
}

/* Video ẩn bên dưới poster */
.showcase-card--video video {
    z-index: 1;
    opacity: 0;
    transition: opacity 0.35s ease;
}

/* Nút Play ở chính giữa thẻ */
.play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    z-index: 3;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(214, 31, 38, 0.88); /* Màu đỏ primary */
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    transition: transform 0.25s ease, background-color 0.25s ease, opacity 0.25s ease;
    pointer-events: none; /* Tránh cản trở sự kiện click của thẻ cha */
}

.play-btn svg {
    width: 24px;
    height: 24px;
    margin-left: 3px; /* Căn lề tâm cho icon tam giác */
}

/* Hiệu ứng Hover vào thẻ Video */
.showcase-card--video:hover .play-btn {
    transform: translate(-50%, -50%) scale(1.1);
    background: var(--primary);
}

.showcase-card--video:hover .showcase-card__poster {
    transform: scale(1.03);
}

/* KHI VIDEO ĐANG PHÁT (Class .is-playing được thêm bởi JS) */
.showcase-card--video.is-playing .showcase-card__poster,
.showcase-card--video.is-playing .play-btn {
    opacity: 0;
    pointer-events: none;
}

.showcase-card--video.is-playing video {
    opacity: 1;
    z-index: 3; /* Đưa video lên trên poster */
}

/* ========== 8. FOOTER ========== */
footer {
    background: #0b0b0b;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 28px 20px;
    text-align: center;
    color: var(--muted-2);
}

/* ========== 9. RESPONSIVE ========== */
@media (max-width: 1100px) {
    .hero__inner,
    .about-grid,
    .split-layout,
    .timeline,
    .card-grid--3 {
        grid-template-columns: 1fr;
    }

    .hero__panel {
        grid-template-columns: 1fr 1fr;
    }

    .showcase-card--wide,
    .showcase-card--landscape {
        grid-column: auto;
    }
}

@media (max-width: 992px) {
    .media-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 250px;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 14px 18px;
    }

    .menu-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        inset: 68px 0 0 auto;
        width: min(92vw, 340px);
        height: calc(100svh - 68px);
        padding: 24px 18px;
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(16px);
        border-left: 1px solid rgba(255, 255, 255, 0.08);
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 20px;
        transform: translateX(105%);
        transition: transform 0.32s ease;
    }

    .nav-links.active {
        transform: translateX(0);
    }

    .menu-toggle.is-active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
        background: var(--primary);
    }

    .menu-toggle.is-active .bar:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.is-active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
        background: var(--primary);
    }

    .hero {
        min-height: auto;
        padding-top: 84px;
        padding-bottom: 48px;
    }

    .hero__inner {
        padding-top: 14px;
    }

    .hero__stats,
    .hero__panel,
    .mini-grid {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: clamp(2.6rem, 16vw, 4.4rem);
    }

    .section {
        padding: 72px 0;
    }

    .cta-banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .cta-banner__actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 576px) {
    .media-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
    }
    
    .showcase-card--wide,
    .showcase-card--landscape, 
    .showcase-card--portrait,
    .showcase-card--square {
        grid-column: span 1;
        grid-row: span 1;
        aspect-ratio: 16 / 9;
    }
    
    .showcase-card--portrait {
        aspect-ratio: 9 / 16;
    }

    .showcase-card--square {
        aspect-ratio: 1 / 1;
    }
}

@media (max-width: 540px) {
    .container {
        width: min(100% - 22px, var(--container));
    }

    .btn,
    .hero__actions,
    .hero__actions .btn {
        width: 100%;
    }

    .about-card,
    .workshop-card,
    .timeline__item,
    .info-card,
    .glass-card,
    .media-card__body,
    .showcase-card__body,
    .video-card__overlay,
    .cta-banner {
        padding: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *, *::before, *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}