/* Restrained motion and depth refinements for the MDM Exchange site. */

html {
  scroll-behavior: smooth;
}

body,
header,
main section,
footer {
  transition: background-color 240ms ease, color 240ms ease, border-color 240ms ease;
}

header {
  box-shadow: 0 1px 0 rgba(var(--shadow-rgb), 0.02),
    0 12px 36px rgba(var(--shadow-rgb), 0.035);
}

header a,
header button,
main a[style-hover],
main button,
details,
details summary {
  transition: transform 180ms ease, box-shadow 180ms ease,
    border-color 180ms ease, background-color 180ms ease, color 180ms ease,
    opacity 180ms ease;
}

header > div > a:first-child img {
  transition: transform 260ms cubic-bezier(.2, .8, .2, 1),
    filter 260ms ease;
}

header > div > a:first-child:hover img {
  transform: rotate(-3deg) scale(1.045);
  filter: drop-shadow(0 7px 10px rgba(var(--shadow-rgb), 0.12));
}

header nav a:hover {
  transform: translateY(-1px);
}

header button:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(var(--shadow-rgb), 0.09);
}

main a[style-hover]:hover,
main button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(var(--shadow-rgb), 0.13);
}

main a[style-hover]:active,
main button:active {
  transform: translateY(0);
}

main h1,
main h2 {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] main h1,
html[data-theme="dark"] main h2 {
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.14);
}

[data-hero-frame] {
  transform-origin: 52% 54%;
  transition: transform 520ms cubic-bezier(.2, .75, .2, 1),
    box-shadow 520ms ease, border-color 240ms ease !important;
}

[data-hero-frame]:hover {
  transform: translateY(-4px) rotateX(0deg) rotateY(0deg) !important;
  border-color: var(--border-3) !important;
  box-shadow: 0 36px 72px -26px rgba(var(--shadow-rgb), 0.42),
    0 8px 20px rgba(var(--shadow-rgb), 0.09) !important;
}

[data-hero-sources] > div {
  transition: transform 220ms ease, box-shadow 220ms ease,
    border-color 220ms ease !important;
}

[data-hero-sources] > div:hover {
  transform: translateX(4px);
  border-color: var(--gold-line) !important;
  box-shadow: 0 10px 24px rgba(var(--shadow-rgb), 0.11) !important;
}

/* Add gentle dimensionality to content cards without changing their layout. */
main section:not(:first-child)
  div[style*="border:1px solid var(--border)"][style*="border-radius"] {
  transition: transform 220ms cubic-bezier(.2, .75, .2, 1),
    box-shadow 220ms ease, border-color 220ms ease,
    background-color 220ms ease !important;
}

main section:not(:first-child)
  div[style*="border:1px solid var(--border)"][style*="border-radius"]:hover {
  transform: translateY(-2px);
  border-color: var(--border-2) !important;
  box-shadow: 0 13px 30px -18px rgba(var(--shadow-rgb), 0.28);
}

details:hover {
  border-color: var(--border-3) !important;
  box-shadow: 0 10px 28px -20px rgba(var(--shadow-rgb), 0.28);
}

details summary:hover {
  color: var(--gold-ink) !important;
}

input,
textarea,
select {
  transition: border-color 180ms ease, box-shadow 180ms ease,
    background-color 180ms ease;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--border-3) !important;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 3px rgba(244, 175, 20, 0.16);
  outline: none;
}

@media (min-width: 900px) {
  [data-hero-frame] {
    transform: perspective(1200px) rotateY(-1.25deg) rotateX(0.45deg);
  }
}

@media (prefers-reduced-motion: no-preference) {
  @keyframes polish-rise {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  [data-hero-grid] > div:first-child {
    animation: polish-rise 560ms cubic-bezier(.2, .75, .2, 1) both;
  }

  [data-hero-grid] > div:last-child {
    animation: polish-rise 620ms 90ms cubic-bezier(.2, .75, .2, 1) both;
  }

  [data-hero-sources] > div:nth-child(2),
  [data-hero-sources] > div:nth-child(4) {
    animation: drift 8.5s 600ms ease-in-out infinite;
  }
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

