/* =====================================================
   style.css  –  Global base styles
   MEMBER Lab, IIT Kharagpur
   ===================================================== */

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary-navy:   #1a2a4a;
  --primary-blue:   #1e3461;
  --accent-gold:    #c9a961;
  --accent-orange:  #e07722;
  --accent-cyan:    #3ab5b0;
  --bg-light:       #f4f4f0;
  --bg-cream:       #fdf8f0;
  --text-dark:      #2c2c2c;
  --text-muted:     #666;
  --border-soft:    #e2e2e2;
  --shadow-soft:    0 2px 12px rgba(0,0,0,0.07);
  --shadow-medium:  0 8px 32px rgba(0,0,0,0.12);
  --transition:     0.25s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'DM Sans', sans-serif;
  color: var(--text-dark);
  background: var(--bg-light);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

/* ══════════════════════════════════════
   INSTITUTE STRIP (top bar)
══════════════════════════════════════ */
.institute-strip {
  background: var(--primary-navy);
  color: #cdd8ea;
  font-size: 0.76rem;
  padding: 6px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.institute-strip .left,
.institute-strip .right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.institute-strip a {
  color: #cdd8ea;
  margin-left: 16px;
  transition: color var(--transition);
}
.institute-strip a:hover { color: #e09040; }

/* ══════════════════════════════════════
   SITE HEADER
   — Always one row: logos-left | logo-right
══════════════════════════════════════ */
.site-header {
  background: #fff;
  border-bottom: 2px solid var(--border-soft);
  padding: 10px 28px;

  /* layout */
  display: flex;
  flex-direction: row;        /* always a row */
  flex-wrap: nowrap;          /* NEVER wrap — this is the key fix */
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
}

/* Left: IIT logos + text */
.logo-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;             /* grows but can shrink */
  min-width: 0;               /* allows shrinking below content size */
  overflow: hidden;
}

.logo-left img {
  height: 56px;
  width: auto;
  flex-shrink: 0;
  object-fit: contain;
}

.institute-name {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
}

.institute-name .hindi {
  font-size: 0.76rem;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.institute-name .english {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--primary-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.institute-name .dept {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-orange);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right: MEMBER Lab logo — pinned to right, never pushed down */
.logo-right {
  flex-shrink: 0;             /* never shrinks */
  flex-grow: 0;               /* never grows */
  display: flex;
  align-items: center;
  margin-left: auto;          /* pushes to the far right */
}

.logo-right img {
  height: 56px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* ══════════════════════════════════════
   NAVIGATION
══════════════════════════════════════ */
.main-nav {
  background: var(--primary-navy);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

/* Top-level nav list — excludes the dropdown sub-list */
.main-nav ul:not(.nav-dropdown) {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  margin: 0;
  width: 100%;
}

.main-nav ul li a {
  display: block;
  padding: 14px 15px;
  color: #c8d4e8;
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}

.main-nav ul li a:hover,
.main-nav ul li a.active {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

/* Hamburger — hidden on desktop */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 14px 4px;
  margin-left: auto;
  line-height: 1;
}

/* ══════════════════════════════════════
   MEMBERS DROPDOWN
══════════════════════════════════════ */

/* Parent li — needs position:relative for dropdown positioning */
.nav-dropdown-item {
  position: relative;
}

/* The trigger link — same style as other nav links */
.nav-dropdown-trigger {
  display: flex !important;
  align-items: center;
  gap: 4px;
  padding: 14px 15px;
  color: #c8d4e8;
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition), background var(--transition);
  user-select: none;
}

.nav-dropdown-trigger:hover,
.nav-dropdown-item.open .nav-dropdown-trigger {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

/* Chevron rotates when open */
.nav-chevron {
  font-size: 0.65rem;
  display: inline-block;
  transition: transform 0.22s ease;
  line-height: 1;
}

.nav-dropdown-item.open .nav-chevron {
  transform: rotate(180deg);
}

/* ── The dropdown panel ──
   Must be position:absolute so it floats OVER the page,
   not inside the flex row of the nav bar.
   Hidden by default; only shown when parent has .open  */
.nav-dropdown {
  /* Hidden by default */
  display: none;

  /* Float above the page — not a flex child of the nav row */
  position: absolute;
  top: 100%;            /* flush below the nav bar */
  left: 0;
  z-index: 9999;

  /* Dimensions & look */
  min-width: 200px;
  width: max-content;
  background: #ffffff;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.18);
  border-top: 3px solid var(--accent-gold, #c9a961);
  overflow: hidden;

  /* Break OUT of the parent flex/grid — critical fix */
  flex-direction: column !important;
  flex-wrap: nowrap !important;
}

/* Fade-in animation */
@keyframes ddFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Show when parent li has .open class — added by JS on click */
.nav-dropdown-item.open .nav-dropdown {
  display: flex !important;          /* flex column — items stack vertically */
  flex-direction: column !important;
  animation: ddFadeIn 0.18s ease;
}

/* Each dropdown option */
.nav-dropdown li {
  list-style: none;
  width: 100%;
  flex: none;
}

.nav-dropdown li a {
  display: flex !important;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 20px !important;
  color: #1a2a4a !important;
  font-size: 0.88rem !important;
  font-weight: 500 !important;
  background: #ffffff !important;
  border-bottom: 1px solid #f0f2f5 !important;
  transition: background 0.18s ease, color 0.18s ease, padding-left 0.18s ease !important;
  white-space: nowrap;
  text-decoration: none;
}

.nav-dropdown li:last-child a {
  border-bottom: none !important;
}

.nav-dropdown li a:hover {
  background: #f4f4f0 !important;
  color: #1a2a4a !important;
  padding-left: 26px !important;
}

/* Emoji icon inside dropdown */
.nav-dd-icon {
  font-style: normal;
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1;
}

/* ── Mobile: slide down inline under the nav item ── */
@media (max-width: 768px) {
  /* Parent stays full-width in stacked nav */
  .nav-dropdown-item {
    position: relative;   /* keep for absolute child */
    width: 100%;
  }

  .nav-dropdown-trigger {
    width: 100%;
    justify-content: space-between;
  }

  /* On mobile the dropdown is still absolute but full-width,
     indented with a left accent */
  .nav-dropdown {
    position: relative !important;  /* flows inside the stacked mobile nav */
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    border-top: none !important;
    border-left: 3px solid var(--accent-gold, #c9a961);
    background: rgba(0,0,0,0.15) !important;
  }

  .nav-dropdown li a {
    color: #b8cce0 !important;
    background: transparent !important;
    border-bottom-color: rgba(255,255,255,0.06) !important;
    padding-left: 32px !important;
  }

  .nav-dropdown li a:hover {
    background: rgba(255,255,255,0.07) !important;
    color: #ffffff !important;
    padding-left: 38px !important;
  }
}

/* ══════════════════════════════════════
   SECTION HELPERS
══════════════════════════════════════ */
.content-wrap {
  max-width: 1140px;
  margin: 0 auto;
  padding: 60px 24px;
}

.section-title {
  font-size: 2rem;
  color: var(--primary-navy);
  font-weight: 800;
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
}

/* ══════════════════════════════════════
   FOOTER
══════════════════════════════════════ */
.site-footer {
  background: var(--primary-navy);
  color: #c0cde0;
  padding-top: 48px;
}

.footer-grid {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 32px 40px;
  display: grid;
  grid-template-columns: 2fr 1fr 1.4fr;
  gap: 48px;
  align-items: start;
}

.footer-col { display: flex; flex-direction: column; gap: 10px; }

.footer-col h3 {
  font-size: 1.1rem;
  color: #fff;
  font-weight: 700;
  margin-bottom: 2px;
}

.footer-col h4 {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e09040;
  margin-bottom: 6px;
}

.footer-col p,
.footer-col a {
  font-size: 0.86rem;
  color: #9aafcc;
  line-height: 1.6;
  transition: color var(--transition);
}

.footer-col a:hover { color: #fff; }

.footer-social {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.footer-social a {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  overflow: hidden;
}

.footer-social a:hover { background: #e09040; }

.footer-social img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  max-width: 1140px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
  color: #6a80a0;
}

.footer-bottom a { color: #e09040; transition: color var(--transition); }
.footer-bottom a:hover { color: #fff; }

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */

/* ── Tablet ── */
@media (max-width: 960px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Mobile: 768px and below ── */
@media (max-width: 768px) {

  /* Top strip: stack on very small */
  .institute-strip {
    padding: 5px 14px;
    font-size: 0.7rem;
  }

  /* ─────────────────────────────────────────
     HEADER FIX
     Keep both groups on ONE row by:
     1. Making the header nowrap (already set above)
     2. Shrinking logos
     3. Hiding the text block to free horizontal space
  ───────────────────────────────────────── */
  .site-header {
    padding: 8px 12px;
    gap: 8px;
  }

  /* Shrink IIT logos */
  .logo-left img {
    height: 36px;
  }

  /* Hide text — logos alone identify the institutions on mobile */
  .institute-name {
    display: none;
  }

  /* MEMBER Lab logo: smaller but still visible, stays right */
  .logo-right img {
    height: 42px;
  }

  /* Hamburger visible */
  .nav-toggle {
    display: block;
  }

  /* Nav collapses by default */
  .main-nav ul {
    display: none;
    flex-direction: column;
    background: var(--primary-navy);
    width: 100%;
    border-top: 1px solid rgba(255,255,255,0.08);
  }

  .main-nav ul.open {
    display: flex;
  }

  .main-nav ul li a {
    padding: 13px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.9rem;
  }

  .nav-container {
    padding: 0 12px;
  }
}

/* ── Very small phones: 420px and below ── */
@media (max-width: 420px) {
  .logo-left img {
    height: 30px;
  }

  .logo-right img {
    height: 36px;
  }
}

/* ── Footer small screen ── */
@media (max-width: 600px) {
  .footer-grid {
    grid-template-columns: 1fr;
    padding: 0 18px 32px;
  }
  .institute-strip {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }
}


/* ══════════════════════════════════════
   MOBILE HEADER OVERRIDE PATCH
   Extra-specific rules to beat any
   conflicting styles from old CSS files
══════════════════════════════════════ */
@media (max-width: 768px) {
  /* Force single row — override anything */
  .site-header {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding: 8px 12px !important;
    gap: 8px !important;
  }

  /* Left side shrinks but never pushes right side down */
  .logo-left {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: calc(100% - 60px) !important; /* leave room for MEMBER logo */
    overflow: hidden !important;
    gap: 6px !important;
    width: auto !important;           /* kill any width:100% */
  }

  .logo-left img {
    height: 36px !important;
    width: auto !important;
    flex-shrink: 0 !important;
  }

  /* Hide text to save space */
  .logo-left .institute-name,
  .logo-left div.institute-name {
    display: none !important;
  }

  /* MEMBER logo stays pinned right */
  .logo-right {
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    margin-left: auto !important;
    width: auto !important;
  }

  .logo-right img {
    height: 42px !important;
    width: auto !important;
    display: block !important;
  }
}

@media (max-width: 420px) {
  .logo-left img  { height: 30px !important; }
  .logo-right img { height: 36px !important; }
}