/*
 * Magnetic declination calculator: the result, a two-needle diagram (true north
 * straight up, magnetic north turned by the declination), the facts, the form
 * and the bearing converter. Shared controls are in /css/tool-ui.css.
 */

.declination-label {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.declination .declination-value {
  margin-top: 8px;
  font-size: 22px;
}

.declination-diagram {
  position: relative;
  width: 148px;
  height: 148px;
  margin: 18px auto 0;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* Each needle is a line from the centre to the rim, turned about the centre. */
.declination-needle {
  position: absolute;
  bottom: 50%;
  left: 50%;
  width: 4px;
  height: 44%;
  margin-left: -2px;
  border-radius: 2px;
  transform-origin: 50% 100%;
}

.declination-needle::after {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  margin-left: -6px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 9px solid currentColor;
}

.declination-needle--true {
  color: var(--ink);
  background: var(--ink);
}

.declination-needle--magnetic {
  color: #c05621;
  background: #c05621;
  transform: rotate(var(--declination, 0deg));
  transition: transform 0.3s ease;
}

.declination-needle[hidden] {
  display: none;
}

.declination-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.declination-key::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-inline-end: 6px;
  border-radius: 50%;
  vertical-align: -1px;
}

.declination-key--true::before {
  background: var(--ink);
}

.declination-key--magnetic::before {
  background: #c05621;
}

@media (prefers-reduced-motion: reduce) {
  .declination-needle--magnetic {
    transition: none;
  }
}
