/* ==========================================================================
   Roof Color Switcher — front-end styles
   Structural / mechanical CSS only (display:flex, transitions, box model).
   NO fixed widths, heights, or breakpoints live here — every dimension
   (widget width, column widths, image width/height/aspect-ratio, gaps,
   circle size, alignment, wrapping) is written per-instance by Elementor's
   Style tab controls via CSS custom properties or direct selectors, and
   Elementor itself generates the responsive @media queries for Desktop /
   Tablet / Mobile. This file never needs editing to resize anything.
   ========================================================================== */

.rcs-widget {
  /* Fallback tokens — only used if a control genuinely has no value at all
     (e.g. before first save). Every one is normally supplied by Elementor. */
  --rcs-transition-duration: 300ms;
  --rcs-anim-duration: 300ms;
  --rcs-anim-delay: 0ms;
  --rcs-hover-scale: 1.08;
  --rcs-circle-size: 52px;
  --rcs-swatch-scale: 1.12;
  --rcs-swatch-radius: 50%;
  --rcs-border-width: 0px;
  --rcs-border-color: transparent;
  --rcs-active-border-width: 2px;
  --rcs-active-border-color: #111111;
  --rcs-hover-border-color: #111111;

  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #211f1b;
}

.rcs-widget,
.rcs-widget *,
.rcs-widget *::before,
.rcs-widget *::after {
  box-sizing: border-box;
}

.rcs-widget img {
  max-width: 100%;
  display: block;
}

/* -------------------------------------------------------------------- */
/* Layout — mechanics only. Direction, gaps, widths, and alignment are   */
/* all supplied by the Style > Layout controls (see the widget class).   */
/* -------------------------------------------------------------------- */

.rcs-grid {
  display: flex;
  flex-direction: row;   /* overridden per-breakpoint by Image Position control */
  flex-wrap: wrap;       /* lets very narrow custom widths reflow gracefully */
  width: 100%;
}

.rcs-image-col {
  min-width: 0; /* prevents flex children from overflowing their track */
}

