/* ============================================================
   BASE.CSS — Сброс, шрифты, базовая типографика, a11y-фокус
   Проект «Икра» · v413
   ============================================================ */

/* ---------- RESET ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin:0; padding:0; background:var(--bg); color:var(--text);
  font-family:"Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  width:100%; max-width:100%;
  overscroll-behavior:none;
  -webkit-user-select:none; user-select:none;
  -webkit-touch-callout:none;
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
  text-rendering: optimizeLegibility;
}

/* ЗАЩИТА ОТ РАЗРЫВА ВЕРСТКИ (Layout Shift) */
img, svg { max-width: 100%; height: auto; aspect-ratio: auto; }

/* Специфичная защита для логотипов в сплеш-скрине и онбординге */
#splash-screen img, .ob-body img { 
  max-width: 120px; 
  max-height: 120px; 
  width: 100%; 
  height: auto; 
  aspect-ratio: 1 / 1; 
  object-fit: contain;
}

/* ---------- PREMIUM TAP FEEDBACK (D-06: transform + opacity only) ---------- */
button, .btn, .icon-btn, .fab, .ayah-share-btn, .star-btn, .filter-chip, .preset-chip, .ob-option, .tasbih-card, .content-card, .dash-quote, .dash-quick, .continue-card, .cal-day, .nav button {
  transition: transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  will-change: transform, opacity;
}
button:active, .btn:active, .icon-btn:active, .star-btn:active, .filter-chip:active, .preset-chip:active, .ob-option:active, .cal-day:active, .nav button:active {
  transform: scale(var(--tap-scale));
  opacity: var(--tap-opacity);
}

/* ---------- FOCUS (a11y) ---------- */
:focus-visible { outline: 2px solid var(--gold-accent, var(--ar-g2)); outline-offset: 2px; border-radius: 6px; }

/* ---------- SCROLLBARS ---------- */
.list, .content-list, .detail-body, .fs-body, .cal, .settings, .form { scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: rgba(var(--accent-rgb), .25) transparent; }
.list::-webkit-scrollbar, .content-list::-webkit-scrollbar, .detail-body::-webkit-scrollbar, .fs-body::-webkit-scrollbar, .cal::-webkit-scrollbar, .settings::-webkit-scrollbar, .form::-webkit-scrollbar { width: 6px; }
.list::-webkit-scrollbar-thumb, .content-list::-webkit-scrollbar-thumb, .detail-body::-webkit-scrollbar-thumb, .fs-body::-webkit-scrollbar-thumb, .cal::-webkit-scrollbar-thumb, .settings::-webkit-scrollbar-thumb, .form::-webkit-scrollbar-thumb { background: rgba(var(--accent-rgb), .22); border-radius: 3px; }

/* ---------- VIEWPORT / ROOT ---------- */
html { height:100%; overflow:hidden; }
body {
  height:100%;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  padding-top: env(safe-area-inset-top);
  padding-bottom: 0;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}
html.is-ios body { height:100vh; }
html:not(.is-ios) body { height:100dvh; }

/* ---------- FORM ELEMENT RESET ---------- */
button, input, textarea, select { font-family:inherit; color:inherit; }
button { cursor:pointer; border:none; background:none; }
input, textarea { -webkit-user-select:text; user-select:text; }

@media (pointer: coarse) {
  input, textarea, select { font-size: 16px !important; }
}

/* ---------- ARABIC: ЕДИНЫЙ БЛОК (v413) ----------
   Один источник правды вместо трёх. Цвет и тень идут из токенов темы,
   поэтому отдельные dark/mono/prefers-color-scheme копии не нужны.
   Сплошной цвет, вес 500, line-height 2. Градиентов на буквах нет. */
