/* Reusable UI components */

/* Logo */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-lg);
  color: var(--text);
}

/* Infinity logo mark: on load, a bright head with a fading tail (stacked,
   phase-staggered dash "echoes") sweeps the full loop once, slowly — the
   way a hand-traced infinity loop actually moves, visibly crossing
   itself at the center — then the trail dissolves and the mark settles
   into a fully-lit, static badge with a small scale bounce. Speed is set
   here; LAP_SECONDS in logo-mark.js must match --infinity-lap so the
   stagger between echoes and the settle timing line up. */
.brand-mark-infinity {
  --infinity-lap: 3s;
  flex-shrink: 0;
  overflow: visible;
  filter: drop-shadow(0 2px 10px rgba(124, 92, 252, 0.45));
  transform-origin: 50% 50%;
  animation: infinity-settle 0.6s cubic-bezier(0.32, 1.6, 0.55, 1) var(--infinity-lap) both;
}

.infinity-base {
  opacity: 0.4;
  animation: infinity-brighten 0.6s ease-out var(--infinity-lap) forwards;
}

.infinity-echoes {
  animation: infinity-fade-out 0.5s ease-in var(--infinity-lap) forwards;
}

.infinity-echo {
  animation: infinity-flow var(--infinity-lap) linear 1;
}

@keyframes infinity-flow {
  to {
    stroke-dashoffset: -1;
  }
}

@keyframes infinity-brighten {
  to {
    opacity: 1;
  }
}

@keyframes infinity-fade-out {
  to {
    opacity: 0;
  }
}

@keyframes infinity-settle {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.22);
  }
  100% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-mark-infinity {
    animation: none;
  }
  .infinity-base {
    opacity: 1;
    animation: none;
  }
  .infinity-echoes,
  .infinity-echo {
    animation: none;
    opacity: 0 !important;
  }
}

/* Nav links */
.nav-link {
  position: relative;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease);
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link[aria-current="page"] {
  color: var(--text);
}

.nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -22px;
  height: 2px;
  background: var(--gradient-brand);
}

@media (max-width: 900px) {
  .nav-link[aria-current="page"]::after {
    display: none;
  }
}

/* Buttons */
.btn,
button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: var(--fs-sm);
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  border: 1px solid transparent;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--gradient-brand);
  color: white;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  box-shadow: 0 16px 40px rgba(124, 92, 252, 0.35);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--surface-border);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.btn-ghost {
  color: var(--text);
  padding-inline: 0.9rem;
}

.btn-ghost:hover {
  background: var(--surface-alt);
}

.btn-sm {
  padding: 0.55rem 1.1rem;
  font-size: var(--fs-xs);
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-pill);
  display: inline-grid;
  place-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--surface-border);
}

/* Eyebrow / badge / pill */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--gradient-brand-soft);
  border: 1px solid var(--surface-border);
  color: var(--accent);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}

.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
}

.tag {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  background: var(--surface-alt);
  border: 1px solid var(--surface-border);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
}

button.tag {
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
}

button.tag[aria-pressed="true"] {
  background: var(--gradient-brand);
  border-color: transparent;
  color: white;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease),
    border-color var(--dur-base) var(--ease);
}

.card-hover:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--surface-border));
}

.card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--gradient-brand-soft);
  display: grid;
  place-items: center;
  color: var(--accent);
  margin-bottom: var(--space-lg);
}

.card-icon svg {
  width: 26px;
  height: 26px;
}

.card h3 {
  margin-bottom: var(--space-sm);
}

.card p {
  font-size: var(--fs-sm);
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: var(--space-lg);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--accent);
}

.card-link svg {
  width: 16px;
  height: 16px;
  transition: transform var(--dur-fast) var(--ease);
}

.card-link:hover svg {
  transform: translateX(3px);
}

/* Stat block */
.stat {
  text-align: left;
}

.stat .num {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 700;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: block;
}

.stat .label {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  margin-top: var(--space-2xs);
}

/* Logo / worklist strip */
.strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* Process steps */
.step {
  display: flex;
  gap: var(--space-lg);
}

.step-index {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent);
}

/* Quote / testimonial */
.quote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-lg);
}

