/* ============================================
   Klarti Landing — Polish layer
   Loads AFTER landing.css. Overrides + extensions only.
   Goals:
     1. Tighter typography, mono-numerals
     2. Refined micro-motion (no AI slop wiggles)
     3. New Features variants (editorial / bento / vs-table)
     4. Detail polish across all sections
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --accent-tint: color-mix(in oklch, var(--color-primary) 8%, transparent);
  --cta-tint: color-mix(in oklch, var(--color-cta) 8%, transparent);
  --grid-line: color-mix(in oklch, var(--color-border) 100%, transparent);
}

[data-theme="dark"] {
  --accent-tint: color-mix(in oklch, var(--color-primary) 14%, transparent);
  --cta-tint: color-mix(in oklch, var(--color-cta) 18%, transparent);
}

/* ----- Tighter rendering on numerals across the page ----- */
.mono { font-family: var(--font-mono); font-feature-settings: 'tnum' 1, 'cv11' 1; letter-spacing: -0.01em; }

html { font-feature-settings: 'ss01' 1, 'cv11' 1, 'cv02' 1; }

/* ============================================
   HERO — sharper rhythm
   ============================================ */
.hero h1 {
  letter-spacing: -0.035em;
  line-height: 1.05;
  font-weight: 600;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(180deg,
    transparent 0%, transparent 70%,
    var(--accent-tint) 70%, var(--accent-tint) 100%);
  padding: 0 0.08em;
  border-radius: 2px;
}

.hero__eyebrow {
  position: relative;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  padding: 6px 14px 6px 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.hero__eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--color-success);
  border-radius: 50%;
  display: inline-block;
  margin-right: 2px;
  animation: klarti-pulse 2.4s ease-in-out infinite;
}
.hero__eyebrow svg { display: none; } /* replaced by pulsing dot */

@keyframes klarti-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--color-success) 50%, transparent); }
  50%       { box-shadow: 0 0 0 6px color-mix(in oklch, var(--color-success) 0%, transparent); }
}

/* Sharper subtitle */
.hero__subtitle {
  font-size: clamp(1.0625rem, 1.4vw, 1.1875rem);
  line-height: 1.55;
  max-width: 540px;
}

/* Button refinements */
.btn { letter-spacing: -0.005em; }
.btn--primary { box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset, var(--shadow-md); }
.btn--secondary:hover { background: var(--cta-tint); }

/* Hero halo: more directional, softer */
.hero__split::before {
  inset: -120px -120px -60px;
  background:
    radial-gradient(ellipse 55% 50% at 78% 40%,
      color-mix(in oklch, var(--color-cta) 16%, transparent) 0%,
      transparent 60%),
    radial-gradient(ellipse 40% 35% at 20% 90%,
      color-mix(in oklch, var(--color-primary) 8%, transparent) 0%,
      transparent 65%);
  filter: blur(8px);
}

/* Screenshot — flatter, more refined frame */
.hero__screenshot {
  border-radius: var(--radius-xl) !important; /* Force rounding on all corners even at 1440px+ bleed */
  border: 1px solid var(--color-border);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.5) inset,
    var(--shadow-xl),
    0 32px 80px -32px color-mix(in oklch, var(--color-cta) 30%, transparent);
  overflow: hidden;
  isolation: isolate; /* Force layout context to keep border-radius mask with 3D transforms */
}
.hero__screenshot img {
  border-radius: inherit; /* Ensure image corners are clipped correctly */
}
[data-theme="dark"] .hero__screenshot {
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 32px 80px -16px rgba(0,0,0,0.6);
}

/* ============================================
   HEADER — finer
   ============================================ */
.header.scrolled {
  background: color-mix(in oklch, var(--color-bg) 88%, transparent);
  border-bottom: 1px solid var(--color-border);
  box-shadow: none;
}
[data-theme="dark"] .header.scrolled {
  background: color-mix(in oklch, var(--color-bg) 80%, transparent);
}
.logo { font-weight: 600; letter-spacing: -0.025em; }
.logo span {
  color: var(--color-primary);
  /* keep the tiny inline dot — matches the brand mark */
}

/* Nav links: animated underline */
.nav a:not(.btn) {
  position: relative;
  padding: 4px 0;
}
.nav a:not(.btn)::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-normal) var(--ease-out);
}
.nav a:not(.btn):hover::after { transform: scaleX(1); }

/* ============================================
   TRUST BAR — single rail with dividers
   ============================================ */
