/**
 * Mobile overrides — load after styles.css
 * Keeps Our Works layout + header menu fixes from being overridden by base rules.
 */
@media (max-width: 768px) {
  .site-header {
    padding-top: calc(max(0.5rem, env(safe-area-inset-top, 0px)) + 4px);
  }

  /* Header: close (X) button above full-screen menu */
  .site-header.site-header--menu-open {
    z-index: 9999;
  }

  .site-header--menu-open .site-header__nav {
    z-index: 1;
  }

  .site-header--menu-open .site-header__logo {
    position: relative;
    z-index: 2;
  }

  .site-header--menu-open .site-header__menu-toggle {
    position: fixed;
    top: calc(max(0.5rem, env(safe-area-inset-top, 0px)) + 4px);
    right: 1rem;
    z-index: 10000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .site-header--menu-open .site-header__menu-icon::before,
  .site-header--menu-open .site-header__menu-icon::after {
    width: 24px;
    left: -1px;
    background: #fff;
  }

  /* Our Works — project cards (collapse empty flex space below text) */
  .works-project {
    flex-wrap: nowrap;
    align-items: stretch;
    align-content: flex-start;
    height: auto;
    min-height: 0;
    gap: 12px;
    justify-content: flex-start;
  }

  .works-project__image {
    flex: 0 0 auto !important;
    width: 100%;
    max-width: 100%;
    height: auto !important;
    min-height: 0;
    aspect-ratio: auto !important;
    border-radius: 14px;
  }

  .works-project__image img {
    position: static;
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    object-position: center top;
  }

  .works-project__body {
    flex: 0 0 auto !important;
    flex-grow: 0 !important;
    width: 100%;
    max-width: none;
    min-height: 0;
    gap: 10px;
  }

  /* Our Works — spacing between project cards */
  section.works-list {
    gap: 0;
    --works-project-gap: 28px;
  }

  section.works-list > #works-projects {
    display: flex !important;
    flex-direction: column !important;
    margin-top: 32px;
    gap: 28px !important;
    row-gap: 28px !important;
  }

  section.works-list > #works-projects > .works-project {
    margin: 0 !important;
    padding-bottom: 0 !important;
    box-sizing: border-box !important;
  }

  section.works-list > .works-toolbar:not(.works-toolbar--bottom) {
    flex: 0 0 auto;
    height: auto;
    margin: 0;
  }

  section.works-list > .works-toolbar--bottom {
    margin-top: 32px;
  }

  /* Our Works — toolbar / filters (no flex-grow gap bug) */
  .works-toolbar {
    align-items: stretch;
    gap: 0;
    height: auto;
  }

  .works-toolbar__filters {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    height: auto;
    min-height: 0;
  }

  .works-filter-dropdown,
  .works-search-dropdown {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    height: auto;
    min-height: 0;
  }

  /* Our Works — align Category + Search text (overlay label matches Category span) */
  .works-filter,
  .works-search {
    height: 44px;
    padding: 0 16px;
    align-items: center;
    box-sizing: border-box;
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
    -webkit-appearance: none;
    appearance: none;
  }

  .works-filter {
    justify-content: space-between;
    text-align: left;
  }

  .works-filter [data-works-category-label],
  .works-search__label {
    padding: 0;
    margin: 0;
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
    text-align: left;
  }

  /* Mobile search — align placeholder with Category */
  .works-search {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 0.5rem;
    justify-content: flex-start;
  }

  .works-search__label {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    align-self: center;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: nowrap;
    border: 0;
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
    color: #535353;
    pointer-events: none;
  }

  .works-search:not(:has(.works-search__input:placeholder-shown)) .works-search__label {
    opacity: 0;
  }

  .works-search__input {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
    color: #535353;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
  }

  .works-search__input::placeholder {
    color: transparent;
  }

  .works-search__icon {
    grid-column: 2;
    grid-row: 1;
    width: 18px;
    height: 18px;
    margin-left: auto;
  }

  /* Our Works — project typography */
  .works-project__category,
  .works-project__category-link {
    display: none !important;
  }

  .works-project__body h2 {
    font-size: 18px !important;
    line-height: 1.45;
  }

  .works-project__body p {
    font-size: 12px;
    line-height: 1.45;
  }

  .works-pagination,
  .works-empty {
    font-size: 12px;
  }

  /* Global mobile typography */
  body {
    font-size: 12px !important;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  .section__title,
  .gallery__title,
  .sponsors__intro h2,
  .instagram__intro h2,
  .contact-section__title,
  .student-profile__bio-name,
  .journey-entry__heading,
  .journey-miro h2,
  .page-placeholder h1,
  .site-footer__label,
  .works-hero__card-overlay h3 {
    font-size: 14px !important;
  }

  p,
  li,
  label,
  input,
  textarea,
  select,
  button,
  a,
  span,
  .site-footer__copy,
  .site-footer__institution,
  .site-footer__degree,
  .site-footer__pages a,
  .contact-form-figma__field label,
  .contact-form-figma__field input,
  .contact-form-figma__field textarea,
  .student-profile__bio-text,
  .journey-entry__body,
  .works-filter,
  .works-search,
  .works-search__input,
  .works-filter [data-works-category-label],
  .works-search__label {
    font-size: 12px !important;
  }

  /* Student profile — mobile */
  .student-profile__titles {
    gap: 10px;
  }

  h1.student-profile__project {
    font-size: 18px !important;
    line-height: 1.2;
  }

  .student-profile__about {
    align-items: center;
    justify-content: center;
  }

  .student-profile__card {
    align-items: center;
    width: min(223px, 100%);
    margin-inline: auto;
  }

  .student-profile__portrait {
    margin-inline: auto;
  }

  .student-profile__social {
    justify-content: center;
    width: 100%;
  }
}
