/* =========================================================
   site.css — shared base, navigation, mobile drawer & footer
   Each page only keeps its hero/section-specific styles.
   ========================================================= */

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; }
body {
    margin: 0;
    padding: 0;
    background-color: #F8F4EC;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: #2C1A0E;
    line-height: 1.7;
    -webkit-text-size-adjust: 100%;
}
img { max-width: 100%; }

/* ---------- Top nav ---------- */
.nav {
    position: fixed;
    display: flex;
    align-items: center;
    height: 72px;
    width: 100%;
    background-color: #F8F4EC;
    border-bottom: 1px solid rgba(180, 140, 90, 0.15);
    margin: 0;
    padding: 0 48px;
    padding-left: max(48px, env(safe-area-inset-left));
    padding-right: max(48px, env(safe-area-inset-right));
    top: 0; left: 0; right: 0;
    z-index: 160;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.nav-logo {
    display: block;
    width: 56px;
    height: 56px;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nav-title { display: flex; flex-direction: column; justify-content: center; }
.nav-title-ch {
    font-family: 'STXingkai', 'KaiTi', 'STKaiti', serif;
    font-size: 20px;
    font-weight: 600;
    color: #2C1A0E;
    letter-spacing: 0.05em;
    transition: color 0.3s ease;
}
.nav-title-en {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-size: 12px;
    font-weight: 400;
    font-style: italic;
    color: #6B4C2A;
    letter-spacing: 0.08em;
    margin-top: 2px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 72px;
    margin: 0 auto;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
    padding: 4px 0;
    text-decoration: none;
    color: inherit;
    transition: transform 0.25s ease;
}
.nav-item-ch {
    font-size: 15px;
    color: #2C1A0E;
    font-weight: 500;
    transition: color 0.25s ease;
}
.nav-item-en {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-size: 11px;
    color: #8A6A45;
    margin-top: 2px;
    letter-spacing: 0.06em;
    transition: color 0.25s ease;
}
.nav-item::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    transform-origin: center;
    width: 22px;
    height: 2px;
    background-color: #B43A2E;
    transition: transform 0.3s cubic-bezier(0.65, 0, 0.35, 1);
}
.nav-item.active::after { transform: translateX(-50%) scaleX(1); }

.nav-lang {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-size: 14px;
    color: #6B4C2A;
    flex: 0 0 auto;
}
.nav-lang span:not(.sep) {
    cursor: pointer;
    padding: 2px 4px;
    transition: color 0.25s ease, transform 0.25s ease;
}
.nav-lang .active-lang { color: #B43A2E; font-weight: 600; }
.nav-lang .sep { color: #C9B79A; }

/* Hover effects: only on pointer-precision devices to avoid sticky hover on touch */
@media (hover: hover) {
    .nav-brand:hover .nav-logo { transform: rotate(-12deg) scale(1.06); }
    .nav-brand:hover .nav-title-ch { color: #B43A2E; }
    .nav-item:hover { transform: translateY(-2px); }
    .nav-item:hover .nav-item-ch { color: #B43A2E; }
    .nav-item:hover::after { transform: translateX(-50%) scaleX(1); }
    .nav-lang span:not(.sep):hover { color: #B43A2E; transform: translateY(-1px); }
}

/* ---------- Mobile drawer ---------- */
.nav-toggle {
    display: none;
    position: relative;
    z-index: 170;
    background: transparent;
    border: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: #2C1A0E;
    margin-left: 8px;
}
.nav-toggle .bar,
.nav-toggle .bar::before,
.nav-toggle .bar::after {
    display: block;
    width: 22px;
    height: 2px;
    background-color: currentColor;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.2s ease, background-color 0.2s ease;
}
.nav-toggle .bar { position: relative; }
.nav-toggle .bar::before,
.nav-toggle .bar::after { content: ''; position: absolute; left: 0; }
.nav-toggle .bar::before { top: -7px; }
.nav-toggle .bar::after { top: 7px; }
.nav-toggle.open .bar { background-color: transparent; }
.nav-toggle.open .bar::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open .bar::after { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
    position: fixed;
    top: 0; right: 0;
    height: 100vh;
    height: 100dvh;
    width: min(82vw, 320px);
    background-color: #F8F4EC;
    box-shadow: -8px 0 24px rgba(80, 50, 20, 0.18);
    z-index: 150;
    padding: 88px 24px 32px;
    padding-right: max(24px, env(safe-area-inset-right));
    display: flex;
    flex-direction: column;
    gap: 2px;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.65, 0, 0.35, 1);
    overflow-y: auto;
    visibility: hidden;
    pointer-events: none;
}
.mobile-menu.open { transform: translateX(0); visibility: visible; pointer-events: auto; }
.mobile-menu .nav-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    padding: 16px 6px;
    min-height: 52px;
    border-bottom: 1px solid rgba(180, 140, 90, 0.18);
    transform: none !important;
}
.mobile-menu .nav-item:active { background-color: rgba(180, 58, 46, 0.06); }
.mobile-menu .nav-item::after { display: none; }
.mobile-menu .nav-item-ch { font-size: 17px; }
.mobile-menu .nav-item-en { margin: 0 0 0 12px; }
.mobile-menu .nav-item.active .nav-item-ch { color: #B43A2E; }
.mobile-menu .mobile-lang {
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-size: 15px;
    color: #6B4C2A;
}
.mobile-menu .mobile-lang span:not(.sep) {
    cursor: pointer;
    padding: 10px 14px;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}
.mobile-menu .mobile-lang span:not(.sep):active { background-color: rgba(180, 58, 46, 0.08); }
.mobile-menu .mobile-lang .active-lang { color: #B43A2E; font-weight: 600; }
.mobile-menu .mobile-lang .sep { color: #C9B79A; padding: 0 2px; }

.mobile-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(28, 16, 8, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 140;
}
.mobile-overlay.show { opacity: 1; pointer-events: auto; }

/* ---------- Footer ---------- */
.site-footer {
    background-color: #F1E9D8;
    border-top: 1px solid rgba(180, 140, 90, 0.2);
    padding: 30px 48px 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    color: #6B4C2A;
}
.footer-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 44px;
    flex-wrap: wrap;
}
.footer-info { line-height: 1.6; }
.footer-title {
    font-family: 'STXingkai', 'KaiTi', serif;
    font-size: 20px;
    color: #2C1A0E;
    font-weight: 600;
    letter-spacing: 0.06em;
}
.footer-title-en {
    font-family: 'Cormorant Garamond', serif;
    font-size: 11px;
    color: #8A6A45;
    font-style: italic;
    letter-spacing: 0.2em;
    margin-top: 2px;
}
.footer-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: 10px;
    font-size: 13.5px;
}
.footer-line .label {
    display: inline-block;
    min-width: 44px;
    padding: 1px 8px;
    background-color: rgba(180, 58, 46, 0.1);
    color: #B43A2E;
    font-size: 12px;
    border-radius: 3px;
    text-align: center;
}
.footer-line .wx {
    color: #B43A2E;
    font-weight: 600;
    font-family: 'Cormorant Garamond', monospace;
    letter-spacing: 0.06em;
    user-select: all;
    font-size: 15px;
}

.footer-qr-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.footer-qr-tag {
    font-family: 'Cormorant Garamond', serif;
    font-size: 11px;
    color: #B43A2E;
    letter-spacing: 0.22em;
    font-weight: 600;
    text-transform: uppercase;
}
.footer-qr {
    height: 130px;
    width: auto;
    display: block;
    border-radius: 4px;
    border: 1px solid rgba(180, 140, 90, 0.25);
    box-shadow: 0 6px 18px rgba(80, 50, 20, 0.18);
    cursor: zoom-in;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: #fff;
}
.footer-qr-hint {
    font-size: 11px;
    color: #8A6A45;
    margin-top: 2px;
    letter-spacing: 0.04em;
}
.footer-copy {
    margin-top: 18px;
    text-align: center;
    font-family: 'Cormorant Garamond', serif;
    font-size: 11px;
    color: #8A6A45;
    letter-spacing: 0.15em;
}
@media (hover: hover) {
    .footer-qr:hover {
        transform: translateY(-3px) scale(1.04);
        box-shadow: 0 12px 28px rgba(80, 50, 20, 0.28);
    }
}

/* ---------- QR lightbox ---------- */
.qr-lightbox {
    position: fixed;
    inset: 0;
    background-color: rgba(28, 16, 8, 0.88);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 40px;
}
.qr-lightbox.show { display: flex; }
.qr-lightbox img {
    max-width: 92vw;
    max-height: 88vh;
    border-radius: 6px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.qr-lightbox-close {
    position: absolute;
    top: max(24px, env(safe-area-inset-top));
    right: max(32px, env(safe-area-inset-right));
    color: #F8F4EC;
    background: transparent;
    border: 1px solid rgba(248, 244, 236, 0.4);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    z-index: 1;
}
@media (hover: hover) {
    .qr-lightbox-close:hover { background-color: rgba(248, 244, 236, 0.15); }
}

/* ---------- Responsive: shared nav / footer / qr-lightbox ---------- */
@media (max-width: 960px) {
    .nav {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: 56px 32px;
        align-content: center;
        align-items: center;
        column-gap: 12px;
        row-gap: 4px;
        height: 104px;
        padding: 6px 20px 8px;
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
    .nav-brand {
        grid-column: 1;
        grid-row: 1;
        gap: 10px;
        min-width: 0;
    }
    .nav-logo { width: 44px; height: 44px; }
    .nav-title { min-width: 0; }
    .nav-title-ch { font-size: 17px; }
    .nav-title-en { font-size: 12px; }
    .nav-title-ch,
    .nav-title-en {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    .nav .nav-lang {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        justify-self: end;
        gap: 8px;
        font-size: 16px;
        white-space: nowrap;
    }
    .nav-menu {
        grid-column: 1 / -1;
        grid-row: 2;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        width: 100%;
        margin: 0;
        align-self: stretch;
    }
    .nav-menu .nav-item {
        justify-content: center;
        min-width: 0;
        min-height: 32px;
        padding: 3px 4px 4px;
        border: 1px solid rgba(180, 140, 90, 0.22);
        border-radius: 4px;
        background-color: rgba(251, 246, 234, 0.72);
        transform: none !important;
    }
    .nav-menu .nav-item.active {
        border-color: rgba(180, 58, 46, 0.5);
        background-color: rgba(180, 58, 46, 0.08);
    }
    .nav-menu .nav-item::after { display: none; }
    .nav-item-ch {
        font-size: 13px;
        line-height: 1.1;
    }
    .nav-item-en {
        font-size: 10px;
        line-height: 1.1;
        margin-top: 1px;
        letter-spacing: 0.03em;
    }
    .nav-toggle,
    .mobile-menu,
    .mobile-overlay {
        display: none;
    }

    .site-footer { padding: 28px 24px 18px; }
    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 26px;
    }
    .footer-qr-block { align-self: center; }
}

@media (max-width: 560px) {
    .nav {
        grid-template-rows: 52px 30px;
        row-gap: 3px;
        height: 96px;
        padding: 5px 14px 7px;
    }
    .nav-logo { width: 40px; height: 40px; }
    .nav-brand { gap: 8px; }
    .nav-title-ch { font-size: 16px; }
    .nav-title-en {
        display: block;
        font-size: 11px;
    }
    .nav .nav-lang {
        gap: 6px;
        font-size: 15px;
    }
    .nav-menu {
        gap: 5px;
    }
    .nav-menu .nav-item {
        min-height: 30px;
        padding: 2px 2px 3px;
    }
    .nav-item-ch { font-size: 12.5px; }
    .nav-item-en { font-size: 9px; }

    .site-footer { padding: 22px 16px 16px; }
    .footer-inner {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
        gap: 22px 14px;
    }
    .footer-info { grid-column: 1 / -1; }
    .footer-qr-block {
        align-self: start;
        width: 100%;
        min-width: 0;
    }
    .footer-qr { height: 108px; }
    .qr-lightbox { padding: 20px; }
    .qr-lightbox-close {
        top: max(16px, env(safe-area-inset-top));
        right: max(16px, env(safe-area-inset-right));
    }
}

@media (max-width: 380px) {
    .nav {
        grid-template-rows: 50px 28px;
        height: 92px;
        padding: 5px 12px 6px;
    }
    .nav-logo { width: 36px; height: 36px; }
    .nav-title-ch { font-size: 15px; }
    .nav-title-en { font-size: 10px; }
    .nav .nav-lang { font-size: 14px; }
    .nav-menu .nav-item { min-height: 28px; }
    .nav-item-en { display: none; }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    html { scroll-behavior: auto; }
}
