/*
Theme Name: Delirium Escape Room
Theme URI: https://deliriumardabil.ir
Author: Delirium Team
Version: 2.5.0
Description: پوسته اختصاصی اتاق فرار دلیریوم (سندروم سایه) با قابلیت تقویم شمسی، رزرو لحظه‌ای، افکت نور فرابنفش، طراحی مینیمال و فونت‌های شخصی‌سازی شده.
Text Domain: delirium
*/

/* ==========================================================================
   ۱. معرفی فونت‌های اختصاصی
   ========================================================================== */
@font-face {
    font-family: 'MainFont';
    src: url('MainFont.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TitleFont';
    src: url('TitleFont.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'WallFont';
    src: url('WallFont.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TypedFont';
    src: url('TypedFont.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ==========================================================================
   ۲. متغیرها و تنظیمات پایه
   ========================================================================== */
:root {
    --primary-dark: #050506;    
    --primary-darker: #020203;
    --text-light: #d1d5db;
    --text-muted: #6b7280;
    --accent-color: #990000; /* Crimson Red */
    --accent-bright: #ff3333;
    --accent-dim: #4a0000;
    --transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-cinematic: cubic-bezier(0.16, 0.84, 0.44, 1);
    --cursor-x: 50vw;
    --cursor-y: 50vh;
}

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

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

html { 
    scroll-behavior: smooth; 
}

body {
    background-color: var(--primary-dark);
    color: var(--text-light);
    font-family: 'MainFont', 'Tahoma', sans-serif; /* فونت متن‌های اصلی */
    line-height: 1.8;
    direction: rtl;
    overflow-x: hidden;
}

/* ==========================================================================
   ۳. هدر، کادربندی شیشه‌ای (Glassmorphism) و لوگو
   ========================================================================== */
.delirium-header {
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(4, 4, 5, 0.75); 
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(153, 0, 0, 0.25); 
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5); 
    transition: var(--transition);
}

.site-logo-container a.brand-link {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
}

.brand-logo {
    width: 55px; 
    height: auto;
    filter: drop-shadow(0 0 10px rgba(153, 0, 0, 0.6)); 
    transition: var(--transition);
}

.brand-title {
    color: var(--accent-color); 
    font-family: 'TitleFont', sans-serif; 
    font-size: 1.4rem;
    font-weight: 800; 
    letter-spacing: 1px;
    margin: 0;
    text-shadow: 0 0 15px rgba(153, 0, 0, 0.5); 
    transition: var(--transition);
}

.site-logo-container a.brand-link:hover .brand-logo {
    filter: drop-shadow(0 0 20px rgba(255, 51, 51, 0.9));
    transform: scale(1.05); 
}

.site-logo-container a.brand-link:hover .brand-title {
    color: #ff3333; 
    text-shadow: 0 0 20px rgba(255, 51, 51, 0.8), 0 0 35px rgba(255, 51, 51, 0.5);
}

.delirium-header.is-scrolled {
    padding: 10px 5%;
    background: rgba(3, 3, 4, 0.92);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

/* ==========================================================================
   ۳ب. بافت گرین سینمایی، نوار پیشرفت اسکرول و منوی موبایل
   ========================================================================== */
.grain-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.05;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* خطوط اسکن نوار (Scanlines) و وینیت سینمایی دائمی */
.vhs-scanlines {
    position: fixed;
    inset: 0;
    z-index: 9997;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.18) 0px,
        rgba(0, 0, 0, 0.18) 1px,
        transparent 1px,
        transparent 3px
    );
    opacity: 0.35;
    animation: scanline-roll 9s linear infinite;
}

@keyframes scanline-roll {
    from { background-position-y: 0; }
    to { background-position-y: 300px; }
}

.vhs-vignette {
    position: fixed;
    inset: 0;
    z-index: 9996;
    pointer-events: none;
    background:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.55) 0%, transparent 8%, transparent 92%, rgba(0, 0, 0, 0.55) 100%),
        radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* خطای ردیابی نوار (Tracking Glitch) که به‌صورت دوره‌ای عبور می‌کند */
.tracking-glitch {
    position: fixed;
    left: 0;
    right: 0;
    top: -15vh;
    height: 12vh;
    pointer-events: none;
    z-index: 9990;
    background: linear-gradient(to bottom,
        transparent,
        rgba(255, 255, 255, 0.05) 35%,
        rgba(153, 0, 0, 0.14) 50%,
        rgba(255, 255, 255, 0.05) 65%,
        transparent);
    opacity: 0;
    mix-blend-mode: overlay;
}

.tracking-glitch.is-active {
    animation: tracking-sweep 0.45s linear;
}

@keyframes tracking-sweep {
    0%   { top: -15vh; opacity: 0; }
    8%   { opacity: 0.9; }
    50%  { opacity: 0.9; transform: translateX(-6px); }
    52%  { transform: translateX(4px); }
    92%  { opacity: 0.9; }
    100% { top: 115vh; opacity: 0; }
}

/* نماد مبهم گوشه صفحه: فقط یک کد/نشانه انتزاعی، بدون حس دوربین ضبط */
.case-mark {
    position: fixed;
    bottom: 24px;
    right: 5%;
    z-index: 98;
    font-family: 'WallFont', monospace;
    font-size: 0.68rem;
    letter-spacing: 2px;
    color: rgba(153, 0, 0, 0.4);
    pointer-events: none;
    direction: ltr;
    transition: opacity 0.12s linear, color 0.12s linear;
}

.case-mark.is-flicker {
    opacity: 0.15;
    color: rgba(255, 51, 51, 0.6);
}

@media (max-width: 860px) {
    .case-mark { bottom: 98px; right: 6%; font-size: 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
    .vhs-scanlines { animation: none; }
}

/* صفحه لودینگ کوتاه، بدون پیغام، فقط یک نماد ساده در حال تنفس */
.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 10010;
    background: var(--primary-darker);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.7s ease;
}

.loading-screen.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-glyph {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(153, 0, 0, 0.5);
    transform: rotate(45deg);
    animation: loading-pulse 1.4s ease-in-out infinite;
}

@keyframes loading-pulse {
    0%, 100% { opacity: 0.3; transform: rotate(45deg) scale(0.85); }
    50% { opacity: 1; transform: rotate(45deg) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .loading-glyph { animation: none; opacity: 0.8; }
}

/* پرده تیره پشت منوی موبایل */
.nav-scrim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 104;
}

body.nav-locked .nav-scrim {
    opacity: 1;
    pointer-events: auto;
}

.scroll-progress {
    position: fixed;
    top: 0;
    right: 0;
    height: 2px;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-dim), var(--accent-color), var(--accent-bright));
    z-index: 10001;
    transition: width 0.12s linear;
    box-shadow: 0 0 10px rgba(255, 51, 51, 0.6);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    background: transparent;
    border: 1px solid rgba(153, 0, 0, 0.35);
    cursor: pointer;
    z-index: 110;
    position: relative;
}

