@tailwind base;
@tailwind components;
@tailwind utilities;

/* Definition of the design system. All colors, gradients, fonts, etc should be defined here. 
All colors MUST be HSL.
*/

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 208 100% 15%;

    --card: 0 0% 100%;
    --card-foreground: 208 100% 15%;

    --popover: 0 0% 100%;
    --popover-foreground: 208 100% 15%;

    --primary: 208 100% 29.4%;
    --primary-foreground: 210 40% 98%;

    --secondary: 22.3 89.6% 54.1%;
    --secondary-foreground: 210 40% 98%;

    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;

    --accent: 204.3 73% 75.9%;
    --accent-foreground: 208 100% 29.4%;

    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;

    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 208 100% 29.4%;

    --radius: 0.5rem;

    --sidebar-background: 0 0% 98%;

    --sidebar-foreground: 240 5.3% 26.1%;

    --sidebar-primary: 240 5.9% 10%;

    --sidebar-primary-foreground: 0 0% 98%;

    --sidebar-accent: 240 4.8% 95.9%;

    --sidebar-accent-foreground: 240 5.9% 10%;

    --sidebar-border: 220 13% 91%;

    --sidebar-ring: 217.2 91.2% 59.8%;
  }

  .dark {
    --background: 208 100% 12%;
    --foreground: 210 40% 98%;

    --card: 208 100% 15%;
    --card-foreground: 210 40% 98%;

    --popover: 208 100% 15%;
    --popover-foreground: 210 40% 98%;

    --primary: 208 100% 45%;
    --primary-foreground: 210 40% 98%;

    --secondary: 22.3 89.6% 54.1%;
    --secondary-foreground: 210 40% 98%;

    --muted: 208 50% 20%;
    --muted-foreground: 215 20.2% 65.1%;

    --accent: 204.3 73% 75.9%;
    --accent-foreground: 208 100% 15%;

    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;

    --border: 208 50% 25%;
    --input: 208 50% 25%;
    --ring: 208 100% 45%;
    --sidebar-background: 208 100% 10%;
    --sidebar-foreground: 240 4.8% 95.9%;
    --sidebar-primary: 208 100% 45%;
    --sidebar-primary-foreground: 0 0% 100%;
    --sidebar-accent: 208 50% 20%;
    --sidebar-accent-foreground: 240 4.8% 95.9%;
    --sidebar-border: 208 50% 25%;
    --sidebar-ring: 217.2 91.2% 59.8%;
  }
}

@layer base {
  * {
    @apply border-border;
  }

  body {
    @apply bg-background text-foreground antialiased;
  }
}

/* Mobile Spacing Optimizations to reduce negative space */
@media (max-width: 767px) {
  .py-32 {
    padding-top: 4rem !important;
    padding-bottom: 4rem !important;
  }
  .py-24 {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }
  .py-20 {
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
  }
  .py-16 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }

  .pt-32 {
    padding-top: 4rem !important;
  }
  .pt-28 {
    padding-top: 3.5rem !important;
  }
  .pt-24 {
    padding-top: 3rem !important;
  }

  .pb-32 {
    padding-bottom: 4rem !important;
  }
  .pb-24 {
    padding-bottom: 3rem !important;
  }
  .pb-20 {
    padding-bottom: 2.5rem !important;
  }
  .pb-16 {
    padding-bottom: 2rem !important;
  }

  .my-24 {
    margin-top: 3rem !important;
    margin-bottom: 3rem !important;
  }
  .my-20 {
    margin-top: 2.5rem !important;
    margin-bottom: 2.5rem !important;
  }
  .my-16 {
    margin-top: 2rem !important;
    margin-bottom: 2rem !important;
  }

  .mt-24 {
    margin-top: 3rem !important;
  }
  .mt-20 {
    margin-top: 2.5rem !important;
  }
  .mt-16 {
    margin-top: 2rem !important;
  }

  .mb-24 {
    margin-bottom: 3rem !important;
  }
  .mb-20 {
    margin-bottom: 2.5rem !important;
  }
  .mb-16 {
    margin-bottom: 2rem !important;
  }
  .mb-12 {
    margin-bottom: 1.5rem !important;
  }

  .gap-16 {
    gap: 2rem !important;
  }
  .gap-12 {
    gap: 1.5rem !important;
  }

  .p-16 {
    padding: 2rem !important;
  }
  .p-12 {
    padding: 1.5rem !important;
  }
  .p-10 {
    padding: 1.5rem !important;
  }
}

