/* ============================================================
   BASE.CSS — استایل‌های مشترک کل سایت
   ============================================================ */

/* ===== FONT ===== */
@font-face {
    font-family: Vazirmatn;
    src: url("../fonts/Vazirmatn.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

/* ===== VARIABLES ===== */
:root {
    --bg: #071b18;
    --surface: #0c2722;
    --gold: #c3a36a;
    --cream: #f0e7d6;
    --muted: #b6c2b8;
    --line: #9f824638;

    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 8px;
    --radius-pill: 100px;

    --transition-fast: .2s;
    --transition-base: .3s;
    --transition-slow: .4s;
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--cream);
    font-family: Vazirmatn, Tahoma, sans-serif;
    font-size: 15px;
    line-height: 1.95;
}

a {
    color: inherit;
    text-decoration: none;
    touch-action: manipulation;
}

a:hover {
    color: var(--gold);
}

button {
    font: inherit;
    touch-action: manipulation;
}

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

h1, h2, h3, p {
    margin-top: 0;
}

h1, h2, h3 {
    font-weight: 500;
    line-height: 1.6;
}

h1 { font-size: clamp(2rem, 4.2vw, 3.7rem); }
h2 { font-size: clamp(1.45rem, 2.5vw, 2rem); }
h3 { font-size: 1.15rem; }

p {
    color: var(--muted);
}

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 6px;
}

/* ===== UTILITIES ===== */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.wrap {
    width: min(1200px, 90%);
    margin-inline: auto;
}

.skip {
    position: fixed;
    top: -100px;
    right: 1rem;
    z-index: 10;
    padding: 1rem;
    background: var(--cream);
    color: var(--bg);
}

.skip:focus {
    top: 1rem;
}

/* ===== SHARED TYPOGRAPHY ===== */
.eyebrow {
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--gold);
    margin-bottom: 15px;
}

.lead {
    font-size: 19px;
}

.quiet {
    color: var(--muted);
    font-size: 11px;
}

.english {
    font-family: Georgia, serif;
    letter-spacing: 2px;
    font-size: 12px;
    color: var(--gold);
}

.note {
    font-size: 12px;
    margin-top: 25px;
}

/* ===== SHARED COMPONENTS ===== */
.section {
    padding-block: 65px;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.section-heading h2 {
    margin-bottom: 0;
}

.section-note {
    max-width: 480px;
    font-size: 13px;
    color: var(--muted);
}

.ornament {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--gold);
    max-width: 320px;
    margin-block: 20px;
}

.ornament::before,
.ornament::after {
    content: "";
    height: 1px;
    background: var(--line);
    flex: 1;
}

.actions {
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    border: 1px solid #b99c65;
    padding: 12px 23px;
    color: #e8cf9d;
    font-size: 13px;
    background: #10261c70;
    transition: background var(--transition-fast);
}

.button:hover {
    background: var(--gold);
    color: var(--bg);
}

.text-link {
    color: var(--gold);
    font-size: 13px;
    border-bottom: 1px solid var(--line);
    padding-block: 7px;
}

/* ===== PAGE INTRO ===== */
.page-intro {
    padding-top: 65px;
    padding-bottom: 25px;
    text-align: center;
}

.page-intro h1 {
    margin-bottom: 15px;
}

.page-intro p {
    max-width: 660px;
    margin-inline: auto;
}

/* ===== PROSE ===== */
.prose {
    max-width: 850px;
    min-height: 350px;
}

.prose h2 {
    margin-top: 30px;
}

.prose .button {
    margin-top: 25px;
}

.prose address {
    font-style: normal;
    color: var(--muted);
}

/* ===== ERROR PAGE ===== */
.error {
    min-height: 65vh;
}

/* ============================================================
   TOP TICKER — نوار قیمت‌های بالای هدر
   ============================================================ */
.top-ticker {
    background: #041310;
    border-bottom: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted);
    overflow: hidden;
}

.top-ticker-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 44px;
    padding-block: 8px;
    flex-wrap: nowrap;
}

/* تماس سمت راست */
.ticker-contact {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--gold);
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color var(--transition-fast);
}

.ticker-contact:hover {
    color: var(--cream);
}

