/**
 * Raxmatilla.Announcement — Liquid Glass e'lon modali.
 * Tashqi bog'liqliksiz, faqat CSS. Barcha o'lchamlar `rem`/`clamp` asosida.
 */

.ann-modal {
    --ann-max-width: 560px;
    --ann-radius: 26px;
    --ann-surface: rgba(255, 255, 255, 0.62);
    --ann-surface-strong: rgba(255, 255, 255, 0.86);
    --ann-border: rgba(255, 255, 255, 0.55);
    --ann-text: #12161d;
    --ann-muted: #4c5566;
    --ann-accent: #0f5ef7;
    --ann-accent-text: #ffffff;
    --ann-shadow: 0 32px 80px -24px rgba(12, 18, 32, 0.45), 0 2px 8px rgba(12, 18, 32, 0.08);
    --ann-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ann-duration: 320ms;

    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: none;
    font-family: inherit;
}

.ann-modal[hidden] {
    display: none !important;
}

.ann-modal.is-mounted {
    display: block;
}

/* --------------------------------------------------------------- Backdrop */

.ann-modal__backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 120% at 50% 0%, rgba(18, 24, 38, 0.42), rgba(8, 11, 20, 0.66));
    -webkit-backdrop-filter: blur(14px) saturate(120%);
    backdrop-filter: blur(14px) saturate(120%);
    opacity: 0;
    transition: opacity var(--ann-duration) var(--ann-ease);
}

.ann-modal.is-open .ann-modal__backdrop {
    opacity: 1;
}

/* --------------------------------------------------------------- Viewport */

.ann-modal__viewport {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(0.75rem, 4vw, 2.5rem);
    padding-bottom: max(clamp(0.75rem, 4vw, 2.5rem), env(safe-area-inset-bottom));
    padding-top: max(clamp(0.75rem, 4vw, 2.5rem), env(safe-area-inset-top));
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* ----------------------------------------------------------------- Dialog */

.ann-modal__dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: var(--ann-max-width);
    max-height: calc(100dvh - clamp(1.5rem, 8vw, 5rem));
    border-radius: var(--ann-radius);
    border: 1px solid var(--ann-border);
    background: linear-gradient(
        160deg,
        rgba(255, 255, 255, 0.78) 0%,
        rgba(255, 255, 255, 0.55) 45%,
        rgba(246, 248, 252, 0.62) 100%
    );
    -webkit-backdrop-filter: blur(34px) saturate(180%);
    backdrop-filter: blur(34px) saturate(180%);
    box-shadow: var(--ann-shadow);
    color: var(--ann-text);
    overflow: hidden;
    opacity: 0;
    transform: translate3d(0, 14px, 0) scale(0.965);
    transition:
        opacity var(--ann-duration) var(--ann-ease),
        transform var(--ann-duration) var(--ann-ease);
    outline: none;
}

.ann-modal.is-open .ann-modal__dialog {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

/* Yuqori qirradagi nozik shisha yorug'ligi. */
.ann-modal__dialog::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(
        150deg,
        rgba(255, 255, 255, 0.95),
        rgba(255, 255, 255, 0.15) 32%,
        rgba(255, 255, 255, 0) 60%
    );
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* backdrop-filter bo'lmagan brauzerlar uchun to'liq shaffofmas fon. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .ann-modal__dialog {
        background: var(--ann-surface-strong);
    }

    .ann-modal__backdrop {
        background: rgba(10, 14, 24, 0.72);
    }
}

/* ------------------------------------------------------------ Yopish (x) */

.ann-modal__dismiss {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: var(--ann-text);
    cursor: pointer;
    transition: background 180ms var(--ann-ease), transform 180ms var(--ann-ease);
}

.ann-modal__dismiss:hover {
    background: rgba(255, 255, 255, 0.85);
}

.ann-modal__dismiss:active {
    transform: scale(0.94);
}

.ann-modal__dismiss svg {
    width: 1rem;
    height: 1rem;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    fill: none;
}

/* ------------------------------------------------------------------ Rasm */

.ann-modal__media {
    flex: 0 1 auto;
    margin: 0;
    aspect-ratio: 16 / 9;
    /* Uzun kontentda rasm butun modalni egallab olmasligi uchun cheklov. */
    max-height: min(34vh, 260px);
    min-height: 130px;
    background: rgba(255, 255, 255, 0.35);
    overflow: hidden;
}

.ann-modal__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Rasm yuklanmasa JS `.ann-modal__media` ni butunlay olib tashlaydi. */

/* ------------------------------------------------------------------ Matn */

.ann-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: clamp(1.25rem, 4vw, 1.9rem) clamp(1.25rem, 4vw, 1.9rem) clamp(0.75rem, 2.5vw, 1.1rem);
}

.ann-modal__dialog--textonly .ann-modal__body {
    padding-top: clamp(1.9rem, 6vw, 2.5rem);
}

