/* Bitigçi mobil katmanı (≤767 px): sayfa yerleşimi, okunur yazı boyu, dokunma hedefleri,
 * geniş tablo/grafik kaydırıcıları ve alt gezinme çubuğu. Masaüstü görünümünü değiştirmez;
 * yalnız yinelenen sayfa yolu gizlemesi her genişlikte geçerlidir.
 * Betik: /static/bitigci-mobile.js (alt gezinme, kaydırıcı sarma, uzun tanık listeleri). */

/* Madde sayfasında içerikte ayrı sayfa yolu varsa başlıktaki ikincisi yinelemedir. */
body:has(nav[aria-label="breadcrumb"]) header div:has(> nav[aria-label="Breadcrumb"]) {
  display: none;
}

@media (max-width: 767px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  /* Yana kayan sayfa olmasın: taşan öğe kendi kaydırıcısında kalır. */
  html,
  body {
    overflow-x: clip;
  }

  /* iOS 16 px altındaki alanlara dokununca sayfayı büyütür. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  select,
  textarea {
    font-size: 16px !important;
  }

  pre {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  code,
  kbd,
  samp {
    overflow-wrap: anywhere;
  }

  pre code {
    overflow-wrap: normal;
  }

  /* ---- Sayfa başlığı: logo küçülmez, başlık yanında sığar ---- */
  .flex:has(> a[aria-label="Bitigçi ana sayfası"]) {
    flex-wrap: nowrap;
    align-items: flex-start;
  }

  a[aria-label="Bitigçi ana sayfası"] {
    flex: 0 0 auto;
  }

  a[aria-label="Bitigçi ana sayfası"] > span.w-11 {
    width: 40px;
    height: 40px;
  }

  a[aria-label="Bitigçi ana sayfası"] + div {
    flex: 1 1 auto;
    min-width: 0;
  }

  a[aria-label="Bitigçi ana sayfası"] + div h1 {
    font-size: clamp(1.3rem, 6.2vw, 1.7rem);
    line-height: 1.18;
    overflow-wrap: break-word;
  }

  a[aria-label="Bitigçi ana sayfası"] + div h1 + p,
  a[aria-label="Bitigçi ana sayfası"] + div p.text-base {
    margin-top: 2px;
    font-size: 0.9rem;
    line-height: 1.4;
  }

  header > div.py-4,
  body > div.bg-white > div.py-4 {
    padding-top: 12px;
    padding-bottom: 12px;
    gap: 10px;
  }

  nav[aria-label="breadcrumb"] a,
  nav[aria-label="Breadcrumb"] a {
    display: inline-block;
    padding: 6px 2px;
  }

  /* ---- Ortak arama çubuğu: tek satır, okunur ipucu, iOS büyütmesi yok ---- */
  html body .gts-global-search__inner {
    padding: 8px 12px 10px;
  }

  html body .gts-global-search__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  html body .gts-global-search .ss-wrap:has(> .bss-local-modes) {
    display: flex;
    align-items: stretch;
    gap: 8px;
  }

  html body .gts-global-search .ss-wrap > input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 46px;
    font-size: 16px;
    border-radius: 12px;
  }

  html body .gts-global-search .bss-local-modes {
    flex: 0 0 auto;
    margin-top: 0;
  }

  html body .gts-global-search .bss-local-modes button {
    height: 100%;
    min-height: 46px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 14px;
    white-space: nowrap;
  }

  /* ---- Okunurluk: 12 px altına inen etiket ve üst bilgiler ---- */
  .text-\[9px\],
  .text-\[10px\],
  .text-\[11px\],
  .rv-item-meta,
  .rv-count,
  .tbld-position-label,
  .lp-badge,
  .lp-mini .lp-badge,
  .lp-mini-title,
  .lp-mini-note,
  .lp-metric span,
  .lp-card h4,
  .oed-pill,
  .kanit-context-chip,
  .gts-def-test-result,
  .gts-def-badge,
  .gts-def-meta,
  .neo-badge,
  .neo-metric-label,
  .neo-metric-note,
  .cf-entry-card__type,
  .cf-confidence,
  .cf-entry-card__meta span,
  .cf-summary-strip span,
  .gts-def-score-head span,
  .gts-def-analysis dt,
  .neo-profile-cell b {
    font-size: 12px !important;
  }

  /* Tablo hücreleri tablodan küçük yazı devralıyorsa en az 12 px (sınıfla boyut verilmişse dokunmaz). */
  :where(td, th) {
    font-size: max(12px, 1em);
  }

  /* ---- Kartlar: dar ekranda iç boşluk daha az, metin sütunu daha geniş ---- */
  main .p-6,
  main .p-8 {
    padding: 1rem;
  }

  main .px-6,
  main .px-8 {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  main .rounded-xl.p-5,
  main details.p-5 {
    padding: 1rem;
  }

  /* ---- Madde sayfası ---- */
  body .lp-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body .lp-metric b {
    font-size: 0.86rem;
  }

  .lp-table td,
  .lp-table th {
    overflow-wrap: anywhere;
  }

  [data-tarihsel-derlem-kart] > summary h2 {
    font-size: 1.15rem;
    line-height: 1.3;
  }

  li > a:only-child {
    padding-block: 3px;
  }

  /* Kavram alanları: uzun sürüm etiketi başlığı taşırmasın */
  .cf-section-heading {
    flex-wrap: wrap;
  }

  .cf-version {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  /* ---- Geniş tablo ve grafik kaydırıcısı ---- */
  .bx-kaydir {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .bx-kaydir-ipucu {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 6px 0 4px;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
  }

  .bx-kaydir-ipucu svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
  }

  .bx-sag-var {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
  }

  .bx-sol-var {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 32px);
    mask-image: linear-gradient(to right, transparent, #000 32px);
  }

  .bx-sol-var.bx-sag-var {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 40px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 40px), transparent);
  }

  /* ---- Uzun tanık listeleri: ilk birkaçı, sonra "tümünü göster" ---- */
  .bx-kisa-gizli {
    display: none !important;
  }

  .bx-tumu {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-height: 46px;
    margin: 10px 0 4px;
    border: 1px solid #c7d2fe;
    border-radius: 12px;
    background: #eef2ff;
    color: #3730a3;
    font: 700 15px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
    cursor: pointer;
  }

  /* ---- Alt gezinme çubuğu ---- */
  .bx-alt {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgb(15 23 42 / 8%);
    background: rgb(255 255 255 / 92%);
    box-shadow: 0 -8px 28px rgb(15 23 42 / 8%);
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    backdrop-filter: saturate(1.6) blur(14px);
    transition: transform 0.24s ease;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  }

  .bx-alt--gizli {
    transform: translateY(115%);
  }

  .bx-alt__oge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 50px;
    padding: 2px 0;
    border: 0;
    border-radius: 14px;
    background: none;
    color: #475569;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.1;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .bx-alt__simge {
    display: grid;
    place-items: center;
    width: 52px;
    height: 28px;
    border-radius: 999px;
    transition: background-color 0.15s ease;
  }

  .bx-alt__simge svg {
    width: 22px;
    height: 22px;
  }

  .bx-alt__oge[aria-current="page"],
  .bx-alt__oge[aria-expanded="true"] {
    color: #3730a3;
  }

  .bx-alt__oge[aria-current="page"] .bx-alt__simge,
  .bx-alt__oge[aria-expanded="true"] .bx-alt__simge,
  .bx-alt__oge:active .bx-alt__simge {
    background: #e0e7ff;
  }

  .bx-alt__oge:focus-visible {
    outline: 3px solid rgb(79 70 229 / 35%);
    outline-offset: 1px;
  }

  .bx-alt__oge[data-bx-yukari][aria-disabled="true"] {
    opacity: 0.45;
  }

  .bx-alt-bosluk {
    padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .bx-alt,
  .bx-alt__simge {
    transition: none;
  }
}

@media print {
  .bx-alt,
  .bx-kaydir-ipucu,
  .bx-tumu {
    display: none !important;
  }

  .bx-kisa-gizli {
    display: revert !important;
  }
}
