/* Layout & mobile fixes — max page width, work grid, industry cards, heroes */

html[data-theme="dark"] {
  --ds-page-max: 1200px;
  --ds-page-gutter: clamp(1rem, 3vw, 1.5rem);
  --ds-hero-max-height: 860px;
  --ds-hero-media-max: 420px;
}

@media (min-width: 1600px) {
  html[data-theme="dark"] {
    --ds-hero-max-height: 820px;
    --ds-hero-media-max: 400px;
  }
}

/* —— Home landing hero (index) —— */
body.site-themed .home-landing-hero.home-banner {
  height: auto !important;
  min-height: min(78vh, var(--ds-hero-max-height)) !important;
  max-height: var(--ds-hero-max-height) !important;
  padding-top: 5.25rem !important;
  padding-bottom: 3.75rem !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

/* Full-bleed background video — fills hero, blended with content */
body.site-themed .home-landing-hero .video-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  max-height: none !important;
  overflow: hidden;
}

body.site-themed .home-landing-hero .video-bg .video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none !important;
  min-height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: brightness(0.42) saturate(1.2) contrast(1.05);
  pointer-events: none;
}

body.site-themed .home-landing-hero .video-bg .video-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(
      118deg,
      rgba(6, 8, 15, 0.78) 0%,
      rgba(6, 8, 15, 0.45) 38%,
      rgba(12, 18, 34, 0.62) 68%,
      rgba(6, 8, 15, 0.8) 100%
    ),
    radial-gradient(ellipse 70% 55% at 75% 35%, rgba(10, 165, 255, 0.14), transparent 52%),
    radial-gradient(ellipse 55% 45% at 15% 70%, rgba(99, 102, 241, 0.1), transparent 48%);
}

body.site-themed .home-landing-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: min(62vh, calc(var(--ds-hero-max-height) - 7rem));
  max-height: calc(var(--ds-hero-max-height) - 5rem);
  padding-top: 2.25rem;
  padding-bottom: 2.75rem;
}

body.site-themed .home-landing-copy {
  padding-top: 1rem;
  padding-bottom: 1.25rem;
}

body.site-themed .home-landing-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 7rem;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(6, 8, 15, 0.85) 55%, var(--ds-bg, #06080f) 100%);
}

body.site-themed .home-landing-hero .learn-more-arrow {
  z-index: 3;
}

@media (min-width: 992px) {
  body.site-themed .home-landing-hero.home-banner {
    padding-top: 6rem !important;
    padding-bottom: 4.5rem !important;
  }

  body.site-themed .home-landing-inner {
    padding-top: 2.75rem;
    padding-bottom: 3.25rem;
  }

  body.site-themed .home-landing-copy {
    padding-top: 1.25rem;
    padding-bottom: 1.5rem;
    padding-right: 1.5rem;
  }
}

body.site-themed .home-landing-hero .hero-dashboard-frame {
  max-width: min(100%, 540px);
  max-height: var(--ds-hero-media-max);
  margin-left: auto;
  margin-right: auto;
}

body.site-themed .home-landing-hero .hero-dashboard-frame__inner,
body.site-themed .home-landing-hero .hero-dashboard-frame img {
  max-height: calc(var(--ds-hero-media-max) - 8px);
  object-fit: cover;
  object-position: center top;
}

@media (max-width: 991px) {
  body.site-themed .home-landing-hero.home-banner {
    min-height: auto !important;
    max-height: none !important;
    padding-top: 5rem !important;
    padding-bottom: 3rem !important;
  }

  body.site-themed .home-landing-inner {
    min-height: auto;
    max-height: none;
    padding-top: 1.5rem;
    padding-bottom: 2rem;
  }

  body.site-themed .home-landing-hero .hero-dashboard-frame {
    margin-top: 1.5rem;
    max-height: min(320px, 50vw);
  }
}

/* Global media caps on very large screens */
@media (min-width: 1400px) {
  body.site-themed .hero-side-visual {
    max-height: var(--ds-hero-media-max);
  }

  body.site-themed .ind-card-media {
    max-height: 11.5rem;
  }

  body.site-themed .ind-card-media img {
    max-height: 11.5rem;
  }

  body.site-themed .work-item-media {
    max-height: 16rem;
  }

  body.site-themed .work-item-img {
    max-height: 16rem;
  }
}