.quote p {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  color: var(--text);
  line-height: var(--lh-snug);
}

.quote cite {
  display: block;
  margin-top: var(--space-md);
  font-style: normal;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* Accordion (FAQ) */
.accordion-item {
  border-bottom: 1px solid var(--surface-border);
}

.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-lg) 0;
  text-align: left;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-md);
}

.accordion-trigger .plus {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  position: relative;
  transition: transform var(--dur-base) var(--ease), background var(--dur-base) var(--ease);
}

.accordion-trigger .plus::before,
.accordion-trigger .plus::after {
  content: "";
  position: absolute;
  background: var(--text);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.accordion-trigger .plus::before {
  width: 12px;
  height: 2px;
}
.accordion-trigger .plus::after {
  width: 2px;
  height: 12px;
  transition: transform var(--dur-base) var(--ease);
}

.accordion-item[data-open="true"] .plus {
  background: var(--gradient-brand);
  border-color: transparent;
}
.accordion-item[data-open="true"] .plus::before,
.accordion-item[data-open="true"] .plus::after {
  background: white;
}
.accordion-item[data-open="true"] .plus::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.accordion-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur-base) var(--ease);
}

.accordion-item[data-open="true"] .accordion-panel {
  grid-template-rows: 1fr;
}

.accordion-panel-inner {
  overflow: hidden;
}

.accordion-panel p {
  padding-bottom: var(--space-lg);
  max-width: 640px;
}

/* Forms */
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}

.form-field input,
.form-field textarea,
.form-field select {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.form-field textarea {
  resize: vertical;
  min-height: 140px;
}

.form-error {
  font-size: var(--fs-xs);
  color: #ef4444;
  min-height: 1em;
}

.form-field[data-invalid="true"] input,
.form-field[data-invalid="true"] textarea {
  border-color: #ef4444;
}

.form-note {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.form-success {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--success-500) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--success-500) 30%, transparent);
  color: var(--text);
}

/* Theme toggle */
.theme-toggle {
  position: relative;
}
.theme-toggle svg {
  width: 20px;
  height: 20px;
}
.theme-toggle .icon-moon {
  display: none;
}
:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}
:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}

/* Reveal-on-scroll. Gated behind .js-reveal (added by an early inline
   script in <head>) so content stays visible by default if JavaScript
   fails to load — it only hides-then-reveals when JS can guarantee the
   reveal will actually run. */
.js-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}
.js-reveal [data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .js-reveal [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

/* Back to top */
.back-to-top {
  position: fixed;
  right: var(--space-lg);
  bottom: var(--space-lg);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease),
    bottom var(--dur-base) var(--ease);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow-md);
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

.breadcrumb a:hover {
  color: var(--accent);
}

/* Article */
.prose {
  max-width: 720px;
  margin-inline: auto;
}

.prose h2 {
  font-size: var(--fs-2xl);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
}

.prose h3 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}

.prose p {
  margin-bottom: var(--space-md);
  font-size: var(--fs-md);
}

.prose ul {
  list-style: disc;
  padding-left: 1.4rem;
  margin-bottom: var(--space-md);
  color: var(--text-muted);
}

.prose li {
  margin-bottom: var(--space-xs);
}

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-lg);
  font-style: italic;
  margin-block: var(--space-lg);
}

/* Table (used for comparisons if needed) */
table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: var(--space-md);
  border-bottom: 1px solid var(--surface-border);
}

th {
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Cookie consent banner */
.cookie-consent {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 300;
  background: var(--surface);
  border-top: 1px solid var(--surface-border);
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform var(--dur-base) var(--ease);
}

.cookie-consent.is-visible {
  transform: translateY(0);
}

.cookie-consent-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  padding-block: var(--space-md);
  flex-wrap: wrap;
}

.cookie-consent-text {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  max-width: 640px;
  margin: 0;
}

.cookie-consent-text a {
  color: var(--accent);
  text-decoration: underline;
}

.cookie-consent-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

@media (max-width: 560px) {
  .cookie-consent-inner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .cookie-consent-actions {
    justify-content: center;
  }
}

