/* ============================================================
   Planetary Interaction Tool
   Clean readable stylesheet
   ============================================================ */

/* ============================================================
   Design Tokens
   ============================================================ */

:root {
    --bg: #08111f;
    --panel: rgba(14, 25, 43, 0.84);
    --panel-strong: rgba(7, 13, 23, 0.90);
    --panel-soft: rgba(22, 39, 65, 0.78);
    --line: rgba(139, 173, 210, 0.22);

    --text: #eef6ff;
    --muted: #9fb2c7;

    --gold: #ffb84d;
    --cyan: #5fe1ff;
    --green: #6dffb2;
    --red: #ff6d8a;
    --purple: #c792ff;

    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 12px;

    --shadow-panel: 0 18px 60px rgba(0, 0, 0, 0.32);
}


/* ============================================================
   Base
   ============================================================ */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 28px;
    color: var(--text);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    background:
        radial-gradient(circle at 15% 10%, rgba(61, 135, 255, 0.32), transparent 34%),
        radial-gradient(circle at 85% 0%, rgba(255, 184, 77, 0.18), transparent 28%),
        linear-gradient(135deg, #06101c, #0b1220 48%, #070a12);
}

a {
    color: inherit;
}

footer {
    max-width: 1320px;
    margin: 20px auto 0;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}


/* ============================================================
   Shared Panels
   ============================================================ */

.hero > div,
.search,
.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, var(--panel), var(--panel-strong));
    box-shadow: var(--shadow-panel);
    backdrop-filter: blur(12px);
}

.panel {
    padding: 22px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.panel h2 {
    margin: 8px 0 0;
    font-size: 28px;
}

.side-panel h2 {
    margin: 0 0 6px;
    font-size: 20px;
}

.muted,
.node-meta,
.planets {
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

.planets {
    color: #ccefff;
}


/* ============================================================
   Hero
   ============================================================ */

.hero {
    max-width: 1320px;
    margin: 0 auto 22px;
    display: flex;
    gap: 20px;
    align-items: stretch;
    justify-content: space-between;
}

.hero > div {
    flex: 1;
    padding: 28px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 12px;
    font-weight: 800;
}

.hero h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 56px);
    letter-spacing: -0.04em;
}

.sub {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 16px;
}


/* ============================================================
   Product Search
   ============================================================ */

.search {
    min-width: 340px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
}

.search label {
    color: #cfe7ff;
    font-weight: 800;
}

.search select,
.tier-highlight-form select {
    width: 100%;
    appearance: none;
    border: 1px solid rgba(95, 225, 255, 0.35);
    border-radius: 14px;
    background: #081522;
    color: var(--text);
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 800;
    outline: none;
}

.search select:focus,
.tier-highlight-form select:focus {
    border-color: rgba(95, 225, 255, 0.72);
    box-shadow: 0 0 0 3px rgba(95, 225, 255, 0.10);
}


/* ============================================================
   Main Layout
   ============================================================ */

.layout {
    max-width: 1320px;
    margin: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 22px;
}


/* ============================================================
   Action Links
   ============================================================ */

.eve-link {
    padding: 10px 14px;
    border: 1px solid rgba(255, 184, 77, 0.35);
    border-radius: 999px;
    color: var(--gold);
    background: rgba(255, 184, 77, 0.08);
    text-decoration: none;
    font-weight: 800;
}

.eve-link:hover {
    border-color: rgba(255, 184, 77, 0.65);
    background: rgba(255, 184, 77, 0.14);
}

.clear-filter {
    display: inline-flex;
    margin: -10px 0 24px;
    color: var(--cyan);
    font-size: 13px;
    text-decoration: none;
}

.clear-filter:hover {
    text-decoration: underline;
}


/* ============================================================
   Production Tree
   ============================================================ */

.tree {
    position: relative;
    margin: 0 0 0 22px;
    padding: 0;
    list-style: none;
}

.tree::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 0;
    bottom: 10px;
    border-left: 1px solid var(--line);
}

.root {
    margin-left: 0;
}

.root::before {
    display: none;
}

.node {
    position: relative;
    margin: 12px 0;
}

.node::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 28px;
    width: 12px;
    border-top: 1px solid var(--line);
}

.root > .node::before {
    display: none;
}

.node-card {
    position: relative;
    padding: 14px 14px 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel-soft);
    overflow: hidden;
    transition:
        opacity 0.18s ease,
        transform 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        filter 0.18s ease;
}

.node-card::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--cyan);
}

.node-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 14px var(--cyan);
}

.badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 9px;
    color: #dcecff;
    background: rgba(255, 255, 255, 0.06);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    font-weight: 900;
}

.batch-pill {
    display: inline-flex;
    margin-left: 4px;
    padding: 2px 7px;
    border: 1px solid rgba(255, 184, 77, 0.38);
    border-radius: 999px;
    color: var(--gold);
    background: rgba(255, 184, 77, 0.08);
    font-weight: 800;
}


/* ============================================================
   Tier Colours
   ============================================================ */

.p4 .dot,
.p4::after {
    background: var(--purple);
}

.p3 .dot,
.p3::after {
    background: var(--red);
}

.p2 .dot,
.p2::after {
    background: var(--gold);
}

.p1 .dot,
.p1::after {
    background: var(--green);
}

.raw .dot,
.raw::after,
.planets .dot,
.planets::after {
    background: var(--cyan);
}