/* Cap content width on very large viewports (avoid stretched layouts) */
body.site-themed .container.s-container,
body.site-themed .works-container.container,
body.site-themed main.pt100 > .container.s-container,
body.site-themed main.pt100.pb60 > .container.s-container,
body.site-themed .cs-detail-hero.container {
  width: 100%;
  max-width: var(--ds-page-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--ds-page-gutter);
  padding-right: var(--ds-page-gutter);
}

@media (min-width: 992px) {
  body.site-themed .container:not(.container-fluid) {
    max-width: min(100%, var(--ds-page-max));
  }
}

@media (min-width: 1400px) {
  body.site-themed .s-navbar {
    padding-left: max(var(--ds-page-gutter), calc((100vw - var(--ds-page-max)) / 2));
    padding-right: max(var(--ds-page-gutter), calc((100vw - var(--ds-page-max)) / 2));
  }

  body.site-themed .home-banner .container.s-container,
  body.site-themed .section-spacing .container,
  body.site-themed .section-spacing .container.s-container {
    max-width: var(--ds-page-max);
  }
}

/* —— Work / case studies page —— */
body.site-themed .work-page-hero.home-banner {
  height: auto !important;
  min-height: 0 !important;
  padding-top: 6.5rem !important;
  padding-bottom: 2.75rem !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-bottom: 0;
  overflow: visible;
}

html[data-theme="dark"] body.site-themed .work-page-hero.home-banner:not(:has(.video-bg)) {
  min-height: auto !important;
}

html[data-theme="dark"] body.site-themed .work-page-hero.home-banner:not(:has(.video-bg))::before {
  display: none !important;
}

body.site-themed .work-page-hero .hero-visual-wrap {
  transform: none !important;
  position: relative;
  z-index: 1;
}

body.site-themed .work-page-hero .header-headings {
  position: relative;
  z-index: 2;
}

body.site-themed #our-work,
body.site-themed .work-page-list {
  position: relative;
  z-index: 3;
  padding-top: 2.5rem !important;
  padding-bottom: 4rem !important;
  margin-top: 0 !important;
  scroll-margin-top: 5.5rem;
  overflow: visible;
}

body.site-themed #our-work .row.work-page-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
}

body.site-themed #our-work .work-item-col {
  display: flex;
  flex-direction: column;
  margin-bottom: 2rem;
  float: none;
}

body.site-themed #our-work .work-item {
  /* Override legacy main.min negative / huge margins */
  display: flex !important;
  flex-direction: column !important;
  position: relative !important;
  width: 100%;
  flex: 1 1 auto;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

body.site-themed #our-work .work-item:nth-child(2n),
body.site-themed #our-work .work-item-col:nth-child(2n) .work-item {
  margin-top: 0 !important;
}

@media (max-width: 991px) {
  body.site-themed #our-work .work-item:nth-child(2n),
  body.site-themed #our-work .work-item-col:nth-child(2n) .work-item {
    margin-top: 0 !important;
  }
}

body.site-themed #our-work .work-item.reveal {
  transform: none;
  opacity: 1;
}

body.site-themed #our-work .work-item.reveal.is-visible {
  transform: none;
  opacity: 1;
}

body.site-themed #our-work .work-item a {
  display: block;
  flex: 1 1 auto;
}

body.site-themed #our-work .work-item-media {
  aspect-ratio: 16 / 10;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

body.site-themed #our-work .work-item-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  min-height: 180px;
}

body.site-themed #our-work .work-item-img.is-placeholder {
  object-fit: contain;
  padding: 2rem;
  opacity: 0.9;
  background: linear-gradient(145deg, rgba(12, 18, 34, 0.95), rgba(15, 23, 42, 0.85));
}

body.site-themed #our-work .work-item h3 {
  padding-right: 0.25rem;
  font-size: 1.25rem;
  line-height: 1.35;
  margin-top: 1rem;
  margin-bottom: 0.35rem;
  position: static;
}

body.site-themed #our-work .work-item h3::after {
  display: none !important;
  content: none !important;
}

body.site-themed .work-page-hero .header-headings > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-top: 1.5rem;
}

body.site-themed .work-page-hero .hero-visual-wrap {
  margin-top: 1.25rem;
  max-width: 100%;
}