/* Site assistant (chatbot) widget — see assets/js/components/chatbot.js
   and assets/js/data/chatbot-kb.js. Not AI; a button/keyword-driven FAQ
   widget styled to sit opposite the back-to-top button. */
.chatbot-widget {
  position: fixed;
  left: var(--space-lg);
  bottom: var(--space-lg);
  z-index: 250;
  transition: bottom var(--dur-base) var(--ease);
}

/* The cookie banner spans the full width at the bottom and sits above
   both floating buttons (z-index 300 vs. 250/90) — without this, it
   visually and functionally blocks clicks on them while it's showing. */
body.has-cookie-banner .chatbot-widget,
body.has-cookie-banner .back-to-top {
  bottom: calc(var(--space-lg) + var(--cookie-banner-h, 0px));
}

/* The mobile nav overlay has no z-index of its own (it relies on the
   header's stacking context), so the chatbot bubble (z-index 250) was
   rendering on top of it, overlapping the nav's own CTA button. `no-scroll`
   is already toggled on <body> exactly when the mobile nav opens/closes
   (see setNavOpen in main.js), so it's a free hook for this too. */
body.no-scroll .chatbot-widget,
body.no-scroll .back-to-top {
  display: none;
}

.chatbot-toggle {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-pill);
  background: var(--gradient-brand);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-glow);
  transition: transform var(--dur-fast) var(--ease);
}

.chatbot-toggle:hover {
  transform: translateY(-2px) scale(1.04);
}

.chatbot-toggle svg {
  width: 24px;
  height: 24px;
  grid-area: 1 / 1;
}

.chatbot-icon-close {
  opacity: 0;
  transform: rotate(-45deg);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.chatbot-icon-chat {
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.chatbot-widget.is-open .chatbot-icon-close {
  opacity: 1;
  transform: rotate(0);
}

.chatbot-widget.is-open .chatbot-icon-chat {
  opacity: 0;
  transform: rotate(45deg);
}

.chatbot-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + var(--space-md));
  width: min(360px, calc(100vw - 2 * var(--space-lg)));
  height: min(500px, 70vh);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transform-origin: bottom left;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}

.chatbot-widget.is-open .chatbot-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chatbot-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--surface-border);
  background: var(--gradient-brand-soft);
}

.chatbot-header strong {
  font-family: var(--font-display);
  font-size: var(--fs-md);
}

.chatbot-subtitle {
  margin: 2px 0 0;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.chatbot-log {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  scrollbar-width: thin;
  scrollbar-color: var(--surface-border) transparent;
}

.chatbot-log::-webkit-scrollbar {
  width: 6px;
}

.chatbot-log::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-log::-webkit-scrollbar-thumb {
  background: var(--surface-border);
  border-radius: var(--radius-pill);
}

.chatbot-log::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.chatbot-msg {
  max-width: 85%;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
}

.chatbot-msg-bot {
  align-self: flex-start;
  background: var(--surface-alt);
  border: 1px solid var(--surface-border);
  border-bottom-left-radius: 4px;
  color: var(--text);
}

.chatbot-msg-user {
  align-self: flex-end;
  background: var(--gradient-brand);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chatbot-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: var(--space-xs);
}

.chatbot-link {
  font-weight: 600;
  font-size: var(--fs-xs);
  color: var(--accent);
}

.chatbot-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  padding: 0 var(--space-lg) var(--space-md);
}

.chatbot-chip {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--surface-border);
  background: var(--surface-alt);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text);
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.chatbot-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chatbot-chip-accent {
  background: var(--gradient-brand);
  border-color: transparent;
  color: #fff;
}

.chatbot-input-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--surface-border);
}

.chatbot-input {
  flex: 1;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-pill);
  padding: 0.6rem 1rem;
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-sm);
}

.chatbot-input:focus {
  outline: none;
  border-color: var(--accent);
}

.chatbot-send {
  width: 40px;
  height: 40px;
  background: var(--gradient-brand);
  color: #fff;
  flex-shrink: 0;
}

.chatbot-send svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 480px) {
  .chatbot-widget {
    left: var(--space-md);
    bottom: var(--space-md);
  }
  .chatbot-panel {
    width: calc(100vw - 2 * var(--space-md));
  }
}
