@charset "utf-8";

/* =========================================
   HTN Pin Design System
    ライフサイクルピン
   ========================================= */

:root {
    /* ピンのステータス色 */
    --pin-color-amber: #E67E22;   /* 琥珀（誕生）*/
    --pin-color-sakura: #FF5E7D;  /* 桜（開花）*/
    --pin-color-gray: #7F8C8D;    /* 灰（静寂）*/
    /* ピンの基本設定 — 元の pin.png (31×45) に合わせる */
    --pin-bg: #FFFFFF;
    --pin-width: 31px;
    --pin-height: 45px;
    --pin-size: 31px;              /* しずく型の正方形辺 (回転後の対角線 ≈ 43.8px ≒ 45px) */
}

/* =========================================
   Pin Base — しずく型共通スタイル
   ========================================= */
.pin-base {
    position: absolute;
    width: var(--pin-width);   /* 31px — 元の pin.png と同じ */
    height: var(--pin-height); /* 45px — 元の pin.png と同じ */
    cursor: pointer;
    z-index: 10;
}

/* =========================================
   Pin Stone — 前面レイヤー（記憶の「石」）
   ========================================= */
.pin-stone {
    position: absolute;
    width: var(--pin-size);
    height: var(--pin-size);
    background-color: var(--pin-bg);
    border: 3px solid var(--pin-color-gray);
    /* しずく型 — pin-base (31×45) の中央に配置して回転 */
    border-radius: 50% 50% 50% 0;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.4s, transform 0.3s, box-shadow 0.3s;
}

/* 数字（逆回転で正位置に） */
.pin-stone .pin-number {
    transform: rotate(45deg);
    font-size: 11px;
    font-weight: bold;
    color: var(--pin-color-gray);
    user-select: none;
    line-height: 1;
}

/* =========================================
   Glow Breathing — 背面レイヤー（記憶の「気配」）
   ========================================= */
.glow-breathing {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    /* pin-stone の円形ヘッド中心 = pin-base の中央 */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: background-color 1s, opacity 1s;
}

/* =========================================
   State: Amber（琥珀 — 誕生）
   新着 or 1ヶ月以内の記憶
   ========================================= */
.pin-base.is-amber .pin-stone {
    border-color: var(--pin-color-amber);
}

.pin-base.is-amber .pin-stone .pin-number {
    color: var(--pin-color-amber);
}

.pin-base.is-amber .glow-breathing {
    background-color: var(--pin-color-amber);
    box-shadow: 0 0 6px 3px var(--pin-color-amber);
    opacity: 1.0;
    animation: glowBreathe 3.5s ease-in-out infinite;
}

/* =========================================
   State: Sakura（桜 — 開花）
   リアクション発生状態
   ========================================= */
.pin-base.is-sakura .pin-stone {
    border-color: var(--pin-color-sakura);
    transform: translate(-50%, -55%) rotate(-45deg) scale(1.1);
}

.pin-base.is-sakura .pin-stone .pin-number {
    color: var(--pin-color-sakura);
}

.pin-base.is-sakura .glow-breathing {
    background-color: var(--pin-color-sakura);
    box-shadow: 0 0 6px 3px var(--pin-color-sakura);
    opacity: 0.9;
    animation: glowBreathe 4s ease-in-out infinite;
}

/* =========================================
   State: Gray（灰 — 静寂）
   1ヶ月経過、アーカイブ
   ========================================= */
.pin-base.is-gray .pin-stone {
    border-color: var(--pin-color-gray);
}

.pin-base.is-gray .pin-stone .pin-number {
    color: #999;
}

.pin-base.is-gray .glow-breathing {
    opacity: 0;
    animation: none;
}

/* =========================================
   State: Reviving（再燃）
   灰色ピンが時折またたく — .is-gray より高い詳細度で上書き
   ========================================= */
.pin-base.is-gray.is-reviving .pin-stone {
    border-color: var(--pin-color-amber);
}

.pin-base.is-gray.is-reviving .pin-number {
    color: var(--pin-color-amber);
}

.pin-base.is-gray.is-reviving .glow-breathing {
    background-color: var(--pin-color-amber);
    box-shadow: 0 0 6px 3px var(--pin-color-amber);
    animation: reviveFlicker 2s ease-in-out forwards;

}

/* =========================================
   Animations
   ========================================= */
@keyframes glowBreathe {
    0%, 100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1.0;
    }
}

@keyframes reviveFlicker {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    40% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

/* =========================================
   Hover
   ========================================= */
.pin-base:hover .pin-stone {
    transform: translate(-50%, -55%) rotate(-45deg) scale(1.15);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.25);
}

.pin-base:hover .glow-breathing {
    opacity: 0.8 !important;
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 640px) {
    :root {
        /* 元のサイズの8割 (31px * 0.8 = 24.8 ≈ 25px, 45px * 0.8 = 36px) */
        --pin-size: 25px;
        --pin-width: 25px;
        --pin-height: 36px;
    }

    .glow-breathing {
        width: 22px;
        height: 22px;
    }

    .pin-stone .pin-number {
        font-size: 9px;
    }

    .pin-stone {
        border-width: 2px;
    }
}

@media (max-width: 480px) {
    :root {
        /* 640px時のさらに8割 (25px * 0.8 = 20px, 36px * 0.8 ≈ 29px) */
        --pin-size: 20px;
        --pin-width: 20px;
        --pin-height: 29px;
    }

    .glow-breathing {
        width: 18px;
        height: 18px;
    }

    .pin-stone .pin-number {
        font-size: 7px;
    }

    .pin-stone {
        border-width: 1px;
    }
}
