/**
 * Mobile project layout — separate from desktop asymmetry in styles.css.
 * Desktop: alternating left/right project rows.
 * Mobile (≤768px): left-aligned projects, solid nav, white pills, scrollable modal copy.
 */

@media (max-width: 768px) {
  /* Round covers on mobile (overrides cached clip-path bevel from older styles.css) */
  .project__media,
  .dossier .project__media {
    clip-path: none !important;
    -webkit-clip-path: none !important;
    border-radius: var(--project-cover-radius, 12px);
    overflow: hidden;
    isolation: isolate;
  }

  .dossier .project__media::before {
    display: none !important;
    content: none !important;
  }

  .project__media img {
    border-radius: var(--project-cover-radius, 12px);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }

  .projects__more {
    margin-top: 0 !important;
    padding-top: clamp(72px, 16vw, 120px) !important;
    padding-bottom: clamp(24px, 6vw, 40px) !important;
  }

  .project,
  .project--zig-left,
  .project--reverse,
  .project--featured {
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100% !important;
    width: 100%;
  }

  .project--reverse .project__media,
  .project--reverse .project__text {
    order: unset;
  }

  /* Year + title left; Watch/Gallery pill right (grid-template-areas for iOS Safari) */
  .project__text {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "year btn"
      "title btn"
      "desc desc"
      "prod prod";
    column-gap: clamp(12px, 4vw, 20px);
    row-gap: 0;
    align-items: center;
    text-align: left;
    min-height: 0;
  }

  .project__production {
    grid-area: prod;
    justify-self: start;
    align-self: end;
    justify-content: flex-start;
    margin-top: clamp(8px, 2vw, 12px);
    margin-bottom: 0;
    padding-top: 0;
    gap: clamp(12px, 3vw, 18px);
  }

  .project__production-item .clients__logo-img {
    opacity: 0.38;
  }

  .project__production-item.clients__logo-link:hover .clients__logo-img,
  .project__production-item.clients__logo-link:focus-visible .clients__logo-img {
    opacity: 0.8;
  }

  .project__text.reveal,
  .project__text.reveal.in-view {
    transform: none !important;
  }

  .project__year {
    grid-area: year;
    margin: 0 0 8px;
  }

  .project__title {
    grid-area: title;
    margin: 0;
    padding-right: 0;
  }

  .project__desc {
    grid-area: desc;
    margin: 12px 0 0;
  }

  .project__view {
    grid-area: btn;
    align-self: center;
    justify-self: end;
    margin: 0;
    width: max-content;
    max-width: 42vw;
  }

  .dossier .project__view,
  .dossier .project__view:hover,
  .dossier .project__view:focus-visible {
    min-height: 36px !important;
    padding: 10px 20px !important;
    transform: none !important;
  }

  body.dossier .project__view:hover,
  body.dossier .project__view:focus-visible {
    outline: 2px solid var(--highlight) !important;
    outline-offset: 3px;
  }

  .dossier .project__view .pill__text,
  .dossier .project__view:hover .pill__text,
  .dossier .project__view:focus-visible .pill__text {
    transform: none !important;
  }

  .dossier .project__view:hover .pill__text,
  .dossier .project__view:focus-visible .pill__text {
    color: var(--highlight) !important;
    -webkit-text-fill-color: var(--highlight) !important;
  }

  .projects__inner {
    padding-right: var(--pad-x);
  }

  /* Projects + Contact section headers */
  .dossier .section-title--offset.section-title--lcars,
  .section-title--offset {
    margin-left: auto;
    margin-right: auto;
    padding-left: clamp(16px, 3vw, 32px);
    padding-right: clamp(16px, 3vw, 32px);
    text-align: center;
    width: fit-content;
    max-width: 100%;
  }

  .section-title--offset-right {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    text-align: left;
    width: 100%;
    max-width: 100%;
  }

  /* Contact bio — full width, left edge, justified body copy */
  #contact .about__grid {
    justify-items: stretch;
  }

  #contact .about__photo {
    justify-self: center;
  }

  #contact .about__bio {
    width: 100%;
    max-width: none;
    text-align: left;
  }

  .modal--contact .modal__dialog--contact {
    width: min(100%, 94vw);
  }

  .contact-form__submit {
    width: 100%;
    align-self: stretch;
    justify-content: center;
  }

  #contact .about__bio p {
    max-width: none;
    text-align: justify;
    text-align-last: left;
    hyphens: auto;
  }

  /* Nav: logo in white circle + pills fill remaining width */
  .nav__inner {
    gap: 10px;
    justify-content: flex-start;
  }

  .nav__brand {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    padding: 7px;
  }

  .nav__brand::before {
    inset: 7px;
  }

  body.dossier .nav__logo {
    max-height: 26px;
  }

  /* Header nav only — stretch pills; project filter row stays compact + centered */
  .nav__inner > .nav__links {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    max-width: none;
    justify-content: space-evenly;
    align-items: center;
    gap: 20px;
  }

  /* Wider pills, 20px between, share remaining nav width evenly */
  .nav__inner > .nav__links a {
    flex: 1 1 0;
    min-width: 0;
    margin: 0 !important;
    padding: 9px 16px !important;
    justify-content: center;
  }

  .nav__inner > .nav__links a:hover,
  .nav__inner > .nav__links a:focus-visible,
  .nav__inner > .nav__links a.active {
    margin: 0 !important;
    padding: 12px 20px !important;
  }

  /* Nav blur washes pill buttons grey on iOS — use solid bar on mobile */
  .nav,
  .nav.nav--scrolled {
    background: var(--bg) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Solid white pills (system styles often override dossier rules on small screens) */
  html.dossier .nav__links a,
  html.dossier .projects-filter__btn,
  html.dossier .project__view,
  html.dossier .btn-ghost,
  html.dossier .hire-cta,
  html.dossier .hero__showreel-btn,
  html.dossier .connect__link,
  body.dossier .nav__links a,
  body.dossier .projects-filter__btn,
  body.dossier .project__view,
  body.dossier .btn-ghost,
  body.dossier .hire-cta,
  body.dossier .hero__showreel-btn,
  body.dossier .connect__link,
  body.dossier button.project__view,
  body.dossier button.projects-filter__btn,
  body.dossier button.btn-ghost,
  body.dossier button.hero__showreel-btn {
    -webkit-appearance: none;
    appearance: none;
    color-scheme: light;
    background-color: #ffffff !important;
    background-image: none !important;
    color: #000000 !important;
    border: none !important;
    box-shadow: none !important;
    opacity: 1 !important;
  }

  html.dossier .nav__links a:hover,
  html.dossier .nav__links a:focus-visible,
  html.dossier .nav__links a.active,
  html.dossier .projects-filter__btn:hover,
  html.dossier .projects-filter__btn:focus-visible,
  html.dossier .projects-filter__btn.is-active,
  body.dossier .nav__links a:hover,
  body.dossier .nav__links a:focus-visible,
  body.dossier .nav__links a.active,
  body.dossier .projects-filter__btn:hover,
  body.dossier .projects-filter__btn:focus-visible,
  body.dossier .projects-filter__btn.is-active,
  body.dossier .btn-ghost:hover,
  body.dossier .btn-ghost:focus-visible,
  body.dossier .hire-cta:hover,
  body.dossier .hire-cta:focus-visible,
  body.dossier .hero__showreel-btn:hover,
  body.dossier .hero__showreel-btn:focus-visible,
  body.dossier .connect__link:hover,
  body.dossier .connect__link:focus-visible {
    background-color: #ffffff !important;
    color: #000000 !important;
  }

  html.dossier .nav__links a .pill__text,
  html.dossier .btn-ghost .pill__text,
  html.dossier .hire-cta .pill__text,
  html.dossier .hero__showreel-btn .pill__text,
  html.dossier .connect__link .pill__text,
  body.dossier .nav__links a .pill__text,
  body.dossier .btn-ghost .pill__text,
  body.dossier .hire-cta .pill__text,
  body.dossier .hero__showreel-btn .pill__text,
  body.dossier .connect__link .pill__text {
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
  }

  html.dossier .project__view .pill__text,
  body.dossier .project__view .pill__text {
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
  }

  /* Long project descriptions: more room for scrollable detail on small screens */
  .modal__dialog {
    max-height: 92dvh;
  }

  .modal__body {
    min-height: min(32vh, 200px);
  }

  /* Showreel: fit the full 16:9 frame to the screen (contain) instead of cropping (cover) */
  body.dossier .hero__video-iframe {
    width: min(100%, 177.78vh);
    height: min(100%, 56.25vw);
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
  }
}
