/* ==========================================================================
   05. DETECTIVE COAT REVEAL & TECH STACK
   ========================================================================== */

.detective-scroll-track {
  position: relative;
  z-index: 1;
  height: 360vh;
}

.detective-stage {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(ellipse at 30% 50%, rgba(0, 255, 102, 0.06), transparent 60%);
}

.character-wrap {
  position: absolute;
  bottom: 0;
  left: 50%;
  --scene-shift-x: 0px;
  --scene-shift-y: 0px;
  --scene-scale: 1;
  transform: translate3d(calc(-50% - var(--scene-shift-x)), var(--scene-shift-y), 0) scale(var(--scene-scale));
  transform-origin: center bottom;
  will-change: transform;
  width: min(92vw, 60svh, 650px);
  aspect-ratio: 2 / 3;
  max-height: 90%;
  z-index: 2;
}

.character {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  user-select: none;
  -webkit-user-drag: none;
}

#characterA {
  opacity: 1;
  z-index: 1;
}

#characterB {
  opacity: 0;
  z-index: 2;
}

.coat-medals {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  image-rendering: pixelated;
}

.coat-medals.interactive {
  pointer-events: auto;
}

.medal-side {
  position: absolute;
  top: 34.5%;
  width: 17.5%;
  height: 30%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
  row-gap: 4px;
}

.medal-side.left {
  left: 17.8%;
}

.medal-side.right {
  right: 17.8%;
}

.medal {
  width: clamp(18px, 4.5vw, 36px);
  aspect-ratio: 0.7;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: center top;
  filter: drop-shadow(2px 2px 0 #000000);
  opacity: 0;
  scale: 0.25;
  cursor: pointer;
  transition: transform 0.15s steps(2), filter 0.15s steps(2);
}

.left .medal:nth-child(odd) {
  rotate: -8deg;
}

.left .medal:nth-child(even) {
  rotate: -3deg;
}

.right .medal:nth-child(odd) {
  rotate: 8deg;
}

.right .medal:nth-child(even) {
  rotate: 3deg;
}

.medal:hover {
  z-index: 15;
  transform: translateY(-3px) scale(1.18) !important;
  rotate: 0deg !important;
  filter: drop-shadow(2px 3px 0 #000000) drop-shadow(0 0 6px rgba(255, 255, 255, .75));
}

.medal::after {
  content: attr(data-tech);
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: #050505;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 2px 2px 0 #000;
  padding: 2px 6px;
  font-family: 'Silkscreen', monospace;
  font-size: 9px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s steps(2);
  z-index: 20;
}

.medal:hover::after {
  opacity: 1;
}

.medal-pin {
  width: 58%;
  height: 8%;
  min-height: 3px;
  background: #fff;
  border: 1.5px solid #000;
  box-shadow: inset 0 -1px 0 #b8c0c8;
  flex-shrink: 0;
  z-index: 3;
}

.ribbon {
  position: relative;
  width: 48%;
  height: 33%;
  margin-top: -1px;
  flex-shrink: 0;
  background: linear-gradient(90deg, #d4dbe2 0%, #fff 24%, #fff 38%, #1b1f24 38%, #1b1f24 62%, #fff 62%, #fff 76%, #d4dbe2 100%);
  border-left: 1.5px solid #000;
  border-right: 1.5px solid #000;
  clip-path: polygon(0 0, 100% 0, 100% 75%, 75% 75%, 75% 88%, 50% 100%, 25% 88%, 25% 75%, 0 75%);
  z-index: 2;
}

.ribbon::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, .18) 2px 3px);
  pointer-events: none;
}

.connector {
  width: 20%;
  height: 8%;
  margin-top: -2px;
  flex-shrink: 0;
  background: #fff;
  border: 1.5px solid #000;
  z-index: 1;
}

.medal-circle {
  position: relative;
  width: 82%;
  aspect-ratio: 1;
  margin-top: -2px;
  flex-shrink: 0;
  background: #fff;
  padding: 8%;
  display: grid;
  place-items: center;
  z-index: 3;
  clip-path: polygon(28% 0%, 72% 0%, 72% 10%, 90% 10%, 90% 28%, 100% 28%, 100% 72%, 90% 72%, 90% 90%, 72% 90%, 72% 100%, 28% 100%, 28% 90%, 10% 90%, 10% 72%, 0% 72%, 0% 28%, 10% 28%, 10% 10%, 28% 10%);
  box-shadow: inset -2px -2px 0 #b0b8c0;
}