.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-light);
    transition: var(--transition);
}

.nav-toggle.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-active span:nth-child(2) { opacity: 0; }
.nav-toggle.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.main-navigation ul {
    display: flex;
    gap: 32px;
    list-style: none;
}

.main-navigation a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    position: relative;
    transition: var(--transition);
}

.main-navigation a::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: -6px;
    width: 0;
    height: 1px;
    background: var(--accent-color);
    transition: var(--transition);
}

.main-navigation a:hover { color: var(--accent-bright); }
.main-navigation a:hover::after { width: 100%; }

body.nav-locked { overflow: hidden; }

@media (max-width: 860px) {
    .nav-toggle { display: flex; }

    .main-navigation {
        position: fixed;
        top: 0;
        left: 0;
        right: auto;
        width: min(80vw, 320px);
        height: 100vh;
        background: rgba(3, 3, 4, 0.98);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-right: 1px solid rgba(153, 0, 0, 0.25);
        transform: translateX(-100%);
        transition: transform 0.45s var(--ease-cinematic);
        display: flex;
        align-items: center;
        padding-top: 110px;
        z-index: 105;
    }

    .main-navigation.is-open { transform: translateX(0); }

    .main-navigation ul {
        flex-direction: column;
        gap: 28px;
        width: 100%;
        padding: 0 40px;
    }

    .main-navigation ul li {
        opacity: 0;
        transform: translateX(-16px);
        transition: opacity 0.4s ease, transform 0.4s ease;
    }

    .main-navigation.is-open ul li {
        opacity: 1;
        transform: translateX(0);
    }

    .main-navigation.is-open ul li:nth-child(1) { transition-delay: 0.08s; }
    .main-navigation.is-open ul li:nth-child(2) { transition-delay: 0.13s; }
    .main-navigation.is-open ul li:nth-child(3) { transition-delay: 0.18s; }
    .main-navigation.is-open ul li:nth-child(4) { transition-delay: 0.23s; }
    .main-navigation.is-open ul li:nth-child(5) { transition-delay: 0.28s; }
    .main-navigation.is-open ul li:nth-child(6) { transition-delay: 0.33s; }

    .main-navigation a { font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .main-navigation ul li { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ==========================================================================
   ۴. افکت‌های ویژه (نور فرابنفش و نوشته‌های مخفی)
   ========================================================================== */
#flashlight-overlay {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh;
    pointer-events: none; 
    z-index: 40;
    background: radial-gradient(circle 200px at var(--cursor-x) var(--cursor-y), rgba(153, 0, 0, 0.15) 0%, rgba(4, 4, 5, 0.96) 70%, rgba(5, 5, 6, 1) 100%);
}

#uv-layer {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh;
    pointer-events: none; 
    z-index: 45;
    overflow: hidden;
    -webkit-mask-image: radial-gradient(circle 140px at var(--cursor-x) var(--cursor-y), black 20%, transparent 100%);
    mask-image: radial-gradient(circle 140px at var(--cursor-x) var(--cursor-y), black 20%, transparent 100%);
}

.uv-text {
    position: absolute; 
    color: #ff3333; 
    font-family: 'WallFont', monospace; 
    /* سایز نوشته‌های دیوار بزرگ‌تر شد (حداقل 1.2rem و حداکثر 1.8rem) */
    font-size: clamp(1.2rem, 3.5vw, 1.8rem); 
    text-shadow: 0 0 5px rgba(255, 51, 51, 0.6), 0 0 15px rgba(255, 51, 51, 0.3); 
    white-space: normal; 
    line-height: 1.6;
    text-align: center;
    transform-origin: center center;
    pointer-events: none;
}

/* ==========================================================================
   ۵. هیرو سکشن (بخش ابتدایی) و دیالوگ راوی
   ========================================================================== */
.psycho-hero, .booking-section { 
    position: relative; 
    z-index: 60; 
}

.psycho-hero {
    height: 100vh; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: flex-start; 
    padding: 0 10%;
}

.glitch-wrapper {
    animation: hero-enter 1.3s var(--ease-cinematic) both;
    animation-delay: 0.2s;
}

@keyframes hero-enter {
    0% { opacity: 0; transform: translateY(36px); filter: blur(12px); }
    60% { filter: blur(0); }
    100% { opacity: 1; transform: translateY(0); }
}

.glitch { 
    position: relative;
    font-family: 'TitleFont', sans-serif; 
    font-size: clamp(2.5rem, 6vw, 4.5rem); 
    color: var(--text-light); 
    letter-spacing: 2px; 
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-dark);
    overflow: hidden;
    direction: ltr;
    text-align: right;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--accent-bright);
    animation: glitch-anim-1 4.5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: 2px 0 #2b7a99, -1px 0 var(--accent-color);
    animation: glitch-anim-2 3.2s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
    0%   { clip-path: inset(8% 0 84% 0); }
    20%  { clip-path: inset(72% 0 4% 0); }
    40%  { clip-path: inset(28% 0 58% 0); }
    60%  { clip-path: inset(88% 0 1% 0); }
    80%  { clip-path: inset(14% 0 72% 0); }
    100% { clip-path: inset(52% 0 30% 0); }
}

