/* sticky-bar.css — Component 2 */

/* Lock light tokens locally — see inline-card.css comment for rationale. */
.kk-sticky {
  --kk-primary:    #0C1C28;
  --kk-accent:     #967BB6;
  --kk-cream:      #FEF5F3;
  --kk-cream-deep: #FFFFFF;
  --kk-line:       #DDD5D0;
  --kk-text-mut:   #5A6770;

  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9000;
  font-family: var(--kk-font-body);
  color: var(--kk-primary);
  background: color-mix(in srgb, var(--kk-cream-deep) 78%, transparent);
  -webkit-backdrop-filter: blur(8px) saturate(1.1);
  backdrop-filter: blur(8px) saturate(1.1);
  border-top: 1px solid var(--kk-line);
  box-shadow:
    0 1px 2px rgba(12, 28, 40, 0.04),
    0 -4px 16px rgba(12, 28, 40, 0.06);
  transform: translateY(110%);
  transition: transform var(--kk-t-macro) var(--kk-ease);
  /* Mobile only */
  display: none;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (max-width: 768px) {
  .kk-sticky { display: block; }
}

.kk-sticky[data-visible="1"] {
  transform: translateY(0);
}

/* Scroll-driven animation: only kicks in for browsers that support it.
 * The transform default + class-toggle above remains the JS-friendly fallback. */
@supports (animation-timeline: view()) {
  @media (max-width: 768px) and (prefers-reduced-motion: no-preference) {
    .kk-sticky[data-driver="scroll"] {
      animation: kk-sticky-rise both;
      animation-timeline: scroll(root);
      animation-range: 40% 60%;
      transform: translateY(110%);
    }
    @keyframes kk-sticky-rise {
      to { transform: translateY(0); }
    }
  }
}

.kk-sticky__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  min-height: 64px;
}

.kk-sticky__offer {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--kk-primary);
}
.kk-sticky__offer strong {
  display: block;
  font-family: var(--kk-font-display);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--kk-text-mut);
  margin-bottom: 2px;
}

.kk-sticky__cta {
  appearance: none;
  border: 0;
  background: var(--kk-primary);
  color: var(--kk-cream-deep);
  font-family: var(--kk-font-display);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 12px 16px;
  border-radius: var(--kk-r-hard);
  min-height: 48px;
  min-width: 96px;
  cursor: pointer;
  transition: background var(--kk-t-micro) var(--kk-ease);
}
.kk-sticky__cta:hover {
  background: color-mix(in srgb, var(--kk-primary) 88%, var(--kk-accent));
}
.kk-sticky__cta:focus-visible {
  outline: 2px solid var(--kk-accent);
  outline-offset: 2px;
}

.kk-sticky__dismiss {
  appearance: none;
  background: transparent;
  border: 0;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--kk-text-mut);
  cursor: pointer;
  border-radius: var(--kk-r-hard);
  transition: color var(--kk-t-micro) var(--kk-ease),
              background var(--kk-t-micro) var(--kk-ease);
}
.kk-sticky__dismiss:hover {
  color: var(--kk-primary);
  background: color-mix(in srgb, var(--kk-accent) 12%, transparent);
}
.kk-sticky__dismiss:focus-visible {
  outline: 2px solid var(--kk-accent);
  outline-offset: 2px;
}
.kk-sticky__dismiss svg { width: 16px; height: 16px; }

/* Expanded form region */
.kk-sticky__expand {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--kk-t-macro) var(--kk-ease);
}
.kk-sticky[data-expanded="1"] .kk-sticky__expand {
  max-height: 280px;
}
.kk-sticky[data-expanded="1"] .kk-sticky__row {
  border-bottom: 1px solid var(--kk-line);
}

.kk-sticky__form {
  padding: 16px 16px 18px;
  display: grid;
  gap: 18px;
}
.kk-sticky__form .kk-field { padding-top: 16px; }
.kk-sticky__form .kk-field__input {
  font-size: 16px; /* prevent iOS zoom */
  border-bottom: 1px solid var(--kk-primary);
  background: transparent;
  width: 100%;
  appearance: none;
  border-radius: 0;
  padding: 6px 0 7px;
  border-left: 0; border-right: 0; border-top: 0;
  color: var(--kk-primary);
  font-family: var(--kk-font-body);
}
.kk-sticky__form .kk-field__input:focus {
  outline: none;
  border-bottom: 2px solid var(--kk-accent);
  padding-bottom: 6px;
}
.kk-sticky__form .kk-field__label {
  position: absolute;
  left: 0; top: 22px;
  font-size: 16px;
  color: var(--kk-text-mut);
  pointer-events: none;
  transform-origin: 0 0;
  transition: transform var(--kk-t-micro) var(--kk-ease),
              color var(--kk-t-micro) var(--kk-ease);
}
.kk-sticky__form .kk-field__input:focus ~ .kk-field__label,
.kk-sticky__form .kk-field__input:not(:placeholder-shown) ~ .kk-field__label {
  transform: translateY(-20px) scale(0.78);
}
.kk-sticky__form .kk-field__input:focus ~ .kk-field__label { color: var(--kk-accent); }

.kk-sticky__form .kk-form__submit-row { display: flex; }
.kk-sticky__form .kk-btn { width: 100%; }

.kk-sticky__form .kk-form__micro {
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--kk-text-mut);
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  .kk-sticky,
  .kk-sticky__expand,
  .kk-sticky__cta,
  .kk-sticky__dismiss { transition: none !important; }
  .kk-sticky[data-driver="scroll"] { animation: none !important; transform: none; }
}