.trust { padding: 28px 0; }
.trust .container {
  gap: clamp(12px, 4vw, 64px);
  position: relative;
}
.trust__badge {
  background: transparent;
  border: none;
  padding: 4px 0;
  color: var(--color-text-secondary);
  font: 500 0.8125rem/1.3 var(--font-ui);
  letter-spacing: 0.005em;
  position: relative;
}
.trust__badge:hover { border: none; box-shadow: none; }
.trust__badge:not(:last-child)::after {
  content: '';
  position: absolute;
  right: calc(-1 * clamp(6px, 2vw, 32px));
  top: 50%; transform: translateY(-50%);
  width: 1px; height: 16px;
  background: var(--color-border);
}
.trust__icon {
  width: 26px; height: 26px;
  background: transparent;
  border: 1px solid var(--color-border);
}
.trust__icon svg { width: 13px; height: 13px; color: var(--color-success); }

@media (max-width: 640px) {
  .trust__badge:not(:last-child)::after { display: none; }
}

/* ============================================
   SECTION HEADER — typographic refinement
   ============================================ */
.section__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
}
.section__label::before {
  content: '';
  width: 16px; height: 1px;
  background: var(--color-primary);
}
.section__title {
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.12;
  text-wrap: balance;
}
.section__desc {
  text-wrap: pretty;
  max-width: 540px;
  margin: 0 auto;
}

/* ============================================
   HOW IT WORKS — richer step cards
   ============================================ */
.step {
  border-radius: 14px;
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
}
.step::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--color-cta);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform var(--duration-normal) var(--ease-out);
  border-radius: 14px 0 0 14px;
}
.step--active::before { transform: scaleY(1); background: var(--color-primary); }
.step__number {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0;
  background: var(--color-surface-inset);
  color: var(--color-text-secondary);
  border-radius: 8px;
  width: 36px; height: 36px;
  transition: all var(--duration-normal) var(--ease);
}
.step__number::before { content: '0'; }
.step--active .step__number {
  background: var(--color-primary);
  color: var(--color-primary-text);
  transform: scale(1.04);
}
.step__title { letter-spacing: -0.015em; font-weight: 600; }
.steps__extra {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--color-surface-inset);
  border: 1px dashed var(--color-border);
  font-size: 0.8125rem;
  line-height: 1.55;
}

/* ============================================
   FEATURES — 3 variants, default V3 (vs-table)
   Switch via [data-features-variant] on <body>
   ============================================ */

/* --- V2 BENTO (Единственная и основная раскладка) --- */
.features-v2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 768px) {
  .features-v2 {
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: minmax(180px, auto);
    gap: 16px;
  }
}
.bento {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: transform var(--duration-normal) var(--ease),
              border-color var(--duration-normal) var(--ease);
}
.bento:hover {
  transform: translateY(-3px);
  border-color: var(--color-cta);
}
.bento__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin-bottom: 10px;
}
.bento__title {
  font: 600 1.1875rem/1.25 var(--font-ui);
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}
.bento__desc {
  font: 400 0.9375rem/1.55 var(--font-ui);
  color: var(--color-text-secondary);
  max-width: 36ch;
}
@media (min-width: 768px) {
  .bento--lg { grid-column: span 4; grid-row: span 2; padding: 32px; }
  .bento--lg .bento__title { font-size: 1.625rem; line-height: 1.15; }
  .bento--lg .bento__desc { font-size: 1rem; max-width: 40ch; }
  .bento--md { grid-column: span 2; }
}

/* Mini-mock specifically for "Payment Matching" hero bento */
.bento__match {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 12px;
  padding: 16px;
  background: var(--color-surface-inset);
  border: 1px solid var(--color-border);
  border-radius: 12px;
}
.bento__match-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 64px;
}
.bento__match-card--paid { 
  background: var(--color-success-bg); 
  border-color: color-mix(in oklch, var(--color-success) 40%, transparent); 
}
.bento__match-amount {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--color-text);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.bento__match-card--paid .bento__match-amount { color: var(--color-success); }
.bento__match-meta {
  font-size: 0.75rem;
  color: var(--color-text-tertiary);
  margin-top: 4px;
  line-height: 1.3;
}
.bento__match-link {
  align-self: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--color-success);
  color: white;
  display: grid; place-items: center;
  transition: transform var(--duration-normal) var(--ease);
}
.bento__match-link svg { width: 14px; height: 14px; }

