/* =================== Global Styles =================== */
:root {
  --color-primary: #6c63ff;
  --color-success: #00bf8e;
  --color-warning: #f7c94b;
  --color-danger: #f75842;
  --color-danger-variant: rgba(247, 88, 66, 0.4);
  --color-white: #fff;
  --color-light: rgba(255, 255, 255, 0.7);
  --color-black: #000;
  --color-bg: #1f2641;
  --color-bg1: #2e3267;
  --color-bg2: #424890;
  --container-width-lg: 80%;
  --container-width-md: 90%;
  --container-width-sm: 94%;
  --transition: all 400ms ease;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
}

.main-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 20px;
  row-gap: 20px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 30px 10px 30px;
  box-sizing: border-box;
}

/* =================== Main Carousel =================== */
.carousel-item {
  flex: 0 0 100%;
  display: none;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: box-shadow 0.4s ease;
  border-radius: 15px;
  margin: 0;
}

.carousel-item:hover::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 15px;
  pointer-events: none;
  box-shadow: inset 0 0 15px rgba(255, 123, 0, 0.5);
}

.carousel-container {
  position: relative;
  flex: 1 1 0;
  width: auto;
  max-width: none;
  height: 460px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

.carousel {
  display: flex;
  transition: transform 0.5s ease;
  width: 100%;
}

.carousel-container .carousel {
  width: 100%;
  display: flex;
  overflow: hidden;
}

.carousel-item.active {
  display: flex;
}

.carousel-item img {
  width: 100%;
  height: 460px;
  object-fit: cover;
  object-position: center top;
  display: block;
  border-radius: 15px;
  transition: box-shadow 0.4s ease;
}

.carousel-item img:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  outline: 2px solid rgba(31, 78, 121, 0.4);
  border-radius: 15px;
}

.main-carousel-announcements {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 20px;
  flex-wrap: nowrap;
  height: 460px;
  grid-column: 1 / -1;
}

/* =================== Carousel Controls =================== */
.prev-button,
.next-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: auto;
  font-size: 28px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background-color: rgba(0, 0, 0, 0.3);
  border: none;
  cursor: pointer;
  opacity: 0.3;
  transition: opacity 0.3s, transform 0.3s;
}

.prev-button { left: 15px; }
.next-button { right: 15px; }

.prev-button:hover,
.next-button:hover {
  opacity: 1;
  background-color: #f75842;
  transform: translateY(-50%) scale(1.08);
}

.carousel-container:hover .prev-button,
.carousel-container:hover .next-button {
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.85;
}

.carousel-container .prev-button,
.carousel-container .next-button {
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
}

.carousel-dots {
  position: relative;
  text-align: center;
  margin: 10px;
}

.dot {
  height: 15px;
  width: 15px;
  margin: 10px;
  background-color: #bbb;
  border-radius: 50%;
  display: inline-block;
}

.dot.active {
  background-color: #333;
}

/* =================== Announcements =================== */
.announcements {
  flex: 0 0 22%;
  width: 22%;
  height: 460px;
  overflow-y: auto;
  padding: 5px;
  border: 2px solid #1f4e79;
  border-radius: 8px;
  background-color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
  margin-top: 0;
}

@media (min-width: 1051px) {
  .announcements {
    position: relative;
    top: 2px;
    height: 458px;
  }
}

.announcements h2 {
  text-align: center;
  margin: 0;
}

.announcement-list {
  max-height: 430px;
  overflow-y: auto;
  scrollbar-color: #1f4e79 #fff;
  scrollbar-width: auto;
  padding-right: 12px;
}

.announcement-list * {
  text-align: justify;
  line-height: 1.6;
  word-break: break-word;
}

.announcement-list a {
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.5;
  display: inline;
  text-decoration: none;
  color: #1f4e79;
  position: relative;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.announcement-list a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0%;
  height: 2px;
  background-color: #00bf8e;
  transition: width 0.3s ease;
}

