/*
 * New Life Builders UI Kit
 *
 * Presentation only: existing page grids, dimensions, spacing, content, and
 * section order remain authoritative. Components opt into these primitives
 * with ui-card, ui-button, ui-section, and ui-hero classes.
 */

:root {
  --ui-motion-fast: 180ms;
  --ui-motion-medium: 360ms;
  --ui-motion-slow: 520ms;
  --ui-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ui-ease-soft: cubic-bezier(0.2, 0.7, 0.2, 1);

  --ui-card-radius: var(--radius, 18px);
  --ui-card-lift: -7px;
  --ui-card-scale: 1.004;
  --ui-card-surface: var(--surface, #ffffff);
  --ui-card-border: rgba(23, 58, 99, 0.14);
  --ui-card-border-hover: rgba(47, 110, 163, 0.34);
  --ui-card-shadow-rest:
    0 2px 7px rgba(25, 40, 55, 0.025),
    0 10px 26px rgba(25, 40, 55, 0.045);
  --ui-card-shadow-hover:
    0 8px 18px rgba(25, 40, 55, 0.055),
    0 24px 48px rgba(25, 40, 55, 0.11);
}

.ui-section,
.ui-hero {
  position: relative;
}

/*
 * Authoritative shared card primitive.
 * Specific page classes continue to own size, grid placement, and padding.
 */
[class].ui-card {
  position: relative;
  isolation: isolate;
  border: 1px solid var(--ui-card-border);
  border-radius: var(--ui-card-radius);
  box-shadow: var(--ui-card-shadow-rest);
  transform: translate3d(0, 0, 0) scale(1);
  transform-origin: 50% 60%;
  backface-visibility: hidden;
  will-change: transform, box-shadow;
  transition:
    transform var(--ui-motion-medium) var(--ui-ease-out),
    box-shadow var(--ui-motion-slow) var(--ui-ease-soft),
    border-color var(--ui-motion-medium) ease,
    background-color var(--ui-motion-medium) ease,
    color var(--ui-motion-fast) ease,
    filter var(--ui-motion-medium) ease !important;
}

/* A full-surface glow replaces the old line/sweep hover treatments. */
[class].ui-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0;
  background:
    radial-gradient(
      120% 90% at 50% 0%,
      rgba(126, 183, 225, 0.085) 0%,
      rgba(126, 183, 225, 0.025) 42%,
      transparent 76%
    );
  transition: opacity var(--ui-motion-medium) ease;
}

/* Remove legacy animated lines from every component using the kit. */
[class].ui-card::before {
  content: none !important;
  animation: none !important;
}

[class].ui-card > * {
  position: relative;
  z-index: 1;
  transition:
    transform var(--ui-motion-medium) var(--ui-ease-out),
    color 300ms ease,
    border-color 320ms ease,
    background-color 320ms ease,
    box-shadow var(--ui-motion-medium) ease,
    opacity 280ms ease,
    filter 320ms ease;
}

[class].ui-card :is(
  .trust-card-icon,
  .service-card-icon,
  .process-card-icon,
  .idea-path-icon,
  .service-path-icon,
  .value-icon
),
[class].ui-card :is(
  .trust-card-icon,
  .service-card-icon,
  .process-card-icon,
  .idea-path-icon,
  .service-path-icon,
  .value-icon
) i {
  transition:
    transform var(--ui-motion-medium) var(--ui-ease-out),
    color 300ms ease,
    border-color 320ms ease,
    background-color 320ms ease,
    box-shadow var(--ui-motion-medium) ease;
}

[class].ui-card--media img {
  transform: scale(1);
  transition:
    transform var(--ui-motion-slow) var(--ui-ease-out),
    filter var(--ui-motion-medium) ease,
    opacity 300ms ease;
}

/* Feature cards retain their authored backgrounds but use the same motion. */
[class].ui-card--feature {
  --ui-card-lift: -5px;
  --ui-card-scale: 1.002;
}

/* Link cards communicate clickability without a separate animation language. */
[class].ui-card--link {
  cursor: pointer;
}

/* Buttons use the same easing and physical response as cards. */
[class].ui-button {
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  transition:
    transform 300ms var(--ui-ease-out),
    box-shadow 340ms ease,
    border-color 280ms ease,
    background-color 280ms ease,
    color 240ms ease,
    filter 280ms ease;
}

