/* ========================================
   TRANH NGANG NEW v2.0
   3 ảnh xếp dọc, pagination, tối ưu hiệu suất
   ======================================== */

/* ========== RESET & BASE ========== */
/* ========== RESET & BASE ========== */
.hgn-page {
    width:100%;
    /* --- CSS CŨ CỦA BẠN (GIỮ NGUYÊN) --- */
    height: calc(100vh - 60px);
    background: #f8f6f3;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* ========== HERO ========== */
.hgn-hero {
    text-align: center;
    padding: 10px 20px 6px;
    flex-shrink: 0;
}

.hgn-hero h1 {
    font-family: 'GanhType', serif;
    font-size: 24px;
    color: #2D1E17;
    letter-spacing: 3px;
    margin: 0 0 2px;
    font-weight: 700;
}

.hgn-hero-sub {
    font-size: 12px;
    color: #8B7355;
    letter-spacing: 1px;
    margin: 0;
}

.hgn-hero-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 4px;
    font-size: 10px;
    color: #A1866E;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.hgn-hero-label .line {
    width: 40px;
    height: 1px;
    background: #C4AA8E;
}

/* ========== GALLERY: 3 CARDS VERTICAL ========== */
.hgn-gallery {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 16px;
    max-width: 900px;
    margin: 0 auto;
    flex: 1;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
}

.hgn-card {
    border-radius: 10px;
    overflow: hidden;
    background: #eee;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    flex: 1;
    min-height: 0;
    max-height: calc((100% - 16px) / 3);
}

.hgn-card:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.hgn-card-img {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #f0ece7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hgn-card-img img {
    height: 100%;
    width: auto;
    max-width: none;
    display: block;
    transition: opacity 0.35s ease;
}

.hgn-card-img img.loading {
    opacity: 0.3;
}

.hgn-card-sku {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.88);
    color: #5A4232;
    border-radius: 6px;
    z-index: 2;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    letter-spacing: 0.5px;
}

/* ========== NAV CONTROLS ========== */
.hgn-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 6px 0 2px;
    flex-shrink: 0;
}

.hgn-nav-btn {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.85);
    border: 1px solid #ddd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: #5A4232;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.25s ease;
}

.hgn-nav-btn:hover {
    background: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transform: scale(1.08);
}

.hgn-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.hgn-counter {
    font-size: 14px;
    color: #8B7355;
    letter-spacing: 1px;
    min-width: 80px;
    text-align: center;
}

.hgn-counter strong {
    color: #5A4232;
    font-size: 16px;
}

/* ========== DOTS ========== */
.hgn-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 4px 0 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.hgn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #D4C5B5;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hgn-dot.active {
    background: #8B0000;
    transform: scale(1.3);
    box-shadow: 0 0 6px rgba(139,0,0,0.3);
}

/* ========== MODAL ========== */
.hgn-modal {
    position: fixed;
    inset: 0;
    background: rgba(157, 138, 124, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    backdrop-filter: blur(2px);
    touch-action: none;
}

.hgn-modal.show {
    display: flex;
    animation: hgnModalIn 0.3s ease;
}

@keyframes hgnModalIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.hgn-modal__backdrop {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.hgn-modal__close {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0,0,0,0.3);
    border: none;
    color: #fff;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100001;
    border-radius: 50%;
    transition: transform 0.2s ease, background 0.2s ease;
}

.hgn-modal__close:active {
    transform: scale(0.9);
    background: rgba(0,0,0,0.6);
}

.hgn-modal__img-wrap {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
    touch-action: none;
}

.hgn-modal__img-inner {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 100%;
}

.hgn-modal__img-wrap img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    transition: transform 0.2s ease;
    transform-origin: center center;
    user-select: none;
    -webkit-user-drag: none;
}