@keyframes glitch-anim-2 {
    0%   { clip-path: inset(58% 0 22% 0); }
    25%  { clip-path: inset(9% 0 82% 0); }
    50%  { clip-path: inset(44% 0 41% 0); }
    75%  { clip-path: inset(76% 0 6% 0); }
    100% { clip-path: inset(19% 0 66% 0); }
}

@media (prefers-reduced-motion: reduce) {
    .glitch::before, .glitch::after { display: none; }
}

.sub-project { 
    display: block; 
    font-family: 'MainFont', sans-serif;
    font-size: 0.95rem; 
    color: var(--text-muted); 
    margin-top: 5px;
    opacity: 0;
    animation: fade-up-simple 0.9s var(--ease-cinematic) both;
    animation-delay: 0.7s;
}

@keyframes fade-up-simple {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.scroll-cue {
    position: absolute;
    bottom: 34px;
    right: 10%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.72rem;
    letter-spacing: 3px;
    opacity: 0;
    animation: fade-up-simple 1s var(--ease-cinematic) both;
    animation-delay: 1.6s;
}

.scroll-cue .cue-line {
    width: 1px;
    height: 42px;
    background: linear-gradient(to bottom, var(--accent-color), transparent);
    animation: cue-pulse 2.2s ease-in-out infinite;
}

@keyframes cue-pulse {
    0%, 100% { transform: scaleY(0.35); opacity: 0.35; }
    50% { transform: scaleY(1); opacity: 1; }
}

.doctor-narration-container { 
    max-width: 750px; /* عرض باکس دیالوگ کمی بیشتر شد تا با فونت بزرگتر هماهنگ شود */
    min-height: 140px; 
    margin: 1.5rem 0; 
}

#typed-text { 
    font-family: 'TypedFont', monospace; 
    /* سایز دیالوگ تایپ شونده بزرگ‌تر شد (حداقل 1.15rem و حداکثر 1.4rem) */
    font-size: clamp(1.15rem, 2.5vw, 1.4rem); 
    color: #8a94a6; 
    line-height: 2.3; 
    display: inline; 
}

