/* Sister Communities - front-end styles (SUP-15127)
   Desktop: >= 768px   |   Mobile: < 768px (reference 402px) */

.sc-section {
  --sc-ink: #2b2b2b;
  --sc-maroon: #6d0f27;
  --sc-arrow: #9b1b30;
  --sc-gap: 14px;
  --sc-bg: #fff;
  background: var(--sc-bg);
  color: var(--sc-ink);
  font-family: var(--e-global-typography-primary-font-family);
  padding: 48px 0 56px;
}
.sc-section[hidden] { display: none; } /* no heading, no spacing when empty */

/* No width cap of its own: the section sits inside whatever boxed container the
   theme gives the page, so the cards scale with the site's configured content
   width rather than a second limit that only this plugin knows about. The
   mobile block below is the one place that adds gutters. */
.sc-inner {
  width: 100%;
  margin: 0 auto;
}

/* Elementor global "Responsive H2".
   Scoped to .sc-section to outrank the Elementor kit's own `.elementor-kit-NNN
   h2`, which is a class plus a type selector. A bare .sc-heading is one class
   and loses to it whatever order the stylesheets load in. The same goes for
   .sc-name, .sc-link and .sc-photo img below. */
.sc-section .sc-heading {
  margin: 0;
  text-align: center;
  font-weight: 900;
  font-size: 54px;
  line-height: 48px;
  letter-spacing: -3.78px;
  text-transform: uppercase;
}
/* Elementor global "Bold Copy", as the annotated design marks the subheading.
   The mobile block below keeps its own smaller size. */
.sc-intro {
  margin: 8px 0 52px;      /* 8px under the heading, 52px down to the cards */
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  line-height: 22px;
  letter-spacing: 0;
}

/* ---------- Viewport / track ---------- */
/* inline-size containment lets the arrow offset below be worked out from the
   carousel's width in CSS, so it does not have to wait for the script. */
.sc-carousel { position: relative; container-type: inline-size; }
.sc-viewport { overflow: hidden; }
.sc-track {
  display: flex;
  gap: var(--sc-gap);
  margin: 0;
  padding: 0;
  list-style: none;
  transition: transform .4s ease;
}

/* ---------- Card ---------- */
.sc-card { flex: 0 0 auto; min-width: 0; }
.sc-photo {
  display: block;
  aspect-ratio: 71 / 41;   /* 710x410 in Figma; 3-up and mobile override below */
  border-radius: 3px;
  overflow: hidden;
  background: #ddd;
}
/* `.elementor img { height: auto }` is the same weight as a bare
   `.sc-photo img`, so whichever loads last wins. Scoping settles it: without
   the 100% height the photo spills past its aspect-ratio box. */
.sc-section .sc-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Elementor global "Amenity Card Titles". */
.sc-section .sc-name {
  margin: 9px 0 8px;       /* 9px under the image, 8px down to the details */
  font-weight: 900;
  font-size: 30px;
  line-height: 32px;
  letter-spacing: -2.1px;
  text-transform: uppercase;
}
/* The name links to the property. It keeps the heading's own colour and stays
   underline-free so the card looks the same as the design until hovered. */
.sc-section .sc-name a {
  color: inherit;
  text-decoration: none;
}
.sc-section .sc-name a:hover,
.sc-section .sc-name a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

/* Elementor global "Bold Copy"; the mobile block swaps in "Card Body". */
.sc-meta {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
  line-height: 22px;
  letter-spacing: 0;
}
.sc-meta .sc-sep { margin: 0 6px; }

/* Elementor "Secondary Button", the same at both breakpoints. */
.sc-section .sc-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  /* padding-left: 4px; */
  color: var(--sc-maroon);
  font-size: 15px;
  font-weight: 700;
  line-height: 24px;
  letter-spacing: .9px;
  text-transform: uppercase;
  text-decoration: none;
}
.sc-link-text { text-decoration: underline; text-underline-offset: 3px; }
.sc-link svg { width: 8px; height: 12px; flex: 0 0 auto; }
.sc-link:hover .sc-link-text,
.sc-link:focus-visible .sc-link-text { text-decoration-thickness: 2px; }

/* Both wordings ship in the markup and the breakpoint picks one, so the right
   text survives page caching without any JS or server-side device sniffing.
   display:none also keeps the hidden one out of the accessibility tree, so a
   screen reader announces a single label. */
.sc-link-text--narrow { display: none; }

