/* ==========================================================================
   فوتر انیمیشنی Zandi — «مسیر تجاری»
   همه‌ی کلاس‌ها با zht-footer / zht-route شروع می‌شوند و متغیرها با --zf-
   ========================================================================== */

.zht-footer {
    --zf-bg: var(--ztg-bg, #050308);
    --zf-pink: #ff4fd8;
    --zf-purple: #8a4bff;
    --zf-blue: #5b6bff;
    --zf-text: rgba(255, 255, 255, 0.68);
    --zf-text-dim: rgba(255, 255, 255, 0.56);
    --zf-line: rgba(255, 255, 255, 0.1);
    --zf-flag: clamp(46px, 11vw, 76px);
    --zf-cycle: 10s;   /* یک دور کامل عبور پرتو */
    --zf-intro: 1.3s;  /* مدت کشیده‌شدن خط در ورود */
    --zf-play: running;

    position: relative;
    isolation: isolate;
    overflow: hidden;
    margin: 0;
    background: var(--zf-bg);
    color: var(--zf-text);
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.7;
}

/* وقتی فوتر خارج از دید است انیمیشن‌ها متوقف می‌شوند (صرفه‌جویی در CPU) */
.zht-footer.is-armed:not(.is-inview) {
    --zf-play: paused;
}

.zht-footer *,
.zht-footer *::before,
.zht-footer *::after {
    box-sizing: border-box;
}

/* خط رنگی بالای فوتر (همان شیمر بالای صفحه‌ها) */
.zht-footer::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    z-index: 2;
    background: linear-gradient(90deg, var(--zf-purple), var(--zf-pink), var(--zf-purple));
    background-size: 200% 100%;
    animation: zf-shimmer 6s linear infinite;
    animation-play-state: var(--zf-play);
}

/* درخشش ملایم پشت مسیر */
.zht-footer-glow {
    position: absolute;
    z-index: -1;
    top: -150px;
    left: 50%;
    width: min(900px, 120%);
    height: 430px;
    transform: translateX(-50%);
    background: radial-gradient(closest-side, rgba(138, 75, 255, 0.28), rgba(255, 79, 216, 0.1) 55%, transparent 100%);
    pointer-events: none;
    animation: zf-breathe 8s ease-in-out infinite alternate;
    animation-play-state: var(--zf-play);
}

.zht-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.zht-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- مسیر تجاری (پرچم‌ها) ---------- */
.zht-route {
    padding: 72px 0 56px;
}

.zht-route-title {
    margin: 0 0 40px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0;
    text-transform: none;
    color: #fff;
}

.zht-route-track {
    position: relative;
    max-width: 860px;
    margin: 0 auto;
}

/* خط اتصال */
.zht-route-line {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(var(--zf-flag) / 2 - 1px);
    height: 2px;
    background: linear-gradient(90deg, var(--zf-pink), var(--zf-purple), var(--zf-blue));
    opacity: 0.6;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
            mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
    transform-origin: left center;
    animation: zf-draw var(--zf-intro) cubic-bezier(0.65, 0, 0.35, 1) backwards;
    animation-play-state: var(--zf-play);
}

/* پرتو نوری که از روی خط عبور می‌کند */
.zht-route-beam {
    position: absolute;
    z-index: 1;
    left: 0;
    top: calc(var(--zf-flag) / 2 - 4px);
    width: 8px;
    height: 8px;
    margin-left: -4px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 10px 3px rgba(255, 79, 216, 0.85), 0 0 26px 8px rgba(138, 75, 255, 0.5);
    opacity: 0;
    pointer-events: none;
    animation: zf-beam var(--zf-cycle) linear infinite;
    animation-delay: calc(var(--zf-intro) + 0.2s);
    animation-play-state: var(--zf-play);
}

.zht-route-beam::after {
    content: "";
    position: absolute;
    right: 50%;
    top: 50%;
    width: 120px;
    height: 2px;
    transform: translateY(-50%);
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 79, 216, 0.9));
}

.zht-route-nodes {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(var(--zf-n, 4), minmax(0, 1fr));
    margin: 0;
    padding: 0;
    list-style: none;
}

.zht-route-nodes > li {
    display: flex;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.zht-route-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
    text-align: center;
    text-decoration: none;
    color: var(--zf-text);
    outline: none;
}

/* مدال پرچم — پس‌زمینه‌ی تیره خط را پشت خودش پنهان می‌کند */
.zht-route-flag {
    position: relative;
    display: block;
    width: var(--zf-flag);
    height: var(--zf-flag);
    padding: 4px;
    border-radius: 50%;
    background: var(--zf-bg);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.35s ease;
    animation: zf-pop 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.35) backwards;
    animation-delay: calc(0.1s + var(--zf-intro) * 0.85 * (2 * var(--zf-i) + 1) / (2 * var(--zf-n)));
    animation-play-state: var(--zf-play);
}

.zht-route-flag img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* موجِ لحظه‌ی رسیدن پرتو؛ زمان‌بندی با موقعیت هر پرچم روی خط هماهنگ است */
.zht-route-flag::after {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid var(--zf-pink);
    box-shadow: 0 0 18px rgba(255, 79, 216, 0.6), inset 0 0 12px rgba(255, 79, 216, 0.35);
    opacity: 0;
    pointer-events: none;
    animation: zf-pass var(--zf-cycle) linear infinite;
    animation-delay: calc(var(--zf-intro) + 0.2s + var(--zf-cycle) * 0.66 * (2 * var(--zf-i) + 1) / (2 * var(--zf-n)) - 0.3s);
    animation-play-state: var(--zf-play);
}

