/* Keen Edge WordPress integration fixes and requested enhancements. */

/* --------------------------------------------------------------------------
   Header / WordPress menu reset
   -------------------------------------------------------------------------- */
.kec-site-header ul,
.kec-site-header ol,
.kec-site-header li,
.kec-desktop-nav-list,
.kec-desktop-nav-list > li,
.kec-mobile-menu nav,
.kec-mobile-menu nav > * {
  list-style: none !important;
  margin: 0;
  padding-left: 0;
}

.kec-site-header li::marker {
  content: "";
  font-size: 0;
}

.kec-site-header {
  color: #fff;
  background: rgba(23, 23, 23, 0.95);
}

.kec-site-header[data-transparent="1"]:not(.kec-header-solid) {
  background: transparent !important;
  border-color: transparent !important;
  backdrop-filter: none !important;
}

.kec-site-header.kec-header-solid {
  background: rgba(23, 23, 23, 0.95) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
}

.kec-site-header a {
  text-decoration: none;
}

.kec-desktop-nav-list {
  font-family: var(--font-display);
}

.kec-desktop-nav-link {
  font-family: var(--font-display);
  font-size: 0.97rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: rgba(255, 255, 255, 0.82) !important;
}

.kec-desktop-nav-link:hover,
.kec-desktop-nav-link:focus-visible {
  color: #fff !important;
}

/* --------------------------------------------------------------------------
   Project template routing/layout hardening
   -------------------------------------------------------------------------- */
body.single-kec_project main,
body.single-kec_project .kec-project-template,
body.single-kec_project .kec-project-hero,
body.single-kec_project article.kec-project-template {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

body.single-kec_project main {
  display: block !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  overflow: visible !important;
}

body.single-kec_project .kec-project-template > section {
  width: 100%;
  max-width: none;
}

/* Homepage about values: user-requested placement inside the right image. */
.kec-about-values {
  right: clamp(1.5rem, 4vw, 5rem);
  left: auto !important;
  transform: translateY(-50%) !important;
  z-index: 2;
}

/* --------------------------------------------------------------------------
   Lucide service icons
   -------------------------------------------------------------------------- */
.kec-service-icon-wrap {
  display: block;
  width: 2.5rem;
  height: 2.5rem;
  line-height: 0;
  overflow: visible;
  flex: 0 0 2.5rem;
}

.kec-service-icon-wrap svg,
.kec-service-icon {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  overflow: visible !important;
  flex: 0 0 auto;
  stroke: currentColor;
  fill: none;
}

.kec-service-icon path,
.kec-service-icon rect,
.kec-service-icon circle,
.kec-service-icon polyline,
.kec-service-icon polygon,
.kec-service-icon line {
  vector-effect: non-scaling-stroke;
}

/* Services archive: background belongs only in the 1px grid gaps, not the
   responsive container padding. */
.kec-services-archive,
.kec-services-archive .container-edge {
  background: var(--color-background);
}

.kec-service-grid {
  width: 100%;
  background: var(--color-border);
}

/* Animated statistics. */
.kec-counter {
  font-variant-numeric: tabular-nums;
  min-width: 4ch;
}

/* --------------------------------------------------------------------------
   Featured projects: Lovable grid on tablet/desktop, carousel on mobile only
   -------------------------------------------------------------------------- */
.kec-project-carousel {
  position: relative;
  width: 100%;
  min-width: 0;
}

/* Desktop/tablet is a normal grid. It must never be horizontally scrollable. */
.kec-project-carousel-track {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  width: 100%;
  min-width: 0;
  overflow: visible;
  scroll-snap-type: none;
  padding: 0;
}

.kec-project-slide {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.kec-project-slide > a,
.kec-project-slide > a > div {
  height: 100%;
}

/* Controls exist in the DOM for mobile but are forcibly hidden above 767px.
   This avoids relying on Tailwind utility classes that may not exist in the
   compiled Lovable stylesheet. */
.kec-project-carousel-controls {
  display: none;
}

.kec-project-carousel-buttons {
  display: flex;
  gap: 0.5rem;
}

.kec-carousel-button {
  width: 2.75rem;
  height: 2.75rem;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--color-border);
  background: var(--color-background);
  color: var(--color-foreground);
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
  cursor: pointer;
}

.kec-carousel-button:hover,
.kec-carousel-button:focus-visible {
  background: var(--color-charcoal);
  color: #fff;
  border-color: var(--color-charcoal);
}

.kec-carousel-button:active {
  transform: translateY(1px);
}

.kec-carousel-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 1rem;
}

.kec-carousel-dot {
  width: 0.45rem;
  height: 0.45rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--color-border);
  transition: width 180ms ease, background-color 180ms ease;
  cursor: pointer;
}

.kec-carousel-dot[aria-current="true"] {
  width: 1.4rem;
  background: var(--color-primary);
}

.kec-project-carousel-cta {
  margin-top: 3.5rem;
}

