/* ==========================================================================
   Roadmap — board + starmap views
   Depends on the tokens defined in styles.css
   ========================================================================== */

.roadmap-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.toggle-group {
    display: flex;
    padding: 4px;
    gap: 2px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
}

.toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1.1rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-faint);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--fast) var(--ease);
}

.toggle-btn svg {
    width: 15px;
    height: 15px;
}

.toggle-btn:hover {
    color: var(--text);
}

.toggle-btn.is-active {
    background: rgba(251, 189, 24, 0.14);
    color: var(--gold);
}

.roadmap-view[hidden] {
    display: none;
}

/* --------------------------------------------------------------------------
   Board
   -------------------------------------------------------------------------- */
.board-view {
    display: flex;
    gap: 0.85rem;
    overflow-x: auto;
    padding-bottom: 1.25rem;
    scroll-snap-type: x proximity;
}

.board-column {
    flex: 0 0 272px;
    max-width: 272px;
    display: flex;
    flex-direction: column;
    max-height: min(70vh, 720px);
    scroll-snap-align: start;
    background: rgba(13, 13, 20, 0.66);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
}

.column-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.85rem 0.9rem 0.7rem;
    border-bottom: 1px solid var(--line);
}

.column-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--gold);
}

.column-count {
    flex-shrink: 0;
    padding: 0.1rem 0.5rem;
    border-radius: var(--r-pill);
    font-size: 0.68rem;
    color: var(--text-faint);
    background: rgba(251, 189, 24, 0.08);
}

.column-cards {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.6rem;
}

.board-card {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.55rem 0.65rem;
    margin-bottom: 0.4rem;
    background: rgba(20, 20, 28, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease),
        box-shadow var(--fast) var(--ease);
}

.board-card:hover {
    transform: translateY(-1px);
    border-color: rgba(251, 189, 24, 0.32);
    box-shadow: var(--shadow-sm);
}

.card-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 0.4rem;
}

.card-label {
    width: 34px;
    height: 6px;
    border-radius: 3px;
    transition: transform 0.15s var(--ease);
}

.card-label:hover {
    transform: scaleY(1.8);
}

.card-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    word-break: break-word;
}

.card-desc {
    margin-top: 0.25rem;
    font-size: 0.7rem;
    line-height: 1.45;
    color: var(--text-faint);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Legend column */
.legend-column {
    flex: 0 0 190px;
    max-width: 190px;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.55rem;
}

.legend-dot {
    flex-shrink: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.legend-label {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-muted);
}

.legend-heading {
    padding: 0.5rem 0.55rem 0.2rem;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.legend-sep {
    height: 1px;
    margin: 0.5rem 0;
    background: var(--line);
}

/* --------------------------------------------------------------------------
   Tooltips
   -------------------------------------------------------------------------- */
.tip {
    position: fixed;
    z-index: 3000;
    padding: 0.55rem 0.85rem;
    border-radius: var(--r-sm);
    background: rgba(6, 6, 14, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(251, 189, 24, 0.24);
    box-shadow: var(--shadow-md);
    font-size: 0.74rem;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s var(--ease);
    white-space: nowrap;
}

.tip.is-visible {
    opacity: 1;
}

.tip-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 0.4rem;
    border-radius: 50%;
    vertical-align: middle;
}

.star-tip {
    min-width: 180px;
    white-space: normal;
    padding: 0.8rem 1rem;
}

.star-tip-name {
    font-size: 0.86rem;
    font-weight: 700;
    color: #fff;
}

.star-tip-series {
    margin-bottom: 0.5rem;
    font-size: 0.68rem;
    color: rgba(251, 189, 24, 0.65);
}

.star-tip-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.74rem;
    color: var(--text-muted);
}

.star-tip-badge {
    display: inline-block;
    margin-top: 0.4rem;
    padding: 0.1rem 0.5rem;
    border-radius: var(--r-pill);
    font-size: 0.64rem;
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    position: relative;
    width: min(100%, 480px);
    max-height: 85vh;
    overflow-y: auto;
    padding: clamp(1.5rem, 4vw, 2rem);
    background: rgba(14, 14, 20, 0.98);
    border: 1px solid rgba(251, 189, 24, 0.2);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s var(--ease);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(10px);
    }
}

.modal-close {
    position: absolute;
    top: 0.85rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-faint);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: all var(--fast) var(--ease);
}

.modal-close:hover {
    background: rgba(251, 189, 24, 0.12);
    color: var(--gold);
}

.modal-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 1rem;
}

.modal-label {
    width: 46px;
    height: 8px;
    border-radius: 4px;
}

.modal-name {
    font-size: 1.3rem;
    font-weight: 700;
    word-break: break-word;
    padding-right: 2rem;
}

.modal-series {
    margin-bottom: 1.1rem;
    font-size: 0.8rem;
    color: rgba(251, 189, 24, 0.65);
}

.modal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0;
    border-top: 1px solid var(--line);
}

