@import url('https://fonts.googleapis.com/css2?family=Inknut+Antiqua:wght@300;400;500;600;700;800;900&family=Mulish:ital,wght@0,200..1000;1,200..1000&display=swap');

* {
    margin: 0;
    padding: 0;
    font-family: 'Mulish', sans-serif;
    box-sizing: border-box;
    scrollbar-color: var(--gold-link) transparent;
    scrollbar-width: thin;
}

body {
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-image: url('../assets/bg-texture.png');
}

main {
    margin: 2rem;
}

body::before {
    content: '';
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 1000px; height: 1000px;
    background: radial-gradient(circle, var(--bg-glow) 0%, transparent 65%);
    pointer-events: none;
}

h1 {
    font-family: 'Inknut Antiqua', serif;
    font-size: 3rem;
    font-weight: 800;
    color: var(--gold);
    z-index: 1;
    margin-top: 0;
    margin-bottom: 0.3rem;
}

#chart-container {
    position: relative;
    z-index: 1;
    margin-bottom: 1rem;
}

#chart-container svg {
    display: block;
    height: calc(100vh - 4rem);
    width: auto;
    max-width: 100vw;
}

.tooltip {
    position: fixed;
    pointer-events: none;
    background: var(--bg-tooltip);
    border: 1px solid rgba(var(--gold-rgb), 0.3);
    border-radius: 4px;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--fg);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 20;
    max-width: 220px;
}

.tooltip .tt-title {
    font-weight: 700;
    color: var(--gold);
    font-size: 14px;
    margin-bottom: 3px;
}

.tooltip .tt-body {
    font-weight: 300;
    color: var(--fg-muted-2);
    font-size: 13px;
    line-height: 1.45;
}

.tribe-arc { cursor: pointer; }

.mech-dot.shared-pulse {
    transform-box: fill-box;
    transform-origin: center;
    animation: sharedPulse 1.5s ease-in-out infinite;
}

@keyframes sharedPulse {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%       { transform: scale(1.3); opacity: 0.75; }
}
.mechanic-label {
    font-weight: 500;
    font-size: 1rem;
    fill: var(--fg-muted-3);
}

.tribe-label {
    font-family: 'Inknut Antiqua', serif;
    font-weight: 700;
    font-size: 13px;
    fill: var(--fg-muted-1);
    letter-spacing: 0.02em;
    cursor: pointer;
}

.center-label {
    font-family: 'Inknut Antiqua', serif;
    font-weight: 900;
    font-size: 16px;
    fill: var(--gold);
    text-anchor: middle;
    letter-spacing: 0.12em;
}

.group-label {
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.7;
}

.center-sublabel {
    font-weight: 400;
    font-size: 13px;
    fill: var(--fg-muted-4);
    text-anchor: middle;
}

/* Info Panel Title (floats above the panel) */
#info-title {
    position: fixed;
    left: 2rem;
    width: 400px;
    bottom: calc(50% + 26vh);
    z-index: 15;
    padding: 1.5rem;
    /* border: 1px solid rgba(var(--gold-rgb), 0.18);
    border-radius: 8px; */
}

.title {
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 0;
    line-height: 2.8rem;
}

.subtitle {
    font-size: 0.78rem;
    font-style: italic;
    font-weight: 600;
    letter-spacing: 0.07em;
    line-height: 1.2rem;
    color: var(--fg-muted-5);
    margin-top: 0.5rem;
    text-align: left;
    z-index: 1;
}

/* Left Info Panel */
#info-panel {
    position: fixed;
    left: 2rem;
    top: 60%;
    transform: translateY(-50%);
    width: 320px;
    height: 70vh;
    overflow-y: auto;
    background: var(--bg-panel);
    border: 1px solid rgba(var(--gold-rgb), 0.18);
    border-radius: 8px;
    padding: 1.5rem;
    z-index: 15;
}

.ip-divider {
    height: 1px;
    background: rgba(var(--gold-rgb), 0.2);
    margin: 0.9rem 0;
}

.ip-section-heading {
    font-family: 'Inknut Antiqua', serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.06em;
    margin-bottom: 0.2rem;
    /* margin-top: 0.9rem; */
}

.ip-intro {
    font-size: 0.9rem;
    color: var(--fg-desc);
    line-height: 1.65;
    font-weight: 300;
    margin-bottom: 0.5rem;
}

.ip-hint {
    font-size: 0.75rem;
    color: var(--fg-muted-5);
    font-style: italic;
    margin-top: 1rem;
    line-height: 1.5;
}

#ip-general, #ip-card {
    transition: opacity 0.25s ease;
}

.ip-hidden {
    display: none;
}

.ip-card-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--fg-muted-5);
    margin-bottom: 0.3rem;
}

.ip-card-name {
    font-family: 'Inknut Antiqua', serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 0.75rem;
    letter-spacing: 0.04em;
}

#ip-card-link {
    background: none;
}

#ip-card-link:hover .ip-card-img {
    border-color: rgba(var(--gold-rgb), 0.6);
    opacity: 0.9;
}

.ip-card-img {
    width: 100%;
    border-radius: 4.8%/3.4%;
    border: 1px solid rgba(var(--gold-rgb), 0.2);
    display: block;
    cursor: pointer;
    transition: border-color 0.2s ease, opacity 0.2s ease;
}