.cursor { 
    animation: blink 0.8s infinite; 
    color: var(--accent-color); 
    font-weight: bold; 
    /* سایز نشانگر تایپ هم‌اندازه با فونت جدید شد */
    font-size: clamp(1.15rem, 2.5vw, 1.4rem); 
}

@keyframes blink { 
    50% { opacity: 0; } 
}

/* ==========================================================================
   ۶. فرم رزرو (ساختار کلی و فیلدها)
   ========================================================================== */
.booking-section {
    padding: 70px 24px; 
    background-color: rgba(4, 4, 5, 0.98); 
    border-top: 1px dashed rgba(153, 0, 0, 0.2);
}

.form-container {
    max-width: 500px; 
    margin: 0 auto; 
    background: rgba(15, 15, 18, 0.8); 
    padding: 42px 36px; 
    border: 1px solid rgba(153, 0, 0, 0.15);
}

#step-1, #step-2 { 
    transition: opacity 0.4s ease; 
}

.form-title { 
    font-family: 'TitleFont', sans-serif; 
    color: var(--accent-color); 
    text-align: center; 
    font-size: 1.5rem; 
    margin-bottom: 12px; 
}

.form-desc { 
    font-family: 'MainFont', sans-serif;
    color: var(--text-muted); 
    text-align: center; 
    font-size: 0.9rem; 
    margin-bottom: 35px; 
}

.input-group { 
    margin-bottom: 25px; 
}

.input-group label { 
    display: block; 
    font-family: 'MainFont', sans-serif;
    color: #7b8495; 
    margin-bottom: 8px; 
    font-size: 0.9rem; 
}

.input-group input[type="text"], 
.input-group input[type="tel"], 
.input-group select {
    width: 100%; 
    background: rgba(0, 0, 0, 0.5); 
    border: 1px solid rgba(255, 255, 255, 0.05); 
    padding: 16px; 
    color: var(--text-light); 
    font-size: 1rem; 
    font-family: inherit; 
}

.input-group input:focus, 
.input-group select:focus { 
    outline: none; 
    border-color: var(--accent-color); 
}

.file-upload-group input[type="file"] {
    background: rgba(0, 0, 0, 0.3);
    border: 1px dashed rgba(153, 0, 0, 0.4);
    color: var(--accent-color);
    cursor: pointer;
    width: 100%;
}

/* ==========================================================================
   ۷. تقویم اسلایدی شمسی و شبکه‌ی سانس‌ها
   ========================================================================== */
.calendar-wrapper, .slots-wrapper { 
    margin-bottom: 25px; 
}

.calendar-wrapper label, .slots-wrapper label { 
    display: block; 
    color: #7b8495; 
    margin-bottom: 12px; 
    font-size: 0.95rem; 
}

.days-slider { 
    display: flex; 
    overflow-x: auto; 
    gap: 12px; 
    padding-bottom: 10px; 
    scrollbar-width: thin; 
    scrollbar-color: var(--accent-color) rgba(0,0,0,0.3); 
}

.days-slider::-webkit-scrollbar { 
    height: 4px; 
}

.days-slider::-webkit-scrollbar-thumb { 
    background: var(--accent-color); 
    border-radius: 2px;
}

