/*
 * TDN Auto Linker — Link & Tooltip Styles v2.0
 * Uses TDN Magazine theme tokens (style.css v2.3.0).
 */

/* ─── Auto-link base style ───────────────────────────────────────────────── */
.tdn-al-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 2px solid #c8922a; /* --tdn-gold */
    padding-bottom: 1px;
    font-weight: 600;
    cursor: pointer;
    transition: color .18s cubic-bezier(.4,0,.2,1),
                border-color .18s cubic-bezier(.4,0,.2,1);
}

.tdn-al-link:hover {
    color: #c8922a;          /* --tdn-gold */
    border-bottom-color: #e8b84b; /* --tdn-gold-lt */
    text-decoration: none;
}

/* ─── Tooltip wrapper ────────────────────────────────────────────────────── */
.tdn-al-tooltip {
    position: fixed;
    z-index: 99999;
    width: 256px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px) scale(.98);
    transition:
        opacity .18s cubic-bezier(.4,0,.2,1),
        transform .18s cubic-bezier(.4,0,.2,1);
    will-change: opacity, transform;
}

.tdn-al-tooltip.tdn-al-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Arrow pointing up at the linked word */
.tdn-al-arrow {
    position: absolute;
    bottom: 100%;
    left: 20px;
    width: 0;
    height: 0;
    border-left:   7px solid transparent;
    border-right:  7px solid transparent;
    border-bottom: 7px solid #181818; /* --tdn-black-soft */
    filter: drop-shadow(0 -2px 3px rgba(0,0,0,.28));
}

/* ─── Tooltip card ───────────────────────────────────────────────────────── */
.tdn-al-card {
    background: #181818;
    border-radius: 6px; /* --radius-md */
    overflow: hidden;
    box-shadow:
        0 10px 40px rgba(0,0,0,.48),
        0 4px 16px rgba(0,0,0,.28);
    font-family: 'Inter', system-ui, -apple-system, sans-serif; /* --font-ui */
    color: #fff;
}

.tdn-al-card-inner {
    padding: 14px 16px;
}

/* Label chip — mirrors .tdn-badge from the theme */
.tdn-al-chip {
    display: inline-block;
    background: #e51a3e;     /* --tdn-red */
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 2px;       /* --radius */
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Tag name — uses Barlow Condensed like .tdn-section-title */
.tdn-al-tag-name {
    font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif; /* --font-headline */
    font-size: 19px;
    font-weight: 700;
    letter-spacing: .03em;
    line-height: 1.15;
    color: #fff;
    margin-bottom: 10px;
}

/* Post count + link row */
.tdn-al-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid #2a2a2a;
    font-size: 11px;
    gap: 8px;
}

.tdn-al-count {
    color: #999;
}

.tdn-al-count strong {
    color: #e51a3e; /* --tdn-red */
    font-weight: 700;
}

.tdn-al-view-link {
    color: #c8922a; /* --tdn-gold */
    font-weight: 700;
    font-size: 11px;
    letter-spacing: .4px;
    text-transform: uppercase;
    white-space: nowrap;
    text-decoration: none;
    transition: color .15s;
}

.tdn-al-view-link:hover {
    color: #e8b84b;
}

/* ─── Loading state ──────────────────────────────────────────────────────── */
.tdn-al-loading {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #888;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 12px;
}

.tdn-al-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #333;
    border-top-color: #e51a3e; /* --tdn-red */
    border-radius: 50%;
    animation: tdn-spin .65s linear infinite;
    flex-shrink: 0;
}

@keyframes tdn-spin {
    to { transform: rotate(360deg); }
}

/* ─── Hide on touch / no-hover devices ──────────────────────────────────── */
@media (hover: none), (pointer: coarse) {
    .tdn-al-tooltip { display: none !important; }
}

/* ─── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .tdn-al-link    { transition: none; }
    .tdn-al-tooltip { transition: none; }
}