.ip-compare-cards {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.ip-compare-slot {
    width: 60%;
}

.ip-compare-name {
    font-family: 'Inknut Antiqua', serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ip-compare-link:hover .ip-card-img {
    border-color: rgba(var(--gold-rgb), 0.6);
    opacity: 0.9;
}

#ip-compare {
    transition: opacity 0.25s ease;
}

.ip-card-hint {
    font-size: 0.72rem;
    color: var(--fg-muted-5);
    text-align: center;
    margin-top: 0.4rem;
    font-style: italic;
}

/* ── Tribe info panel ─────────────────────────────────── */
#tribe-panel {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%) translateX(calc(100% + 2rem));
    width: 320px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--bg-panel);
    border: 1px solid rgba(var(--gold-rgb), 0.18);
    border-radius: 8px;
    padding: 1.5rem;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 15;
}

#tribe-panel.active {
    transform: translateY(-50%) translateX(0);
}

.tp-name {
    font-family: 'Inknut Antiqua', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

.tp-description {
    font-size: 1rem;
    color: var(--fg-desc);
    line-height: 1.65;
    font-weight: 300;
    margin-bottom: 1rem;
}

.tp-divider {
    height: 1px;
    background: rgba(var(--gold-rgb), 0.12);
    margin-bottom: 1rem;
}

.tp-count {
    font-size: 0.9rem;
    color: var(--fg-muted-5);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.9rem;
}

.tp-stats-heading {
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--fg-muted-5);
    margin-bottom: 0.5rem;
}

.tp-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.9rem;
    color: var(--fg-muted-3);
    margin-bottom: 0.35rem;
}

.tp-stat-pct {
    color: var(--gold);
    font-weight: 600;
    font-size: 0.9rem;
}

/* ── Comparison panel additions ───────────────────────── */
.tp-tribe-name {
    font-family: 'Inknut Antiqua', serif;
    font-size: 1.1rem;
}

.tp-vs {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--fg-muted-5);
    font-family: 'Inknut Antiqua', serif;
    margin: 0 0.2em;
}

.tp-legend-solid,
.tp-legend-dashed {
    display: inline-block;
    width: 22px;
    height: 0;
    vertical-align: middle;
    border-top-width: 2px;
    border-top-style: solid;
    margin-right: 4px;
}

.tp-legend-dashed {
    border-top-style: dashed;
}

.tp-compare-heading {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fg-muted-5);
    margin-top: 0.8rem;
    margin-bottom: 0.3rem;
}

.tp-compare-pcts {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.tp-compare-hint {
    font-size: 0.78rem;
    color: var(--fg-muted-5);
    font-style: italic;
    margin-top: 1.1rem;
    text-align: center;
}

/* Credits Panel */
#credits {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-panel);
    border: 1px solid rgba(var(--gold-rgb), 0.18);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    z-index: 15;
    width: fit-content;
    overflow: hidden;
    font-size: 12px;
    text-align: end;
    color: var(--fg-desc);
    cursor: pointer;
    user-select: none;
}

.credits-body {
    max-height: 0;
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s ease, max-width 0.35s ease, opacity 0.25s ease;
}

#credits.open .credits-body {
    max-height: 200px;
    max-width: 400px;
    opacity: 1;
}

h3 {
    font-family: 'Inknut Antiqua', serif;
    font-size: 12px;
    color: var(--gold);
    line-height: 1rem;
}

ul {
    display: flex;
    gap: 0.5rem;
    color: var(--fg-desc);
    justify-content: end;
    margin-top: 0.3rem;
}

ul p {
    color: var(--fg-muted-5);
    /* font-style: italic; */
}
li {
    list-style: none;
}

a {
    color: var(--gold-link);
    text-decoration: none;
    background: linear-gradient(var(--bg-link-hover), var(--bg-link-hover)) no-repeat right bottom / 0% 16px;
    transition: background-size 0.2s ease-in-out, background-position 0s 0.2s;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

a:hover {
    background-position: left bottom;
    background-size: 100% 16px;
    transition: background-size 0.2s ease-in-out;
}

.inspiration {
    font-size: 12px;
    margin-top: 0.1rem;
}

/* ── Responsive / Mobile ──────────────────────────────── */
@media (max-width: 1300px) {
    /* Switch to a vertical stacked layout */
    body {
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
    }

    main {
        display: flex;
        flex-direction: column;
        margin: 0;
        height: 100svh;
    }

    /* Title: in-flow at top, full width, compact */
    #info-title {
        position: static;
        width: 100%;
        padding: 0.5rem 1rem 0.25rem;
        bottom: auto;
        left: auto;
    }

    h1 {
        font-size: 2rem;
        line-height: 2.2rem;
        text-align: center;
    }
    
    .title {
        align-items: center;
    }

    .subtitle {
        margin-top: 0.25rem;
        font-size: 0.9rem;
        text-align: center;
    }

    /* Info panel: in-flow below title, full width */
    #info-panel {
        position: static;
        width: 100%;
        height: auto;
        max-height: 20svh;
        transform: none;
        top: auto;
        left: auto;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
        overflow-y: auto;
        padding-top: 0.5rem;
    }

    #info-panel p {
        padding: 0;
        font-size: 0.8rem;
    }

    #chart-container {
        flex: 1;
        min-height: 0;
    }

    #chart-container svg {
        width: 100%;
        height: 100%;
    }

    #tribe-panel {
        left: 0;
        right: 0;
        top: 0;
        bottom: auto;
        width: 100%;
        max-width: none;
        max-height: 42svh;
        border-radius: 0 0 12px 12px;
        transform: translateY(-100%);
        padding: 1rem;
    }

    .tp-name, .tp-description, .tp-count, .tp-stats-heading, .tp-stat-row, .tp-stats {
        font-size: 0.8rem;
        padding-bottom: 2px 0;
        margin: 0;
    }

    .tp-name {
        font-size: 1.1rem;
    }
    .tp-description {
        padding-bottom: 1rem;
    }
    #tribe-panel.active {
        transform: translateY(0);
    }

    #credits {
        bottom: 1rem;
        right: 1rem;
        max-width: 90vw;
    }
}
