@layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
@import '/assets/f47cf25678047dc1d0c5372c25b330b4ffdf35604610caa62c68ff9ad26b877e/components/slider/slider.css';
@layer cinder.components {
  .cinder-image-compare {
    display: flex;
    flex-direction: column;
    gap: var(--cinder-space-3);
    min-inline-size: 0;
    font-family: var(--cinder-font-sans);
    color: var(--cinder-text-default);
  }

  /* Side by side: two columns while each can be 24rem wide, stacked below that. */
  .cinder-image-compare__pair {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(24rem, 100%), 1fr));
    gap: var(--cinder-space-4);
  }

  .cinder-image-compare__figure {
    display: flex;
    flex-direction: column;
    gap: var(--cinder-space-2);
    min-inline-size: 0;
    margin: 0;
  }

  .cinder-image-compare__caption {
    font-size: var(--cinder-text-sm);
    font-weight: var(--cinder-font-semibold);
  }

  .cinder-image-compare__caption-detail {
    font-weight: var(--cinder-font-normal);
    color: var(--cinder-text-muted);
  }

  .cinder-image-compare__pane,
  .cinder-image-compare__viewport {
    max-block-size: 32rem;
    overflow: auto;
    padding: var(--cinder-space-3);
    background: var(--cinder-surface-inset);
    border: var(--cinder-border-width) solid var(--cinder-border-muted);
    border-radius: var(--cinder-radius-lg);
  }

  .cinder-image-compare__pane:focus-visible,
  .cinder-image-compare__viewport:focus-visible {
    outline: var(--cinder-ring-width) solid transparent;
    box-shadow: var(--_cinder-focus-ring-shadow);
  }

  /* Images keep their natural size: alignment and the wipe work in image pixels. */
  .cinder-image-compare__image {
    display: block;
    max-inline-size: none;
    margin-inline: auto;
  }

  /*
   * The wipe is as wide as its frame, so the slider below spans the image it moves across.
   * A frame wider than the container still scrolls in the viewport. It starts at the leading
   * edge; a page that wants it centred centres it.
   */
  .cinder-image-compare[data-cinder-mode='wipe'] {
    inline-size: fit-content;
    max-inline-size: 100%;
  }

  /* `clip`, not `hidden`: the frame must not be a scroll container, so the labels stick to the viewport. */
  .cinder-image-compare__frame {
    position: relative;
    inline-size: fit-content;
    margin-inline: auto;
    overflow: clip;
    user-select: none;
  }

  .cinder-image-compare__layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
  }

  .cinder-image-compare__divider {
    position: absolute;
    inset-block: 0;
    inline-size: 0.125rem;
    translate: -50% 0;
    background: var(--cinder-accent-solid);
    pointer-events: none;
  }

  .cinder-image-compare__handle {
    position: absolute;
    inset-block-start: 50%;
    inline-size: 1.875rem;
    block-size: 1.875rem;
    translate: -50% -50%;
    background: var(--cinder-accent-solid);
    border: 0.125rem solid var(--cinder-surface-raised);
    border-radius: var(--cinder-radius-full);
    box-shadow: var(--cinder-shadow-md);
    cursor: ew-resize;
    touch-action: none;
  }

  /* A touch target of at least 44px around the 30px handle. */
  .cinder-image-compare__handle::before {
    content: '';
    position: absolute;
    inset: calc(-1 * var(--cinder-space-2));
    border-radius: var(--cinder-radius-full);
  }

  /*
   * A row across the frame's top holding the two labels. Each label is sticky against the
   * viewport's scrollport, so in a frame wider than the viewport the far label stays in view.
   */
  .cinder-image-compare__edge-labels {
    position: absolute;
    inset-block-start: var(--cinder-space-1-5);
    inset-inline: 0;
    display: flex;
    justify-content: space-between;
    gap: var(--cinder-space-2);
    padding-inline: var(--cinder-space-2);
    pointer-events: none;
  }

  .cinder-image-compare__edge-label {
    position: sticky;
    padding: var(--cinder-space-0-5) var(--cinder-space-1-5);
    font-size: var(--cinder-text-xs);
    font-weight: var(--cinder-font-semibold);
    line-height: var(--cinder-leading-tight);
    color: var(--cinder-accent-text);
    background: var(--cinder-surface-raised);
    border: var(--cinder-border-width) solid var(--cinder-border-muted);
    border-radius: var(--cinder-radius-sm);
    white-space: nowrap;
  }

  .cinder-image-compare__edge-label--before:where(
    :not([dir='rtl'], [dir='rtl'] *),
    [dir='rtl'] [dir='ltr'],
    [dir='rtl'] [dir='ltr'] *
  ) {
    left: var(--cinder-space-2);
  }

  .cinder-image-compare__edge-label--before:where(
    :is([dir='rtl'], [dir='rtl'] *):not([dir='rtl'] [dir='ltr'], [dir='rtl'] [dir='ltr'] *)
  ) {
    right: var(--cinder-space-2);
  }

  .cinder-image-compare__edge-label--after:where(
    :not([dir='rtl'], [dir='rtl'] *),
    [dir='rtl'] [dir='ltr'],
    [dir='rtl'] [dir='ltr'] *
  ) {
    right: var(--cinder-space-2);
  }

  .cinder-image-compare__edge-label--after:where(
    :is([dir='rtl'], [dir='rtl'] *):not([dir='rtl'] [dir='ltr'], [dir='rtl'] [dir='ltr'] *)
  ) {
    left: var(--cinder-space-2);
  }

  .cinder-image-compare__control {
    display: flex;
    align-items: center;
    gap: var(--cinder-space-3);
    font-size: var(--cinder-text-sm);
  }

  .cinder-image-compare__end {
    flex: none;
    font-weight: var(--cinder-font-medium);
  }

  .cinder-image-compare__control > .cinder-image-compare__slider {
    flex: 1 1 auto;
    min-inline-size: 0;
  }

  /* The ends name the two images, so the slider's own label and number stay hidden. */
  .cinder-image-compare__slider .cinder-slider__header {
    display: none;
  }

  @media (forced-colors: active) {
    .cinder-image-compare__divider,
    .cinder-image-compare__handle {
      background: Highlight;
    }
    .cinder-image-compare__pane:focus-visible,
    .cinder-image-compare__viewport:focus-visible {
      outline: var(--cinder-ring-width) solid ButtonText;
      outline-offset: calc(-1 * var(--cinder-ring-width));
      box-shadow: none;
    }
  }
}
