/* ==========================================================================
   Cartagena Companions — responsive layer
   Breakpoints: 1199 · 1023 · 899 (nav switch) · 767 · 599 · 379
   ========================================================================== */

@media (max-width: 1199px) {
  .m-intro__head { grid-column: 1 / 8; }
  .m-intro__side { grid-column: 8 / 13; }
}

@media (max-width: 1023px) {
  :root { --header-h: 80px; }

  /* Models grid → 6 columns, paired rhythm */
  .m-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .m-card--1 { grid-column: 1 / -1; --ratio: 5 / 4; }
  .m-card--2 { grid-column: 1 / 4; --ratio: 3 / 4; align-self: start; }
  .m-card--3 { grid-column: 4 / 7; --ratio: 3 / 4; margin-top: clamp(3rem, 10vw, 6rem); }
  .m-card--4 { grid-column: 1 / -1; --ratio: 3 / 2; margin-top: 0; }
  .m-card--5 { grid-column: 1 / 4; --ratio: 3 / 4; align-self: start; }
  .m-card--6 { grid-column: 4 / 7; --ratio: 3 / 4; margin-top: clamp(3rem, 10vw, 6rem); }
  .m-grid > .m-card:not([class*="m-card--"]) { grid-column: span 3; --ratio: 3 / 4; align-self: start; }
  .m-card--6 .m-card__name { font-size: clamp(1.75rem, 1.3rem + 1.4vw, 2.5rem); }
  .m-quote { grid-column: 1 / -1; }

  .m-intro { row-gap: 1.5rem; }
  .m-intro__head,
  .m-intro__side { grid-column: 1 / -1; }
  .m-intro__side { max-width: 34rem; }

  .story__visual { grid-column: 1 / 6; }
  .story__body { grid-column: 7 / 13; }

  .vacancies__head > :first-child,
  .vacancies__aside { grid-column: 1 / -1; }
  .vacancies__aside { max-width: 34rem; }

  .profile__visual { grid-column: 1 / 7; }
  .profile__body { grid-column: 7 / 13; }
  .offers { grid-template-columns: 1fr; }
  .offers li:nth-child(odd) { padding-right: 0; }

  .s-hero__text { grid-column: 1 / 7; }
  .s-hero__collage { grid-column: 7 / 13; }

  .chapter__media { grid-column: 1 / 7; }
  .chapter__body { grid-column: 7 / 13; }
  .chapter--flip .chapter__media { grid-column: 7 / 13; }
  .chapter--flip .chapter__body { grid-column: 1 / 7; }
  .mosaic--trio .frame:first-child { min-height: 340px; }

  .howto__intro { grid-column: 1 / 8; }
  .howto__visual { grid-column: 8 / 13; }
  .howto__steps { grid-template-columns: 1fr 1fr; }
  .howto__steps::before { display: none; }
  .howto__step:last-child { grid-column: 1 / -1; }
  .howto__step:last-child .pay-options { grid-template-columns: 1fr auto 1fr; align-items: stretch; }
  .howto__step:last-child .pay-options__or { flex-direction: column; justify-content: center; font-size: 0.95rem; }
  .howto__step:last-child .pay-options__or::before,
  .howto__step:last-child .pay-options__or::after { width: 1px; height: auto; flex: 1; }

  .book__intro { grid-column: 1 / 6; }
  .book__form { grid-column: 6 / 13; }
}

