/*
   The Qiblah compass ([data-qibla-compass]), used on the prayer times page and the Qiblah guide. The dial shows
   north at the top and a gold needle to the Kaaba; with a phone's compass the dial turns so its N points north
   and the needle points the way to face, glowing when the phone is lined up. Only transform and opacity animate.
*/

.qc {
  display: grid;
  justify-items: center;
  gap: .6rem;
  text-align: center;
}
/* A compass is the same in every language: the dial never mirrors. */
.qc-dial-wrap {
  position: relative;
  direction: ltr;
  width: min(220px, 70vw);
  aspect-ratio: 1;
}
.qc-dial {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--ip-surface) 0 58%, transparent 59%),
    conic-gradient(from 0deg, rgba(230, 184, 92, .16), rgba(31, 122, 99, .12), rgba(230, 184, 92, .16));
  box-shadow: inset 0 0 0 1px var(--ip-line), 0 18px 40px -24px rgba(13, 59, 41, .55);
  transform: rotate(var(--qc-turn, 0deg));
  transition: transform .25s linear;
}
.qc-dial svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.qc-ring {
  fill: none;
  stroke: var(--ip-line-strong);
  stroke-width: 1.2;
}
.qc-ring--inner { stroke-dasharray: 2 4; }
.qc-tick { stroke: var(--ip-muted); stroke-width: 1; opacity: .55; }
.qc-tick--major { stroke: var(--ip-ink-2); stroke-width: 2; opacity: .9; }
.qc-letter {
  fill: var(--ip-ink-2);
  font-family: var(--ip-font-display);
  font-size: 15px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
}
.qc-letter--n { fill: #c0392b; }
[data-theme="dark"] .qc-letter--n { fill: #ff8a73; }
.qc-needle {
  position: absolute;
  inset: 0;
  transform: rotate(var(--bearing, 0deg));
}
.qc-needle-line {
  position: absolute;
  left: calc(50% - 2px);
  top: 18%;
  width: 4px;
  height: 32%;
  border-radius: 4px;
  background: linear-gradient(180deg, #e6b85c, #b8892b);
  box-shadow: 0 0 12px rgba(230, 184, 92, .6);
}
.qc-needle::after {
  content: "";
  position: absolute;
  top: calc(50% - 8px);
  left: calc(50% - 8px);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ip-surface);
  border: 3px solid #b8892b;
}
.qc-kaaba {
  position: absolute;
  top: 6%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-left: -15px;
  border-radius: 8px;
  background: #1c1c1c;
  color: #e6b85c;
  font-size: .5rem;
  box-shadow: 0 0 0 3px rgba(230, 184, 92, .55), 0 6px 14px -4px rgba(0, 0, 0, .5);
  transform: rotate(calc(var(--bearing, 0deg) * -1 - var(--qc-turn, 0deg)));
}
.qc-kaaba::before {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 9px;
  height: 3px;
  background: #e6b85c;
}
.qc-kaaba i { opacity: 0; }
.qc-heading-mark {
  position: absolute;
  top: -10px;
  left: 50%;
  width: 0;
  height: 0;
  margin-left: -9px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 13px solid var(--ip-primary);
  opacity: 0;
  transition: opacity .3s var(--ip-ease);
}
.qc.is-live .qc-heading-mark { opacity: 1; }
.qc.is-aligned .qc-dial {
  box-shadow: inset 0 0 0 2px #2eb872, 0 0 0 8px rgba(46, 184, 114, .18), 0 18px 40px -20px rgba(46, 184, 114, .8);
}
.qc.is-aligned .qc-heading-mark { border-top-color: #2eb872; }
.qc-readout {
  display: grid;
  gap: .05rem;
}
.qc-degrees {
  font-family: var(--ip-font-display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.05;
  color: var(--ip-ink);
  font-variant-numeric: tabular-nums;
}
.qc-point { font-weight: 600; color: var(--ip-primary); }
.qc-distance { font-size: .85rem; color: var(--ip-muted); }
.qc-status {
  max-width: 30ch;
  margin: 0;
  font-size: .82rem;
  line-height: 1.5;
  color: var(--ip-muted);
}
.qc.is-aligned .qc-status { color: var(--ip-success); font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .qc-dial,
  .qc-heading-mark { transition: none; }
}
