/* M Branding — telefon versiyasi.
   theme-dark.css dan KEYIN ulanadi. Sahifalardagi stillar inline yozilgani uchun
   bu yerda `mbm-*` klasslari va !important ishlatiladi. Desktopga ta'sir qilmaydi:
   barcha qoidalar media query ichida. */

/* Dock (pastki panel) desktopda umuman ko'rinmaydi */
.mbm-dock, .mbm-menu-extra { display: none; }

/* ───────────── Planshet: 761–1080px ───────────── */
@media (max-width: 1080px) {
  .mbm-meta { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; row-gap: 28px !important; }
  #mb-gal-3, #mb-gal-3b { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  #mb-head { max-width: min(62%, 860px) !important; width: auto !important; height: auto !important; margin: 0 !important; }
}

@media (max-width: 860px) {
  .mbm-story { grid-template-columns: 1fr !important; }
}

/* ───────────── Telefon: ≤760px ───────────── */
@media (max-width: 760px) {
  html { -webkit-text-size-adjust: 100%; }
  body { -webkit-tap-highlight-color: transparent; }

  /* ── Header ── */
  .mbm-header-bar {
    height: 64px !important;
    padding: 0 16px 0 20px !important;
    gap: 12px !important;
  }
  .mbm-logo { flex: 0 0 auto !important; }
  .mbm-logo img { width: 118px !important; height: auto !important; }
  .mbm-lang, .mbm-hcta { display: none !important; }
  .mbm-burger {
    height: 40px !important;
    padding: 0 16px 0 18px !important;
    gap: 12px !important;
    font-size: 12px !important;
  }

  /* ── Menyu (to'liq ekran) ── */
  .mbm-menu {
    justify-content: flex-start !important;
    padding: 96px 20px calc(28px + env(safe-area-inset-bottom)) !important;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .mbm-close {
    top: 12px !important;
    right: 16px !important;
    height: 40px !important;
    padding: 0 16px 0 18px !important;
    border-width: 1.5px !important;
    font-size: 12px !important;
  }
  .mbm-nav { gap: 2px !important; }
  .mbm-nav a {
    font-size: clamp(40px, 12vw, 54px) !important;
    gap: 14px !important;
    padding: 6px 0 10px !important;
    border-bottom: 1px solid var(--color-divider);
  }
  .mbm-nav a > span:first-child { font-size: 11px !important; min-width: 18px; }

  .mbm-menu-extra {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    margin-top: 28px;
  }
  .mbm-menu-lang {
    display: flex;
    gap: 8px;
  }
  .mbm-menu-lang button {
    flex: 1 1 0;
    height: 44px;
    border-radius: 999px;
    border: 1.5px solid var(--color-divider);
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: border-color .3s, color .3s;
  }
  .mbm-menu-lang button[style*="accent"] { border-color: var(--color-accent); }
  .mbm-menu-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 26px;
    border-radius: 999px;
    background: var(--color-accent);
    color: #0b0b0b !important;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .mbm-menu-cta span:last-child { font-size: 16px; line-height: 1; }
  .mbm-menu-contacts {
    margin-top: 28px !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px !important;
    font-size: 14px !important;
    color: color-mix(in srgb, var(--color-text) 78%, transparent);
  }
  .mbm-menu-contacts a:nth-child(-n+2) { grid-column: 1 / -1; }

  /* ── Pastki tezkor panel ── */
  .mbm-dock {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 70;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border-radius: 999px;
    background: rgba(18, 17, 16, .78);
    border: 1px solid rgba(255, 255, 255, .08);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
    box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .9);
    animation: mbmDockIn .7s cubic-bezier(.16, 1, .3, 1) .9s both;
    transition: translate .5s cubic-bezier(.16, 1, .3, 1), opacity .35s ease;
  }
  html[data-mbm-dock="hide"] .mbm-dock { translate: 0 calc(100% + 28px); opacity: 0; pointer-events: none; }
  .mbm-dock-main {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 22px;
    border-radius: 999px;
    background: var(--color-accent);
    color: #0b0b0b !important;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .mbm-dock-arrow { font-size: 16px; line-height: 1; transition: transform .3s cubic-bezier(.16, 1, .3, 1); }
  .mbm-dock-main:active .mbm-dock-arrow { transform: translateX(4px); }
  .mbm-dock-icon {
    flex: 0 0 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .14);
    color: var(--color-text) !important;
  }
  .mbm-dock a:active { transform: scale(.96); }
  .mbm-dock a { transition: transform .2s cubic-bezier(.16, 1, .3, 1); }
  @keyframes mbmDockIn { from { opacity: 0; transform: translateY(120%); } to { opacity: 1; transform: none; } }

  /* ── Yakuniy CTA va footer ── */
  .mbm-cta > div { padding: 44px 20px 40px !important; }
  .mbm-cta h3 { font-size: clamp(32px, 9.4vw, 40px) !important; margin-bottom: 30px !important; }
  .mbm-cta-btns { width: 100%; flex-direction: column; align-items: stretch !important; gap: 10px !important; }
  .mbm-cta-btns a { width: 100%; height: 56px !important; justify-content: space-between; }
  .mbm-footer { padding: 40px 20px calc(108px + env(safe-area-inset-bottom)) !important; }
  .mbm-footer-grid { grid-template-columns: 1fr !important; gap: 22px !important; }
  body:not(:has(.mbm-dock)) .mbm-footer { padding-bottom: calc(40px + env(safe-area-inset-bottom)) !important; }
  .mbm-footer-grid a { padding: 3px 0; }

  /* ── Loyiha kartalari (Bosh sahifa + Portfolio): telefonda hover yo'q ── */
  [data-mbhref] { border-radius: 22px !important; }
  [data-mbhref] > div:last-child { aspect-ratio: 4 / 4.1 !important; padding: 20px !important; gap: 12px !important; }
  [data-mbhref] .mb-name { font-size: 26px !important; }

  /* ── Bosh sahifa: hero ── */
  #mb-hero { min-height: calc(100svh - 64px) !important; }
  .mbm-hero-in {
    min-height: calc(100svh - 64px) !important;
    padding: 28px 20px 96px !important;
  }
  #mb-head {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
  }
  #mb-head h1 { font-size: clamp(38px, 11vw, 52px) !important; }
  .mbm-hero-cta { flex-direction: column; gap: 14px !important; margin-top: 28px !important; }
  .mbm-hero-cta a { width: 100% !important; font-size: 11.5px !important; padding: 0 2px 14px !important; }
  .mbm-hero-foot { margin: 0 !important; align-items: stretch !important; }
  .mbm-hero-foot > span[title] { display: none !important; }
  #mb-info { width: 100% !important; gap: 14px !important; }
  #mb-info span { font-size: 10px !important; }
  #mb-info p { font-size: 15px !important; text-align: left !important; }
  #mb-scene { top: 50% !important; }
  #mb-scene-par { width: min(82vw, 38svh) !important; }

  /* ── Bosh sahifa: biz haqimizda (scroll bilan yonuvchi matn) ── */
  #mb-about { height: 190vh !important; }
  .mbm-about-in { padding: 88px 20px 96px !important; gap: 22px !important; }
  .mbm-about-top { grid-template-columns: 1fr !important; gap: 18px !important; }
  #mb-about-text { font-size: clamp(24px, 6.7vw, 32px) !important; line-height: 1.1 !important; }
  .mbm-about-bot { grid-template-columns: 1fr !important; gap: 18px !important; padding-bottom: 8px !important; }
  .mbm-about-bot > span:first-child { display: none; }
  .mbm-about-bot > p { font-size: 11px !important; }
  .mbm-about-side { justify-self: stretch !important; width: 100% !important; gap: 22px !important; }
  .mbm-about-side p { font-size: 15.5px !important; }
  .mbm-about-side a { width: 100% !important; }
  #mb-about-decor > div { transform-origin: center; scale: .6; }

  .mbm-marquee { font-size: 44px !important; }

  /* ── Bosh sahifa: xizmatlar ro'yxati ── */
  .mbm-svc-row {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    padding: 24px 4px 26px !important;
  }
  .mbm-svc-row > span:first-child {
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
  }
  .mbm-svc-row > span:first-child svg { width: 24px; height: 24px; }
  .mbm-svc-row > span:last-child > span:first-child { font-size: 28px !important; }
  .mbm-svc-row > span:last-child > span:last-child { font-size: 15.5px !important; line-height: 1.55 !important; }

  #mb-work { padding: 40px 20px 64px !important; }
  #mb-work-grid { gap: 14px !important; }

  /* ── Narxlar ── */
  .mbm-price-row {
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas: "num plus" "main main" "price price";
    gap: 12px 16px !important;
    padding: 26px 0 !important;
  }
  .mbm-price-row > :nth-child(1) { grid-area: num; padding-top: 0 !important; align-self: center; }
  .mbm-price-row > :nth-child(2) { grid-area: main; gap: 12px !important; }
  .mbm-price-row > :nth-child(2) > span:first-child { font-size: 32px !important; }
  .mbm-price-row > :nth-child(3) { grid-area: price; font-size: 22px !important; padding-top: 2px !important; }
  .mbm-price-row > :nth-child(4) { grid-area: plus; width: 36px !important; height: 36px !important; }
  .mbm-price-panel { grid-template-columns: 1fr !important; padding-bottom: 30px !important; }
  .mbm-price-panel > span:first-child { display: none; }
  .mbm-price-items { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px 16px !important; }

  /* ── Xizmatlar / Narxlar: tor ekranda ustun minimal kengligi sig'masligi mumkin ── */
  .mbm-svc-block, .mbm-note { grid-template-columns: minmax(0, 1fr) !important; }
  .mbm-svc-block { gap: 20px !important; }

  /* ── Aloqa ── */
  .mbm-contact { grid-template-columns: 1fr !important; gap: 48px !important; padding-top: 32px !important; }
  .mbm-contact .input {
    font-size: 16px !important;   /* iOS'da avtomatik zoom bo'lmasligi uchun */
    min-height: 50px;
    padding: 12px 14px !important;
  }
  .mbm-contact textarea.input { min-height: 132px; }
  .mbm-contact .field label { font-size: 12px !important; }
  .mbm-contact .btn-primary { width: 100%; height: 56px; justify-content: space-between !important; }
  .mbm-contact .btn-primary::after { content: "→"; font-size: 16px; }
  .mbm-contact a[href^="mailto"] { font-size: 17px !important; word-break: break-all; }

  /* ── Loyiha sahifalari ── */
  .mbm-meta { gap: 22px 16px !important; }
  .mbm-story { gap: 28px !important; }
  #mb-gal-2 { grid-template-columns: 1fr !important; gap: 12px !important; }
  div#mb-gal-2b { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  #mb-gal-2b > div { border-radius: 16px !important; }
  /* Vertikal vizuallar — barmoq bilan suriladigan lenta */
  #mb-gal-3, #mb-gal-3b {
    display: flex !important;
    gap: 10px !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin-inline: -24px;
    padding-inline: 24px;
    scroll-padding-inline: 24px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  #mb-gal-3::-webkit-scrollbar, #mb-gal-3b::-webkit-scrollbar { display: none; }
  #mb-gal-3 > div, #mb-gal-3b > div { flex: 0 0 74%; scroll-snap-align: start; border-radius: 18px !important; }
  .mbm-next { flex-direction: column; align-items: stretch !important; }
  .mbm-next > a { justify-content: space-between; width: 100%; }

  /* Umumiy: katta rasm burchaklari telefonda yumshoqroq */
  section div[style*="border-radius: 28px"], section + div[style*="border-radius: 28px"], section div[style*="border-radius:28px"], section + div[style*="border-radius:28px"] { border-radius: 20px !important; }
}

/* Sensorli ekranlarda hover yo'q: loyiha tavsifi doim ko'rinadi */
@media (hover: none) and (max-width: 1080px) {
  [data-mbhref] .mb-more {
    max-height: none !important;
    margin-top: 0 !important;
    opacity: 1 !important;
    transform: none !important;
  }
  [data-mbhref] .mb-more .mb-cta { display: none !important; }
  [data-mbhref] .mb-more > span:first-child {
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 14px !important;
  }
  [data-mbhref] .mb-name { transform: none !important; }
}

/* Juda tor ekranlar (≤360px) */
@media (max-width: 360px) {
  .mbm-logo img { width: 104px !important; }
  .mbm-dock-main { padding: 0 16px; font-size: 11.5px; }
  .mbm-dock-icon { flex-basis: 44px; width: 44px; height: 44px; }
  .mbm-price-items { grid-template-columns: 1fr !important; }
}

@media (prefers-reduced-motion: reduce) {
  .mbm-dock { animation: none; }
}