.announcement-list a:hover {
  color: #ff7b00;
  text-shadow: 0 2px 8px rgba(255, 123, 0, 0.4);
}

.announcement-list a::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0%;
  height: 2px;
  background: linear-gradient(90deg, #ff7b00, transparent);
  transition: width 0.3s ease;
}

.announcement-list a:hover::before { width: 100%; }
.announcement-list a:hover::after { width: 100%; }

.announcement-list p,
.announcement-list span,
.announcement-list div {
  line-height: 1.5;
  margin-bottom: 8px;
}

.announcement-list > div {
  margin-bottom: 12px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 8px;
}

.announcement-list::-webkit-scrollbar {
  width: 10px;
  background-color: #fff;
}

.announcement-list::-webkit-scrollbar-thumb {
  background-color: #1f4e79;
  border-radius: 10px;
}

.announcement-list::-webkit-scrollbar-thumb:hover { background-color: #333; }

hr {
  margin: 10px 0;
  border-color: #1f4e79;
}

/* =================== Spotlight =================== */
.spotlight-section {
  display: contents;
  padding-top: 20px;
}

.spotlight-section h2 {
  text-align: center;
  color: #d65a1f;
}

.spotlight {
  height: 500px;
  flex: 1 1 0;
  width: auto;
  padding: 10px;
  box-sizing: border-box;
  border: 1px solid #1f4e79;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.spotlight-carousel {
  position: relative;
  width: 100%;
  min-height: 300px;
  overflow: hidden;
}

.spotlight-carousel-item {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  width: 100%;
  height: auto;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.spotlight-carousel-item.active {
  opacity: 1;
  z-index: 1;
  position: relative;
}

.spotlight-carousel-item img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  margin: auto;
}

.spotlight-carousel-item p {
  padding: 10px;
  font-size: 16px;
  text-align: justify;
  margin: 0;
}

.spotlight-carousel-controls {
  position: relative;
  text-align: center;
  margin-top: 20px;
}

.spotlight-prev-button,
.spotlight-next-button {
  position: absolute;
  top: -250px;
  font-size: 24px;
  cursor: pointer;
  padding: 10px;
  border-radius: 50%;
  background-color: white;
  color: #333;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.spotlight-prev-button { left: 0; }
.spotlight-next-button { right: 0; }

.spotlight-dots {
  position: relative;
  text-align: center;
  margin-top: 20px;
}

.spotlight-dot {
  height: 15px;
  width: 15px;
  margin: 0 10px;
  background-color: #bbb;
  border-radius: 50%;
  display: none;
}

.spotlight-dot.active { background-color: #333; }

.seminars-events h2 {
  text-align: center;
  color: #287c7c;
}

/* =================== Seminars / Events =================== */
.seminars-events {
  height: 500px;
  flex: 1 1 0;
  width: auto;
  padding: 10px;
  box-sizing: border-box;
  border: 1px solid #1f4e79;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.seminars-events-list a {
  position: relative;
  text-decoration: none;
  color: #1f4e79;
  display: inline-block;
  padding-bottom: 2px;
  transition: color 0.3s ease;
}

.seminars-events-list a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 0;
  height: 2px;
  background-color: #f75842;
  transition: width 0.3s ease, left 0.3s ease;
}

.seminars-events-list a:hover { color: #f75842; }
.seminars-events-list a:hover::after { width: 100%; left: 0; }
.latest-publications h2 {
  text-align: center;
  color: #245a8d;
}

/* =================== Latest Publications =================== */
.latest-publications {
  height: 500px;
  flex: 1 1 0;
  width: auto;
  padding: 10px;
  box-sizing: border-box;
  border: 1px solid #1f4e79;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.latest-publications-list {
  overflow-y: auto;
  scrollbar-color: #1f4e79 #fff;
  scrollbar-width: auto;
}

.latest-publications-list a {
  position: relative;
  text-decoration: none;
  color: #1f4e79;
  display: inline-block;
  padding-bottom: 2px;
  transition: color 0.3s ease;
}

.latest-publications-list a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 0;
  height: 2px;
  background-color: #6c63ff;
  transition: width 0.3s ease, left 0.3s ease;
}

.latest-publications-list a:hover { color: #6c63ff; }
.latest-publications-list a:hover::after { width: 100%; left: 0; }

/* Featured publication / journal name */
.latest-publications-list em,
.latest-publications-list i {
  color: #7a4e8a !important;
}

.latest-publications-list::-webkit-scrollbar {
  width: 10px;
  background-color: #fff;
}

.latest-publications-list::-webkit-scrollbar-thumb {
  background-color: #1f4e79;
  border-radius: 10px;
}

.latest-publications-list::-webkit-scrollbar-thumb:hover { background-color: #333; }

/* =================== Common Scrollbars =================== */
.spotlight-list,
.seminars-events-list,
.latest-publications-list {
  max-height: 340px;
  overflow-y: auto;
  scrollbar-color: #1f4e79 #fff;
  scrollbar-width: auto;
}

.spotlight-list::-webkit-scrollbar,
.seminars-events-list::-webkit-scrollbar,
.latest-publications-list::-webkit-scrollbar {
  width: 10px;
  background-color: #fff;
}

.spotlight-list::-webkit-scrollbar-thumb,
.seminars-events-list::-webkit-scrollbar-thumb,
.latest-publications-list::-webkit-scrollbar-thumb {
  background-color: #1f4e79;
  border-radius: 10px;
}

.spotlight-list::-webkit-scrollbar-thumb:hover,
.seminars-events-list::-webkit-scrollbar-thumb:hover,
.latest-publications-list::-webkit-scrollbar-thumb:hover { background-color: #333; }

/* =================== Page Container =================== */
.page-container {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0 30px 20px 30px;
  box-sizing: border-box;
}

/* =================== Responsive =================== */

/*
 * IMPORTANT:
 * The carousel JavaScript is already working correctly.
 * These responsive rules only fix layout/sizing.
 * The carousel continues to use the existing .active class system.
 */

/* ---------- Tablet / medium screens: 481px–1050px ---------- */

@media (min-width: 481px) and (max-width: 1050px) {

  html,
  body {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  .page-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 15px 20px 15px !important;
    box-sizing: border-box !important;
  }

  .main-columns {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 15px 10px 15px !important;
    column-gap: 0 !important;
    row-gap: 20px !important;
    box-sizing: border-box !important;
  }

  .main-carousel-announcements {
    grid-column: 1 / -1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  .carousel-container {
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 430px !important;
    min-height: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  .carousel-container .carousel {
    width: 100% !important;
    max-width: 100% !important;
    height: 430px !important;
    display: flex !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  /*
   * Preserve the working JavaScript carousel:
   * main.js changes the .active class.
   */
  .carousel-container .carousel .carousel-item {
    display: none !important;
    flex: 0 0 100% !important;
    width: 100% !important;
    min-width: 100% !important;
    height: 430px !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  .carousel-container .carousel .carousel-item.active {
    display: flex !important;
  }

  .carousel-container .carousel .carousel-item img {
    width: 100% !important;
    max-width: 100% !important;
    height: 430px !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center top !important;
    display: block !important;
  }

  .announcements {
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    max-height: 400px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .announcement-list {
    max-height: calc(400px - 60px) !important;
    overflow-y: auto !important;
    padding-right: 12px;
  }
    /* ---------------------------------------------------------
     HEADER: 481px–1050px ONLY
     Keep IITH beside Dept of Physics
     --------------------------------------------------------- */
  /* ---------------------------------------------------------
     HEADER: 481px–1050px
     Hide IITH — keep only Dept of Physics
     --------------------------------------------------------- */
.mobile-title {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 15px !important;
}

.mobile-title .dept {
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
}

.mobile-title .dept h1 {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.1 !important;
}

.mobile-title .inst {
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 16px !important;
  line-height: 1.1 !important;
  text-align: center !important;
}
  
 
}

@media (min-width: 769px) {
  .mobile-title {
    display: none !important;
  }
}


/* ---------- Mobile: 480px and below ---------- */

@media (max-width: 480px) {

  html,
  body {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
  }

  .page-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 10px 20px 10px !important;
    box-sizing: border-box !important;
  }

  .main-columns {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    column-gap: 0 !important;
    row-gap: 20px !important;
    box-sizing: border-box !important;
  }

  .spotlight-section {
    display: contents;
  }

  .spotlight,
  .seminars-events,
  .latest-publications {
    flex: none;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-bottom: 0;
    box-sizing: border-box;
  }

  .main-carousel-announcements {
    grid-column: 1 / -1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    z-index: 1;
    box-sizing: border-box !important;
  }

  .carousel-container {
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 56vw !important;
    max-height: 430px !important;
    min-height: 220px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  .carousel-container .carousel {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow: hidden !important;
    position: relative !important;

    /*
     * Do NOT use transform-based sliding here.
     * The existing JavaScript correctly switches .active.
     */
    transform: none !important;
    transition: none !important;

    box-sizing: border-box !important;
  }

  .carousel-container .carousel .carousel-item {
    display: none !important;
    flex: 0 0 100% !important;
    width: 100% !important;
    min-width: 100% !important;
    height: 100% !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    box-sizing: border-box !important;
  }

  .carousel-container .carousel .carousel-item.active {
    display: flex !important;
  }

  .carousel-container .carousel .carousel-item img {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center top !important;
    display: block !important;
  }

  .announcements {
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    max-height: 300px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  .announcement-list {
    max-height: calc(300px - 60px) !important;
    overflow-y: auto !important;
    padding-right: 12px;
  }

  /*
   * Header safety.
   * These rules prevent a desktop fixed/minimum width from making
   * the header collapse into a narrow column on small screens.
   */
  header,
  .header,
  .header-content,
  .header-inner,
  .site-header,
  .top-header {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .header h1,
  header h1,
  .header-content h1,
  .header-inner h1,
  .site-header h1,
  .top-header h1 {
    max-width: calc(100vw - 30px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    font-size: 30px !important;
    line-height: 1.1 !important;
    text-align: center !important;
    white-space: normal !important;
  }

  .header h2,
  header h2,
  .header-content h2,
  .header-inner h2,
  .site-header h2,
  .top-header h2 {
    max-width: calc(100vw - 30px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    font-size: 18px !important;
    line-height: 1.15 !important;
    text-align: center !important;
    white-space: normal !important;
  }
}


/* ---------- Very small phones ---------- */

@media (max-width: 360px) {

  .page-container {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  .main-carousel-announcements {
    gap: 15px !important;
  }

  .carousel-container {
    min-height: 200px !important;
  }
}

/* =================== Box Hover Effects =================== */
.announcements,
.spotlight,
.seminars-events,
.latest-publications {
  transition: background-color 0.3s ease, border-radius 0.3s ease;
}

.announcements:hover,
.spotlight:hover,
.seminars-events:hover,
.latest-publications:hover {
  background-color: #fff4e5;
  border-radius: 12px;
}

/* =================== Text =================== */
.announcement-list,
.spotlight,
.seminars-events-list,
.latest-publications-list {
  color: #222;
  font-weight: 500;
}

.announcement-list a,
.seminars-events-list a,
.latest-publications-list a { color: #333; }

.announcement-list a:hover,
.seminars-events-list a:hover,
.latest-publications-list a:hover { color: #000; }

/* =================== Badges =================== */
.new-badge {
  background: #ff9800;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 12px;
  margin-left: 5px;
  display: none;
}

.recent-badge {
  background: #1976d2;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 12px;
  margin-left: 5px;
  display: none;
}

.new-badge,
.recent-badge {
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}
