/* =============================================================================
   نشانِ برندِ وسطِ هدر — ۱۴۰۵/۰۹/۰۳
   دسکتاپ (≥1024): نشانِ سرمه‌ای با لبه‌ی طلاییِ برجسته که زیرِ نوار آویزان است:
     لوگو + «گروه سلامت آذرنجات» + AZARNEJAT HEALTH GROUP. برقِ نور هر چند ثانیه از
     رویش می‌گذرد و با ماوس کمی سه‌بعدی می‌چرخد. با اسکرول (html.az-crest-min،
     اسکریپتِ کوچکِ داخل header.php) نام‌ها جمع می‌شوند و فقط لوگو می‌ماند.
   تبلت/موبایل (<1024): لوگو + نام کنارش (az-lockup)؛ در گوشی فقط نام فارسی.
   مارک‌آپ: header.php · فقط transform/opacity انیمیت می‌شود (بدون هزینه‌ی چیدمان).
   ========================================================================== */

:root {
    --crest-navy: #0f1729;
    --crest-navy-2: #18233d;
    --crest-gold-1: #f7e4a6;
    --crest-gold-2: #d9b45f;
    --crest-gold-3: #a77b2c;
    --crest-gold-txt: linear-gradient(180deg, #fff3c9 0%, #ecc976 45%, #c79a45 100%);
}

/* ---------------------------------------------------------------- دسکتاپ */
@media (min-width: 1024px) {
    #main-header .lg\:relative > a.az-crest {
        position: absolute;
        left: 50%;
        /* ۳۴px بیشتر بالا می‌رود تا لبه‌ی بالاییِ حلقه‌ی طلاییِ داخلی بیرون از صفحه بماند */
        top: -40px;
        width: 212px;
        padding: 44px 14px 20px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0;
        text-decoration: none;
        /* سرمه‌ایِ عمیق با لبه‌ی طلایی (حاشیه‌ی گرادیانی = padding-box + border-box) */
        border: 2px solid transparent;
        border-top: 0;
        border-radius: 0 0 46% 46% / 0 0 30% 30%;
        background:
            radial-gradient(120% 70% at 50% 0%, var(--crest-navy-2) 0%, var(--crest-navy) 62%) padding-box,
            linear-gradient(180deg, var(--crest-gold-3) 0%, var(--crest-gold-1) 38%, var(--crest-gold-2) 62%, var(--crest-gold-3) 100%) border-box !important;
        box-shadow:
            inset 0 0 0 4px var(--crest-navy),
            inset 0 0 0 5px rgba(217, 180, 95, .38),
            inset 0 -14px 26px -14px rgba(217, 180, 95, .28),
            0 18px 30px -14px rgba(5, 9, 20, .75),
            0 4px 10px rgba(5, 9, 20, .35);
        overflow: hidden;
        isolation: isolate;
        transform: translateX(-50%) perspective(700px) rotateX(var(--crest-rx, 0deg)) rotateY(var(--crest-ry, 0deg));
        transform-origin: 50% 0;
        transition: width .45s cubic-bezier(.2, .8, .2, 1), padding .45s cubic-bezier(.2, .8, .2, 1), transform .35s ease;
        will-change: transform;
    }

    /* هاله‌ی شیشه‌ای بالای نشان (حس برجستگی) */
    #main-header a.az-crest::before {
        content: "";
        position: absolute;
        inset: 0 0 auto 0;
        height: 55%;
        background: radial-gradient(70% 90% at 50% 0%, rgba(255, 236, 180, .13), rgba(255, 236, 180, 0) 70%);
        pointer-events: none;
        z-index: -1;
    }

    /* برقِ نوری که هر ۷ ثانیه از روی نشان رد می‌شود */
    #main-header .az-crest__shine {
        position: absolute;
        top: -20%;
        bottom: -20%;
        left: 0;
        width: 46%;
        background: linear-gradient(100deg, rgba(255, 240, 200, 0) 0%, rgba(255, 240, 200, .16) 45%, rgba(255, 255, 255, .28) 50%, rgba(255, 240, 200, .16) 55%, rgba(255, 240, 200, 0) 100%);
        transform: translateX(-140%) skewX(-12deg);
        animation: az-crest-shine 7s ease-in-out 1.2s infinite;
        pointer-events: none;
        z-index: 2;
        mix-blend-mode: screen;
    }

    @keyframes az-crest-shine {
        0% { transform: translateX(-140%) skewX(-12deg); }
        22%, 100% { transform: translateX(380%) skewX(-12deg); }
    }

    #main-header a.az-crest .az-crest__logo {
        display: block;
        flex: 0 0 auto;
        width: 112px;
        height: auto;
        filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .45)) !important;
        transition: width .45s cubic-bezier(.2, .8, .2, 1), transform .35s ease;
    }

    #main-header .az-crest__name {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-top: 6px;
        padding-top: 7px;
        position: relative;
        max-height: 60px;
        opacity: 1;
        transition: max-height .45s cubic-bezier(.2, .8, .2, 1), opacity .3s ease, margin .45s, padding .45s;
        white-space: nowrap;
    }

    /* خطِ باریکِ طلایی با الماسِ وسط، بینِ لوگو و نام */
    #main-header .az-crest__name::before {
        content: "";
        position: absolute;
        top: 0;
        left: 50%;
        width: 120px;
        height: 1px;
        transform: translateX(-50%);
        background: linear-gradient(90deg, rgba(217, 180, 95, 0), rgba(217, 180, 95, .9) 50%, rgba(217, 180, 95, 0));
    }

    #main-header .az-crest__name::after {
        content: "";
        position: absolute;
        top: -2.5px;
        left: 50%;
        width: 6px;
        height: 6px;
        transform: translateX(-50%) rotate(45deg);
        background: var(--crest-gold-1);
        box-shadow: 0 0 6px rgba(247, 228, 166, .8);
    }

    #main-header .az-crest__fa {
        font-family: "peyda", "yekan", sans-serif;
        font-weight: 900;
        font-size: 17px;
        line-height: 1.5;
        background: var(--crest-gold-txt);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent !important;
        -webkit-text-fill-color: transparent;
        filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .55));
    }

    #main-header .az-crest__en {
        direction: ltr;
        font-family: "Segoe UI", Tahoma, Arial, sans-serif;
        font-weight: 600;
        font-size: 8.5px;
        letter-spacing: .26em;
        margin-right: -.26em; /* جبرانِ فاصله‌ی آخرِ حروف تا دقیقاً وسط بیفتد */
        line-height: 1.6;
        color: rgba(236, 211, 150, .78) !important;
    }

    /* سه‌بعدیِ ظریف با هاور (بدون JS: کمی به جلو خم می‌شود و لوگو بالا می‌آید) */
    #main-header a.az-crest:hover {
        --crest-rx: 9deg;
    }

    #main-header a.az-crest:hover .az-crest__logo {
        transform: translateY(-2px) scale(1.04);
    }

    #main-header a.az-crest:focus-visible {
        outline: 2px solid var(--crest-gold-1);
        outline-offset: 3px;
    }

    /* بعد از اسکرول: فقط لوگو، نشان کوچک‌تر */
    html.az-crest-min #main-header .lg\:relative > a.az-crest {
        width: 136px;
        padding: 40px 12px 12px;
    }

    html.az-crest-min #main-header a.az-crest .az-crest__logo {
        width: 100px;
    }

    html.az-crest-min #main-header .az-crest__name {
        max-height: 0;
        opacity: 0;
        margin-top: 0;
        padding-top: 0;
    }
}

