/* Coloured world markers: position glyphs here, effect areas in marker-effects.css. The style
 * picker's dialog is the markers plugin's (plugins/markers/picker.css); its swatches use these rules. */
.table-object[data-kind="marker"] > .table-marker {
  display: grid;
  place-items: center;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  isolation: isolate;
}

.table-marker__glyph {
  --mk: var(--marker-color, var(--table-accent));
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: var(--mk);
  stroke: none;
  pointer-events: none;
}

/* The parts of a position marker (markerStyles.js), all tinted from the marker colour. */
.table-marker__glyph .mk-m { fill: var(--mk); }
.table-marker__glyph .mk-l { fill: color-mix(in srgb, var(--mk) 55%, #fff); }
.table-marker__glyph .mk-d { fill: color-mix(in srgb, var(--mk) 62%, #000); }
.table-marker__glyph .mk-dd { fill: color-mix(in srgb, var(--mk) 38%, #000); }
.table-marker__glyph .mk-s { fill: #fff; opacity: 0.8; }
.table-marker__glyph .mk-soft { opacity: 0.62; }
.table-marker__glyph .mk-s.mk-soft { opacity: 0.5; }
.table-marker__glyph .mk-metal { fill: #d3d8e0; }
.table-marker__glyph .mk-metal-d { fill: #69707a; }
.table-marker__glyph .mk-gold { fill: #f2cc5c; }
.table-marker__glyph .mk-ink { fill: rgba(16, 16, 20, 0.9); }
.table-marker__glyph .mk-bone { fill: color-mix(in srgb, var(--mk) 34%, #f3ead6); }
.table-marker__glyph .mk-bone-d { fill: color-mix(in srgb, var(--mk) 40%, #85785f); }

.table-marker__glyph .mk-o,
.table-marker__glyph .mk-outline {
  stroke: rgba(var(--table-black-rgb, 0, 0, 0), 0.62);
  stroke-width: 1.1;
  stroke-linejoin: round;
}

.table-marker__glyph .mk-outline { fill: none; }

.table-marker__glyph .mk-rim {
  fill: none;
  stroke: color-mix(in srgb, var(--mk) 40%, #fff);
  stroke-width: 1;
  stroke-linecap: round;
  opacity: 0.85;
}

/* A soft ground shadow under a position marker on the table and in the picker. */
.table-object[data-kind="marker"] > .table-marker[data-group="position"],
.table-marker-picker__swatch--position {
  position: relative;
}

.table-marker-picker__swatch--position {
  width: 48px;
  height: 48px;
}

.table-object[data-kind="marker"] > .table-marker[data-group="position"]::before,
.table-marker-picker__swatch--position::before {
  position: absolute;
  right: 16%;
  bottom: 1%;
  left: 16%;
  height: 16%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--table-black-rgb, 0, 0, 0), 0.5),
    rgba(var(--table-black-rgb, 0, 0, 0), 0.2) 62%, transparent);
  content: "";
  pointer-events: none;
}

/* Idle motion: the whole SVG moves (transform only); its shadow follows a floating marker. */
.table-marker > .table-marker__glyph,
.table-marker-picker__swatch--position > .table-marker__glyph {
  animation-delay: var(--marker-phase, 0s);
  animation-direction: alternate;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}

.table-marker > .table-marker__glyph--bob,
.table-marker-picker__swatch--position > .table-marker__glyph--bob {
  animation-name: table-marker-bob;
  animation-duration: 1.7s;
}

.table-marker > .table-marker__glyph--sway,
.table-marker-picker__swatch--position > .table-marker__glyph--sway {
  transform-origin: 50% 88%;
  animation-name: table-marker-sway;
  animation-duration: 2.2s;
}

.table-marker > .table-marker__glyph--breathe,
.table-marker-picker__swatch--position > .table-marker__glyph--breathe {
  transform-origin: 50% 84%;
  animation-name: table-marker-breathe;
  animation-duration: 2.4s;
}

.table-marker:has(> .table-marker__glyph--bob)::before,
.table-marker-picker__swatch--position:has(> .table-marker__glyph--bob)::before {
  animation: table-marker-shadow 1.7s ease-in-out infinite alternate;
}

@keyframes table-marker-bob {
  from { transform: translateY(0); }
  to { transform: translateY(-8%); }
}

@keyframes table-marker-sway {
  from { transform: rotate(-3deg); }
  to { transform: rotate(3deg); }
}

@keyframes table-marker-breathe {
  from { transform: scale(0.97); }
  to { transform: scale(1.03); }
}

@keyframes table-marker-shadow {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0.7; transform: scale(0.84); }
}

/* Reduced effects: markers stand still (their rest pose is the drawing itself). `!important`, as
   in marker-effects.css: the `:has()` shadow rule is as specific as these. */
body.table-effect-off--image-effects .table-marker > .table-marker__glyph,
body.table-effect-off--image-effects .table-marker::before,
body.table-effect-off--image-effects .table-marker-picker__swatch--position > .table-marker__glyph,
body.table-effect-off--image-effects .table-marker-picker__swatch--position::before,
.is-effects-reduced .table-marker > .table-marker__glyph,
.is-effects-reduced .table-marker::before,
.is-effects-reduced .table-marker-picker__swatch--position > .table-marker__glyph,
.is-effects-reduced .table-marker-picker__swatch--position::before {
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .table-marker > .table-marker__glyph,
  .table-marker::before,
  .table-marker-picker__swatch--position > .table-marker__glyph,
  .table-marker-picker__swatch--position::before { animation: none !important; }
}
