/* ==========================================================================
   صفحهٔ خانگی عمومی — سبک فلت و مدرن (هم‌خانوادهٔ اپلیکیشن شاد)
   اصل‌ها: یک رنگ accent (سبز برند) + خاکستری‌های خنثی، بدون گرادیان،
   بدون ایموجی (آیکون‌های SVG تک‌رنگ)، سایه‌های بسیار ملایم، گوشه‌های نرم.
   همهٔ رنگ‌ها از متغیرهای :root در madrese.css ⇒ «حالت شب» خودکار.
   ========================================================================== */

.home-page {
    background: var(--surface-2);
    color: var(--text);
    min-height: 100vh;
    font-size: .88rem;
}
.home-wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* رفتن به لنگرها با حرکت نرم (فقط در همین صفحه) */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* اسپرایت آیکون‌ها دیده نشود ولی برای <use> در دسترس بماند */
.visually-hidden { position: absolute; width: 0; height: 0; overflow: hidden; }

/* آیکون‌های حالت شب: در پوستهٔ روشن ماه، در پوستهٔ شب خورشید */
.only-dark { display: none; }
[data-theme="dark"] .only-light { display: none; }
[data-theme="dark"] .only-dark { display: block; }

/* ================================================================ سرصفحه */
.home-bar {
    background: var(--gradient-strong);
    color: #fff;
    padding: 14px 0 16px;
}
[data-theme="dark"] .home-bar { background: var(--primary-2); }

.home-bar-top { display: flex; align-items: center; gap: 11px; }

.home-logo {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 13px;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    font-weight: 800;
    font-size: 18px;
}
.home-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }

.home-bar-text { display: grid; line-height: 1.45; flex: 1; min-width: 0; }
.home-bar-text strong { font-size: .98rem; font-weight: 800; }
.home-bar-text small { color: rgba(255, 255, 255, .8); font-size: .68rem; }

.home-bar-actions { display: flex; align-items: center; gap: 8px; }

.home-ghost-btn {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 11px;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    cursor: pointer;
    transition: background .15s;
}
.home-ghost-btn:hover { background: rgba(255, 255, 255, .3); }

.home-bar-login {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 11px;
    background: #fff;
    color: var(--primary-strong);
    font-size: .8rem;
    font-weight: 800;
    text-decoration: none;
    transition: opacity .15s;
}
.home-bar-login:hover { opacity: .88; }

.home-bar-catalog {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 11px;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    text-decoration: none;
    transition: background .15s;
}
.home-bar-catalog:hover { background: rgba(255, 255, 255, .28); }

/* نوار جست‌وجو (داخل سرصفحهٔ سبز) — قرص همیشه سفید است، پس رنگ متن/آیکون
   آن ثابت و تیره است تا در «حالت شب» هم خوانا بماند (مثل دکمه‌های سفید سرصفحه). */
.home-search {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 14px;
    padding: 0 14px;
    border-radius: 13px;
    background: #fff;
    color: #8d9aa6;
}
.home-search input {
    flex: 1;
    border: 0;
    background: transparent;
    color: #16232e;
    font-family: inherit;
    font-size: .84rem;
    padding: 12px 0;
    outline: none;
}
.home-search input::placeholder { color: #8d9aa6; }
.home-search input::-webkit-search-cancel-button { filter: grayscale(1) opacity(.6); }

/* ==================================================================== بنر */
.home-hero {
    margin-top: 16px;
    border-radius: var(--radius);
    background: var(--gradient-strong);
    color: #fff;
    overflow: hidden;
}
[data-theme="dark"] .home-hero { background: var(--primary-2); }

.home-slides { position: relative; }
.home-slide { display: none; gap: 16px; align-items: center; padding: 22px 20px 20px; }
.home-slide.on { display: flex; }
.home-slide-text { flex: 1; min-width: 0; }
.home-slide h2 { margin: 0 0 7px; font-size: 1.06rem; font-weight: 800; line-height: 1.75; }
.home-slide p { margin: 0 0 14px; font-size: .79rem; line-height: 1.95; color: rgba(255, 255, 255, .88); }

.home-slide-cta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 9px 15px;
    border-radius: 11px;
    background: #fff;
    color: var(--primary-strong);
    font-size: .78rem;
    font-weight: 800;
    text-decoration: none;
}
.home-slide-cta:hover { opacity: .9; }
.home-slide-cta .mico { transform: none; }

