/* ============================================
   OBSTACLES (Rocks, Bushes, Twigs)
   ============================================ */
.obstacle {
    position: absolute;
    box-sizing: border-box;
    pointer-events: auto;
    /* Enable for accessibility */
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    filter: drop-shadow(1px 3px 2px var(--color-shadow-medium));
}

.obstacle.rock {
    background-image: url('../assets/rock.svg');
}

.obstacle.bush {
    background-image: url('../assets/bush.svg');
}

.obstacle.pond {
    background-image: url('../assets/pond.svg');
    background-size: 100% 100%;
}

.obstacle.twig::before {
    content: '';
    position: absolute;
    inset: 50% auto auto 50%;
    width: var(--twig-length);
    height: 24px;
    background: url('../assets/twig.svg') center / 100% 100% no-repeat;
    transform: translate(-50%, -50%) rotate(var(--twig-angle));
}

/* ============================================
   ITEMS (Collectibles: apples, pears)
   ============================================ */
.collectible {
    position: absolute;
    width: 32px;
    /* WCAG 2.5.8: min 24px */
    height: 32px;
    box-sizing: border-box;
    display: grid;
    place-items: center;
    /* Creates 44px total hit area with pseudo-element */
}

.collectible::before {
    content: '';
    position: absolute;
    width: 44px;
    height: 44px;
    top: -8px;
    left: -8px;
    border-radius: 50%;
    /* Debug: background: var(--color-debug-hit-area); */
}

.collectible .game-icon {
    width: 100%;
    height: 100%;
    filter: drop-shadow(1px 2px 2px var(--color-shadow-medium));
}

/* ============================================
   NPCs
   ============================================ */
.npc {
    position: absolute;
    min-width: 56px;
    min-height: 56px;
    border-radius: var(--radius-md);
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.2s;
}

.npc:not(.completed):hover {
    transform: scale(1.1);
}

.npc:focus-visible {
    outline: 3px solid var(--color-focus-ring);
    outline-offset: 2px;
}

.npc-home {
    position: absolute;
    inset: -5%;
    pointer-events: none;
    filter: drop-shadow(1px 2px 2px var(--color-shadow-medium));
}

.npc-home > svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.npc-home > .animal-art {
    inset: 27% 18% auto;
    width: 64%;
    height: 58%;
}

.npc-home:is([data-habitat="den"], [data-habitat="burrow"], [data-habitat="grass"]) > .animal-art {
    inset-block-start: 36%;
    width: 58%;
    inset-inline: 21%;
}

.npc.npc--near {
    transform: scale(1.08);
}

.npc.npc--near .npc-home {
    filter: drop-shadow(0 1px 2px #ffdf8f) drop-shadow(0 2px 3px var(--color-shadow-medium));
}

/* Completed indicator */
.npc.completed {
    opacity: 0.85;
    cursor: default;
    pointer-events: none;  /* prevent accidental re-clicks */
}

.npc.completed::after {
    content: '';
    position: absolute;
    top: -12px;
    right: -12px;
    background: var(--color-picture-backing) url('../assets/star.svg') center / 28px no-repeat;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    text-align: center;
    line-height: 40px;
    font-size: 0.85rem;
    border: 2px solid #fff;
    box-shadow: var(--shadow-1);
}

@media (prefers-contrast: high) {

    .obstacle,
    .npc,
    .collectible {
        border-width: 3px;
        border-color: var(--color-black);
    }

    .npc.completed::after {
        border-width: 3px;
    }
}

@media (pointer: coarse) {

    .npc,
    .collectible {
        transform: scale(1.2);
    }

    .npc:active {
        transform: scale(1.1);
    }
}
