/* ==========================================================================
   Microbiology Wing — ICMR-NIHR
   Scoped under .mb-page so it never collides with bootstrap / header / footer.
   Breakpoints: 860px (stack cards), 560px (phones).
   ========================================================================== */

.mb-page {
    --navy: #003679;
    --navy-deep: #00214d;
    --navy-tint: #eef3fb;
    --navy-line: #d6e2f2;
    --teal: #12776a;
    --teal-tint: #e3f2ef;
    --ink: #172233;
    --text: #3d4d63;          /* body copy, 8.4:1 on white */
    --muted: #66768b;
    --line: #e1e7f0;
    --paper: #f6f8fb;
    --white: #fff;

    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-head: 'Source Serif 4', Georgia, serif;
    --font-hi: 'Noto Sans Devanagari', 'Inter', system-ui, sans-serif;

    --radius: 16px;
    --shadow: 0 1px 2px rgba(0, 33, 77, .05), 0 8px 24px rgba(0, 33, 77, .07);
    --shadow-hover: 0 2px 4px rgba(0, 33, 77, .06), 0 18px 40px rgba(0, 33, 77, .12);
    --wrap: 1200px;
    --gutter: clamp(16px, 4vw, 32px);

    background: var(--paper);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.mb-page *,
.mb-page *::before,
.mb-page *::after { box-sizing: border-box; }

.mb-page img { display: block; max-width: 100%; }
.mb-page h1, .mb-page h2, .mb-page h3, .mb-page p, .mb-page figure { margin: 0; }

/* --------------------------------------------------------------------------
   Bilingual: one language at a time, with Devanagari tuned for readability
   -------------------------------------------------------------------------- */
html[data-lang="en"] .mb-page .lang-hi,
html[data-lang="hi"] .mb-page .lang-en,
.mb-page .lang-sep { display: none; }

.mb-page .lang-hi {
    font-family: var(--font-hi);
    line-height: 1.85;
    letter-spacing: 0;
}

.mb-page h1 .lang-hi,
.mb-page h2 .lang-hi,
.mb-page h3 .lang-hi { font-weight: 700; line-height: 1.45; }

/* --------------------------------------------------------------------------
   Hero — deep navy with petri-dish colony rings
   -------------------------------------------------------------------------- */
.mb-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
    color: var(--white);
    padding: clamp(40px, 7vw, 76px) 0;
}

.mb-hero::before {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    background:
        repeating-radial-gradient(circle at 94% -10%, transparent 0 44px, rgba(255, 255, 255, .055) 44px 45px),
        radial-gradient(circle at 6% 110%, rgba(18, 119, 106, .35), transparent 45%);
}

.mb-wrap {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.mb-hero__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.mb-hero__id {
    display: flex;
    align-items: center;
    gap: clamp(14px, 2.5vw, 24px);
    flex: 1 1 520px;
    min-width: 0;
}

.mb-hero__icon {
    flex: none;
    display: grid;
    place-items: center;
    width: clamp(52px, 7vw, 76px);
    aspect-ratio: 1;
    border-radius: 18px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .22);
    font-size: clamp(22px, 3vw, 32px);
    backdrop-filter: blur(6px);
}

.mb-hero h1 {
    font-family: var(--font-head);
    font-size: clamp(1.7rem, 3.6vw, 2.7rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.02em;
    color: var(--white);
    margin-bottom: 8px;
}

.mb-hero__sub {
    display: block;
    max-width: 62ch;
    font-size: clamp(.92rem, 1.3vw, 1.05rem);
    line-height: 1.6;
    color: rgba(255, 255, 255, .82);
}

/* Language toggle */
.lang-toggle {
    display: inline-flex;
    gap: 2px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .22);
    flex: none;
}

.lang-toggle .lang-opt {
    appearance: none;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, .85);
    font: 600 .86rem/1 var(--font-body);
    padding: 10px 18px;
    min-height: 40px;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: background .2s, color .2s;
}

.lang-toggle .lang-opt:hover { color: var(--white); background: rgba(255, 255, 255, .12); }
.lang-toggle .lang-opt:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }
.lang-toggle .lang-opt.is-active { background: var(--white); color: var(--navy); }
.lang-toggle .lang-abbr { font-size: .72rem; font-weight: 700; opacity: .7; }

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */
.mb-main { padding: clamp(40px, 6vw, 72px) 0 clamp(56px, 8vw, 104px); }
.mb-block + .mb-block { margin-top: clamp(56px, 8vw, 96px); }

.mb-head { max-width: 62ch; margin-bottom: clamp(24px, 4vw, 40px); }

.mb-head h2 {
    font-family: var(--font-head);
    font-size: clamp(1.45rem, 2.6vw, 2.05rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.015em;
    color: var(--navy);
    padding-left: 16px;
    border-left: 4px solid var(--teal);
}

.mb-head p {
    margin-top: 12px;
    padding-left: 20px;
    font-size: clamp(.95rem, 1.2vw, 1.04rem);
    color: var(--text);
}

/* --------------------------------------------------------------------------
   Capabilities
   -------------------------------------------------------------------------- */
.cap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: clamp(16px, 2.4vw, 28px);
}

.cap-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: clamp(22px, 3vw, 32px);
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: border-color .25s, box-shadow .25s;
}

.cap-card:hover { border-color: var(--navy-line); box-shadow: var(--shadow-hover); }

.cap-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--navy-tint);
    color: var(--navy);
    font-size: 22px;
}

.cap-card h3 {
    font-family: var(--font-head);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--ink);
}

