/* ==============
   Custom styles, layered on top of Tailwind CDN.
   Brand kit will replace these defaults.
   ============== */

html { scroll-behavior: smooth; }

body { -webkit-font-smoothing: antialiased; }

/* Subtle floating motion on hero photo gradient */
@keyframes float-slow {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

/* Mermaid diagram - tighten font + ensure responsive */
.mermaid svg {
  max-width: 100%;
  height: auto;
}

.mermaid .nodeLabel {
  font-family: 'Inter', sans-serif !important;
  font-size: 13px !important;
  font-weight: 500;
}

/* Plotly responsive default */
.js-plotly-plot { width: 100% !important; }

/* AOS - reduce duration default */
[data-aos] { transition-duration: 600ms !important; }

/* Selection color override (Tailwind's selection: doesn't catch all) */
::selection { background: #7551c3; color: #faf9f7; }

/* Prose color tweaks for body copy */
.prose { color: #1a1a2e; }
.prose h2 { color: #1a1a2e; margin-top: 2.5rem; }
.prose strong { color: #1a1a2e; }

/* Mobile menu transition */
#mobile-menu { transition: all 0.2s ease; }

/* Card hover refinement */
article.group:hover .arrow-icon { transform: translateX(4px); }

/* ==============
   Marquee carousels (logos, reviews)
   - Loop seamlessly by duplicating content in markup and translating -50%.
   - Each direct child must include consistent right padding so the rendered
     width is exactly 2x of one full set.
   ============== */
@keyframes marquee-x {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee-x linear infinite;
  will-change: transform;
}
.marquee-track:hover { animation-play-state: paused; }
.marquee-slow  { animation-duration: 220s; }
.marquee-medium { animation-duration: 140s; }
.marquee-fast  { animation-duration: 100s; }
.marquee-trusted { animation-duration: 60s; }

/* Hide native scrollbar on horizontally-scrollable carousels (the JS
   reviews carousel uses overflow-x:auto so users can swipe / wheel). */
.no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

/* Carousel prev/next buttons */
.carousel-btn {
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: 1px solid rgba(26, 26, 46, 0.12);
  color: #1a1a2e;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(26, 26, 46, 0.06);
}
.carousel-btn:hover {
  border-color: #7551c3;
  color: #7551c3;
}
.carousel-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Filter buttons on the previous projects page */
.filter-btn {
  border: 1px solid rgba(26, 26, 46, 0.12);
  padding: 0.45rem 1.1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  background: white;
  color: #1a1a2e;
  transition: all 0.15s ease;
}
.filter-btn:hover { border-color: rgba(26, 26, 46, 0.4); }
.filter-btn.active {
  background: #1a1a2e;
  color: #faf9f7;
  border-color: #1a1a2e;
}

/* ==============
   Outcome bars - replaces Plotly inside case studies.
   Pure HTML/CSS/JS. Each row is a self-contained micro-chart with the
   metric, its target value, a proportional bar, the baseline it
   replaced, and one line of context. Bars animate from 0 to their
   target width when scrolled into view.
   ============== */
.outcome-chart { display: flex; flex-direction: column; gap: 1.75rem; }

.outcome-row {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 1.5rem;
  row-gap: 0.5rem;
  align-items: baseline;
  padding: 1rem 1.25rem;
  border-radius: 14px;
  border: 1px solid rgba(26, 26, 46, 0.05);
  background: rgba(255, 255, 255, 0.5);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.outcome-row:hover {
  background: rgba(117, 81, 195, 0.04);
  border-color: rgba(117, 81, 195, 0.25);
}

.outcome-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a1a2e;
  letter-spacing: -0.01em;
}
.outcome-value {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1.875rem;
  line-height: 1;
  color: #1a1a2e;
  text-align: right;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.outcome-value.is-negative { color: #1a1a2e; }
.outcome-value .outcome-sign {
  display: inline-block;
  margin-right: 0.1em;
  color: #7551c3;
  font-weight: 700;
}
.outcome-value .outcome-unit {
  font-size: 0.7em;
  font-weight: 600;
  color: rgba(26, 26, 46, 0.65);
  margin-left: 0.05em;
}

.outcome-track {
  grid-column: 1 / -1;
  height: 10px;
  background: rgba(240, 232, 219, 0.7);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.25rem;
}
.outcome-fill {
  height: 100%;
  background: linear-gradient(90deg, #d8c8ed 0%, #a995df 50%, #7551c3 100%);
  border-radius: 999px;
  width: 0;
  transition: width 1.1s cubic-bezier(0.65, 0, 0.35, 1);
  transform-origin: left center;
}
.outcome-row.in-view .outcome-fill { width: var(--bar-width); }

.outcome-context {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.4rem;
  padding-top: 0.6rem;
  border-top: 1px dashed rgba(26, 26, 46, 0.08);
}
.outcome-baseline {
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: rgba(26, 26, 46, 0.65);
}
.outcome-baseline::before {
  content: 'Baseline';
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(117, 81, 195, 0.85);
  background: rgba(117, 81, 195, 0.08);
  border-radius: 4px;
  padding: 0.05rem 0.4rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}
.outcome-explanation {
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: rgba(26, 26, 46, 0.78);
  line-height: 1.5;
}

@media (max-width: 640px) {
  .outcome-value { font-size: 1.5rem; }
  .outcome-row { padding: 0.85rem 1rem; }
}

/* ==============
   Result Stats - the "6% / 9% / 7%" pattern from the old WP Canva blocks.
   Replaces image-based result cards with native, animated stat tiles.
   Used on case studies where outcomes are best-told as 2-4 big numbers
   sitting on a soft-tinted card.
   ============== */
.result-stats {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), 1fr);
  gap: 1.5rem;
  padding: 2.5rem 2rem;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(216, 200, 237, 0.4) 0%, rgba(182, 224, 194, 0.25) 100%);
  border: 1px solid rgba(117, 81, 195, 0.08);
}
.result-stat {
  text-align: center;
  padding: 1rem;
  border-radius: 14px;
  transition: background 0.2s ease, transform 0.2s ease;
}
.result-stat:hover { background: rgba(255, 255, 255, 0.5); transform: translateY(-2px); }
.result-stat-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5b3fc1;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  border: 1px solid rgba(117, 81, 195, 0.15);
  transition: transform 0.3s ease;
}
.result-stat:hover .result-stat-icon { transform: scale(1.08) rotate(-3deg); }
.result-stat-icon svg { width: 30px; height: 30px; }
.result-stat-value {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 700;
  font-size: clamp(2.5rem, 5vw, 3.25rem);
  line-height: 1;
  color: #5b3fc1;
  letter-spacing: -0.02em;
  margin-bottom: 0.65rem;
}
.result-stat-value .result-stat-suffix {
  font-size: 0.55em;
  font-weight: 700;
  margin-left: 0.05em;
  vertical-align: 12%;
}
.result-stat-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  color: rgba(26, 26, 46, 0.75);
  font-weight: 500;
  line-height: 1.4;
  max-width: 22ch;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .result-stats { grid-template-columns: 1fr 1fr; padding: 1.5rem 1rem; gap: 0.5rem; }
}
@media (max-width: 480px) {
  .result-stats { grid-template-columns: 1fr; }
}

/* ==============
   Process Flow - the "AB testing framework" pattern from the old WP Canva
   diagrams. Five-step horizontal arrow flow on desktop, vertical timeline
   on mobile. Steps highlight on hover.
   ============== */
.process-flow {
  display: grid;
  grid-template-columns: repeat(var(--steps, 5), 1fr);
  gap: 0.75rem;
  position: relative;
}
.process-step {
  position: relative;
  padding: 1.5rem 1rem 1.25rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(117, 81, 195, 0.12);
  text-align: center;
  cursor: default;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.process-step:hover {
  background: white;
  border-color: rgba(117, 81, 195, 0.4);
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(117, 81, 195, 0.08);
  z-index: 2;
}
.process-step-num {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  color: #7551c3;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(117, 81, 195, 0.25);
}
.process-step-icon {
  width: 56px;
  height: 56px;
  margin: 0.5rem auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: linear-gradient(135deg, #a995df 0%, #5b3fc1 100%);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(117, 81, 195, 0.25);
  transition: transform 0.3s ease;
}
.process-step:hover .process-step-icon { transform: scale(1.1) rotate(-5deg); }
.process-step-icon svg { width: 26px; height: 26px; }
.process-step-name {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #1a1a2e;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}
.process-step-detail {
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: rgba(26, 26, 46, 0.7);
}

/* Arrow connector between steps (desktop only) */
@media (min-width: 768px) {
  .process-step:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -0.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid rgba(117, 81, 195, 0.45);
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    z-index: 1;
  }
}

@media (max-width: 768px) {
  .process-flow { grid-template-columns: 1fr; gap: 1.5rem; }
  .process-step:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: -1.1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-top: 10px solid rgba(117, 81, 195, 0.45);
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
  }
}

/* ==============
   Outcome Pillars - qualitative result cards.
   Used when the case study's wins are descriptive rather than numeric
   (e.g., "Streamlined reporting", "User-friendly interface"). Each pillar
   is a small card with icon + title + 1-2 sentence description.
   ============== */
.outcome-pillars {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), 1fr);
  gap: 1.25rem;
}
.outcome-pillar {
  padding: 1.5rem 1.4rem;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(117, 81, 195, 0.1);
  border-radius: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.outcome-pillar:hover {
  background: white;
  border-color: rgba(117, 81, 195, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(117, 81, 195, 0.07);
}
.outcome-pillar-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #d8c8ed 0%, #7551c3 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  transition: transform 0.3s ease;
}
.outcome-pillar:hover .outcome-pillar-icon { transform: scale(1.06) rotate(-3deg); }
.outcome-pillar-icon svg { width: 22px; height: 22px; }
.outcome-pillar-title {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: #1a1a2e;
  letter-spacing: -0.01em;
  margin-bottom: 0.45rem;
}
.outcome-pillar-text {
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  line-height: 1.55;
  color: rgba(26, 26, 46, 0.7);
}

@media (max-width: 768px) {
  .outcome-pillars { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .outcome-pillars { grid-template-columns: 1fr; }
}

/* ==============
   Reduced motion. Honour the OS "reduce motion" setting: stop the
   always-on marquees and the reviews auto-scroll, neutralise AOS
   reveals (belt-and-braces with the JS disable), and drop smooth
   scrolling so jumps are instant. Content stays fully visible and
   manual controls (carousel buttons, scroll/swipe) still work.
   ============== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .marquee-track { animation: none !important; }
  [data-aos] { opacity: 1 !important; transform: none !important; transition: none !important; }
  .outcome-fill { transition: none !important; }
}

/* ==============
   Skip link / in-page anchors. The sticky header is 4rem tall; offset
   anchored content by 5rem so the destination isn't hidden underneath
   it (WCAG 2.2 SC 2.4.11 Focus Not Obscured). #main is a programmatic
   focus target only, so it takes no visible outline.
   ============== */
:target,
[id] { scroll-margin-top: 5rem; }
#main:focus { outline: none; }

/* ==============
   Nav dropdowns. The trigger is a real <button>; JS toggles .is-open on
   the .nav-dd wrapper and keeps aria-expanded truthful, with Esc and
   click-outside to close. Hover is a mouse-only enhancement so touch /
   keyboard users are never bounced to a parent page or trapped in an
   invisible panel. !important beats the Tailwind opacity/visibility
   utilities still on the panel for its closed state.
   ============== */
/* The label is a real link (navigates); the caret is the menu toggle.
   Negative margin keeps the enlarged hit area from changing nav height. */
.nav-dd-toggle {
  cursor: pointer;
  padding: 0.6rem 0.4rem;
  margin: -0.6rem -0.2rem;
  border-radius: 0.5rem;
}
.nav-dd-panel { pointer-events: none; }

.nav-dd.is-open > .nav-dd-panel {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translate(-50%, 0) !important;
  pointer-events: auto;
}

@media (hover: hover) and (pointer: fine) {
  .nav-dd:hover > .nav-dd-panel,
  .nav-dd:focus-within > .nav-dd-panel {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translate(-50%, 0) !important;
    pointer-events: auto;
  }
}
