/* ===========================================================================
   پای صفحهٔ ساخته‌شده با سازنده — مشترکِ قالب‌ها. دور ۸۱ (docs/83-footer-builder.md)
   ===========================================================================

   نشانه‌گذاری: `templates/frontend/_shared/footer/`. هر رنگ از نشانه‌های قالب (`--theme-*`ِ
   `apps/appearance/design.py`) ساخته می‌شود و هر «لحن» فقط چند متغیرِ `--sf-*` را عوض می‌کند؛ پس
   فوتر در هر قالب رنگِ برند، گوشه و قلمِ همان قالب را می‌گیرد و رنگِ سختِ کم‌کنتراست در هیچ لحنی
   نمی‌ماند. سفیدِ ثابت فقط روی زمینه‌های تیره (`dark`، `brand`) است، که آن‌جا معنایش «متنِ روشن» است.

   چیدمانِ بدنهٔ اصلی `flex-wrap` است و نه شبکهٔ ستونِ شمرده: تعدادِ ستون‌ها را منوساز تعیین می‌کند
   (۰ تا ۶) و هر تعدادی، با معرفی و تماس یا بی آن‌ها، ردیف را پر می‌کند.
   =========================================================================== */

.sf {
    --sf-bg: var(--theme-surface, #fff);
    --sf-ink: var(--theme-ink, #1f2937);
    --sf-muted: var(--theme-ink-muted, #6b7280);
    --sf-line: var(--theme-line, #e5e7eb);
    --sf-accent: var(--theme-accent, #0da487);
    --sf-card: var(--theme-tint, #f8fafc);
    --sf-chip: color-mix(in srgb, var(--theme-accent, #0da487) 12%, var(--sf-bg));
    --sf-gap: clamp(28px, 4vw, 44px);
    --sf-pad: clamp(28px, 4vw, 48px);

    margin-top: clamp(32px, 5vw, 64px);
    background: var(--sf-bg);
    color: var(--sf-ink);
    font-size: 14px;
    line-height: 1.8;
    border-top: 1px solid var(--sf-line);
}
.sf--tint { --sf-bg: var(--theme-tint, #f5f7fa); --sf-card: var(--theme-surface, #fff); }
.sf--dark {
    --sf-bg: color-mix(in srgb, var(--theme-ink, #111827) 88%, #000);
    --sf-ink: color-mix(in srgb, #fff 92%, var(--theme-accent, #0da487));
    --sf-muted: color-mix(in srgb, #fff 66%, var(--sf-bg));
    --sf-line: color-mix(in srgb, #fff 12%, transparent);
    --sf-accent: color-mix(in srgb, var(--theme-accent, #0da487) 55%, #fff);
    --sf-card: color-mix(in srgb, #fff 5%, transparent);
    --sf-chip: color-mix(in srgb, #fff 9%, transparent);
    border-top-color: transparent;
}
.sf--brand {
    --sf-bg: var(--theme-accent-deep, color-mix(in srgb, var(--theme-accent, #0da487) 78%, #000));
    --sf-ink: #fff;
    --sf-muted: color-mix(in srgb, #fff 74%, transparent);
    --sf-line: color-mix(in srgb, #fff 18%, transparent);
    --sf-accent: #fff;
    --sf-card: color-mix(in srgb, #fff 8%, transparent);
    --sf-chip: color-mix(in srgb, #fff 14%, transparent);
    border-top-color: transparent;
}
.sf--compact { --sf-gap: 24px; --sf-pad: 24px; font-size: 13.5px; }
.sf--rounded { border-radius: clamp(20px, 3vw, 32px) clamp(20px, 3vw, 32px) 0 0; border-top: 0; }

/* هم‌عرضِ محتوای قالب‌ها (۱۳۲۰ پیکسلِ کانتینرِ بوت‌استرپ)؛ `--ds-container` تا ۱۶۰۰ می‌رود و فوتر از بدنهٔ صفحه پهن‌تر می‌شد. */
.sf__inner {
    max-width: 1320px;
    margin-inline: auto;
    padding-inline: 16px;
}
.sf--full .sf__inner { max-width: none; padding-inline: clamp(16px, 5vw, 72px); }

.sf a { color: inherit; text-decoration: none; transition: color .15s ease; }
.sf a:hover { color: var(--sf-accent); }
.sf a:focus-visible, .sf button:focus-visible, .sf summary:focus-visible, .sf input:focus-visible {
    outline: 2px solid var(--sf-accent);
    outline-offset: 3px;
    border-radius: 4px;
}
.sf h2 { margin: 0; color: var(--sf-ink); }
.sf p { margin: 0; }
.sf ul { margin: 0; padding: 0; list-style: none; }
/* دور ۸۲ — قالب‌ها به هر `section` فاصلهٔ بخش‌های صفحهٔ اصلی می‌دهند (فست‌کارت: `section { padding-top: calc(26px +
   1.25vw) }`) و ستون‌های «معرفی» و «تماس» از بقیهٔ ستون‌ها پایین‌تر می‌نشستند. اینجا صفر (ویژگیِ ۰،۱،۱ از `section` و
   `.section-t-space` بیشتر است)؛ فاصلهٔ هر نوار را `.sf .sf-band` می‌دهد که از این هم قوی‌تر است. */
.sf section, .sf nav { margin: 0; padding: 0; }

.sf .sf-band { padding-block: var(--sf-pad); }
.sf .sf-band + .sf-band { border-top: 1px solid var(--sf-line); }

.sf .sf-icon { width: 22px; height: 22px; display: block; }

/* --- مزیت‌ها -------------------------------------------------------------- */
.sf .sf-perks__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px 24px; }
.sf .sf-perk { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sf .sf-perk__icon {
    flex: none;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--sf-chip);
    color: var(--sf-accent);
}
.sf .sf-perk__text { display: grid; line-height: 1.6; min-width: 0; }
.sf .sf-perk__text b { font-size: 14.5px; font-weight: 800; color: var(--sf-ink); }
.sf .sf-perk__text small { font-size: 12.5px; color: var(--sf-muted); }
.sf .sf-perks--cards .sf-perk {
    padding: 16px;
    border: 1px solid var(--sf-line);
    border-radius: var(--theme-radius-lg, 16px);
    background: var(--sf-card);
}

/* --- خبرنامه -------------------------------------------------------------- */
.sf .sf-news { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 32px; }
.sf .sf-news__copy { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1 1 320px; }
.sf .sf-news__icon {
    flex: none;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--sf-chip);
    color: var(--sf-accent);
}
.sf .sf-news__title { font-size: 17px; font-weight: 800; line-height: 1.6; }
.sf .sf-news__text { color: var(--sf-muted); font-size: 13px; }
.sf .sf-news__form {
    display: flex;
    flex: 1 1 360px;
    max-width: 480px;
    padding: 5px;
    border: 1px solid var(--sf-line);
    border-radius: 999px;
    background: var(--sf-card);
}
.sf .sf-news__form:focus-within { border-color: var(--sf-accent); }
.sf .sf-news__input {
    flex: 1;
    min-width: 0;
    height: 44px;
    padding-inline: 16px;
    border: 0;
    background: transparent;
    color: var(--sf-ink);
    font: inherit;
}
.sf .sf-news__input::placeholder { color: var(--sf-muted); }
.sf .sf-news__input:focus { outline: none; }
.sf .sf-news__btn {
    flex: none;
    height: 44px;
    padding-inline: 24px;
    border: 0;
    border-radius: 999px;
    background: var(--theme-cta, var(--theme-accent, #0da487));
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: filter .15s ease;
}
.sf .sf-news__btn:hover { filter: brightness(.94); }

/* --- بدنهٔ اصلی ----------------------------------------------------------- */
.sf .sf-main { display: flex; flex-wrap: wrap; gap: var(--sf-gap) clamp(24px, 3.5vw, 48px); }
.sf .sf-about { flex: 1.6 1 260px; min-width: 0; display: grid; align-content: start; gap: 14px; }
.sf .sf-main--wide-about .sf-about { flex: 2.6 1 340px; }
.sf .sf-about__logo { display: inline-flex; width: max-content; max-width: 100%; }
/* ارتفاعِ صریح: SVGِ جانشینِ لوگو اندازهٔ ذاتی ندارد و با `width: auto` صفر می‌شد. */
.sf .sf-about__img { height: 44px; width: auto; min-width: 96px; max-width: 180px; object-fit: contain; object-position: right center; }
[dir="ltr"] .sf .sf-about__img { object-position: left center; }
.sf--dark .sf-about__logo, .sf--brand .sf-about__logo {
    padding: 8px 12px;
    border-radius: var(--theme-radius, 12px);
    background: #fff;
}
.sf .sf-about__title { font-size: 18px; font-weight: 900; }
.sf .sf-about__text { color: var(--sf-muted); max-width: 46ch; line-height: 2; }

.sf .sf-col { flex: 1 1 140px; min-width: 0; }
.sf .sf-col__title {
    position: relative;
    margin-bottom: 14px !important;
    padding-bottom: 10px;
    font-size: 15px;
    font-weight: 800;
}
.sf .sf-col__title::after {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    bottom: 0;
    width: 28px;
    height: 3px;
    border-radius: 3px;
    background: var(--sf-accent);
}
.sf .sf-col__list { display: grid; gap: 8px; }
.sf .sf-col__list a { color: var(--sf-muted); display: inline-block; transition: color .15s ease, transform .15s ease; }
.sf .sf-col__list a:hover { color: var(--sf-accent); transform: translateX(-3px); }
[dir="ltr"] .sf .sf-col__list a:hover { transform: translateX(3px); }

.sf .sf-contact { flex: 1.3 1 220px; }
.sf .sf-contact__list { display: grid; gap: 14px; }
.sf .sf-contact__list li { display: flex; align-items: flex-start; gap: 12px; }
.sf .sf-contact__list li > span:last-child { display: grid; line-height: 1.6; min-width: 0; overflow-wrap: anywhere; }
.sf .sf-contact__list small { color: var(--sf-muted); font-size: 12px; }
.sf .sf-contact__list a, .sf .sf-contact__list li > span:last-child > span { font-weight: 700; color: var(--sf-ink); }
.sf .sf-contact__icon {
    flex: none;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--sf-chip);
    color: var(--sf-accent);
}
.sf .sf-contact__icon .sf-icon { width: 18px; height: 18px; }

/* شبکه‌ها: دایره‌های یک‌اندازه با آیکونِ خودِ شبکه (`appearance/social.py`) */
.sf .sf-social { display: flex; flex-wrap: wrap; gap: 8px; }
.sf .sf-social .ds-social__item a {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--sf-line);
    background: var(--sf-card);
    transition: transform .15s ease, border-color .15s ease;
}
.sf .sf-social .ds-social__item a:hover { transform: translateY(-2px); border-color: var(--sf-accent); }
.sf .sf-social img { width: 20px; height: 20px; }
.sf .sf-social--small .ds-social__item a { width: 34px; height: 34px; }
.sf .sf-social--small img { width: 17px; height: 17px; }

/* --- نمادها و لوگوها ------------------------------------------------------ */
.sf .sf-logos { display: grid; gap: 16px; justify-items: center; text-align: center; }
.sf .sf-logos__title { font-size: 15px; font-weight: 800; }
.sf .sf-logos__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px; }
.sf .sf-logos__list, .sf .sf-logos__seals .ts-seals { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; }
.sf .sf-logo, .sf .sf-logos__seals .ts-seals__item {
    display: grid;
    place-items: center;
    min-width: 108px;
    height: 72px;
    padding: 8px 12px;
    border: 1px solid var(--theme-line, #e5e7eb);
    border-radius: var(--theme-radius, 12px);
    background: #fff; /* لوگوها برای زمینهٔ روشن ساخته شده‌اند — در هر لحن روی کاشیِ سفید */
    transition: transform .15s ease, box-shadow .15s ease, filter .2s ease;
}
.sf .sf-logo:hover, .sf .sf-logos__seals .ts-seals__item:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -14px rgb(15 23 42 / .35); }
.sf .sf-logo img { max-width: 96px; max-height: 48px; width: auto; height: auto; object-fit: contain; }
/* درگاهِ بی‌لوگو: نامش در همان کاشی — مدیر درگاه را فعال کرده و باید در فوتر دیده شود (دور ۸۲) */
.sf .sf-logo--name { min-width: 120px; }
.sf .sf-logo__name { max-width: 120px; color: #1f2937; font-size: 13px; font-weight: 800; line-height: 1.5; text-align: center; overflow-wrap: anywhere; }
.sf .sf-logos__seals img { max-height: 56px; width: auto; }
.sf .sf-logos--mono .sf-logo img, .sf .sf-logos--mono .ts-seals__item img { filter: grayscale(1); opacity: .8; transition: filter .2s ease, opacity .2s ease; }
.sf .sf-logos--mono .sf-logo:hover img, .sf .sf-logos--mono .ts-seals__item:hover img { filter: none; opacity: 1; }

/* --- متنِ معرفیِ بلند ----------------------------------------------------- */
.sf .sf-seo__box { border: 1px solid var(--sf-line); border-radius: var(--theme-radius-lg, 16px); background: var(--sf-card); }
.sf .sf-seo__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    list-style: none;
}
.sf .sf-seo__summary::-webkit-details-marker { display: none; }
.sf .sf-seo__title { font-size: 15px; font-weight: 800; color: var(--sf-ink); }
.sf .sf-seo__more { color: var(--sf-accent); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.sf .sf-seo__more::after { content: ' ▾'; }
.sf .sf-seo__box[open] .sf-seo__more { font-size: 0; }
.sf .sf-seo__box[open] .sf-seo__more::after { content: '▴'; font-size: 12.5px; }
.sf .sf-seo__body { padding: 0 18px 18px; color: var(--sf-muted); line-height: 2.1; font-size: 13.5px; }
.sf .sf-seo__body :is(h1, h2, h3, h4) { color: var(--sf-ink); font-size: 15px; margin: 12px 0 6px; }
.sf .sf-seo__body a { color: var(--sf-accent); text-decoration: underline; text-underline-offset: 3px; }

/* --- نوارِ پایانی --------------------------------------------------------- */
.sf .sf-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    padding-block: 18px;
    color: var(--sf-muted);
    font-size: 12.5px;
}
.sf .sf-bottom__copy { flex: 1 1 320px; }
.sf .sf-bottom__credit::before { content: ' · '; }
.sf .sf-bottom__pay { display: flex; flex-wrap: wrap; gap: 6px; }
.sf .sf-bottom__pay li { display: grid; place-items: center; height: 32px; padding: 4px 8px; border-radius: 8px; background: #fff; border: 1px solid var(--theme-line, #e5e7eb); }
.sf .sf-bottom__pay img { max-height: 22px; width: auto; }
.sf .sf-bottom__top {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--sf-line);
    border-radius: 999px;
    color: var(--sf-ink) !important;
    font-weight: 700;
}
.sf .sf-bottom__top .sf-icon { width: 16px; height: 16px; }
.sf .sf-bottom__top:hover { border-color: var(--sf-accent); }

/* --- موبایل و تبلت -------------------------------------------------------- */
@media (max-width: 991.98px) {
    .sf .sf-about, .sf .sf-main--wide-about .sf-about { flex-basis: 100%; }
    .sf .sf-contact { flex-basis: 100%; }
}
@media (max-width: 575.98px) {
    .sf .sf-perks__list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
    .sf .sf-perk { flex-direction: column; align-items: flex-start; gap: 10px; }
    .sf .sf-perk__icon { width: 42px; height: 42px; }
    .sf .sf-col { flex: 1 1 40%; }
    .sf .sf-news__form { max-width: none; }
    .sf .sf-bottom { justify-content: center; text-align: center; }
    .sf .sf-bottom__copy { flex-basis: 100%; }
    .sf .sf-logo, .sf .sf-logos__seals .ts-seals__item { min-width: 92px; height: 64px; }
}
/* نوارِ پایینیِ ثابتِ موبایلِ قالب‌ها نباید آخرین سطرِ فوتر را بپوشاند */
@media (max-width: 767.98px) { .sf { padding-bottom: 72px; } }

@media (prefers-reduced-motion: reduce) {
    .sf a, .sf .sf-logo, .sf .sf-social .ds-social__item a, .sf .sf-col__list a { transition: none; }
    .sf .sf-col__list a:hover, .sf .sf-logo:hover, .sf .sf-social .ds-social__item a:hover { transform: none; }
}