@media (max-width: 899px) {
  /* Header → logo | menu button */
  .primary-nav { display: none; }
  .menu-toggle { display: inline-flex; }
  .brand img { height: 50px; }
  .site-header.is-scrolled .brand img { height: 44px; }
  .site-header.is-scrolled .site-header__inner { height: 64px; }
  body.is-locked .site-header { background: transparent; }
  body.is-locked .site-header::before { opacity: 0; }

  /* Stack all split layouts */
  .story,
  .profile,
  .chapter,
  .book,
  .s-hero { grid-template-columns: minmax(0, 1fr); }

  .story__visual,
  .story__body,
  .profile__visual,
  .profile__body,
  .chapter__media,
  .chapter__body,
  .chapter--flip .chapter__media,
  .chapter--flip .chapter__body,
  .howto__intro,
  .howto__visual,
  .book__intro,
  .book__form,
  .s-hero__text,
  .s-hero__collage { grid-column: 1 / -1; grid-row: auto; position: relative; top: auto; }

  .story__visual { max-width: 30rem; }
  .story__body { margin-top: 3rem; }

  .profile { padding-top: calc(var(--header-h) + 0.5rem); }
  .profile__visual .frame { max-height: none; }
  .profile__body { padding-top: 2.5rem; }

  .chapter__body { padding-top: 2.5rem; }
  .chapter--flip .chapter__media { order: -1; }

  .howto__top { grid-template-columns: minmax(0, 1fr); }
  .howto__visual { justify-items: start; }

  /* Book Now: heading → form → process steps (form first, where visitors expect it) */
  .book { row-gap: 0; }
  .book__intro { display: contents; }
  .book__intro > .eyebrow { order: 1; }
  .book__intro > .display { order: 2; }
  .book__form { order: 3; margin-top: 2.5rem; }
  .book__intro > .steps { order: 4; margin-top: 4rem; }
  .book__intro > .profile__note { order: 5; margin-top: 1.5rem; }

  .s-hero { min-height: 0; row-gap: 3rem; padding-top: calc(var(--header-h) + 3rem); }
  .s-hero__text { padding-bottom: 0; }
  .s-hero__collage { min-height: 0; aspect-ratio: 5 / 4; }

  .related__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .related__grid .m-card:nth-child(3) { display: none; }

  .site-footer__top { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .site-footer__bottom { justify-content: center; text-align: center; }
}

@media (max-width: 767px) {
  /* Models hero: triptych → smooth left-to-right marquee of every companion */
  .page-hero__media--triptych { display: none; }
  .page-hero__image-edit-target { display:none; }
  .page-hero__marquee { display: block; }
  .marquee__track { animation: marquee-ltr 42s linear infinite; }
  .page-hero__foot { flex-direction: column; align-items: flex-start; }

  .m-index__inner { flex-direction: column; align-items: flex-start; gap: 0; padding-top: 1.5rem; }
  .m-index__list { width: calc(100% + var(--gutter)); margin-left: 0; margin-right: calc(var(--gutter) * -1); padding-right: var(--gutter); }
  .m-index__link { padding-block: 1.1rem 1.3rem; }

  .s-index { grid-template-columns: 1fr; gap: 0; }
  .s-index__item {
    grid-template-columns: clamp(5.5rem, 26vw, 7.5rem) minmax(0, 1fr);
    grid-template-rows: auto;
    gap: 1.25rem;
    align-items: center;
    padding-block: 1.25rem;
    border-top: 1px solid var(--line);
  }
  .s-index__item:last-child { border-bottom: 1px solid var(--line); }
  .s-index__item .frame { aspect-ratio: 1 / 1; }
  .s-index__body { min-width: 0; margin-top: 0; padding-top: 0; border-top: 0; grid-template-columns: auto minmax(0, 1fr); }
  .s-index__title { font-size: clamp(1.25rem, 1rem + 1.5vw, 1.6rem); }
  .s-index__arrow { display: none; }

  /* swipeable row of reserved places */
  .vacancies__slots {
    display: flex;
    gap: 0.75rem;
    margin-right: calc(var(--gutter) * -1);
    padding-right: var(--gutter);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .vacancies__slots::-webkit-scrollbar { display: none; }
  .slot { flex: 0 0 42%; scroll-snap-align: start; }
}

@media (max-width: 767px) {
  /* sticky booking bar */
  .mobile-cta {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 80;
    display: block;
    padding: 1.75rem var(--gutter) calc(0.9rem + env(safe-area-inset-bottom));
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.96) 0%, rgba(0, 0, 0, 0.9) 55%, rgba(0, 0, 0, 0) 100%);
    transform: translateY(110%);
    transition: transform 0.5s var(--ease-out);
    pointer-events: none;
  }
  .mobile-cta.is-visible { transform: none; pointer-events: auto; }
  .mobile-cta .btn { width: 100%; }
  body.is-locked .mobile-cta { transform: translateY(110%); }

  /* Models → single column, every card full width and aligned, same portrait ratio */
  .m-grid { grid-template-columns: minmax(0, 1fr); row-gap: 3.5rem; }
  .m-card--1,
  .m-card--2,
  .m-card--3,
  .m-card--4,
  .m-card--5,
  .m-card--6 {
    grid-column: 1 / -1;
    margin: 0;
    align-self: start;
    --ratio: 4 / 5;
  }
  .m-grid > .m-card:not([class*="m-card--"]) {
    grid-column: 1 / -1;
    margin: 0;
    align-self: start;
    --ratio: 4 / 5;
  }
  .m-card--feature .m-card__name,
  .m-card--6 .m-card__name { font-size: clamp(1.75rem, 1.3rem + 1.4vw, 2.5rem); }

  /* name index: fade the right edge to signal it scrolls */
  .m-index__list {
    -webkit-mask-image: linear-gradient(90deg, #000 80%, transparent);
    mask-image: linear-gradient(90deg, #000 80%, transparent);
  }

  /* comfortable tap targets (≥44px) without changing the look */
  .m-card__book { padding: 0.9rem 0 0.9rem 1rem; margin-block: -0.9rem; }
  .site-footer__nav a,
  .site-footer__social a,
  .mobile-menu__foot a { display: inline-block; padding-block: 0.6rem; }
  .breadcrumb a { display: inline-block; padding-block: 0.6rem; }
  .profile__pager a { padding-block: 0.4rem; }
  .slot__label { font-size: 0.6875rem; }

  /* safe areas on notched phones */
  .site-header__inner,
  .container { padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
}

@media (max-width: 599px) {
  :root { --header-h: 72px; }

  .btn-row { flex-direction: column; align-items: stretch; }
  .btn-row .btn { width: 100%; }
  .home-hero .btn-row { width: 100%; max-width: 20rem; margin-inline: auto; }

  .m-quote { padding-block: 0.5rem; }

  .story__note { grid-template-columns: 1fr; gap: 1rem; }
  .story__pull { margin-top: 3rem; }

  .slot { flex-basis: 62%; }

  .howto__steps { grid-template-columns: 1fr; gap: 3rem; }
  .howto__step:last-child .pay-options { grid-template-columns: 1fr; }
  .howto__step:last-child .pay-options__or { flex-direction: row; }
  .howto__step:last-child .pay-options__or::before,
  .howto__step:last-child .pay-options__or::after { width: auto; height: 1px; }
  .howto__step-head { margin-bottom: 1.25rem; }

  .form-grid { grid-template-columns: 1fr; gap: 1.75rem; }
  .form-foot { flex-direction: column; align-items: stretch; }
  .form-foot .btn { width: 100%; }

  .mosaic--trio { grid-template-columns: 1fr 1fr; }
  .mosaic--trio .frame:first-child { grid-row: auto; grid-column: 1 / -1; min-height: 0; aspect-ratio: 4 / 3; height: auto; }
  .mosaic--trio .frame:nth-child(2),
  .mosaic--trio .frame:nth-child(3) { aspect-ratio: 1 / 1; }

  .related__grid { gap: 0.75rem; }
  .related__grid .m-card__name { font-size: 1.5rem; }
  .related__grid .m-card__book { display: none; }

  .profile__pager span { font-size: 1.25rem; }

  .site-footer__nav { flex-direction: column; align-items: center; gap: 1rem; }
}

@media (max-width: 379px) {
  .m-index__link { font-size: 1.2rem; }
  .menu-toggle__label-open,
  .menu-toggle[aria-expanded="true"] .menu-toggle__label-close { display: none; }
}
