/* ==========================================================================
   Projukti Bari — i18n / Typography (2026-11-29)
   Noto Sans Bengali is no longer loaded (WebPageTest 2026-12-03) —
   Bengali uses only self-hosted Hind Siliguri woff2.
   Hind Siliguri 400/500/600/700 and Inter 400/500/600/700 are
   self-hosted woff2 in public/fonts/ — the @font-face rules below are
   the single copy shared by BOTH public layouts (layouts/app loads
   store.css too; layouts/public does not, so the rules live here).
   Font stacks are driven by the <html lang> attribute set by the
   locale middleware (bn = Bengali default, en = English).
   ========================================================================== */

/* Inter 400/500/600/700, Latin subset (SIL OFL, google/fonts).
   No unicode-range: same pattern as the Poppins rules in store.css —
   the file covers the Latin range the stacks need. */
@font-face{font-family:Inter;src:url(../fonts/inter-400-latin.woff2) format("woff2");font-weight:400;font-display:swap}
@font-face{font-family:Inter;src:url(../fonts/inter-500-latin.woff2) format("woff2");font-weight:500;font-display:swap}
@font-face{font-family:Inter;src:url(../fonts/inter-600-latin.woff2) format("woff2");font-weight:600;font-display:swap}
@font-face{font-family:Inter;src:url(../fonts/inter-700-latin.woff2) format("woff2");font-weight:700;font-display:swap}

/* HERO-UPGRADE round 3 (2026-12-03) — font-swap CLS fix (PSI mobile CLS
   0.176, single shift on section.hero, caused by inter-700 + hind-siliguri-700
   loading after first paint). The generic sans-serif fallback is 8-16%
   narrower than Inter, so hero text reflows when the webfont swaps in
   (measured hero-string widths, 2026-12-03: Roboto 0.90-0.93x, Arial
   0.91-0.94x, Noto Sans 0.84-0.92x of Inter; hero-sub wraps 3 lines in the
   fallback vs 4 in Inter, h1 3 vs 4, eyebrow 1 vs 2 at 390px). These fallback
   faces make the fallback render with Inter's metrics, so the swap changes no
   line breaks: size-adjust scales the fallback glyphs to Inter's advance
   width (per weight, from the measured hero-string ratios — the per-weight
   sweep matches Roboto's line counts at both 350px and 372px content widths),
   and ascent/descent/line-gap-override copy Inter's own vertical metrics
   (fontTools: upm 2048, ascent 1984, descent -494, lineGap 0). src lists the
   system sans on each platform (Android Roboto, Windows Arial / Helvetica
   Neue, Linux Noto / Liberation Sans) — whichever resolves gets the
   overrides. The webfont itself is unchanged; this only affects the brief
   fallback paint before it loads. */
@font-face{font-family:'Inter Fallback';src:local("Arial"),local("Helvetica Neue"),local("Roboto"),local("Noto Sans"),local("Liberation Sans");font-weight:400;font-display:swap;size-adjust:107%;ascent-override:96.88%;descent-override:24.12%;line-gap-override:0%}
@font-face{font-family:'Inter Fallback';src:local("Arial"),local("Helvetica Neue"),local("Roboto"),local("Noto Sans"),local("Liberation Sans");font-weight:500;font-display:swap;size-adjust:107%;ascent-override:96.88%;descent-override:24.12%;line-gap-override:0%}
@font-face{font-family:'Inter Fallback';src:local("Arial"),local("Helvetica Neue"),local("Roboto"),local("Noto Sans"),local("Liberation Sans");font-weight:600;font-display:swap;size-adjust:108%;ascent-override:96.88%;descent-override:24.12%;line-gap-override:0%}
@font-face{font-family:'Inter Fallback';src:local("Arial"),local("Helvetica Neue"),local("Roboto"),local("Noto Sans"),local("Liberation Sans");font-weight:700;font-display:swap;size-adjust:110%;ascent-override:96.88%;descent-override:24.12%;line-gap-override:0%}

/* Same treatment for Bengali glyphs (BN hero): the Bengali fallback is ~3-5%
   WIDER than Hind Siliguri (measured: Noto Sans Bengali h1 565.5 vs 549, sub
   862.7 vs 821.5; Lohit Bengali h1 595 vs 565, sub ~860 vs 818), so the
   fallback is scaled down slightly (line counts already match at 100%; the
   95-97% adjustment centres the widths so the swap is visually seamless
   too — and so the BN CTA buttons, which fit on one row at 412px in the
   webfont, also fit on one row in the fallback). src lists the Bengali
   system font on each platform — Lohit (Linux), Noto Sans Bengali (Android),
   Nirmala UI (Windows) — whichever resolves gets the overrides. NOTE:
   local("Noto Sans Bengali") does not resolve in this sandbox's Chromium
   (face status "error"), so Lohit is listed first to keep the face usable
   there; on Android the Noto entry is the one that resolves.
   Vertical metrics (fontTools: upm 1000, ascent 1116, descent -501,
   lineGap 0). */