.rcs-content-col {
  flex: 1 1 0%; /* fills remaining space unless a Content Column Width is set */
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* -------------------------------------------------------------------- */
/* Image preview                                                        */
/*                                                                       */
/* Both <img> layers are stacked in the SAME CSS Grid cell instead of    */
/* being position:absolute. This is deliberate: absolutely-positioned    */
/* children are taken out of normal flow and contribute nothing to their */
/* parent's height, which is exactly what caused the old fixed-height    */
/* requirement. As normal (in-flow) grid items, each <img> still         */
/* contributes its own intrinsic size to the grid's auto-sizing — so by  */
/* default (Height Mode = Auto) the wrapper's height is simply whatever  */
/* the image's natural height renders at, with zero empty space, ever.   */
/* Only when the user explicitly picks Custom Height or Aspect Ratio     */
/* does Elementor add a `height`/`aspect-ratio` rule that takes over.    */
/* -------------------------------------------------------------------- */

.rcs-preview {
  display: grid;
  align-items: start;   /* don't let grid auto-stretch images to a shared height */
  justify-items: stretch;
  margin: 0;
  overflow: hidden; /* clips to border-radius only — never hides content */
}

.rcs-preview-img {
  grid-area: 1 / 1 / -1 / -1; /* stack every layer in the same single cell */
  display: block;
  width: 100%;
  height: auto;   /* natural, image-driven height — Custom/Aspect modes override this */
  max-width: 100%;
  opacity: 0;
  transition:
    opacity var(--rcs-anim-duration, var(--rcs-transition-duration)) ease var(--rcs-anim-delay, 0ms),
    transform var(--rcs-anim-duration, var(--rcs-transition-duration)) ease var(--rcs-anim-delay, 0ms);
}

.rcs-preview-img.is-visible {
  opacity: 1;
}

/* Transition style variants, chosen via Style > Animation and applied
   through the data-animation attribute rendered on .rcs-widget. */
.rcs-widget[data-animation="slide"] .rcs-preview-img {
  transform: translateX(16px);
}
.rcs-widget[data-animation="slide"] .rcs-preview-img.is-visible {
  transform: translateX(0);
}

.rcs-widget[data-animation="scale"] .rcs-preview-img {
  transform: scale(1.06);
}
.rcs-widget[data-animation="scale"] .rcs-preview-img.is-visible {
  transform: scale(1);
}

/* Hover zoom (opt-in via Style > Image > Enable Hover Zoom) */
.rcs-widget.rcs-hover-zoom .rcs-preview:hover .rcs-preview-img.is-visible {
  transform: scale(var(--rcs-hover-scale, 1.08));
}

/* Disable-animation escape hatch + respect the user's OS motion setting */
.rcs-widget.rcs-no-animation .rcs-preview-img,
.rcs-widget.rcs-no-animation .rcs-swatch,
.rcs-widget.rcs-no-animation .rcs-swatch-circle {
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .rcs-widget * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* -------------------------------------------------------------------- */
/* Title / description                                                  */
/* -------------------------------------------------------------------- */

.rcs-title {
  margin: 0 0 12px;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.rcs-description {
  margin: 0;
  font-size: 16px;
  line-height: 1.65;
  color: #625c53;
}

.rcs-description p {
  margin: 0 0 0.75em;
}
.rcs-description p:last-child {
  margin-bottom: 0;
}

/* -------------------------------------------------------------------- */
/* Swatches — display:flex only; wrap, gap, alignment and max-width all  */
/* come from the Style > Color Swatches controls.                       */
/* -------------------------------------------------------------------- */

.rcs-swatches {
  display: flex;
}

.rcs-swatch-item {
  display: flex;
}

.rcs-swatch {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  padding: 4px 2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.rcs-swatch-circle {
  width: var(--rcs-circle-size);
  height: var(--rcs-circle-size);
  flex-shrink: 0;
  border-radius: var(--rcs-swatch-radius);
  background-color: var(--rcs-item-color, #999);
  border: var(--rcs-border-width) solid var(--rcs-border-color);
  outline: var(--rcs-active-border-width) solid transparent;
  outline-offset: 3px;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.3),
    inset 0 -3px 6px rgba(0, 0, 0, 0.2);
  transition:
    outline-color var(--rcs-transition-duration) ease,
    border-color var(--rcs-transition-duration) ease,
    transform var(--rcs-transition-duration) cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rcs-swatch-name {
  font-size: 12px;
  color: #625c53;
  text-align: center;
  max-width: calc(var(--rcs-circle-size) + 28px);
  line-height: 1.25;
}

/* Hover (desktop) */
@media (hover: hover) and (pointer: fine) {
  .rcs-swatch:hover .rcs-swatch-circle {
    transform: translateY(-2px) scale(1.05);
    outline-color: var(--rcs-hover-border-color);
  }
}

/* Keyboard focus */
.rcs-swatch:focus-visible {
  outline: none;
}
.rcs-swatch:focus-visible .rcs-swatch-circle {
  outline-color: var(--rcs-hover-border-color);
  outline-style: solid;
  outline-width: 2px;
}

/* Active / selected */
.rcs-swatch.is-active .rcs-swatch-circle {
  outline-color: var(--rcs-active-border-color);
  outline-width: var(--rcs-active-border-width);
  transform: scale(var(--rcs-swatch-scale));
}

.rcs-swatch.is-active .rcs-swatch-name {
  color: #211f1b;
  font-weight: 600;
}

/* Tooltip */
.rcs-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  white-space: nowrap;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  background: #211f1b;
  color: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 3;
}

.rcs-swatch:hover .rcs-tooltip,
.rcs-swatch:focus-visible .rcs-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Optional badge, e.g. "New" / "Popular" */
.rcs-badge {
  position: absolute;
  top: -4px;
  right: -2px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 999px;
  background: #a9794c;
  color: #ffffff;
  line-height: 1.4;
  z-index: 2;
}
