/* ═══════════════════════════════════════════════════════════════
   سازه گستر سهند — سیستم طراحی اصلی
   Design & Development: dashtseo.ir
   ═══════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────
   1. Design Tokens (متغیرهای طراحی)
   ───────────────────────────────────── */
:root {
    /* رنگ‌های اصلی - پالت ساختمانی گرم */
    --color-brick:        #A8412B;   /* آجری اصلی */
    --color-brick-dark:   #7A2E1F;   /* آجری تیره */
    --color-brick-light:  #C75A3F;   /* آجری روشن */
    --color-brick-50:     #F9EEEA;   /* آجری خیلی روشن */

    --color-earth:        #8B6F47;   /* خاکی */
    --color-earth-dark:   #5F4A2F;   /* خاکی تیره */
    --color-earth-light:  #B59368;   /* خاکی روشن */

    --color-cream:        #F5F1EB;   /* کرم */
    --color-cream-dark:   #E8E0D2;   /* کرم تیره */
    --color-paper:        #FAF8F4;   /* کاغذ */

    --color-charcoal:     #1A1814;   /* ذغالی */
    --color-graphite:     #2D2A24;   /* گرافیت */
    --color-stone:        #6B6660;   /* سنگی */
    --color-mist:         #A8A39A;   /* مه‌آلود */

    --color-success:      #4A6741;   /* سبز زیتونی */
    --color-warning:      #C28F2C;   /* زرد اخطاری */
    --color-error:        #8B2E2E;   /* قرمز خطا */

    /* سایه‌ها - ظریف و حرفه‌ای */
    --shadow-sm:   0 1px 2px rgba(26, 24, 20, 0.04);
    --shadow-md:   0 4px 12px rgba(26, 24, 20, 0.06), 0 1px 2px rgba(26, 24, 20, 0.04);
    --shadow-lg:   0 12px 28px rgba(26, 24, 20, 0.08), 0 2px 6px rgba(26, 24, 20, 0.04);
    --shadow-xl:   0 24px 48px rgba(26, 24, 20, 0.12), 0 4px 12px rgba(26, 24, 20, 0.04);
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.6);

    /* تایپوگرافی */
    --font-display: 'IRANSansX', 'Vazirmatn', 'Tahoma', sans-serif;
    --font-body:    'IRANSansX', 'Vazirmatn', 'Tahoma', sans-serif;
    --font-mono:    'JetBrains Mono', 'Courier New', monospace;
    --font-num:     'IRANSansXFaNum', 'Vazirmatn', sans-serif;

    /* سایزهای تایپوگرافی - Major Third Scale */
    --text-xs:   0.75rem;     /* 12px */
    --text-sm:   0.875rem;    /* 14px */
    --text-base: 1rem;        /* 16px */
    --text-lg:   1.125rem;    /* 18px */
    --text-xl:   1.25rem;     /* 20px */
    --text-2xl:  1.5rem;      /* 24px */
    --text-3xl:  1.875rem;    /* 30px */
    --text-4xl:  2.25rem;     /* 36px */
    --text-5xl:  3rem;        /* 48px */
    --text-6xl:  3.75rem;     /* 60px */
    --text-7xl:  4.5rem;      /* 72px */
    --text-8xl:  6rem;        /* 96px */

    /* فاصله‌ها - 8px Grid */
    --space-1:  0.25rem;   /* 4px */
    --space-2:  0.5rem;    /* 8px */
    --space-3:  0.75rem;   /* 12px */
    --space-4:  1rem;      /* 16px */
    --space-5:  1.25rem;   /* 20px */
    --space-6:  1.5rem;    /* 24px */
    --space-8:  2rem;      /* 32px */
    --space-10: 2.5rem;    /* 40px */
    --space-12: 3rem;      /* 48px */
    --space-16: 4rem;      /* 64px */
    --space-20: 5rem;      /* 80px */
    --space-24: 6rem;      /* 96px */
    --space-32: 8rem;      /* 128px */

    /* Container */
    --container-sm:  640px;
    --container-md:  768px;
    --container-lg:  1024px;
    --container-xl:  1280px;
    --container-2xl: 1440px;

    /* Border Radius */
    --radius-sm:   4px;
    --radius-md:   8px;
    --radius-lg:   12px;
    --radius-xl:   16px;
    --radius-2xl:  24px;
    --radius-full: 9999px;

    /* ترنزیشن‌ها */
    --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out:  cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast:   150ms;
    --duration-base:   250ms;
    --duration-slow:   400ms;

    /* Z-index */
    --z-base:    1;
    --z-dropdown: 100;
    --z-sticky:  200;
    --z-header:  300;
    --z-overlay: 400;
    --z-modal:   500;
    --z-toast:   600;
}

/* ─────────────────────────────────────
   2. Reset و Normalize
   ───────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.7;
    color: var(--color-charcoal);
    background: var(--color-paper);
    direction: rtl;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

img,
svg,
video {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--duration-base) var(--ease-out);
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

ul, ol {
    list-style: none;
}

/* ─────────────────────────────────────
   3. Layout Utilities
   ───────────────────────────────────── */
