/* ════════════════════════════════════════════════════════════
   TERAN ILDIZ — css/base.css   (v33 · 2/7)
   Reset · tipografika · fokus · scrollbar · boot · bo'sh holat
   ════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--ff-body);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--txt);
  background: var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,h2,h3,h4,h5 { font-family: var(--ff-display); color: var(--ink); line-height: 1.2; font-weight: 700; letter-spacing: -.015em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img, svg, video, canvas { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
ul, ol { list-style: none; }
::selection { background: var(--brand); color: #fff; }

/* Fokus halqasi — klaviatura uchun aniq ko'rinadigan */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--brand-hi); outline-offset: 2px; border-radius: 2px; }

/* Scrollbar — nozik, mavzuga mos */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Skip link */
.skip-link {
  position: fixed; top: -48px; left: 12px; z-index: 500;
  background: var(--brand); color: #fff; font-weight: 700; font-size: .85rem;
  padding: 10px 16px; border-radius: 0 0 var(--r) var(--r);
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: 0; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── Sahifa yuklanish chizig'i (motionfx.js: #fxProgress) —
     BBC uslubidagi tepa qizil ingichka progress ── */
#fxProgress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  z-index: 400; pointer-events: none; background: transparent;
}
#fxProgress .bar {
  height: 100%; width: 0;
  background: var(--brand);
  transition: width .12s linear, opacity .4s ease;
}

/* ── "Yuqoriga" tugmasi (motionfx.js: #fxTop) ── */
#fxTop {
  position: fixed; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 90; width: 44px; height: 44px;
  display: grid; place-items: center;
  background: var(--chrome-bg); color: var(--chrome-ink);
  border: 1px solid var(--chrome-bdr); border-radius: var(--r);
  box-shadow: var(--sh-md);
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
#fxTop.on { opacity: 1; transform: none; pointer-events: auto; }
#fxTop:hover { border-color: var(--brand); color: var(--brand-hi); }
@media (max-width: 768px) {
  #fxTop { bottom: calc(var(--tab-h) + 14px + env(safe-area-inset-bottom)); }
}

/* ── Boot: sahifa mazmuni bir tekis paydo bo'ladi ── */
body.ti-boot #nav,
body.ti-boot #catbar,
body.ti-boot .main { opacity: 0; }
#nav, #catbar, .main { animation: tiBootIn .5s var(--ease-out) both; }
#catbar { animation-delay: .06s; }
.main   { animation-delay: .12s; }
@keyframes tiBootIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Eski 3D fon (three-scene) — BBC yassi dizaynda o'chirilgan */
#ti3d-bg { display: none !important; }

/* ── Bo'sh holat ── */
.empty {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 72px 20px; text-align: center;
  border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--surf);
}
.empty i { font-size: 30px; color: var(--dim); }
.empty p { color: var(--muted); font-size: .95rem; max-width: 380px; }

/* ── "Davom etish" tugmasi ichidagi sarlavha (extras.js: .hr-t) ── */
.hr-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }

/* ── Save-Data / kam quvvat ── */
body.ti-savedata * { animation-duration: .01ms !important; transition-duration: .01ms !important; }

/* ── Harakat kamaytirilgan rejim ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
