/* ==========================================================================
   MOBILE CORE V3 — KURUMSAL WEB SİTESİ MOBİL KABUK STANDARDI (CSS)
   Kapsam: htmlandhtml.com ana sayfa ve tüm kurumsal/hizmet/sektör sayfaları
   Sözleşme:
   - Tüm kurallar yalnızca @media (max-width: 768px) altında ve --mc-* / mc-web-* önekiyle çalışır.
   - Masaüstü (> 768px) görünümüne ve mega menüye hiçbir müdahale yapılmaz.
   - >= 48x48 CSS px dokunma hedefi | >= 16px form/girdi metni | CLS <= 0.1 | 0px taşma
   ========================================================================== */

:root {
  --mc-bg: #F8FAFC;
  --mc-surface: #FFFFFF;
  --mc-surface-2: #EEF2F7;
  --mc-surface-glass: rgba(255, 255, 255, 0.94);
  --mc-ink: #0F172A;
  --mc-ink-2: #334155;
  --mc-muted: #526277;
  --mc-line: #D8E2EE;
  --mc-line-strong: #BCCBE0;
  --mc-brand: #714B67;
  --mc-brand-strong: #5E3D55;
  --mc-brand-tint: #F5EFF4;
  --mc-on-brand: #FFFFFF;
  --mc-accent: #1E3A5F;
  --mc-focus-ring: #714B67;
  --mc-scrim: rgba(15, 23, 42, 0.56);
  --mc-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --mc-shadow-xl: 0 24px 64px rgba(15, 23, 42, 0.22);
  --mc-topbar-h: 60px;
  --mc-bottom-h: 68px;
  --mc-sat: env(safe-area-inset-top, 0px);
  --mc-sab: env(safe-area-inset-bottom, 0px);
  --mc-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mc-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

/* Masaüstü (> 768px) Koruma Kalkanı */
@media (min-width: 769px) {
  .mc-web-svg,
  .mc-web-topbar,
  .mc-web-bottom-nav,
  .mc-web-sheet-layer {
    display: none !important;
  }
}

/* ==========================================================================
   MOBİL KABUK KURALLARI (<= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  html,
  body {
    max-width: 100% !important;
    overflow-x: clip !important;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
  }

  body {
    padding-top: calc(var(--mc-topbar-h) + var(--mc-sat)) !important;
  }

  body.mc-web-has-bottom {
    padding-bottom: calc(var(--mc-bottom-h) + var(--mc-sab) + 18px) !important;
  }

  /* Form sayfalarında alt çubuk gizlendiği için ekstra alt boşluk gerekmez */
  body.mc-web-form-page {
    padding-bottom: calc(20px + var(--mc-sab)) !important;
  }

  /* Mevcut masaüstü/eski mobil header ve yüzen WhatsApp balonu mobilde kabuğa devredilir */
  body.mc-web-ready > header.header,
  body.mc-web-ready > .header,
  .hh-floating-wa {
    display: none !important;
  }

  /* Klavye Odak Halkası */
  .mc-web-topbar :focus-visible,
  .mc-web-bottom-nav :focus-visible,
  .mc-web-sheet-layer :focus-visible {
    outline: 3px solid var(--mc-focus-ring) !important;
    outline-offset: 2px !important;
    border-radius: 8px;
  }

  .mc-web-svg {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
  }
  svg.mc-ico {
    display: block;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.95;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  /* ---------------- 1. MOBİL ÜST ÇUBUK (60px + safe-area) ---------------- */
  .mc-web-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--mc-topbar-h) + var(--mc-sat));
    padding: var(--mc-sat) 10px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    background: var(--mc-surface-glass);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    backdrop-filter: blur(16px) saturate(1.4);
    border-bottom: 1px solid var(--mc-line);
    color: var(--mc-ink);
    font-family: var(--mc-font);
    z-index: 9990;
    box-shadow: var(--mc-shadow-xs);
  }

  .mc-web-topbar-start {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    flex: 1;
  }

  .mc-web-brand-btn {
    min-height: 48px !important;
    padding: 4px 8px;
    border-radius: 12px;
    border: 0;
    background: transparent;
    color: var(--mc-ink);
    display: inline-flex;
    align-items: center;
    gap: 9px;
    text-decoration: none !important;
    min-width: 0;
    cursor: pointer;
    touch-action: manipulation;
  }
  .mc-web-brand-btn:active {
    background: var(--mc-surface-2);
  }
  .mc-web-brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--mc-brand);
    color: var(--mc-on-brand);
    display: grid;
    place-items: center;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    flex-shrink: 0;
  }
  .mc-web-brand-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
  }
  .mc-web-brand-title {
    font-size: 0.9375rem;
    font-weight: 850;
    letter-spacing: -0.025em;
    color: var(--mc-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
  }
  .mc-web-brand-sub {
    font-size: 0.6875rem;
    font-weight: 650;
    color: var(--mc-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
  }

  .mc-web-context-title {
    font-size: 0.9375rem;
    font-weight: 820;
    letter-spacing: -0.02em;
    color: var(--mc-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 4px;
  }

  .mc-web-topbar-end {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
  }

  /* Zorunlu 48x48 CSS px İkon Butonu */
  .mc-web-icon-btn {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    border-radius: 14px;
    border: 0;
    background: transparent;
    color: var(--mc-ink);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.14s, transform 0.12s;
  }
  .mc-web-icon-btn:hover,
  .mc-web-icon-btn:active {
    background: var(--mc-surface-2);
  }
  .mc-web-icon-btn[hidden],
  .mc-web-brand-btn[hidden],
  .mc-web-context-title[hidden],
  .mc-web-sheet-layer[hidden],
  .mc-web-bottom-nav[hidden] {
    display: none !important;
  }

  /* ---------------- 2. BAĞLAMSAL ALT DÖNÜŞÜM ÇUBUĞU (68px + safe-area) ---------------- */
  .mc-web-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: calc(var(--mc-bottom-h) + var(--mc-sab));
    padding: 8px 12px calc(8px + var(--mc-sab));
    background: var(--mc-surface-glass);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    backdrop-filter: blur(16px) saturate(1.4);
    border-top: 1px solid var(--mc-line);
    font-family: var(--mc-font);
    z-index: 9990;
    transition: transform 0.2s var(--mc-ease), opacity 0.2s;
  }

  html.mc-web-keyboard-open .mc-web-bottom-nav {
    transform: translateY(110%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .mc-web-cta-bar {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 8px;
    align-items: center;
  }

  .mc-web-btn {
    min-height: 50px !important;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-family: var(--mc-font);
    font-size: 0.875rem;
    font-weight: 780;
    line-height: 1.2;
    text-align: center;
    text-decoration: none !important;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.15s, transform 0.12s;
  }
  .mc-web-btn:active {
    transform: scale(0.985);
  }
  .mc-web-btn-primary {
    background: var(--mc-brand) !important;
    color: var(--mc-on-brand) !important;
  }
  .mc-web-btn-primary:hover {
    background: var(--mc-brand-strong) !important;
  }
  .mc-web-btn-secondary {
    background: var(--mc-surface) !important;
    border-color: var(--mc-line-strong) !important;
    color: var(--mc-ink) !important;
  }

  /* ---------------- 3. SÜRÜKLENEBİLİR BOTTOM SHEET (ARAMA & AKORDEON MENÜ) ---------------- */
  .mc-web-sheet-layer {
    position: fixed;
    inset: 0;
    background: var(--mc-scrim);
    z-index: 9998;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    font-family: var(--mc-font);
    color: var(--mc-ink);
  }
  .mc-web-sheet-box {
    width: 100%;
    max-height: 88dvh;
    background: var(--mc-surface);
    border-radius: 24px 24px 0 0;
    box-shadow: var(--mc-shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: mcWebSheetRise 0.22s var(--mc-ease);
  }
  @keyframes mcWebSheetRise {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .mc-web-sheet-handle {
    padding: 10px 0 4px;
    display: grid;
    place-items: center;
    cursor: grab;
    touch-action: none;
  }
  .mc-web-sheet-handle i {
    display: block;
    width: 42px;
    height: 5px;
    border-radius: 99px;
    background: var(--mc-line-strong);
  }
  .mc-web-sheet-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 12px 10px 18px;
    border-bottom: 1px solid var(--mc-line);
  }
  .mc-web-sheet-title {
    font-size: 1.05rem;
    font-weight: 820;
    letter-spacing: -0.02em;
    color: var(--mc-ink);
    margin: 0;
  }
  .mc-web-sheet-scroll {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 14px 16px calc(24px + var(--mc-sab));
  }

  .mc-web-search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 14px;
    border-radius: 14px;
    background: var(--mc-surface);
    border: 1px solid var(--mc-line-strong);
    box-shadow: var(--mc-shadow-xs);
    margin-bottom: 12px;
  }
  .mc-web-search-box input {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    border: 0 !important;
    background: transparent !important;
    color: var(--mc-ink) !important;
    font-size: 16px !important;
    outline: none !important;
  }

  .mc-web-stack {
    display: grid;
    gap: 8px;
  }
  .mc-web-section-lbl {
    font-size: 0.72rem;
    font-weight: 820;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mc-muted);
    margin: 12px 2px 6px;
  }

  .mc-web-nav-row {
    width: 100%;
    min-height: 52px !important;
    padding: 10px 13px;
    border-radius: 14px;
    background: var(--mc-surface);
    border: 1px solid var(--mc-line);
    color: var(--mc-ink) !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-decoration: none !important;
    font-size: 0.90625rem;
    font-weight: 720;
    box-shadow: var(--mc-shadow-xs);
  }
  .mc-web-nav-row small {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mc-muted);
    margin-top: 2px;
  }

  /* Akordeon Grupları (Mega Menü Bağlantıları) */
  .mc-web-acc {
    background: var(--mc-surface);
    border: 1px solid var(--mc-line);
    border-radius: 16px;
    overflow: hidden;
  }
  .mc-web-acc summary {
    min-height: 54px !important;
    padding: 12px 15px;
    font-size: 0.9375rem;
    font-weight: 780;
    color: var(--mc-ink);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .mc-web-acc summary::-webkit-details-marker {
    display: none;
  }
  .mc-web-acc-body {
    border-top: 1px solid var(--mc-line);
    padding: 8px 10px 12px;
    display: grid;
    gap: 6px;
    background: var(--mc-bg);
  }
  .mc-web-acc-group-title {
    font-size: 0.72rem;
    font-weight: 820;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--mc-brand);
    padding: 8px 6px 2px;
  }
  .mc-web-acc-link {
    min-height: 48px !important;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--mc-surface);
    border: 1px solid var(--mc-line);
    color: var(--mc-ink) !important;
    text-decoration: none !important;
    font-size: 0.875rem;
    font-weight: 680;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  /* ---------------- 4. MOBİL İÇERİK AKIŞI, CLS SABİTLEME & 48PX ERGONOMİ ---------------- */
  /* Hero Dönen Başlık CLS Sabitlemesi */
  [data-hh-hero-rotator] {
    min-height: 118px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
  }

  /* Hero çift CTA: yalnızca birincil buton baskın dolgu, ikincil buton çerçeveli */
  .hero-actions .btn-secondary,
  .hero-cta-row .btn-secondary {
    background: var(--mc-surface) !important;
    color: var(--mc-ink) !important;
    border: 1.5px solid var(--mc-line-strong) !important;
  }
  .hero-actions .btn,
  .hero-cta-row .btn {
    min-height: 50px !important;
  }

  /* 48x48px Dokunma Hedefleri: Toggle, Saha Filtreleri, Akışı Durdur, 71 Hizmet Akordeonu */
  .hh-toggle,
  .hh-toggle-wrap label,
  .hh-wa-filter-btn,
  .hh-wa-pause-btn,
  details > summary {
    min-height: 48px !important;
  }
  .hh-wa-filter-btn,
  .hh-wa-pause-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 16px !important;
  }

  /* Yatay Kaydırma Şeritleri İzolasyonu (0px Sayfa Taşması) */
  section,
  main,
  .hh-wa-marquee,
  .hh-sector-reel-section,
  .catalog,
  .pricing-grid,
  .compare-grid {
    max-width: 100% !important;
    overflow-x: clip !important;
  }

  /* Form Alanları: 16px Font + min-height 52px (iOS Zoom Engelleme) */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
  select,
  textarea {
    font-size: 16px !important;
    min-height: 52px !important;
  }

  /* Reduced Motion Desteği */
  @media (prefers-reduced-motion: reduce) {
    .hh-wa-track,
    [data-hh-hero-rotator] * {
      animation: none !important;
      transition: none !important;
    }
  }

  /* 320px Kompakt Ekran Güvencesi */
  @media (max-width: 379px) {
    [data-hh-hero-rotator] {
      min-height: 136px !important;
    }
    .mc-web-cta-bar {
      grid-template-columns: 1fr 1.15fr;
      gap: 6px;
    }
    .mc-web-btn {
      padding: 8px 10px;
      font-size: 0.8125rem;
    }
  }
}