/* Hero motion belongs only to the image element, never the copy column. */
.ui-hero .hero-image,
.ui-hero .hero-image-img {
  transition:
    transform var(--ui-motion-slow) var(--ui-ease-out),
    box-shadow var(--ui-motion-slow) var(--ui-ease-soft),
    filter var(--ui-motion-medium) ease;
}


/*
 * Neutralize the legacy grid-hover behavior. Hovering hero copy must leave the
 * image completely still; only a pointer directly over the image can animate it.
 */
.ui-hero .hero-grid:hover .hero-image-img {
  transform: scale(1);
}

.ui-hero .hero-grid:hover .hero-image {
  box-shadow: var(--shadow);
}

@media (hover: hover) and (pointer: fine) {
  [class].ui-card:hover {
    transform:
      translate3d(0, var(--ui-card-lift), 0)
      scale(var(--ui-card-scale)) !important;
    border-color: var(--ui-card-border-hover) !important;
    box-shadow: var(--ui-card-shadow-hover) !important;
  }

  [class].ui-card:hover::after {
    opacity: 1;
  }

  [class].ui-card:hover > * {
    transform: translateY(-1px);
  }

  [class].ui-card:hover :is(h2, h3) {
    color: var(--brand);
  }

  [class].ui-card:hover :is(
    .trust-card-icon,
    .service-card-icon,
    .process-card-icon,
    .idea-path-icon,
    .service-path-icon,
    .value-icon
  ) {
    transform: translateY(-2px);
  }

  [class].ui-card:hover :is(
    .trust-card-icon,
    .service-card-icon,
    .process-card-icon,
    .idea-path-icon,
    .service-path-icon,
    .value-icon
  ) i {
    transform: translateY(-1px);
  }

  [class].ui-card--media:hover img {
    transform: scale(1.026) !important;
    filter: saturate(1.035) contrast(1.012);
  }

  /* Legacy cards used several competing image zoom values. */
  [class].ui-card--media:hover :is(
    .plan-doc-preview,
    .plan-showcase-media,
    .portfolio-project-media,
    .project-card-media
  ) img {
    transform: scale(1.026) !important;
  }

  [class].ui-card:hover .step {
    letter-spacing: inherit;
  }

  [class].ui-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.015);
  }

  .ui-hero .hero-image:hover {
    box-shadow: var(--shadow-hover);
  }

  .ui-hero .hero-image:hover .hero-image-img {
    transform: scale(1.018);
    filter: saturate(1.03) contrast(1.01);
  }
}

/* Process timeline: card, marker, and connector respond as one component. */
.page-process .timeline-item {
  transition: transform var(--ui-motion-medium) var(--ui-ease-out);
}

.page-process .timeline-marker {
  transition:
    transform var(--ui-motion-medium) var(--ui-ease-out),
    box-shadow var(--ui-motion-slow) ease,
    color 300ms ease,
    background-color 320ms ease,
    border-color 320ms ease,
    filter 320ms ease;
}

.page-process .timeline-item:not(:last-child)::before {
  transition:
    width 320ms ease,
    background-color var(--ui-motion-medium) ease,
    box-shadow var(--ui-motion-medium) ease;
}

@media (hover: hover) and (pointer: fine) {
  .page-process .timeline-item:hover {
    transform: translateX(3px);
  }

  .page-process .timeline-item:hover [class].ui-card--timeline {
    transform: translate3d(6px, -5px, 0) scale(1.003);
    border-color: var(--ui-card-border-hover);
    box-shadow: var(--ui-card-shadow-hover);
  }

  .page-process .timeline-item:hover .timeline-marker {
    transform: translateY(-2px) scale(1.075);
    filter: saturate(1.05) brightness(1.025);
    box-shadow:
      0 6px 16px rgba(37, 99, 235, 0.18),
      0 14px 30px rgba(37, 99, 235, 0.12);
  }

  .page-process .timeline-item:hover:not(:last-child)::before {
    width: 2px;
    background-color: rgba(47, 110, 163, 0.5);
    box-shadow: 0 0 12px rgba(47, 110, 163, 0.14);
  }
}




