/*
 * Bir Hospital public site - design system (tokens, typography, accessibility, shared components).
 * Loaded after style.css so the tokens and base typography apply to every public page.
 * Brand colours are variables only: change them here (or override :root from a CMS-driven <style>) - never inline.
 *
 * Kalimati: no font file ships with the project. Copy Kalimati.ttf or .woff2 (and Kalimati-Bold.*) to
 * public/frontend/website/fonts/ (website) and public/fonts/ (admin); until then the Devanagari stack falls back
 * to a locally installed Kalimati, then Noto Sans Devanagari (loaded from Google Fonts), then Mangal.
 */
@font-face {
  font-family: 'Kalimati';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('Kalimati'), local('Kalimati Regular'), url('../fonts/Kalimati.woff2') format('woff2'), url('../fonts/Kalimati.ttf') format('truetype');
}
@font-face {
  font-family: 'Kalimati';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: local('Kalimati Bold'), url('../fonts/Kalimati-Bold.woff2') format('woff2'), url('../fonts/Kalimati-Bold.ttf') format('truetype');
}

:root {
  /* Brand */
  --color-primary: #0b5cab;        /* medical blue */
  --color-primary-dark: #084680;
  --color-secondary: #0f8b8d;      /* teal */
  --color-accent: #1f9d6b;         /* emerald */
  --color-surface: #ffffff;
  --color-surface-alt: #f4f7fa;
  --color-text: #1e293b;           /* dark slate */
  --color-text-muted: #475569;
  --color-border: #d5dde6;
  --color-focus: #ffbf47;
  --color-danger: #b42318;

  /* Typography */
  --font-nepali: 'Kalimati', 'Noto Sans Devanagari', 'Mangal', sans-serif;
  --font-english: 'Inter', 'Roboto', 'Segoe UI', Arial, sans-serif;
  --font-heading: 'Poppins', 'Inter', 'Segoe UI', Arial, sans-serif;
  --font-size-base: 16px;
  --line-height-en: 1.6;
  --line-height-ne: 1.85;          /* Devanagari needs room for matras and conjuncts */

  /* Shape */
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, .10);
  --container-pad: 16px;
}

html { font-size: var(--font-size-base); -webkit-text-size-adjust: 100%; }

/* Language aware fonts: <html lang="en|ne"> is set by the layout. Set on html/body only and inherit, so icon fonts
   (.fa, .icofont ...) keep their own font-family. Wrap mixed content in lang="en" / lang="ne" to switch inline. */
html:lang(en), html:lang(en) body { font-family: var(--font-english); line-height: var(--line-height-en); }
html:lang(ne), html:lang(ne) body {
  font-family: var(--font-nepali);
  line-height: var(--line-height-ne);
  letter-spacing: 0;               /* letter-spacing breaks Devanagari conjunct shaping */
}
[lang="en"]:not(html) { font-family: var(--font-english); }
[lang="ne"]:not(html) { font-family: var(--font-nepali); line-height: var(--line-height-ne); }
.fa, [class^="fa-"], [class*=" fa-"] { font-family: FontAwesome !important; }
body { color: var(--color-text); background: var(--color-surface); }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--color-text); line-height: 1.3; }
html:lang(en) h1, html:lang(en) h2, html:lang(en) h3, html:lang(en) h4, html:lang(en) h5, html:lang(en) h6 { font-family: var(--font-heading); }
html:lang(ne) h1, html:lang(ne) h2, html:lang(ne) h3, html:lang(ne) h4, html:lang(ne) h5, html:lang(ne) h6 { font-family: var(--font-nepali); line-height: 1.5; font-weight: 700; }
html:lang(ne) p, html:lang(ne) li, html:lang(ne) td, html:lang(ne) th, html:lang(ne) label, html:lang(ne) input, html:lang(ne) textarea, html:lang(ne) select, html:lang(ne) button {
  font-family: var(--font-nepali);
}
input, textarea, select, button { font-family: inherit; }
img { max-width: 100%; height: auto; }
.table-responsive-auto, .content-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { max-width: 100%; }