.day-btn {
    flex: 0 0 auto; 
    width: 95px; 
    background: rgba(0, 0, 0, 0.6); 
    border: 1px solid rgba(255, 255, 255, 0.08); 
    color: var(--text-muted); 
    padding: 12px 5px; 
    text-align: center; 
    font-size: 0.95rem; 
    font-family: inherit; 
    cursor: pointer; 
    transition: var(--transition); 
    line-height: 1.4;
}

.day-btn span { 
    font-size: 0.8rem; 
    opacity: 0.7; 
}

.day-btn:hover { 
    border-color: rgba(153, 0, 0, 0.5); 
    color: var(--text-light); 
}

.day-btn.active { 
    background: rgba(153, 0, 0, 0.15); 
    border-color: var(--accent-color); 
    color: var(--accent-color); 
}

.time-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 12px; 
}

.slot-btn {
    background: rgba(0, 0, 0, 0.5); 
    border: 1px solid rgba(255, 255, 255, 0.08); 
    color: var(--text-light); 
    padding: 14px 0; 
    font-size: 1.1rem; 
    font-family: inherit; 
    font-weight: bold; 
    cursor: pointer; 
    transition: var(--transition); 
    text-align: center;
}

.slot-btn:hover:not(.booked) { 
    border-color: var(--accent-color); 
}

.slot-btn.active { 
    background: var(--accent-color); 
    color: var(--primary-dark); 
}

.slot-btn.booked {
    color: #4a4d55; 
    text-decoration: line-through; 
    text-decoration-color: #8c1c1c; 
    text-decoration-thickness: 2px;
    background: rgba(20, 5, 5, 0.4); 
    border-color: rgba(140, 28, 28, 0.2); 
    cursor: not-allowed; 
    pointer-events: none;
}

/* ==========================================================================
   ۸. بخش پرداخت و دکمه‌ها
   ========================================================================== */
.payment-box { 
    background: rgba(0, 0, 0, 0.4); 
    border: 1px solid rgba(153, 0, 0, 0.3); 
    padding: 20px; 
    text-align: center; 
    margin-bottom: 30px; 
}

.card-number { 
    font-family: 'MainFont', sans-serif;
    font-size: 1.4rem; 
    letter-spacing: 3px; 
    color: var(--text-light); 
    margin-bottom: 5px; 
    direction: ltr; 
}

.card-name { 
    font-size: 0.85rem; 
    color: #7b8495; 
    margin-bottom: 15px; 
}

.copy-btn { 
    background: rgba(255, 255, 255, 0.05); 
    color: var(--text-light); 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    padding: 8px 20px; 
    cursor: pointer; 
    transition: 0.2s; 
    font-family: inherit;
}

.submit-btn { 
    width: 100%; 
    padding: 18px; 
    background: var(--accent-color); 
    color: var(--primary-dark); 
    border: none; 
    font-size: 1.1rem; 
    font-weight: bold; 
    cursor: pointer; 
    transition: var(--transition); 
    margin-bottom: 10px; 
    font-family: inherit; 
}

.final-submit { 
    background: #5a0000; 
    color: #fff; 
}

.final-submit:hover { 
    background: #800000; 
}

.final-submit:disabled {
    background: #330909;
    color: #888;
    cursor: not-allowed;
}

.back-btn { 
    width: 100%; 
    padding: 15px; 
    background: transparent; 
    color: var(--text-muted); 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    cursor: pointer; 
    font-family: inherit; 
}

/* ==========================================================================
   ۸ب. سیستم انیمیشن اسکرول (Reveal on Scroll)
   ========================================================================== */
[data-reveal] {
    opacity: 0;
    transform: translateY(46px);
    filter: blur(6px);
    transition: opacity 1s var(--ease-cinematic), transform 1s var(--ease-cinematic), filter 1s var(--ease-cinematic);
    transition-delay: var(--reveal-delay, 0s);
    will-change: transform, opacity, filter;
}

[data-reveal].is-visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

[data-reveal="scale"] { transform: translateY(0) scale(0.94); }
[data-reveal="scale"].is-visible { transform: translateY(0) scale(1); }

[data-reveal="right"] { transform: translateX(70px); }
[data-reveal="right"].is-visible { transform: translateX(0); }

[data-reveal="left"] { transform: translateX(-70px); }
[data-reveal="left"].is-visible { transform: translateX(0); }

/* شکست دراماتیک هنگام ورود عناصر: طیف رنگی و لرزش کوتاه، سپس آرام شدن */
[data-reveal].is-glitching {
    animation: reveal-glitch-burst 0.55s steps(1, end);
}

