/* =========================================================
   CAROUFLEX ESSENTIALS
   ========================================================= */

/* =========================================================
   1. TYPOGRAPHY SYSTEM
   ========================================================= */

.crfxl-preset-tagline {
  font-weight: 700;
  line-height: 1.4;
  display: block;
  margin: 0 0 20px 0;
  color: var(--crfxl-text, inherit);
}

.crfxl-preset-title {
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 20px 0;
  padding: 0;
  color: var(--crfxl-text, inherit) !important;
}

.crfxl-preset-title a {
  text-decoration: none;
  color: inherit;
  transition: opacity 0.3s;
}

.crfxl-preset-title a:hover {
  color: inherit !important;
  opacity: 0.7;
}

.crfxl-preset-description,
.crfxl-preset-excerpt {
  font-weight: 400;
  line-height: 1.6;
  margin-bottom: 25px;
  color: var(--crfxl-text, inherit);
}

.crfxl-preset-description p,
.crfxl-preset-excerpt p {
  margin: 0 0 15px 0;
}

.crfxl-preset-description p:last-child,
.crfxl-preset-excerpt p:last-child {
  margin-bottom: 0;
}

/* --- Font Size Presets --- */

/* Small */
.crfxl-font-preset-small .crfxl-preset-tagline {
  font-size: 11px;
  margin-bottom: 10px;
}
.crfxl-font-preset-small .crfxl-preset-title {
  font-size: 20px;
  margin-bottom: 10px;
}
.crfxl-font-preset-small .crfxl-preset-cta {
  font-size: 12px;
}
.crfxl-font-preset-small .crfxl-preset-description,
.crfxl-font-preset-small .crfxl-preset-excerpt {
  font-size: 13px;
  line-height: 1.5;
}
.crfxl-font-preset-small .crfxl-el-badge {
  font-size: 10px;
}
.crfxl-font-preset-small .crfxl-el-counter {
  font-size: 12px;
}
.crfxl-font-preset-small .crfxl-el-meta-group {
  font-size: 12px;
}
.crfxl-font-preset-small .crfxl-el-avatar {
  width: 20px;
  height: 20px;
}

/* Medium (Default) */
.crfxl-font-preset-medium .crfxl-preset-tagline {
  font-size: 13px;
  margin-bottom: 15px;
}
.crfxl-font-preset-medium .crfxl-preset-title {
  font-size: 28px;
  margin-bottom: 15px;
}
.crfxl-font-preset-medium .crfxl-preset-cta {
  font-size: 14px;
}
.crfxl-font-preset-medium .crfxl-preset-description,
.crfxl-font-preset-medium .crfxl-preset-excerpt {
  font-size: 15px;
}
.crfxl-font-preset-medium .crfxl-el-badge {
  font-size: 12px;
}
.crfxl-font-preset-medium .crfxl-el-counter {
  font-size: 14px;
}
.crfxl-font-preset-medium .crfxl-el-meta-group {
  font-size: 13px;
}
.crfxl-font-preset-medium .crfxl-el-avatar {
  width: 24px;
  height: 24px;
}

/* Large */
.crfxl-font-preset-large .crfxl-preset-tagline {
  font-size: 15px;
  margin-bottom: 20px;
}
.crfxl-font-preset-large .crfxl-preset-title {
  font-size: 42px;
  margin-bottom: 20px;
}
.crfxl-font-preset-large .crfxl-preset-cta {
  font-size: 16px;
}
.crfxl-font-preset-large .crfxl-preset-description,
.crfxl-font-preset-large .crfxl-preset-excerpt {
  font-size: 17px;
}
.crfxl-font-preset-large .crfxl-el-badge {
  font-size: 13px;
}
.crfxl-font-preset-large .crfxl-el-counter {
  font-size: 16px;
}
.crfxl-font-preset-large .crfxl-el-meta-group {
  font-size: 14px;
}
.crfxl-font-preset-large .crfxl-el-avatar {
  width: 30px;
  height: 30px;
}

