/* by Creasant */
@media only screen and (max-width: 1180px), only screen and (min-width: 1180px) and (max-width: 1366px) {
  header .mtpc_header .top-header .wrapper .top_head_right .search_icon {
    display: none;
  }
}

@media only screen and (max-width: 1180px) {
  header .mtpc_header .top-header .wrapper .top_head_right .top_links {
    display: block;
  }

  /* Lang overlay: dark panel + white links (cloned into mobile header) */
  .mtpc_lang_btn .lang_overlay {
    background: #003366;
  }
  .mtpc_lang_btn .lang_overlay ul.language-switcher-language-url li a,
  .mtpc_lang_btn .lang_overlay ul.language-switcher-language-url li a:hover,
  .mtpc_lang_btn .lang_overlay ul.language-switcher-language-url li a.is-active {
    color: #ffffff;
  }

  /* Logo container — shrink height at tablet */
  header .mtpc_header .header .wrapper .logos .logos_container {
    height: 60px;
  }
}

@media (max-width: 1180px) {
  /* Body text */
  body {
    font-size: 24px;
    line-height: 38px;
  }

  /* Heading tags */
  h1 {
    font-size: 58px;
  }
  h2 {
    font-size: 38px;
  }
  h3 {
    font-size: 32px;
  }
  h4 {
    font-size: 26px;
  }
  h5 {
    font-size: 24px;
  }
  h6 {
    font-size: 21px;
  }

  /* Utility typography classes */
  .h1 {
    font-size: 58px;
  }
  .h2 {
    font-size: 38px;
  }
  .h3 {
    font-size: 32px;
  }
  .h4 {
    font-size: 26px;
  }
  .h5 {
    font-size: 24px;
  }
  .h6 {
    font-size: 21px;
  }
  .h7 {
    font-size: 18px;
  }
  .h8 {
    font-size: 16px;
  }

  /* Note text — h7 size, light weight at tablet */
  .note-text {
    font-size: 18px;
    line-height: 26px;
    font-weight: 300;
  }

  .note-text li {
    margin-bottom: 1em;
  }

  /* Number-item — static stacked layout (Figma mobile/tablet). Digit + title
     overlap at top, body content full-width below. No sticky / no morph (JS
     scroll handler also no-ops at this width). */
  /* Neutralize desktop sticky scroller (JS still wraps DOM on all widths). */
  .numbers-scroller {
    height: auto !important;
  }
  .numbers-sticky {
    position: static;
    height: auto;
    overflow: visible;
    display: block;
  }
  .numbers-sticky .mtpc-section-item {
    position: relative;
    inset: auto;
    height: auto;
    display: block;
    margin-bottom: 80px;
  }
  .numbers-morph-wrap {
    display: none;
  }
  /* Desktop hides ::before counter when wrapped in scroller (SVG replaces it);
     re-show it at narrow widths since SVG morph is disabled here. */
  .numbers-sticky .number-item .field--name-field-mod-1-col-container > .field__item:has(.number-item__title)::before {
    display: flex;
    position: static;
    width: auto;
    height: auto;
    font-size: 140px;
  }

  .number-item .field--name-field-mod-1-col-container.field__items {
    display: block;
  }
  .number-item .field--name-field-mod-1-col-container > .field__item:has(.number-item__title) {
    position: relative;
    /* min-height: 303px; */
    min-height: unset;
    margin: 0 0 50px;
    display: block;
  }
  .number-item .field--name-field-mod-1-col-container > .field__item:has(.number-item__title)::before {
    inset: 0 auto auto 0;
    width: 228px;
    height: 303px;
    font-size: 387px;
    line-height: 1;
    justify-content: flex-start;
  }
  .number-item__title {
    /* position: absolute; */
    position: static;
    top: 110px;
    left: 130px;
    right: 0;
    text-align: left;
    z-index: 1;
  }
  .number-item__title h3 {
    color: #003366;
  }
  .number-item .field--name-field-mod-1-col-container > .field__item:has(.number-item__content) {
    margin: 0;
  }
  .number-item__content p {
    font-size: 24px;
    line-height: 38px;
    letter-spacing: 0.72px;
  }

  /* Card grid — stack columns */
  .card-grid.mtpc-2col-section .mtpc-2col-section-wrapper {
    display: block;
  }
  .card-grid.mtpc-2col-section .mtpc-2col-section-wrapper > .mtpc-2col-item {
    width: 100%;
    margin-bottom: 50px;
  }
  .card-grid.mtpc-2col-section .mtpc-2col-section-wrapper > .mtpc-2col-item--2 {
    margin-left: 0;
  }

  /* Top banner */
  .top-banner.mtpc-1col-section {
    clip-path: polygon(0 0, 100% 0, 100% 95%, 0% 100%);
  }

  .top-banner .mtpc-1col-section-wrapper {
    padding: 20px 0 40px;
  }

  .top-banner > img {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 90%);
  }

  /* Team Members view — swap table for card layout */
  .view-team-members .views-view-table {
    display: none;
  }
  .view-team-members .team-member-cards {
    display: block;
  }
  .team-member-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 5px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5ebf0;
  }
  .team-member-card:last-child {
    margin-bottom: 0;
  }
  .team-member-row {
    display: flex;
    align-items: stretch;
    gap: 5px;
    min-height: 56px;
  }
  .team-member-label {
    flex: 0 0 128px;
    box-sizing: border-box;
    padding: 10px 20px;
    background-color: #e5ebf0;
    color: #003366;
    font-size: 21px;
    font-weight: 700;
    line-height: 36px;
  }
  .team-member-value {
    flex: 1 1 auto;
    box-sizing: border-box;
    padding: 10px 20px;
    background-color: #f2f2f2;
    color: #3d3d3d;
  }
  .team-member-row:first-child .team-member-value {
    font-weight: 700;
  }

  /* Companies — grid 2 cols, smaller card title */
  .companies-grid .view-content {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  .company-card__overlay {
    padding: 20px;
  }
  .company-card__face--back {
    padding: 30px;
  }
  .company-card__title {
    font-weight: 400;
    font-size: 24px;
    line-height: 38px;
    letter-spacing: 0.72px;
  }
  .company-card__face--back .company-card__title {
    font-weight: 700;
  }

  /* Companies — card: disable flip, tap-to-expand popup */
  .company-card {
    perspective: none;
  }
  .company-card .company-card__face,
  .company-card:hover .company-card__face {
    transition: opacity 0.3s ease;
  }
  .company-card .company-card__face--front,
  .company-card:hover .company-card__face--front {
    transform: none;
    opacity: 1;
  }
  .company-card .company-card__face--back,
  .company-card:hover .company-card__face--back {
    transform: none;
    opacity: 0;
    pointer-events: none;
  }
  /* Companies — overlay popup (separate element, card stays in grid) */
  .companies-popup {
    display: block;
    position: fixed;
    top: 50%;
    left: 50%;
    width: calc(100vw - 50px);
    max-width: 720px;
    max-height: 80vh;
    overflow-y: auto;
    box-sizing: border-box;
    z-index: 1100;
    padding: 40px 30px 30px;
    background: #ffffff;
    color: #3d3d3d;
    transform: translate(-50%, -50%) scale(0);
    transform-origin: top left;
    transition: transform 0.3s ease;
    pointer-events: none;
  }
  .companies-popup.is-open {
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
  }
  .companies-popup__title {
    margin: 0 0 15px;
    font-weight: 700;
    font-size: 28px;
    line-height: 38px;
    color: #003366;
  }
  .companies-popup__desc {
    font-size: 18px;
    line-height: 28px;
  }
  .companies-popup__close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    text-decoration: none;
    font-size: 0;
    color: transparent;
  }
  .companies-popup__close::before {
    content: "";
    width: 19px;
    height: 19px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='19' height='19' viewBox='0 0 19 19' fill='none'><path d='M0.707031 0.707153L17.707 17.7072' stroke='%233d3d3d' stroke-width='2'/><path d='M17.707 0.707153L0.707032 17.7072' stroke='%233d3d3d' stroke-width='2'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
  }

  /* Companies — filter: collapsed bar with toggle + active pills only */
  .companies-filter {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 40px;
  }
  .companies-filter__pills {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
  }
  .companies-filter__toggle {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    padding: 0;
    background: transparent;
    border: 0;
    color: #003366;
    font-weight: 600;
    font-size: 24px;
    line-height: 35px;
    cursor: pointer;
  }
  .companies-filter__toggle:hover {
    background: transparent;
    color: #003366;
  }
  .companies-filter__icon {
    flex-shrink: 0;
  }
  .companies-filter__pill {
    padding: 5px 25px;
    font-size: 24px;
    line-height: 35px;
  }
  .companies-filter:not(.is-open) .companies-filter__pill:not(.is-active) {
    display: none;
  }

  /* Companies — filter: open overlay (top-anchored, left-aligned pills) */
  .companies-filter.is-open {
    position: fixed;
    inset: 0;
    z-index: 1100;
    margin: 0;
    padding: 100px 25px;
    background: rgba(34, 34, 34, 0.95);
    overflow-y: auto;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 20px;
  }
  .companies-filter.is-open .companies-filter__toggle {
    display: none;
  }
  .companies-filter.is-open .companies-filter__pills {
    width: 100%;
    max-width: 720px;
    gap: 15px;
    justify-content: flex-start;
    order: 1;
  }
  .companies-filter.is-open .companies-filter__pill {
    padding: 10px 30px;
  }
  .companies-filter.is-open .companies-filter__pill:not(.is-active) {
    display: inline-flex;
    background: #ffffff;
    border-color: #9d9c9c;
    color: #1a1a1a;
  }
  .companies-filter.is-open .companies-filter__close {
    width: 100%;
    max-width: 720px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0;
    background: transparent;
    border: 0;
    cursor: pointer;
    order: 0;
  }
  .companies-filter.is-open .companies-filter__close:hover {
    background: transparent;
  }
  .companies-filter.is-open .companies-filter__close::before {
    content: "";
    width: 25px;
    height: 25px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'><path d='M1 1L24 24' stroke='white' stroke-width='2'/><path d='M24 1L1 24' stroke='white' stroke-width='2'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
  }
  body.companies-filter-open {
    overflow: hidden;
  }

  /* News & Events detail — stack content + sidebar in single col */
  .node--type-news-event.node--view-mode-full .node__content {
    grid-template-columns: 1fr;
    grid-template-areas:
      "date"
      "title"
      "banner"
      "body"
      "sidebar"
      "back";
    column-gap: 0;
    padding: 0 30px;
  }
  .node--type-news-event.node--view-mode-full .field--name-field-banner img {
    height: auto;
    aspect-ratio: 1570 / 458;
  }

  /* News & Events — halve grid to 2 cols. Reset explicit col placements
     from desktop so dense flow re-packs big cards across the full width. */
  .news-events-grid .view-content {
    grid-template-columns: repeat(2, 1fr);
  }
  .news-events-grid .view-content > .views-row:nth-child(18n + 3),
  .news-events-grid .view-content > .views-row:nth-child(18n + 7),
  .news-events-grid .view-content > .views-row:nth-child(18n + 17),
  .news-events-grid .view-content > .views-row:nth-child(18n + 4),
  .news-events-grid .view-content > .views-row:nth-child(18n + 16),
  .news-events-grid .view-content > .views-row:nth-child(18n + 18) {
    grid-column: span 2;
    grid-row: span 2;
  }
  .news-events-grid .view-content > .views-row:nth-child(18n + 12),
  .news-events-grid .view-content > .views-row:nth-child(18n + 14),
  .news-events-grid .view-content > .views-row:nth-child(18n + 13),
  .news-events-grid .view-content > .views-row:nth-child(18n + 15) {
    grid-column: span 2;
  }

  .home-news-events-section.mtpc-1col-section {
    padding-top: 80px;
    padding-bottom: 150px;
  }

  /* Contact Us — stack image over content, full-width image */
  .mtpc-1col-section.contact-us {
    padding-top: 60px;
    padding-bottom: 60px;
  }
  .mtpc-1col-section.contact-us .field--name-field-mod-1-col-container > .field__item:first-child {
    margin-bottom: 30px;
  }
  .contact-us-card {
    padding: 40px;
  }
  .contact-us-card-inner {
    flex-direction: column;
    gap: 20px;
  }
  .contact-us-img {
    display: block;
  }
  .contact-us-img .field--name-field-mod-image {
    width: 100%;
  }
  .contact-us-content .field--name-field-mod-long-fmt > .field__item {
    grid-template-columns: 95px 1fr;
    column-gap: 9px;
    row-gap: 20px;
  }
  .contact-us-content p {
    font-size: 24px;
    line-height: 38px;
    letter-spacing: 0.72px;
  }

  .news-events-home .view-content {
    gap: 20px;
    margin-top: 30px;
  }

  .ne-card--home .ne-card__overlay {
    padding: 30px 30px 40px;
  }

  /* Slideshow */
  .mtpc-block-slideshow-block .slick-dots.circle li.slick-active {
    width: 26px;
    height: 26px;
  }
}

@media (max-width: 999px) {
  /* Home slideshow */
  .home-slideshow .mtpc-block-slideshow-block .slick-dots {
    top: unset;
    left: unset;
    bottom: 5%;
    right: 22%;
    transform: translateX(50%);
  }

  .top-banner > img {
    width: calc(100% + 60px);
    margin: 0 -30px;
  }
}