/* لپ‌تاپِ کوچک (1024–1279): نشان باریک‌تر تا رویِ شماره‌ی تلفنِ نوارِ بالا نیفتد */
@media (min-width: 1024px) and (max-width: 1279.98px) {
    #main-header .lg\:relative > a.az-crest {
        width: 146px;
        padding-left: 8px;
        padding-right: 8px;
    }

    #main-header a.az-crest .az-crest__logo {
        width: 94px;
    }

    #main-header .az-crest__name::before {
        width: 96px;
    }

    #main-header .az-crest__fa {
        font-size: 14px;
    }

    #main-header .az-crest__en {
        font-size: 7px;
        letter-spacing: .14em;
        margin-right: -.14em;
    }

    html.az-crest-min #main-header .lg\:relative > a.az-crest {
        width: 118px;
    }

    html.az-crest-min #main-header a.az-crest .az-crest__logo {
        width: 88px;
    }
}

/* -------------------------------------------------------- تبلت و موبایل */
@media (max-width: 1023.98px) {
    #main-header .lg\:relative > a.az-lockup {
        display: flex;
        align-items: center;
        gap: 9px;
        position: static;
        margin: 0;
        padding: 0;
        transform: none;
        text-decoration: none;
        min-width: 0;
    }

    #main-header a.az-lockup .az-lockup__logo {
        display: block;
        flex: 0 0 auto;
        width: auto;
        height: 54px;
        max-width: none;
        object-fit: contain;
        margin: 0;
        filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .45)) !important;
    }

    #main-header .az-lockup__name {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding-right: 10px;
        border-right: 1px solid rgba(217, 180, 95, .55);
        white-space: nowrap;
        min-width: 0;
    }

    #main-header .az-lockup__fa {
        font-family: "peyda", "yekan", sans-serif;
        font-weight: 900;
        font-size: 16px;
        line-height: 1.45;
        background: var(--crest-gold-txt);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent !important;
        -webkit-text-fill-color: transparent;
    }

    #main-header .az-lockup__en {
        direction: ltr;
        font-family: "Segoe UI", Tahoma, Arial, sans-serif;
        font-weight: 600;
        font-size: 7.5px;
        letter-spacing: .2em;
        line-height: 1.5;
        color: rgba(236, 211, 150, .75) !important;
    }
}