.sgs-container {
    width: 100%;
    max-width: var(--container-2xl);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

@media (min-width: 768px) {
    .sgs-container { padding: 0 var(--space-8); }
}

@media (min-width: 1024px) {
    .sgs-container { padding: 0 var(--space-10); }
}

/* ─────────────────────────────────────
   4. تایپوگرافی
   ───────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 800;
    line-height: 1.25;
    color: var(--color-charcoal);
    letter-spacing: -0.01em;
}

h1 { font-size: var(--text-5xl); line-height: 1.15; }
h2 { font-size: var(--text-4xl); line-height: 1.2; }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

@media (max-width: 768px) {
    h1 { font-size: var(--text-4xl); }
    h2 { font-size: var(--text-3xl); }
    h3 { font-size: var(--text-2xl); }
}

p {
    line-height: 1.85;
    color: var(--color-graphite);
}

/* ─────────────────────────────────────
   5. سیستم Grid پیشرفته
   ───────────────────────────────────── */
.sgs-grid {
    display: grid;
    gap: var(--space-6);
}

.sgs-grid--2 { grid-template-columns: repeat(2, 1fr); }
.sgs-grid--3 { grid-template-columns: repeat(3, 1fr); }
.sgs-grid--4 { grid-template-columns: repeat(4, 1fr); }
.sgs-grid--auto { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

@media (max-width: 1024px) {
    .sgs-grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .sgs-grid--2,
    .sgs-grid--3,
    .sgs-grid--4 { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────
   6. دکمه‌ها
   ───────────────────────────────────── */
.sgs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 700;
    line-height: 1;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-out);
    white-space: nowrap;
    text-decoration: none;
    user-select: none;
}

.sgs-btn--primary {
    background: var(--color-brick);
    color: var(--color-cream);
    box-shadow: var(--shadow-md);
}

.sgs-btn--primary:hover {
    background: var(--color-brick-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.sgs-btn--secondary {
    background: var(--color-charcoal);
    color: var(--color-cream);
}

.sgs-btn--secondary:hover {
    background: var(--color-graphite);
    transform: translateY(-2px);
}

.sgs-btn--outline {
    background: transparent;
    color: var(--color-charcoal);
    border-color: var(--color-charcoal);
}

.sgs-btn--outline:hover {
    background: var(--color-charcoal);
    color: var(--color-cream);
}

.sgs-btn--ghost {
    background: transparent;
    color: var(--color-brick);
    border-color: var(--color-brick-50);
}

.sgs-btn--ghost:hover {
    background: var(--color-brick-50);
    border-color: var(--color-brick);
}

.sgs-btn--lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-base);
}

.sgs-btn--xl {
    padding: var(--space-5) var(--space-10);
    font-size: var(--text-lg);
}

.sgs-btn--block {
    width: 100%;
}

/* ─────────────────────────────────────
   7. Badge و Tag
   ───────────────────────────────────── */
.sgs-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 700;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sgs-badge--new {
    background: var(--color-brick);
    color: var(--color-cream);
}

.sgs-badge--hot {
    background: var(--color-warning);
    color: var(--color-charcoal);
}

.sgs-badge--safe {
    background: var(--color-success);
    color: var(--color-cream);
}

.sgs-badge--outline {
    background: transparent;
    color: var(--color-stone);
    border: 1px solid var(--color-cream-dark);
}

/* ─────────────────────────────────────
   8. Card
   ───────────────────────────────────── */
.sgs-card {
    background: var(--color-paper);
    border: 1px solid var(--color-cream-dark);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--duration-base) var(--ease-out);
}

.sgs-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-brick-50);
}

/* ─────────────────────────────────────
   9. انیمیشن‌های ظریف
   ───────────────────────────────────── */
@keyframes sgs-fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes sgs-slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes sgs-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.sgs-fade-in {
    animation: sgs-fadeIn 0.6s var(--ease-out);
}

.sgs-animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

.sgs-animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ─────────────────────────────────────
   10. Skip Link (دسترسی‌پذیری)
   ───────────────────────────────────── */
.skip-link {
    position: absolute;
    top: -100px;
    right: 0;
    background: var(--color-brick);
    color: var(--color-cream);
    padding: var(--space-3) var(--space-5);
    z-index: var(--z-modal);
    text-decoration: none;
    border-radius: 0 0 0 var(--radius-md);
}

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

/* ─────────────────────────────────────
   11. Screen Reader Only
   ───────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ─────────────────────────────────────
   12. Selection
   ───────────────────────────────────── */
::selection {
    background: var(--color-brick);
    color: var(--color-cream);
}

/* ─────────────────────────────────────
   13. Scrollbar سفارشی
   ───────────────────────────────────── */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-cream);
}

::-webkit-scrollbar-thumb {
    background: var(--color-brick);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-brick-dark);
}
