/* CSS tùy biến của landing Jimmy Baccarat. Tailwind CDN lo phần tiện ích còn lại. */

:root {
    --color-background: #121318;
    --color-secondary: #ffca45;
}

/* ---- Khối style chuyển từ index.html ---- */
.glow-gold { box-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
.glass-panel { backdrop-filter: blur(12px); background: rgba(26, 28, 35, 0.7); border: 1px solid rgba(255, 215, 0, 0.2); }
.hero-gradient { background: linear-gradient(180deg, rgba(18, 19, 24, 0.4) 0%, rgba(18, 19, 24, 0.95) 100%); }
.gold-border-top { border-top: 2px solid #FFD700; }
.timeline-line { position: relative; }
.timeline-line::before { content: ''; position: absolute; left: 24px; top: 0; bottom: 0; width: 2px; background: linear-gradient(180deg, #FFD700 0%, transparent 100%); }
.material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.animated-border-card { position: relative; overflow: hidden; border-radius: 0.75rem; }
.animated-border-card::before { content: ''; position: absolute; inset: -60%; background: conic-gradient(from 0deg, transparent 0%, #FFD700 8%, transparent 22%, transparent 100%); animation: border-run 3.5s linear infinite; z-index: 0; }
.animated-border-card::after { content: ''; position: absolute; inset: 2px; border-radius: inherit; background: rgba(26, 28, 35, 0.92); backdrop-filter: blur(12px); z-index: 1; }
.animated-border-card > * { position: relative; z-index: 2; }
@keyframes border-run { to { transform: rotate(360deg); } }

/* ---- Hero banner dạng khung trưng bày (theo mẫu trang Thanh Hà) ----
   Ảnh nằm trong khung rộng tối đa 1280px, bo góc, viền vàng mảnh và quầng sáng vàng phía sau. */
.hero-banner {
    border-radius: 1rem;
    border: 1px solid rgba(255, 202, 69, 0.55);
    box-shadow:
        0 0 0 1px rgba(255, 202, 69, 0.12),
        0 0 28px rgba(255, 202, 69, 0.22),
        0 18px 50px rgba(0, 0, 0, 0.55);
    transition: box-shadow 0.4s ease, transform 0.4s ease;
}
.hero-banner:hover {
    box-shadow:
        0 0 0 1px rgba(255, 202, 69, 0.25),
        0 0 40px rgba(255, 202, 69, 0.35),
        0 18px 50px rgba(0, 0, 0, 0.55);
}
.hero-banner picture { display: block; }
.hero-banner:focus-visible { outline: 3px solid var(--color-secondary); outline-offset: 4px; }
@media (max-width: 767px) {
    .hero-banner { border-radius: 0.75rem; }
}

/* Viền sáng mỏng bên trong khung để mép ảnh không bị cứng */
.hero-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255, 246, 223, 0.08), inset 0 0 24px rgba(0, 0, 0, 0.35);
}

/* Vệt sáng trắng 15% nghiêng 20 độ quét qua ảnh mỗi 6 giây */
.hero-banner::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 35%;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transform: translateX(-120%) skewX(-20deg);
    animation: hero-sheen 6s ease-in-out infinite;
}
@keyframes hero-sheen {
    0% { transform: translateX(-120%) skewX(-20deg); }
    40%, 100% { transform: translateX(420%) skewX(-20deg); }
}

/* ---- Hiện dần khi cuộn: chỉ ẩn khi main.js đã gắn js-ready và GSAP sẵn sàng ---- */
.js-ready .reveal { opacity: 0; transform: translateY(45px); }

/* ---- Nền động toàn trang (spec 5.3): nền trang đặt trên html để canvas z-index -1 nhìn thấy ---- */
html { background: #121318; }
body { background: transparent; }
#bg-canvas { position: fixed; inset: 0; z-index: -1; pointer-events: none; }

/* 3 vầng sáng vàng radial trôi chậm, đường kính 40–60vw */
.bg-glow {
    position: fixed;
    z-index: -1;
    pointer-events: none;
    border-radius: 50%;
    will-change: transform;
    transform: translate(-50%, -50%);
}
.bg-glow-1 {
    left: 15%; top: 20%; width: 55vw; height: 55vw;
    background: radial-gradient(circle, rgba(255, 202, 69, 0.09) 0%, rgba(255, 202, 69, 0) 70%);
    animation: glow-drift-1 30s ease-in-out infinite alternate;
}
.bg-glow-2 {
    left: 80%; top: 50%; width: 60vw; height: 60vw;
    background: radial-gradient(circle, rgba(255, 202, 69, 0.07) 0%, rgba(255, 202, 69, 0) 70%);
    animation: glow-drift-2 38s ease-in-out infinite alternate;
}
.bg-glow-3 {
    left: 40%; top: 85%; width: 40vw; height: 40vw;
    background: radial-gradient(circle, rgba(255, 202, 69, 0.1) 0%, rgba(255, 202, 69, 0) 70%);
    animation: glow-drift-3 45s ease-in-out infinite alternate;
}
@keyframes glow-drift-1 {
    from { transform: translate(-50%, -50%); }
    to { transform: translate(calc(-50% + 12vw), calc(-50% + 8vh)); }
}
@keyframes glow-drift-2 {
    from { transform: translate(-50%, -50%); }
    to { transform: translate(calc(-50% - 14vw), calc(-50% - 10vh)); }
}
@keyframes glow-drift-3 {
    from { transform: translate(-50%, -50%); }
    to { transform: translate(calc(-50% + 10vw), calc(-50% - 12vh)); }
}

/* ---- Video tải khi bấm (spec 5.4) ---- */
.yt-facade { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: var(--color-background); cursor: pointer; }
.yt-facade img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.yt-facade:hover img { transform: scale(1.04); }
.yt-facade:focus-visible { outline: 3px solid var(--color-secondary); outline-offset: -3px; }
.yt-play {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 64px;
    height: 64px;
    margin: -32px 0 0 -32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 4px;
    color: var(--color-background);
    background: var(--color-secondary);
    box-shadow: 0 0 24px rgba(255, 202, 69, 0.45);
    transition: transform 0.2s ease;
}
.yt-facade:hover .yt-play, .yt-facade:focus-visible .yt-play { transform: scale(1.1); }
.yt-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* Dự phòng khi tắt JS: liên kết phủ lên thẻ video */
.yt-noscript {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: flex-end;
    padding: 16px;
    color: var(--color-secondary);
    font-weight: 700;
    background: linear-gradient(to top, rgba(18, 19, 24, 0.9), transparent 60%);
}

/* Số liệu đếm lên: chữ số cùng độ rộng để không nhảy bố cục */
[data-count-to] { font-variant-numeric: tabular-nums; }

/* ---- Phương pháp dạng tab (spec 5.6) ---- */
.method-tab {
    padding: 12px 20px;
    border-radius: 9999px;
    border: 1px solid rgba(255, 202, 69, 0.25);
    background: transparent;
    color: #d0c6ab;
    font-family: 'Be Vietnam Pro', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.method-tab:hover { color: var(--color-secondary); border-color: rgba(255, 202, 69, 0.6); }
.method-tab[aria-selected="true"] {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: var(--color-background);
}
.method-tab:focus-visible { outline: 3px solid var(--color-secondary); outline-offset: 3px; }
[role="tabpanel"]:focus-visible { outline: 2px solid var(--color-secondary); outline-offset: 4px; border-radius: 0.75rem; }

/* ---- SVG bảng cầu 3-2-1-1: vòng tròn hiện lần lượt, cách nhau 120ms qua --i ---- */
.road-321 { display: block; width: 100%; height: auto; --bead-b: #e5484d; --bead-p: #3b82f6; }
.road-321 .road-grid { fill: none; stroke: rgba(255, 202, 69, 0.15); stroke-width: 1; }
.road-321 .bead { fill: none; stroke-width: 4; transform-box: fill-box; transform-origin: center; }
.road-321 .bead-b { stroke: var(--bead-b); }
.road-321 .bead-p { stroke: var(--bead-p); }
/* Chỉ giấu vòng khi JS đã sẵn sàng; tắt JS thì bảng hiện đủ ngay */
.js-ready .road-321:not(.is-drawn) .bead { opacity: 0; }
.road-321.is-drawn .bead { animation: bead-in 0.4s ease-out both; animation-delay: calc(var(--i, 0) * 120ms); }
@keyframes bead-in {
    from { opacity: 0; transform: scale(0.4); }
    to { opacity: 1; transform: scale(1); }
}

/* ---- Lightbox ảnh cộng đồng (spec 5.7) ---- */
.lightbox-trigger { padding: 0; border: 0; background: none; cursor: zoom-in; }
.lightbox-trigger:focus-visible { outline: 3px solid var(--color-secondary); outline-offset: -3px; }

/* Phủ kín màn hình; dùng chung cho <dialog> thật và dự phòng khi trình duyệt không có HTMLDialogElement */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    color: inherit;
    background: rgba(18, 19, 24, 0.94);
}
.lightbox:not([open]) { display: none; }
.lightbox-stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 72px 16px;
    cursor: zoom-out;
}
.lightbox-img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 202, 69, 0.3);
    box-shadow: 0 0 40px rgba(255, 202, 69, 0.15);
    cursor: default;
}
/* Phóng vào 200ms mỗi lần mở */
.lightbox[open] .lightbox-img { animation: lightbox-zoom 200ms ease-out both; }
@keyframes lightbox-zoom {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}
.lightbox-btn {
    position: absolute;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 202, 69, 0.4);
    background: rgba(26, 28, 35, 0.85);
    color: var(--color-secondary);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.lightbox-btn:hover { background: var(--color-secondary); color: var(--color-background); }
.lightbox-btn:focus-visible { outline: 3px solid var(--color-secondary); outline-offset: 3px; }
.lightbox-close { top: calc(12px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); }
.lightbox-prev, .lightbox-next { top: 50%; margin-top: -24px; }
.lightbox-prev { left: calc(8px + env(safe-area-inset-left)); }
.lightbox-next { right: calc(8px + env(safe-area-inset-right)); }

/* ---- Menu trượt mobile và nút Telegram nổi (spec 5.9) ---- */
/* Nút hamburger và nút ✕: vùng bấm 44x44 */
.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 202, 69, 0.4);
    background: transparent;
    color: var(--color-secondary);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.menu-toggle:hover { background: var(--color-secondary); color: var(--color-background); }
.menu-toggle:focus-visible { outline: 3px solid var(--color-secondary); outline-offset: 3px; }

.drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: opacity 300ms ease, visibility 0s linear 300ms;
}
.drawer-backdrop.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }

/* Trượt từ phải: đóng thì visibility:hidden để phím Tab không lọt vào drawer */
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 80vw;
    max-width: 320px;
    padding: calc(16px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) 24px;
    overflow-y: auto;
    background: rgba(26, 28, 35, 0.92);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 202, 69, 0.5);
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.5);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 300ms ease, visibility 0s linear 300ms;
}
.drawer.is-open { transform: translateX(0); visibility: visible; transition-delay: 0s; }
/* Trình duyệt không có backdrop-filter: nền đặc để chữ vẫn đọc được */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .drawer { background: #1a1c23; }
}
.drawer-links { display: flex; flex-direction: column; }
.drawer-links a {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 0 8px;
    border-bottom: 1px solid rgba(255, 202, 69, 0.12);
    color: #d0c6ab;
    font-family: 'Be Vietnam Pro', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: color 0.2s ease;
}
.drawer-links a:hover { color: var(--color-secondary); }
.drawer-links a:focus-visible, .drawer-cta:focus-visible { outline: 3px solid var(--color-secondary); outline-offset: -3px; }
/* Section nhận focus lập trình từ link neo trong drawer: không vẽ viền focus quanh cả khối */
section[tabindex="-1"]:focus { outline: none; }
.drawer-cta { display: flex; align-items: center; justify-content: center; min-height: 48px; margin-top: auto; text-align: center; }

