/* The UE2GD icon's blue (#3862c7, docs/wiki/assets/UE2GD_icon_color.svg) as the theme colour. */
:root > * {
  --md-primary-fg-color: #3862c7;
  --md-primary-fg-color--light: #6081d2;
  --md-primary-fg-color--dark: #2d4e9f;
  --md-accent-fg-color: #2d4e9f;
  --md-accent-fg-color--transparent: rgba(56, 98, 199, 0.1);
}

/* Lighter links on the dark scheme, so they stay readable. */
[data-md-color-scheme="slate"] {
  --md-typeset-a-color: #8aa4e3;
  --md-accent-fg-color: #8aa4e3;
  --md-accent-fg-color--transparent: rgba(138, 164, 227, 0.1);
}

/* Godot / Unreal video comparison (javascripts/compare.js): the Godot video on top, clipped at
   the divider (--pos); the Unreal video under it fills the rest. Each video's watermark is in its
   own side's bottom corner, so the play button sits on the divider instead. */
.md-typeset figure.ue2gd-compare {
  --pos: 50%;
  position: relative;
  display: block; /* Material styles figures as shrink-to-fit flex boxes: everything here is absolute */
  width: 100%;
  max-width: 100%;
  margin: 1.5em 0 0.5em;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 0.4rem;
  background: #000;
  cursor: ew-resize;
  user-select: none;
  touch-action: pan-y;
}
.md-typeset .ue2gd-compare video {
  position: absolute;
  max-width: none;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.md-typeset .ue2gd-compare video:first-child {
  z-index: 1;
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}
.md-typeset .ue2gd-compare__divider {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 3px;
  margin-left: -1.5px;
  background: #fff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.md-typeset .ue2gd-compare__divider::after {
  content: "\2039\00a0\203a"; /* < > */
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2.2rem;
  height: 2.2rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff;
  color: #3862c7;
  font-size: 1.2rem;
  line-height: 2.2rem;
  text-align: center;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
}
.md-typeset .ue2gd-compare__label {
  position: absolute;
  z-index: 3;
  top: 0.6rem;
  padding: 0.15rem 0.5rem;
  border-radius: 0.2rem;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  pointer-events: none;
}
.md-typeset .ue2gd-compare__label--left { left: 0.6rem; }
.md-typeset .ue2gd-compare__label--right { right: 0.6rem; }
/* Invisible, over the video: the keyboard and screen readers move the divider with it. */
.md-typeset .ue2gd-compare input[type=range] {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.md-typeset .ue2gd-compare:focus-within .ue2gd-compare__divider { background: #8aa4e3; }
.md-typeset .ue2gd-compare__play {
  position: absolute;
  z-index: 3;
  left: var(--pos);
  bottom: 0.6rem;
  transform: translateX(-50%);
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.75rem;
  cursor: pointer;
}
.md-typeset .ue2gd-compare__play:focus-visible { outline: 2px solid #8aa4e3; }
.md-typeset .ue2gd-compare__caption {
  margin-top: 0;
  font-size: 0.7rem;
  color: var(--md-default-fg-color--light);
  text-align: center;
}

/* Looping clips (foliage, particles) */
.md-typeset figure.ue2gd-clip {
  display: block;
  width: 100%;
  max-width: 100%;
}
.md-typeset figure.ue2gd-clip video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.2rem;
}
.md-typeset figure.ue2gd-clip figcaption {
  max-width: none;
  font-size: 0.7rem;
  color: var(--md-default-fg-color--light);
}

/* Store buttons not live yet: greyed out, with the reason as a tooltip (title). */
.md-typeset .md-button.ue2gd-button-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.md-typeset .md-button.ue2gd-button-disabled:hover {
  color: var(--md-primary-fg-color);
  background-color: transparent;
  border-color: currentcolor;
}
