/* styles.css — cleaned & consolidated
   - Malayalam-first base + site styles kept
   - Celebration widget styles consolidated at the end
   - Removed duplicate/conflicting selectors and ensured predictable specificity
*/

/* ===========================
   VARIABLES
   =========================== */
:root{
  --teal: #00A896;
  --navy: #192A56;
  --paper: #FCF6F0;
  --ink: #374151;
  --muted: #6B7280;
  --ring: rgba(25,42,86,.12);
  --card-radius: 14px;
  --primary: var(--teal);
  --secondary: var(--navy);

  --base-font-size: 16px;
  --ml-line-height: 1.85;
  --en-line-height: 1.6;
  --lead-line-height: 1.75;
}

/* ===========================
   RESET / BASE
   =========================== */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: hidden;
  font-size: var(--base-font-size);
  font-family: 'Manjari', 'Noto Sans Malayalam', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--ink);
  background: var(--paper);
  line-height: var(--ml-line-height);
  -webkit-text-size-adjust: 100%;
}

img { display: block; max-width: 100%; height: auto; object-fit: contain; }
a { color: inherit; text-decoration: none; }

/* ===========================
   LAYOUT HELPERS
   =========================== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 18px; }
.grid { display: grid; gap: 18px; }
.grid-12 { grid-template-columns: repeat(12, 1fr); }

/* CARDS */
.card {
  background: #fff;
  border: 1px solid var(--ring);
  border-radius: var(--card-radius);
  box-shadow: 0 6px 18px rgba(0,0,0,.05);
}
.pad { padding: 16px; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  box-sizing: border-box;
  max-width: 100%;
  white-space: nowrap;
}
.btn-teal { background: var(--teal); color: #fff; }
.btn-navy { background: var(--navy); color: #fff; }
.btn .icon { margin-right: 8px; }

/* PILLS / SMALL */
.pill {
  display: inline-block;
  padding: .25rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  background: rgba(0,168,150,.08);
  color: #055e53;
  border: 1px solid rgba(0,168,150,.12);
}

/* TEXT UTILITIES */
.muted, .cap { color: var(--muted); }
.lead { font-size: 15px; color: var(--muted); line-height: var(--lead-line-height); }

/* HEADINGS */
.h1 { font-size: 36px; line-height: 1.1; margin: 0; }
.h2 { font-size: 28px; line-height: 1.15; margin: 0; }
.h3 { font-size: 18px; line-height: 1.2; margin: 0; }

/* LANGUAGE HELPERS */
.ml, [lang="ml"] {
  font-family: 'Manjari', 'Noto Sans Malayalam', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: var(--ml-line-height);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.en, [lang="en"] {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  line-height: var(--en-line-height);
  font-weight: 400;
  letter-spacing: 0.01em;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* English inside dense components */
.card p.en, .card p[lang="en"],
.lead.en, .lead[lang="en"],
.subtitle.en, .subtitle[lang="en"],
.daily-caption.en, .daily-caption[lang="en"],
.cap.en, .cap[lang="en"] {
  line-height: 1.65;
}
[lang="en"] .cap, [lang="en"] .muted { line-height: 1.5; }

/* BILINGUAL */
.bilingual .ml { margin-bottom: 8px; }
.bilingual .en { margin-top: 0; }

/* ===========================
   HEADER
   =========================== */
header {
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 1200;
}
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  gap: 12px;
}
.brand { color: #fff; }
.brand-left { display:flex; align-items:center; gap:12px; }
.brand-logo { width:56px; height:56px; border-radius:10px; flex:0 0 56px; object-fit:contain; display:block; }
.brand-text .title { font-family: 'Manjari', system-ui, sans-serif; font-weight:700; font-size:20px; margin:0; color:#fff; }
.brand-text .subtitle { font-size:12px; color:#cfeff0; margin-top:2px; }

.nav { display: flex; gap: 14px; align-items: center; }
.nav a { color: #c9d2ff; }
.nav a:hover { color: #fff; }
.nav .btn-donate { background: var(--teal); color: #fff; padding: 8px 12px; border-radius: 999px; font-weight: 700; }

@media (max-width:720px) {
  .header-bar { flex-direction: column; align-items: flex-start; padding: 12px; }
  .brand-left { width:100%; justify-content:space-between; }
  .brand-text { margin-left: 8px; flex:1; }
  .brand-text .title { font-size: 18px; }
  .nav { width: 100%; justify-content: flex-start; gap: 10px; flex-wrap: wrap; }
  .nav a { font-size: 14px; }
  .brand-logo { width:48px; height:48px; flex:0 0 48px; }
}

/* ===========================
   TOP HERO
   =========================== */
.top-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--card-radius);
  margin: 18px auto 6px;
  max-width: 1200px;
  z-index: 0;
}
.hero-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16/6;
  min-height: 220px;
  max-height: 420px;
  overflow: hidden;
  border-radius: var(--card-radius);
  background: #e9eef0;
}
.slide { position: absolute; inset: 0; opacity: 0; z-index: 0; backface-visibility: hidden; transform-origin: center; }
.slide img { width: 100%; height: 100%; object-fit: cover; display: block; -webkit-user-drag: none; }
.slide.play { animation: crossfade 12s infinite; animation-fill-mode: both; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 10; pointer-events: none; }
.boxed {
  background: linear-gradient(180deg, rgba(25,42,86,0.18), rgba(25,42,86,0.08));
  color: #fff;
  padding: 22px 28px;
  border-radius: 12px;
  text-align: center;
  backdrop-filter: blur(2px);
  pointer-events: auto;
}
.top-hero .overlay h1 { margin: 0; font-family: 'Manjari', system-ui, sans-serif; font-size: 30px; line-height: 1.05; }
.top-hero .overlay p { margin: 6px 0 0; color: rgba(255,255,255,0.92); font-size: 14px; }

@keyframes crossfade {
  0% { opacity: 0; transform: scale(1.02); }
  6% { opacity: 1; transform: scale(1); }
  30% { opacity: 1; transform: scale(1); }
  36% { opacity: 0; transform: scale(0.98); }
  100% { opacity: 0; }
}

/* ===========================
   ACTIVITIES, PROJECTS, ETC
   (kept unchanged: responsive rules preserved)
   =========================== */

.activities-header { display: grid; gap: 18px; align-items: end; grid-template-columns: repeat(12, 1fr); }
.activities-header .left { grid-column: span 9; }
.activities-header .right { grid-column: span 3; text-align: right; }
.activities-header .right .btn { white-space: nowrap; display: inline-flex; }

@media (max-width:820px) {
  .activities-header .left, .activities-header .right { grid-column: span 12; text-align: left; }
  .activities-header .right .btn { width: 100%; box-sizing: border-box; display: flex; justify-content: center; }
}

#activities .grid-12 > article { grid-column: span 12; }
@media (min-width:768px) { #activities .grid-12 > article { grid-column: span 6; } }
@media (min-width:1024px) { #activities .grid-12 > article { grid-column: span 4; } }

.activity-card { display: flex; gap: 12px; align-items: center; }
.activity-card .thumb { width: 140px; height: 96px; border-radius: 8px; flex: 0 0 140px; object-fit: cover; border: 1px solid var(--ring); }
.activity-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.activity-meta h4 { margin: 0; font-size: 16px; color: var(--navy); }
.activity-meta .meta-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.step { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start; }
.dot { width: 36px; height: 36px; border-radius: 50%; background: rgba(25,42,86,.08); display: grid; place-items: center; font-weight: 700; color: var(--navy); border: 1px solid var(--ring); }
.admission-steps { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
@media (max-width:820px) { .admission-steps { grid-template-columns: 1fr; } }

.about-cards { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; align-items: start; }
@media (max-width:820px) { .about-cards { grid-template-columns: 1fr; } }

.medical-photo {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
  border: 1px solid rgba(25,42,86,0.06);
}
@media (max-width:920px) { .medical-photo { max-height: 180px; } }

.projects-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}
.projects-grid .card { display: flex; flex-direction: column; gap: 12px; }
.projects-grid .card img, .projects-grid .thumb { width: 100%; height: 220px; object-fit: cover; border-radius: 8px; display: block; border: 1px solid var(--ring); }
.projects-grid .card h3 { margin: 0; font-size: 18px; line-height: 1.15; }
@media (max-width:1024px) { .projects-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } .projects-grid .card img { height: 180px; } }
@media (max-width:640px) { .projects-grid { grid-template-columns: repeat(1, minmax(0,1fr)); } .projects-grid .card img { height: 140px; } .projects-grid .card { padding: 12px; } .projects-grid .card h3 { font-size: 16px; } }

/* SPLASH / PRELOADER */
#splash {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(252,246,240,0.96));
  z-index: 1500; transition: opacity .35s ease, visibility .35s ease;
  visibility: visible; opacity: 1; pointer-events: auto;
}
#splash.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-card { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 14px; background: #fff; box-shadow: 0 12px 30px rgba(2,6,23,0.06); border: 1px solid var(--ring); }
.splash-logo { width: 56px; height: 56px; border-radius: 10px; overflow: hidden; flex: 0 0 56px; background: var(--teal); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 18px; }
.splash-text { font-size: 15px; color: var(--navy); font-weight: 700; }
.splash-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

.water-wrap { width: 240px; height: 12px; border-radius: 999px; background: linear-gradient(180deg,#f1f5f9,#fff); border: 1px solid rgba(25,42,86,0.06); overflow: hidden; margin-top: 8px; }
.water-fill { height: 100%; width: 0%; background: linear-gradient(90deg,#00A896,#00C2B1); transition: width 220ms linear; display: block; }
.water-percent { font-size: 12px; color: var(--muted); margin-left: 10px; min-width: 36px; text-align: right; }
.splash-row { display: flex; align-items: center; gap: 10px; }

/* REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
  .slide.play { animation: none; opacity: 1; }
}

/* ACTIVITY SMALL SCREEN TWEAK */
@media (max-width:480px) {
  .activity-card { flex-direction: column; align-items: stretch; }
  .activity-card .thumb { width: 100%; flex: 0 0 auto; height: 160px; }
  .activity-meta .btn { width: 100%; align-self: stretch; }
}

/* DAILY DELIGHT */
.daily-delight {
  max-width: 1200px;
  margin: 18px auto;
  padding: 20px;
  background: #fff;
  border-radius: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: center;
  box-shadow: 0 12px 30px rgba(25,42,86,0.06);
  border-top: 6px solid var(--secondary);
  transition: transform .35s ease, box-shadow .35s ease;
  will-change: transform;
}
.daily-delight:hover { transform: translateY(-6px); box-shadow: 0 24px 50px rgba(25,42,86,0.12); }
@media (max-width:920px) { .daily-delight { grid-template-columns: 1fr; padding: 16px; } }

.daily-text .kicker { font-weight: 800; color: var(--primary); font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
.daily-text .title { font-size: 30px; margin: 6px 0; font-weight: 800; font-family: 'Manjari', system-ui, sans-serif; color: var(--secondary); line-height: 1.05; }
.daily-text .subtitle { font-size: 18px; color: #334155; margin: 6px 0; }
.daily-text .lead { color: #475569; }

.daily-image { position: relative; overflow: hidden; border-radius: 16px; transform: rotate(-1.5deg); transition: transform .35s ease, box-shadow .35s ease; }
.daily-delight:hover .daily-image { transform: rotate(0deg); box-shadow: 0 18px 40px rgba(25,42,86,0.12); }
.daily-image img { width: 100%; height: 360px; object-fit: cover; border-radius: 12px; display: block; transform: none; }
@media (max-width:920px) { .daily-image img { height: 240px; } }

.badge-latest { position: absolute; top: 10px; right: 10px; background: #dc2626; color: #fff; font-weight: 700; padding: 6px 10px; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,0.08); font-size: 12px; }
.daily-caption { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* UTILITIES */
.text-center { text-align: center; }
.text-bold { font-weight: 700; }
.rounded-xl { border-radius: 1.25rem; }
.shadow-soft { box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (max-width:820px) {
  .row, .nav, .activity-meta .meta-row { flex-wrap: wrap !important; }
  .pill { white-space: normal !important; margin-bottom: 6px; }
  .activity-card .thumb, .thumb { max-width: 100%; height: auto; flex: 0 0 auto; }
  .card.pad { padding-left: 14px; padding-right: 14px; }
}

/* FOOTER */
footer {
  background: var(--navy);
  color: #ffffff;
  padding: 28px 18px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr 280px 240px;
  gap: 20px;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 6px;
}
.footer-left .ml { font-size: 20px; color: #9fe7db; margin-bottom: 6px; }
.footer-left .cap { color: rgba(255,255,255,0.85); }
.footer-links .cap { color: rgba(255,255,255,0.92); font-weight: 700; margin-bottom: 8px; }
.footer-links a { color: #d8e9ff; display: inline-block; margin: 6px 0; }
.footer-links a:hover { color: #ffffff; text-decoration: underline; }
.footer-contact .cap { color: rgba(255,255,255,0.92); font-weight: 700; margin-bottom: 8px; }
.footer-contact .cap + .cap { font-weight: 600; color: rgba(255,255,255,0.95); display: block; margin: 6px 0; }
.footer-grid .space-xs { height: 8px; }
footer .container { padding-left: 6px; padding-right: 6px; }

@media (max-width:820px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    text-align: center;
    padding: 6px;
  }
  .footer-left, .footer-links, .footer-contact { justify-self: center; }
  .footer-links a { display: block; margin: 8px 0; font-size: 15px; }
  .footer-contact .cap { display: block; margin: 6px 0; word-break: break-word; white-space: normal; }
  footer { padding: 20px 12px; }
}
@media (max-width:420px) {
  .footer-left .ml { font-size: 16px; }
  .footer-links a { font-size: 14px; }
  .footer-contact .cap { font-size: 13px; line-height: 1.25; }
  footer { padding: 16px 10px; }
}
footer a:focus {
  outline: 3px solid rgba(255,255,255,0.12);
  outline-offset: 2px;
  border-radius: 6px;
}

/* COUNTDOWN BADGE NUDGE FOR SHORT VIEWPORTS */
@media (max-height:720px) {
  #cw-countdown-badge { bottom: calc(20px + 96px); }
}

/* Final safety */
html, body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }


/* ===========================================================================
   CELEBRATION WIDGET — CONSOLIDATED (single authoritative block)
   - Placed at the end so it wins over earlier rules
   - Uses images/banner.jpg as default background fallback
   - Avoids hiding the root element; modal visibility controlled via .open on root
   =========================================================================== */

/* Root: do not set display:none on .cw-root; script controls open state */
#celebration-widget-root { position: relative; font-family: "Inter", system-ui, sans-serif; }

/* Floating badge: unified, visible, accessible */
#cw-countdown-badge,
.cw-badge-auto {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2500;
  padding: 12px 16px;
  border-radius: 999px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(135deg, #06b89a, #007a6b);
  color: #fff;
  box-shadow: 0 12px 30px rgba(0,0,0,0.22);
  cursor: pointer;
  transition: transform .22s ease, opacity .22s ease;
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  min-width: 56px;
  padding-left: 14px;
  padding-right: 14px;
  touch-action: manipulation;
}
#cw-countdown-badge:hover,
.cw-badge-auto:hover { transform: translateY(-6px) scale(1.03); }

/* Hidden state toggled by script */
#cw-countdown-badge.hidden,
.cw-badge-auto.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

/* Mobile: make badge full-width, readable label, and touch-friendly */
@media (max-width:480px) {
  #cw-countdown-badge {
    right: 12px;
    left: 12px;
    bottom: 86px;
    width: calc(100% - 24px);
    justify-content: center;
    padding: 12px 16px;
    font-size: 15px;
  }
  /* Keep label visible on mobile and ellipsize if too long */
  #cw-countdown-badge .label {
    display: inline-block;
    margin-right: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
  }
  #cw-countdown-badge .value { margin-left: 6px; font-weight:700; }
}


/* Modal + backdrop */
#celebration-widget-root .cw-modal { display: none; position: fixed; inset: 0; z-index: 2600; align-items: center; justify-content: center; padding: 16px; }
#celebration-widget-root.open .cw-modal { display: flex; }
#celebration-widget-root .cw-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.62); backdrop-filter: blur(3px); }

/* Card (dark translucent so background image is visible) */
#celebration-widget-root .cw-card {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  width: min(920px, 94%);
  max-width: 920px;
  max-height: calc(100vh - 48px);
  background: linear-gradient(180deg, rgba(12,18,26,0.84), rgba(8,12,18,0.92));
  color: #fff;
  box-shadow: 0 30px 80px rgba(2,6,23,0.7);
  display: grid;
  place-items: center;
  padding: 20px;
}

/* Background image (fallback to images/banner.jpg) */
#celebration-widget-root #cw-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url('images/banner.jpg');
  background-size: cover;
  background-position: center;
  filter: brightness(.48) saturate(.98) blur(.3px);
  transition: transform .6s ease, opacity .4s ease;
  opacity: 1;
}

/* Foreground content */
#celebration-widget-root .cw-content {
  position: relative;
  z-index: 4;
  text-align: center;
  padding: 18px;
  color: #fff;
}
#celebration-widget-root .cw-content, #celebration-widget-root .cw-content * { color: #fff !important; text-shadow: 0 6px 20px rgba(0,0,0,0.45); }

/* Big countdown */
#cw-big-val {
  font-size: 44px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 10px 18px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  box-shadow: 0 12px 28px rgba(0,0,0,0.45);
  display: inline-block;
  z-index: 5;
}
#cw-meta { font-size: 13px; opacity: 0.9; margin-top: 6px; }

/* Title / subtitle / badge in modal */
#cw-title { font-size: 26px; font-weight: 800; margin: 6px 0; color: #fff; }
#cw-sub { font-size: 14px; margin: 0 0 12px; color: rgba(255,255,255,0.9); }
#cw-badge { display:inline-block; padding:6px 12px; border-radius:999px; background: rgba(0,168,150,0.95); color:#fff; font-weight:800; }

/* Close button */
#cw-close {
  position: absolute;
  right: 12px;
  top: 12px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  border: none;
  padding: 8px 10px;
  border-radius: 8px;
  z-index: 6;
  cursor: pointer;
}

/* Confetti canvas will sit above background but under content; no explicit rules needed here */

/* RESPONSIVE TWEAKS */
@media (max-width:720px) {
  #cw-big-val { font-size: 32px; }
  #cw-title { font-size: 20px; }
  #celebration-widget-root .cw-card { padding: 12px; border-radius: 10px; }
}
@media (max-width:480px) {
  #cw-big-val { font-size: 26px; }
  #cw-title { font-size: 18px; }
}

/* final accessibility helper */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
