/* Mobile and tablet hero composition (up to 1199px): visual first, readable copy and actions below.
   Desktop layouts (from 1200px) remain owned by their page styles. */
.hero-description--mobile { display: none; }
@media (max-width: 1199px) {
  body {
    --mobile-hero-title: clamp(2rem, 10.5vw, 3.25rem);
    --mobile-hero-accent: var(--blue-1, #214ecd);
  }
  body[data-category="implantologia"], body[data-theme="red"] {
    --mobile-hero-accent: #c41230;
  }
  body .mobile-hero {
    --mobile-hero-media-scale: 1.45;
    --leone-hero-title-font-size: var(--mobile-hero-title);
    --leone-hero-title-font-size-mobile: var(--mobile-hero-title);
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    background: #fff !important;
  }
  body .mobile-hero::before, body .mobile-hero::after { display: none !important; }
  body .mobile-hero h1 {
    --fs-h1: var(--mobile-hero-title);
    width: auto !important;
    max-width: 100% !important;
    margin: 0 0 1rem !important;
    text-align: left;
    overflow-wrap: break-word;
    word-break: normal;
  }
  body .mobile-hero p {
    width: 100% !important;
    max-width: 100% !important;
    text-shadow: none !important;
  }
  body .mobile-hero :is(.btn, .hero-cta, .button) {
    display: flex;
    width: 100%;
    max-width: 100%;
    white-space: normal;
    text-align: center;
    justify-content: center;
    min-height: 48px;
  }

  /* Full-width background image and video heroes. */
  body .mobile-hero.hero:not(.hero-slider) { display: flex; flex-direction: column; }
  body .mobile-hero.hero > :is(.hero-image, .hero-video-wrapper),
  body .mobile-hero > :is(.quality-hero__image, .instructions-hero__media) {
    order: -1;
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: clamp(260px, 82vw, 460px) !important;
    min-height: 0 !important;
    margin: 0 !important;
    background-position: center !important;
    background-size: cover !important;
    overflow: hidden;
  }
  body .mobile-hero .hero-overlay-gradient { display: none !important; }
  body .mobile-hero :is(.hero-bg-media, .hero-bg-video, .instructions-hero__media video, .instructions-hero__media img) {
    position: static !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    transform: none !important;
  }
  body .mobile-hero .instructions-hero__media img {
    transform: scale(1.5) !important;
  }
  body .mobile-hero :is(.hero-overlay, .hero-content, .quality-hero__content, .instructions-hero__content) {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-width: none !important;
  }
  body .mobile-hero :is(.hero-content, .quality-hero__content, .instructions-hero__content) {
    padding: 0.75rem var(--page-gutter, 16px) 2rem !important;
  }
  body .mobile-hero :is(.hero-content, .quality-hero__content, .instructions-hero__content) h1 {
    color: var(--mobile-hero-accent) !important;
  }
  body .mobile-hero :is(.hero-content, .quality-hero__content, .instructions-hero__content) :is(p, .contact-hero-subtitle, .accent, .hero-title-accent, .quality-hero__accent) {
    color: inherit !important;
  }
  body .mobile-hero :is(.hero-overlay .hero-content, .quality-hero__content, .instructions-hero__content) p {
    color: #354158 !important;
  }
  body .mobile-hero .hero-content > .btn { display: flex; width: 100%; margin-top: 1.5rem; }

  /* Product, catalog and Digital heroes with separate media and copy. */
  body .mobile-hero :is(.banner-inner, .catalogo-a-z-hero__inner, .mad-lab-hero__inner, .home-hero__inner, .home-hero-content),
  body .mobile-hero.marpe-hero > .container,
  body .mobile-hero.digital-product-hero > .container {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 0 !important;
    gap: 0 !important;
    padding: 0 !important;
    max-width: none !important;
  }
  body .mobile-hero :is(.banner-image, .catalogo-a-z-hero__media, .marpe-hero-visual, .digital-product-hero__media, .mad-lab-hero__media, .home-hero__visual, .hero-right-col) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    order: -1 !important;
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: clamp(260px, 82vw, 460px) !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: #fff !important;
    overflow: hidden !important;
    transform: none !important;
  }
  body .mobile-hero :is(.banner-image, .catalogo-a-z-hero__media, .marpe-hero-visual, .digital-product-hero__media, .mad-lab-hero__media, .home-hero__visual, .hero-right-col) :is(img, video, #hero-media) {
    position: static !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    max-width: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
  }
  body .mobile-hero :is(.banner-image, .catalogo-a-z-hero__media, .marpe-hero-visual, .digital-product-hero__media, .mad-lab-hero__media, .home-hero__visual) :is(img, video) {
    transform: scale(var(--mobile-hero-media-scale)) !important;
  }
  body .mobile-hero :is(.banner-text, .catalogo-a-z-hero__content, .marpe-hero-content, .digital-product-hero__content, .mad-lab-hero__copy, .home-hero__copy, .hero-left) {
    position: relative !important;
    inset: auto !important;
    order: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-width: none !important;
    padding: 0.75rem var(--page-gutter, 16px) 2rem !important;
    margin: 0 !important;
    text-align: left !important;
  }
  body .mobile-hero :is(.digital-product-hero__content, .home-hero__copy) {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }
  body .mobile-hero :is(.digital-product-hero__content, .home-hero__copy) > * {
    order: 0 !important;
  }
  body .mobile-hero :is(.page-hero-content, .publications-hero__inner, .privacy-hero__inner, .digital-page-hero__inner, .vp-hero-content, .course-page-hero__inner) {
    height: auto !important;
    min-height: 0 !important;
    padding: 2rem var(--page-gutter, 16px) !important;
  }
  body .mobile-hero :is(.page-hero-content, .publications-hero__inner, .privacy-hero__inner, .digital-page-hero__inner, .vp-hero-copy, .course-page-hero__inner) h1 {
    color: var(--mobile-hero-accent) !important;
  }
  body .mobile-hero :is(.page-hero-content, .publications-hero__inner, .privacy-hero__inner, .digital-page-hero__inner, .vp-hero-copy, .course-page-hero__inner, .hero-left) :is(p, .page-hero-label, .hero-label, .vp-kicker) {
    color: #354158 !important;
  }
  body .mobile-hero :is(.marpe-hero-content, .digital-product-hero__content)::before,
  body .mobile-hero :is(.marpe-hero-content, .digital-product-hero__content)::after,
  body .mobile-hero .home-hero-bg { display: none !important; }
  body .mobile-hero .home-hero__visual--mobile { display: none !important; }
  body .mobile-hero .hero-right-col .hero-video {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0;
  }
  body .mobile-hero .hero-right-col .hero-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }
  body[data-product="narrow-2_9"] .mobile-hero,
  body[data-product="narrow-3_8"] .mobile-hero {
    --mobile-hero-media-scale: 1.6;
  }
  body.digital-product-page .mobile-hero {
    --mobile-hero-media-scale: 1.3;
  }
  body:is([data-product="conic-one"], [data-product="mua-estetici"]) .mobile-hero {
    --mobile-hero-media-scale: 1.25;
  }
  body .mobile-hero :is(.conic-one-hero-actions, .marpe-hero-actions, .digital-product-hero__actions, .cta-group) {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }
  body .mobile-hero :is(.conic-one-hero-actions, .marpe-hero-actions, .digital-product-hero__actions, .cta-group) > :is(a, button, .cta-note-wrap) {
    width: 100% !important;
  }
  body .mobile-hero.digital-product-hero .digital-product-hero__content .btn {
    min-height: 48px;
  }

  /* Homepage carousel: image, pagination, then copy. */
  body.page-home .mobile-hero.hero-slider .hero-layout {
    display: flex;
    flex-direction: column;
    height: auto !important;
    min-height: 0 !important;
  }
  body.page-home .mobile-hero.hero-slider .hero-layout::after { display: none; }
  body.page-home .mobile-hero.hero-slider .hero-media-area {
    position: relative;
    inset: auto;
    order: 0;
    height: clamp(235px, 72vw, 360px);
    width: 100%;
  }
  body.page-home .mobile-hero.hero-slider .hero-media-slide img {
    position: absolute;
    top: -12%;
    left: 50%;
    right: auto;
    transform: translateX(-70%);
    object-fit: contain;
    object-position: center;
    width: auto;
    max-width: none;
    max-inline-size: none;
    height: 170%;
    filter: none;
  }
  body.page-home .mobile-hero.hero-slider .hero-media-slide {
    position: relative;
    overflow: hidden;
  }
  body.page-home .mobile-hero.hero-slider .swiper-slide:first-child .hero-media-slide img {
    top: -5%;
    width: auto;
    height: 110%;
    transform: translateX(-68%);
  }
  body.page-home .mobile-hero.hero-slider .swiper-slide:nth-child(2) .hero-media-slide img {
    transform: translateX(-65%);
  }
  body.page-home .mobile-hero.hero-slider .swiper-slide:nth-child(3) .hero-media-slide img {
    top: -30%;
    transform: translateX(-73%);
    height: 145%;
    filter: none;
  }
  body.page-home .mobile-hero.hero-slider .hero-text {
    position: relative;
    inset: auto;
    order: 2;
    height: auto;
  }
  body.page-home .mobile-hero.hero-slider .hero-slide-inner {
    height: auto;
    padding: 0.25rem var(--page-gutter, 16px) 2rem;
  }
  body.page-home .mobile-hero.hero-slider .hero-pagination {
    position: relative;
    inset: auto !important;
    order: 1;
    align-self: center;
    transform: none;
    padding-top: 0.5rem;
  }
  body.page-home .mobile-hero .hero-description--desktop { display: none !important; }
  body.page-home .mobile-hero .hero-description--mobile { display: block; }

  /* A shared white fade lets the larger image flow naturally into the copy. */
  body .mobile-hero :is(.hero-image, .hero-video-wrapper, .quality-hero__image,
    .instructions-hero__media, .banner-image, .catalogo-a-z-hero__media,
    .marpe-hero-visual, .digital-product-hero__media, .mad-lab-hero__media,
    .home-hero__visual, .hero-right-col, .hero-media-area)::after {
    content: "";
    display: block !important;
    position: absolute !important;
    z-index: 2;
    inset: auto 0 0 !important;
    height: var(--hero-media-fade-height, 52%) !important;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 92%) !important;
    pointer-events: none;
  }

  html:lang(fr) .mobile-hero h1[data-i18n="[html] resources:mediaArea.hero.title"] {
    --fs-h1: min(var(--mobile-hero-title), 7vw);
    --leone-hero-title-font-size: min(var(--mobile-hero-title), 7vw);
    --leone-hero-title-font-size-mobile: min(var(--mobile-hero-title), 7vw);
    white-space: nowrap;
  }
}

