:root {
    --bg-primary: #1a1612;
    --bg-secondary: #24201b;
    --text-primary: #f5e6d3;
    --text-secondary: #c4b49e;
    --accent: #d49a5a;
    --accent-hover: #b87d3b;
    --card-bg: rgba(36, 32, 27, 0.7);
    --header-bg: rgba(26, 22, 18, 0.8);
    --border-color: #4a3e30;
    --scrollbar-thumb: #d49a5a;
    --scrollbar-track: #24201b;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    position: relative;   /* برای اینکه #page-bg نسبت به body قرار گیرد */
}

main {
    flex: 1;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; border: 2px solid var(--scrollbar-track); }
::-webkit-scrollbar-thumb:hover { background: var(--accent-hover); }
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); }

.text-muted { color: var(--text-secondary); }

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
}

.header-glass {
    background: var(--header-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
}

.btn-accent {
    background: var(--accent);
    color: #fff;
    padding: 0.7rem 2.2rem;
    border-radius: 9999px;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
}
.btn-accent:hover { background: var(--accent-hover); transform: translateY(-3px); box-shadow: 0 15px 30px -8px var(--accent); }

.logo-box { background: var(--bg-secondary); border: 2px solid var(--border-color); border-radius: 0.75rem; padding: 0.4rem; display: flex; align-items: center; justify-content: center; }

.glitch-header { font-weight: 900; letter-spacing: -0.5px; position: relative; display: inline-block; animation: text-glitch 1.5s infinite linear alternate-reverse; }
@keyframes text-glitch {
    0% { text-shadow: 2px 0 #f4a261, -2px 0 #e76f51; }
    25% { text-shadow: -2px 0 #f4a261, 2px 0 #e76f51; }
    50% { text-shadow: 2px 0 #e76f51, -2px 0 #f4a261; }
    75% { text-shadow: -1px 0 #e76f51, 1px 0 #f4a261; }
    100% { text-shadow: 2px 0 #f4a261, -2px 0 #e76f51; }
}

.fullscreen-section { position: relative; min-height: 100vh; display: flex; align-items: center; justify-content: center; overflow: hidden; will-change: transform, opacity; background: transparent !important; }
.section-content { position: relative; z-index: 2; text-align: center; max-width: 900px; padding: 2rem; background: transparent !important; }

/* مهم‌ترین تغییر: absolute به‌جای fixed */
.page-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    z-index: -1;
}
.bg-particles, .bg-waves {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#mobileMenu { overflow: hidden; max-height: 0; opacity: 0; transition: max-height 0.5s ease, opacity 0.4s ease, padding 0.3s ease; padding-top: 0; padding-bottom: 0; }
#mobileMenu:not(.hidden) { max-height: 600px; opacity: 1; padding-top: 1rem; padding-bottom: 1rem; }
#menuToggle i { transition: transform 0.3s ease, opacity 0.3s ease; }
#menuToggle.active i::before { content: "\f00d"; font-family: "Font Awesome 6 Free"; font-weight: 900; }

@media (max-width: 1023px) {
    .header-glass { padding: 0.5rem 0; }
    .logo-box { padding: 0.2rem; }
    .glitch-header { font-size: 1.4rem !important; }
    .btn-accent { padding: 0.4rem 1.2rem; font-size: 0.8rem; }
    footer .grid { grid-template-columns: 1fr; text-align: center; }
    footer .flex { justify-content: center; }
    .fullscreen-section { padding: 2rem 1rem; }
    .section-content h1 { font-size: 2.2rem !important; }
    .grid { grid-template-columns: repeat(1, 1fr); }
    .grid-cols-2 { grid-template-columns: repeat(1, 1fr) !important; }
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr) !important; }
    .max-w-7xl { padding-left: 0.5rem; padding-right: 0.5rem; }
    table { font-size: 0.7rem; }
    th, td { padding: 0.5rem !important; }
}

.prose { word-wrap: break-word; overflow-wrap: break-word; white-space: normal; }
.prose blockquote { border-right: 4px solid var(--accent); padding-right: 1rem; color: var(--text-secondary); font-style: italic; }
.prose ul { list-style-type: disc; padding-right: 1.5rem; }
.prose ol { list-style-type: decimal; padding-right: 1.5rem; }
.prose a { color: var(--accent); text-decoration: underline; }
.prose strong { font-weight: bold; }
.prose em { font-style: italic; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-weight: bold; margin-top: 1.5rem; margin-bottom: 0.5rem; }
.prose h1 { font-size: 2rem; }
.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.25rem; }

.ql-syntax { background: #2d2d2d; color: #f8f8f2; border-radius: 0.5rem; padding: 1rem; font-family: 'Courier New', monospace; direction: ltr; text-align: left; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word; }
.ql-align-right { text-align: right; }
.ql-align-center { text-align: center; }
.ql-align-left { text-align: left; }
.ql-editor blockquote { border-right: 4px solid var(--accent); padding-right: 1rem; margin: 0.5rem 0; color: var(--text-secondary); font-style: italic; }
.ql-editor ul { list-style-type: disc; padding-right: 1.5rem; }
.ql-editor ol { list-style-type: decimal; padding-right: 1.5rem; }
.ql-editor a { color: var(--accent); text-decoration: underline; }