/* CCF motion and control feedback. Reuses the live site's colour variables. */
:root {
  --ccf-fx-quick: 150ms;
  --ccf-fx-ease: cubic-bezier(.2, 0, 0, 1);
}

/* The older observer can still mark elements. Keep its pending cards readable. */
.ccf-reveal-pending {
  opacity: 1;
  transform: none;
}

header.ccf-fx-scrolled {
  box-shadow: 0 4px 14px color-mix(in srgb, var(--ink) 18%, transparent);
}

:is(.hero-actions a, header summary, .activity-cover, .card .link, .ccf-to-top, .ccf-fx-mobile-contact):focus-visible,
.contact-form :is(input, textarea, button):focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.contact-form :is(input[type="text"], input[type="email"], textarea):focus-visible {
  border-color: var(--blue);
}

.contact-form :is(input, textarea):user-invalid {
  box-shadow: inset 0 0 0 1px var(--pink);
}

.ccf-fx-mobile-contact {
  display: none;
}

@media (max-width: 760px) {
  a.ccf-fx-mobile-contact:not([hidden]) {
    position: fixed;
    inset-inline-start: max(16px, env(safe-area-inset-left));
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 39;
    display: inline-flex;
    max-width: calc(100% - 100px);
    min-height: 44px;
    padding: 8px 18px;
    text-align: center;
  }
}

@media (prefers-reduced-motion: no-preference) {
  header {
    transition: box-shadow var(--ccf-fx-quick) var(--ccf-fx-ease);
  }

  :is(.hero-actions .btn, .header-actions .btn:not(.header-festival), .contact-form button[type="submit"], .ccf-fx-mobile-contact):active {
    transform: translateY(2px) scale(.98);
    box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 80%, var(--pink));
  }

  @media (hover: hover) and (pointer: fine) {
    .activity-cover img {
      transition: transform 240ms var(--ccf-fx-ease);
    }

    .activity-card:hover .activity-cover img {
      transform: scale(1.035);
    }

    :is(.service-cards .card, .activity-cards .card):hover {
      transform: translateY(-2px);
    }
  }

  .ccf-fx-reveal {
    animation: ccf-fx-settle 240ms var(--ccf-fx-ease);
  }

  .ccf-fx-reveal:focus-within {
    animation: none;
  }

  @keyframes ccf-fx-settle {
    from { translate: 0 8px; }
    to { translate: 0 0; }
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  .btn:is(:hover, :active),
  .ccf-to-top:not(.is-visible) {
    transform: none !important;
  }
}

@media print {
  .ccf-fx-mobile-contact {
    display: none !important;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .ccf-fx-arriving::after {
    position: absolute;
    inset: auto 0 0;
    z-index: 0;
    height: 2px;
    content: "";
    pointer-events: none;
    background: linear-gradient(90deg, transparent, var(--pink), var(--yellow), var(--blue), transparent);
    animation: ccf-fx-arrival 320ms ease-out both;
  }

  .home-page .hero .ccf-fx-hero-accent {
    animation: ccf-fx-settle 260ms var(--ccf-fx-ease);
  }

  @keyframes ccf-fx-arrival {
    0%, 100% { opacity: 0; }
    34% { opacity: .72; }
  }

  @media (hover: hover) and (pointer: fine) {
    .activity-cover:hover {
      outline: 2px solid var(--blue);
      outline-offset: -2px;
    }
  }

  .ccf-fx-ripple-host {
    isolation: isolate;
  }

  .ccf-fx-ripple-host.ccf-fx-static-host {
    position: relative;
  }

  .ccf-fx-ripple {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
  }

  .ccf-fx-ripple::before {
    position: absolute;
    left: var(--ccf-fx-x);
    top: var(--ccf-fx-y);
    width: var(--ccf-fx-diameter);
    aspect-ratio: 1;
    border-radius: 50%;
    content: "";
    background: radial-gradient(circle, var(--ink), transparent 70%);
    animation: ccf-fx-ripple-out 450ms var(--ccf-fx-ease) both;
  }

  @keyframes ccf-fx-ripple-out {
    from { transform: translate(-50%, -50%) scale(.08); opacity: .28; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 0; }
  }

  /* The live 4:3 cover reserves the geometry before the image request. */
  .activity-cover.ccf-fx-photo-loading {
    position: relative;
  }

  .activity-cover.ccf-fx-photo-loading::after {
    position: absolute;
    inset: 0;
    content: "";
    pointer-events: none;
    background: linear-gradient(115deg, var(--paper) 20%, var(--rose) 49%, var(--paper) 78%);
    background-size: 240% 100%;
    animation: ccf-fx-photo-sheen 820ms ease-out both;
  }

  @keyframes ccf-fx-photo-sheen {
    from { background-position: 100% 50%; }
    to { background-position: 0 50%; }
  }
}