.medal-core {
  position: relative;
  width: 100%;
  height: 100%;
  background: #080a0c;
  display: grid;
  place-items: center;
  overflow: hidden;
  clip-path: polygon(26% 0%, 74% 0%, 74% 12%, 88% 12%, 88% 26%, 100% 26%, 100% 74%, 88% 74%, 88% 88%, 74% 88%, 74% 100%, 26% 100%, 26% 88%, 12% 88%, 12% 74%, 0% 74%, 0% 26%, 12% 26%, 12% 12%, 26% 12%);
  box-shadow: inset 0 0 0 1.5px #fff;
}

.medal-core::before {
  content: "";
  position: absolute;
  top: 18%;
  left: 18%;
  width: 2px;
  height: 2px;
  background: rgba(255, 255, 255, .85);
  box-shadow: 2px 0 0 rgba(255, 255, 255, .45), 0 2px 0 rgba(255, 255, 255, .45);
  pointer-events: none;
}

.tech-logo {
  position: relative;
  z-index: 1;
  display: block;
  width: 58%;
  height: 58%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: brightness(0) invert(1);
}

.fallback {
  color: #fff;
  font-family: 'Silkscreen', monospace;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
}

.tech-card.medal-linked-hover {
  transform: translateY(-4px) !important;
  border-color: #ffffff !important;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.35) !important;
}

.tech-stack-panel {
  position: absolute;
  right: 4%;
  top: 54%;
  transform: translateY(-50%) translateX(40px);
  width: min(58vw, 760px);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  will-change: opacity, transform;
}

.tech-stack-panel.active {
  pointer-events: auto;
}

.tech-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  width: 100%;
  margin-top: 8px;
}

.tech-card {
  background-color: rgba(12, 16, 13, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px 10px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  aspect-ratio: 1 / 1.05;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
  opacity: 0;
  transform: translateY(15px);
  cursor: pointer;
  user-select: none;
  outline: none;
  will-change: transform;
}

.tech-card:hover,
.tech-card:focus-visible {
  transform: translateY(-8px) !important;
  border-color: rgba(74, 222, 128, 0.5) !important;
  box-shadow: 0 10px 24px rgba(74, 222, 128, 0.22), 0 0 18px rgba(0, 255, 102, 0.25) !important;
  background-color: rgba(40, 40, 40, 0.72) !important;
  outline: none;
}

.tech-card img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  transition: filter 0.3s ease, transform 0.3s ease;
}

.tech-card:hover img,
.tech-card:focus-visible img {
  filter: none;
  transform: scale(1.12);
}

.tech-card span {
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  color: #d1d5db;
  letter-spacing: 0.4px;
  text-align: center;
  transition: color 0.3s ease;
}

.tech-card:hover span,
.tech-card:focus-visible span {
  color: #4ade80;
}

.scroll-hint {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: 22px;
  width: 30px;
  height: 48px;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 8px;
  border: 1px solid rgba(0, 255, 102, 0.65);
  border-radius: 18px;
  opacity: 1;
  transition: opacity .25s ease;
  pointer-events: none;
  box-shadow: 0 0 10px rgba(0, 255, 102, 0.2);
}

.scroll-hint::before {
  content: "";
  width: 3px;
  height: 8px;
  border-radius: 3px;
  background: var(--neon);
  animation: scroll-wheel 1.45s cubic-bezier(.45, 0, .55, 1) infinite;
}

.scroll-hint::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  left: 50%;
  bottom: -11px;
  border-right: 1px solid var(--neon);
  border-bottom: 1px solid var(--neon);
  transform: translateX(-50%) rotate(45deg);
  animation: scroll-chevron 1.45s ease-in-out infinite;
}

@keyframes scroll-wheel {
  0% {
    transform: translateY(0);
    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  75% {
    transform: translateY(13px);
    opacity: .8;
  }

  100% {
    transform: translateY(13px);
    opacity: 0;
  }
}

@keyframes scroll-chevron {

  0%,
  100% {
    transform: translate(-50%, 0) rotate(45deg);
    opacity: .35;
  }

  50% {
    transform: translate(-50%, 4px) rotate(45deg);
    opacity: 1;
  }
}

