:root {
  --motion-out: cubic-bezier(0.22, 1, 0.36, 1);
  --motion-standard: cubic-bezier(0.25, 0.72, 0.3, 1);
  --motion-fast: 180ms;
  --motion-panel: 260ms;
}

.nav nav > a:not(.button) {
  position: relative;
  text-decoration: none;
}

.nav nav > a:not(.button)::after {
  position: absolute;
  inset: auto 0 4px;
  border-bottom: 1px solid currentColor;
  transform: scaleX(0);
  transform-origin: left;
  content: '';
  transition: transform var(--motion-fast) var(--motion-out);
}

.nav nav > a:not(.button):is(:hover, :focus-visible, [aria-current])::after {
  transform: scaleX(1);
}

/* Keep arrows out of the text flow and reserve the existing button padding. */
.hero .button, .hero .text-link, .plan .button, .cta .button {
  position: relative;
}

:is(.hero .button, .hero .text-link, .plan .button, .cta .button)::after {
  position: absolute;
  top: calc(50% - .55em);
  right: 6px;
  width: 8px;
  height: 1.1em;
  content: '';
  pointer-events: none;
  background: currentColor;
  clip-path: polygon(0 46%, 72% 46%, 42% 28%, 53% 22%, 100% 50%, 53% 78%, 42% 72%, 72% 54%, 0 54%);
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity var(--motion-fast) ease, transform var(--motion-fast) var(--motion-out);
}

.hero .text-link::after { right: -13px; }

:is(.hero .button, .hero .text-link, .plan .button, .cta .button):is(:hover, :focus-visible)::after {
  opacity: 1;
  transform: translateX(0);
}

.button {
  transition: background-color var(--motion-fast) ease, border-color var(--motion-fast) ease,
              box-shadow var(--motion-fast) ease, transform var(--motion-fast) var(--motion-out);
}

.button:active:not(:disabled) { transform: translateY(1px); }

.service-index article {
  transition: border-color var(--motion-fast) ease;
}

.service-index article h3 {
  transition: transform var(--motion-fast) var(--motion-out);
}

.service-index article:focus-within { border-color: #6c899a; }

#quote-form :is(input:not([type=checkbox], [type=radio]), select, textarea) {
  transition: background-color var(--motion-fast) ease, border-color var(--motion-fast) ease,
              box-shadow var(--motion-fast) ease;
}

#quote-form :is(input:not([type=checkbox], [type=radio]), select, textarea):focus {
  border-color: #597c92;
  box-shadow: 0 0 0 2px #d4e1e8;
}

#quote-form .service-options label > span { transition: color var(--motion-fast) ease; }
#quote-form .service-options label:has(input:checked) > span { color: var(--navy); }

@media (hover: hover) {
  .button:hover:not(:disabled) { box-shadow: 0 3px 8px #11263824; }
  .service-index article:hover { border-color: #6c899a; }
  .service-index article:hover h3 { transform: translateX(3px); }
}

@media (max-width: 680px) {
  .nav nav, .nav nav.open {
    display: flex;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-5px);
    transition: opacity var(--motion-fast) ease, transform var(--motion-panel) var(--motion-out),
                visibility 0s linear var(--motion-panel);
  }

  .nav nav.open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    transition-delay: 0s;
  }

  .nav nav > a:not(.button)::after { inset-inline-end: auto; width: 18px; }

  /* Retain a usable navigation list when browser scripting is unavailable. */
  .nav .fallback-nav {
    position: static;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    padding-top: 0;
  }

  .nav:has(.fallback-nav) {
    flex-wrap: wrap;
    padding-block: 14px;
  }

  .nav > noscript:has(.fallback-nav) { display: contents; }
  .nav .fallback-nav { flex-basis: 100%; }
  .nav:has(.fallback-nav) .menu-toggle { display: none; }
}

@media (min-width: 681px) {
  .nav > noscript { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  .hero-copy > :is(.eyebrow, h1, .lede, .actions), .responsive-showcase {
    animation: hero-enter 500ms var(--motion-out) var(--hero-delay, 0ms) backwards;
  }

  .hero-copy > h1 { --hero-delay: 48ms; }
  .hero-copy > .lede { --hero-delay: 94ms; }
  .hero-copy > .actions { --hero-delay: 140ms; }
  .responsive-showcase { --hero-delay: 115ms; }
  .hero-copy:focus-within > .actions, .responsive-showcase:focus-within { animation: none; }

  .section-reveal { animation: section-enter 420ms var(--motion-out); }
  #quote-care:not([hidden]) { animation: section-enter 240ms var(--motion-out); }
}

@supports selector(details::details-content) and (transition-behavior: allow-discrete) {
  .faq details::details-content {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--motion-panel) var(--motion-standard),
                content-visibility var(--motion-panel) allow-discrete;
  }

  .faq details[open]::details-content { grid-template-rows: 1fr; }
  .faq .faq-answer { min-block-size: 0; overflow: clip; }
}

@keyframes hero-enter {
  from { opacity: .74; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes section-enter {
  from { opacity: .72; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

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

  .faq details::details-content { transition: none; }

  .button:active:not(:disabled), .service-index article:hover h3 {
    transform: none;
  }
}