@keyframes reveal-glitch-burst {
    0%   { text-shadow: none; }
    15%  { transform: translate3d(-5px, 2px, 0) skewX(2deg); text-shadow: 3px 0 rgba(255, 51, 51, 0.65), -3px 0 rgba(43, 122, 153, 0.5); }
    30%  { transform: translate3d(4px, -2px, 0) skewX(-1.5deg); text-shadow: -3px 0 rgba(255, 51, 51, 0.6), 3px 0 rgba(43, 122, 153, 0.45); }
    45%  { transform: translate3d(-3px, 1px, 0) skewX(1deg); text-shadow: 2px 0 rgba(255, 51, 51, 0.5); }
    60%  { transform: translate3d(2px, -1px, 0); text-shadow: -2px 0 rgba(43, 122, 153, 0.4); }
    80%  { transform: translate3d(-1px, 0, 0); text-shadow: 1px 0 rgba(255, 51, 51, 0.25); }
    100% { transform: translate3d(0, 0, 0) skewX(0deg); text-shadow: none; }
}

/* فلاش استاتیک تمام‌صفحه، هم‌زمان با لحظات دراماتیک اسکرول */
.static-flash {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    opacity: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='90' height='90'><filter id='s'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/></filter><rect width='100%25' height='100%25' filter='url(%23s)'/></svg>");
    mix-blend-mode: overlay;
}

.static-flash.is-flashing {
    animation: static-flash-kf 0.34s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes static-flash-kf {
    0%   { opacity: 0; }
    10%  { opacity: 0.6; }
    100% { opacity: 0; }
}

/* لرزش کوتاه صفحه هم‌زمان با فلاش، حس ضربه و شوک، با فرود نرم */
body.tape-shake { animation: tape-shake-kf 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97); }

@keyframes tape-shake-kf {
    0%   { transform: translate(0, 0); }
    12%  { transform: translate(-4px, 2px); }
    28%  { transform: translate(3px, -2px); }
    46%  { transform: translate(-2px, 1px); }
    64%  { transform: translate(1px, -1px); }
    82%  { transform: translate(-1px, 0.5px); }
    100% { transform: translate(0, 0); }
}

@media (prefers-reduced-motion: reduce) {
    [data-reveal] { opacity: 1 !important; transform: none !important; filter: none !important; }
    [data-reveal].is-glitching { animation: none; }
    .static-flash.is-flashing { animation: none; opacity: 0 !important; }
    body.tape-shake { animation: none; }
}

/* خط جداکننده متحرک بین بخش‌ها، شبیه به خط اسکن نوارهای VHS */
.section-divider {
    position: relative;
    height: 40px;
    overflow: hidden;
    z-index: 61;
}

.section-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: repeating-linear-gradient(90deg, rgba(153, 0, 0, 0.55) 0 12px, transparent 12px 26px);
    animation: scanline-drift 7s linear infinite;
}

@keyframes scanline-drift {
    to { background-position-x: 38px; }
}

/* ==========================================================================
   ۸ج. روایت پروژه (Story Section)
   ========================================================================== */
.story-section {
    position: relative;
    z-index: 60;
    padding: 80px 8%;
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 50px;
    align-items: start;
    border-top: 1px dashed rgba(153, 0, 0, 0.2);
}

.story-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-family: 'TitleFont', sans-serif;
    color: var(--accent-color);
    letter-spacing: 7px;
    font-size: 0.9rem;
    opacity: 0.85;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid rgba(153, 0, 0, 0.25);
    padding-left: 20px;
}

.story-body { max-width: 720px; }

.story-body h2 {
    font-family: 'TitleFont', sans-serif;
    font-size: clamp(1.7rem, 4vw, 2.5rem);
    color: var(--text-light);
    font-weight: 300;
    margin-bottom: 26px;
    line-height: 1.5;
}

.story-body h2 span { color: var(--accent-color); }

.story-body p {
    font-family: 'MainFont', sans-serif;
    color: var(--text-muted);
    font-size: 1.02rem;
    line-height: 2.1;
    margin-bottom: 18px;
}

.story-stats {
    display: flex;
    gap: 44px;
    margin-top: 44px;
    flex-wrap: wrap;
}

.story-stat b {
    display: block;
    font-family: 'TitleFont', sans-serif;
    font-size: 2.3rem;
    color: var(--accent-color);
    text-shadow: 0 0 20px rgba(153, 0, 0, 0.35);
}