/* Client logo marquee */
.marquee-fade {
  width: 120px;
}
.client-logo-marquee-track {
  display: flex;
  align-items: center;
  width: max-content;
  margin-left: 140px;
  will-change: transform;
  backface-visibility: hidden;
  animation: clientLogoScroll 66s linear infinite;
}
.client-logo-marquee-track:hover {
  animation-play-state: paused;
}
@keyframes clientLogoScroll {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-50%, 0, 0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .client-logo-marquee-track {
    animation: none;
  }
}
@media (max-width: 767px) {
  .client-logo-marquee-track {
    margin-left: 24px;
  }
  .marquee-fade {
    width: 24px !important;
    opacity: 0.7;
  }
  .marquee-logo-img {
    height: 56px !important;
    margin-right: 40px !important;
  }
}

/* Hide LeadLeaf chat widget while a landing page modal is open */
body.lp-modal-open iframe[src*="leadconnectorhq"],
body.lp-modal-open iframe[src*="chat-widget"],
body.lp-modal-open div[id*="chat"],
body.lp-modal-open div[class*="chat-widget"],
body.lp-modal-open div[class*="ChatWidget"],
body.lp-modal-open div[role="button"][aria-label*="chat" i],
body.lp-modal-open div[aria-label*="message" i] {
  display: none !important;
}

