/* ==========================================================================
   BARSÄZ — Layout
   هدر، ناوبری، منوی موبایل، فوتر
   ========================================================================== */

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background: var(--bg);
    border-bottom: 1px solid transparent;
    transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease),
        box-shadow var(--dur) var(--ease);
}

.site-header.scrolled {
    border-bottom-color: var(--line);
    box-shadow: var(--shadow-sm);
}

.nav {
    display: flex;
    align-items: center;
    gap: 34px;
    height: var(--header-h);
}

/* ---------- Brand / logo ---------- */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex: none;
    color: var(--ink);
}

.brand-mark {
    width: 34px;
    height: 42px;
    color: currentColor;
}

.brand-img {
    display: block;
    width: auto;
    height: 46px;
    max-width: 210px;
    object-fit: contain;
    /* حذف پس‌زمینهٔ سفید لوگو روی سطوح روشن */
    mix-blend-mode: multiply;
}

/* در صفحهٔ ورود (سطح تیره) لوگو سفید و پس‌زمینه‌اش محو می‌شود */
.auth-visual .brand-img {
    filter: brightness(0) invert(1);
    mix-blend-mode: screen;
}

/* در فوتر، لوگو با رنگ اصلی داخل باکس سفید گرد + هالهٔ سبزِ نرم */
.site-footer .brand-img {
    filter: none;
    mix-blend-mode: normal;
    height: 48px;
    padding: 6px;
    border-radius: var(--radius-sm);
    background: #fff;
    box-shadow: 0 14px 34px -14px color-mix(in srgb, var(--accent-bright) 45%, transparent);
}

.brand-text {
    display: flex;
    flex-direction: column;
    align-items: start;   /* هر دو نام از یک لبه می‌شینند */
    gap: 0;               /* فاصلهٔ نام لاتین با margin-top خودش تنظیم می‌شود */
    line-height: 1.3;
    min-width: 0;         /* اگر عرض فлекс کم بیاید، متن وفق می‌یابد */
}

.brand-text strong,
.brand-text small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 42vw;
}

.brand-text strong {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 900;
    letter-spacing: -.3px;
}

.brand-text small {
    font-family: var(--font-display);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 5px;
    margin-top: 4px;
    color: var(--muted);
    text-transform: uppercase;
    direction: ltr;       /* نام لاتین درست‌خوان و هم‌لبه با نام فارسی */
    text-align: end;
}

/* ---------- Nav links ---------- */
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-links a {
    position: relative;
    padding: 8px 13px;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--ink-2);
    border-radius: var(--radius-pill);
}

.nav-links a::after {
    content: "";
    position: absolute;
    bottom: 3px;
    inset-inline: 13px;
    height: 1.5px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--dur) var(--ease);
}

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

.nav-links a:hover::after,
.nav-links a.active::after {
    transform: scaleX(1);
}

/* ---------- Actions ---------- */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-inline-start: auto;
}

/* ---------- Mobile toggle ---------- */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 50%;
    padding: 0 12px;
}

.nav-toggle span {
    display: block;
    height: 1.8px;
    border-radius: 2px;
    background: var(--ink);
    transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}

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

/* ---------- Mobile drawer ---------- */
.mobile-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    z-index: var(--z-drawer);
    max-height: calc(100vh - var(--header-h));
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px var(--gutter) 34px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease),
        visibility var(--dur) var(--ease);
}

body.nav-open .theme-switcher {
    opacity: 0;
    pointer-events: none;
}

body.modal-open {
    overflow: hidden;
}

body.modal-open .theme-switcher {
    opacity: 0;
    pointer-events: none;
}

.mobile-nav.open {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.mobile-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 4px;
    border-bottom: 1px solid var(--line);
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
}

.mobile-nav a svg {
    width: 16px;
    height: 16px;
    color: var(--muted);
    transform: scaleX(-1);
}

.mobile-nav a.active {
    color: var(--accent);
}

.mobile-nav a.active svg {
    color: var(--accent);
}

.mobile-nav .mobile-cta {
    margin-top: 22px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Footer
   فوترِ زنده: پس‌زمینهٔ چندلایه (هاله‌های سبز)، خطِ نورِ لبهٔ بالا،
   میکرهاور روی لینک‌ها و دکمه‌های تماس و شبکه‌های اجتماعی
   -------------------------------------------------------------------------- */
.site-footer {
    position: relative;
background: var(--dark);
    color: var(--on-dark);
    padding-top: 78px;
}

/* خطِ نورِ لبهٔ بالای فوتر — مثل اشعهٔ نور که از لبهٔ جنگل می‌تابد */
.site-footer::before {
    content: "";
    position: absolute;
    top: 0;
    inset-inline: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 3%, var(--accent-bright) 30% 70%, transparent 97%);
    box-shadow: 0 0 22px 1px color-mix(in srgb, var(--accent-bright) 35%, transparent);
    pointer-events: none;
}

/* محتوا روی پس‌زمینه بنشیند */
.site-footer > .container {
    position: relative;
    z-index: 1;
}

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

.footer-brand .brand {
    color: var(--on-dark);
    margin-bottom: 20px;
}

.footer-brand .brand-text small { color: var(--on-dark-muted); }

.footer-desc {
    max-width: 100%;
    color: var(--on-dark-muted);
    font-size: 14px;
    line-height: 2.05;
    margin-bottom: 26px;
}