.story-stat span {
    font-family: 'MainFont', sans-serif;
    font-size: 0.85rem;
    color: var(--text-muted);
}

@media (max-width: 860px) {
    .story-section {
        grid-template-columns: 1fr;
        padding: 90px 6%;
        gap: 26px;
    }
    .story-label {
        writing-mode: horizontal-tb;
        border-left: none;
        border-bottom: 1px solid rgba(153, 0, 0, 0.25);
        padding: 0 0 16px 0;
        justify-content: flex-start;
    }
}

/* ==========================================================================
   ۸د. شبکه‌ی هشت پایان (Endings Grid)
   ========================================================================== */
.endings-section {
    position: relative;
    z-index: 60;
    padding: 60px 8% 90px;
    background: radial-gradient(circle at 50% 0%, rgba(153, 0, 0, 0.06), transparent 60%);
}

.endings-intro {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 44px;
}

.endings-intro .eyebrow {
    display: block;
    color: var(--accent-color);
    letter-spacing: 4px;
    font-size: 0.78rem;
    text-transform: uppercase;
    margin-bottom: 14px;
    font-family: 'MainFont', sans-serif;
}

.endings-intro h2 {
    font-family: 'TitleFont', sans-serif;
    font-size: clamp(1.7rem, 4vw, 2.3rem);
    font-weight: 300;
    color: var(--text-light);
    margin-bottom: 16px;
}

.endings-intro p {
    font-family: 'MainFont', sans-serif;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.9;
}

.endings-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    background: rgba(153, 0, 0, 0.15);
    border: 1px solid rgba(153, 0, 0, 0.15);
    max-width: 1100px;
    margin: 0 auto;
}

.ending-card {
    background: rgba(4, 4, 5, 0.96);
    padding: 38px 18px;
    text-align: center;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s var(--ease-cinematic), transform 0.6s var(--ease-cinematic), background 0.4s ease;
}

.endings-grid.is-visible .ending-card { opacity: 1; transform: translateY(0); }
.endings-grid.is-visible .ending-card:nth-child(1) { transition-delay: 0.04s; }
.endings-grid.is-visible .ending-card:nth-child(2) { transition-delay: 0.09s; }
.endings-grid.is-visible .ending-card:nth-child(3) { transition-delay: 0.14s; }
.endings-grid.is-visible .ending-card:nth-child(4) { transition-delay: 0.19s; }
.endings-grid.is-visible .ending-card:nth-child(5) { transition-delay: 0.24s; }
.endings-grid.is-visible .ending-card:nth-child(6) { transition-delay: 0.29s; }
.endings-grid.is-visible .ending-card:nth-child(7) { transition-delay: 0.34s; }
.endings-grid.is-visible .ending-card:nth-child(8) { transition-delay: 0.39s; }

.ending-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(153, 0, 0, 0.2), transparent 70%);
    opacity: 0;
    transition: var(--transition);
}

.ending-card:hover { background: rgba(20, 4, 4, 0.92); }
.ending-card:hover::before { opacity: 1; }

.ending-number {
    display: block;
    font-family: 'TitleFont', sans-serif;
    font-size: 2.1rem;
    color: rgba(153, 0, 0, 0.5);
    margin-bottom: 12px;
    transition: var(--transition);
}

.ending-card:hover .ending-number {
    color: var(--accent-bright);
    text-shadow: 0 0 20px rgba(255, 51, 51, 0.6);
}

.ending-label {
    font-family: 'WallFont', monospace;
    font-size: 0.82rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    line-height: 1.6;
}

.ending-card.locked .ending-label {
    filter: blur(3px);
    user-select: none;
    transition: filter 0.4s ease;
}

.ending-card.locked:hover .ending-label { filter: blur(0.5px); }

.ending-card.final {
    border: 1px solid rgba(153, 0, 0, 0.45);
    background: rgba(20, 2, 2, 0.6);
}

