/* HippieStation webmap — minimal styling. */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font: 13px/1.4 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #111;
    color: #ddd;
}

body {
    display: grid;
    grid-template:
        "topbar topbar"  44px
        "side   map"     1fr / 280px 1fr;
    height: 100vh;
}

.topbar {
    grid-area: topbar;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    background: #1c1c20;
    border-bottom: 1px solid #2c2c33;
}

.topbar h1 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: #eee;
    flex: 0 0 auto;
}

.topbar label { font-size: 12px; color: #aaa; }

.topbar select,
.topbar input[type="search"] {
    margin-left: 6px;
    background: #2a2a31;
    color: #eee;
    border: 1px solid #3a3a44;
    border-radius: 3px;
    padding: 3px 8px;
    font: inherit;
}

.topbar input[type="search"] { width: 220px; }

.status {
    margin-left: auto;
    color: #888;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.sidebar {
    grid-area: side;
    overflow-y: auto;
    background: #16161a;
    border-right: 1px solid #2c2c33;
    padding: 12px;
}

.panel + .panel { margin-top: 18px; }

.panel h2 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #777;
    margin: 0 0 8px;
}

.hint {
    margin: 0 0 8px;
    color: #666;
    font-size: 11px;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
}

.filters label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
}

.filters input[type=checkbox] { accent-color: #4080c0; }

#pinned-list, #search-results { list-style: none; padding: 0; margin: 0; }

#pinned-list li, #search-results li {
    padding: 6px 8px;
    background: #1f1f25;
    border: 1px solid #2c2c33;
    border-radius: 3px;
    margin-bottom: 6px;
    font-size: 12px;
}

.entry-name { font-weight: 600; color: #fff; }
.entry-coord { color: #888; font-size: 10px; margin-left: 6px; }
.entry-desc { color: #bbb; margin-top: 4px; }
.entry-type {
    color: #6699bb;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 10px;
    /* Type paths can be 80+ chars. overflow-wrap (not break-all) lets the
       browser wrap *only* if the path doesn't fit the available width, so
       short paths stay on one line. */
    overflow-wrap: anywhere;
}
.entry-cat {
    display: inline-block;
    padding: 0 5px;
    border-radius: 2px;
    background: #2c2c33;
    color: #aaa;
    font-size: 10px;
    margin-left: 4px;
}
.entry-count {
    display: inline-block;
    padding: 0 5px;
    border-radius: 2px;
    background: #1f3a4a;
    color: #cfe;
    font-size: 10px;
    margin-left: 4px;
    font-weight: 600;
}

.pin-remove, .result-jump {
    cursor: pointer;
    background: none;
    border: 0;
    color: #888;
    padding: 0 4px;
    float: right;
}
.pin-remove:hover, .result-jump:hover { color: #eee; }

#map {
    grid-area: map;
    cursor: crosshair;
    background: #000;
}

/* Per-z-level background. Body data-zname is set by switchZ in main.js.
   Layer order matches code/_onclick/hud/parallax.dm:22-29. In-game one
   random-layer (space_gas|asteroids) and one random-galaxy (1..4) are
   picked, but for the static webmap we show all of them at distinct
   anchor positions so every map session looks the same.
   CSS paints first-listed on top, so list below is front-to-back.

   `background-position` is rewritten on every map pan by main.js
   (see updateParallax). The values here are the PARALLAX_BASES anchors;
   main.js adds the per-layer pan delta on top. */
/* Layer order matches the game's BYOND `layer` values from
   code/_onclick/hud/parallax.dm. Higher layer = drawn on top in BYOND;
   CSS background-image stacks first-listed on top, so the order below
   is reversed from add-order in parallax.dm.

   game layer 30 -> planet     (TOP)
   game layer  3 -> random_layer (asteroids / space_gas)
   game layer  3 -> layer_3
   game layer  2 -> layer_2
   game layer  1 -> galaxy
   game layer  1 -> layer_1    (BACK) */
body[data-zname="station"] #map,
body[data-zname="centcom"] #map {
    background-color: #04040a;
    background-image:
        url('vendor/parallax_asteroids.png'), /* tiled, in front */
        url('vendor/parallax_planet.png'),    /* big, behind asteroids */
        url('vendor/parallax_space_gas.png'), /* tiled nebula */
        url('vendor/parallax_layer3.png'),    /* closest stars */
        url('vendor/parallax_layer2.png'),    /* mid stars */
        url('vendor/parallax_galaxy.png'),    /* galaxy A */
        url('vendor/parallax_galaxy3.png'),   /* galaxy B */
        url('vendor/parallax_layer1.png');    /* deepest stars - back */
    background-repeat:
        repeat,         /* asteroids - tiled */
        no-repeat,      /* planet */
        repeat,         /* space_gas - tiled */
        repeat,         /* layer3 */
        repeat,         /* layer2 */
        no-repeat,      /* galaxy */
        no-repeat,      /* galaxy3 */
        repeat;         /* layer1 */
    background-size:
        960px 960px,    /* asteroids */
        1440px 1440px,  /* planet - big */
        720px 720px,    /* space_gas */
        480px 480px,    /* layer3 */
        480px 480px,    /* layer2 */
        480px 480px,    /* galaxy */
        480px 480px,    /* galaxy3 */
        480px 480px;    /* layer1 */
    image-rendering: pixelated;
}

body[data-zname="lavaland"] #map {
    background:
        radial-gradient(ellipse at 50% 50%, rgba(160, 50, 10, 0.45) 0%, transparent 70%),
        radial-gradient(ellipse at 20% 80%, rgba(120, 40, 10, 0.4) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 20%, rgba(80, 30, 10, 0.5) 0%, transparent 60%),
        #1a0a05;
}

/* Pixel-art tiles. Match slimbus exactly: just image-rendering, nothing else. */
img {
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

/* Override Leaflet 1.9.x's default tile compositing.
   Leaflet ships `.leaflet-container img.leaflet-tile { mix-blend-mode: plus-lighter }`
   which additively blends each tile's RGBA with whatever sits behind it,
   clamped to white. Slimbus has a black #map background so the addition
   is a no-op. We have a bright parallax behind tiles, so the additive
   blend turns every tile-edge anti-alias pixel into saturated white --
   visible as continuous white seams between tiles. Force normal alpha
   compositing to fix it. */
.leaflet-container img.leaflet-tile {
    mix-blend-mode: normal;
}

/* Leaflet tooltip override — dark theme, comfortable width. min-width
   guarantees the box doesn't collapse to a thin column when the only long
   token is a wrappable type path. */
.leaflet-tooltip.webmap-tip {
    background: rgba(20, 20, 25, 0.95);
    color: #eee;
    border: 1px solid #3a3a44;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
    padding: 6px 8px;
    font-size: 12px;
    min-width: 320px;
    max-width: 480px;
    white-space: normal;
    overflow-wrap: anywhere;
}
.leaflet-tooltip.webmap-tip:before { display: none; }

.tip-coord { color: #888; font-size: 10px; margin-bottom: 4px; }
.tip-entry + .tip-entry { margin-top: 5px; padding-top: 5px; border-top: 1px solid #2c2c33; }