@media (min-width: 768px) {
  body.site-themed .work-page-hero .hero-visual-wrap {
    margin-top: 0.5rem;
  }
}

@media (max-width: 767px) {
  body.site-themed .work-page-hero.home-banner:not(:has(.video-bg))::before {
    display: none;
  }

  body.site-themed .work-page-hero .hero-side-visual {
    max-height: 240px;
    animation: none;
  }

  body.site-themed .work-page-hero.home-banner {
    padding-top: 5.5rem !important;
  }
}

/* —— Homepage & industries: industry cards —— */
#industries .ind-card.reveal {
  opacity: 1;
  transform: none;
}

#industries .ind-card.reveal.is-visible {
  opacity: 1;
  transform: none;
}

html[data-theme="dark"] #industries .ind-card:has(.ind-card-media)::before,
html[data-theme="dark"] .ind-card.ind-card--media::before {
  display: none !important;
}

html[data-theme="dark"] #industries .ind-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

html[data-theme="dark"] #industries .ind-card-media {
  flex: 0 0 auto;
  aspect-ratio: 16 / 10;
  max-height: none;
}

html[data-theme="dark"] #industries .ind-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

html[data-theme="dark"] #industries .ind-card-body {
  flex: 1 1 auto;
}

html[data-theme="dark"] article.ind-card .ind-card-icon--overlay {
  top: 0.5rem;
  right: 0.5rem;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0.95rem;
}

html[data-theme="dark"] a.ind-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0.75rem 1rem 1.15rem !important;
  overflow: hidden;
}

html[data-theme="dark"] a.ind-card .ind-card-chrome {
  margin: -0.75rem -1rem 0.85rem;
  border-radius: 12px 12px 0 0;
  flex-shrink: 0;
}

html[data-theme="dark"] a.ind-card h5,
html[data-theme="dark"] a.ind-card p {
  padding-left: 0.15rem;
  padding-right: 0.15rem;
}

/* —— Inner page hero visual (JS-injected) —— */
@media (max-width: 991px) {
  main.pt100.page-hero-layout .page-hero__visual {
    display: none !important;
  }

  main.pt100.page-hero-layout .section-header,
  main.pt100.page-hero-layout > .container > .row.section-header {
    max-width: 100%;
  }
}

/* —— Hero CTAs & actions (global) —— */
@media (max-width: 767px) {
  body.site-themed .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  body.site-themed .hero-actions .cta-link {
    margin-left: 0.75rem;
    margin-right: 0.75rem;
    text-align: center;
    justify-content: center;
  }

  body.site-themed .home-banner:not(:has(.video-bg))::before {
    opacity: 0.12;
    width: 100%;
    height: 35%;
    right: 0;
    bottom: 0;
    top: auto;
    transform: none;
  }

  body.site-themed .hero-visual-wrap,
  body.site-themed .hero-dashboard-frame {
    transform: none !important;
  }

  body.site-themed .hero-side-visual {
    max-height: 260px;
    animation: none;
  }

  body.site-themed .section-header .header-headings h2::after,
  body.site-themed .section-header .header-headings .h1::after {
    margin-left: auto;
    margin-right: auto;
  }

  body.site-themed .section-header.text-center .header-headings h2::after,
  body.site-themed .section-header .col-12.text-center .header-headings h2::after {
    margin-left: auto;
    margin-right: auto;
  }
}

/* —— Navbar / collapse —— */
@media (max-width: 767px) {
  body.site-themed .s-navbar .navbar-collapse.collapse:not(.show) {
    display: none !important;
  }
}

/* —— Prevent horizontal scroll from decorative layers —— */
body.site-themed {
  overflow-x: clip;
}

/* —— Case study hero on small screens —— */
@media (max-width: 768px) {
  html[data-theme="dark"] .cs-detail-hero::before {
    display: none !important;
  }

  html[data-theme="dark"] .cs-hero-frame {
    margin-top: 1rem;
  }
}

/* Hero / dashboard frames — do not over-stretch on ultra-wide screens */
body.site-themed .hero-visual-wrap {
  max-width: min(100%, 540px);
}

@media (min-width: 768px) {
  body.site-themed .work-page-hero .col-md-5 .hero-visual-wrap {
    margin-left: auto;
  }
}

body.site-themed .banner-illustration,
body.site-themed .hero-side-visual {
  max-width: 100%;
}
