/* =============================================================================
   ship-tooltip.css - Compact ship inspect tooltip
   ============================================================================= */

.ship-tooltip {
    position: absolute;
    z-index: var(--z-panel-overlay);
    /* One width for player, NPC and wreck inspectors (sized for the NPC reward rail). */
    width: clamp(360px, 42vw, 560px);
    background: #080b10;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    pointer-events: none;
    /* iOS: suppress long-press loupe / Copy-Loo Up on inspector text */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    transition:
        opacity 0.18s ease,
        transform 0.18s ease,
        visibility 0s linear 0.18s;
}

.ship-tooltip--open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    transition:
        opacity 0.18s ease,
        transform 0.18s ease;
}

/* Portrait area */
.ship-tooltip__portrait {
    position: relative;
    width: 100%;
    height: 190px;
    overflow: hidden;
    background: #05070a;
    border-bottom: 1px solid rgba(197, 160, 89, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ship-tooltip__portrait-img {
    width: auto;
    max-width: 80%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.8));
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.ship-tooltip--npc .ship-tooltip__portrait-img {
    max-width: 80%;
    max-height: 300px;
}

/* Bottom fade so portrait blends into body */
.ship-tooltip__portrait::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent, #080b10);
    pointer-events: none;
}

/* Desktop/tablet: fixed top-left beside nav, below header */
@media (min-width: 640px) {
    .ship-tooltip {
        position: fixed;
        left: calc(var(--panel-gap) + var(--nav-width) + 8px);
        top: var(--hud-top);
    }
}

/* Mobile: centred card, natural height, capped above nav bar */
@media (max-width: 639px) {
    .ship-tooltip {
        position: fixed;
        top: 50%;
        left: 50%;
        right: auto;
        width: calc(100% - 32px);
        max-height: calc(100vh - 60px - 110px);
        transform: translate(-50%, -50%);
        border-radius: var(--radius-md, 8px);
        overflow-y: auto;
    }

    .ship-tooltip--open {
        transform: translate(-50%, -50%);
    }

    .ship-tooltip__portrait {
        height: 190px;
    }
}

/* Ship class + name - above stats rail (matches command panel hero). */
.ship-tooltip__hero.ph-info-col {
    padding: 10px var(--space-lg);
    gap: 6px;
    border-bottom: 1px solid rgba(197, 160, 89, 0.2);
}

.ship-tooltip__hero .ph-ship-name {
    margin-bottom: 0;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

/* Body: chips + bars + actions */
.ship-tooltip__body {
    padding: var(--space-sm) var(--space-lg) var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.ship-tooltip__chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.ship-tooltip__bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ship-tooltip__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-xs);
}

.ship-tooltip .ms-rail {
    grid-auto-columns: 1fr;
}

.ship-tooltip .ms-rail__cell {
    padding: 0.65rem 0.75rem;
}

.ship-tooltip .ms-rail__cell:first-child {
    padding-left: var(--space-lg);
}

.ship-tooltip .ms-rail__cell:last-child {
    padding-right: var(--space-lg);
}

.ship-tooltip .ms-rail__label,
.ship-tooltip .ms-rail__value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Owner's guild under the ship name: pennant + [TAG] + name, opens the guild profile. */
.ship-tooltip__guild {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    align-self: flex-start;
    max-width: 100%;
    padding: 2px 0;
    border: none;
    background: none;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    text-align: left;
    cursor: pointer;
}

.ship-tooltip__guild[hidden] {
    display: none;
}

.ship-tooltip__guild:hover .ship-tooltip__guild-name,
.ship-tooltip__guild:focus-visible .ship-tooltip__guild-name {
    color: var(--gold);
    text-decoration: underline;
}

.ship-tooltip__guild-flag {
    display: inline-flex;
    flex-shrink: 0;
}

.ship-tooltip__guild-svg {
    width: 18px;
    height: auto;
}

.ship-tooltip__guild-tag {
    color: var(--gold);
    font-weight: 600;
}

.ship-tooltip__guild-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Wreck inspector: the hull shown weathered and dim. */
.ship-tooltip--wreck .ship-tooltip__portrait-img {
    filter: grayscale(0.7) sepia(0.35) brightness(0.7);
}
