:root {
  --navy: #0f172a;
  --navy-light: #1e293b;
  --gold: #fbbf24;
  --gold-light: #fcd34d;
  --page-bg: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --font-sans: "Source Sans 3", "Segoe UI", sans-serif;
  --font-display: "Libre Baskerville", Georgia, serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--page-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: #1d4ed8; text-decoration: none; }
a:hover { color: var(--navy); }

.container {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

/* Top bar */
.topbar {
  background: var(--navy);
  color: #fff;
  font-size: 0.8rem;
}
.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 0;
  flex-wrap: wrap;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.topbar-brand img {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  object-fit: cover;
}
#lang-select {
  background: var(--navy-light);
  color: #fff;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
}

/* Header / nav */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0;
  flex-wrap: nowrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: inherit;
  min-width: 0;
  flex-shrink: 1;
}
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 2px solid var(--gold);
  overflow: hidden;
  background: #fff;
  flex-shrink: 0;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.brand-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
  white-space: nowrap;
}
.brand-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0;
  white-space: nowrap;
}

.nav-desktop {
  display: none;
  align-items: center;
  gap: 0.1rem;
  font-size: 0.82rem;
  font-weight: 600;
  flex: 1 1 auto;
  justify-content: flex-end;
  flex-wrap: nowrap;
  min-width: 0;
  overflow: visible;
}
.nav-desktop > a,
.nav-drop > button {
  appearance: none;
  background: none;
  border: 0;
  color: #334155;
  font: inherit;
  font-weight: 600;
  padding: 0.45rem 0.5rem;
  cursor: pointer;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.2;
}
.nav-desktop > a:hover,
.nav-drop > button:hover,
.nav-desktop > a.is-active,
.nav-drop.open > button {
  color: var(--navy);
  background: #f1f5f9;
}
.nav-drop { position: relative; flex-shrink: 0; }
.nav-drop-panel {
  display: none;
  position: absolute;
  top: calc(100% - 2px);
  left: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  z-index: 80;
}
.nav-drop:hover .nav-drop-panel,
.nav-drop:focus-within .nav-drop-panel,
.nav-drop.open .nav-drop-panel,
.nav-drop-panel.open-mobile {
  display: block;
}
.nav-drop-panel a {
  display: block;
  padding: 0.55rem 0.75rem;
  color: #334155;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.88rem;
  white-space: normal;
  text-decoration: none;
}
.nav-drop-panel a:hover { background: #f8fafc; color: var(--navy); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  margin-left: 0.35rem;
}
.header-actions .btn-lms {
  margin-left: 0;
}

.btn-lms {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.35rem;
  background: var(--navy);
  color: #fff !important;
  border: 0;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}
.btn-lms:hover { background: var(--navy-light); color: #fff !important; }

.btn-mobile {
  display: inline-flex;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--navy);
}

.nav-mobile {
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0 0 1rem;
  border-top: 1px solid var(--border);
}
.nav-mobile.open { display: flex; }
.nav-mobile a,
.nav-mobile button.btn-lms,
.nav-mobile a.btn-lms {
  padding: 0.7rem 0.25rem;
  color: #334155;
  font-weight: 600;
  text-align: left;
  width: 100%;
  margin: 0;
}

@media (min-width: 960px) {
  .nav-desktop { display: flex; }
  .btn-mobile { display: none; }
  .nav-mobile { display: none !important; }
}
@media (max-width: 959px) {
  .header-actions .btn-lms {
    display: inline-flex;
  }
}

/* Page shell */
.page-main {
  padding: 2rem 0 3.5rem;
  min-height: 55vh;
}
.page-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  overflow: hidden;
}
.page-panel > .legacy-content {
  max-width: 100%;
}

/* Soften legacy chrome inside new shell */
.legacy-content .fac-hero,
.legacy-content .fg-hero {
  border-radius: 12px;
  overflow: hidden;
}
.legacy-content table {
  width: 100%;
  border-collapse: collapse;
}
.legacy-content table td,
.legacy-content table th {
  border: 1px solid var(--border);
  padding: 0.5rem 0.65rem;
  vertical-align: top;
}

