/* Custom styles for news section */

/* Align icons vertically with bullet points and match text size */
#news ul li i.fas,
#news ul li i.fa,
#news ul li svg.svg-inline--fa {
  font-size: 0.85em !important;
  vertical-align: middle !important;
  margin-left: 0.2em !important;
  margin-right: 0.05em !important;
  position: relative !important;
  top: -0.08em !important;
}

/* Match news text size with regular body text */
#news ul li {
  font-size: inherit !important;
  line-height: inherit !important;
}

/* Enlarge and align the News "Show More / Show Less" toggle */
#news-toggle {
  font-size: 0.8rem !important; /* increase if desired */
  line-height: 1.5 !important;
}

#news-toggle i {
  vertical-align: middle !important;
  margin-left: 0.35em !important; /* spacing like see-all */
}

/* Publications section - make left column (title) smaller, right column larger */
#publications .section-heading {
  flex: 0 0 40%;
  max-width: 40%;
}

#publications .section-heading h1 {
  margin-bottom: 1.2rem !important;
}

#publications .section-heading + div {
  flex: 0 0 100%;
  max-width: 100%;
}

/* Make publication images larger */
#publications .stream-item .mr-3 {
  max-width: 250px !important;
  flex-shrink: 0 !important;
  overflow: hidden !important; /* keep media fully inside the view */
}

#publications .stream-item .mr-3 img {
  max-width: 250px !important;
  width: auto !important;
  height: auto !important;
  display: block !important;
}

/* Make publication titles larger */
#publications .article-title {
  font-size: 1.2rem !important;
  font-weight: 600 !important;
}

/* Add more spacing around publication content */
#publications .stream-item .mr-3 {
  margin-right: 1.2rem !important;
}

#publications .media-body {
  flex: 1 !important;
}

/* Add vertical divider lines between filter controls */
.pub-filters.form-control {
  border: 1px solid #ced4da !important;
  border-left: 1px solid #dee2e6 !important;
  border-radius: 0 !important;
}

.form-row .col-auto:first-child .filter-search {
  border-radius: 0.25rem 0 0 0.25rem !important;
}

.form-row .col-auto:last-child .pub-filters {
  border-radius: 0 0.25rem 0.25rem 0 !important;
}

/* Make date dropdown wider */
.pub-filters[data-filter-group="year"] {
  min-width: 110px !important;
}

/* PUBLICATIONS - Desktop/tablet: vertically center image to text */
@media screen and (min-width: 992px) {
  #publications .media {
    display: flex !important;
    align-items: center !important; /* vertically center image and text */
  }

  #publications .stream-item .mr-3,
  #publications .stream-item .ml-3 {
    align-self: center !important; /* ensure image column centers */
  }
}

/* Projects filter bar: force primary buttons to #1565c0 */
#projects .project-toolbar .btn.btn-primary {
  background-color: #1565c0 !important;
  border-color: #1565c0 !important;
  color: #fff !important;
  transition: background-color 0.12s ease, border-color 0.12s ease,
              transform 0.12s ease, box-shadow 0.12s ease;
  transform-origin: center center;
}

#projects .project-toolbar .btn.btn-primary:hover {
  background-color: #0d47a1 !important; /* darker hover */
  border-color: #0d47a1 !important;
  color: #fff !important;
  transform: scale(1.03);
}

#projects .project-toolbar .btn.btn-primary:focus {
  background-color: #0d47a1 !important; /* match hover color on focus */
  border-color: #0d47a1 !important;
  color: #fff !important;
  outline: none !important;
  transform: scale(1.05);
  /* Darker outer focus ring + deeper shadow */
  box-shadow: 0 0 0 0.25rem rgba(6, 35, 77, 0.65), 0 6px 12px rgba(6, 35, 77, 0.65) !important;
}

#projects .project-toolbar .btn.btn-primary.active,
#projects .project-toolbar .btn.btn-primary:active,
#projects .project-toolbar .btn.btn-primary:not(:disabled):not(.disabled).active,
#projects .project-toolbar .btn.btn-primary:not(:disabled):not(.disabled):active {
  background-color: #0b3c91 !important; /* active pressed */
  border-color: #0b3c91 !important;
  color: #fff !important;
  transform: scale(1.06);
  box-shadow: 0 0 0 0.2rem rgba(21, 101, 192, 0.3), 0 8px 16px rgba(21, 101, 192, 0.2) !important;
}

/* Center Projects images and text, prevent overflow */
#projects .project-card .card {
  overflow: hidden !important;
}

#projects .project-card .card-image,
#projects .project-card .card-image img,
#projects .project-card .img-responsive {
  display: block !important;
  margin-left: auto !important;
  margin-right: auto !important;
  max-width: 100% !important;
  height: auto !important;
}

#projects .project-card .card-text,
#projects .project-card .card-text h4,
#projects .project-card .card-text .article-style,
#projects .project-card .card-text p {
  text-align: center !important;
}

/* Ensure long words/titles wrap instead of overflowing */
#projects .project-card .card-text h4,
#projects .project-card .card-text p,
#projects .project-card .card-text .article-style {
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
}

/* ============================================
   MOBILE & TABLET ONLY STYLES
   ============================================ */

