@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 {
  /* Smooth in-page anchor scrolling, offset for the 80px sticky header
     so anchored section headings are never hidden behind the nav.
     Respects prefers-reduced-motion (no smooth scroll when reduced). */
  :root {
    scroll-behavior: smooth;
  }
  @media (prefers-reduced-motion: reduce) {
    :root {
      scroll-behavior: auto;
    }
  }
  /* Offset every anchored section/element so the sticky header
     (h-20 = 80px) does not cover the heading. 96px gives breathing room. */
  section[id],
  [id].scroll-mt-header,
  div[id].scroll-mt-header {
    scroll-margin-top: 96px;
  }
  :root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;

    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;

    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;

    --primary: 222.2 47.4% 11.2%;
    --primary-foreground: 210 40% 98%;

    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;

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

    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;

    --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: 222.2 84% 4.9%;

    --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%;

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

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

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

  * {
    @apply border-border;
  }

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

  /* Global keyboard focus visibility for interactive elements */
  a:focus-visible,
  button:focus-visible,
  [role="menuitem"]:focus-visible,
  [role="tab"]:focus-visible,
  input:focus-visible,
  textarea:focus-visible,
  select:focus-visible,
  summary:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
    border-radius: 4px;
  }
}

/* Landscaping Style Picker page tokens */
.landscaping-page {
  --ls-primary: #1b4332;
  --ls-accent: #d2691e;
  --ls-secondary: #52796f;
  --ls-bg-alt: #f4f6f4;
  --ls-text: #1a1a1a;
  --ls-muted: #6b7280;
  --ls-gold: #fbbf24;
  --ls-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --ls-radius: 12px;
}

.landscaping-page h1,
.landscaping-page h2,
.landscaping-page h3,
.landscaping-page h4 {
  font-family: "Inter", sans-serif;
}

.landscaping-page h1 {
  font-family: "Playfair Display", serif;
}

.landscaping-page body,
.landscaping-page p,
.landscaping-page span,
.landscaping-page a,
.landscaping-page button,
.landscaping-page li {
  font-family: "Inter", sans-serif;
}

/* ========================================
   Homepage Reusable Component Classes
   ======================================== */