/*
 * Design gallery rail: cards remain fully visible and their lifted shadows have
 * protected space inside the horizontal scroller.
 */
.page-design-drafting .plan-showcase-grid {
  grid-auto-columns: clamp(290px, 30vw, 400px);
  padding: 32px 40px 64px;
  scroll-padding-inline: 40px;
}

@media (max-width: 760px) {
  .page-design-drafting .plan-showcase-grid {
    grid-auto-columns: minmax(270px, 82vw);
    padding: 24px 18px 54px;
    scroll-padding-inline: 18px;
  }
}

/* Services page kit: one independent card system across every section. */
.page-services .ui-card--service {
  --ui-card-lift: -6px;
  --ui-card-scale: 1.003;
}

.page-services .service-path-grid {
  gap: clamp(14px, 2vw, 20px);
  border-top: 0;
  border-bottom: 0;
}

.page-services .service-path-card.ui-card--service,
.page-services .service-path-card.ui-card--service:first-child,
.page-services .service-path-card.ui-card--service:last-child {
  padding: clamp(24px, 3vw, 36px);
  border: 1px solid var(--ui-card-border);
}

.page-services :is(
  .services-detail-grid,
  .process-grid,
  .why-grid
) {
  gap: clamp(16px, 2vw, 24px);
}

.page-services .service-scope-card.ui-card--service::before {
  content: none !important;
}

/* Services: preserve contrast on the dark interactive path card. */
.page-services .service-path-card.ui-card:hover,
.page-services .service-path-card.ui-card:hover h3,
.page-services .service-path-card.ui-card:hover .service-path-arrow {
  color: #ffffff;
}

.page-services .service-path-card.ui-card:hover p,
.page-services .service-path-card.ui-card:hover .service-path-number {
  color: rgba(255, 255, 255, 0.78);
}

/* Four benefits should form a balanced 2-by-2 composition on desktop. */
.page-services .why-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 760px) {
  .page-services .why-grid {
    grid-template-columns: 1fr;
  }
}

/* ================================================================
   Cross-page content-card and grid contract
   The UI kit now owns the dimensions shared by editorial cards.
   Media, navigation, hero and service-scope cards keep their
   purpose-built variants.
   ================================================================ */

[class].ui-card--content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  height: 100%;
  padding: clamp(24px, 2.6vw, 32px);
  background: var(--surface, #ffffff);
}

[class].ui-card--content > :last-child { margin-bottom: 0; }
[class].ui-card--content :is(h2, h3) { width: 100%; }

:is(.trust-grid, .services-grid, .process-grid, .testimonials-grid, .values-grid, .why-grid, .services-detail-grid, .idea-path-grid, .faq-list) {
  align-items: stretch;
}

:is(.trust-grid, .services-grid, .process-grid, .testimonials-grid, .values-grid, .why-grid, .services-detail-grid, .idea-path-grid, .faq-list) > .ui-card {
  height: 100%;
}

@media (min-width: 1001px) {
  .page-home .trust-grid,
  .page-home .services-grid,
  .page-home .testimonials-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .page-home .process-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.page-about .about-story-card {
  width: min(100%, 880px);
  margin-inline: auto;
}

.page-about .values-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.page-about .trust-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.page-services .process-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.page-services .services-detail-grid,
.page-services .why-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.page-design-drafting .process-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.page-design-drafting .idea-path-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.page-process .process-grid,
.page-process .why-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.page-process .services-detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.page-process .faq-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 24px);
  margin-top: clamp(28px, 4vw, 44px);
}
.page-process .faq-item h3 { margin: 0; }
.page-process .faq-item p { margin-top: 10px; color: var(--muted); }

.page-portfolio .services-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.page-contact .contact-side-stack { grid-auto-rows: 1fr; }