/* Hide ALL floating chat widgets on /lp/ landing page routes */
body.lp-route iframe[src*="leadconnectorhq"],
body.lp-route iframe[src*="chat-widget"],
body.lp-route iframe[src*="loader"],
body.lp-route div[id*="chat" i],
body.lp-route div[class*="chat-widget" i],
body.lp-route div[class*="ChatWidget" i],
body.lp-route div[class*="chat-widget-container" i],
body.lp-route div[data-widget-id],
body.lp-route div[role="button"][aria-label*="chat" i],
body.lp-route div[aria-label*="message" i],
body.lp-route div[aria-label*="Hi there" i],
body.lp-route div[class*="widget" i][style*="fixed"],
body.lp-route div[class*="bubble" i][style*="fixed"],
body.lp-route div[class*="launcher" i],
body.lp-route #leadconnector-chat-widget,
body.lp-route .leadconnector-chat-widget,
body.lp-route [data-chat-widget],
body.lp-route [data-lc-chat],
body.lp-route chat-widget {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Mobile: case study modal is a full-screen sheet sliding up from bottom */
@media (max-width: 767px) {
  .lp-modal-card {
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 1rem 1rem 0 0 !important;
    animation: lp-sheet-up 280ms ease-out;
  }
  @keyframes lp-sheet-up {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }
}

/* LP Rebrand 2027 — scorecard grid (CaseStudyModal) */
.lp-scorecard-grid {
  display: grid;
  gap: 0.75rem;
}
@media (min-width: 768px) {
  .lp-scorecard-grid {
    grid-template-columns: repeat(var(--tile-count), minmax(0, 1fr));
  }
}
@media (max-width: 767px) {
  .lp-scorecard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .lp-scorecard-grid .lp-scorecard-tile-last {
    grid-column: 1 / -1;
  }
}

/* LP Rebrand 2027 — modal gallery frame (height-constrained so arrows stay visible) */
.lp-gallery-frame {
  max-height: none;
  min-height: 0;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lp-gallery-img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 40vh;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
@media (max-width: 767px) {
  .lp-gallery-img {
    max-height: 34vh;
  }
}

/* LP Rebrand 2027 — before/after slide images fit inside the constrained gallery frame */
.lp-ba-website {
  max-height: none;
  overflow: visible;
  align-items: center;
  justify-content: center;
}
.lp-ba-img-wrap {
  max-height: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lp-ba-img {
  max-height: 40vh;
  width: auto;
  object-fit: contain;
}
@media (max-width: 767px) {
  .lp-ba-img {
    max-height: 34vh;
  }
}

/* LP Rebrand 2027 — desktop: flex-based image heights so the modal fits without scrolling */
@media (min-width: 768px) {
  .lp-gallery-img,
  .lp-ba-img {
    max-height: 100%;
  }
}

/* LP Rebrand 2027 — modal description (full text, never clamped) */
.lp-modal-summary {
  overflow: visible;
}

/* LP Rebrand 2027 — no text widows anywhere on /lp/ routes (incl. modals) */
body.lp-route h1,
body.lp-route h2,
body.lp-route h3,
body.lp-route h4,
body.lp-route h5,
body.lp-route h6,
body.lp-route button,
body.lp-route .lp-modal-card h3,
body.lp-route .lp-scorecard-tile,
body.lp-route [class*="badge"],
body.lp-route label {
  text-wrap: balance;
}
body.lp-route p,
body.lp-route li,
body.lp-route figcaption,
body.lp-route blockquote,
body.lp-route .lp-modal-summary,
body.lp-route .lp-scorecard-tile > div:last-child,
body.lp-route small {
  text-wrap: pretty;
}
/* Fallback for browsers without text-wrap: join last two words of short
   headings and card descriptions with a non-breaking space (handled in JS
   via noWidow for most strings; this covers any remaining inline text). */

/* LP AI Website — hero headline: three explicit lines, clamp so each line
   fills most of the content width on phones (~64px at 390px) and WEBSITE
   DESIGN never wraps. */
.lp-ai-headline {
  font-size: clamp(3.6rem, 16.5vw, 7rem);
  line-height: 0.9;
}
@media (max-width: 640px) {
  .lp-ai-headline {
    font-size: min(16vw, 72px) !important;
    line-height: 0.95 !important;
  }
}
@media (max-width: 360px) {
  .lp-ai-headline {
    font-size: min(15.5vw, 60px) !important;
  }
}

/* LP header: compact on mobile so logo + button fit inside the screen */
@media (max-width: 639px) {
  .lp-header .lp-header-logo {
    width: 130px !important;
  }
  .lp-header .lp-header-phone {
    display: none !important;
  }
  .lp-header .lp-header-btn {
    padding: 10px 14px !important;
    font-size: 14px !important;
    height: auto !important;
  }
}

/* LP scan button: full width, wrap text on mobile */
@media (max-width: 639px) {
  .lp-scan-btn {
    width: 100% !important;
    max-width: 100% !important;
    padding: 14px 20px !important;
    height: auto !important;
    white-space: normal !important;
    text-align: center !important;
    line-height: 1.3 !important;
  }
  .lp-scan-btn a {
    justify-content: center !important;
    flex-wrap: wrap !important;
  }
}

/* LP hero: clip decorative blurred circles so they cannot widen the page */
.lp-hero-section {
  overflow: hidden !important;
}

/* ============================================================ */
/* LP AI Website — PREMIUM DESIGN UPGRADE                        */
/* ============================================================ */

/* Dark band: navy→blue gradient + dot grid + soft light blue glow */
.lp-ai-darkband {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0b1f3a 0%, #005096 100%);
}
.lp-ai-darkband::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.05) 1px,
    transparent 1px
  );
  background-size: 26px 26px;
  pointer-events: none;
  z-index: 0;
}
.lp-ai-darkband::after {
  content: "";
  position: absolute;
  top: 35%;
  left: 60%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(149, 202, 238, 0.12),
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

/* Glassy pill chip */
.lp-ai-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  backdrop-filter: blur(6px);
  transition: all 0.25s ease;
}
.lp-ai-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(149, 202, 238, 0.4);
}

/* Glass card on dark band */
.lp-ai-glass-card {
  position: relative;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(10px);
  border-radius: 1rem;
  padding: 1.6rem;
  transition:
    transform 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}
