/* Interaction timings are shared with the disclosure and menu controllers. */
:root {
  --motion-fast: 160ms;
  --motion-ui: 240ms;
  --motion-disclosure: 340ms;
  --motion-reveal: 480ms;
  --motion-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* A fixed gold base with two opacity layers avoids abrupt gradient swaps. */
.button-primary {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.button-primary::before,
.button-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
}

.button-primary::before {
  background: linear-gradient(115deg, #ead7aa, #d9bc7f 48%, #cba65f);
}

.button-primary::after {
  background: linear-gradient(115deg, #cfb173, #bf9c55 48%, #b68e46);
}

.button-primary:not(:disabled):active::after {
  opacity: 1;
}

.button-primary:not(:disabled):active:not(:focus-visible) {
  box-shadow: inset 0 2px 3px #57401826;
}

.button-primary:disabled::before,
.button-primary:disabled::after {
  opacity: 0;
}

@media (hover: hover) and (pointer: fine) {
  .button-primary:not(:disabled):hover::before {
    opacity: 1;
  }

  .button-primary:hover:not(:disabled):not(:focus-visible):not(:active) {
    border-color: #765821;
    box-shadow:
      inset 0 1px 0 #fff7,
      0 6px 16px #1d2e3226;
  }

  .service summary:hover .service-number,
  .service summary:hover .disclosure-icon,
  .faq-list summary:hover .disclosure-icon {
    color: var(--ink);
  }
}

/* Native details remain the fallback. JS only owns the measured height. */
.service,
.faq-list details {
  overflow-anchor: none;
}

.service summary,
.faq-list summary {
  border-radius: 6px;
}

.service summary:focus-visible,
.faq-list summary:focus-visible {
  outline-offset: -4px;
  box-shadow: none;
}

.disclosure-icon {
  position: relative;
  width: 24px;
  height: 24px;
  margin-left: auto;
  flex-shrink: 0;
  color: var(--muted);
}

.disclosure-icon::before,
.disclosure-icon::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 11px;
  width: 14px;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
}

.disclosure-icon::after {
  transform: rotate(90deg);
}

details[data-expanded="true"] > summary .disclosure-icon::after,
details:not([data-enhanced])[open] > summary .disclosure-icon::after {
  transform: rotate(0);
  opacity: 0;
}

details[data-expanded="true"] .service-number,
details[data-expanded="true"] > summary .disclosure-icon {
  color: var(--ink);
}

details[data-expanded="false"] > [data-disclosure-panel] {
  opacity: 0;
}

details[data-expanded="true"] > [data-disclosure-panel] {
  opacity: 1;
}

.mobile-menu a {
  border-radius: 6px;
}

.mobile-menu a:focus-visible {
  outline-offset: 2px;
}

.menu-glyph {
  position: relative;
  width: 20px;
  height: 20px;
}

.menu-glyph::before,
.menu-glyph::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
}

.menu-glyph::before {
  top: 6px;
}
.menu-glyph::after {
  top: 13px;
}
.menu-toggle[aria-expanded="true"] .menu-glyph::before {
  translate: 0 3.5px;
  rotate: 45deg;
}
.menu-toggle[aria-expanded="true"] .menu-glyph::after {
  translate: 0 -3.5px;
  rotate: -45deg;
}

@keyframes quiz-step-in {
  from {
    opacity: 0.3;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes quiz-open {
  from {
    opacity: 0.4;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Every transition, animation and press or hover movement. */
@media (prefers-reduced-motion: no-preference) {
  .button {
    transition:
      translate var(--motion-fast) var(--motion-ease),
      scale 120ms var(--motion-ease),
      background-color var(--motion-fast) ease,
      border-color var(--motion-fast) ease,
      box-shadow var(--motion-fast) ease;
  }

  .button-primary::before,
  .button-primary::after {
    transition: opacity var(--motion-fast) ease;
  }

  .button:not(:disabled):active {
    translate: 0 0;
    scale: 0.985;
    transition-duration: 100ms;
  }

  .button-primary:not(:disabled):active::after {
    transition-duration: 90ms;
  }

  /* Focus feedback is immediate; the outline is never animated. */
  .button:focus-visible {
    transition-property: translate, scale, background-color, border-color;
  }

  .button:disabled {
    translate: none;
    scale: none;
  }

  .button .icon,
  .text-link .icon,
  .hero-secondary .icon,
  .footer-contact .icon,
  .quiz-back .icon,
  .service-body > a .icon,
  .gallery-footer > a .icon {
    transition: translate var(--motion-fast) var(--motion-ease);
  }

  .icon-button,
  .carousel-button,
  .quiz-exit,
  .plain-button,
  .answer-summary button {
    transition:
      background-color var(--motion-fast) ease,
      border-color var(--motion-fast) ease,
      color var(--motion-fast) ease,
      scale 120ms var(--motion-ease);
  }

  .icon-button:not(:disabled):active,
  .carousel-button:not(:disabled):active,
  .quiz-exit:active {
    scale: 0.94;
  }

  .text-link,
  .hero-secondary,
  .footer-contact,
  .footer-socials a,
  .quiz-back {
    transition:
      color var(--motion-fast) ease,
      border-color var(--motion-fast) ease;
  }

  .desktop-nav a::after {
    transition: right var(--motion-ui) var(--motion-ease);
  }

  /* Touch screens receive press feedback without persistent hover movement. */
  @media (hover: hover) and (pointer: fine) {
    .button:not(:disabled):hover:not(:active) {
      translate: 0 -2px;
    }

    .button:hover .icon:has(use[href="#i-arrow"]),
    .text-link:hover .icon:has(use[href="#i-arrow"]) {
      translate: 3px 0;
    }

    .hero-secondary:hover .icon {
      translate: 3px 0;
    }

    .quiz-back:hover .icon {
      translate: -3px 0;
    }

    .button:hover .icon:has(use[href="#i-up-right"]),
    .text-link:hover .icon:has(use[href="#i-up-right"]),
    .footer-contact:hover .icon,
    .service-body > a:hover .icon,
    .gallery-footer > a:hover .icon {
      translate: 2px -2px;
    }

    .quiz-option:hover {
      translate: 0 -1px;
    }

    .service summary:hover h3 {
      translate: 3px 0;
    }
  }

  .service summary h3,
  .service-number {
    transition:
      translate var(--motion-ui) var(--motion-ease),
      color var(--motion-fast) ease;
  }

  .disclosure-icon {
    transition: color var(--motion-fast) ease;
  }

  .disclosure-icon::before,
  .disclosure-icon::after {
    transition:
      transform var(--motion-disclosure) var(--motion-ease),
      opacity var(--motion-ui) ease;
  }

  [data-disclosure-panel] {
    transition: opacity var(--motion-ui) ease;
  }

  /* Menu state changes stay synchronous; the controller animates its surface. */
  .mobile-menu a {
    transition:
      background-color var(--motion-fast) ease,
      color var(--motion-fast) ease;
  }

  .menu-glyph::before,
  .menu-glyph::after {
    transition:
      translate var(--motion-ui) var(--motion-ease),
      rotate var(--motion-ui) var(--motion-ease);
  }

  /* The incoming step animates without delaying navigation or keyboard focus. */
  .question-panel,
  .result-panel {
    animation: quiz-step-in var(--motion-ui) var(--motion-ease) both;
  }

  .quiz-dialog[open] .quiz-workspace {
    animation: quiz-open 280ms var(--motion-ease) both;
  }

  .quiz-option {
    transition:
      background-color var(--motion-fast) ease,
      border-color var(--motion-fast) ease,
      box-shadow var(--motion-fast) ease,
      translate var(--motion-fast) var(--motion-ease);
  }

  .quiz-option:active {
    translate: 0 0;
  }

  .radio-indicator,
  .step-circle,
  .step-link {
    transition:
      background-color var(--motion-fast) ease,
      border-color var(--motion-fast) ease,
      color var(--motion-fast) ease;
  }

  .radio-indicator::after {
    transition: transform var(--motion-ui) var(--motion-ease);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none;
    transition: none;
  }
}

@media (forced-colors: active) {
  .button-primary::before,
  .button-primary::after {
    display: none;
  }
}
