/**
 * 监狱重工 ZANE 官网 - 自定义样式
 * 用于 Tailwind CSS 之外的补充样式
 */

/* ========================================
   深色模式声明（防止浏览器强制转换）
   ======================================== */
:root {
    color-scheme: dark only;

    /* 主题色变量 - 默认 ZNHI 蓝色 */
    --color-primary: #4db8ff;
    --color-primary-dim: #3a8abf;
    --color-primary-rgb: 77, 184, 255;
}

/* ZNTP 绿色主题 */
.theme-zntp {
    --color-primary: #3EAF5C;
    --color-primary-dim: #2E8A47;
    --color-primary-rgb: 62, 175, 92;
}

/* ========================================
   Logo反色处理（深色转白，保留#2CE6E6青色）
   ======================================== */
.logo-invert {
    /* 反转所有颜色，然后通过色相旋转恢复青色 */
    filter: invert(1) hue-rotate(180deg) saturate(1.3) brightness(1.05);
}

/* ========================================
   表单元素样式修复
   ======================================== */
/* 移除Tailwind forms插件的默认ring效果，统一使用border */
input:focus,
textarea:focus,
select:focus {
    outline: none !important;
    box-shadow: none !important;
    --tw-ring-color: transparent !important;
}

/* 关于页联络表单专用样式 */
.contact-input {
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.contact-input:focus {
    border-color: rgba(var(--color-primary-rgb), 0.5) !important;
    background-color: rgba(37, 37, 41, 0.8);
}

/* ========================================
   渐变文字效果
   ======================================== */
.text-gradient {
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-image: linear-gradient(to right, #ffffff, #a0a0a5);
}

/* ========================================
   Hero 区域遮罩
   ======================================== */
.hero-overlay {
    background: radial-gradient(circle at center, transparent 0%, #121214 90%);
}

/* ========================================
   卡片悬浮效果
   ======================================== */
.card-hover {
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.6);
}

/* ========================================
   淡入动画（用于关于页等）
   ======================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fade-in {
    animation: fadeIn 1s ease-out forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

.animate-slide-in-left {
    animation: slideInFromLeft 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ========================================
   图片滤镜工具类
   ======================================== */
.img-polar {
    filter: saturate(0) brightness(0.75) contrast(1.25);
}

.img-polar-hover {
    filter: saturate(0.2) brightness(0.75) contrast(1.25);
    transition: filter 0.5s ease;
}

.img-polar-hover:hover {
    filter: saturate(0.5) brightness(0.8) contrast(1.2);
}

/* ========================================
   滚动条样式（可选）
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #121214;
}

::-webkit-scrollbar-thumb {
    background: #333336;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* ========================================
   选中文本样式
   ======================================== */
::selection {
    background: rgba(var(--color-primary-rgb), 0.3);
    color: white;
}

/* ========================================
   自定义下拉菜单
   ======================================== */
.custom-dropdown {
    position: relative;
}

.dropdown-trigger {
    cursor: pointer;
    user-select: none;
}

.dropdown-trigger.dropdown-active {
    border-color: rgba(var(--color-primary-rgb), 0.5) !important;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #1c1c1f;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    z-index: 50;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.dropdown-menu.dropdown-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-option {
    padding: 12px 16px;
    font-size: 14px;
    color: #a0a0a5;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dropdown-option:last-child {
    border-bottom: none;
}

.dropdown-option:hover {
    background: rgba(var(--color-primary-rgb), 0.1);
    color: white;
}

.dropdown-option.dropdown-selected-option {
    background: rgba(var(--color-primary-rgb), 0.15);
    color: var(--color-primary);
}

.dropdown-option.dropdown-selected-option::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background: var(--color-primary);
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

/* ========================================
   精品页和故事章节的文字阴影（提升可读性）
   ======================================== */
/* 精品页产品标题 - 更大更淡的阴影 */
.product-item h2 {
    text-shadow: 0 6px 24px rgba(0, 0, 0, 0.6), 0 3px 8px rgba(0, 0, 0, 0.5);
}

/* 故事章节标题 - 标题浓度低，扩散大 */
.story-chapter h2 {
    text-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* 精品页段落文字 */
.product-item p {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* 故事章节段落文字 - 正文浓度高 */
.story-chapter p {
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.95), 0 2px 6px rgba(0, 0, 0, 0.85);
}

/* 精品页标签、副标题、规格参数等小文字 */
.product-item span {
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

/* 故事章节标签、副标题、规格参数等小文字 - 加大阴影并提高浓度 */
.story-chapter span,
.story-chapter .text-gray-300,
.story-chapter .text-gray-500,
.story-chapter .text-white {
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.85), 0 1px 4px rgba(0, 0, 0, 0.75);
}

/* 规格参数的 div 元素（右侧布局等使用 div 渲染规格） */
.product-item .text-gray-500,
.product-item .text-white,
.product-item .text-lg,
.product-item .text-2xl,
.product-item .text-3xl {
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

/* 规格参数卡片内的文字（背景有毛玻璃效果，阴影可以轻一些） */
.product-item .bg-surface-dark\/60 span,
.product-item .bg-surface-dark\/60 .text-white {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* 故事章节数据块 - 加大阴影并提高浓度 */
.story-chapter .text-2xl,
.story-chapter .text-4xl,
.story-chapter .text-5xl,
.story-chapter .text-6xl,
.story-chapter .text-7xl,
.story-chapter .text-8xl {
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.9), 0 2px 8px rgba(0, 0, 0, 0.75);
}

/* 故事章节引用卡片（quote-card）内的文字 - 有背景，阴影轻一些 */
.story-chapter .quote-card p,
.story-chapter .quote-card span {
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

/* ========================================
   作者留言卡片悬停效果
   ======================================== */
.quote-card {
    border-left-color: var(--color-primary) !important;
    transition: border-color 0.3s ease;
}

.quote-card:hover {
    border-left-color: rgba(255, 255, 255, 0.3) !important;
}

/* ========================================
   主题色透明度变体修复
   ======================================== */
/* 覆盖 Tailwind 的透明度修饰符类，因为 CSS 变量不支持透明度修饰符 */

/* 背景色 */
.bg-primary\/60 {
    background-color: rgba(var(--color-primary-rgb), 0.6) !important;
}

.bg-primary\/40 {
    background-color: rgba(var(--color-primary-rgb), 0.4) !important;
}

.bg-primary\/20 {
    background-color: rgba(var(--color-primary-rgb), 0.2) !important;
}

/* 文字颜色 */
.text-primary\/90 {
    color: rgba(var(--color-primary-rgb), 0.9) !important;
}

.text-primary\/60 {
    color: rgba(var(--color-primary-rgb), 0.6) !important;
}

/* 边框颜色 */
.border-primary\/50 {
    border-color: rgba(var(--color-primary-rgb), 0.5) !important;
}

.border-primary\/40 {
    border-color: rgba(var(--color-primary-rgb), 0.4) !important;
}

.border-primary\/30 {
    border-color: rgba(var(--color-primary-rgb), 0.3) !important;
}

.border-primary\/20 {
    border-color: rgba(var(--color-primary-rgb), 0.2) !important;
}

/* 焦点状态边框颜色 */
.focus\:border-primary\/50:focus {
    border-color: rgba(var(--color-primary-rgb), 0.5) !important;
}

.focus\:border-primary\/40:focus {
    border-color: rgba(var(--color-primary-rgb), 0.4) !important;
}

.focus\:border-primary\/30:focus {
    border-color: rgba(var(--color-primary-rgb), 0.3) !important;
}

/* ========================================
   侧边栏系列切换
   ======================================== */
.series-btn.series-active {
    background: rgba(37, 37, 41, 0.5);
}

/* 系列卡片内容区 - 平滑高度过渡 */
.series-inner {
    height: 128px; /* 默认高度 = h-32 */
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease;
}

/* 选中状态的展开高度 */
.series-btn.series-active .series-inner {
    height: 192px; /* 展开高度 = h-48 */
    opacity: 1;
}

/* 未选中状态的透明度和悬停效果 */
.series-btn:not(.series-active) .series-inner {
    opacity: 0.6;
}

.series-btn:not(.series-active):hover .series-inner {
    opacity: 1;
}

/* ========================================
   图片查看器样式
   ======================================== */
/* 全屏查看器容器 */
.image-viewer {
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
}

/* 查看器淡入动画 */
.image-viewer.animate-fade-in {
    animation: viewerFadeIn 0.3s ease-out forwards;
}

/* 查看器淡出动画 */
.image-viewer.animate-fade-out {
    animation: viewerFadeOut 0.3s ease-out forwards;
}

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

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

/* 查看器中的图片淡入效果 */
.image-viewer img {
    transition: opacity 0.3s ease;
}

/* 查看器按钮悬停效果 */
.image-viewer button:not(:disabled):hover {
    transform: scale(1.05);
}

.image-viewer button {
    transition: all 0.2s ease;
}

/* 查看器计数器样式 */
.image-viewer #viewer-counter {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* 查看器加载指示器动画 */
@keyframes viewerSpinPulse {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.1);
    }
}

.image-viewer #viewer-loading > div {
    animation: viewerSpinPulse 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .image-viewer img {
        max-height: 80vh !important;
    }

    .image-viewer button {
        backdrop-filter: blur(12px);
    }
}

/* ========================================
   移动端滚动高亮效果
   当元素滚动到视口中心时，自动触发类似 hover 的高亮状态
   ======================================== */
@media (max-width: 767px) {
    /* 精选旗舰卡片 - 图片缩放 */
    .featured-card.is-active .saturate-50 {
        transform: scale(1.05);
    }

    /* 精选旗舰卡片 - 标题变色 */
    .featured-card.is-active h3 {
        color: var(--color-primary) !important;
    }

    /* 精选旗舰卡片 - 底部下划线显示 */
    .featured-card.is-active span.border-transparent {
        border-color: white !important;
    }

    /* 发展历程时间线 - 年份变亮 */
    .timeline-item.is-active .text-surface-highlight {
        color: white !important;
    }

    /* 发展历程时间线 - 圆点边框变色 */
    .timeline-item.is-active .border-white\/20 {
        border-color: var(--color-primary) !important;
    }
}