.ending-card.final .ending-number { color: var(--accent-color); }
.ending-card.final .ending-label { color: #c98a8a; filter: none; }

@media (max-width: 860px) {
    .endings-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 420px) {
    .ending-card { padding: 28px 10px; }
    .ending-number { font-size: 1.7rem; }
}

/* ==========================================================================
   ۹. استایل فوتر (بیرون آمده از لایه تاریکی)
   ========================================================================== */
.site-footer {
    position: relative; 
    z-index: 100; 
    border-top: 1px solid rgba(153, 0, 0, 0.1); 
    padding: 40px 20px; 
    background-color: var(--primary-dark);
}

.site-footer { position: relative; }

.footer-tagline {
    font-family: 'WallFont', monospace;
    color: var(--accent-color);
    font-size: 0.95rem;
    opacity: 0.75;
    letter-spacing: 0.5px;
}

.back-to-top {
    position: fixed;
    bottom: 26px;
    left: 26px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(4, 4, 5, 0.85);
    border: 1px solid rgba(153, 0, 0, 0.4);
    color: var(--accent-color);
    font-size: 1.1rem;
    cursor: pointer;
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: var(--transition);
    backdrop-filter: blur(8px);
}

.back-to-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--accent-color);
    color: var(--primary-dark);
    box-shadow: 0 0 20px rgba(153, 0, 0, 0.4);
}

.footer-content {
    max-width: 600px; 
    margin: 0 auto; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 20px;
}

.footer-links {
    display: flex; 
    gap: 40px; 
    align-items: center;
}

.footer-link {
    font-family: 'MainFont', sans-serif;
    color: var(--text-light); 
    text-decoration: none; 
    font-size: 1.1rem; 
    transition: var(--transition); 
    display: flex; 
    align-items: center; 
    gap: 8px;
}

.footer-link:hover {
    color: var(--accent-color);
}

.footer-icon {
    font-size: 1.3rem;
}

.footer-copyright {
    font-family: 'MainFont', sans-serif;
    color: var(--text-muted); 
    font-size: 0.85rem; 
    margin: 0; 
    opacity: 0.7;
}

/* ==========================================================================
   ۱۰. پاپ‌آپ ترسناک رها شدن صفحه (Idle)
   ========================================================================== */
#idle-message {
    position: fixed; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    background: rgba(20, 5, 5, 0.97); 
    color: #e5e7eb; 
    font-family: 'MainFont', sans-serif;
    padding: 35px 45px; 
    z-index: 10000; 
    opacity: 0; 
    pointer-events: none; 
    transition: opacity 0.8s; 
    border: 1px solid #990000; 
    max-width: 90%; 
    width: 460px; 
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9); 
    text-align: justify;
}

.hidden { 
    display: none; 
}

/* ==========================================================================
   ۱۱. طراحی واکنش‌گرا (Responsive)
   ========================================================================== */

/* تبلت و صفحه‌های میانی */
@media (max-width: 1024px) {
    .psycho-hero { padding: 0 6%; }
    .story-section { padding: 110px 6%; }
    .endings-section { padding: 80px 6% 110px; }
}

@media (max-width: 860px) {
    .delirium-header {
        justify-content: space-between;
        padding: 14px 5%;
        background: rgba(4, 4, 5, 0.9);
    }
}

@media (max-width: 768px) {
    .brand-logo { 
        width: 45px; 
    }

    .brand-title { 
        font-size: 1.25rem; 
    }

    .psycho-hero {
        padding: 0 5%;
        align-items: flex-start;
    }

    .scroll-cue { right: 5%; }

    .doctor-narration-container {
        min-height: 200px; /* تنظیم فضای موبایل برای فونت بزرگتر دیالوگ */
    }

    .form-container { 
        padding: 35px 20px; 
        border: none;
        border-top: 1px solid rgba(153, 0, 0, 0.15);
        border-bottom: 1px solid rgba(153, 0, 0, 0.15);
    }
    
    .card-number {
        font-size: 1.2rem;
    }

    .footer-links {
        gap: 20px; 
    }

    .story-stats { gap: 34px; }
    .back-to-top { width: 40px; height: 40px; bottom: 18px; left: 18px; font-size: 1rem; }
}

/* موبایل کوچک */
@media (max-width: 480px) {
    .psycho-hero { height: auto; min-height: 100vh; padding: 140px 6% 80px; }
    .glitch { font-size: clamp(2rem, 9vw, 2.8rem); }
    .form-container { padding: 28px 16px; }
    .time-grid { grid-template-columns: repeat(2, 1fr); }
    .story-body h2 { font-size: 1.5rem; }
    .endings-intro h2 { font-size: 1.5rem; }
    .footer-links { flex-direction: column; gap: 16px; }
}

/* موبایل با جهت افقی (لندسکیپ) */
@media (max-width: 900px) and (orientation: landscape) {
    .psycho-hero { height: auto; padding: 130px 6% 60px; }
    .scroll-cue { display: none; }
}