@font-face{font-family:'Hind Siliguri Fallback';src:local("Lohit Bengali"),local("Noto Sans Bengali"),local("Nirmala UI"),local("Noto Sans"),local("Arial");font-weight:400;font-display:swap;size-adjust:95%;ascent-override:111.6%;descent-override:50.1%;line-gap-override:0%}
@font-face{font-family:'Hind Siliguri Fallback';src:local("Lohit Bengali"),local("Noto Sans Bengali"),local("Nirmala UI"),local("Noto Sans"),local("Arial");font-weight:600;font-display:swap;size-adjust:96%;ascent-override:111.6%;descent-override:50.1%;line-gap-override:0%}
@font-face{font-family:'Hind Siliguri Fallback';src:local("Lohit Bengali"),local("Noto Sans Bengali"),local("Nirmala UI"),local("Noto Sans"),local("Arial");font-weight:700;font-display:swap;size-adjust:97%;ascent-override:111.6%;descent-override:50.1%;line-gap-override:0%}

/* ---------- 1. Font stacks by language ---------- */

/* Bengali mode: Inter first so Latin words / digits inside Bengali text
   stay crisp; Bengali glyphs fall through to Hind Siliguri. */
html[lang="bn"] body {
  font-family: 'Inter', 'Inter Fallback', 'Hind Siliguri', 'Hind Siliguri Fallback', sans-serif;
}
html[lang="bn"] h1,
html[lang="bn"] h2,
html[lang="bn"] h3,
html[lang="bn"] h4,
html[lang="bn"] h5,
html[lang="bn"] h6,
html[lang="bn"] .btn,
html[lang="bn"] .pb-btn,
html[lang="bn"] button,
html[lang="bn"] input,
html[lang="bn"] select,
html[lang="bn"] textarea,
html[lang="bn"] nav a,
html[lang="bn"] .main-nav a {
  font-family: 'Inter', 'Inter Fallback', 'Hind Siliguri', 'Hind Siliguri Fallback', sans-serif;
}

/* English mode: Inter only. */
html[lang="en"] body {
  font-family: 'Inter', 'Inter Fallback', sans-serif;
}
html[lang="en"] h1,
html[lang="en"] h2,
html[lang="en"] h3,
html[lang="en"] h4,
html[lang="en"] h5,
html[lang="en"] h6,
html[lang="en"] .btn,
html[lang="en"] .pb-btn,
html[lang="en"] button,
html[lang="en"] input,
html[lang="en"] select,
html[lang="en"] textarea,
html[lang="en"] nav a,
html[lang="en"] .main-nav a {
  font-family: 'Inter', 'Inter Fallback', sans-serif;
}

/* ---------- 2. Bengali matra / spacing fix (Bengali mode only) ---------- */

/* Any letter-spacing breaks Bengali matra and conjunct letters, so force
   zero tracking everywhere in Bengali mode (overrides tracking-* classes). */
html[lang="bn"] * {
  letter-spacing: 0 !important;
}

/* Body line-height 1.7 (required range 1.65–1.75). */
html[lang="bn"] body {
  line-height: 1.7;
}

/* Heading line-height 1.35 (required range 1.3–1.4). */
html[lang="bn"] h1,
html[lang="bn"] h2,
html[lang="bn"] h3,
html[lang="bn"] h4,
html[lang="bn"] h5,
html[lang="bn"] h6 {
  line-height: 1.35;
}

/* Buttons keep comfortable leading and never re-introduce tracking. */
html[lang="bn"] .btn,
html[lang="bn"] .pb-btn,
html[lang="bn"] button {
  line-height: 1.5;
  letter-spacing: 0 !important;
}

/* ---------- 3. Responsive overflow guards (both languages) ---------- */

.main-nav a,
.btn,
.pb-btn,
.pb-tabs a {
  overflow-wrap: break-word;
}

img,
svg,
video {
  max-width: 100%;
}

/* Long Bengali words must never overflow nav / buttons / cards — but
   NEVER word-break: break-all on Bengali text: it would split conjuncts
   and detach matra. keep-all + anywhere wraps only at safe boundaries. */
html[lang="bn"] .main-nav a,
html[lang="bn"] .btn {
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* ---------- 4. Language toggle: always one line (BUG-028) ---------- */

/* The toggle had NO rules at all, so "বাংলা | EN" wrapped freely once the
   nav ran out of room. It is a single flex row that never wraps, in the
   desktop header and in the mobile header alike. */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex: none;
}
/* BUG-117: the toggle links were 27px tall (no padding) — 9px vertical
   padding makes them ~45px tall. The "EN" link stays ~34px wide: the pair
   forms one 80×45px segmented control, and a mis-tap only switches language
   (documented exception — widening it to 44px would break the flow header
   fit at 320px). */
.lang-toggle a {
  white-space: nowrap;
  padding: 9px 6px;
}