@media (min-width: 761px) and (max-width: 1000px) {
  .page-home .services-grid,
  .page-home .process-grid,
  .page-home .testimonials-grid,
  .page-about .values-grid,
  .page-services .process-grid,
  .page-services .services-detail-grid,
  .page-design-drafting .process-grid,
  .page-design-drafting .idea-path-grid,
  .page-process .process-grid,
  .page-process .why-grid,
  .page-process .services-detail-grid,
  .page-process .faq-list,
  .page-portfolio .services-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  :is(
    .page-home .trust-grid,
    .page-home .services-grid,
    .page-home .process-grid,
    .page-home .testimonials-grid,
    .page-about .values-grid,
    .page-about .trust-grid,
    .page-services .process-grid,
    .page-services .services-detail-grid,
    .page-services .why-grid,
    .page-design-drafting .process-grid,
    .page-design-drafting .idea-path-grid,
    .page-process .process-grid,
    .page-process .why-grid,
    .page-process .services-detail-grid,
    .page-process .faq-list,
    .page-portfolio .services-detail-grid
  ) {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  [class].ui-card,
  [class].ui-card::after,
  [class].ui-card *,
  [class].ui-button,
  .ui-hero .hero-image,
  .ui-hero .hero-image-img,
  .page-process .timeline-item,
  .page-process .timeline-marker,
  .page-process .timeline-item::before {
    transition: none;
  }

  [class].ui-card:hover,
  [class].ui-card:hover > *,
  [class].ui-button:hover,
  .ui-hero .hero-image:hover,
  .ui-hero .hero-image:hover .hero-image-img,
  .page-process .timeline-item:hover,
  .page-process .timeline-item:hover [class].ui-card--timeline,
  .page-process .timeline-item:hover .timeline-marker {
    transform: none;
  }
}


/* Design gallery: renderings are the work. Avoid a second framed panel around each image. */
.page-design-drafting .plan-showcase-card.ui-card--design {
  overflow: hidden;
  background: var(--surface, #ffffff);
}

.page-design-drafting .plan-showcase-media {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
}

.page-design-drafting .plan-showcase-media img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

/* Gallery examples should read as work samples, not bordered dashboard widgets. */
.page-design-drafting .plan-showcase-card.ui-card--design {
  border: 0;
  box-shadow: none;
}

/* Keep every design card visually distinct at rest without restoring an outline. */
.page-design-drafting .plan-showcase-card.ui-card--design {
  background: #ffffff;
  box-shadow:
    0 10px 28px rgba(25, 40, 55, 0.08),
    0 2px 8px rgba(25, 40, 55, 0.04);
}


/* Design gallery carousel controls */
.page-design-drafting .design-gallery-carousel {
  position: relative;
}

.page-design-drafting .design-gallery-arrow {
  position: absolute;
  top: 48%;
  z-index: 8;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(23, 58, 99, 0.94);
  box-shadow: 0 12px 28px rgba(23, 58, 99, 0.24);
  cursor: pointer;
  transform: translateY(-50%);
  transition:
    transform 220ms var(--ui-ease-out),
    background-color 220ms ease,
    box-shadow 220ms ease;
}

.page-design-drafting .design-gallery-arrow--prev {
  left: 10px;
}

.page-design-drafting .design-gallery-arrow--next {
  right: 10px;
}

.page-design-drafting .design-gallery-arrow span {
  font-size: 1.45rem;
  line-height: 1;
  transform: translateY(-1px);
}

.page-design-drafting .design-gallery-arrow:hover,
.page-design-drafting .design-gallery-arrow:focus-visible {
  background: var(--brand, #2f6ea3);
  box-shadow: 0 16px 34px rgba(23, 58, 99, 0.3);
  transform: translateY(-50%) scale(1.06);
}

.page-design-drafting .design-gallery-arrow:focus-visible {
  outline: 3px solid rgba(47, 110, 163, 0.3);
  outline-offset: 3px;
}

.page-design-drafting [data-design-gallery-track] {
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
}

.page-design-drafting [data-design-gallery-track] .plan-showcase-card {
  scroll-snap-align: start;
}

@media (max-width: 760px) {
  .page-design-drafting .design-gallery-arrow {
    top: 46%;
    width: 44px;
    height: 44px;
  }

  .page-design-drafting .design-gallery-arrow--prev {
    left: 4px;
  }

  .page-design-drafting .design-gallery-arrow--next {
    right: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-design-drafting .design-gallery-arrow {
    transition: none;
  }

  .page-design-drafting [data-design-gallery-track] {
    scroll-behavior: auto;
  }
}
