/* Insole anatomy and component functions */

.anatomy {
  position: relative;
  padding-block: clamp(96px, 9vw, 136px);
  overflow: hidden;
  border-top: 1px solid var(--color-border);
  background:
    linear-gradient(90deg, transparent 0, rgba(13, 143, 201, 0.035) 50%, transparent 100%),
    var(--color-bg);
  scroll-margin-top: var(--header-height);
}

.anatomy::before {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(var(--color-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-grid) 1px, transparent 1px);
  background-size: 72px 72px;
  content: "";
  pointer-events: none;
}

.anatomy__container {
  position: relative;
  width: min(calc(100% - 64px), var(--container));
  margin-inline: auto;
}

.anatomy-figure {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.anatomy-figure__toolbar {
  display: flex;
  min-height: 52px;
  padding-inline: 22px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-family: var(--font-tech);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.anatomy-figure__toolbar span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--color-accent-bright);
}

.anatomy-figure__toolbar i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent-bright);
  box-shadow: 0 0 10px var(--color-accent-bright);
}

.anatomy-figure__media {
  padding: clamp(14px, 2.3vw, 30px);
  background: var(--color-surface);
}

.anatomy-map {
  --anatomy-marker-color: var(--color-text-soft);
  position: relative;
  overflow: hidden;
  aspect-ratio: 1827 / 861;
  isolation: isolate;
  background: #ffffff;
}

.anatomy-map__base {
  display: block;
  width: 100%;
  height: auto;
}

.anatomy-map__base-mask {
  position: absolute;
  z-index: 1;
  top: 2.5%;
  left: 28%;
  width: 20%;
  height: 20%;
  background: #ffffff;
  pointer-events: none;
}

.anatomy-map__filters {
  position: absolute;
  pointer-events: none;
}

.anatomy-map__detail {
  position: absolute;
  z-index: 2;
  inset: 0;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity var(--duration-fast) ease,
    transform var(--duration-fast) ease;
  pointer-events: none;
}

.anatomy-map__detail.is-active {
  opacity: 1;
  transform: translateY(0);
}

.anatomy-map__asset {
  position: absolute;
  display: block;
  max-width: none;
  height: auto;
}

.anatomy-map__connector {
  filter: url("#anatomy-connector-color");
}

.anatomy-map__label--metatarsal-upper {
  top: 3.8%;
  left: 0;
  width: 23%;
}

.anatomy-map__connector--metatarsal-upper {
  top: 31.9%;
  left: 23.1%;
  width: 12.4%;
}

.anatomy-map__label--metatarsal-lower {
  top: 52.6%;
  left: 0.3%;
  width: 23%;
}

.anatomy-map__connector--metatarsal-lower {
  top: 60.5%;
  left: 23.2%;
  width: 18.3%;
}

.anatomy-map__label--arch-support {
  top: 67.3%;
  left: 37.5%;
  width: 25.5%;
}

.anatomy-map__connector--arch-support {
  top: 51.7%;
  left: 46.47%;
  width: 0.3%;
}

.anatomy-map__label--heel-cup {
  top: 1.5%;
  left: 80.9%;
  width: 21.5%;
}

.anatomy-map__connector--heel-cup {
  top: 40.6%;
  left: 72.27%;
  width: 18.5%;
}

.anatomy-map__label--heel-pad {
  top: 63.9%;
  left: 80.7%;
  width: 23%;
}

.anatomy-map__connector--heel-pad {
  top: 78.15%;
  left: 63.5%;
  width: 16.3%;
}

.anatomy-map__label--sole-fit {
  top: 75.2%;
  left: 30%;
  width: 22%;
  aspect-ratio: 345 / 152;
  background-image: url("../assets/鞋墊各部位功能底圖.png");
  background-position: 35.4% 4.7%;
  background-repeat: no-repeat;
  background-size: 529.6% 566.4%;
}

.anatomy-map__marker {
  position: absolute;
  z-index: 3;
  top: var(--marker-y);
  left: var(--marker-x);
  width: 1.95%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--anatomy-marker-color);
  pointer-events: none;
}

.anatomy-map__hotspot {
  position: absolute;
  top: var(--hotspot-y);
  left: var(--hotspot-x);
  z-index: 4;
  width: clamp(22px, 2.5%, 48px);
  padding: 0;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  outline: 2px solid transparent;
  outline-offset: 2px;
  background: transparent;
  cursor: pointer;
}

.anatomy-map__hotspot::after {
  position: absolute;
  inset: 19%;
  border: 2px solid rgba(41, 73, 93, 0.86);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(41, 73, 93, 0.2);
  content: "";
  opacity: 0;
  transform: scale(0.72);
  transition:
    opacity var(--duration-fast) ease,
    transform var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
}

.anatomy-map__hotspot:hover::after,
.anatomy-map__hotspot:focus-visible::after {
  box-shadow: 0 0 0 6px rgba(41, 73, 93, 0.14);
  opacity: 1;
  transform: scale(1);
}

.anatomy-map__hotspot:focus-visible {
  outline-color: var(--color-cyan);
}

.anatomy-map__hint {
  margin: 16px 0 0;
  color: var(--color-text-muted);
  font-size: 13px;
  line-height: 1.7;
}

.anatomy-map__controls {
  display: flex;
  margin-top: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.anatomy-map__controls button {
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.66);
  color: var(--color-text-soft);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color var(--duration-fast) ease,
    background var(--duration-fast) ease,
    color var(--duration-fast) ease;
}

.anatomy-map__controls button:hover,
.anatomy-map__controls button[aria-pressed="true"] {
  border-color: rgba(0, 119, 184, 0.48);
  background: rgba(0, 119, 184, 0.08);
  color: var(--color-cyan);
}

.anatomy-map__controls button:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: 2px;
}

@media (max-width: 1000px) {
  .anatomy__container {
      width: min(calc(100% - 48px), var(--container));
    }
}

@media (max-width: 640px) {
  .anatomy {
      padding-block: 72px;
    }

  .anatomy::before {
      background-size: 48px 48px;
    }

  .anatomy__container {
      width: calc(100% - 40px);
    }

  .anatomy-figure {
      width: calc(100% + 16px);
      margin-inline: -8px;
    }

  .anatomy-figure__toolbar {
      min-height: 48px;
      padding-inline: 14px;
    }

  .anatomy-figure__toolbar span:last-child {
      display: none;
    }

  .anatomy-figure__media {
      padding: 6px;
    }

  .anatomy-map__hint {
      margin-top: 12px;
    }

  .anatomy-map__controls {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

  .anatomy-map__controls button {
      padding-inline: 8px;
      font-size: 12px;
    }
}
