/* === RESET & BASE === */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* === CSS CUSTOM PROPERTIES === */
:root {
    --primary: #5B5EFF;
    --primary-soft: #EEEEFF;
    --accent: #FF5C8D;
    --green: #22C97C;
    --bg: #FFFFFF;
    --bg-soft: #F7F7FC;
    --bg-mid: #F0F0F8;
    --bg-section: #F3F4F6;
    --bg-card: #FFFFFF;
    --text: #1A1A2E;
    --text-mid: #4A4A6A;
    --text-light: #6F6F8E;
    --border: #E8E8F0;
    --nav-bg: rgba(255,255,255,0.92);
    --mobile-menu-bg: rgba(255,255,255,0.97);
    --mockup-bar: #F0F0F5;
    --shadow: 0 4px 24px rgba(91,94,255,0.08);
    --shadow-lg: 0 20px 60px rgba(91,94,255,0.14);
    --radius: 20px;
    --radius-sm: 12px;
    --nav-height: 60px;
}

[data-theme="dark"] {
    --primary: #7B7EFF;
    --primary-soft: #1E1E3F;
    --bg: #0F0F1A;
    --bg-soft: #161625;
    --bg-mid: #1E1E33;
    --bg-section: #141422;
    --bg-card: #1A1A2E;
    --text: #F0F0FF;
    --text-mid: #A0A0C0;
    --text-light: #9090C0;
    --border: #2A2A45;
    --nav-bg: rgba(15,15,26,0.92);
    --mobile-menu-bg: rgba(20,20,40,0.97);
    --mockup-bar: #252540;
    --shadow: 0 4px 24px rgba(91,94,255,0.18);
    --shadow-lg: 0 20px 60px rgba(91,94,255,0.25);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'IranYekanX', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
}

/* === NAVBAR === */
body > nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 10px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 17px;
}

.nav-logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    overflow: hidden;
}

.nav-logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-links a {
    text-decoration: none;
    color: var(--text-mid);
    font-size: 18px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 999px;
    transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active { color: var(--primary); }

.nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, #6B9EFF 0%, var(--primary) 100%);
    color: white !important;
    padding: 10px 20px !important;
    border-radius: 999px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    text-decoration: none;
    transition: all 0.2s !important;
    box-shadow: 0 4px 16px rgba(91,94,255,0.35);
}

.nav-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(91,94,255,0.45);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* === THEME TOGGLE === */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--bg-soft);
    color: var(--text-mid);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.theme-toggle .moon-icon { display: none; }
.theme-toggle .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle .sun-icon { display: none; }
[data-theme="dark"] .theme-toggle .moon-icon { display: block; }

/* === HAMBURGER === */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
}

.hamburger span {
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.25s;
    transform-origin: center;
}

.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* === MOBILE MENU === */
.mobile-menu {
    display: none;
    position: fixed;
    top: calc(var(--nav-height) + 10px);
    left: 12px;
    right: 12px;
    max-height: calc(100dvh - var(--nav-height) - 22px);
    overflow-y: auto;
    z-index: 999;
    background: var(--mobile-menu-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(157,160,175,0.2);
    border-radius: 24px;
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    flex-direction: column;
    gap: 4px;
}

.mobile-menu.open { display: flex; }
.mobile-menu ul { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.mobile-menu ul a {
    display: block;
    padding: 12px 16px;
    color: var(--text-mid);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    border-radius: 12px;
    transition: all 0.2s;
}
.mobile-menu ul a:hover { background: rgba(91,94,255,0.08); color: var(--primary); }
.mobile-menu .nav-cta { margin-top: 8px; justify-content: center; }

/* === TABLET / MOBILE NAV BREAKPOINTS === */
@media (max-width: 900px) {
    .nav-links { display: none; }
    .nav-actions .nav-cta { display: none; }
    .hamburger { display: flex; }
    body > nav { padding: 10px 16px; }
}

@media (max-width: 768px) {
    .theme-toggle { width: 36px; height: 36px; }
}

/* === SHARED TYPOGRAPHY === */
.section-title {
    font-size: clamp(24px, 3.5vw, 36px);
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
}

.section-subtitle {
    font-size: 17px;
    color: var(--text-mid);
}

.detail-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-soft);
    color: var(--primary);
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
}

.post-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-soft);
    color: var(--primary);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    width: fit-content;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-light);
    flex-wrap: wrap;
}

.post-meta span { display: flex; align-items: center; gap: 4px; }

/* === SHARED BUTTONS === */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(180deg, #76A5FF 0%, var(--primary) 100%);
    color: white;
    padding: 14px 32px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 4px 24px rgba(91,94,255,0.35);
    border: none;
    cursor: pointer;
    font-family: 'IranYekanX', sans-serif;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(91,94,255,0.45);
}

