/* ============================================================
   Elementor Integration Styles
   Life Science Insights Theme
   ============================================================ */

/* ------------------------------------------------------------
   Let Elementor manage its own container width (set in kit settings).
   We match the theme header/container to Elementor's kit width.
   ------------------------------------------------------------ */

/* The Elementor front-page wrapper should span the full body width so
   its centered boxed containers align with the centered header. */
.lsi-main {
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
}

/* ── Hero widget Elementor wrapper — ensure no clipping ── */
.elementor-widget-lsi_hero_carousel,
.elementor-widget-lsi_hero_carousel > .elementor-widget-container {
  padding: 0 !important;
  margin: 0 !important;
  overflow: visible !important;
  width: 100% !important;
}

/* Elementor widget base reset */
.elementor-widget-lsi_featured_research .lsi-featured-research,
.elementor-widget-lsi_news_grid .lsi-news-grid,
.elementor-widget-lsi_categories_grid .lsi-topics-grid,
.elementor-widget-lsi_newsletter .lsi-newsletter,
.elementor-widget-lsi_author_spotlight .lsi-author-box,
.elementor-widget-lsi_research_stats .lsi-stats-grid {
  font-family: var(--lsi-font-body);
}

/* ---- Featured Research Widget ---- */
.lsi-featured-research {
  display: grid;
  gap: 0;
  border: 1px solid var(--lsi-border);
  border-radius: var(--lsi-radius-xl);
  overflow: hidden;
  background: var(--lsi-bg);
}

.lsi-fr--split {
  grid-template-columns: 1fr 1fr;
}

.lsi-fr--overlay {
  position: relative;
}

.lsi-fr__image {
  overflow: hidden;
  background: var(--lsi-bg-alt);
}

.lsi-fr__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.lsi-featured-research:hover .lsi-fr__image img {
  transform: scale(1.02);
}

.lsi-fr--split .lsi-fr__image {
  aspect-ratio: 4/3;
}

.lsi-fr__content {
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  justify-content: center;
}

.lsi-fr__category {
  width: fit-content;
}

.lsi-fr__title {
  font-family: var(--lsi-font-heading);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 500;
  line-height: 1.2;
  color: var(--lsi-text);
}

.lsi-fr__title a {
  color: inherit;
  text-decoration: none;
}

.lsi-fr__title a:hover {
  color: var(--lsi-accent);
}

.lsi-fr__summary {
  color: var(--lsi-text-secondary);
  line-height: 1.7;
  font-size: 1rem;
}

/* Overlay variant */
.lsi-fr--overlay .lsi-fr__image {
  min-height: 480px;
}

.lsi-fr--overlay .lsi-fr__content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
  color: #fff;
  padding: 3rem 2.5rem;
}

.lsi-fr--overlay .lsi-fr__title,
.lsi-fr--overlay .lsi-article-meta {
  color: #fff;
}

.lsi-fr--overlay .lsi-fr__summary {
  color: rgba(255, 255, 255, 0.8);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .lsi-fr--split {
    grid-template-columns: 1fr;
  }
  .lsi-fr__content {
    padding: 1.75rem;
  }
}

/* ---- Elementor specific spacing ---- */
.elementor-widget:not(:last-child) {
  margin-bottom: 0;
}

/* ============================================================
   Elementor Heading Widget — Theme-consistent typography
   ============================================================ */

/* ============================================================
   Elementor Heading Widget — Theme-consistent typography
   ============================================================ */

/* Base reset — override Elementor inline styles */
.elementor-widget-heading .elementor-heading-title {
  font-family: var(--lsi-font-body) !important;
  font-weight: var(--lsi-fw-semibold) !important;
  line-height: var(--lsi-line-height-tight) !important;
  letter-spacing: var(--lsi-ls-snug) !important;
  color: var(--lsi-text) !important;
  margin: 0;
}

/* Size variants mapped to theme scale */
.elementor-widget-heading .elementor-heading-title.elementor-size-small  { font-size: var(--lsi-small) !important; }
.elementor-widget-heading .elementor-heading-title.elementor-size-medium { font-size: var(--lsi-h4) !important; }
.elementor-widget-heading .elementor-heading-title.elementor-size-large  { font-size: var(--lsi-h3) !important; }
.elementor-widget-heading .elementor-heading-title.elementor-size-xl     { font-size: var(--lsi-h2) !important; }
.elementor-widget-heading .elementor-heading-title.elementor-size-xxl    { font-size: var(--lsi-h1) !important; }