.footer-col h4 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--on-dark);
}

/* خطِ سبزِ کوتاه کنار تیتر ستون‌ها */
.footer-col h4::before {
    content: "";
    flex: none;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(to right, var(--accent-bright), transparent);
}

.footer-col ul {
    display: grid;
    gap: 11px;
}

.footer-col a {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    color: var(--on-dark-muted);
    font-size: 14px;
    transition: color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

/* خطِ سبزی که با هاور از کنار لینک می‌روید */
.footer-col a::before {
    content: "";
    flex: none;
    width: 0;
    height: 2px;
    border-radius: 2px;
    background: var(--accent-bright);
    margin-inline-end: 0;
    transition: width .3s var(--ease), margin-inline-end .3s var(--ease);
}

.footer-col a:hover {
    color: var(--accent-bright);
    transform: translateX(-4px);
}

.footer-col a:hover::before {
    width: 15px;
    margin-inline-end: 9px;
}

.contact-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
    color: var(--on-dark-muted);
    font-size: 14px;
    line-height: 1.9;
}

/* آیکن تماس داخل چیپِ گردِ کم‌رنگ */
.contact-ic {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: none;
    margin-top: -2px;
    border: 1px solid color-mix(in srgb, var(--accent-bright) 26%, transparent);
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent-bright) 13%, transparent);
    color: var(--accent-bright);
    transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.contact-row:hover .contact-ic {
    background: color-mix(in srgb, var(--accent-bright) 22%, transparent);
    border-color: color-mix(in srgb, var(--accent-bright) 45%, transparent);
}

.contact-ic svg {
    width: 16px;
    height: 16px;
}

.contact-row a {
    color: inherit;
    word-break: break-word;
    transition: color var(--dur) var(--ease);
}

.contact-row a:hover {
    color: var(--accent-bright);
}

/* دکمه‌های اجتماعی در فوتر: هاورِ درخشان با گرادیان و هاله */
.site-footer .social-btn {
    background: color-mix(in srgb, var(--on-dark) 3%, transparent);
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease),
        border-color var(--dur) var(--ease), transform var(--dur) var(--ease),
        box-shadow var(--dur) var(--ease);
}

.site-footer .social-btn:hover {
    background: linear-gradient(135deg, var(--accent-bright), color-mix(in srgb, var(--accent-bright) 58%, var(--accent)));
    border-color: transparent;
    color: var(--dark);
    transform: translateY(-4px);
    box-shadow: 0 12px 26px -10px color-mix(in srgb, var(--accent-bright) 55%, transparent);
}

.footer-bottom {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    padding: 24px 0;
    color: var(--on-dark-muted);
    font-size: 13px;
}

/* جداکنندهٔ گرادیانیِ نرم به‌جای خطِ یک‌دست */
.footer-bottom::before {
    content: "";
    position: absolute;
    top: 0;
    inset-inline: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--on-dark-line) 18% 82%, transparent);
}

.footer-bottom a:hover { color: var(--accent-bright); }

@media (prefers-reduced-motion: reduce) {
    .footer-col a:hover { transform: none; }
    .site-footer .social-btn:hover { transform: none; }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
    .nav-links { display: none; }
    .nav-toggle { display: flex; }
    .footer-grid {
        grid-template-columns: 1.4fr 1fr 1fr;
        gap: 40px;
    }
    .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    .nav { gap: 16px; }
}

@media (max-width: 720px) {
    :root { --header-h: 72px; }
    .nav { gap: 12px; }
    .brand { gap: 9px; }
    .brand-mark { width: 27px; height: 34px; }
    .brand-img { height: 36px; max-width: 165px; }
    .brand-text strong { font-size: 16px; }
    .brand-text small { letter-spacing: 3.5px; font-size: 8px; }
    .nav-actions { gap: 8px; }
    .nav-actions .nav-cta { display: none; }
    .nav-actions .icon-btn { width: 40px; height: 40px; }
    .nav-actions .icon-btn svg { width: 17px; height: 17px; }
    .nav-toggle { width: 40px; height: 40px; padding: 0 10px; }
    .mobile-nav { padding-top: 14px; }
    .site-footer { padding-top: 58px; }
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px 22px;
        padding-bottom: 44px;
    }
    .footer-brand { grid-column: 1 / -1; }
    /* ستون تماس در موبایل تمام‌عرض می‌شود */
    .footer-contact { grid-column: 1 / -1; }
    /* دکمهٔ تم همیشه سمت چپ می‌نشیند */
    .theme-switcher { bottom: 18px; left: 18px; right: auto; }
    .ts-panel { left: 0; right: auto; transform-origin: bottom left; }
    .ts-toggle { width: 48px; height: 48px; }
    .ts-panel { width: min(244px, calc(100vw - 36px)); }
}

@media (max-width: 560px) {
    .footer-col:last-child { grid-column: 1 / -1; }
    .footer-desc { max-width: none; }
    .contact-ic { width: 32px; height: 32px; }
    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 20px 0;
    }
}

@media (max-width: 400px) {
    .nav-actions { gap: 6px; }
    .nav-actions .icon-btn,
    .nav-toggle { width: 38px; height: 38px; }
    .brand-text strong { font-size: 15px; }
}