.lp-ai-glass-card:hover {
  transform: translateY(-6px);
  border-color: rgba(149, 202, 238, 0.4);
  box-shadow: 0 14px 44px -12px rgba(149, 202, 238, 0.28);
}

/* AI chat window card */
.lp-ai-chatcard {
  background: #fff;
  border-radius: 1.25rem;
  box-shadow: 0 24px 70px -18px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.lp-ai-chatcard-inner {
  animation: lp-ai-float 4.5s ease-in-out infinite;
}
@keyframes lp-ai-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .lp-ai-chatcard-inner {
    animation: none;
  }
}

/* Result tile */
.lp-result-tile {
  background: #fff;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid rgba(0, 80, 150, 0.1);
  cursor: pointer;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}
.lp-result-tile:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 40px -10px rgba(0, 80, 150, 0.25);
}

/* Signs warning card */
.lp-signs-card {
  border-top: 3px solid #f36f21;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}
.lp-signs-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 36px -10px rgba(243, 111, 33, 0.22);
}

/* What You Get card */
.lp-get-card {
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}
.lp-get-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 36px -10px rgba(0, 80, 150, 0.2);
}

/* How It Works timeline */
.lp-timeline-line {
  position: absolute;
  top: 32px;
  left: 10%;
  right: 10%;
  height: 2px;
  border-top: 2px dashed rgba(0, 80, 150, 0.25);
  z-index: 0;
}
@media (max-width: 767px) {
  .lp-timeline-line {
    top: 0;
    bottom: 0;
    left: 32px;
    right: auto;
    width: 2px;
    height: auto;
    border-top: none;
    border-left: 2px dashed rgba(0, 80, 150, 0.25);
  }
}

/* FAQ Plus→X rotation */
.lp-faq-plus {
  transition: transform 0.25s ease;
}
[data-state="open"] .lp-faq-plus {
  transform: rotate(135deg);
}

/* ============================================================ */
/* LP AI Website — MOBILE CENTERING + OVERFLOW FIXES            */
/* ============================================================ */

/* Center glass card contents on the dark band at every width */
.lp-ai-glass-card {
  text-align: center;
  align-items: center;
}
.lp-ai-glass-card > div:first-child {
  margin-left: auto;
  margin-right: auto;
}

/* Mobile overflow guards for all LP page sections */
body.lp-route section {
  overflow-x: hidden;
}

/* EXAMPLE AI SEARCH result row: stack on small screens so nothing runs off */
@media (max-width: 639px) {
  .lp-ai-chatcard .lp-ai-result-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
  .lp-ai-chatcard .lp-ai-result-row > .lp-ai-result-name {
    width: 100%;
  }
  .lp-ai-chatcard .lp-ai-result-row .lp-ai-result-meta {
    width: 100%;
    justify-content: flex-start;
  }
}

/* WHAT YOU GET device mockup: keep badges + phone fully inside on mobile */
@media (max-width: 1023px) {
  .lp-get-devices {
    padding-left: 1rem;
    padding-right: 1rem;
    transform: scale(0.92);
    transform-origin: center center;
  }
}
@media (max-width: 639px) {
  .lp-get-devices {
    transform: scale(0.82);
  }
  /* Stack benefit items centered on mobile */
  .lp-get-list li {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.6rem;
  }
  .lp-get-list li > div:last-child {
    max-width: 90%;
  }
  .lp-get-cta {
    width: 100%;
  }
  .lp-get-cta a {
    width: 100%;
    justify-content: center;
  }
}

/* Chips wrap fully inside the screen */
.lp-ai-chip-wrap {
  max-width: 100%;
}

/* LP AI Website — mockup badge nowrap + mobile sizing */
.lp-mockup-badge {
  white-space: nowrap;
}
@media (max-width: 639px) {
  .lp-mockup-badge {
    font-size: 11px !important;
    padding: 4px 10px !important;
    white-space: nowrap !important;
  }
  .lp-ai-badge {
    right: 0 !important;
    left: auto !important;
    white-space: nowrap !important;
  }
}
