/* ==========================================================================
 *  css/style.css —— 清梦官网自定义样式
 *  仅放置 Tailwind 无法直接表达的样式（纹理、雨效、文字阴影、表单细节）。
 * ========================================================================== */

/* ------------------------------ 基础 ------------------------------ */
:root {
    --qm-rust: #b7410e;
    --qm-darker: #0a0a0a;
    color-scheme: dark;
}

html {
    scroll-behavior: smooth;
    /* 固定导航栏高度补偿，避免锚点跳转后标题被遮挡 */
    scroll-padding-top: 5rem;
}

body {
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background-color: rgba(183, 65, 14, 0.65);
    color: #fff;
}

/* 自定义滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb { background: #3f3f3f; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--qm-rust); }

/* 键盘焦点可见性（无障碍） */
a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--qm-rust);
    outline-offset: 2px;
}

/* ------------------------------ 文字效果 ------------------------------ */
.text-shadow {
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.85), 0 0 2px rgba(0, 0, 0, 1);
}

/* 标题闪烁：模拟末世灯管接触不良 */
.flicker {
    animation: qm-flicker 6s infinite steps(1, end);
}

@keyframes qm-flicker {
    0%, 43%, 100% { opacity: 1; }
    44% { opacity: 0.55; }
    45% { opacity: 1; }
    46% { opacity: 0.7; }
    47% { opacity: 1; }
    78% { opacity: 0.85; }
    79% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .flicker,
    .animate-bounce,
    .animate-pulse {
        animation: none !important;
    }
    html { scroll-behavior: auto; }
}

/* ------------------------------ 纹理与雨效 ------------------------------ */
/* 铁锈纹理：叠加噪点与斜向划痕 */
.rust-texture {
    position: relative;
    background-image:
        linear-gradient(115deg, rgba(183, 65, 14, 0.06) 0%, transparent 55%),
        repeating-linear-gradient(58deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 7px),
        repeating-linear-gradient(-32deg, rgba(0, 0, 0, 0.25) 0 1px, transparent 1px 9px);
}

.rust-texture::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 20% 30%, rgba(183, 65, 14, 0.07), transparent 45%),
                radial-gradient(circle at 80% 70%, rgba(183, 65, 14, 0.05), transparent 40%);
}

/* 雨效：两层细斜线缓慢下落 */
.rain-effect {
    position: relative;
}

.rain-effect::before {
    content: '';
    position: fixed;
    inset: -50% 0 0 0;
    z-index: 40;
    pointer-events: none;
    opacity: 0.35;
    background-image:
        repeating-linear-gradient(72deg,
            rgba(200, 220, 235, 0.10) 0 1px,
            transparent 1px 12px);
    background-size: 220px 220px;
    animation: qm-rain 1.1s linear infinite;
}

.rain-effect::after {
    content: '';
    position: fixed;
    inset: -50% 0 0 0;
    z-index: 39;
    pointer-events: none;
    opacity: 0.22;
    background-image:
        repeating-linear-gradient(74deg,
            rgba(220, 235, 245, 0.09) 0 1px,
            transparent 1px 22px);
    background-size: 340px 340px;
    animation: qm-rain 1.9s linear infinite;
}

@keyframes qm-rain {
    from { transform: translate3d(0, -220px, 0); }
    to   { transform: translate3d(-40px, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .rain-effect::before,
    .rain-effect::after { animation: none; }
}

/* ------------------------------ 预约表单 ------------------------------ */
/* 邮箱输入框在“已发送验证码”后变为只读，降低视觉权重但仍可读 */
#preorder-email:read-only {
    color: #9ca3af;
    background-color: rgba(10, 10, 10, 0.85);
    cursor: not-allowed;
}

/* 6 位验证码输入：等宽 + 大字距，避免使用 type=number 的上下箭头 */
#preorder-code {
    letter-spacing: 0.5em;
    text-indent: 0.5em;
    font-variant-numeric: tabular-nums;
}

#preorder-code::placeholder {
    letter-spacing: 0.1em;
    text-indent: 0;
}

/* 移动端：避免 iOS 自动放大 */
@media (max-width: 640px) {
    #preorder-email,
    #preorder-code {
        font-size: 16px;
    }
}
