/* =====================================================
   style.css  –  Global base styles
   MEMBER Lab, IIT Kharagpur
   ===================================================== */

*, *::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
══════════════════════════════════════ */
.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
══════════════════════════════════════ */
.site-header {
  background: #fff;
  border-bottom: 2px solid var(--border-soft);
  padding: 10px 28px;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.logo-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  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.78rem;
    font-weight: 700;
    color: var(--primary-navy);
    line-height: 1.2;
    white-space: normal;
    overflow: visible;
}

.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;
}

.logo-right {
  flex-shrink: 0;
  flex-grow: 0;
  display: flex;
  align-items: center;
}

.logo-right img {
  height: 56px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* ══════════════════════════════════════
   NAVIGATION — desktop
══════════════════════════════════════ */
.main-nav {
  background: var(--primary-navy);
  position: sticky;
  top: 0;
  z-index: 500;
}

.nav-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  position: relative;
}

/* Desktop: top-level ul is a flex row */
.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 — ALWAYS hidden on desktop, shown ONLY via mobile media query below */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  padding: 12px 8px;
  margin-left: auto;
  line-height: 1;
  flex-shrink: 0;
}

/* Explicitly hide hamburger on all screens wider than 768px */
@media (min-width: 769px) {
  .nav-toggle {
    display: none !important;
  }
}

/* ══════════════════════════════════════
   MEMBERS DROPDOWN
══════════════════════════════════════ */
.nav-dropdown-item {
  position: relative;
}

.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);
}

.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);
}

/* Dropdown panel — hidden by default, floats below nav */
.nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 9999;
  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);
  overflow: hidden;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
}

@keyframes ddFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nav-dropdown-item.open .nav-dropdown {
  display: flex !important;
  flex-direction: column !important;
  animation: ddFadeIn 0.18s ease;
}

.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;
}

.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;
}

.nav-dd-icon {
  font-style: normal;
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1;
}

/* ══════════════════════════════════════
   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 — MOBILE  ≤ 768px
   Fixes:
   1. Header: logos + text on left, MEMBER logo on right
      (same layout as desktop, just smaller)
   2. Nav: compact dropdown, NOT full-screen
══════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Top strip ── */
  .institute-strip {
    padding: 5px 12px;
    font-size: 0.68rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  /* ── Header: one row, logos + text left, MEMBER right ── */
  .site-header {
    padding: 8px 12px !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
  }

  /* Left group: both IIT logos + text block, all smaller */
  .logo-left {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    gap: 7px !important;
    align-items: center !important;
    overflow: hidden !important;
  }

  /* IIT logos: smaller but both visible */
  .logo-left img {
    height: 34px !important;
    flex-shrink: 0 !important;
  }

  /* Text block: show on mobile too, just smaller */
  .institute-name {
    display: flex !important;
    flex-direction: column !important;
    gap: 1px !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .institute-name .hindi {
    font-size: 0.6rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .institute-name .english {
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    white-space: normal !important;
    overflow: visible !important;
    line-height: 1.2 !important;
  }

  .institute-name .dept {
    font-size: 0.58rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* MEMBER Lab logo: pinned right, never wraps */
  .logo-right {
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    margin-left: 8px !important;
  }

  .logo-right img {
    height: 40px !important;
    width: auto !important;
  }

  /* ── Hamburger: visible on mobile ── */
  .nav-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
  }

  /* ── Nav list: hidden by default, slides down when open ──
     KEY FIX: max-height + overflow so it doesn't fill screen */
  .main-nav ul:not(.nav-dropdown) {
    display: none !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    background: var(--primary-navy) !important;
    border-top: 1px solid rgba(255,255,255,0.08) !important;
    /* Prevent full-screen takeover */
    max-height: 55vh !important;
    overflow-y: auto !important;
  }

  .main-nav ul:not(.nav-dropdown).open {
    display: flex !important;
  }

  .main-nav ul li {
    width: 100%;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }

  .main-nav ul li a {
    padding: 8px 16px !important;
    font-size: 0.82rem !important;
    width: 100% !important;
    display: block !important;
}

  .nav-container {
    padding: 0 12px !important;
    flex-wrap: wrap !important;
    align-items: center !important;
  }

  /* ── Members dropdown on mobile: inline below trigger ── */
  .nav-dropdown-item {
    position: relative !important;
    width: 100% !important;
  }

  .nav-dropdown-trigger {
    width: 100% !important;
    justify-content: space-between !important;
    padding: 8px 16px !important;
}

  .nav-dropdown {
    position: relative !important;
    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) !important;
    background: rgba(0,0,0,0.2) !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: #fff !important;
    padding-left: 38px !important;
  }

  /* ── Footer ── */
  .footer-grid {
    grid-template-columns: 1fr;
    padding: 0 16px 28px;
    gap: 28px;
  }
}

/* ── Very small: 420px ── */
@media (max-width: 420px) {
  .logo-left img        { height: 28px !important; }
  .logo-right img       { height: 34px !important; }
  .institute-name .english { font-size: 0.65rem !important; }
  .institute-name .hindi   { display: none !important; }
  .institute-name .dept    { font-size: 0.55rem !important; }
}

/* ── Tablet footer ── */
@media (max-width: 960px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* === MOBILE HOTFIXES === */
@media (max-width:768px){
  .main-nav{position:relative!important;}

  /* Keep nav-container as flex so hamburger aligns correctly */
  .nav-container{
    display:flex!important;
    flex-wrap:wrap!important;
    align-items:center!important;
  }

  .nav-toggle{
    margin-left:auto!important;
    order: 1;
  }

  .main-nav ul:not(.nav-dropdown){
    order: 2;
    width:100%!important;
    max-height:55vh!important;
    overflow-y:auto!important;
  }

  .main-nav ul:not(.nav-dropdown).open{
    display:flex!important;
  }

  .nav-dropdown-item.open .nav-dropdown{
    display:flex!important;
  }

  .site-header{
    display:flex!important;
    justify-content:space-between!important;
    align-items:center!important;
    flex-wrap:nowrap!important;
  }

  .logo-left{
    flex:1 1 auto!important;
    display:flex!important;
    flex-wrap:nowrap!important;
    min-width:0!important;
  }

  .logo-right{
    display:flex!important;
    flex-shrink:0!important;
    margin-left:8px!important;
  }

  .logo-left img,
  .logo-right img{
    object-fit:contain!important;
  }
}