/* Links inside headings */
.elementor-widget-heading .elementor-heading-title a {
  color: inherit !important;
  text-decoration: none;
}
.elementor-widget-heading .elementor-heading-title a:hover {
  color: var(--lsi-accent) !important;
}

/* ── Line variants — add CSS class in Elementor Advanced tab ──────────
   lsi-line-left   : accent line on the LEFT  of the heading text
   lsi-line-right  : accent line on the RIGHT of the heading text
   lsi-line-both   : accent lines on BOTH sides (centred look)
   ------------------------------------------------------------------- */

/* Shared wrapper behaviour for all line variants */
.elementor-widget-heading.lsi-line-left  .elementor-heading-title,
.elementor-widget-heading.lsi-line-right .elementor-heading-title,
.elementor-widget-heading.lsi-line-both  .elementor-heading-title {
  display: flex !important;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
}

/* The line itself — shared base */
.elementor-widget-heading.lsi-line-left  .elementor-heading-title::before,
.elementor-widget-heading.lsi-line-right .elementor-heading-title::after,
.elementor-widget-heading.lsi-line-both  .elementor-heading-title::before,
.elementor-widget-heading.lsi-line-both  .elementor-heading-title::after {
  content: '';
  display: block;
  flex: 1;
  height: 1.5px;
  background: var(--lsi-border);
  border-radius: 1px;
}

/* Left line only */
.elementor-widget-heading.lsi-line-left .elementor-heading-title::before {
  max-width: 40px;
  background: var(--lsi-accent);
}

/* Right line only — stretches to fill remaining space */
.elementor-widget-heading.lsi-line-right .elementor-heading-title::after {
  flex: 1;
  background: var(--lsi-border);
}

/* Both sides — left is short accent, right stretches */
.elementor-widget-heading.lsi-line-both .elementor-heading-title::before {
  max-width: 40px;
  background: var(--lsi-accent);
  flex: none;
  width: 40px;
}
.elementor-widget-heading.lsi-line-both .elementor-heading-title::after {
  flex: 1;
}

/* ============================================================
   Hero Carousel Widget - Premium Editorial
   ============================================================ */
.lsi-hero-carousel {
  --lsi-hero-thumbs-w: 320px;
  --lsi-hero-radius: 18px;
  --lsi-hero-accent: var(--lsi-accent, #e5483c);
  --lsi-hero-overlay: 55%;
  font-family: var(--lsi-font-body);
  width: 100%;
  border-radius: var(--lsi-hero-radius);
  overflow: hidden;
}

/* ── With thumbnail rail: side-by-side grid ── */
.lsi-hero-carousel--thumbs-right,
.lsi-hero-carousel--thumbs-left {
  display: grid;
  grid-template-columns: 1fr var(--lsi-hero-thumbs-w);
}
.lsi-hero-carousel--thumbs-left {
  grid-template-columns: var(--lsi-hero-thumbs-w) 1fr;
}
.lsi-hero-carousel--thumbs-left .lsi-hero__stage {
  order: 2;
}
.lsi-hero-carousel--thumbs-left .lsi-hero__thumbs {
  order: 1;
}

/* ── Full-width mode — true edge-to-edge, header overlaps ── */
.lsi-hero-carousel--full {
  display: block;
  border-radius: 0;
  /* Break out of every Elementor container/column/padding.
     left:50vw anchors to true viewport center (not parent %).
     translateX(-50%) shifts left by half own width (100vw/2 = 50vw). */
  width: 100vw;
  position: relative;
  left: 50vw;
  transform: translateX(-50%);
  /* Pull up behind fixed header */
  margin-top: calc(-1 * (var(--lsi-header-height, 80px) + 1.5rem));
}
.lsi-hero-carousel--full .lsi-hero__stage {
  height: 100vh;
  min-height: 560px;
  border-radius: 0;
  width: 100%;
}

/* Stage */
.lsi-hero__stage {
  position: relative;
  height: 560px;
  overflow: hidden;
  background: #0d0d0d;
}
.lsi-hero__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.7s ease,
    visibility 0.7s;
  display: flex;
  align-items: flex-end;
}
.lsi-hero__slide.is-active {
  opacity: 1;
  visibility: visible;
  z-index: 2;
}