/* === SECTION SYSTEM === */
.section-wrap {
    border-radius: 50px;
    margin: 40px 24px;
    padding: 40px 24px;
}
.section-wrap.outer-gray { background: var(--bg-section); }
.section-wrap.outer-white { background: var(--bg); }

.section-inner {
    border-radius: 24px;
    padding: 15px 48px;
    max-width: 1200px;
    margin: 0 auto;
}
.section-inner.inner-white { background: var(--bg); }
.section-inner.inner-gray { background: var(--bg-section); }

@media (max-width: 900px) {
    .section-wrap { border-radius: 40px; margin: 28px 16px; padding: 28px 16px; }
    .section-inner { padding: 28px 24px; }
}

@media (max-width: 768px) {
    .section-wrap { border-radius: 28px; margin: 20px 12px; padding: 20px 12px; }
    .section-inner { padding: 24px 16px; border-radius: 16px; }
}

/* === FOOTER === */
footer {
    background: linear-gradient(180deg, #1a1a2e 0%, #0a0a14 100%);
    border-radius: 36px 36px 0 0;
    padding: 80px 40px 40px;
    color: white;
    position: relative;
    overflow: hidden;
}

.footer-snowflakes {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.footer-snowflake {
    position: absolute;
    color: rgba(255,255,255,0.4);
    font-size: 10px;
    animation: snowfall-footer linear infinite;
}

@keyframes snowfall-footer {
    0% { transform: translateY(-20px) rotate(0deg); opacity: 0.8; }
    100% { transform: translateY(400px) rotate(360deg); opacity: 0; }
}

.footer-snowflake:nth-child(1)  { left: 8%;  animation-duration: 9s;  animation-delay: 0s;   font-size: 8px; }
.footer-snowflake:nth-child(2)  { left: 18%; animation-duration: 7s;  animation-delay: 1.5s; font-size: 12px; }
.footer-snowflake:nth-child(3)  { left: 28%; animation-duration: 10s; animation-delay: 0.3s; font-size: 7px; }
.footer-snowflake:nth-child(4)  { left: 42%; animation-duration: 8s;  animation-delay: 2.2s; font-size: 10px; }
.footer-snowflake:nth-child(5)  { left: 52%; animation-duration: 12s; animation-delay: 0.8s; font-size: 9px; }
.footer-snowflake:nth-child(6)  { left: 62%; animation-duration: 9s;  animation-delay: 1.2s; font-size: 11px; }
.footer-snowflake:nth-child(7)  { left: 72%; animation-duration: 7s;  animation-delay: 0.5s; font-size: 8px; }
.footer-snowflake:nth-child(8)  { left: 82%; animation-duration: 11s; animation-delay: 2.5s; font-size: 10px; }
.footer-snowflake:nth-child(9)  { left: 90%; animation-duration: 8s;  animation-delay: 1.8s; font-size: 9px; }

.footer-content {
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

.footer-top {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 60px;
}

@media (max-width: 900px) {
    footer { padding: 64px 24px 32px; }
    .footer-top { grid-template-columns: 1fr 1fr; gap: 32px; }
}

@media (max-width: 768px) {
    footer { padding: 56px 16px 28px; border-radius: 28px 28px 0 0; }
    .footer-top { grid-template-columns: 1fr; gap: 24px; margin-bottom: 40px; }
    .footer-desc { max-width: none; }
}

.footer-brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.footer-logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    overflow: hidden;
}

.footer-logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.footer-brand-name { font-size: 20px; font-weight: 600; color: white; }
.footer-desc { font-size: 14px; color: rgba(255,255,255,0.5); line-height: 1.8; max-width: 280px; }
.footer-col h4 { font-size: 13px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: rgba(255,255,255,0.65); margin-bottom: 20px; }
.footer-col a { display: block; color: rgba(255,255,255,0.6); text-decoration: none; font-size: 14px; margin-bottom: 12px; transition: color 0.2s; }
.footer-col a:hover { color: white; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.08); padding-top: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.footer-copy { font-size: 12px; color: rgba(255,255,255,0.4); text-align: center; }
.footer-tagline { font-size: 13px; color: rgba(255,255,255,0.6); text-align: center; }

.author-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 15px;
}

.author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* === ANIMATIONS (default: no animation, overridden in home.css) === */
.anim { opacity: 1; transform: none; }

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

/* === ACCESSIBILITY === */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -40px;
    right: 0;
    background: var(--primary);
    color: white;
    padding: 8px 24px;
    border-radius: 0 0 12px 12px;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    z-index: 9999;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .snowfall-container, .particle-bg { display: none !important; }
}