/* Footer */
.site-footer {
  background: var(--navy);
  color: #cbd5e1;
  padding: 2.5rem 0 1.5rem;
  margin-top: auto;
}
.footer-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}
.site-footer h3 {
  color: #fff;
  font-family: var(--font-display);
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}
.site-footer a { color: #e2e8f0; }
.site-footer a:hover { color: var(--gold); }
.footer-copy {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #334155;
  font-size: 0.8rem;
  color: #94a3b8;
}

/* Home extras */
.whats-new {
  background: linear-gradient(90deg, #fef3c7, #fff7ed);
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.whats-new-content {
  white-space: nowrap;
  animation: ticker 28s linear infinite;
  font-weight: 600;
  color: var(--navy);
  font-size: 0.92rem;
}
@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Contact form */
.contact-form {
  display: grid;
  gap: 0.9rem;
  max-width: 560px;
}
.contact-form label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}
.contact-form input,
.contact-form textarea,
.contact-form select {
  font: inherit;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.contact-form button {
  justify-self: start;
  background: var(--navy);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 0.7rem 1.2rem;
  font-weight: 700;
  cursor: pointer;
}
.form-status {
  font-size: 0.9rem;
  color: var(--muted);
}
.form-status.error { color: #b91c1c; }
.form-status.ok { color: #047857; }

/* LMS helpers (Tailwind CDN also used on home) */
.hidden { display: none !important; }
.lms-tab.active {
  color: var(--navy);
  border-bottom-color: var(--navy);
}
.pulse-ring::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--navy);
  animation: pulse 2s linear infinite;
  opacity: 0;
  z-index: -1;
}
@keyframes pulse {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(1.3); opacity: 0; }
}

.lang-mr { display: none; }
html[lang="mr"] .lang-en { display: none; }
html[lang="mr"] .lang-mr { display: inline; }

/* A11y + search toolbar */
.topbar-tools {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.a11y-btn,
.list-filter-clear,
.copy-page-link,
.carousel-btn {
  appearance: none;
  border: 1px solid #475569;
  background: var(--navy-light);
  color: #fff;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.a11y-btn:hover,
.list-filter-clear:hover,
.carousel-btn:hover { border-color: var(--gold); color: var(--gold); }

#site-search {
  background: var(--navy-light);
  color: #fff;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
  min-width: 140px;
  font-size: 0.78rem;
}
#site-search::placeholder { color: #94a3b8; }
#site-search-meta {
  font-size: 0.7rem;
  color: #94a3b8;
  min-width: 4rem;
}

html.high-contrast body {
  background: #000;
  color: #fff;
}
html.high-contrast .site-header,
html.high-contrast .page-panel,
html.high-contrast .topbar {
  background: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
}
html.high-contrast a { color: #ffe08a; }

/* Carousel controls */
.carousel-container,
.hero-carousel { position: relative; }
/* Hide leftover filename captions from mirror (e.g. "slide9") */
.carousel-subheading { display: none !important; }
/* Single carousel UI — side arrows + bottom dots (no overlapping second set) */
.carousel-ui { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.carousel-ui .carousel-control,
.carousel-ui .carousel-dots { pointer-events: auto; }
.carousel-ui .carousel-dots {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  display: flex;
  gap: 0.4rem;
  align-items: center;
  z-index: 6;
  margin: 0;
}
.carousel-ui .carousel-dot,
.carousel-ui .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
}
.carousel-ui .carousel-dot.active,
.carousel-ui .dot.active {
  background: var(--gold);
  width: 22px;
}
.carousel-controls { display: none !important; }

/* Filters */
.list-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.list-filter-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
}
.list-filter-input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  font: inherit;
  min-width: 180px;
}
.list-filter-clear {
  background: #fff;
  color: var(--navy);
  border-color: var(--border);
}
.list-filter-count {
  font-size: 0.8rem;
  color: var(--muted);
  margin-left: auto;
}

/* Toasts + back to top */
.dts-toast-host {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(360px, calc(100vw - 2rem));
}
.dts-toast {
  background: var(--navy);
  color: #fff;
  border-radius: 10px;
  padding: 0.75rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s, transform .25s;
}
.dts-toast.show { opacity: 1; transform: translateY(0); }
.dts-toast-ok { background: #047857; }
.dts-toast-error { background: #b91c1c; }
.dts-toast-info { background: var(--navy); }

.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1500;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 0;
  background: var(--navy);
  color: var(--gold);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
}
.back-to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.dts-toast-host:not(:empty) ~ .back-to-top,
body:has(.dts-toast-host:not(:empty)) .back-to-top {
  bottom: 5.5rem;
}

/* Reveal + table interaction */
.reveal-ready {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .45s ease, transform .45s ease;
}
.reveal-ready.reveal-in {
  opacity: 1;
  transform: none;
}
.interactive-table tr { cursor: pointer; }
.interactive-table tr.selected { background: #eff6ff; }
.copy-page-link {
  margin-left: 0.75rem;
  background: transparent;
  border-color: #64748b;
}

.nav-drop-panel.open-mobile {
  display: block;
  position: static;
  box-shadow: none;
  border: 0;
  padding-left: 0.5rem;
}

.fg-card { cursor: pointer; }
.img-fallback { object-fit: contain; background: #f1f5f9; }