@layer components {
  /* Primary blue CTA button shadow + hover */
  .btn-blue-shadow {
    box-shadow: 0 4px 16px rgba(29, 78, 216, 0.4);
    transition: box-shadow 0.3s ease;
  }
  .btn-blue-shadow:hover {
    box-shadow: 0 6px 24px rgba(29, 78, 216, 0.5);
  }

  /* White CTA button shadow + hover */
  .btn-white-shadow {
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.25);
    transition: box-shadow 0.3s ease;
  }
  .btn-white-shadow:hover {
    box-shadow: 0 6px 24px rgba(255, 255, 255, 0.35);
  }

  /* Gold accent button shadow + hover */
  .btn-gold-shadow {
    box-shadow: 0 4px 16px rgba(234, 179, 8, 0.4);
    transition: box-shadow 0.3s ease;
  }
  .btn-gold-shadow:hover {
    box-shadow: 0 6px 24px rgba(234, 179, 8, 0.5);
  }

  /* Consistent homepage section container */
  .homepage-section {
    padding-top: 6rem;
    padding-bottom: 6rem;
  }
  @media (min-width: 768px) {
    .homepage-section {
      padding-top: 7rem;
      padding-bottom: 7rem;
    }
  }

  /* Consistent card styling for service/benefit cards */
  .homepage-card {
    @apply bg-white rounded-2xl border border-slate-200 shadow-sm transition-all duration-300;
  }
  .homepage-card-hover:hover {
    @apply shadow-md border-[#1D4ED8]/30;
  }

  /* Card icon container — blue badge */
  .card-icon-badge {
    @apply h-12 w-12 rounded-lg flex items-center justify-center;
    background-color: rgb(219 234 254); /* blue-100 */
    color: #1d4ed8;
  }

  /* Gold highlight text span */
  .text-gold-accent {
    color: #ca8a04; /* gold-600 */
  }

  /* Card heading */
  .card-heading {
    @apply text-xl font-bold text-[#081D33] mb-4;
  }

  /* Card body text */
  .card-body {
    @apply text-slate-600 leading-relaxed;
  }

  /* Pill / badge for high-impact labels */
  .gold-pill {
    @apply inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-bold uppercase tracking-wider;
    background-color: rgb(254 249 195); /* gold-100 */
    color: #854d0e; /* gold-900 */
    border: 1px solid rgb(253 224 71); /* gold-300 */
  }

  /* Final CTA section — left image fade (nursery) */
  .cta-image-left {
    mask-image: linear-gradient(
      to right,
      rgba(0, 0, 0, 1) 0%,
      rgba(0, 0, 0, 0.4) 60%,
      rgba(0, 0, 0, 0) 100%
    );
    -webkit-mask-image: linear-gradient(
      to right,
      rgba(0, 0, 0, 1) 0%,
      rgba(0, 0, 0, 0.4) 60%,
      rgba(0, 0, 0, 0) 100%
    );
  }

  /* Hero gradient overlay — mobile (wider navy for readability) */
  .hero-overlay-mobile {
    background: linear-gradient(
      90deg,
      rgba(8, 29, 51, 0.98) 0%,
      rgba(8, 29, 51, 0.95) 40%,
      rgba(8, 29, 51, 0.85) 60%,
      rgba(8, 29, 51, 0.6) 80%,
      rgba(8, 29, 51, 0.45) 100%
    );
  }

  /* Hero benefit icon container — translucent white circle */
  .hero-benefit-icon {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
  }

  /* Final CTA section — right image fade (landscaping) */
  .cta-image-right {
    mask-image: linear-gradient(
      to left,
      rgba(0, 0, 0, 1) 0%,
      rgba(0, 0, 0, 0.4) 60%,
      rgba(0, 0, 0, 0) 100%
    );
    -webkit-mask-image: linear-gradient(
      to left,
      rgba(0, 0, 0, 1) 0%,
      rgba(0, 0, 0, 0.4) 60%,
      rgba(0, 0, 0, 0) 100%
    );
  }

  /* FAQ widget — responsive height to avoid excessive empty space on mobile */
  .faq-widget-wrapper {
    height: 1100px;
  }
  @media (max-width: 1024px) {
    .faq-widget-wrapper {
      height: 1400px;
    }
  }
  @media (max-width: 768px) {
    .faq-widget-wrapper {
      height: 1800px;
    }
  }
  @media (max-width: 480px) {
    .faq-widget-wrapper {
      height: 2200px;
    }
  }

  /* Subtle fade-and-rise entrance for editable homepage sections.
     Content is visible by default; animation only enhances on mount.
     Respects prefers-reduced-motion. */
  @keyframes fadeUp {
    from {
      opacity: 0;
      transform: translateY(16px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  .fade-up {
    animation: fadeUp 0.7s ease-out both;
  }

  /* Staggered entrance for pain-point cards (0.1s increments).
     Respects prefers-reduced-motion. */
  @keyframes fadeUpStagger {
    from {
      opacity: 0;
      transform: translateY(18px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  .fade-up-stagger {
    opacity: 0;
    animation: fadeUpStagger 0.6s ease-out both;
  }
  .fade-up-stagger:nth-child(1) {
    animation-delay: 0.1s;
  }
  .fade-up-stagger:nth-child(2) {
    animation-delay: 0.2s;
  }
  .fade-up-stagger:nth-child(3) {
    animation-delay: 0.3s;
  }
  .fade-up-stagger:nth-child(4) {
    animation-delay: 0.4s;
  }

  /* Six-step process entrance — fade & rise, staggered in numerical order.
     Supports up to six steps. Respects prefers-reduced-motion. */
  .fade-up-step {
    opacity: 0;
    animation: fadeUpStagger 0.55s ease-out both;
  }
  .fade-up-step:nth-child(1) {
    animation-delay: 0.1s;
  }
  .fade-up-step:nth-child(2) {
    animation-delay: 0.2s;
  }
  .fade-up-step:nth-child(3) {
    animation-delay: 0.3s;
  }
  .fade-up-step:nth-child(4) {
    animation-delay: 0.4s;
  }
  .fade-up-step:nth-child(5) {
    animation-delay: 0.5s;
  }
  .fade-up-step:nth-child(6) {
    animation-delay: 0.6s;
  }

  /* Connecting path for the process — fills once as the section enters view. */
  @keyframes lineFill {
    from {
      transform: scaleX(0);
    }
    to {
      transform: scaleX(1);
    }
  }
  .process-line-fill {
    transform-origin: left center;
    animation: lineFill 0.9s ease-out 0.15s both;
  }
  .process-line-fill-vertical {
    transform-origin: top center;
    animation: lineFill 0.9s ease-out 0.15s both;
  }

  /* Local SEO map markers — appear once in a restrained sequence.
     No continuous pulsing. Respects prefers-reduced-motion. */
  @keyframes markerPop {
    0% {
      opacity: 0;
      transform: scale(0.4);
    }
    70% {
      opacity: 1;
      transform: scale(1.15);
    }
    100% {
      opacity: 1;
      transform: scale(1);
    }
  }
  .marker-pop-1 {
    opacity: 0;
    animation: markerPop 0.4s ease-out 0.3s both;
  }
  .marker-pop-2 {
    opacity: 0;
    animation: markerPop 0.4s ease-out 0.45s both;
  }
  .marker-pop-3 {
    opacity: 0;
    animation: markerPop 0.4s ease-out 0.6s both;
  }
  .marker-pop-4 {
    opacity: 0;
    animation: markerPop 0.4s ease-out 0.75s both;
  }

  /* Lead-source cards — appear once in a controlled sequence flowing toward
     the central "New Opportunities" inbox. No continuous movement.
     Respects prefers-reduced-motion. */
  .lead-source-1 {
    opacity: 0;
    animation: fadeUp 0.45s ease-out 0.2s both;
  }
  .lead-source-2 {
    opacity: 0;
    animation: fadeUp 0.45s ease-out 0.32s both;
  }
  .lead-source-3 {
    opacity: 0;
    animation: fadeUp 0.45s ease-out 0.44s both;
  }
  .lead-source-4 {
    opacity: 0;
    animation: fadeUp 0.45s ease-out 0.56s both;
  }
  .lead-source-5 {
    opacity: 0;
    animation: fadeUp 0.45s ease-out 0.68s both;
  }
  .lead-source-6 {
    opacity: 0;
    animation: fadeUp 0.45s ease-out 0.8s both;
  }

  /* AI chat conversation steps — appear once in the correct order.
     No looping, no typing effect after initial reveal.
     Respects prefers-reduced-motion. */
  .chat-step-1 {
    opacity: 0;
    animation: fadeUp 0.4s ease-out 0.25s both;
  }
  .chat-step-2 {
    opacity: 0;
    animation: fadeUp 0.4s ease-out 0.4s both;
  }
  .chat-step-3 {
    opacity: 0;
    animation: fadeUp 0.4s ease-out 0.55s both;
  }
  .chat-step-4 {
    opacity: 0;
    animation: fadeUp 0.4s ease-out 0.7s both;
  }

  /* Booking → pipeline opportunity card — slides once from the "New Lead"
     column toward "Appointment Set". No looping. Respects reduced-motion. */
  @keyframes pipelineMove {
    0% {
      opacity: 0;
      transform: translateX(-160%) translateY(2px);
    }
    60% {
      opacity: 1;
    }
    100% {
      opacity: 1;
      transform: translateX(0) translateY(0);
    }
  }
  .pipeline-card {
    opacity: 0;
    animation: pipelineMove 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.55s both;
  }

  /* Connector lines between booking and pipeline panels — fill once. */
  .pipeline-connector {
    transform-origin: center;
    animation: lineFill 0.7s ease-out 0.4s both;
    transform: scaleX(0);
  }
  @keyframes lineFill {
    from {
      transform: scaleX(0);
    }
    to {
      transform: scaleX(1);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .fade-up,
    .fade-up-stagger,
    .fade-up-step {
      animation: none;
      opacity: 1;
    }
    .process-line-fill,
    .process-line-fill-vertical {
      animation: none;
      transform: none;
    }
    .marker-pop-1,
    .marker-pop-2,
    .marker-pop-3,
    .marker-pop-4 {
      animation: none;
      opacity: 1;
    }
    .lead-source-1,
    .lead-source-2,
    .lead-source-3,
    .lead-source-4,
    .lead-source-5,
    .lead-source-6 {
      animation: none;
      opacity: 1;
    }
    .chat-step-1,
    .chat-step-2,
    .chat-step-3,
    .chat-step-4 {
      animation: none;
      opacity: 1;
    }
    .pipeline-card,
    .pipeline-connector {
      animation: none;
      opacity: 1;
      transform: none;
    }
  }
}

/* ========================================
   Mobile/Tablet Sticky Bottom Navigation
   Lifts the third-party chat widget button
   above the bottom nav bar on ≤1024px.
   ======================================== */
@media (max-width: 1024px) {
  /* LeadConnector / chat widget floating launcher button */
  [id*="leadconnector"] [role="button"],
  iframe[src*="leadconnectorhq"] {
    margin-bottom: 80px !important;
  }
  /* Generic chat launcher fallbacks */
  .leadconnectorhq-launcher,
  #leadconnectorhq-launcher,
  div[class*="chat-widget"],
  div[class*="ChatWidget"] {
    bottom: calc(80px + env(safe-area-inset-bottom)) !important;
  }
}
