/* C1 — STICKY RIBBON CTA — 3D button, presses on click */

.cta-ribbon {
  /* Anchor */
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0));
  transform: translate(-50%, 0);
  z-index: 40;

  /* Button form */
  width: min(560px, calc(100% - 32px));
  min-height: 56px;
  padding: 16px 28px;
  border: 2px solid var(--ink-primary);
  border-radius: 14px;
  background: var(--accent-block);
  color: var(--ink-primary);

  /* The tactile 3D — a hard solid shadow under the button ("stick out"),
     plus a soft atmospheric shadow for grounding. */
  box-shadow:
    0 6px 0 0 var(--ink-primary),
    0 10px 22px rgba(0, 0, 0, 0.18),
    0 2px 6px rgba(0, 0, 0, 0.10);

  /* Type */
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  line-height: 1.25;

  /* Layout */
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-sm);

  /* Slide-in entrance */
  opacity: 0;
  animation: ribbon-rise-in var(--dur-ribbon-slide) var(--ease-ribbon) 700ms forwards;

  /* Smooth press/hover transitions */
  transition:
    transform 90ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 90ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Hide the decorative brand atom inside the ribbon (was rendering badly on iOS). */
.cta-ribbon .block { display: none; }

@keyframes ribbon-rise-in {
  from { opacity: 0; transform: translate(-50%, 24px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Hover — even more "lifted" feel: shadow grows, button rises 1px more. */
@media (hover: hover) {
  .cta-ribbon:hover {
    transform: translate(-50%, -1px);
    box-shadow:
      0 7px 0 0 var(--ink-primary),
      0 14px 28px rgba(0, 0, 0, 0.22),
      0 3px 8px rgba(0, 0, 0, 0.12);
  }
}

/* Active — pressed in: button moves down 6px to "land" on its shadow,
   the hard shadow collapses to zero, atmospheric shadow tightens. */
.cta-ribbon:active {
  transform: translate(-50%, 6px);
  box-shadow:
    0 0 0 0 var(--ink-primary),
    0 2px 6px rgba(0, 0, 0, 0.16);
  transition-duration: 60ms;
}

.cta-ribbon:focus-visible {
  outline: 3px solid var(--ink-primary);
  outline-offset: 4px;
}

/* Hide on /install routes */
body[data-route="install"] .cta-ribbon { display: none; }

/* Body bottom padding so the floating button never covers the last content. */
body[data-cta="c1"] {
  padding-bottom: calc(108px + env(safe-area-inset-bottom, 0));
}

/* Mobile — slightly smaller button, tighter inset, full safe-area aware,
   shadow scaled down a touch so it doesn't dominate the small screen. */
@media (max-width: 720px) {
  .cta-ribbon {
    width: calc(100% - 24px);
    bottom: calc(16px + env(safe-area-inset-bottom, 0));
    padding: 14px 20px;
    font-size: 13px;
    min-height: 52px;
    border-radius: 12px;
    box-shadow:
      0 5px 0 0 var(--ink-primary),
      0 8px 18px rgba(0, 0, 0, 0.18),
      0 2px 4px rgba(0, 0, 0, 0.10);
  }
  .cta-ribbon:active {
    transform: translate(-50%, 5px);
    box-shadow:
      0 0 0 0 var(--ink-primary),
      0 2px 5px rgba(0, 0, 0, 0.14);
  }
  body[data-cta="c1"] {
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0));
  }
}

/* Reduced motion — no entrance animation, no transitions, but keep the 3D shadow.
   Press feedback degrades to instant outline change rather than animated translate. */
@media (prefers-reduced-motion: reduce) {
  .cta-ribbon {
    animation: none;
    opacity: 1;
    transform: translateX(-50%);
    transition: none;
  }
  .cta-ribbon:hover { transform: translateX(-50%); }
  .cta-ribbon:active {
    transform: translateX(-50%);
    box-shadow:
      0 0 0 0 var(--ink-primary),
      0 2px 6px rgba(0, 0, 0, 0.16);
  }
}