@media (min-width: 768px) and (max-width: 1023px) {
  .kec-project-carousel-track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .kec-featured-projects-section {
    overflow: hidden;
  }

  .kec-featured-projects-intro {
    margin-bottom: 2.5rem !important;
  }

  .kec-project-carousel-track {
    display: flex;
    grid-template-columns: none;
    gap: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding: 0 0 0.25rem;
    touch-action: pan-x pan-y;
  }

  .kec-project-carousel-track::-webkit-scrollbar {
    display: none;
  }

  .kec-project-slide {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .kec-featured-project-card-media {
    aspect-ratio: 4 / 5;
    min-height: 0;
  }

  .kec-featured-project-card-content {
    padding: 1.5rem;
  }

  .kec-featured-project-card .heading-md {
    font-size: clamp(1.85rem, 8.5vw, 2.4rem);
    line-height: 1.04;
  }

  .kec-project-carousel-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
  }

  .kec-project-carousel-cta {
    margin-top: 2.5rem;
  }
}

/* --------------------------------------------------------------------------
   Trusted-by logo marquee
   -------------------------------------------------------------------------- */
.kec-client-marquee-track {
  display: flex;
  align-items: center;
  gap: 4rem;
  width: max-content;
  white-space: nowrap;
}

.kec-client-logo-item {
  flex: 0 0 auto;
  min-width: 11rem;
  min-height: 4.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-inline: 1rem;
}

.kec-client-logo {
  width: auto;
  max-width: 13rem;
  height: 4.5rem;
  object-fit: contain;
  filter: grayscale(1);
  opacity: 0.66;
  transition: filter 180ms ease, opacity 180ms ease;
}

.kec-client-logo-item:hover .kec-client-logo {
  filter: grayscale(0);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Project gallery + custom lightbox
   -------------------------------------------------------------------------- */
.kec-project-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.kec-gallery-item {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--color-muted);
  overflow: hidden;
  cursor: zoom-in;
  aspect-ratio: 4 / 3;
}

.kec-gallery-item:first-child:nth-last-child(n + 3) {
  grid-column: span 2;
  aspect-ratio: 16 / 8.5;
}

.kec-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms ease;
}

.kec-gallery-item:hover img,
.kec-gallery-item:focus-visible img {
  transform: scale(1.035);
}

.kec-gallery-item::after {
  content: "+";
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  background: rgba(20, 20, 20, 0.9);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.3rem;
  transition: background-color 180ms ease, color 180ms ease;
}

.kec-gallery-item:hover::after,
.kec-gallery-item:focus-visible::after {
  background: var(--color-primary);
}

.kec-lightbox[hidden] {
  display: none !important;
}

.kec-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: rgba(10, 10, 10, 0.97);
  color: #fff;
}

.kec-lightbox-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
}

.kec-lightbox-count {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.kec-lightbox-close,
.kec-lightbox-nav {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.kec-lightbox-close:hover,
.kec-lightbox-close:focus-visible,
.kec-lightbox-nav:hover,
.kec-lightbox-nav:focus-visible {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.kec-lightbox-stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0.5rem 4.5rem 1rem;
}

.kec-lightbox-image {
  display: block;
  max-width: min(92vw, 92rem);
  max-height: calc(100vh - 10rem);
  width: auto;
  height: auto;
  object-fit: contain;
}

.kec-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.kec-lightbox-prev { left: 1rem; }
.kec-lightbox-next { right: 1rem; }

.kec-lightbox-caption {
  min-height: 3.5rem;
  padding: 0 1.25rem 1.25rem;
  text-align: center;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.72);
}

body.kec-lightbox-open {
  overflow: hidden;
}

@media (min-width: 768px) {
  .kec-project-gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }

  .kec-gallery-item:first-child:nth-last-child(n + 4) {
    grid-column: span 2;
    grid-row: span 2;
    aspect-ratio: auto;
    min-height: 32rem;
  }
}

@media (max-width: 767px) {
  .kec-client-marquee-track {
    gap: 2rem;
  }

  .kec-client-logo-item {
    min-width: 9rem;
  }

  .kec-client-logo {
    max-width: 10rem;
    height: 3.5rem;
  }

  .kec-lightbox-stage {
    padding-inline: 0.75rem;
  }

  .kec-lightbox-nav {
    top: auto;
    bottom: 0.75rem;
    transform: none;
  }

  .kec-lightbox-prev { left: 0.75rem; }
  .kec-lightbox-next { right: 0.75rem; }

  .kec-lightbox-image {
    max-height: calc(100vh - 11rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .kec-project-carousel-track {
    scroll-behavior: auto;
  }

  .kec-client-marquee-track {
    animation: none !important;
  }

  .kec-gallery-item img {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Project single: force the Lovable full-bleed layout and defeat generic
   WordPress/plugin reading-width constraints without affecting inner containers.
   -------------------------------------------------------------------------- */
.kec-site-shell,
.kec-site-main {
  width: 100%;
  max-width: none;
  min-width: 0;
}

body.single-kec_project {
  overflow-x: clip;
}

body.single-kec_project .kec-site-main,
body.single-kec_project .kec-site-main--project {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

body.single-kec_project article.kec-project-template {
  position: relative;
  width: 100vw !important;
  max-width: 100vw !important;
  margin-left: calc(50% - 50vw) !important;
  margin-right: calc(50% - 50vw) !important;
  border: 0 !important;
  box-shadow: none !important;
  background: var(--color-background);
}

body.single-kec_project article.kec-project-template > section {
  width: 100% !important;
  max-width: none !important;
}