.hgn-modal__preview {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(234, 221, 211, 0.95) 0%, rgba(234, 221, 211, 0.85) 60%, transparent 100%);
    padding: 80px 20px 30px;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.hgn-modal__preview.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.hgn-modal__preview-title {
    color: #523F31;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.hgn-modal__preview-desc {
    color: #523F31;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.hgn-modal__preview-btn {
    background: #796254;
    color: #fff;
    border: 2px solid #796254;
    padding: 10px 30px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hgn-modal__preview-btn:active {
    transform: scale(0.96);
}

/* ========== TAP HINT (touch guide) ========== */
.hgn-tap-hint-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to bottom, rgba(234, 221, 211, 0.95) 0%, rgba(234, 221, 211, 0.85) 60%, transparent 100%);
    padding: 60px 20px 140px;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
}

.hgn-tap-hint-layer.show {
    opacity: 1;
    transform: translateY(0);
}

.hgn-tap-hint {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.5);
    padding: 6px 14px 6px 10px;
    border-radius: 24px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

.hgn-tap-hint__icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    animation: hgnTapBounce 1.8s ease-in-out infinite;
}

.hgn-tap-hint__icon img {
    width: 100%;
    height: 100%;
    filter: brightness(0) invert(1) drop-shadow(0 1px 4px rgba(0,0,0,0.3));
}

.hgn-tap-hint__text {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    letter-spacing: 0.3px;
}

@keyframes hgnTapBounce {
    0%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
    50% { transform: translateY(3px); }
    70% { transform: translateY(-2px); }
}

@keyframes hgnRipple {
    0% {
        r: 3;
        opacity: 0.8;
        stroke-width: 2;
    }
    100% {
        r: 16;
        opacity: 0;
        stroke-width: 0.5;
    }
}


/* ========== FOOTER ========== */
.hgn-footer {
    text-align: center;
    padding: 4px 16px 8px;
    flex-shrink: 0;
}

.hgn-footer a {
    color: #8B7355;
    text-decoration: none;
    font-size: 14px;
}

.hgn-footer a:hover {
    color: #8B0000;
}

.hgn-footer-info {
    display: block;
    margin-top: 8px;
    font-size: 11px;
    color: #B8A898;
    letter-spacing: 2px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 767px) {
    .hgn-hero { padding: 8px 16px 4px; }
    .hgn-hero h1 { font-size: 20px; }
    .hgn-card-sku { font-size: 8px; padding: 2px 5px; }
    .hgn-nav-btn { width: 32px; height: 32px; font-size: 14px; }
    .hgn-gallery { gap: 6px; padding: 0 10px; }
    .hgn-modal__backdrop { padding: 8px 4px; }
    .hgn-modal__img-wrap { width: 100%; }
    .hgn-modal__img-wrap img { width: 100%; max-height: 80vh; }
}

@media (min-width: 768px) {
    .hgn-gallery { gap: 10px; }
    .hgn-card { max-height: calc((100% - 10px) / 2); }
}

@media (max-width: 400px) {
    .hgn-gallery { gap: 4px; }
    .hgn-hero { padding: 6px 10px 2px; }
}


/* Landscape mobile modal */
@media (max-height: 500px) and (orientation: landscape) {
    .hgn-modal__img-wrap img { max-height: 85vh; max-width: 90vw; width: auto; }
    .hgn-modal__backdrop { padding: 10px 8px 8px; }
    .hgn-modal__close { bottom: 8px; right: 8px; width: 32px; height: 32px; font-size: 18px; top: auto; }
}

/* ========== MOBILE AUTO-ROTATE MODAL ========== */
.hgn-modal--mobile-landscape .hgn-modal__backdrop {
    width: 100vh;
    height: 100vw;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: calc(-50vw);
    margin-left: calc(-50vh);
    padding: 8px !important;
    transition: transform 0.3s ease;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hgn-modal--mobile-landscape .hgn-modal__img-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hgn-modal--mobile-landscape .hgn-modal__img-wrap img {
    width: auto;
    height: auto;
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.hgn-modal--mobile-landscape .hgn-modal__close {
    position: absolute;
    bottom: 12px;
    right: 12px;
    top: auto;
}

.hgn-modal--mobile-landscape .hgn-modal__preview {
    transform: rotate(0deg) translateY(20px);
}

.hgn-modal--mobile-landscape .hgn-modal__preview.show {
    transform: rotate(0deg) translateY(0);
}