/* Background image — static, no Ken Burns */
.lsi-hero__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

/* Scrim — bottom-heavy gradient for readability */
.lsi-hero__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.78) 0%,
    rgba(0, 0, 0, 0.4) 40%,
    rgba(0, 0, 0, 0) 70%
  );
}

/* Content wrap — spans full stage width */
.lsi-hero__content-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
}

/* .lsi-container inside content-wrap handles centering — content sits inside it */
.lsi-hero__content-wrap .lsi-container {
  padding-bottom: 0;
}

.lsi-hero__content {
  padding-bottom: 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
  color: #fff;
}

/* Title */
.lsi-hero__title {
  font-family: var(--lsi-font-heading);
  font-size: clamp(2rem, 3.5vw, 3.25rem);
  line-height: 1.1;
  font-weight: var(--lsi-fw-semibold);
  letter-spacing: var(--lsi-ls-tight);
  margin: 0;
  max-width: 100ch;
}
.lsi-hero__title a {
  color: #fff;
  text-decoration: none;
}
.lsi-hero__title a:hover {
  text-decoration: none;
}

/* CTA button */
.lsi-hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65em 1.6em;
  background: rgba(255, 255, 255, 0.95);
  color: #111;
  font-size: var(--lsi-xs);
  font-weight: var(--lsi-fw-semibold);
  border-radius: 6px;
  text-decoration: none;
  letter-spacing: var(--lsi-ls-normal);
  transition:
    background 0.22s ease,
    color 0.22s ease;
}
.lsi-hero__cta:hover {
  background: var(--lsi-hero-accent);
  color: #fff;
}
.lsi-hero__cta svg {
  transition: transform 0.22s ease;
}
.lsi-hero__cta:hover svg {
  transform: translateX(3px);
}

/* Nav arrows */
.lsi-hero__nav {
  position: absolute;
  bottom: 2rem;
  z-index: 5;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}
.lsi-hero__nav:hover {
  background: var(--lsi-hero-accent);
  border-color: var(--lsi-hero-accent);
}
/* Full-width: arrows bottom-right */
.lsi-hero-carousel--full .lsi-hero__nav--prev {
  right: calc((100% - 1140px) / 2 + 4.5rem);
}
.lsi-hero-carousel--full .lsi-hero__nav--next {
  right: calc((100% - 1140px) / 2 + 1.25rem);
}
/* Thumbs layout: arrows bottom-right of stage */
.lsi-hero-carousel--thumbs-right .lsi-hero__nav--prev,
.lsi-hero-carousel--thumbs-left .lsi-hero__nav--prev {
  right: 4rem;
}
.lsi-hero-carousel--thumbs-right .lsi-hero__nav--next,
.lsi-hero-carousel--thumbs-left .lsi-hero__nav--next {
  right: 1.25rem;
}


/* Progress bar */
.lsi-hero__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  z-index: 6;
  background: rgba(255, 255, 255, 0.12);
}
.lsi-hero__progress-bar {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--lsi-hero-accent);
}

/* Thumbnail rail */
.lsi-hero__thumbs {
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow-y: auto;
  border-left: 1px solid rgba(0, 0, 0, 0.06);
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}
.lsi-hero__thumbs::-webkit-scrollbar {
  width: 3px;
}
.lsi-hero__thumbs::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 9999px;
}

.lsi-hero__thumb {
  position: relative;
  display: flex;
  align-items: stretch;
  flex: 1 1 0;
  min-height: 0;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition: background 0.2s ease;
}
.lsi-hero__thumb:last-child {
  border-bottom: none;
}
.lsi-hero__thumb:hover {
  background: #f8f8f8;
}
.lsi-hero__thumb.is-active {
  background: #fff7f7;
}

.lsi-hero__thumb::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--lsi-hero-accent);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.3s ease;
}
.lsi-hero__thumb.is-active::after {
  transform: scaleY(1);
}

.lsi-hero__thumb-img {
  flex: 0 0 88px;
  align-self: stretch;
  background-size: cover;
  background-position: center;
  filter: brightness(0.92) saturate(0.9);
  transition: filter 0.25s ease;
}
.lsi-hero__thumb.is-active .lsi-hero__thumb-img,
.lsi-hero__thumb:hover .lsi-hero__thumb-img {
  filter: brightness(1) saturate(1);
}

