/* ═══════════════════════════════════════════════════════════
   header.css — Karunya Shared Header + Footer
   Import on every page. Covers:
     • Announcement bar
     • Sticky header (desktop + tablet + mobile)
     • Mobile drawer nav
     • Footer (3-col → 2-col → 1-col)
     • Scroll-to-top button
   ═══════════════════════════════════════════════════════════ */
/* ── LANGUAGE TOGGLE ── */
body.lang-ml .en-text { display: none !important; }
body.lang-en .ml-text { display: none !important; }
/* ── ANNOUNCEMENT BAR ── */
/* ── ANNOUNCEMENT TOAST (bottom-right, colourful) ── */
.kh-ann-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9000;
  width: 340px;
  max-width: calc(100vw - 36px);
  display: flex;
  gap: 12px;
  padding: 16px 18px 16px 16px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--border, #e2e8f0);
  box-shadow: 0 16px 48px rgba(15,35,67,0.22);
  border-left: 5px solid #1d4ed8;
  transform: translateY(24px);
  opacity: 0;
  transition: transform .35s cubic-bezier(.2,.8,.3,1), opacity .35s ease;
}
.kh-ann-toast.show { transform: translateY(0); opacity: 1; }
.kh-ann-icon { font-size: 26px; line-height: 1.1; flex-shrink: 0; }
.kh-ann-content { flex: 1; min-width: 0; }
.kh-ann-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted, #64748b); margin-bottom: 4px; }
.kh-ann-text { font-size: 14px; font-weight: 600; color: var(--navy, #0f2343); line-height: 1.5; }
.kh-ann-link { display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--primary-dark, #007f71); border-bottom: 2px solid var(--primary, #00a896); }
.kh-ann-close {
  position: absolute;
  top: 8px; right: 10px;
  background: none; border: none;
  font-size: 20px; line-height: 1;
  color: var(--muted, #94a3b8);
  cursor: pointer; padding: 2px 4px;
}
.kh-ann-close:hover { color: var(--navy, #0f2343); }

/* Type-specific accent colour (left border + icon tint) */
.kh-ann-info    { border-left-color: #2563eb; }
.kh-ann-success { border-left-color: #059669; }
.kh-ann-warn    { border-left-color: #d97706; }
.kh-ann-event   { border-left-color: var(--primary, #00a896); }

@media (max-width: 480px) {
  .kh-ann-toast { right: 12px; left: 12px; bottom: 12px; width: auto; }
}

/* ── HEADER SHELL ── */
#karunya-header-bar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--navy, #0f2343);
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  transition: box-shadow 0.3s, transform 0.35s ease;
  will-change: transform;
}
/* Hide-on-scroll-down: slide the bar up out of view */
#karunya-header-bar.kh-hidden {
  transform: translateY(-100%);
}

/* inner flex row */
.kh-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 0;
  transition: height 0.3s ease;
}
/* Compact mode: shrink the bar once the user scrolls down */
#karunya-header-bar.kh-compact .kh-inner {
  height: 52px;
}
#karunya-header-bar.kh-compact .kh-logo-img {
  height: 30px;
  width: 30px;
  transition: height 0.3s ease, width 0.3s ease;
}
/* ── LOGO ── */
.kh-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: auto;   /* push nav to the right */
}
.kh-logo-img {
  height: 36px;
  width: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255,255,255,0.22);
  display: block;       /* logo always present (header.js provides a fallback src) */
}
.kh-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.kh-org-main {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.kh-org-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.55);
  font-weight: 400;
  white-space: nowrap;
}

/* ── DESKTOP NAV ── */
.kh-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.kh-nav-link {
  position: relative;
  padding: 7px 12px;
  color: rgba(255,255,255,0.75);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 8px;
  text-decoration: none;
  transition: background .18s, color .18s;
  white-space: nowrap;
}
.kh-nav-link:hover,
.kh-nav-link.active { background: rgba(255,255,255,0.1); color: #fff; }
/* Active-page underline accent */
.kh-nav-link.active::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--primary, #00a896);
}
.kh-nav-cta.active::after { display: none; }
.kh-nav-cta {
  background: var(--primary, #00a896);
  color: #fff !important;
  padding: 7px 16px;
  border-radius: 8px;
  font-weight: 600;
  margin-left: 4px;
}
.kh-nav-cta:hover { background: var(--primary-dark, #007f71); }

/* ── "More ▾" DROPDOWN (desktop) ── */
.kh-more { position: relative; display: inline-flex; }
.kh-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.kh-more-caret { font-size: 10px; transition: transform .2s; opacity: .8; }
.kh-more.open .kh-more-caret { transform: rotate(180deg); }
.kh-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  background: var(--navy-light, #1a3055);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.35);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 250;
}
.kh-more.open .kh-more-menu { display: flex; }
.kh-more-menu .kh-nav-link { width: 100%; padding: 10px 14px; border-radius: 7px; }
.kh-more-menu .kh-nav-link.active::after { display: none; }
.kh-more-menu .kh-nav-link.active { background: rgba(255,255,255,0.12); }

/* ── LANG TOGGLE ── */
.kh-lang-btn {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.9);
  border: none;
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: background .18s;
  flex-shrink: 0;
  margin-left: 10px;
  white-space: nowrap;
}
.kh-lang-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }

/* ── HAMBURGER ── */
.kh-menu-btn {
  display: none;            /* hidden on desktop */
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 6px;
  margin-left: 8px;
  flex-shrink: 0;
  line-height: 1;
}
.kh-menu-btn svg {
  width: 22px;
  height: 22px;
  display: block;
}

/* ── MOBILE DRAWER ── */
.kh-drawer {
  display: none;
  flex-direction: column;
  background: var(--navy-light, #1a3055);
  padding: 8px 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.kh-drawer.open { display: flex; }
.kh-drawer .kh-nav-link {
  padding: 11px 14px;
  font-size: 14px;
  border-radius: 8px;
}
/* lang button inside drawer */
.kh-drawer-lang {
  margin: 8px 14px 0;
  align-self: flex-start;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
  border: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.4px;
}
.kh-drawer-lang:hover { background: rgba(255,255,255,0.15); }

/* ── FOOTER ── */
#karunya-footer-bar {
  background: var(--navy, #0f2343);
  color: rgba(255,255,255,0.8);
  margin-top: auto;
}
.kf-top {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 36px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
}
.kf-brand .kh-logo { margin-bottom: 14px; }
.kf-tagline {
  font-size: 13.5px;
  color: rgba(255,255,255,0.55);
  line-height: 1.65;
  max-width: 270px;
}
.kf-social {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}
.kf-social-icon {
  width: 34px;
  height: 34px;
  background: rgba(255,255,255,0.07);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.65);
  font-size: 15px;
  text-decoration: none;
  transition: background .2s;
}
.kf-social-icon:hover { background: var(--primary, #00a896); color: #fff; }

.kf-col h4 {
  font-size: 11.5px;
  font-weight: 700;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  margin-bottom: 14px;
}
.kf-col ul { list-style: none; padding: 0; margin: 0; }
.kf-col ul li { margin-bottom: 9px; }
.kf-col ul li a {
  font-size: 13.5px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  transition: color .2s;
}
.kf-col ul li a:hover { color: var(--primary, #00a896); }

.kf-contact-item {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-bottom: 11px;
  font-size: 13.5px;
  color: rgba(255,255,255,0.65);
}
.kf-contact-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin-top: 2px;
  fill: var(--primary, #00a896);
}

.kf-bottom {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 18px 24px;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.kf-copy { font-size: 12px; color: rgba(255,255,255,0.35); }
.kf-note { font-size: 11.5px; color: rgba(255,255,255,0.28); }

/* ── SCROLL-TO-TOP ── */
#kh-scroll-top {
  position: fixed;
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 12px));
  right: 24px;
  width: 42px;
  height: 42px;
  background: var(--primary, #00a896);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,168,150,.38);
  transition: transform .2s;
  z-index: 500;
}
#kh-scroll-top.show { display: flex; }
#kh-scroll-top:hover { transform: translateY(-3px); }

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */

/* Tablet landscape: shrink nav text slightly */
@media (max-width: 1024px) {
  .kf-top { grid-template-columns: 1fr 1fr; }
  .kh-nav { gap: 0; }
  .kh-nav-link { padding: 7px 8px; font-size: 12.5px; }
}

/* Tablet portrait: hide desktop nav, show hamburger */
@media (max-width: 768px) {
  .kh-nav { display: none; }
  .kh-menu-btn { display: flex; }
  .kf-top { grid-template-columns: 1fr; gap: 28px; }
  .kf-bottom { flex-direction: column; text-align: center; }
}

/* Mobile: tighten header padding, small logo font */
@media (max-width: 480px) {
  .kh-inner {
    padding: 0 14px;
    height: 56px;
  }
  .kh-logo-img { height: 30px; width: 30px; }
  .kh-org-main { font-size: 13.5px; }
  .kh-org-sub  { display: none; }   /* hide trust name on small phones */
  .kh-lang-btn { padding: 5px 9px; font-size: 11px; margin-left: 6px; }
  .kf-top { padding: 36px 16px 28px; }
  .kf-bottom { padding: 14px 16px; }
}

/* Very small (360px) — prevent any overflow */
@media (max-width: 380px) {
  .kh-org-main { font-size: 12.5px; }
  .kh-logo-img { height: 28px; width: 28px; }
}
/* ── MAINTENANCE NOTICE ── */
.kh-maint-tag { font-size: 11px; margin-left: 2px; vertical-align: middle; }
#kh-maint-banner {
  background: #fef3c7;
  border-bottom: 1px solid #fcd34d;
  color: #92400e;
  padding: 16px 20px;
  position: sticky;
  top: 64px;
  z-index: 150;
}
.kh-maint-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
}
.kh-maint-icon { font-size: 28px; flex-shrink: 0; }
.kh-maint-text { display: flex; flex-direction: column; gap: 3px; line-height: 1.4; }
.kh-maint-text strong { font-size: 15px; font-weight: 700; }
.kh-maint-sub { font-size: 13px; opacity: 0.85; }
@media (max-width: 480px) {
  #kh-maint-banner { top: 56px; }
  .kh-maint-icon { font-size: 22px; }
  .kh-maint-text strong { font-size: 14px; }
}