.home-preview { flex: 0 0 auto; display: grid; gap: 8px; }
.home-preview-row {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, .16);
    color: #fff;
}
.home-preview-row:first-child { background: rgba(255, 255, 255, .3); }

.home-dots { display: flex; gap: 6px; justify-content: center; padding: 0 0 14px; }
.home-dots button {
    width: 6px;
    height: 6px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .42);
    cursor: pointer;
    transition: width .18s;
}
.home-dots button.on { width: 18px; background: #fff; }

/* ============================================================ دسته‌بندی */
.home-cats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    margin-top: 16px;
}
.home-cat {
    display: grid;
    gap: 8px;
    justify-items: center;
    padding: 12px 4px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    text-decoration: none;
    font-size: .67rem;
    font-weight: 700;
    text-align: center;
    transition: background .15s, color .15s;
}
.home-cat:hover { background: var(--surface); color: var(--primary-strong); }
.home-cat-ico {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: var(--surface);
    color: var(--primary-strong);
    transition: background .15s;
}
.home-cat:hover .home-cat-ico { background: var(--primary-soft); }

/* =============================================================== بخش‌ها */
.home-section { padding: 26px 0 2px; scroll-margin-top: 14px; }

.home-head { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.home-head h2 { margin: 0; font-size: .98rem; font-weight: 800; }
.home-count { color: var(--muted); font-size: .71rem; font-weight: 600; }
.home-more {
    margin-inline-start: auto;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--primary-strong);
    font-size: .74rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}
.home-more:hover { opacity: .8; }

.home-grid { display: grid; gap: 11px; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); }

/* خدمات پرکاربرد */
.home-service {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    transition: transform .15s, box-shadow .15s;
}
.home-service:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.home-service-ico {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-strong);
}
.home-service-text { flex: 1; min-width: 0; }
.home-service-text strong { display: block; font-size: .85rem; font-weight: 700; margin-bottom: 2px; }
.home-service-text span { display: block; color: var(--muted); font-size: .71rem; line-height: 1.7; }
.home-service-go { color: var(--muted); opacity: .7; }

/* کارت ماژول */
.home-card {
    padding: 16px;
    border-radius: var(--radius);
    background: var(--surface);
    transition: transform .15s, box-shadow .15s;
    scroll-margin-top: 20px;
}
.home-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.home-card:target { box-shadow: 0 0 0 2px var(--primary); }
.home-card-ico {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--primary-strong);
    margin-bottom: 12px;
}
.home-card h3 { margin: 0 0 6px; font-size: .89rem; font-weight: 700; }
.home-card p { margin: 0; color: var(--text-2); font-size: .77rem; line-height: 1.95; }

/* قابلیت‌های ویژه */
.home-feature {
    padding: 16px;
    border-radius: var(--radius);
    background: var(--surface);
    transition: transform .15s, box-shadow .15s;
}
.home-feature:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.home-feature-ico {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary-strong);
    margin-bottom: 12px;
}
.home-feature h3 { margin: 0 0 5px; font-size: .87rem; font-weight: 700; }
.home-feature p { margin: 0; color: var(--text-2); font-size: .76rem; line-height: 1.9; }

/* نقش‌ها */
.home-roles { display: grid; gap: 9px; grid-template-columns: repeat(auto-fit, minmax(146px, 1fr)); }
.home-role { padding: 13px 14px; border-radius: var(--radius-sm); background: var(--surface); text-align: center; }
.home-role strong { display: block; margin-bottom: 3px; font-size: .83rem; font-weight: 700; }
.home-role span { color: var(--muted); font-size: .7rem; line-height: 1.7; }

/* جست‌وجوی بی‌نتیجه */
.home-empty {
    display: none;
    margin-top: 12px;
    padding: 28px 16px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--muted);
    text-align: center;
    font-size: .8rem;
}
.home-empty.on { display: block; }