/* ---------- Desktop count variations ---------- */
@media (min-width: 768px) {
  .sc-track { justify-content: center; }

  /* One card is half the content width either way, so the single card lines up
     with the left card of the two-card layout instead of stretching across.
     Reference: 710px card inside a 1434px content width. */
  .sc-card { width: calc((100% - var(--sc-gap)) / 2); }        /* 1 & 2 cards */
  .sc-section[data-count="3"] .sc-card,
  .sc-section[data-count="many"] .sc-card { width: calc((100% - 2 * var(--sc-gap)) / 3); }
  .sc-section[data-count="2"] .sc-track { justify-content: flex-start; }

  /* 468.67 x 271 in Figma, i.e. about 1.73:1. */
  .sc-section[data-count="3"] .sc-photo,
  .sc-section[data-count="many"] .sc-photo { aspect-ratio: 468.67 / 271; }

  /* Carousel: the cards overflow on purpose, and centring would split that
     overflow across both ends, clipping the first card as well as the last.
     The track has to start at the left edge so the first card is whole and the
     translate steps line up with card boundaries. */
  .sc-section[data-count="many"] .sc-track { justify-content: flex-start; }

  /* arrows only when more than 3 */
  /* The size declarations are repeated defensively: themes style bare <button>
     elements, and a padding or min-width rule from the theme turns this circle
     into a stretched pill. */
  .sc-section .sc-arrow {
    position: absolute;
    /* Centre of the first image, from the card width and the photo's
       468.67:271 aspect ratio. The script sets the same value as an inline
       style once it runs; starting from this means there is nothing to jump
       from. */
    top: calc(((100cqw - 2 * var(--sc-gap)) / 3) * 271 / 468.67 / 2);
    transform: translateY(-50%);
    width: 27px; height: 27px;
    min-width: 27px; min-height: 27px;
    max-width: 27px; max-height: 27px;
    box-sizing: border-box;
    border: 0; border-radius: 50%;
    background: var(--sc-arrow);
    color: #fff;
    display: none;
    align-items: center; justify-content: center;
    padding: 0; margin: 0; cursor: pointer;
    font-size: 0; line-height: 0;
    -webkit-appearance: none; appearance: none;
    box-shadow: 0 1px 4px rgba(0,0,0,.35);
    z-index: 2;
  }
  .sc-arrow svg { width: 7px; height: 11px; }
  /* Half the 27px button, so each one stays centred on the edge of the first
     and last visible image the way the design has it. */
  .sc-arrow--prev { left: -13.5px; }
  .sc-arrow--next { right: -13.5px; }
  .sc-section[data-count="many"] .sc-arrow { display: flex; }
  .sc-arrow:disabled { display: none !important; } /* hide prev on first, next on last */
  .sc-arrow:focus-visible { outline: 2px solid var(--sc-maroon); outline-offset: 2px; }
}

/* ---------- Mobile ---------- */
@media (max-width: 767.98px) {
  .sc-section { --sc-bg: #e6e6e6; --sc-gap: 16px; padding: 24px 0 40px; }
  .sc-inner { width: auto; padding: 0 24px; }          /* 24px sides @402px */

  /* These three carry the same .sc-section scope as the base rules above, or
     the base rules would outrank them here. */
  .sc-section .sc-heading { text-align: left; font-size: 30px; line-height: 32px; letter-spacing: -2.1px; }
  .sc-intro { text-align: left; font-size: 15px; font-weight: 600; margin: 10px 0 32px; }

  .sc-viewport { overflow: visible; }
  .sc-track {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px var(--sc-gap);                           /* 24px rows, 16px columns */
    transform: none !important;                        /* never a carousel */
  }
  /* A grid column, so an odd last card keeps the others' width and sits at the
     left of its row rather than stretching or centring. */
  .sc-card { width: auto; }
  .sc-section[data-count="1"] .sc-track { grid-template-columns: 1fr; }
  .sc-arrow { display: none !important; }

  .sc-photo { aspect-ratio: 169 / 121; }                     /* 169x121 */
  .sc-section[data-count="1"] .sc-photo { aspect-ratio: 177 / 127; }  /* 354x254 */
  /* margin is left to the base rule so the 9px / 8px card spacing is the same
     at both breakpoints. */
  .sc-section .sc-name { font-size: 15px; font-weight: 800; line-height: 20px; letter-spacing: .9px; }
  .sc-section[data-count="1"] .sc-name { white-space: nowrap; }
  /* Elementor global "Card Body" replaces "Bold Copy" here. */
  .sc-meta { font-size: 16px; font-weight: 400; line-height: 22px; margin-bottom: 14px; }
  .sc-meta .sc-line { display: block; }
  .sc-meta .sc-sep { display: none; }
  /* The Secondary Button type is identical at both breakpoints, so only the
     indent is dropped here. */
  .sc-section .sc-link { padding-left: 0; }
  .sc-link svg { width: 9px; height: 14px; }

  /* "Learn More" on mobile, "Explore Community" on desktop. */
  .sc-link-text--wide { display: none; }
  .sc-link-text--narrow { display: inline; }

  /* Two or more cards means a ~169px card, narrow enough for the label to wrap
     and leave the chevron floating beside a two-line block. Holding the label
     on one line keeps the chevron directly beside it, one gap away, with
     align-items centring the two against each other. */
  .sc-section:not([data-count="1"]) .sc-link {
    white-space: nowrap;
    gap: 6px;
    align-items: center;
  }
}