.ann-modal__title {
    margin: 0;
    padding-right: 2.25rem;
    font-size: clamp(1.25rem, 1.05rem + 1vw, 1.65rem);
    font-weight: 650;
    line-height: 1.25;
    letter-spacing: -0.015em;
    color: var(--ann-text);
    overflow-wrap: anywhere;
}

.ann-modal__desc {
    margin-top: 0.75rem;
    font-size: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
    line-height: 1.6;
    color: var(--ann-muted);
    overflow-wrap: anywhere;
}

.ann-modal__desc > :first-child {
    margin-top: 0;
}

.ann-modal__desc > :last-child {
    margin-bottom: 0;
}

.ann-modal__desc p {
    margin: 0 0 0.7em;
}

.ann-modal__desc ul,
.ann-modal__desc ol {
    margin: 0 0 0.7em;
    padding-left: 1.25em;
}

.ann-modal__desc li {
    margin-bottom: 0.3em;
}

.ann-modal__desc a {
    color: var(--ann-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ann-modal__desc strong {
    color: var(--ann-text);
    font-weight: 600;
}

/* --------------------------------------------------------------- Tugmalar */

.ann-modal__actions {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
    padding: clamp(1.1rem, 3.5vw, 1.5rem) clamp(1.25rem, 4vw, 1.9rem);
    padding-bottom: max(clamp(1.1rem, 3.5vw, 1.5rem), env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.45);
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.28));
}

.ann-modal__actions--single {
    grid-template-columns: 1fr;
}

.ann-modal__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.875rem;
    padding: 0.6875rem 1.25rem;
    border-radius: 14px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition:
        transform 160ms var(--ann-ease),
        box-shadow 160ms var(--ann-ease),
        background 160ms var(--ann-ease);
}

.ann-modal__btn:active {
    transform: scale(0.985);
}

.ann-modal__btn--primary {
    background: var(--ann-accent);
    color: var(--ann-accent-text);
    box-shadow: 0 8px 20px -8px rgba(15, 94, 247, 0.75);
}

.ann-modal__btn--primary:hover {
    background: #0b4fd6;
    color: var(--ann-accent-text);
}

.ann-modal__btn--ghost {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(18, 22, 29, 0.1);
    color: var(--ann-text);
}

.ann-modal__btn--ghost:hover {
    background: rgba(255, 255, 255, 0.85);
}

/* ------------------------------------------------------------- Fokus holati */

.ann-modal :focus-visible {
    outline: 2px solid var(--ann-accent);
    outline-offset: 3px;
}

/* Dialog dasturiy ravishda fokuslanadi — ko'rinadigan halqa kerak emas. */
.ann-modal__dialog:focus,
.ann-modal__dialog:focus-visible {
    outline: none;
}

/* -------------------------------------------------------- Body scroll lock */

body.ann-modal-open {
    overflow: hidden;
}

/* ------------------------------------------------------------- Mobil ekran */

@media (max-width: 480px) {
    .ann-modal {
        --ann-radius: 22px;
    }

    .ann-modal__viewport {
        align-items: flex-end;
    }

    .ann-modal__dialog {
        max-height: calc(100dvh - 1.5rem);
    }

    .ann-modal__actions {
        grid-template-columns: 1fr;
    }

    .ann-modal__media {
        max-height: min(28vh, 200px);
    }
}

/* --------------------------------------------------- Qorong'i rejim (auto) */

@media (prefers-color-scheme: dark) {
    .ann-modal {
        --ann-surface: rgba(24, 28, 38, 0.62);
        --ann-surface-strong: rgba(24, 28, 38, 0.94);
        --ann-border: rgba(255, 255, 255, 0.14);
        --ann-text: #f2f4f8;
        --ann-muted: #aab2c2;
        --ann-shadow: 0 32px 80px -24px rgba(0, 0, 0, 0.72);
    }

    .ann-modal__dialog {
        background: linear-gradient(
            160deg,
            rgba(38, 44, 58, 0.78) 0%,
            rgba(24, 28, 38, 0.6) 48%,
            rgba(18, 21, 30, 0.7) 100%
        );
    }

    .ann-modal__dialog::before {
        background: linear-gradient(
            150deg,
            rgba(255, 255, 255, 0.32),
            rgba(255, 255, 255, 0.05) 34%,
            rgba(255, 255, 255, 0) 62%
        );
    }

    .ann-modal__dismiss,
    .ann-modal__btn--ghost {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.16);
        color: var(--ann-text);
    }

    .ann-modal__dismiss:hover,
    .ann-modal__btn--ghost:hover {
        background: rgba(255, 255, 255, 0.18);
    }

    .ann-modal__actions {
        border-top-color: rgba(255, 255, 255, 0.1);
        background: none;
    }
}

/* ------------------------------------------------- Harakatni kamaytirish */

@media (prefers-reduced-motion: reduce) {
    .ann-modal__backdrop,
    .ann-modal__dialog,
    .ann-modal__btn,
    .ann-modal__dismiss {
        transition-duration: 1ms !important;
    }

    .ann-modal__dialog {
        transform: none !important;
    }

    .ann-modal__btn:active,
    .ann-modal__dismiss:active {
        transform: none;
    }
}