.cap-card p { font-size: .95rem; line-height: 1.7; }

/* --------------------------------------------------------------------------
   Equipment — image and text side by side, alternating on desktop
   -------------------------------------------------------------------------- */
.equip-list { display: grid; gap: clamp(20px, 3vw, 32px); }

.equip-card {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) + 6px);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow .25s;
}

.equip-card:hover { box-shadow: var(--shadow-hover); }
.equip-card:nth-child(even) .equip-media {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, var(--navy-tint), #e3ecf7);
    border-right: 1px solid var(--line);
    overflow: hidden;
}

.equip-media__frame {
    flex: 1;
    display: grid;
    place-items: center;
    padding: clamp(14px, 2.4vw, 26px);
    min-height: 260px;
}

/* Whole photo always visible: never cropped, scaled to fit */
.equip-media img {
    width: 100%;
    height: auto;
    max-height: 460px;
    object-fit: contain;
    border-radius: 12px;
    background: var(--white);
    box-shadow: 0 6px 20px rgba(0, 33, 77, .14);
    transition: transform .6s cubic-bezier(.22, .61, .36, 1);
}

.equip-card:hover .equip-media img { transform: scale(1.025); }

/* Fallback icon only appears if the photo fails to load */
.equip-media__fallback {
    display: none;
    place-items: center;
    color: var(--navy);
    opacity: .4;
    font-size: 3.2rem;
}

.equip-media.is-broken .equip-media__fallback { display: grid; }

.equip-media figcaption {
    padding: 11px 18px;
    background: var(--navy);
    color: rgba(255, 255, 255, .92);
    font-size: .84rem;
    line-height: 1.4;
}

.equip-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    min-width: 0;
    padding: clamp(24px, 4vw, 44px);
}

.equip-tag {
    align-self: flex-start;
    padding: 5px 13px;
    border-radius: 999px;
    background: var(--teal-tint);
    color: var(--teal);
    font-size: .82rem;
    font-weight: 600;
}

.equip-body h3 {
    font-family: var(--font-head);
    font-size: clamp(1.3rem, 2.1vw, 1.65rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.01em;
    color: var(--navy);
}

.equip-body p { font-size: .97rem; line-height: 1.75; max-width: 70ch; }

.equip-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    padding: 14px 0 0;
    list-style: none;
    border-top: 1px solid var(--line);
}

.equip-meta li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--paper);
    border: 1px solid var(--line);
    color: var(--ink);
    font-size: .84rem;
    font-weight: 500;
}

.equip-meta i { color: var(--teal); font-size: .85rem; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 860px) {
    .equip-card { grid-template-columns: 1fr; }
    .equip-card:nth-child(even) .equip-media { order: 0; }
    .equip-media { border-right: 0; border-bottom: 1px solid var(--line); }
    .equip-media__frame { min-height: 0; }
    .equip-media img { max-height: 420px; }
}

@media (max-width: 560px) {
    .mb-hero__inner { align-items: flex-start; }
    .mb-hero__id { align-items: flex-start; flex-basis: 100%; }
    .lang-toggle { width: 100%; }
    .lang-toggle .lang-opt { flex: 1; justify-content: center; }
    .mb-head h2 { padding-left: 12px; }
    .mb-head p { padding-left: 16px; }
    .equip-meta li { font-size: .8rem; padding: 6px 12px; }
}


/* --------------------------------------------------------------------------
   Motion — one calm page-load sequence + scroll reveal (JS adds .js-reveal)
   -------------------------------------------------------------------------- */
@keyframes mb-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes mb-drift { from { transform: scale(1); } to { transform: scale(1.12) rotate(2deg); } }

.mb-hero::before { animation: mb-drift 18s ease-in-out infinite alternate; transform-origin: 94% 0; }

.mb-hero__icon { animation: mb-rise .7s .05s both cubic-bezier(.22, .61, .36, 1); }
.mb-hero h1    { animation: mb-rise .7s .15s both cubic-bezier(.22, .61, .36, 1); }
.mb-hero__sub  { animation: mb-rise .7s .28s both cubic-bezier(.22, .61, .36, 1); }
.lang-toggle   { animation: mb-rise .7s .4s  both cubic-bezier(.22, .61, .36, 1); }

.js-reveal .reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity .7s cubic-bezier(.22, .61, .36, 1), transform .7s cubic-bezier(.22, .61, .36, 1);
    transition-delay: var(--d, 0s);
}
.js-reveal .reveal.is-in { opacity: 1; transform: none; }

/* Hover feedback */
.cap-card:hover .cap-icon { background: var(--navy); color: var(--white); transform: scale(1.06); }
.cap-icon { transition: background .25s, color .25s, transform .25s; }
.equip-meta li { transition: background .2s, border-color .2s, transform .2s; }
.equip-meta li:hover { background: var(--navy-tint); border-color: var(--navy-line); transform: translateY(-2px); }

/* Smooth language switch */
.mb-page .lang-en, .mb-page .lang-hi { animation: mb-rise .35s both; }

@media (prefers-reduced-motion: reduce) {
    .mb-page *, .mb-page *::before, .mb-page *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-delay: 0s !important;
    }
    .js-reveal .reveal { opacity: 1; transform: none; }
}

@media print {
    .lang-toggle { display: none; }
    .mb-hero { background: none; color: var(--ink); }
    .mb-hero h1, .mb-hero__sub { color: var(--ink); }
    .equip-card, .cap-card { box-shadow: none; break-inside: avoid; }
}