/* Tablets and Mobile devices only (max-width: 991px) */
@media screen and (max-width: 991px) {

  /* Prevent horizontal scroll */
  body {
    overflow-x: hidden !important;
  }

  /* Global mobile containment: keep all sections within viewport */
  .home-section,
  .home-section .container,
  .home-section .row {
    overflow-x: hidden !important;
  }

  /* Media elements scale to viewport */
  img,
  video,
  iframe,
  embed {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Wrap button toolbars to avoid horizontal scroll */
  .btn-toolbar,
  .btn-group {
    flex-wrap: wrap !important;
  }

  /* Make wide tables scrollable rather than overflowing */
  .home-section table {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Keep Publications section title on one line */
  #publications .section-heading {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  #publications .section-heading h1 {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* PUBLICATIONS - Mobile fixes */

  /* Stack publication items vertically and center */
  #publications .stream-item,
  #publications .media {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }

  /* Make publication images smaller and centered */
  #publications .stream-item .mr-3 {
    max-width: 200px !important;
    margin-right: 0 !important;
    margin-bottom: 1rem !important;
    text-align: center !important;
    overflow: hidden !important; /* avoid overflow on small screens */
  }

  /* Also handle left-margin image container variant */
  #publications .stream-item .ml-3 {
    max-width: 200px !important;
    margin-left: 0 !important;
    margin-bottom: 1rem !important;
    text-align: center !important;
  }

  #publications .stream-item .mr-3 img {
    max-width: 200px !important;
    width: auto !important;
  }
  /* Mobile: constrain GIF width and show full image */
  #publications .stream-item .mr-3 img[src$=".gif"] {
    width: 200px !important;   /* mobile match */
    height: auto !important;   /* preserve aspect ratio */
    object-fit: contain !important;
    object-position: center center !important;
  }

  #publications .stream-item .ml-3 img {
    max-width: 200px !important;
    width: auto !important;
  }

  /* Mobile: constrain GIF width in compact view and show full image */
  #publications .stream-item .ml-3 img[src$=".gif"] {
    width: 200px !important;   /* mobile match */
    height: auto !important;   /* preserve aspect ratio */
    object-fit: contain !important;
    object-position: center center !important;
  }

  /* Center publication content */
  #publications .media-body {
    width: 100% !important;
    text-align: center !important;
  }

  /* Publication titles: wrap on mobile to stay in view */
  #publications .article-title {
    font-size: 0.95rem !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    max-width: 100% !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
  }

  #publications .article-title a {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    display: block !important;
    font-size: 0.95rem !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
  }

  /* Authors/metadata: allow wrapping so names stay visible */
  #publications .article-metadata,
  #publications .article-metadata .article-metadata-simple {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    font-size: 0.85rem !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
  }

  /* Smaller font for all publication text */
  #publications .media-body p,
  #publications .article-style,
  #publications .stream-meta {
    font-size: 0.85rem !important;
  }

  #publications .btn-links {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 0.3rem !important;
  }

  /* Compact publication item spacing */
  #publications .stream-item {
    margin-bottom: 2rem !important;
  }

  /* Stack publication filters vertically */
  #publications .form-row {
    flex-direction: column !important;
  }

  #publications .form-row .col-auto {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 0.5rem !important;
  }

  #publications .filter-search,
  #publications .pub-filters {
    width: 100% !important;
  }

  /* PROJECTS - Mobile fixes */
  #projects .projects-container {
    overflow: visible !important; /* avoid clipping images */
  }

  /* Ensure one column and no horizontal overflow */
  #projects .project-card,
  #projects .project-item {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Card images and showcase images scale and center */
  #projects .card-image,
  #projects .card-image img,
  #projects .img-responsive,
  #projects .project-showcase img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* Center project text in all views */
  #projects .card-text,
  #projects .card-text h4,
  #projects .article-style,
  #projects .article-title,
  #projects .btn-links {
    text-align: center !important;
  }

  /* Wrap long words to avoid overflow */
  #projects .card-text h4,
  #projects .article-title,
  #projects .article-style,
  #projects .card-text p {
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
  }

}

/* Ensure publication titles match styling for anchors too */
#publications .article-title a {
  font-size: inherit !important;
  font-weight: inherit !important;
  line-height: inherit !important;
}

/* ============================================
   EXPERIENCE SECTION FIXES
   ============================================ */

/* Normalize logo rendering to avoid baseline misalignment */
.experience .card-body img {
  height: auto !important;
  display: block !important;
}

/* Ensure the logo cell centers content */
.experience .card-body .row.align-items-center {
  align-items: center !important;
}
.experience .card-body .col-auto {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Desktop/tablet: reserve consistent space so text lines align */
@media (min-width: 576px) {
  .experience .card-body .col-auto {
    width: 110px !important;
    min-width: 110px !important;
    flex: 0 0 110px !important;
  }
}

/* Mobile-specific alignment: keep logo and text aligned */
@media (max-width: 575.98px) {
  .experience .card-body .row.align-items-center {
    align-items: center !important;
    flex-wrap: nowrap !important; /* prevent wrapping that breaks alignment */
  }
  .experience .card-body .col-auto {
    width: 90px !important;  /* match template default */
    min-width: 90px !important;
    flex: 0 0 90px !important;
  }
  .experience .card-body img {
    width: 90px !important;
    max-width: 90px !important;
  }
  .experience .card-body .col {
    min-width: 0 !important; /* allow text to shrink without overflow */
  }
}
