/* ==========================================================================
   Marco Repole · Portfolio
   responsive.css: adattamenti per desktop compatto, tablet e mobile,
   più preferenze di accessibilità (movimento ridotto).
   ========================================================================== */

/* ---------- Desktop compatto ---------- */
@media (max-width: 1240px) {
  .nav-link {
    padding: 0 15px;
  }

  .header-pill--cta {
    padding-left: 20px;
  }
}

@media (max-width: 1180px) {
  .header-pill--cta {
    display: none;
  }

  .site-header__bar {
    justify-content: space-between;
  }
}

/* ---------- Navigazione mobile ---------- */
@media (max-width: 1080px) {
  :root {
    --header-h: 84px;
  }

  .header-pill--nav {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .header-pill {
    height: 56px;
  }

  .is-scrolled .header-pill {
    height: 50px;
  }

  .is-scrolled .menu-toggle {
    width: 50px;
  }

  .brand-logo {
    height: 38px;
  }

  .is-scrolled .brand-logo {
    height: 33px;
  }
}

@media (min-width: 1081px) {
  .mobile-menu {
    display: none !important;
  }
}

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
  .services__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .service-card {
    min-height: 270px;
  }

  .principles__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 28px;
  }

  .principle:nth-child(3) {
    border-left: 0;
  }

  .process__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .step {
    min-height: 240px;
  }

  .footer__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer__brand {
    grid-column: 1 / -1;
  }

  .case-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .case-facts > div:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

/* Griglia progetti a 2 colonne (tablet) */
@media (min-width: 641px) and (max-width: 1024px) {
  .work-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Card dispari finale: orizzontale a tutta larghezza */
  .work-card:nth-child(2n + 1):last-child {
    grid-column: 1 / -1;
  }

  .work-card:nth-child(2n + 1):last-child .work-card__link {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  }

  .work-card:nth-child(2n + 1):last-child .work-card__body {
    align-content: end;
    padding: 22px 16px 16px 26px;
  }

  .work-card:nth-child(2n + 1):last-child .work-card__summary {
    display: block;
  }
}

/* ---------- Layout a colonna singola ---------- */
@media (max-width: 900px) {
  /* Footer: copyright, credito e "Torna su" uno sotto l'altro */
  .footer__bottom {
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
  }

  .footer__top {
    justify-self: start;
  }

  .hero {
    padding-top: calc(var(--header-h) + 28px);
  }

  .hero__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .hero__lead {
    max-width: 38ch;
  }

  .hero__visual {
    justify-self: center;
    max-width: 520px;
  }

  .hero-chip--status {
    left: -2%;
  }

  .hero-chip--place {
    right: -1%;
  }

  .about__inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .about__visual {
    width: min(100%, 460px);
  }

  .case-hero__grid {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .case-section {
    grid-template-columns: minmax(0, 1fr);
  }

  .cta__ring {
    top: 46%;
    left: 64%;
  }

  .case-next__link {
    grid-template-columns: minmax(0, 1fr);
  }

  .case-next .case-media {
    order: -1;
  }
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  :root {
    --radius-xl: 26px;
    --header-h: 78px;
  }

  .site-header {
    padding-top: 12px;
  }

  .site-header.is-scrolled {
    padding-top: 8px;
  }

  .header-pill {
    height: 52px;
  }

  .is-scrolled .header-pill {
    height: 48px;
  }

  .header-pill--brand {
    padding: 0 16px 0 10px;
  }

  .brand-logo {
    height: 34px;
  }

  .is-scrolled .brand-logo {
    height: 30px;
  }

  .menu-toggle {
    width: 52px;
  }

  .is-scrolled .menu-toggle {
    width: 48px;
  }

  .hero__title {
    margin-top: 24px;
  }

  .hero__lead {
    margin-top: 22px;
  }

  .hero__actions {
    margin-top: 30px;
  }

  .hero__visual {
    max-width: 440px;
  }

  .hero-chip {
    padding: 8px 12px;
    font-size: 0.75rem;
  }

  .hero-chip--status {
    top: 70%;
    left: 0;
  }

  .hero-chip--place {
    display: none;
  }

  .hero__eyebrow {
    height: 34px;
    padding: 0 14px 0 12px;
    font-size: 0.6875rem;
    letter-spacing: 0.09em;
    white-space: nowrap;
  }

  .cta__panel {
    padding: 36px 24px 28px;
  }

  .cta__title {
    font-size: clamp(1.75rem, 9.2cqi, 2.5rem);
  }

  .btn--lg {
    --btn-h: 58px;
    padding-left: 22px;
    font-size: 1rem;
  }

  .btn--lg .arrow-circle {
    width: 44px;
    height: 44px;
  }

  .hero__orbit-dot,
  .cta__ring-dot {
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
  }

  .services__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .service-card {
    min-height: 0;
    padding: 22px 20px 20px;
  }

  .service-card__title {
    margin-top: 22px;
  }

  .filters {
    flex-wrap: nowrap;
    width: calc(100% + var(--gutter) * 2);
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .filters::-webkit-scrollbar {
    display: none;
  }

  .filter-btn {
    flex: none;
  }

  .work-grid {
    gap: 14px;
  }

  .work__more {
    flex-direction: column;
  }

  .principles__list {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0;
  }

  .principle {
    padding: 20px 4px;
  }

  .principle + .principle {
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    border-left: 0;
  }

  .principle:first-child {
    padding-top: 4px;
  }

  .principle:last-child {
    padding-bottom: 4px;
  }

  .process__list {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .step {
    min-height: 0;
  }

  .step__title {
    padding-top: 32px;
  }

  .process__track {
    display: none;
  }

  .wa-fab {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    height: 56px;
    padding: 6px;
  }

  .wa-fab::after {
    width: 56px;
    height: 56px;
  }

  .facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .cta__actions,
  .cta__actions .btn {
    width: 100%;
  }

  .cta__actions .btn {
    justify-content: space-between;
  }

  .footer__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }


  .case-facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .case-facts > div + div {
    margin-top: 12px;
  }

  .case-gallery {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .case-source {
    flex-direction: column;
    align-items: flex-start;
  }

  .mobile-menu__footer .btn {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 380px) {
  .hero__actions .btn {
    width: 100%;
    justify-content: space-between;
  }

  .hero__actions .btn--outline {
    justify-content: center;
  }

  .hero__eyebrow {
    letter-spacing: 0.06em;
  }
}

/* ---------- Schermi bassi (laptop 13") ---------- */
@media (min-width: 901px) and (max-height: 760px) {
  .hero__visual {
    max-width: 500px;
  }
}

/* ---------- Movimento ridotto ---------- */
@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .js [data-hero],
  .js [data-reveal],
  .js [data-split],
  .js [data-clip],
  .js [data-stagger] > *,
  .js [data-batch] > *,
  .js .site-header .header-pill {
    opacity: 1 !important;
  }

  .hero-chip__pulse::after,
  .hero__scroll-line::after,
  .hero-chip,
  .about__badge,
  .wa-fab.is-visible::after {
    animation: none;
  }

  .js .wa-fab:not(.is-visible) {
    transform: none;
  }
}