/* Accessibility */
.skip-link {
  position: absolute; left: 8px; top: -48px; z-index: 10000;
  background: var(--color-primary-dark); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
  transition: top .15s ease;
}
.skip-link:focus { top: 8px; color: #fff; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
[tabindex]:focus-visible, summary:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(11, 92, 171, .35);
}
.sr-only-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Visitor font-size control (set by design-system.js on <html data-fs="...">) */
html[data-fs="lg"] { --font-size-base: 18px; }
html[data-fs="xl"] { --font-size-base: 20px; }

/* Shared components used by redesigned pages */
.ds-container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--container-pad); }
.ds-page-title { background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary) 60%, var(--color-secondary)); color: #fff; padding: 28px 0; }
.ds-page-title h1 { color: #fff; margin: 0; font-size: clamp(1.4rem, 2.5vw + .6rem, 2.1rem); }
.ds-breadcrumb { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: .9rem; }
.ds-breadcrumb li + li::before { content: '/'; margin-right: 6px; opacity: .7; }
.ds-breadcrumb a { color: #fff; text-decoration: underline; }
.ds-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: box-shadow .2s ease, transform .2s ease; overflow: hidden; }
.ds-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.ds-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--color-surface-alt); color: var(--color-primary-dark); font-size: .8rem; border: 1px solid var(--color-border); }
.ds-badge--important { background: #fff4e5; color: #8a4b00; border-color: #f2c585; }
.ds-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--color-primary); color: #fff; font-weight: 600; text-decoration: none; cursor: pointer; transition: background .15s ease; }
.ds-btn:hover { background: var(--color-primary-dark); color: #fff; text-decoration: none; }
.ds-btn--outline { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.ds-btn--outline:hover { background: var(--color-primary); color: #fff; }
.ds-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ds-empty { text-align: center; padding: 40px 16px; color: var(--color-text-muted); border: 1px dashed var(--color-border); border-radius: var(--radius); }

/* Prevent horizontal overflow on narrow screens */
body { overflow-x: hidden; }
iframe, video, embed, object { max-width: 100%; }
@media (max-width: 575.98px) {
  :root { --container-pad: 12px; }
  .ds-grid { grid-template-columns: 1fr; }
}

/* Text size control in the top bar */
.fs-li { margin-right: 6px; }
.fs-control { display: inline-flex; gap: 4px; vertical-align: middle; }
.fs-control button { min-width: 32px; min-height: 28px; padding: 0 6px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-primary-dark); font-weight: 600; cursor: pointer; }
.fs-control button[aria-pressed="true"] { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.fs-control button { min-width: 26px; min-height: 26px; font-size: .8rem; padding: 0 4px; }
.header-btn { white-space: nowrap; }
.header-btn .fs-li { margin-right: 2px; }
@media (max-width: 1199.98px) { .header-btn { white-space: normal; } }

/* Phones: keep the Hospital Data / NAMS shortcuts in the flow instead of overlapping the emblem */
@media (max-width: 767.98px) {
  .other_site { position: static !important; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; margin: 6px 0; float: none !important; }
  .other_site a { position: static !important; margin: 0 !important; }
}

/* Nepali pages: the legacy stylesheet sets "Nunito Sans" on these selectors, which would bypass Kalimati */
html:lang(ne) .paragraph,
html:lang(ne) .font-secondary,
html:lang(ne) .file-upload,
html:lang(ne) #banner .caption-text,
html:lang(ne) #banner .caption-text h2,
html:lang(ne) .btn,
html:lang(ne) .nav-link,
html:lang(ne) .dropdown-item,
html:lang(ne) .card-title,
html:lang(ne) .card-body,
html:lang(ne) footer,
html:lang(ne) footer a { font-family: var(--font-nepali) !important; }
html:lang(ne) .fa, html:lang(ne) [class^="fa-"], html:lang(ne) [class*=" fa-"] { font-family: FontAwesome !important; }