.zht-route-name {
    margin-top: 14px;
    font-size: 13.5px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--zf-text);
    text-wrap: balance;
    transition: color 0.25s ease;
    animation: zf-rise 0.6s ease-out backwards;
    animation-delay: calc(0.35s + var(--zf-intro) * 0.85 * (2 * var(--zf-i) + 1) / (2 * var(--zf-n)));
    animation-play-state: var(--zf-play);
}

.zht-route-node:hover .zht-route-flag,
.zht-route-node:focus-visible .zht-route-flag {
    transform: translateY(-4px) scale(1.07);
    box-shadow: 0 0 0 1px rgba(255, 79, 216, 0.7), 0 10px 30px rgba(138, 75, 255, 0.45);
}

.zht-route-node:hover .zht-route-name,
.zht-route-node:focus-visible .zht-route-name {
    color: #fff;
}

.zht-route-node:focus-visible .zht-route-flag {
    outline: 2px solid #fff;
    outline-offset: 5px;
}

/* ---------- ستون‌ها ---------- */
.zht-footer-cols {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.3fr);
    gap: 48px;
    padding: 56px 0 48px;
    border-top: 1px solid var(--zf-line);
}

.zht-footer-brand .site-logo {
    display: inline-flex;
}

.zht-footer-about {
    max-width: 34ch;
    margin: 22px 0 0;
    font-size: 14.5px;
    color: var(--zf-text);
}

.zht-footer-heading {
    margin: 0 0 20px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0;
    text-transform: none;
    color: #fff;
}

.zht-footer-list {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.zht-footer-list li {
    margin: 0;
    padding: 0;
}

.zht-footer-link {
    padding-bottom: 3px;
    text-decoration: none;
    color: var(--zf-text);
    background: linear-gradient(90deg, var(--zf-pink), var(--zf-purple)) no-repeat 0 100% / 0 1px;
    transition: color 0.25s ease, background-size 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.zht-footer-link:hover,
.zht-footer-link:focus-visible {
    color: #fff;
    background-size: 100% 1px;
}

.zht-footer-link:focus-visible {
    outline: 2px solid var(--zf-purple);
    outline-offset: 4px;
    border-radius: 2px;
}

/* ---------- اطلاعات تماس ---------- */
.zht-footer-contact-list {
    gap: 16px;
}

.zht-footer-contact-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.zht-footer-ico {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    color: var(--zf-pink);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 0 0 1px var(--zf-line);
    transition: color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.zht-footer-ico svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.zht-footer-contact-item:hover .zht-footer-ico {
    color: #fff;
    background: linear-gradient(135deg, var(--zf-pink), var(--zf-purple));
    box-shadow: 0 6px 18px rgba(255, 79, 216, 0.35);
}

.zht-footer-contact-text {
    padding-top: 5px;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--zf-text);
    overflow-wrap: anywhere;
}

/* ---------- نوار آخر (متن قابل ویرایش) ---------- */
.zht-footer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 32px;
    padding: 22px 0 26px;
    border-top: 1px solid var(--zf-line);
    font-size: 13.5px;
    color: var(--zf-text-dim);
}

.zht-footer-bottom p {
    margin: 0;
}

.zht-footer-bottom a {
    color: #fff;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.3);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.25s ease;
}

.zht-footer-bottom a:hover,
.zht-footer-bottom a:focus-visible {
    text-decoration-color: var(--zf-pink);
}

/* ---------- کیفریم‌ها ---------- */
@keyframes zf-shimmer {
    0%   { background-position: 0% 0; }
    100% { background-position: 200% 0; }
}

@keyframes zf-breathe {
    from { opacity: 0.55; }
    to   { opacity: 1; }
}

@keyframes zf-draw {
    from { transform: scaleX(0); }
}

@keyframes zf-pop {
    from { opacity: 0; transform: scale(0.5); }
}

@keyframes zf-rise {
    from { opacity: 0; transform: translateY(6px); }
}

@keyframes zf-beam {
    0%   { left: 0;    opacity: 0; }
    4%   { opacity: 1; }
    62%  { opacity: 1; }
    66%  { left: 100%; opacity: 0; }
    100% { left: 100%; opacity: 0; }
}

@keyframes zf-pass {
    0%   { opacity: 0; transform: scale(0.82); }
    3%   { opacity: 1; transform: scale(1); }
    11%  { opacity: 0; transform: scale(1.5); }
    100% { opacity: 0; transform: scale(1.5); }
}

/* ---------- واکنش‌گرا ---------- */
@media (max-width: 1350px) {
    /* جا برای دکمه‌ی گرد «بازگشت به بالا» */
    .zht-footer-extra {
        margin-right: 68px;
    }
}

@media (max-width: 900px) {
    .zht-route {
        padding: 56px 0 44px;
    }
    .zht-footer-cols {
        grid-template-columns: 1fr 1fr;
        gap: 40px 32px;
    }
    .zht-footer-brand {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .zht-route-title {
        margin-bottom: 30px;
    }
    .zht-route-name {
        font-size: 12px;
    }
    .zht-footer-cols {
        grid-template-columns: 1fr;
        padding: 44px 0 36px;
    }
    .zht-footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        padding-right: 60px;
    }
    .zht-footer-extra {
        margin-right: 0;
    }
}

/* احترام به تنظیم «کاهش حرکت» سیستم‌عامل: همه‌چیز ثابت و کامل نمایش داده می‌شود */
@media (prefers-reduced-motion: reduce) {
    .zht-footer *,
    .zht-footer *::before,
    .zht-footer *::after {
        animation: none !important;
        transition: none !important;
    }
    .zht-route-beam {
        display: none;
    }
}
