/* Pointer and keyboard feedback for the homepage. */
:root {
  --feedback-ease: cubic-bezier(.22, 1, .36, 1);
  --card-ease: cubic-bezier(.25, .8, .25, 1);
}

.button, .text-link, .preview-footer a, .sector-link, .faq-list summary {
  transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.button, .text-link, .preview-footer a, .request-footnote a, .sector-link {
  --arrow-x: 4px;
  --arrow-y: 0px;
}

.hero-actions .text-link, .sample-callout .button, .preview-footer a,
.faq-layout .text-link, .request-footnote a {
  --arrow-x: 3px;
  --arrow-y: -3px;
}

@media (prefers-reduced-motion: no-preference) {
  :is(.button, .text-link, .preview-footer a, .request-footnote a, .sector-link) > .icon,
  .sector-link > span:nth-child(2), .faq-list summary .icon {
    transition: transform 240ms var(--feedback-ease);
  }

  :is(.button, .text-link, .preview-footer a, .request-footnote a, .sector-link):focus-visible > .icon {
    transform: translate(var(--arrow-x), var(--arrow-y));
  }

  .sector-link:focus-visible > span:nth-child(2) { transform: translateX(6px); }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  :is(.button, .text-link, .preview-footer a, .request-footnote a, .sector-link):hover:not(:disabled) > .icon {
    transform: translate(var(--arrow-x), var(--arrow-y));
  }

  .sector-link:hover > span:nth-child(2) { transform: translateX(6px); }
}

.sector-link:focus-visible { color: var(--cobalt); background: var(--gallery); }
.faq-list summary:focus-visible { color: var(--cobalt); }

/* Montiso's practice-card expansion, with room for each report description at every width. */
@media (hover: hover) and (pointer: fine) {
  .feature {
    transition: background-color 360ms var(--card-ease), color 180ms ease;
  }

  .feature :is(p, .feature-label, .feature-number, .icon-box) {
    transition: color 180ms ease, border-color 180ms ease, background-color 360ms var(--card-ease);
  }

  .feature:hover { background: var(--cobalt); color: white; }
  .feature:hover :is(p, .feature-number, .feature-label) { color: white; }
  .feature:hover .feature-label { border-color: rgb(255 255 255 / 45%); }
  .feature:hover .icon-box { color: white; background: rgb(255 255 255 / 15%); }
}

@media (min-width: 1050px) and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .feature-grid {
    --card-gap: clamp(12px, 1.7vw, 24px);
    --card-pad: clamp(23px, 2.4vw, 36px);
    container-type: inline-size;
    gap: var(--card-gap);
    grid-template-columns: 1fr 1fr 1fr;
    transition: grid-template-columns 560ms var(--card-ease);
  }

  .feature-grid:has(.feature:first-child:hover) { grid-template-columns: 1.24fr .88fr .88fr; }
  .feature-grid:has(.feature:nth-child(2):hover) { grid-template-columns: .88fr 1.24fr .88fr; }
  .feature-grid:has(.feature:last-child:hover) { grid-template-columns: .88fr .88fr 1.24fr; }

  /* Size the copy to the narrowest track so the row stays the same height as cards open. */
  .feature {
    --copy-width: calc(29.3cqi - .586 * var(--card-gap) - 2 * var(--card-pad));
    min-width: 0;
    padding: var(--card-pad);
  }
  .feature h3 { max-inline-size: min(19ch, var(--copy-width)); }
  .feature p, .feature-label { max-inline-size: var(--copy-width); }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .feature .icon-box .icon { transition: transform 560ms var(--card-ease); }
  .feature:hover .icon-box .icon { transform: scale(1.15); }
  .feature:hover .icon-box .icon :is(path, circle) {
    stroke-dasharray: 82;
    animation: draw-feature-icon 680ms cubic-bezier(.4, 0, .2, 1) 140ms backwards;
  }
}

@keyframes draw-feature-icon {
  from { stroke-dashoffset: 82; }
  to { stroke-dashoffset: 0; }
}

/* Keep the disclosure native; supported engines interpolate the answer's actual height. */
@supports (interpolate-size: allow-keywords) and selector(details::details-content) {
  @media (prefers-reduced-motion: no-preference) {
    .faq-list details { interpolate-size: allow-keywords; }
    .faq-list details::details-content {
      display: flow-root;
      block-size: 0;
      overflow: hidden;
      transition: block-size 440ms var(--feedback-ease),
                  content-visibility 440ms allow-discrete;
    }
    .faq-list details[open]::details-content { block-size: auto; }
  }
}