/* Shared mobile product rule: left-aligned titles, full-width compact CTAs. */
@media (max-width: 1199px) {
  body .mobile-hero.marpe-hero .marpe-hero-content {
    align-items: stretch !important;
  }
  body .mobile-hero .marpe-hero-header { width: 100%; }
  body .mobile-hero .marpe-hero-header h1 {
    text-align: left;
    align-items: flex-start;
  }
  body .mobile-hero :is(.conic-one-hero-actions, .marpe-hero-actions, .digital-product-hero__actions, .cta-group) > :is(a, button, .cta-note-wrap) {
    flex: 0 0 auto;
  }
}

/* Tablet: keep the separated composition with roomier type and gutters. */
@media (min-width: 769px) and (max-width: 1199px) {
  body .mobile-hero {
    --page-gutter: 32px;
    --mobile-hero-title: clamp(3rem, 5.2vw, 3.75rem);
  }

  body.page-home .mobile-hero.hero-slider .hero-copy {
    width: 100%;
    max-width: 48rem;
    margin: 0;
    padding: 0;
  }

  body.page-home .mobile-hero.hero-slider .hero-slide-inner {
    padding-block: 1.5rem 3rem;
  }

  body.page-home .mobile-hero.hero-slider .hero-description {
    max-width: 42rem;
  }

  body.page-home .mobile-hero.hero-slider .hero-cta {
    width: auto;
    min-width: 180px;
  }
}

/* Keep the Leaf mechanism visible above the transition into the copy. */
@media (max-width: 1199px) {
  body.page-home .mobile-hero.hero-slider .hero-media-area {
    --hero-media-fade-height: 24%;
  }
}