/* Narrow viewports: stack the mock vertically so both cards get full width */
@media (max-width: 560px) {
  .bento__match {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .bento__match-link {
    justify-self: center;
  }
}



/* ============================================
   SECURITY — refined diagram
   ============================================ */
.security-visual {
  background: var(--color-surface-inset);
  border: 1px solid var(--color-border);
}
.security-visual__node {
  background: var(--color-surface);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 0.875rem;
  text-align: left;
  position: relative;
}
.security-visual__node svg { width: 16px; height: 16px; color: var(--color-cta); }
.security-visual__node--highlight svg { color: var(--color-success); }
.security-visual__arrow {
  width: 1px; height: 24px;
  background: linear-gradient(180deg, transparent, var(--color-border), transparent);
  font-size: 0;
  position: relative;
}
.security-visual__arrow::after {
  content: '';
  position: absolute;
  left: 50%; top: 100%;
  width: 6px; height: 6px;
  border-right: 1px solid var(--color-text-tertiary);
  border-bottom: 1px solid var(--color-text-tertiary);
  transform: translate(-50%, -8px) rotate(45deg);
}
.security-visual__node--transit {
  border: 1px dashed var(--color-border);
  background: transparent;
  color: var(--color-text-tertiary);
  font-style: italic;
  font-size: 0.8125rem;
}
.security-visual__node--transit svg { color: var(--color-text-tertiary); }

/* ============================================
   FAQ — finer
   ============================================ */
.faq-item {
  border-radius: 10px;
  transition: border-color var(--duration-fast) var(--ease),
              background var(--duration-fast) var(--ease);
}
.faq-item.open {
  border-color: color-mix(in oklch, var(--color-cta) 30%, var(--color-border));
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}
.faq-question {
  padding: 20px 22px;
  font-weight: 500;
  font-size: 1.0625rem;
  letter-spacing: -0.005em;
}
.faq-question svg {
  width: 18px; height: 18px;
  padding: 4px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  box-sizing: content-box;
}
.faq-item.open .faq-question svg {
  border-color: var(--color-cta);
  color: var(--color-cta);
}

/* ============================================
   FOUNDER — quote treatment
   Keep ONLY the decorative open-quote mark.
   Don't wrap content in a card — it conflicts
   with the avatar circle bg in dark theme.
   ============================================ */
.founder-content {
  gap: 32px;
}
.founder blockquote {
  position: relative;
  padding-top: 4px;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
  text-wrap: pretty;
}
.founder blockquote::before {
  content: '\201C';
  position: absolute;
  left: -8px; top: -28px;
  font-family: 'Hanken Grotesk', Georgia, serif;
  font-size: 3.5rem;
  line-height: 1;
  color: var(--color-primary);
  opacity: 0.5;
  font-weight: 600;
}

/* ============================================
   FINAL CTA — bigger, more decisive
   ============================================ */
.final-cta { padding: clamp(72px, 10vw, 128px) 0; }
.final-cta h2 {
  font-size: clamp(1.875rem, 4vw, 2.75rem);
  letter-spacing: -0.03em;
  font-weight: 600;
  max-width: 22ch;
  margin-left: auto;
  margin-right: auto;
  text-wrap: balance;
}

/* ============================================
   SCROLL REVEAL — smoother, slight stagger
   ============================================ */
.reveal {
  transform: translateY(16px);
  transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal:nth-child(2) { transition-delay: 60ms; }
.reveal:nth-child(3) { transition-delay: 120ms; }
.reveal:nth-child(4) { transition-delay: 180ms; }
.reveal:nth-child(5) { transition-delay: 240ms; }

/* ============================================
   SCROLL-TOP & COOKIE — subtle refinements
   ============================================ */
.scroll-top { width: 44px; height: 44px; }
.cookie-banner__text { font-size: 0.8125rem; }

/* ============================================
   ANIMATED CTA SHIMMER (subtle)
   ============================================ */
.btn--primary {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.btn--primary::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(110deg,
    transparent 30%,
    rgba(255,255,255,0.18) 50%,
    transparent 70%);
  transform: translateX(-100%);
  transition: transform 800ms var(--ease-out);
  z-index: -1;
  pointer-events: none;
}
.btn--primary:hover::before { transform: translateX(100%); }

/* ============================================
   ARROW ICON IN PRIMARY BUTTONS — slight push on hover
   ============================================ */
.btn svg { transition: transform var(--duration-normal) var(--ease); }
.btn:hover svg { transform: translateX(2px); }

/* ============================================
   HOW IT WORKS: showcase image gets a frame
   ============================================ */
.steps__showcase img {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 4px;
  box-shadow: var(--shadow-lg);
}

/* ============================================
   RESPECT REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .hero__eyebrow::before { animation: none; }
  .btn--primary::before { display: none; }
  .step::before { transition: none; }
}