/* قیمت‌ها */
.ticker-prices {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    white-space: nowrap;
    min-width: 0;
    flex-wrap: nowrap;
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.ticker-label {
    color: var(--muted);
    font-size: 12px;
}

.ticker-value {
    color: var(--gold);
    font-family: Georgia, serif;
    font-size: 12px;
    font-weight: 500;
    direction: ltr;
    letter-spacing: .3px;
}

.ticker-sep {
    color: var(--line);
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
    background: #061713;
    border-bottom: 1px solid var(--line);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 105px;
    position: relative;
}

.wordmark {
    display: flex;
    align-items: center;
    flex-direction: column;
    color: var(--gold);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.wordmark img {
    height: 57px;
    width: 57px;
    object-fit: contain;
    mix-blend-mode: screen;
}

.wordmark span {
    font-family: Georgia, serif;
    font-size: 12px;
    letter-spacing: 2px;
}

.menu-toggle {
    border: 0;
    background: none;
    color: var(--gold);
    padding: 12px 0;
    position: relative;
    z-index: 1;
}

.menu-toggle span {
    margin-left: 6px;
}

.topbar-spacer {
    width: 130px;
}

/* ===== NAVIGATION ===== */
.nav {
    display: none;
    padding: 15px 0;
}

.nav.open {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav a {
    font-size: 13px;
    padding: 5px 0;
}

.nav a[aria-current] {
    color: var(--gold);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    border-top: 1px solid var(--line);
    background: #041310;
    padding-top: 45px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.footer h2 {
    font-size: 15px;
    color: var(--gold);
    margin-bottom: 15px;
}

.footer a {
    display: block;
    font-size: 12px;
    margin-bottom: 6px;
}

.footer p,
.footer address {
    font-size: 12px;
    font-style: normal;
}

.footer-brand {
    font-size: 24px !important;
    color: var(--gold);
}

.footer-bottom {
    border-top: 1px solid var(--line);
    padding-block: 22px;
    margin-top: 35px;
    display: flex;
    justify-content: space-between;
    gap: 15px;
    color: var(--muted);
}

.footer-bottom > div {
    display: flex;
    gap: 20px;
}

/* ============================================================
   PRODUCT CARD (مشترک بین home و products)
   ============================================================ */
.product-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 26px;
}

.product-card {
    min-width: 0;
}

.product-image {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    aspect-ratio: 4/5;
    border: 1px solid var(--line);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.product-card a:hover img {
    transform: scale(1.025);
}

.view-piece,
.view-product {
    position: absolute;
    bottom: 16px;
    left: 16px;
    padding: 5px 10px;
    background: #061b16d9;
    color: var(--cream);
    font-size: 11px;
}

.card-info,
.product-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-bottom: 1px solid var(--line);
}

.card-info .eyebrow,
.product-info .eyebrow {
    font-size: 10px;
}

.card-info h3,
.product-info h3 {
    margin-top: 3px;
    margin-bottom: 16px;
}

.card-info > span,
.product-info > span {
    color: var(--gold);
}

.card-price {
    font-size: 13px;
    color: var(--gold);
    font-weight: 500;
    margin: 6px 0 0;
    letter-spacing: .3px;
}

.product-desc {
    font-size: 12px;
    color: var(--muted);
    margin: 6px 0 16px;
    line-height: 1.8;
}

.category-badge {
    display: inline-block;
    font-size: 12px;
    color: var(--gold);
    background: #c3a36a1a;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    margin-top: 10px;
}

/* ============================================================
   BREADCRUMB & DETAIL
   ============================================================ */
.breadcrumb {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    font-size: 12px;
    color: var(--gold);
    flex-wrap: wrap;
}

.detail-grid {
    display: grid;
    gap: 35px;
    align-items: center;
}

.detail-image {
    width: 100%;
    max-height: 700px;
    object-fit: contain;
}

/* ============================================================
   RESPONSIVE — SHARED
   ============================================================ */
@media (min-width: 600px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 960px) {
    .menu-toggle {
        visibility: hidden;
        width: 130px;
    }

    .consult-top {
        width: 130px;
        text-align: left;
    }

    .nav {
        display: flex !important;
        justify-content: center;
        gap: 40px;
        border-top: 1px solid var(--line);
    }

    .nav.open {
        flex-direction: row;
    }

    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .footer-grid {
        grid-template-columns: 1.1fr .7fr 1fr 1.2fr;
        gap: 40px;
    }

    .detail-grid {
        grid-template-columns: 1fr 1fr;
        gap: 70px;
    }
}

@media (max-width: 767px) {
    .top-ticker-inner {
        justify-content: center;
    }

    .ticker-contact {
        display: none;
    }

    .ticker-prices {
        gap: 8px;
        justify-content: center;
        flex-wrap: wrap;
        white-space: normal;
    }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition: none !important;
    }
}


/* ============================================================
   TOAST MESSAGES — پیام‌های شناور
   ============================================================ */
.toast-stack {
    position: fixed;
    top: 90px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    width: calc(100% - 32px);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-right: 3px solid var(--gold);
    border-radius: var(--radius-md);
    color: var(--cream);
    box-shadow: 0 10px 30px -10px #00000080;
    pointer-events: auto;
    animation: toastIn .3s ease-out;
}

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

.toast--success { border-right-color: #6abf87; }
.toast--error   { border-right-color: #e07b7b; }
.toast--warning { border-right-color: #e0b96a; }
.toast--info    { border-right-color: #7baee0; }
.toast--debug   { border-right-color: var(--muted); }

.toast-icon {
    width: 22px;
    height: 22px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
    background: #c3a36a22;
    color: var(--gold);
}

.toast--success .toast-icon { background: #6abf8722; color: #6abf87; }
.toast--error   .toast-icon { background: #e07b7b22; color: #e07b7b; }
.toast--warning .toast-icon { background: #e0b96a22; color: #e0b96a; }
.toast--info    .toast-icon { background: #7baee022; color: #7baee0; }

.toast-text {
    flex: 1;
    margin: 0;
    font-size: 13px;
    color: var(--cream);
    line-height: 1.7;
}

.toast-close {
    background: none;
    border: 0;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    padding: 0 2px;
    flex-shrink: 0;
    transition: color var(--transition-fast);
}

.toast-close:hover { color: var(--gold); }

/* ============================================================
   FORM ERRORS — خطاهای فرم
   ============================================================ */
.form-errors {
    background: #e07b7b14;
    border: 1px solid #e07b7b40;
    border-right: 3px solid #e07b7b;
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 22px;
}

.form-errors-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.form-errors-icon {
    width: 20px;
    height: 20px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e07b7b33;
    color: #e07b7b;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.form-errors-head strong {
    flex: 1;
    color: #e07b7b;
    font-size: 13px;
}

.form-errors-close {
    background: none;
    border: 0;
    color: #e07b7b;
    font-size: 13px;
    cursor: pointer;
    padding: 0 2px;
    flex-shrink: 0;
}

.form-errors-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 6px;
}

.form-errors-list li {
    position: relative;
    padding-right: 16px;
    font-size: 12px;
    color: #f0b0b0;
    line-height: 1.8;
}

.form-errors-list li::before {
    content: "—";
    position: absolute;
    right: 0;
    color: #e07b7b;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .toast-stack {
        top: 70px;
        right: 8px;
        left: 8px;
        width: auto;
        max-width: none;
    }
}

/* ===== AUTH LINK (ورود/ثبت‌نام یا پروفایل) ===== */
.auth-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--gold);
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    white-space: nowrap;
    flex-shrink: 0;
    z-index: 1;
}

.auth-link:hover {
    background: var(--gold);
    color: var(--bg);
    border-color: var(--gold);
}

.auth-link-icon {
    font-size: 14px;
    line-height: 1;
}

.auth-link-text {
    font-weight: 500;
}

/* کاربر لاگین‌کرده — کمی متمایز */
.auth-link--user {
    background: #c3a36a14;
    border-color: #c3a36a55;
}

.auth-link--user .auth-link-icon {
    color: var(--gold);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 767px) {
    .auth-link {
        padding: 6px 10px;
        font-size: 11px;
    }

    .auth-link-icon {
        font-size: 12px;
    }

    /* در موبایل فقط آیکون (متن مخفی) */
    .auth-link-text {
        display: none;
    }

    .auth-link {
        padding: 10px;
        width: 38px;
        height: 38px;
        aspect-ratio: 1 / 1;
        justify-content: center;
    }
}

/* ===== AUTH USER MENU ===== */
.auth-user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1;
    flex-shrink: 0;
}

/* دکمه خروج (لینک) */
.auth-logout-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
}

.auth-logout-link:hover {
    background: #e07b7b14;
    border-color: #e07b7b55;
    color: #e07b7b;
}

.auth-logout-icon {
    font-size: 13px;
    line-height: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 767px) {
    .auth-user-menu {
        gap: 6px;
    }

    .auth-logout-link {
        padding: 10px;
        width: 38px;
        height: 38px;
        aspect-ratio: 1 / 1;
        justify-content: center;
    }

    .auth-logout-text {
        display: none;
    }
}

/* ===== سبد خرید (دکمه) ===== */
.auth-link--cart {
    position: relative;
    background: #c3a36a0e;
}

.auth-link--cart:hover {
    background: var(--gold);
    color: var(--bg);
    border-color: var(--gold);
}

/* شمارنده‌ی سبد */
.auth-cart-badge {
    position: absolute;
    top: -6px;
    left: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #e07b7b;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid var(--bg);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 767px) {
    .auth-link--cart .auth-link-text {
        display: none;
    }

    .auth-link--cart {
        padding: 10px;
        width: 38px;
        height: 38px;
        aspect-ratio: 1 / 1;
        justify-content: center;
    }

    .auth-cart-badge {
        top: -4px;
        left: -4px;
        min-width: 16px;
        height: 16px;
        font-size: 9px;
    }
}