/* Extra Large */
.crfxl-font-preset-xlarge .crfxl-preset-tagline {
  font-size: 18px;
  margin-bottom: 25px;
  letter-spacing: 2px;
}
.crfxl-font-preset-xlarge .crfxl-preset-title {
  font-size: 84px;
  line-height: 1.1;
  margin-bottom: 30px;
  letter-spacing: -1.5px;
}
.crfxl-font-preset-xlarge .crfxl-preset-description,
.crfxl-font-preset-xlarge .crfxl-preset-excerpt {
  font-size: 20px;
}
.crfxl-font-preset-xlarge .crfxl-el-badge {
  font-size: 14px;
}
.crfxl-font-preset-xlarge .crfxl-el-counter {
  font-size: 18px;
}
.crfxl-font-preset-xlarge .crfxl-el-meta-group {
  font-size: 16px;
}
.crfxl-font-preset-xlarge .crfxl-el-avatar {
  width: 40px;
  height: 40px;
}

@media (max-width: 768px) {
  .crfxl-font-preset-medium .crfxl-preset-title {
    font-size: 22px;
  }
  .crfxl-font-preset-large .crfxl-preset-title {
    font-size: 28px;
  }
  .crfxl-font-preset-xlarge .crfxl-preset-title {
    font-size: 36px;
  }
}

/* =========================================================
   2. BUTTON PRESETS (Refactored for SVG)
   ========================================================= */