/* Nút Telegram nổi: tròn 56px, cách mép 16px + vùng an toàn của iPhone */
.floating-tg {
    position: fixed;
    right: calc(16px + env(safe-area-inset-right));
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    color: var(--color-background);
    background: var(--color-secondary);
    box-shadow: 0 0 16px rgba(255, 202, 69, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(12px) scale(0.9);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
}
.floating-tg.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    transition-delay: 0s;
    animation: floating-glow 2.4s ease-in-out infinite;
}
.floating-tg:focus-visible { outline: 3px solid var(--color-secondary); outline-offset: 4px; }
/* Từ 768px trở lên chỉ dùng menu desktop. Đặt ở đây để không phụ thuộc thứ tự nạp của Tailwind CDN */
@media (min-width: 768px) {
    .menu-toggle, .drawer, .drawer-backdrop, .floating-tg { display: none !important; }
}
@keyframes floating-glow {
    0%, 100% { box-shadow: 0 0 12px rgba(255, 202, 69, 0.35); }
    50% { box-shadow: 0 0 28px 6px rgba(255, 202, 69, 0.6); }
}

/* ---- Giảm chuyển động ---- */
@media (prefers-reduced-motion: reduce) {
    .hero-banner::after { animation: none; }
    .animated-border-card::before { animation: none; }
    .bg-glow { animation: none; }
    .yt-facade img, .yt-play { transition: none; }
    .yt-facade:hover img, .yt-facade:hover .yt-play, .yt-facade:focus-visible .yt-play { transform: none; }
    .method-tab { transition: none; }
    .js-ready .road-321:not(.is-drawn) .bead { opacity: 1; }
    .road-321.is-drawn .bead { animation: none; opacity: 1; }
    .lightbox-trigger img { transition: none; }
    .lightbox-trigger:hover img { transform: none; }
    .lightbox[open] .lightbox-img { animation: none; }
    .lightbox-btn { transition: none; }
    .drawer, .drawer-backdrop, .menu-toggle, .drawer-links a { transition: none; }
    .floating-tg, .floating-tg.is-visible { transition: none; animation: none; }
}
