/*
 * RAZOR Slider. Loaded only on pages using [razor_slider].
 *
 * Colours and fonts come from the child theme's :root tokens, with fallbacks
 * so the slider still renders if a token is renamed. Buttons are the theme's
 * own .et_pb_button variants and are styled there, not here.
 *
 * Slides are stacked in one grid cell and cross-faded, so the slider is
 * always as tall as its tallest slide and never jumps between slides.
 */

.razor-slider {
  --razor-slider-pad-y: clamp(50px, 8vw, 120px);
  --razor-slider-speed: 0.6s;
  --razor-slider-light-bg: var(--colour-background, #f4f7f8);
  --razor-slider-light-text: var(--colour-text-body, #0e1f38);
  --razor-slider-dark-bg: var(--colour-text-heading, #18263a);
  --razor-slider-dark-text: var(--colour-white, #fff);
  --razor-slider-accent: var(--colour-tertiary, #e97721);

  position: relative;
  width: 100%;
  overflow: hidden;
}

.razor-slider__track {
  display: grid;
  /* Lets slider.js see horizontal swipes; vertical still scrolls the page. */
  touch-action: pan-y;
}

/* ---- Slide ---- */

.razor-slider__slide {
  grid-area: 1 / 1;
  position: relative;
  display: flex;
  isolation: isolate;
  background: var(--razor-slider-light-bg);
  color: var(--razor-slider-light-text);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--razor-slider-speed) ease,
    visibility 0s linear var(--razor-slider-speed);
}

.razor-slider__slide.is-active {
  opacity: 1;
  visibility: visible;
  transition:
    opacity var(--razor-slider-speed) ease,
    visibility 0s;
}

.razor-slider__slide--dark {
  background: var(--razor-slider-dark-bg);
  color: var(--razor-slider-dark-text);
}

.razor-slider__background {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Keep text readable over a background photo. */
.razor-slider__slide.has-background::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(149deg, rgba(10, 10, 11, 0.00) 51.89%, rgba(10, 10, 11, 0.20) 99.99%), linear-gradient(228deg, rgba(6, 18, 28, 0.00) 12.77%, rgba(28, 21, 6, 0.60) 121.21%);
}
@media screen and (max-width: 800px) {
  .razor-slider__slide.has-background::before {
    background: linear-gradient(149deg, rgba(10, 10, 11, 0.2) 51.89%, rgba(10, 10, 11, 01) 99.99%), linear-gradient(228deg, rgba(6, 18, 28, 0.00) 12.77%, rgba(28, 21, 6, 1) 121.21%);
  }
}
.razor-slider__slide--dark.has-background::before {
  background: linear-gradient(
    90deg,
    rgb(14 31 56 / 0.85),
    rgb(14 31 56 / 0.55)
  );
}

/* ---- Columns ---- */

/*
 * Inner + columns mirror the theme's .et_pb_section .et_pb_row /
 * .et_pb_column (style.css), so a slide lines up with every other section:
 * same frame width, same gaps, same 1000px wrap point.
 */
.razor-slider__inner {
  display: flex;
  flex-wrap: nowrap;
  row-gap: clamp(30px, calc(var(--row-gap, 10px) * 6), 60px);
  column-gap: clamp(30px, calc(var(--column-gap, 10px) * 6), 60px);
  align-items: center;
  max-width: var(--frame-max-m, 1450px);
  width: var(--frame-width, calc(100% - 160px));
  margin-inline: auto;
  padding: var(--razor-slider-pad-y) 0;
  /* Room for the controls under the content. */
  padding-top: calc(var(--razor-slider-pad-y) + 60px);
  padding-bottom: calc(var(--razor-slider-pad-y) + 60px);
}
.razor-slider__slide--align-start .razor-slider__inner {
  align-items: start;
}
.razor-slider__slide--align-end .razor-slider__inner {
  align-items: end;
}

.razor-slider__column {
  display: flex;
  flex-direction: column;
  flex: 1 1 45%;
  column-gap: clamp(30px, calc(var(--column-gap, 10px) * 4), 40px);
  row-gap: clamp(30px, calc(var(--column-gap, 10px) * 5), 48px);
  width: 100%;
  min-width: 0;
  height: 100%;
  justify-content: flex-end;
}

.razor-slider__slide--60-40 .razor-slider__column--left,
.razor-slider__slide--40-60 .razor-slider__column--right {
  flex: 1 1 55%;
}
.razor-slider__slide--60-40 .razor-slider__column--right,
.razor-slider__slide--40-60 .razor-slider__column--left {
  flex: 1 1 35%;
}

/* ---- Editor content ---- */

.razor-slider__content > :first-child {
  margin-top: 0;
}
.razor-slider__content > :last-child {
  margin-bottom: 0;
  padding-bottom: 0;
}

.razor-slider__content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  width: 0%;
}

/* The theme colours headings via --colour-text; follow the slide instead. */
.razor-slider__slide :is(h1, h2, h3, h4, h5, h6, p, li, blockquote) {
  color: inherit;
}

.razor-slider__content a:not(.et_pb_button) {
  color: var(--razor-slider-accent);
}

.razor-slider__slide--dark .razor-slider__content a:not(.et_pb_button) {
  color: inherit;
  text-decoration: underline;
}

/* TinyMCE's alignment buttons. */
.razor-slider__content .aligncenter {
  display: block;
  margin-inline: auto;
}
.razor-slider__content .alignleft {
  float: left;
  margin: 0 20px 10px 0;
}
.razor-slider__content .alignright {
  float: right;
  margin: 0 0 10px 20px;
}

/* ---- Buttons (styled by the theme) ---- */

.razor-slider__buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 30px;
}
@media screen and (max-width: 600px) {
  .razor-slider__buttons {
    gap: 16px;
    justify-content: center;
  }
}

/* "Text button only": no background, no border, no theme button styling. */
.razor-slider a.razor-slider__text-button {
  padding: 0;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 1.26px;
  text-transform: uppercase;
  text-decoration: none;
  color: inherit;
  transition: var(--transition-fast, all 0.15s ease);
  color: var(--colour-white);
  font-family: var(--font-body-condensed);
  position: relative;
}

.razor-slider a.razor-slider__text-button::after {
  content: "";
  width: 0%;
  height: 1.5px;
  background: var(--colour-white);
  transition: ease 300ms;
  position: absolute;
  bottom: -2px;
  left: 0;
}
.razor-slider a.razor-slider__text-button:hover::after {
  width: 100%;
}

.razor-slider a.razor-slider__text-button:focus-visible {
  outline: 2px solid var(--razor-slider-accent);
  outline-offset: 3px;
}

/* Centre the buttons when the text above them is centred. */
.razor-slider__content:has(> :last-child[style*="text-align: center"])
  + .razor-slider__buttons {
  justify-content: center;
}

/* ---- Controls ---- */

/* Overlaid on the slide, so colours follow the active slide's scheme. */
.razor-slider__controls {
  position: absolute;
  bottom: clamp(20px, 3vw, 40px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
  right: clamp(30px, 3vw, 100px);
}
@media screen and (max-width: 1500px) {
  .razor-slider__controls{
    right: 0;
  }
}

.razor-slider__arrow {
  appearance: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: none;
  color: var(--razor-slider-light-text);
  transition: var(--transition-fast, all 0.15s ease);
}

.razor-slider.is-dark .razor-slider__arrow {
  color: var(--razor-slider-dark-text);
}

.razor-slider__arrow {
  display: grid;
  place-items: center;
  width: 35px;
  height: 60px;
  border-radius: 50%;
  border: 1px solid #FFF;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(15px);
}

.razor-slider__arrow svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
}

.razor-slider__arrow:hover {
  background: var(--razor-slider-accent);
  border-color: var(--razor-slider-accent);
  color: var(--colour-white, #fff);
}

.razor-slider .razor-slider__arrow:focus-visible {
  outline: 2px solid var(--razor-slider-accent);
  outline-offset: 3px;
}

/* ---- Responsive ---- */

/* Same breakpoint at which the theme stacks .et_pb_column_1_2. */
@media (max-width: 1000px) {
  .razor-slider__inner {
    flex-wrap: wrap;
  }
  .razor-slider__slide .razor-slider__column {
    flex: 1 1 100%;
    /* height: 100% makes each stacked column as tall as both together,
       which pushes the second one out of the slide and clips it. */
    height: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .razor-slider {
    --razor-slider-speed: 0s;
  }
}