/* بنر کاتالوگ دیجیتال در صفحهٔ خانگی */
.home-catalog-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 17px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.home-catalog-banner:hover {
    border-color: var(--primary-strong);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.home-catalog-banner-ico {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: var(--primary-soft);
    color: var(--primary-strong);
}
.home-catalog-banner-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.home-catalog-banner-text strong { font-size: .88rem; font-weight: 800; }
.home-catalog-banner-text small { color: var(--muted); font-size: .72rem; line-height: 1.8; }

/* ==================================================== فراخوان و پاورقی */
.home-cta {
    margin-top: 26px;
    padding: 26px 20px;
    border-radius: var(--radius);
    background: var(--gradient-strong);
    color: #fff;
    text-align: center;
}
[data-theme="dark"] .home-cta { background: var(--primary-2); }
.home-cta h2 { margin: 0 0 6px; font-size: 1rem; font-weight: 800; }
.home-cta p { margin: 0 0 16px; font-size: .79rem; line-height: 1.9; color: rgba(255, 255, 255, .88); }
.home-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    border-radius: 12px;
    background: #fff;
    color: var(--primary-strong);
    font-size: .82rem;
    font-weight: 800;
    text-decoration: none;
}
.home-cta-btn:hover { opacity: .9; }

.home-footer {
    margin-top: 26px;
    padding: 20px 0 92px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: .73rem;
    text-align: center;
}
.home-footer-links { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-bottom: 8px; }
.home-footer a { color: var(--text-2); text-decoration: none; }
.home-footer a:hover { color: var(--primary-strong); }
.home-footer-phone { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 6px; }

/* ============================== نوار پایین: ساده و آیکونی (سبک اینستاگرام) */
.home-bottomnav {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 40;
    display: none;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
}
.home-bottomnav-inner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 56px;
    max-width: 520px;
    margin: 0 auto;
}
.home-tab {
    display: grid;
    place-items: center;
    width: 54px;
    height: 44px;
    border-radius: 13px;
    color: var(--muted);
    text-decoration: none;
    transition: color .15s, background .15s;
}
.home-tab:hover { color: var(--text-2); background: var(--surface-2); }
.home-tab.on { color: var(--primary-strong); }
.home-tab.on .mico { stroke-width: 2.3; }

/* ============================================================== واکنش‌گرا */
@media (max-width: 900px) {
    .home-bottomnav { display: block; }
    .home-cats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .home-bar { padding: 12px 0 14px; }
    .home-bar-text small { display: none; }
    .home-bar-catalog { width: 42px; height: 42px; padding: 0; justify-content: center; }
    .home-bar-catalog span { display: none; }
    .home-slide { padding: 18px 16px 18px; }
    .home-slide h2 { font-size: .98rem; }
    .home-preview { display: none; }
    .home-section { padding: 22px 0 2px; }
    .home-cta { padding: 22px 16px; }
    .home-grid { grid-template-columns: 1fr; }
    .home-catalog-banner { padding: 13px 14px; }
    .home-catalog-banner-text small { font-size: .78rem; }
}

/* ------------------------------------------------- کف خوانایی روی موبایل
   صفحهٔ خانگی هم باید روی گوشی مثل یک اپ خوانا باشد: هیچ متنی کوچک‌تر از
   ۱۲px و هیچ کنترل لمسی کوچک‌تر از ۴۰px. */
@media (max-width: 900px) {
    .home-slide p, .home-card p, .home-feature p, .home-cta p,
    .home-slide-cta, .home-footer, .home-service-text span,
    .home-role span, .home-more, .home-count, .home-bar-text small {
        font-size: .78rem;   /* ۱۲٫۵px */
    }

    .home-cats a, .home-service, .home-tab {
        font-size: .78rem;
    }

    .home-tab { min-height: 48px; }
    .home-ghost-btn { width: 42px; height: 42px; }
    .home-slide-cta { min-height: 40px; padding: 10px 16px; }

    /* نقطه‌های اسلایدر: ناحیهٔ لمس بزرگ، خودِ نقطه کوچک می‌ماند */
    .home-dots { gap: 2px; }
    .home-dots button {
        width: 26px;
        height: 32px;
        border-radius: 999px;
        background: transparent;
        position: relative;
    }
    .home-dots button::after {
        content: '';
        position: absolute;
        inset: 13px 4px;
        border-radius: 999px;
        background: rgba(255, 255, 255, .42);
        transition: background .18s;
    }
    .home-dots button.on { width: 34px; background: transparent; }
    .home-dots button.on::after { background: #fff; }
}