/* ============================================================
   Raw Materials
   ============================================================ */

.raw-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 14px 0 24px;
}

.raw-chip {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    padding: 11px 12px;
    text-decoration: none;
}

.raw-chip:hover,
.raw-chip.active {
    border-color: rgba(95, 225, 255, 0.65);
    background: rgba(95, 225, 255, 0.10);
}

.raw-chip em {
    color: var(--gold);
    font-style: normal;
    font-weight: 900;
}

.raw-chip.needed {
    border-color: rgba(109, 255, 178, 0.55);
    background: rgba(109, 255, 178, 0.08);
}

.raw-chip.needed em {
    color: var(--green);
}


/* ============================================================
   Planet Sources
   ============================================================ */

.planet-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.side-panel .planet-grid.planet-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: stretch;
}

.side-panel .planet-grid.planet-links a {
    box-sizing: border-box;
    flex: 0 0 calc(50% - 8px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    margin: 0;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.045);
    color: #cfe7ff;
    line-height: 1.2;
    text-decoration: none;
}

.side-panel .planet-grid.planet-links a:hover,
.side-panel .planet-grid.planet-links a.active {
    border-color: rgba(95, 225, 255, 0.62);
    background: rgba(95, 225, 255, 0.10);
    box-shadow: 0 0 24px rgba(95, 225, 255, 0.08);
}

.side-panel .planet-grid.planet-links a span {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    line-height: 1.2;
}

.side-panel .planet-grid.planet-links a em {
    display: inline-block;
    margin-left: 8px;
    color: var(--gold);
    font-style: normal;
    font-weight: 900;
    font-size: 12px;
}

.source-detail {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}


/* ============================================================
   View Mode Controls
   ============================================================ */

.tier-highlight-form {
    margin: 10px 0 22px;
}


/* ============================================================
   View Mode Highlighting
   ============================================================ */

body.view-raw .node-card:not(.raw),
body.view-p1 .node-card:not(.p1),
body.view-p2 .node-card:not(.p2),
body.view-p3 .node-card:not(.p3),
body.view-p4 .node-card:not(.p4),
body.view-planets .node-card:not(.planets) {
    opacity: 0.34;
    filter: saturate(0.55) brightness(0.78);
}

body.view-raw .node-card.raw {
    border-color: rgba(95, 225, 255, 0.88);
    box-shadow:
        0 0 0 1px rgba(95, 225, 255, 0.25),
        0 0 42px rgba(95, 225, 255, 0.25);
}

body.view-p1 .node-card.p1 {
    border-color: rgba(109, 255, 178, 0.88);
    box-shadow:
        0 0 0 1px rgba(109, 255, 178, 0.25),
        0 0 42px rgba(109, 255, 178, 0.25);
}

body.view-p2 .node-card.p2 {
    border-color: rgba(255, 184, 77, 0.88);
    box-shadow:
        0 0 0 1px rgba(255, 184, 77, 0.25),
        0 0 42px rgba(255, 184, 77, 0.25);
}

body.view-p3 .node-card.p3 {
    border-color: rgba(255, 109, 138, 0.88);
    box-shadow:
        0 0 0 1px rgba(255, 109, 138, 0.25),
        0 0 42px rgba(255, 109, 138, 0.25);
}

body.view-p4 .node-card.p4 {
    border-color: rgba(199, 146, 255, 0.88);
    box-shadow:
        0 0 0 1px rgba(199, 146, 255, 0.25),
        0 0 42px rgba(199, 146, 255, 0.25);
}

body.view-planets .node-card.planets {
    border-color: rgba(95, 225, 255, 0.88);
    box-shadow:
        0 0 0 1px rgba(95, 225, 255, 0.25),
        0 0 42px rgba(95, 225, 255, 0.25);
}

body.view-raw .node-card.raw,
body.view-p1 .node-card.p1,
body.view-p2 .node-card.p2,
body.view-p3 .node-card.p3,
body.view-p4 .node-card.p4,
body.view-planets .node-card.planets {
    opacity: 1;
    filter: none;
    transform: translateX(6px);
}


/* ============================================================
   Source / Planet Matching
   ============================================================ */

body.source-filter-active .node-card:not(.source-match) {
    opacity: 0.30;
    filter: saturate(0.45) brightness(0.72);
}

body.source-filter-active .node-card.source-match {
    opacity: 1;
    filter: none;
    transform: translateX(8px);
    border-color: rgba(95, 225, 255, 0.95);
    box-shadow:
        0 0 0 1px rgba(95, 225, 255, 0.30),
        0 0 48px rgba(95, 225, 255, 0.30);
}

body.planet-filter-active .node-card.planet-match {
    opacity: 1;
    filter: none;
    transform: translateX(8px);
    border-color: rgba(255, 184, 77, 0.92);
    box-shadow:
        0 0 0 1px rgba(255, 184, 77, 0.26),
        0 0 46px rgba(255, 184, 77, 0.22);
}


/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 900px) {
    body {
        padding: 16px;
    }

    .hero,
    .layout {
        display: grid;
        grid-template-columns: 1fr;
    }

    .layout {
        gap: 16px;
    }

    .search {
        min-width: 0;
    }

    .tree {
        margin-left: 14px;
    }

    .panel-head {
        flex-direction: column;
    }

    .side-panel .planet-grid.planet-links a {
        flex-basis: 100%;
    }
}