.modal-row-label {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.modal-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.modal-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.modal-badge {
    padding: 0.15rem 0.7rem;
    border-radius: var(--r-pill);
    font-size: 0.74rem;
    font-weight: 600;
}

.modal-desc-block {
    padding-top: 0.9rem;
    border-top: 1px solid var(--line);
}

.modal-desc-block[hidden] {
    display: none;
}

.modal-desc {
    margin-top: 0.5rem;
    font-size: 0.86rem;
    line-height: 1.7;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Starmap
   -------------------------------------------------------------------------- */
.starmap-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
}

.starmap-container {
    position: relative;
    width: 100%;
    height: clamp(420px, 68vh, 720px);
    /* The map is an ellipse and fills this box, so a wide container is used,
       not letterboxed around a circle. */
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: radial-gradient(ellipse at 50% 50%, rgba(12, 12, 25, 0.95), rgba(4, 4, 10, 0.98));
    cursor: grab;
    touch-action: none;
}

.starmap-container:active {
    cursor: grabbing;
}

.starmap-inner {
    position: absolute;
    inset: 0;
    transform-origin: 0 0;
}

.starmap-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.zoom-controls {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    z-index: 15;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.zoom-btn {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(10, 10, 10, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--fast) var(--ease);
}

.zoom-btn:hover {
    background: rgba(251, 189, 24, 0.14);
    border-color: var(--line-strong);
    color: var(--gold);
}

.zoom-level {
    padding: 0.15rem 0;
    text-align: center;
    font-size: 0.62rem;
    color: var(--text-faint);
}

.starmap-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1.1rem;
}

.starmap-stats .stat-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-faint);
}

.starmap-stats .stat-item strong {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gold);
}

.starmap-hint {
    margin-top: 0.6rem;
    font-size: 0.74rem;
    color: var(--text-faint);
}

@keyframes twinkle {
    0%,
    100% {
        opacity: 0.15;
    }
    50% {
        opacity: 0.65;
    }
}

@media (max-width: 780px) {
    .board-column {
        flex-basis: 240px;
        max-width: 240px;
    }

    .legend-column {
        flex-basis: 165px;
        max-width: 165px;
    }
}

/* --------------------------------------------------------------------------
   Starmap — orbital view
   Rings are statuses (done innermost), angular sectors are clusters.
   Anything that must stay legible while zooming counter-scales via --inv-z,
   which the zoom handler keeps at 1/zoom.
   -------------------------------------------------------------------------- */
.starmap-inner {
    --inv-z: 1;
}

.orbit-ring {
    fill: none;
    stroke: rgba(251, 189, 24, 0.13);
    stroke-dasharray: 2 7;
    vector-effect: non-scaling-stroke;
}

.orbit-label {
    fill: rgba(251, 189, 24, 0.5);
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: calc(9px * var(--inv-z));
    letter-spacing: 0.14em;
    text-transform: uppercase;
    pointer-events: none;
}

.sector-line {
    stroke: rgba(255, 255, 255, 0.055);
    stroke-dasharray: 1 6;
    vector-effect: non-scaling-stroke;
}

.cluster-label {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: calc(10.5px * var(--inv-z));
    font-weight: 700;
    letter-spacing: 0.22em;
    opacity: 0.9;
    pointer-events: none;
    transition: opacity var(--fast) var(--ease);
}

.cluster-label.is-dim {
    opacity: 0.12;
}

/* Core */
.core-glow {
    fill: rgba(251, 189, 24, 0.05);
}

.core-disc {
    fill: rgba(251, 189, 24, 0.16);
    stroke: rgba(251, 189, 24, 0.55);
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}

.core-label {
    fill: var(--gold);
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: calc(10px * var(--inv-z));
    font-weight: 700;
    letter-spacing: 0.2em;
    pointer-events: none;
}

/* Stars */
.sstar {
    /* #starmap-main is pointer-events:none so drags pass through to the
       container; stars have to opt back in or nothing is hoverable. */
    pointer-events: all;
    cursor: pointer;
    transition: opacity var(--base) var(--ease);
}

/* Invisible, generous target — a 4px dot is not a click target. */
.star-hit {
    fill: transparent;
}

.sstar.is-dim {
    opacity: 0.07;
    pointer-events: none;
}

.star-halo {
    opacity: 0.2;
}

.star-body {
    opacity: 1;
}

.star-core {
    opacity: 0.8;
}

.sstar:hover .star-halo {
    opacity: 0.42;
}

.sstar:hover .star-body {
    stroke: #fff;
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}

.sstar:focus {
    outline: none;
}

.sstar:focus-visible .star-halo {
    opacity: 0.45;
    stroke: #fff;
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.star-orbit {
    fill: none;
    stroke-width: 0.6;
    stroke-dasharray: 3 5;
    opacity: 0.35;
    vector-effect: non-scaling-stroke;
    animation: starOrbitSpin 9s linear infinite;
    transform-box: fill-box;
    transform-origin: center;
}

@keyframes starOrbitSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Labels would be soup if all 52 showed at once: only the flagships are
   always on, the rest appear on hover/focus or once you zoom in. */
.star-name {
    fill: rgba(255, 255, 255, 0.55);
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: calc(9.5px * var(--inv-z));
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--fast) var(--ease);
}

.sstar.is-key .star-name {
    fill: rgba(255, 255, 255, 0.75);
    font-weight: 600;
    opacity: 1;
}

.sstar:hover .star-name,
.sstar:focus-visible .star-name {
    fill: #fff;
    opacity: 1;
}

.starmap-inner.show-labels .star-name {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .star-orbit {
        animation: none;
    }
}