.crfxl-btn-preset {
  display: inline-flex !important;
  justify-content: center;
  align-items: center;
  gap: 10px; /* Space between text and icon */
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box !important;
  text-decoration: none !important;
  box-shadow: none;
  outline: none;
  margin: 0;
  padding: 0.75rem 1.6rem !important; /* Slightly wider for better balance */
  min-width: 120px;
  background-color: var(--crfxl-accent, #2271b1);
  color: var(--crfxl-contrast, #ffffff);
  border: 1px solid transparent;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2 !important;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  z-index: 1;
  transform: translateZ(0);
  transition: all 0.3s ease-out;
}

.crfxl-btn-preset:hover {
  filter: var(--crfxl-hover-filter, brightness(0.9));
  text-decoration: none !important;
  color: var(--crfxl-contrast, #ffffff) !important;
}

.crfxl-btn-preset span {
  position: relative;
  z-index: 5;
  display: inline-block;
  line-height: 1;
}

/* Shapes */
.crfxl-btn-radius-pill {
  border-radius: 50rem !important;
}
.crfxl-btn-radius-rounded {
  border-radius: 8px !important;
}
.crfxl-btn-radius-sharp {
  border-radius: 0px !important;
}

/* Style: Outline */
.crfxl-btn-style-outline {
  background-color: transparent;
  border-color: var(--crfxl-accent, #2271b1);
  color: var(--crfxl-accent, #2271b1);
}
.crfxl-btn-style-outline:hover {
  background-color: var(--crfxl-accent, #2271b1);
  color: var(--crfxl-contrast, #ffffff) !important;
  filter: none;
}

/* Style: Icon Slide (Complex Logic) */
.crfxl-btn-style-icon-slide {
  padding-right: 3.8rem !important; /* Make room for the box */
  transition: padding 0.3s ease;
}

.crfxl-btn-style-icon-slide .crfxl-btn-icon {
  background: var(--crfxl-contrast, #ffffff);
  color: var(--crfxl-accent, #2271b1); /* Icon is accent color */
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: all 0.3s ease-out;
  width: 34px;
  height: 34px;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  border-radius: 6px;
}

.crfxl-btn-radius-pill.crfxl-btn-style-icon-slide .crfxl-btn-icon {
  border-radius: 50%;
}
.crfxl-btn-radius-sharp.crfxl-btn-style-icon-slide .crfxl-btn-icon {
  border-radius: 0;
}

.crfxl-btn-style-icon-slide:hover .crfxl-btn-icon {
  width: calc(100% - 10px);
  height: calc(100% - 10px);
  top: 5px;
  right: 5px;
  transform: none;
  background: var(--crfxl-contrast, #ffffff);
}

/* 1. FIX: Force icon to become a pill (not an oval) on hover when button is pill */
.crfxl-btn-radius-pill.crfxl-btn-style-icon-slide:hover .crfxl-btn-icon {
  border-radius: 50rem !important;
}

.crfxl-btn-style-icon-slide:hover span {
  color: var(--crfxl-accent, #2271b1); /* Invert text color on hover */
}

/* Style: Text Links (Arrow & Underline) */
.crfxl-btn-style-arrow,
.crfxl-btn-style-underline {
  background: transparent !important;
  border: none !important;
  min-width: auto !important;
  padding: 0 !important;
  color: var(--crfxl-accent, #2271b1);
  display: inline-flex;
  gap: 8px;
  border-radius: 0 !important;
}
.crfxl-btn-style-arrow:hover,
.crfxl-btn-style-underline:hover {
  opacity: 0.8;
  color: var(--crfxl-accent, #2271b1) !important;
  background: transparent !important;
  filter: none;
}

.crfxl-btn-style-arrow .crfxl-btn-decor-icon {
  display: flex;
  align-items: center;
  transition: transform 0.3s ease;
}

.crfxl-btn-style-underline {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}
.crfxl-btn-style-underline::after {
  content: "";
  display: block;
  height: 2px;
  width: 100%;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
  margin-top: 4px;
}
.crfxl-btn-style-underline:hover::after {
  transform: scaleX(1);
}
/* We hide the icon for underline style */
.crfxl-btn-style-underline .crfxl-btn-decor-icon {
  display: none;
}

/* Style: Shiny */
.crfxl-btn-style-shiny::before {
  content: "";
  position: absolute;
  top: 0;
  left: -80%;
  width: 60%;
  height: 100%;
  background: rgba(255, 255, 255, 0.4);
  transform: skewX(-25deg);
  transition: left 0.5s ease-out;
  pointer-events: none;
}
.crfxl-btn-style-shiny:hover::before {
  left: 120%;
}


/* =========================================================
   3. NAVIGATION PRESETS (Complete: Sides, Inline, Dots & Logic)
   ========================================================= */

/* --- Base Arrow Button --- */
.crfxl-nav-arrow {
  position: relative;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  z-index: 30;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--crfxl-nav, var(--crfxl-accent, #000));
  transition: all 0.2s ease;
}

.crfxl-nav-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.crfxl-nav-arrow svg {
  display: block;
  width: 100%;
  height: 100%;
  stroke-width: 2px;
  pointer-events: none;
}

/* --- Arrow Dimensions (Shared) --- */
.crfxl-arrows-minimal .crfxl-nav-arrow {
  width: 40px;
  height: 40px;
}
.crfxl-arrows-long .crfxl-nav-arrow {
  width: 60px;
  height: 30px;
}
.crfxl-arrows-bubble .crfxl-nav-arrow,
.crfxl-arrows-semi-trans-bubble .crfxl-nav-arrow {
  width: 44px;
  height: 44px;
  padding: 11px;
  border-radius: 50%;
}

/* --- Style Skins (Shared) --- */
.crfxl-arrows-bubble .crfxl-nav-arrow {
  background: var(--crfxl-nav, var(--crfxl-accent, #2271b1));
  color: var(--crfxl-nav-contrast, var(--crfxl-contrast, #fff));
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}
.crfxl-arrows-semi-trans-bubble .crfxl-nav-arrow {
  background: var(--crfxl-nav, var(--crfxl-accent, #000));
  color: var(--crfxl-nav-contrast, var(--crfxl-contrast, #fff));
  opacity: 0.6;
}

/* =========================================================
   CONTEXT A: SIDE NAVIGATION (Absolute)
   ========================================================= */
.crfxl-nav-sides {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  transform: translateY(-50%);
  z-index: 100;
  height: 0;
  pointer-events: none;
}
.crfxl-nav-sides .crfxl-nav-arrow {
  position: absolute;
  top: 0;
  transform: translateY(-50%); /* Centering */
  pointer-events: auto;
}
.crfxl-nav-sides .crfxl-arrow-prev {
  left: 10px;
  right: auto;
}
.crfxl-nav-sides .crfxl-arrow-next {
  right: 10px;
  left: auto;
}

/* Side Hover Effects (Must maintain translateY-50%) */
.crfxl-nav-sides .crfxl-arrows-minimal .crfxl-nav-arrow:hover:not(:disabled) {
  transform: translateY(-50%) scale(1.1);
}
.crfxl-nav-sides .crfxl-arrows-long .crfxl-arrow-prev:hover:not(:disabled) {
  transform: translateY(-50%) translateX(-5px);
}
.crfxl-nav-sides .crfxl-arrows-long .crfxl-arrow-next:hover:not(:disabled) {
  transform: translateY(-50%) translateX(5px);
}
.crfxl-nav-sides .crfxl-arrows-bubble .crfxl-nav-arrow:hover:not(:disabled) {
  transform: translateY(calc(-50% - 3px));
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}
.crfxl-nav-sides
  .crfxl-arrows-semi-trans-bubble
  .crfxl-nav-arrow:hover:not(:disabled) {
  transform: translateY(calc(-50% - 3px)) scale(1.05);
  opacity: 0.9;
}

/* =========================================================
   CONTEXT B: INLINE NAVIGATION (Relative/Flex)
   ========================================================= */
.crfxl-nav-inline {
  display: flex;
  flex-direction: row;
  gap: 15px;
  align-items: center;
  z-index: 100;
  position: relative;
}

/* Inline Hover Effects (Simple, no translateY needed) */
.crfxl-nav-inline .crfxl-arrows-minimal .crfxl-nav-arrow:hover:not(:disabled) {
  transform: scale(1.1);
}
.crfxl-nav-inline .crfxl-arrows-long .crfxl-arrow-prev:hover:not(:disabled) {
  transform: translateX(-5px);
}
.crfxl-nav-inline .crfxl-arrows-long .crfxl-arrow-next:hover:not(:disabled) {
  transform: translateX(5px);
}
.crfxl-nav-inline .crfxl-arrows-bubble .crfxl-nav-arrow:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}
.crfxl-nav-inline
  .crfxl-arrows-semi-trans-bubble
  .crfxl-nav-arrow:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.05);
  opacity: 0.9;
}

@media (max-width: 768px) {
  .crfxl-nav-sides .crfxl-arrow-prev {
    left: 10px;
  }
  .crfxl-nav-sides .crfxl-arrow-next {
    right: 10px;
  }
  .crfxl-nav-inline {
    width: 100%;
    justify-content: center;
  }
}

/* =========================================================
   DOTS CONTAINER
   ========================================================= */
.crfxl-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  z-index: 20;
  position: absolute;
  width: 100%;
  left: 0;
  bottom: 20px;
}
/* Individual Dot */
.crfxl-dot {
  padding: 0;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--crfxl-nav, var(--crfxl-accent, #2271b1));
  opacity: 0.4;
}
.crfxl-dot.crfxl-active {
  background: var(--crfxl-nav, var(--crfxl-accent, #2271b1));
  transform: scale(1.3);
  opacity: 1;
}

/* Dot Styles */
.crfxl-dots-circles .crfxl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.crfxl-dots-squares .crfxl-dot {
  width: 10px;
  height: 10px;
  border-radius: 0;
}
.crfxl-dots-lines .crfxl-dot {
  width: 24px;
  height: 3px;
  border-radius: 2px;
}

/* =========================================================
   VISIBILITY LOGIC (Global Controller)
   ========================================================= */
/* !important used to enforce structure over defaults */

/* --- DESKTOP RULES (Min-Width 769px) --- */
@media (min-width: 769px) {
  /* 1. Hiding Dots */
  .crfxl-nav-d-arrows .crfxl-dots,
  .crfxl-nav-d-arrows-only .crfxl-dots,
  .crfxl-nav-d-arrows-sidebar .crfxl-dots,
  .crfxl-nav-d-sidebar-only .crfxl-dots {
    display: none !important;
  }

  /* 2. Hiding Arrows */
  .crfxl-nav-d-dots .crfxl-nav-arrow,
  .crfxl-nav-d-sidebar-only .crfxl-nav-arrow {
    display: none !important;
  }

  /* 3. Hiding Both */
  .crfxl-nav-d-none .crfxl-nav-arrow,
  .crfxl-nav-d-none .crfxl-dots {
    display: none !important;
  }
}

/* --- MOBILE RULES (Max-Width 768px) --- */
@media (max-width: 768px) {
  /* 1. Hiding Dots on Mobile */
  .crfxl-nav-m-arrows .crfxl-dots,
  .crfxl-nav-m-arrows-only .crfxl-dots,
  .crfxl-nav-m-arrows-sidebar .crfxl-dots,
  .crfxl-nav-m-sidebar-only .crfxl-dots {
    display: none !important;
  }

  /* 2. Hiding Arrows on Mobile */
  .crfxl-nav-m-dots .crfxl-nav-arrow,
  .crfxl-nav-m-sidebar-only .crfxl-nav-arrow {
    display: none !important;
  }

  /* 3. Hiding Both on Mobile */
  .crfxl-nav-m-none .crfxl-nav-arrow,
  .crfxl-nav-m-none .crfxl-dots {
    display: none !important;
  }
}

/* =========================================================
   4. ELEMENTS LIBRARY (Badges, Counters, Avatar/Meta)
   ========================================================= */

/* --- Badges --- */
.crfxl-el-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: normal;
  transition: all 0.3s ease;
  margin-bottom: 15px;
}

/* Badge: Modern */
.crfxl-el-badge-modern {
  background: var(--crfxl-tag);
  color: var(--crfxl-tag-contrast);
  padding: 0.4em 1em;
  border-radius: 20px;
}
.crfxl-el-badge-modern:hover {
  filter: var(--crfxl-tag-hover-filter);
}

/* Badge: Simple */
.crfxl-el-badge-simple {
  background: transparent;
  color: var(--crfxl-tag);
  padding: 0;
}
.crfxl-el-badge-simple:hover {
  opacity: 0.7;
}

/* Badge: Outline */
.crfxl-el-badge-outline {
  background: transparent;
  border: 1px solid currentColor;
  color: var(--crfxl-tag);
  padding: 0.3em 0.8em;
  border-radius: 4px;
}
.crfxl-el-badge-outline:hover {
  background: var(--crfxl-tag);
  color: var(--crfxl-tag-contrast);
  border-color: var(--crfxl-tag);
}

/* --- Counters --- */
.crfxl-el-counter {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-weight: 700;
  color: var(--crfxl-text, #333);
  line-height: 1;
  margin-bottom: 20px;
}
.crfxl-el-counter-sep {
  opacity: 0.4;
  font-weight: 400;
}
.crfxl-el-counter-total {
  opacity: 0.5;
  font-weight: 500;
}
.crfxl-el-counter-current {
  font-weight: 700;
}

/* --- Avatars & Meta --- */
.crfxl-el-avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #eee;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

.crfxl-el-meta-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 15px;
  color: var(--crfxl-text, inherit);
  line-height: 1.2;
  margin-bottom: 12px;
}

.crfxl-meta-date-group,
.crfxl-meta-author-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.crfxl-el-icon {
  display: block;
  fill: currentColor;
  flex-shrink: 0;
  width: 1em;
  height: 1em;
  line-height: 1;
}

/* =========================================================
   5. LAYOUT & CONTENT PLACEMENT (SMART SAFE ZONE)
   ========================================================= */

/* --- 1. DEFAULT SAFE ZONE (Desktop) --- */
/* This equals Arrow Width + Breathing Room */
.crfxl-has-overlay {
  --crfxl-nav-safe-zone: 70px;
}

/* --- 2. CONTAINER SETUP --- */
.crfxl-slide-content {
  position: absolute;
  z-index: 25;
  pointer-events: none;

  /* CALCULATION: Total Width minus Safe Zones on both sides */
  width: calc(100% - (var(--crfxl-nav-safe-zone) * 2));
  max-width: 800px;

  /* Center the safe box horizontally */
  margin-left: auto;
  margin-right: auto;
  left: 0;
  right: 0;
}

.crfxl-slide-content > * {
  pointer-events: auto;
}

/* --- 3. DESKTOP PLACEMENT RULES (min-width: 769px) --- */
@media (min-width: 769px) {
  /* Center */
  .placement-center .crfxl-slide-content {
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
  }

  /* Left Center */
  .placement-left-center .crfxl-slide-content {
    top: 50%;
    transform: translateY(-50%);
    text-align: left;

    /* Stick to Left Safe Zone */
    margin-left: var(--crfxl-nav-safe-zone);
    margin-right: auto;
    left: 0;
    right: auto;

    max-width: 600px;
    width: auto;
    padding-right: var(--crfxl-nav-safe-zone);
  }

  /* Right Center */
  .placement-right-center .crfxl-slide-content {
    top: 50%;
    transform: translateY(-50%);
    text-align: right;

    /* Stick to Right Safe Zone */
    margin-right: var(--crfxl-nav-safe-zone);
    margin-left: auto;
    right: 0;
    left: auto;

    max-width: 600px;
    width: auto;
    padding-left: var(--crfxl-nav-safe-zone);
  }

  /* Bottom Center */
  .placement-bottom-center .crfxl-slide-content {
    bottom: 10%;
    top: auto;
    text-align: center;
  }
}

/* --- 4. MOBILE RULES (max-width: 768px) --- */
@media (max-width: 768px) {
  /* A. DEFAULT: Small padding for clean look (Dots, None, Sidebar-Only) */
  .crfxl-has-overlay {
    --crfxl-nav-safe-zone: 20px;
  }

  /* B. SMART OVERRIDE: If Mobile Arrows are ON, increase padding */
  /* These classes are generated by your PHP settings */
  .crfxl-nav-m-both.crfxl-has-overlay,
  .crfxl-nav-m-arrows.crfxl-has-overlay,
  .crfxl-nav-m-arrows-only.crfxl-has-overlay,
  .crfxl-nav-m-arrows-sidebar.crfxl-has-overlay {
    --crfxl-nav-safe-zone: 55px; /* 40px Arrow + 15px Gap */
  }

  /* Recalculate Width for Mobile */
  .crfxl-slide-content {
    width: calc(100% - (var(--crfxl-nav-safe-zone) * 2));
    max-width: 100%;
  }

  /* Mobile Placement Logic */
  .mobile-placement-center .crfxl-slide-content {
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
  }

  .mobile-placement-left-center .crfxl-slide-content {
    top: 50%;
    transform: translateY(-50%);
    text-align: left;
    margin-left: var(--crfxl-nav-safe-zone);
    margin-right: auto;
    left: 0;
    right: auto;
  }

  .mobile-placement-right-center .crfxl-slide-content {
    top: 50%;
    transform: translateY(-50%);
    text-align: right;
    margin-right: var(--crfxl-nav-safe-zone);
    margin-left: auto;
    right: 0;
    left: auto;
  }

  .mobile-placement-bottom-center .crfxl-slide-content {
    bottom: 10%;
    top: auto;
    text-align: center;
  }
}

/* =========================================================
   6. GLOBAL TEXT ANIMATIONS
   ========================================================= */

/* --- Base Hidden State --- */
[class*="crfxl-anim-"] .crfxl-anim-box .crfxl-anim-item {
  opacity: 0;
  transition: opacity 0.8s ease-out,
    transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: opacity, transform;
  backface-visibility: hidden;
}

/* --- Active State (Visible) --- */
[class*="crfxl-anim-"] .crfxl-anim-box.crfxl-active .crfxl-anim-item,
[class*="crfxl-anim-"] .active .crfxl-anim-box .crfxl-anim-item,
[class*="crfxl-anim-"] .crfxl-active .crfxl-anim-box .crfxl-anim-item {
  opacity: 1;
  transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
}

/* --- Smart Origins (Responsive) --- */

/* Desktop Origins */
@media (min-width: 769px) {
  .placement-center .crfxl-anim-item,
  .placement-bottom-center .crfxl-anim-item {
    transform-origin: center center;
  }
  .placement-left-center .crfxl-anim-item {
    transform-origin: left center;
  }
  .placement-right-center .crfxl-anim-item {
    transform-origin: right center;
  }
}

/* Mobile Origins */
@media (max-width: 768px) {
  .mobile-placement-center .crfxl-anim-item,
  .mobile-placement-bottom-center .crfxl-anim-item {
    transform-origin: center center;
  }
  .mobile-placement-left-center .crfxl-anim-item {
    transform-origin: left center;
  }
  .mobile-placement-right-center .crfxl-anim-item {
    transform-origin: right center;
  }
}

/* --- Animation Types --- */

/* Pure Fade In (No Movement) */
.crfxl-anim-fade-in .crfxl-anim-box .crfxl-anim-item {
  transform: translate3d(0, 0, 0);
}

/* Fade In Up */
.crfxl-anim-fade-in-up .crfxl-anim-box .crfxl-anim-item {
  transform: translate3d(0, 30px, 0);
}

/* Fade In Down */
.crfxl-anim-fade-in-down .crfxl-anim-box .crfxl-anim-item {
  transform: translate3d(0, -30px, 0);
}

/* --- Staggering --- */
[class*="crfxl-anim-"] .active .crfxl-anim-box .crfxl-anim-item:nth-child(1) {
  transition-delay: 0.1s;
}
[class*="crfxl-anim-"] .active .crfxl-anim-box .crfxl-anim-item:nth-child(2) {
  transition-delay: 0.25s;
}
[class*="crfxl-anim-"] .active .crfxl-anim-box .crfxl-anim-item:nth-child(3) {
  transition-delay: 0.4s;
}
[class*="crfxl-anim-"] .active .crfxl-anim-box .crfxl-anim-item:nth-child(4) {
  transition-delay: 0.55s;
}

/* =========================================================
   7. UTILITIES
   ========================================================= */

/* Accessibility */
.crfxl-sr-announcer,
.screen-reader-text {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

/* Global Link Overlay */
.crfxl-global-link-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
}

/* Image Overlays */
.crfxl-overlay-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: background-color 0.3s ease;
  z-index: 5;
}

.crfxl-has-overlay.overlay-none .crfxl-overlay-layer {
  background: transparent;
}
.crfxl-has-overlay.overlay-light .crfxl-overlay-layer {
  background: rgba(0, 0, 0, 0.15);
}
.crfxl-has-overlay.overlay-medium .crfxl-overlay-layer {
  background: rgba(0, 0, 0, 0.35);
}
.crfxl-has-overlay.overlay-strong .crfxl-overlay-layer {
  background: rgba(0, 0, 0, 0.6);
}
.crfxl-has-overlay.overlay-gradient .crfxl-overlay-layer {
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 20%,
    rgba(0, 0, 0, 0.85) 100%
  );
}

/* =========================================================
   8. RADIUS SYSTEM
   ========================================================= */

.crfxl-radius-square {
  --crfxl-radius: 0px;
}

.crfxl-radius-soft {
  --crfxl-radius: 12px;
}

.crfxl-radius-extra-soft {
  --crfxl-radius: 18px;
}
/* =========================================================
   9. AUTOPLAY TOGGLE BUTTON (Global)
   ========================================================= */

.crfxl-autoplay-toggle {
  position: absolute;
  bottom: 20px; /* Added Global Position */
  right: 20px; /* Added Global Position */
  z-index: 50;

  /* Default Design */
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
}

/* Hover & Focus States */
.crfxl-autoplay-toggle:hover,
.crfxl-autoplay-toggle:focus {
  background: #000;
  border-color: #fff;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.crfxl-autoplay-toggle svg {
  display: block;
  width: 14px;
  height: 14px;
}

/* Toggle Logic: Hide/Show Icons based on class */
.crfxl-autoplay-toggle.paused .crfxl-icon-pause {
  display: none;
}
.crfxl-autoplay-toggle.paused .crfxl-icon-play {
  display: block !important;
}
