:root {
    --color-primary: #2A6B97;
    --color-secondary: #8B6D9C;
    --color-accent: #D48A6A;
    --color-dark: #2C3639;
    --color-darker: #21292C;
    --color-light: #F5F5F0;
    --color-muted: #DCD7C9;
    --color-dark-muted: #374145;
}

.text-gradient {
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    background-image: linear-gradient(135deg, #2A6B97 0%, #8B6D9C 100%);
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #2A6B97 0%, #8B6D9C 100%);
}

.bg-gradient-davinci {
    background: linear-gradient(180deg, #F5F5F0 0%, #DCD7C9 100%);
}

.bg-gradient-footer {
    background: linear-gradient(180deg, #2C3639 0%, #21292C 100%);
}

.transition-base {
    transition: all 0.3s ease;
}

.shadow-soft {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.shadow-hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.content-auto {
    content-visibility: auto;
}

/* 平台展开菜单样式 */
.group:hover .invisible {
    visibility: visible;
}

.group:hover .opacity-0 {
    opacity: 1;
}

/* 更多 向右展开样式与动效 */
.more-menu { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.more-menu:focus { outline: none; }
.more-submenu {
    min-width: 140px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(12px) translateY(-50%) scale(0.995);
    transition: opacity 520ms cubic-bezier(.2,.8,.2,1), transform 520ms cubic-bezier(.2,.8,.2,1), visibility 520ms;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 6px 8px; /* 收窄内边距 */
    border-radius: 8px;
    background: transparent; /* 完全去除背景 */
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border: none; /* 去除边线 */
    box-shadow: none; /* 去除阴影 */
    transform-origin: left center;
}
.more-menu.open .more-submenu,
.more-menu:hover .more-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0) translateY(-50%) scale(1);
}

/* horizontal item styles inside submenu */
.more-submenu > div { margin: 0; display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; transition: transform 420ms cubic-bezier(.2,.8,.2,1), background 360ms ease, color 360ms ease; color: var(--color-dark-muted); }
.more-submenu > div:hover { transform: translateY(-6px); background: rgba(42,107,151,0.06); color: var(--color-primary); box-shadow: 0 8px 20px rgba(42,107,151,0.03); }

/* subtle staggered reveal */
.more-menu.open .more-submenu > div { transform: translateY(0); }
.more-menu.open .more-submenu > div:nth-child(1) { transition-delay: 40ms; }
.more-menu.open .more-submenu > div:nth-child(2) { transition-delay: 80ms; }
.more-menu.open .more-submenu > div:nth-child(3) { transition-delay: 120ms; }
.more-menu.open .more-submenu > div:nth-child(4) { transition-delay: 160ms; }
.more-menu.open .more-submenu > div:nth-child(5) { transition-delay: 200ms; }
.more-arrow { transition: transform 220ms ease, opacity 200ms ease; color: var(--color-dark-muted); }
.more-menu.open .more-arrow,
.more-menu:hover .more-arrow { transform: translateX(4px) rotate(10deg); color: var(--color-primary); }
.more-arrow.duplicate { opacity: 0.6; transform-origin: left center; }
.more-menu.open .more-arrow.duplicate,
.more-menu:hover .more-arrow.duplicate { opacity: 1; transform: translateX(6px) rotate(8deg); }

/* 小屏幕时向右展开改为向下（避免屏幕溢出） */
@media (max-width: 640px) {
    /* revert to vertical list on small screens (no background) */
    .more-submenu { left: 0 !important; top: calc(100% + 6px) !important; transform: translateY(6px) !important; display: flex !important; flex-direction: column !important; gap: 8px !important; padding: 6px !important; background: transparent !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; border-radius: 8px !important; border: none !important; }
    .more-submenu > div { width: 100%; }
    .more-menu.open .more-submenu, .more-menu:hover .more-submenu { transform: translateY(0) !important; opacity: 1 !important; visibility: visible !important; }
}

/* 双箭头触发器样式 */
.more-toggle { background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(245,245,240,0.96)); border: 1px solid rgba(42,107,151,0.08); padding: 6px 8px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 8px; transition: transform 320ms cubic-bezier(.2,.8,.2,1), box-shadow 320ms cubic-bezier(.2,.8,.2,1), background 320ms ease; box-shadow: 0 4px 18px rgba(42,107,151,0.04); }
.more-toggle:focus { outline: 2px solid rgba(42,107,151,0.12); outline-offset: 2px; }
.more-toggle:hover { transform: translateX(3px); box-shadow: 0 14px 40px rgba(42,107,151,0.06); background: linear-gradient(180deg, rgba(42,107,151,0.03), rgba(245,245,240,0.96)); }
.more-toggle .double-arrow { display: inline-flex; gap: 6px; align-items: center; color: var(--color-dark-muted); font-size: 0.95rem; }
.more-toggle .double-arrow i { display: inline-block; transform: translateX(0); transition: transform 360ms cubic-bezier(.2,.8,.2,1), opacity 260ms ease; opacity: 0.95; color: var(--color-dark-muted); }
.more-toggle:hover .double-arrow i:first-child { transform: translateX(6px); }
.more-toggle:hover .double-arrow i:last-child { transform: translateX(12px); }

/* When menu is open, animate slightly and change color */
.more-menu.open .more-toggle .double-arrow i { color: var(--color-primary); transform: translateX(6px); }

@media (max-width: 640px) {
    .more-toggle { display: none; }
}

/* Language selector styles */
#langSelector #langBtn {
    min-width: 68px;
}
#langMenu li { font-size: 0.95rem; }
#langMenu li:hover { background-color: rgba(0,0,0,0.03); }

/* Small accessibility tweak for RTL */
html[dir="rtl"] .fa-caret-down { transform: rotate(180deg); }

/* Hero title visual polish for English only (non-content change) */
html[lang="en"] .hero-title { position: relative; display: inline-block; line-height: 1; padding-bottom: 0.25rem; }
html[lang="en"] .hero-title-main { background-image: linear-gradient(90deg, #2A6B97 0%, #8B6D9C 100%); -webkit-background-clip: text; background-clip: text; color: transparent; display: inline-block; }
html[lang="en"] .hero-title-sub { display: block; font-weight: 600; color: var(--color-dark); opacity: 0.92; font-size: 0.72em; margin-top: 0.08em; letter-spacing: 0.2px; }

html[lang="en"] .hero-title::after { content: ""; position: absolute; left: 0; bottom: -0.45rem; height: 8px; width: 38%; background: linear-gradient(90deg, rgba(42,107,151,0.16), rgba(139,109,156,0.16)); border-radius: 999px; transform: scaleX(0); transform-origin: left; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
html[lang="en"] .hero-title:hover::after, html[lang="en"] .hero-title:focus-within::after { transform: scaleX(1); }

html[lang="en"] .hero-title-main { text-shadow: 0 6px 18px rgba(42,107,151,0.06); }

/* Decorative soft ornament (visual only) */
.hero-ornament { position: absolute; width: 88px; height: 88px; border-radius: 999px; right: -18px; top: -28px; background: radial-gradient(circle at 30% 30%, rgba(42,107,151,0.12), transparent 40%), linear-gradient(135deg, rgba(42,107,151,0.06), rgba(212,138,106,0.06)); pointer-events: none; filter: blur(6px); opacity: 0.95; }

/* Optimized hero title styling (responsive, tighter spacing, better hierarchy) */
.hero-optimized {
    display: block;
    max-width: 920px;
    line-height: 1.03;
    margin-bottom: 0.25rem;
}
.hero-optimized .hero-main {
    display: block;
    font-weight: 800;
    font-size: clamp(2.4rem, 6.4vw, 4.6rem);
    line-height: 1.02;
    letter-spacing: -0.6px;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-rendering: optimizeLegibility;
    text-shadow: 0 6px 18px rgba(42,107,151,0.06);
}
.hero-optimized .hero-emphasis {
    display: block;
    font-weight: 600;
    font-size: clamp(1.05rem, 2.6vw, 1.6rem);
    margin-top: 0.36rem;
    color: var(--color-dark);
    opacity: 0.95;
    letter-spacing: 0.2px;
}

@media (max-width: 768px) {
    .hero-optimized { max-width: 100%; }
    .hero-optimized .hero-main { font-size: clamp(1.8rem, 9.4vw, 2.8rem); letter-spacing: -0.3px; }
    .hero-optimized .hero-emphasis { font-size: clamp(0.96rem, 4.2vw, 1.2rem); margin-top: 0.28rem; }
}

/* Hero paragraph (Chinese) visual polish */
.hero-lead {
    max-width: 54ch;
    font-size: clamp(1rem, 1.6vw, 1.0625rem);
    line-height: 1.95;
    color: rgba(44,54,57,0.88);
    margin-top: 0.6rem;
    text-wrap: balance;
    text-align: justify;
    -webkit-font-smoothing: antialiased;
}
.hero-lead p { margin: 0; }

@media (max-width: 768px) {
    .hero-lead { max-width: 100%; font-size: clamp(0.96rem, 3.8vw, 1rem); line-height: 1.8; text-align: left; }
}

@media (max-width: 768px) {
    html[lang="en"] .hero-title::after { bottom: -0.35rem; width: 46%; height: 6px; }
    .hero-ornament { width: 56px; height: 56px; right: -8px; top: -18px; filter: blur(4px); opacity: 0.7; }
    .hero-title-sub { font-size: 0.78em; }
}

/* Section title polish and micro-animations for English */
html[lang="en"] .section-title { position: relative; display: inline-block; padding-bottom: 0.4rem; color: var(--color-darker); }
html[lang="en"] .section-title { transition: transform .6s cubic-bezier(.2,.8,.2,1), opacity .6s ease; transform: translateY(8px); opacity: 0; }
html[lang="en"] .section-title.in-view { transform: translateY(0); opacity: 1; }

html[lang="en"] .section-title::after { content: ""; position: absolute; left: 0; bottom: -0.45rem; height: 6px; width: 22%; background: linear-gradient(90deg, rgba(42,107,151,0.18), rgba(139,109,156,0.18)); border-radius: 999px; transform: scaleX(0); transform-origin: left; transition: transform .5s ease; }
html[lang="en"] .section-title.in-view::after { transform: scaleX(1); }

html[lang="en"] .section-ornament { position: absolute; right: -12px; top: -18px; width: 56px; height: 56px; border-radius: 999px; pointer-events: none; background: radial-gradient(circle at 35% 35%, rgba(42,107,151,0.08), transparent 40%), linear-gradient(135deg, rgba(42,107,151,0.04), rgba(212,138,106,0.04)); filter: blur(5px); opacity: 0.9; transform: translateY(-6px) scale(.98); transition: transform .45s cubic-bezier(.2,.8,.2,1), opacity .45s ease; }

html[lang="en"] .section-title:hover .section-ornament, html[lang="en"] .section-title:focus-within .section-ornament { transform: translateY(-2px) scale(1); opacity: 1; }

/* smaller ornament for footer headings */
html[lang="en"] footer .section-ornament { width: 36px; height: 36px; right: -8px; top: -8px; filter: blur(4px); opacity: 0.65; }

@media (max-width: 768px) {
    html[lang="en"] .section-title::after { width: 34%; bottom: -0.35rem; height: 5px; }
    html[lang="en"] .section-ornament { right: -8px; top: -12px; width: 40px; height: 40px; filter: blur(4px); }
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    html[lang="en"] .hero-title::after,
    html[lang="en"] .section-title::after,
    html[lang="en"] .section-title,
    html[lang="en"] .hero-title { transition: none !important; animation: none !important; }
}

/* Generic reveal-on-scroll utility */
.reveal { opacity: 0; transform: translateY(14px); will-change: opacity, transform; transition: opacity .6s cubic-bezier(.2,.8,.2,1), transform .6s cubic-bezier(.2,.8,.2,1); }
.reveal.in-view { opacity: 1; transform: translateY(0); }
.reveal[data-reveal-delay] { transition-delay: var(--reveal-delay, 0s); }

/* Provide CSS var mapping if not explicitly set by JS */
.reveal { --reveal-delay: 0s; }

@media (prefers-reduced-motion: reduce) {
    .reveal { transition: none !important; transform: none !important; }
}

/* Cursor trail canvas (subtle, translucent) */
.cursor-trail { position: fixed; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; mix-blend-mode: screen; opacity: 0.9; }

/* Hero media subtle transform smoothing */
.hero-media img { will-change: transform; transition: transform 450ms cubic-bezier(.2,.8,.2,1); }

/* Ensure the trail is disabled on small screens (better perf) */
@media (max-width: 768px) {
    .cursor-trail { display: none; }
}

/* Fireworks canvas */
.fireworks-canvas { position: fixed; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

/* Case card overlay and hover polish */
.case-figure { position: relative; overflow: hidden; border-radius: 12px; }
.case-img { transition: transform 500ms cubic-bezier(.2,.8,.2,1); display: block; width: 100%; height: 100%; object-fit: cover; }
.case-overlay { position: absolute; left: 0; bottom: 0; width: 100%; padding: 14px; background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 100%); color: #ffffff; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.case-tag { background: rgba(255,255,255,0.08); color: #fff; padding: 6px 10px; border-radius: 999px; font-weight: 600; font-size: 0.85rem; backdrop-filter: blur(6px); }
.case-figure:hover .case-img { transform: scale(1.06); }
.case-card { transition: transform 350ms ease, box-shadow 350ms ease; }
.case-card:hover { transform: translateY(-6px); box-shadow: 0 14px 40px rgba(42,107,151,0.08); }

/* Ensure overlay text is readable on light-theme cards */
.bg-light .case-overlay { background: linear-gradient(180deg, rgba(0,0,0,0.0) 0%, rgba(0,0,0,0.55) 100%); }

@media (prefers-reduced-motion: reduce) {
    .case-img { transition: none !important; }
    .case-card { transition: none !important; }
}