.lsi-hero__thumb-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.8rem 0.9rem 0.8rem 0.75rem;
  min-width: 0;
}

.lsi-hero__thumb-cat {
  font-size: var(--lsi-xxs);
  font-weight: var(--lsi-fw-semibold);
  letter-spacing: var(--lsi-ls-wider);
  text-transform: uppercase;
  color: var(--lsi-hero-accent);
  opacity: 0.7;
  transition: opacity 0.2s ease;
}
.lsi-hero__thumb.is-active .lsi-hero__thumb-cat {
  opacity: 1;
}

.lsi-hero__thumb-title {
  font-size: var(--lsi-xs);
  font-weight: var(--lsi-fw-medium);
  line-height: var(--lsi-line-height-snug);
  color: #333;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.2s ease;
}
.lsi-hero__thumb.is-active .lsi-hero__thumb-title {
  color: #111;
}

.lsi-hero__thumb-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background: var(--lsi-hero-accent);
  opacity: 0.4;
}
.lsi-hero__thumb.is-active .lsi-hero__thumb-progress {
  width: 100%;
  transition: width 0.3s ease;
}

/* Responsive */
@media (max-width: 1024px) {
  .lsi-hero-carousel--thumbs-right,
  .lsi-hero-carousel--thumbs-left {
    grid-template-columns: 1fr;
    border-radius: 14px;
  }
  .lsi-hero-carousel--thumbs-left .lsi-hero__stage,
  .lsi-hero-carousel--thumbs-left .lsi-hero__thumbs {
    order: initial;
  }
  .lsi-hero__thumbs {
    flex-direction: row;
    border-left: none;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    overflow-x: auto;
    overflow-y: hidden;
  }
  .lsi-hero__thumb {
    flex: 0 0 190px;
    flex-direction: column;
    border-bottom: none;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
  }
  .lsi-hero__thumb::after {
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: auto;
    height: 3px;
    transform: scaleX(0);
    transform-origin: left;
  }
  .lsi-hero__thumb.is-active::after {
    transform: scaleX(1);
  }
  .lsi-hero__thumb-img {
    flex: 0 0 100px;
    width: 100%;
    align-self: auto;
  }
  .lsi-hero__thumb-text {
    padding: 0.6rem 0.75rem;
  }
}

@media (max-width: 768px) {
  .lsi-hero-carousel--full .lsi-hero__stage {
    height: 100svh;
    min-height: 480px;
  }
  .lsi-hero__content {
    padding-bottom: 3rem;
  }
  .lsi-hero__title {
    font-size: clamp(1.5rem, 5vw, 2rem);
    max-width: 100%;
  }

  .lsi-hero-carousel--full .lsi-hero__nav--prev {
    right: 4rem;
  }
  .lsi-hero-carousel--full .lsi-hero__nav--next {
    right: 1rem;
  }
}

@media (max-width: 640px) {
  .lsi-hero-carousel--full .lsi-hero__stage,
  .lsi-hero__stage {
    height: 100svh;
    min-height: 420px;
  }
  .lsi-hero__content {
    padding-bottom: 2.5rem;
  }
  .lsi-hero__title {
    font-size: 1.5rem;
  }
  .lsi-hero__nav {
    bottom: 1.25rem;
    width: 34px;
    height: 34px;
  }
  .lsi-hero__thumb {
    flex: 0 0 155px;
  }
  .lsi-hero__thumb-img {
    flex: 0 0 80px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lsi-hero__slide {
    transition:
      opacity 0.3s ease,
      visibility 0.3s;
  }
}

/* Fix Elementor inner sections */
.elementor-inner-section .elementor-container {
  max-width: 100%;
}

/* Elementor Pro popup fix */
.elementor-popup-modal .lsi-newsletter {
  border: none;
  background: transparent;
}

/* Elementor theme builder header conflict prevention */
.elementor-location-header .lsi-header {
  position: relative;
  top: auto;
}

/* Make sure Elementor columns respect our border radius */
.elementor-column .lsi-card {
  height: 100%;
}

/* Admin: hide widgets in editor when Elementor not active */
.no-elementor .lsi-elementor-only {
  display: none;
}
