/* ==========================================================================
   Anchor Sidebar — Programmatic CSS Ruler
   1 cm = 30px (10 mm)
   ========================================================================== */

:root {
    --ruler-cm: 30px; 
    --ruler-height: calc(18 * var(--ruler-cm) + 1px); /* 0 to 18cm */
}

/* ── Container ─────────────────────────────────────────────────── */
.hp-anchor-sidebar {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 900;
}

/* ── Ruler wrapper ──────────────────────────────────────────────── */
.hp-anchor-ruler {
    position: relative;
    width: 150px;
    height: var(--ruler-height);
}

/* CSS ruler background */
.hp-anchor-ticks {
    position: absolute;
    right: 0;
    top: 0;
    width: 30px; /* Area for ticks */
    height: 100%;
    z-index: 1;
    pointer-events: none;
    
    /* Main vertical line */
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    
    background-image: 
        /* 2cm marks (0, 2, 4...) */
        repeating-linear-gradient(to bottom, 
            rgba(255, 255, 255, 0.5) 0px, 
            rgba(255, 255, 255, 0.5) 1px, 
            transparent 1px, 
            transparent calc(var(--ruler-cm) * 2)),
        /* 1cm marks (1, 3, 5...) */
        repeating-linear-gradient(to bottom, 
            rgba(255, 255, 255, 0.4) 0px, 
            rgba(255, 255, 255, 0.4) 1px, 
            transparent 1px, 
            transparent var(--ruler-cm)),
        /* 0.5cm (5mm) marks */
        repeating-linear-gradient(to bottom, 
            rgba(255, 255, 255, 0.3) 0px, 
            rgba(255, 255, 255, 0.3) 1px, 
            transparent 1px, 
            transparent calc(var(--ruler-cm) / 2)),
        /* 1mm marks */
        repeating-linear-gradient(to bottom, 
            rgba(255, 255, 255, 0.15) 0px, 
            rgba(255, 255, 255, 0.15) 1px, 
            transparent 1px, 
            transparent calc(var(--ruler-cm) / 10));
            
    background-size: 
        24px 100%, /* 2cm marks */
        16px 100%, /* 1cm marks */
        10px 100%, /* 0.5cm marks */
        6px 100%;  /* mm marks */
        
    background-repeat: no-repeat;
    background-position: 
        right top,
        right top,
        right top,
        right top;
}

/* Lines extending before 0cm and after the last cm */
.hp-anchor-ticks::before,
.hp-anchor-ticks::after {
    content: '';
    position: absolute;
    right: -1px;
    width: 1px;
}

.hp-anchor-ticks::before {
    bottom: 100%;
    height: 50px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.15), transparent);
}

.hp-anchor-ticks::after {
    top: 100%;
    height: 50px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.15), transparent);
}

/* ── Tab list ───────────────────────────────────────────────────── */
.hp-anchor-list {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    list-style: none;
    margin: 0;
    padding: 0;
    z-index: 2;
}

/* ── Sliding indicator ── */
.hp-anchor-sliding-line {
    position: absolute;
    right: -15px; /* cross the border line */
    width: 50px;
    height: 2px;
    background: linear-gradient(90deg,
        rgba(249, 115, 22, 0) 0%,
        rgba(249, 115, 22, 1) 50%,
        rgba(249, 115, 22, 0) 100%);
    transform: translateY(-50%); 
    z-index: 3;
    border-radius: 2px;
    transition: top 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    list-style: none;
}

/* ── Each anchor item ───────────────────────────────────────────── */
.hp-anchor-item {
    position: absolute;
    right: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    cursor: pointer;
}

/* ── Label ────── */
.hp-anchor-label {
    margin-right: 35px; /* push left of ticks */
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    transition: color 0.3s ease, font-weight 0.3s ease;
    position: relative;
    z-index: 2;
}

.hp-anchor-item.active .hp-anchor-label {
    color: #F97316;
    font-weight: 700;
}

.hp-anchor-item:hover .hp-anchor-label {
    color: rgba(255, 255, 255, 0.9);
}

/* ── Dot (at exact cm point) ────── */
.hp-anchor-mark {
    position: absolute;
    right: 19px; /* Center dot at the left end of the 24px tick mark (24 - 10/2) */
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid rgba(148, 163, 184, 0.7);
    background-color: #050B14;
    transition: all 0.3s ease;
    z-index: 3;
}

.hp-anchor-item.active .hp-anchor-mark {
    background-color: #F97316;
    border-color: #F97316;
    transform: translateY(-50%) scale(1.3);
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.6);
}

.hp-anchor-item:hover .hp-anchor-mark {
    border-color: rgba(255, 255, 255, 0.9);
    transform: translateY(-50%) scale(1.15);
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .hp-anchor-sidebar {
        right: 15px;
    }
    .hp-anchor-ruler {
        width: 120px;
    }
    .hp-anchor-label {
        font-size: 10px;
    }
}

@media (max-width: 1024px) {
    .hp-anchor-sidebar {
        display: none;
    }
}