/* گوشی: لوگو کوچک‌تر، فقط نام فارسی؛ دکمه‌ی واتساپِ هدر آیکونی می‌شود
   (نسخه‌ی کامل «واتساپ» و «تماس فوری» در نوارِ پایینِ صفحه هست). */
@media (max-width: 600px) {
    #main-header .lg\:relative > a.az-lockup {
        gap: 7px;
    }

    #main-header a.az-lockup .az-lockup__logo {
        height: 46px;
    }

    #main-header .az-lockup__name {
        padding-right: 7px;
    }

    #main-header .az-lockup__fa {
        font-size: 13.5px;
    }

    #main-header .az-lockup__en {
        display: none;
    }

    #main-header .wa-lux {
        gap: 0 !important;
        padding: .45rem .55rem !important;
    }

    #main-header .wa-lux .wa-tx {
        display: none;
    }
}

@media (max-width: 340px) {
    #main-header .az-lockup__fa {
        font-size: 12px;
    }
}

/* مرورگری که background-clip:text ندارد (یا حالت کنتراست بالا): طلاییِ ساده، نه متنِ ناپیدا */
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
    #main-header .az-crest__fa,
    #main-header .az-lockup__fa {
        background: none;
        color: #e2bd68 !important;
        -webkit-text-fill-color: #e2bd68;
    }
}

@media (forced-colors: active) {
    #main-header .az-crest__fa,
    #main-header .az-lockup__fa {
        background: none;
        color: CanvasText !important;
        -webkit-text-fill-color: CanvasText;
    }
}

@media (prefers-reduced-motion: reduce) {
    #main-header .az-crest__shine {
        animation: none;
        display: none;
    }

    #main-header a.az-crest,
    #main-header a.az-crest *,
    #main-header .az-crest__name {
        transition: none !important;
    }
}
