/* ==========================================
   BEEZLOOP FLAIR
   Signature bee/hive/honeycomb identity system.
   All motion here respects prefers-reduced-motion
   and animates only transform/opacity for cheap
   compositing (no layout thrash).
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    .hive-widget,
    .hive-widget *,
    .honeycomb-points li,
    .post-card.is-buzzing .buzz-badge,
    .hive-particle,
    .reading-progress-bee {
        animation: none !important;
        transition: none !important;
    }
}

/* ---------- 1. The Hive: live activity indicator ---------- */

.hive-widget {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 9500;
    display: flex;
    align-items: center;
    font-family: var(--body-font);
}

.hive-widget-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color) 0%, #CB9C0F 100%);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22), 0 0 0 0 rgba(212, 165, 20, 0.45);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: hive-breathe 3.2s ease-in-out infinite;
}

@keyframes hive-breathe {
    0%, 100% { box-shadow: 0 4px 16px rgba(0,0,0,0.22), 0 0 0 0 rgba(212,165,20,0.4); }
    50% { box-shadow: 0 4px 16px rgba(0,0,0,0.22), 0 0 0 10px rgba(212,165,20,0); }
}

.hive-widget-btn svg {
    display: block;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
    animation: hive-bee-flutter 1.8s ease-in-out infinite;
    transform-origin: center;
}

@keyframes hive-bee-flutter {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-2px) rotate(-4deg); }
    75% { transform: translateY(1px) rotate(3deg); }
}

.hive-widget-btn:hover,
.hive-widget-btn:focus-visible {
    transform: scale(1.07);
}

.hive-popover {
    position: absolute;
    bottom: 64px;
    right: 0;
    min-width: 220px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, rgba(0,0,0,0.08));
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.hive-widget.is-open .hive-popover {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.hive-popover-count {
    font-family: var(--header-font);
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--accent-color);
    line-height: 1.1;
}

.hive-popover-label {
    font-size: 0.78rem;
    color: var(--text-muted, #6b6b6b);
    margin-top: 2px;
}

.hive-popover-latest {
    display: block;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed rgba(0,0,0,0.1);
    font-size: 0.82rem;
    color: inherit;
    text-decoration: none;
    line-height: 1.35;
}

.hive-popover-latest:hover {
    color: var(--accent-color);
}

@media (max-width: 600px) {
    .hive-widget { right: 12px; bottom: 78px; }
    .hive-widget-btn { width: 46px; height: 46px; }
}

/* ---------- 2. Honeycomb Key Points ---------- */

.entry-key-points.honeycomb-key-points ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.entry-key-points.honeycomb-key-points li {
    position: relative;
    padding: 10px 14px 10px 40px;
    background: linear-gradient(135deg, rgba(212,165,20,0.08), rgba(212,165,20,0.02));
    border-left: 3px solid var(--accent-color);
    clip-path: polygon(1.5% 0%, 98.5% 0%, 100% 50%, 98.5% 100%, 1.5% 100%, 0% 50%);
    opacity: 0;
    transform: translateX(-8px);
    animation: honeycomb-cell-in 0.5s ease forwards;
}

.entry-key-points.honeycomb-key-points li::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background: var(--accent-color);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

.entry-key-points.honeycomb-key-points li:nth-child(1) { animation-delay: 0.05s; }
.entry-key-points.honeycomb-key-points li:nth-child(2) { animation-delay: 0.15s; }
.entry-key-points.honeycomb-key-points li:nth-child(3) { animation-delay: 0.25s; }
.entry-key-points.honeycomb-key-points li:nth-child(4) { animation-delay: 0.35s; }
.entry-key-points.honeycomb-key-points li:nth-child(5) { animation-delay: 0.45s; }
.entry-key-points.honeycomb-key-points li:nth-child(n+6) { animation-delay: 0.55s; }

@keyframes honeycomb-cell-in {
    to { opacity: 1; transform: translateX(0); }
}

/* ---------- 3. Buzz trending indicator ---------- */

.post-card.is-buzzing {
    position: relative;
}

.post-card.is-buzzing .buzz-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px 3px 7px;
    border-radius: 999px;
    background: rgba(20, 18, 12, 0.72);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    color: #F5D77A;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-family: var(--body-font);
}

.buzz-badge svg {
    width: 11px;
    height: 11px;
    animation: buzz-wing 0.45s ease-in-out infinite;
    transform-origin: center;
}

@keyframes buzz-wing {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(-10deg) scale(1.08); }
}

/* ---------- 4. Reading progress "flight path" ---------- */

.reading-progress-bar {
    height: 4px;
    background: rgba(0, 0, 0, 0.06);
}

.reading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-warm, #E5C158), var(--accent-color) 60%, var(--accent-deep, #A97D0E));
    position: relative;
    transition: width 0.12s linear;
}

.reading-progress-bee {
    position: absolute;
    right: -9px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    line-height: 1;
    animation: reading-bee-bob 0.6s ease-in-out infinite;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.35));
}

@keyframes reading-bee-bob {
    0%, 100% { transform: translateY(-50%) rotate(0deg); }
    50% { transform: translateY(-60%) rotate(8deg); }
}

/* ---------- 5. Ambient hive hum (homepage hero) ---------- */

.hive-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.hive-particle {
    position: absolute;
    width: 5px;
    height: 5px;
    background: var(--accent-warm, #E5C158);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    opacity: 0.35;
    animation-name: hive-drift;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

@keyframes hive-drift {
    0% { transform: translate(0, 0) rotate(0deg); opacity: 0; }
    10% { opacity: 0.4; }
    50% { transform: translate(var(--drift-x, 30px), -40px) rotate(90deg); }
    90% { opacity: 0.3; }
    100% { transform: translate(calc(var(--drift-x, 30px) * 2), -90px) rotate(180deg); opacity: 0; }
}

@media (max-width: 782px) {
    .hive-particles { display: none; }
}
