/* by Creasant */
@media screen and (max-width: 768px) {
  .intro-text {
    font-size: 16px;
  }
  
  .mobile-align-center {
    text-align: center !important;
    float: unset !important;
  }

  .flex-gap-30 .mtpc-2col-section-wrapper {
    gap: 15px;
  }

  .flex-gap-50 .mtpc-2col-section-wrapper {
    gap: 30px;
  }

  .mobile-reverse-row .mtpc-2col-section-wrapper {
    flex-direction: column-reverse !important;
    display: flex;
  }
  
  .mtpc-2col-section.l10_90 .mtpc-2col-section-wrapper>.mtpc-2col-item--1,
  .mtpc-2col-section.l10_90 .mtpc-2col-section-wrapper>.mtpc-2col-item--2 {
    width: 100% !important;
  }


  h2 {
    font-size: 36px;
  }
  
  .mtpc_pagetitle.mtpc_gallery h1 {
    font-size: 36px;
  }
  
  h3 {
    font-size: 24px;
  }
  
  #block-mtpc-secondfooter h3 {
    text-align: center;
  }
  
  #block-mtpc-secondfooter .field--name-field-mtpc-profile-listing-item {
    grid-template-columns: repeat(1, 1fr);
  }
  
  #block-mtpc-secondfooter .collaborating_universities_wrapper .field--name-field-mtpc-profile-listing-item {
    grid-template-columns: repeat(6, 1fr);   /* 6 columns, each logo spans 2 = 3 per row */
    gap: 30px 20px;
  }

  /* reset every item, so the earlier 4+3 rules (nth-child(4) etc.) stop applying */
  #block-mtpc-secondfooter .collaborating_universities_wrapper .field--name-field-mtpc-profile-listing-item > .field__item:nth-child(n) {
    grid-column: span 2;
    order: 0;
  }

  /* CUHK, EdUHK go after HKU (item 7) */
  #block-mtpc-secondfooter .collaborating_universities_wrapper .field--name-field-mtpc-profile-listing-item > .field__item:nth-child(4),
  #block-mtpc-secondfooter .collaborating_universities_wrapper .field--name-field-mtpc-profile-listing-item > .field__item:nth-child(5) {
    order: 1;
  }

  /* PolyU goes last, starting at column 3 so it sits in the middle */
  #block-mtpc-secondfooter .collaborating_universities_wrapper .field--name-field-mtpc-profile-listing-item > .field__item:nth-child(6) {
    order: 2;
    grid-column: 3 / span 2;
  }
  
  .info-wrapper .mtpc-3col-section-wrapper>.mtpc-3col-item:not(:first-child) {
    margin-top: 15px;
  }
  
  .point-section .mtpc-image-grid-block-item .grid_main_image {
    width: 40%;
    min-width: 270px;
  }
  
  .point-section .mtpc-image-grid-block-item:nth-child(odd),
  .point-section .mtpc-image-grid-block-item:nth-child(even) {
    margin-top: 20px !important;
  }
  
  .point-section .mtpc-image-grid-block-item .mtpc-image-caption {
    width: 80%;
    margin: 0 auto;
  }
  
  .resources-section .mtpc-2col-section-wrapper>.mtpc-2col-item--2 {
    margin-top: 40px;
  }
  
  .view-id-mtpc_albums .view-header {
    padding-left: 0;
  }
  
  .path-photos-videos .mtpc_pagetitle.mtpc_gallery h1,
  .page-node-type-mtpc-gallery .mtpc_pagetitle.mtpc_gallery h1 {
    padding-top: 60px;
  }
  
  .tbl-scroll-wrapper {
    overflow: auto;
  }
  
  .tbl-scroll-wrapper:not(.crf) table {
    min-width: 768px;
  }
}

@media screen and (max-width: 767px) {
  .mtpc-4col-section .mtpc-4col-section-wrapper>.mtpc-4col-item:first-child {
    margin-top: 0;
  }
}

@media (max-width: 640px) {
  table.tbl-bg.tbl-bg thead tr th,
  table.tbl-bg.tbl-bg tbody tr td { padding: 12px 14px; }
  table.tbl-bg.tbl-bg tbody tr td:first-child { width: auto; }
}

@media (max-width: 640px) {
  .venue-tbl table.tbl-bg.tbl-bg thead tr th:first-of-type { width: 110px; }
  .venue-tbl table.tbl-bg.tbl-bg thead tr th:nth-of-type(2) { width: auto; }
  .venue-tbl table.tbl-bg.tbl-bg tbody tr td:first-child:nth-last-child(4) { white-space: normal; }
  .venue-tbl table.tbl-bg.tbl-bg tbody tr td:first-child:nth-last-child(4) br { display: initial; }
}

@media (max-width: 580px) {
  h2 {
    font-size: 32px;
    line-height: 40px;  
  }
  
  header .mtpc_header .header .wrapper .logos .logos_left .logo_one img {
    height: 25px;
  }
  
  #block-mtpc-secondfooter .collaborating_universities_wrapper .field--name-field-mtpc-profile-listing-item.field--name-field-mtpc-profile-listing-item {
    grid-template-columns: repeat(4, 1fr);
    gap: 30px 20px;
  }
  
  /* 2 per row, and reset the order/column overrides from the 768px and 1200px rules */
  #block-mtpc-secondfooter .collaborating_universities_wrapper .field--name-field-mtpc-profile-listing-item > .field__item:nth-child(n):nth-child(n):nth-child(n) {
    grid-column: span 2;
    order: 0;
  }
}

@media (max-width: 575px) {
  .speaker-wrapper {
    padding-top: 0;
  }
  
  .speaker-wrapper .mtpc_pl_item_container {
    margin-bottom: 30px;
  }
  
  .speaker-wrapper > .field__items > .field__item,
  .speaker-wrapper[data-count="4"] > .field__items > .field__item { flex-basis: 100%; max-width: 100%; padding-bottom: 28px; }
  .speaker-wrapper > .field__items > .field__item::before { display: none !important; }
  
  .speaker-wrapper .mtpc_pl_texts {
    width: 100% !important;
  }
  
  .speaker-wrapper .mtpc_profile_name_container a .mtpc_profile_name {
    font-size: 22px !important;  
  }
  
  .speaker-wrapper .mtpc_pl_pic {
    margin-bottom: 0 !important;
  }
}

@media (max-width: 530px) {
  .organizers-img img {
    width: 80%;
    margin: 0 auto;
  }
}