/* ============================================================
   KONSTELASI.CSS  —  regulasiku.id front page
   The search box (combobox) and the constellation panel (3D graph of
   regulations and their relations), plus the crawlable key-laws list.
   Used by index.html only, together with _js/konstelasi.js.

   Every class is prefixed "ks-" so nothing here can collide with the
   front page's own inline styles (e.g. its .pill) or a shared sheet.

   The site has no dark mode. The page stays light; the panel has its
   own light and dark palette (.ks-sky[data-mode]) which follows
   prefers-color-scheme unless the panel's own ☾/☀ toggle overrides it.
   ============================================================ */

.ks-visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}

/* ── Search ── */
.ks-search {
    position: relative;
    max-width: 680px;
    margin: 28px auto 0;
    text-align: left;
}

.ks-search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card, #fff);
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: 999px;
    padding: 6px 8px 6px 20px;
    box-shadow: 0 8px 28px -14px rgba(15, 40, 50, .35);
    transition: border-color .15s;
}
.ks-search-box:focus-within { border-color: var(--accent, #357d90); }
.ks-search-box svg { flex: none; color: var(--text-muted, #64748b); }

.ks-search-box input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 1.05rem;
    color: var(--text-primary, #0f172a);
    padding-block: 10px;
}
.ks-search-box input::placeholder { color: var(--text-muted, #64748b); }
.ks-search-box input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.ks-search-clear {
    flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border: 0; border-radius: 50%;
    background: var(--bg-muted, #f1f5f9);
    color: var(--text-muted, #64748b);
    cursor: pointer;
}
.ks-search-clear:hover { background: var(--border, #e2e8f0); color: var(--text-primary, #0f172a); }
.ks-search-clear[hidden] { display: none; }

.ks-search-go {
    flex: none;
    border: 0;
    border-radius: 999px;
    background: var(--accent, #357d90);
    color: #fff;
    font: inherit;
    font-weight: 600;
    font-size: .95rem;
    padding: 10px 18px;
    cursor: pointer;
}
.ks-search-go:hover { background: var(--accent-dark, #2a6474); }

.ks-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ks-search-field {
    position: relative;   /* anchors .ks-results under the search box */
    flex: 1;
    min-width: 0;
}
/* "Jelajah": same size and look as the "Cari" button inside the box */
.ks-browse {
    flex: none;
    border-radius: 999px;
    background: var(--accent, #357d90);
    color: #fff;
    font-weight: 600;
    font-size: .95rem;
    padding: 10px 18px;
}
.ks-browse:hover { background: var(--accent-dark, #2a6474); color: #fff; }

.ks-results {
    position: absolute;
    left: 0; right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 18px 40px -18px rgba(15, 40, 50, .45);
    padding: 6px;
    margin: 0;
    list-style: none;
    max-height: 214px;   /* about 5 rows; the rest scrolls */
    overflow-y: scroll;
}
.ks-results[hidden] { display: none; }
.ks-results li {
    display: flex;
    gap: 10px;
    align-items: baseline;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
}
.ks-results li[aria-selected="true"],
.ks-results li:hover { background: var(--accent-light, #e8f4f7); }
.ks-results .ks-r-cite { font-weight: 700; color: var(--text-primary, #0f172a); white-space: nowrap; }
.ks-results .ks-r-title {
    color: var(--text-muted, #64748b);
    font-size: .9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.ks-results .ks-r-empty { color: var(--text-muted, #64748b); cursor: default; }
.ks-results .ks-r-empty:hover { background: none; }

.ks-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; align-self: center; display: inline-block; }

/* ── Constellation panel ── */
.ks-wrap { padding: 8px 48px 40px; }

.ks-sky {
    --sky: #edf4f6;
    --sky-2: #fbfdfd;
    --sky-line: #d3e1e6;
    --sky-text: #102a33;
    --sky-muted: #587580;
    --sky-panel: rgba(255, 255, 255, .95);
    --sky-chip: rgba(255, 255, 255, .88);
    --sky-hover: rgba(42, 127, 147, .10);
    --ok-fg: #1f7a4a; --ok-line: #b9dcc8;
    --open-bg: #2a7f93; --open-fg: #ffffff;
    --c-uud: #c28a14;
    --c-uu: #2a7f93;
    --c-perpu: #d0654b;
    --c-perbps: #7a63c9;
    --c-kolonial: #5b8f3a;
    --c-perubahan: #c2418c;
    --c-other: #7f9095;
    --link-amend: 42, 127, 147;
    --link-ratify: 208, 101, 75;
    --link-basis: 70, 105, 118;
    --ring: #102a33;
    --star: 0;

    position: relative;
    background: radial-gradient(120% 90% at 50% 40%, var(--sky-2), var(--sky) 70%);
    color: var(--sky-text);
    border-radius: 14px;
    overflow: hidden;
    height: clamp(440px, 68vh, 680px);
    border: 1px solid var(--sky-line);
    font-family: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
}
.ks-sky[data-mode="dark"] {
    --sky: #0b1a21;
    --sky-2: #10242d;
    --sky-line: #1d3a46;
    --sky-text: #e3eff2;
    --sky-muted: #8fa9b2;
    --sky-panel: rgba(10, 24, 31, .94);
    --sky-chip: rgba(8, 20, 26, .72);
    --sky-hover: rgba(113, 197, 214, .12);
    --ok-fg: #9fe0b8; --ok-line: #2e5a44;
    --open-bg: #71c5d6; --open-fg: #06222b;
    --c-uud: #e8c46b;
    --c-uu: #71c5d6;
    --c-perpu: #ef8f78;
    --c-perbps: #b4a5e8;
    --c-kolonial: #9dd17a;
    --c-perubahan: #f08cc4;
    --c-other: #a8b8be;
    --link-amend: 113, 197, 214;
    --link-ratify: 239, 143, 120;
    --link-basis: 150, 180, 190;
    --ring: #ffffff;
    --star: 1;
    color-scheme: dark;
}
.ks-sky :focus-visible { outline: 2px solid var(--c-uu); outline-offset: 2px; }

.ks-sky canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.ks-sky canvas.ks-dragging { cursor: grabbing; }

.ks-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    color: var(--sky-muted);
    font-size: .95rem;
}
.ks-status[hidden] { display: none; }

.ks-top {
    position: absolute;
    left: 16px; top: 14px; right: 16px;
    display: flex;
    justify-content: space-between;
    gap: 8px 12px;
    pointer-events: none;
    flex-wrap: wrap;
}
.ks-top > * { pointer-events: auto; }
.ks-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .82rem; color: var(--sky-muted); }
.ks-legend span { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.ks-legend .ks-ln { width: 18px; height: 0; border-top: 2px solid; display: inline-block; }
.ks-stats { font-size: .82rem; color: var(--sky-muted); font-variant-numeric: tabular-nums; }
.ks-stats b { color: var(--sky-text); font-weight: 600; }

.ks-controls { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 6px; }
.ks-controls button, .ks-controls a {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    border-radius: 9px;
    border: 1px solid var(--sky-line);
    background: var(--sky-panel);
    color: var(--sky-text);
    font: inherit;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
}
.ks-controls button:hover, .ks-controls a:hover { border-color: var(--c-uu); }
.ks-hint { position: absolute; left: 16px; bottom: 14px; font-size: .78rem; color: var(--sky-muted); }

.ks-tip {
    position: absolute;
    pointer-events: none;
    background: var(--sky-panel);
    border: 1px solid var(--sky-line);
    color: var(--sky-text);
    font-size: .82rem;
    padding: 5px 9px;
    border-radius: 7px;
    white-space: nowrap;
    transform: translate(12px, -50%);
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ks-tip[hidden] { display: none; }

.ks-card {
    position: absolute;
    right: 14px; top: 56px;
    width: min(340px, calc(100% - 28px));
    background: var(--sky-panel);
    color: var(--sky-text);
    border: 1px solid var(--sky-line);
    border-radius: 12px;
    box-shadow: 0 16px 36px -20px rgba(10, 30, 40, .45);
    padding: 16px 16px 14px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    max-height: calc(100% - 120px);
    overflow-y: auto;
    line-height: 1.5;
}
.ks-card[hidden] { display: none; }
.ks-card-close {
    position: absolute;
    right: 8px; top: 8px;
    border: 0;
    background: transparent;
    color: var(--sky-muted);
    font-size: 1.2rem;
    cursor: pointer;
    width: 30px; height: 30px;
    border-radius: 6px;
}
.ks-card-close:hover { color: var(--sky-text); }
.ks-card-kind { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--sky-muted); display: flex; align-items: center; gap: 7px; }
.ks-card-cite { font-family: 'Lora', Georgia, serif; font-size: 1.35rem; font-weight: 700; margin: 4px 0 2px; color: var(--sky-text); }
.ks-card-title { font-size: .95rem; color: var(--sky-text); margin: 0 0 10px; text-wrap: pretty; }
.ks-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ks-pill { font-size: .75rem; border: 1px solid var(--sky-line); border-radius: 999px; padding: 2px 9px; color: var(--sky-muted); font-variant-numeric: tabular-nums; }
.ks-pill.ks-ok { color: var(--ok-fg); border-color: var(--ok-line); }
.ks-card h3 { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--sky-muted); margin: 12px 0 6px; font-weight: 600; }
.ks-rel { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.ks-rel button {
    all: unset;
    cursor: pointer;
    display: flex;
    gap: 8px;
    align-items: baseline;
    font-size: .88rem;
    color: var(--sky-text);
    padding: 3px 4px;
    border-radius: 6px;
}
.ks-rel button:hover, .ks-rel button:focus-visible { background: var(--sky-hover); }
.ks-rel em { font-style: normal; color: var(--sky-muted); font-size: .8rem; }
.ks-card-open {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    text-decoration: none;
    background: var(--open-bg);
    color: var(--open-fg);
    font-weight: 700;
    font-size: .9rem;
    padding: 8px 14px;
    border-radius: 9px;
}
.ks-card-none { font-size: .85rem; color: var(--sky-muted); margin: 0; }

.ks-caption {
    margin-top: 12px;
    font-size: .88rem;
    color: var(--text-muted, #64748b);
    max-width: 75ch;
}

@media screen and (max-width: 900px) {
    .ks-wrap { padding: 8px 32px 36px; }
}

@media screen and (max-width: 720px) {
    .ks-wrap { padding: 4px 12px 28px; }
    .ks-card { top: auto; bottom: 58px; right: 10px; left: 10px; width: auto; max-height: 55%; }
    .ks-hint { display: none; }
    .ks-search-box { padding-left: 14px; }
    .ks-search-go { padding: 9px 14px; }
    .ks-search-row { gap: 8px; }
    .ks-browse { padding: 9px 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .ks-search-box, .ks-sky * { transition: none !important; }
}