.ar-font, [lang="ar"], [lang^="ar-"], .arabic, .read-ayah-ar,
.tasbih-card .ar, .mem-block .mb-ar, .content-card .c-ar, .dash-quote .dq-ar,
.smart-reminder-card .src-ar,
.bismillah-card .b-ar, .spiritual-card .sc-ar-bismillah, .spiritual-card .sc-ar-alyaq,
.counter .ar, .preview-card .pv-ar, .next-toast .nt-ar, .ob-ar-preview {
  font-family: "Noto Naskh Arabic", "Amiri", "SF Arabic", "Geeza Pro", serif;
  font-size-adjust: 0.52;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1, "rlig" 1;
  font-kerning: normal;
  font-synthesis: none;
  font-weight: 500;
  line-height: 2;
  letter-spacing: normal;
  word-spacing: normal;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  -webkit-text-fill-color: currentColor;
  color: var(--arabic-gold);
  filter: none;
  text-shadow: var(--arabic-depth, none);
}
.ar-font { display: block; max-width: 100%; min-width: 0; padding: 8px 0; }

/* Цветовые spans таджвида сохраняют свои цвета и получают ту же тень. */
.ar-font span[class*="tajweed-"], .read-ayah-ar span[class*="tajweed-"] {
  font-weight: 500; line-height: 2; text-shadow: inherit; background: none; -webkit-text-fill-color: currentColor;
}

/* ---------- HERO-БЛИК (вариант B) ----------
   Узкая полоса света проходит по буквам раз в 7 секунд.
   В состоянии покоя (0%..62%) полоса полностью выведена за пределы текста,
   поэтому статическое золото остаётся на 100% равномерным по яркости.
   data-t выставляет app.js. Только на hero-элементах. */
.spiritual-card .sc-ar-bismillah[data-t],
.spiritual-card .sc-ar-alyaq[data-t],
.dash-quote .dq-ar[data-t],
.bismillah-card .b-ar[data-t] { position: relative; }
.spiritual-card .sc-ar-bismillah[data-t]::after,
.spiritual-card .sc-ar-alyaq[data-t]::after,
.dash-quote .dq-ar[data-t]::after,
.bismillah-card .b-ar[data-t]::after {
  content: attr(data-t);
  position: absolute; inset: 0; padding: inherit;
  color: transparent; -webkit-text-fill-color: transparent; text-shadow: none; pointer-events: none;
  background: linear-gradient(105deg, transparent 36%, var(--arabic-shine) 50%, transparent 64%) -20% 0 / 260% 100% no-repeat;
  -webkit-background-clip: text; background-clip: text;
  animation: iqra-shine 7s ease-in-out infinite;
}
@keyframes iqra-shine { 0%, 62% { background-position: -20% 0; } 100% { background-position: 120% 0; } }

/* ---------- REDUCED MOTION (D-06) ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- FOCUS RING FOR FINE POINTERS ---------- */
@media (pointer: fine) {
  button:focus-visible,
  .btn:focus-visible,
  .icon-btn:focus-visible,
  .fab:focus-visible,
  .ayah-share-btn:focus-visible,
  .star-btn:focus-visible,
  .filter-chip:focus-visible,
  .preset-chip:focus-visible,
  .ob-option:focus-visible,
  .nav button:focus-visible,
  .seg button:focus-visible,
  .prog-tabs button:focus-visible,
  .cal-nav button:focus-visible,
  .cal-day:focus-visible,
  .stepper button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
}
button::-moz-focus-inner { border: 0; padding: 0; }

/* ---------- TOUCH TARGET SAFETY ---------- */
button, .btn, .icon-btn, .fab, .ayah-share-btn, .star-btn, .filter-chip, .preset-chip, .ob-option {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}


/* ============================================================
   IQRA V413 — ТИПОГРАФИКА ЛАТИНИЦЫ/КИРИЛЛИЦЫ
   ============================================================ */
html, body { line-height: 1.52; font-kerning: normal; font-optical-sizing: auto; }

/* Читабельность русских переводов и вспомогательных строк. */
.read-ayah-tr,
.read-ayah-trn,
.content-card .c-tr,
.detail-hero .dh-text,
.dash-quote .dq-tr,
.night-note,
.transcription-note {
  line-height: 1.68;
  text-wrap: pretty;
}

.read-ayah-trn {
  color: var(--text);
  font-size: clamp(15px, 3.8vw, 17px);
  font-weight: 400;
}

.read-ayah-tr {
  color: var(--muted);
  font-size: clamp(13px, 3.4vw, 14px);
  font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
}
