/* ==================================================
   AURORA NEXUS v2 — Portal Digital
   Ringan (tanpa blur berat), responsif, Light/Dark/System
================================================== */

:root {
    color-scheme: light;

    --bg: #f6f8fb;
    --card: #ffffff;
    --card-hover: #ffffff;
    --soft: #eef2f7;

    --text: #121a24;
    --text-2: #566478;
    --text-3: #8795a8;

    --line: rgba(100,116,139,.16);
    --line-strong: rgba(100,116,139,.28);

    --mint: #0fa97a;
    --mint-soft: rgba(16,185,129,.12);
    --cyan: #0891b2;
    --violet: #7c5cf0;
    --amber: #f5a524;

    --grad: linear-gradient(120deg, #10b981, #06b6d4 55%, #8b5cf6);
    --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.05);
    --shadow-hover: 0 2px 4px rgba(15,23,42,.05), 0 18px 40px rgba(16,185,129,.16);

    --radius: 18px;
    --ease: cubic-bezier(.2,.7,.2,1);
}

:root[data-mode="dark"] {
    color-scheme: dark;

    --bg: #0d1218;
    --card: #151c25;
    --card-hover: #19222d;
    --soft: #1e2833;

    --text: #eef4f6;
    --text-2: #a9b7c6;
    --text-3: #7d8da0;

    --line: rgba(148,163,184,.13);
    --line-strong: rgba(148,163,184,.25);

    --mint: #34d399;
    --mint-soft: rgba(52,211,153,.13);
    --cyan: #22d3ee;
    --violet: #a78bfa;

    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    --shadow-hover: 0 2px 4px rgba(0,0,0,.35), 0 18px 40px rgba(52,211,153,.12);
}


/* ---------- RESET ---------- */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
    line-height: 1.5;
    transition: background .3s, color .3s;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
button, a { -webkit-tap-highlight-color: transparent; }

.container { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }

:focus-visible { outline: 3px solid var(--mint); outline-offset: 3px; border-radius: 10px; }


/* ---------- BACKGROUND (GPU-friendly) ---------- */

.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: var(--bg); }

.bg-blob {
    position: absolute;
    width: 60vmax; height: 60vmax;
    border-radius: 50%;
    opacity: .5;
    will-change: transform;
}
.blob-a {
    top: -35vmax; left: -20vmax;
    background: radial-gradient(circle, rgba(16,185,129,.28), transparent 65%);
    animation: drift 22s ease-in-out infinite alternate;
}
.blob-b {
    right: -25vmax; top: 10vh;
    background: radial-gradient(circle, rgba(139,92,246,.24), transparent 65%);
    animation: drift 28s ease-in-out -8s infinite alternate-reverse;
}
:root[data-mode="dark"] .bg-blob { opacity: .6; }

.bg-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(var(--line) 1px, transparent 1px),
        linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 56px 56px;
    opacity: .45;
    -webkit-mask-image: linear-gradient(to bottom, #000, transparent 60%);
            mask-image: linear-gradient(to bottom, #000, transparent 60%);
}

@keyframes drift {
    from { transform: translate3d(0,0,0) scale(.9); }
    to   { transform: translate3d(6vmax,5vmax,0) scale(1.12); }
}

.site-wrapper { position: relative; }


/* ---------- ANIMASI UMUM ---------- */

@keyframes rise {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
}


/* ---------- TOPBAR ---------- */

.topbar { padding: 14px 0 8px; }

.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-logo-wrap {
    flex-shrink: 0;
    width: 44px; height: 44px;
    display: grid; place-items: center;
    border-radius: 14px;
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.brand-logo-wrap.small { width: 36px; height: 36px; border-radius: 11px; }
.brand-logo { width: 100%; height: 100%; object-fit: contain; padding: 5px; }

.brand-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand-info strong {
    font-size: 14px; font-weight: 700; letter-spacing: -.2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-info span { font-size: 11px; color: var(--text-2); }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.btn-wa {
    display: inline-flex; align-items: center; gap: 8px;
    height: 40px; padding: 0 16px;
    border-radius: 12px;
    font-size: 13px; font-weight: 600;
    color: #fff;
    background: linear-gradient(120deg, #10b981, #059669);
    box-shadow: 0 6px 18px rgba(16,185,129,.25);
    transition: transform .25s var(--ease), box-shadow .25s;
}
.btn-wa i { font-size: 18px; }
.btn-wa:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(16,185,129,.35); }

.theme-switcher {
    display: flex; gap: 2px; padding: 3px;
    border-radius: 12px;
    background: var(--soft);
    border: 1px solid var(--line);
}
.theme-switcher button {
    width: 34px; height: 32px;
    display: grid; place-items: center;
    border-radius: 9px;
    font-size: 17px;
    color: var(--text-3);
    transition: color .2s, background .25s, transform .2s;
}
.theme-switcher button:hover { color: var(--mint); }
.theme-switcher button:active { transform: scale(.9); }
.theme-switcher button.active {
    color: #fff;
    background: var(--grad);
    box-shadow: 0 3px 10px rgba(16,185,129,.3);
}


/* ---------- TOOLBAR (STICKY) ---------- */

#sentinel { height: 1px; }

.toolbar {
    position: sticky; top: 0; z-index: 50;
    padding: 12px 0 10px;
    background: white, transparent);
    -webkit-backdrop-filter: blur(12px);
            backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color .25s, box-shadow .25s;
}
.toolbar.stuck { border-color: #fff; box-shadow: 0 8px 24px rgba(15,23,42,.06); }

.toolbar-inner { display: flex; flex-direction: column; gap: 10px; }

.search {
    position: relative;
    display: flex; align-items: center;
    width: 100%; max-width: 720px;
}
.search-icon {
    position: absolute; left: 16px;
    font-size: 20px; color: var(--text-3);
    pointer-events: none;
    transition: color .2s;
}
.search input {
    width: 100%; height: 54px;
    padding: 0 60px 0 48px;
    font-size: 15px;
    background: var(--card);
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    outline: none;
    box-shadow: var(--shadow);
    transition: border-color .25s, box-shadow .25s;
    -webkit-appearance: none; appearance: none;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input::placeholder { color: var(--text-3); }
.search input:focus {
    border-color: var(--mint);
    box-shadow: 0 0 0 4px rgba(16,185,129,.12), var(--shadow);
}
.search:focus-within .search-icon { color: var(--mint); }

.search-key {
    position: absolute; right: 14px;
    min-width: 26px; height: 26px;
    display: grid; place-items: center;
    padding: 0 7px;
    border-radius: 8px;
    font: 600 12px 'Space Grotesk', sans-serif;
    color: var(--text-3);
    background: var(--soft);
    border: 1px solid var(--line);
    pointer-events: none;
}
.search-clear {
    display: none;
    position: absolute; right: 10px;
    width: 34px; height: 34px;
    place-items: center;
    border-radius: 10px;
    color: var(--text-2);
    background: var(--soft);
    transition: background .2s, transform .2s;
}
.search-clear:hover { background: var(--line-strong); }
.search-clear:active { transform: scale(.9); }
.search.has-value .search-clear { display: grid; }
.search.has-value .search-key { display: none; }

/* chips (filter kategori) */
.chips {
    position: relative;               /* patokan offsetLeft untuk centering chip aktif */
    display: flex; gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 4px;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
    flex-shrink: 0;
    display: inline-flex; align-items: center; gap: 7px;
    height: 36px; padding: 0 13px;
    border-radius: 999px;
    font-size: 12.5px; font-weight: 600;
    color: var(--text-2);
    background: var(--card);
    border: 1px solid var(--line);
    scroll-snap-align: start;
    white-space: nowrap;
    transition: color .2s, background .25s, border-color .25s, transform .2s, opacity .2s;
}
.chip i { font-size: 16px; }
.chip em {
    font-style: normal; font-size: 10.5px;
    min-width: 20px; height: 20px;
    display: grid; place-items: center;
    padding: 0 6px;
    border-radius: 999px;
    color: var(--text-2);
    background: var(--soft);
}
.chip:hover { color: var(--mint); border-color: rgba(16,185,129,.4); transform: translateY(-1px); }
.chip.active {
    color: #fff;
    background: var(--grad);
    border-color: transparent;
    box-shadow: 0 6px 16px rgba(16,185,129,.28);
}
.chip.active em { color: #fff; background: rgba(255,255,255,.25); }

/* kategori tanpa hasil saat mencari */
.chip.is-empty:not(.active) { opacity: .45; }


/* ---------- DIRECTORY ---------- */

.directory { padding: 14px 0 40px; min-height: 60vh; }

.search-info { min-height: 20px; margin: 8px 2px 4px; font-size: 12.5px; color: var(--text-2); }

/* jarak di bawah (bukan di atas) agar section tersembunyi tidak meninggalkan celah */
.cat-section { margin-bottom: 34px; }

.cat-head { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }

.cat-icon {
    flex-shrink: 0;
    width: 44px; height: 44px;
    display: grid; place-items: center;
    border-radius: 14px;
    font-size: 23px;
    color: var(--mint);
    background: var(--mint-soft);
}
.cat-icon.fav { color: var(--amber); background: rgba(245,165,36,.14); }

.cat-title { flex: 1; min-width: 0; }
.cat-title h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 19px; letter-spacing: -.02em; line-height: 1.25;
}
.cat-title p { margin-top: 2px; font-size: 12.5px; color: var(--text-2); }

.cat-count {
    min-width: 32px; height: 32px;
    display: grid; place-items: center;
    padding: 0 10px;
    border-radius: 10px;
    font: 700 13px 'Space Grotesk', sans-serif;
    color: var(--mint);
    background: var(--mint-soft);
}

.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 12px;
}

/* transisi singkat saat berpindah tab kategori */
#categories.swap { animation: rise .35s var(--ease); }


/* ---------- LINK CARD ---------- */

.link-card {
    --mx: 50%; --my: 50%;
    position: relative;
    isolation: isolate;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform .3s var(--ease), box-shadow .3s, border-color .3s, background .3s;
}

/* spotlight mengikuti kursor */
.link-card::before {
    content: "";
    position: absolute; inset: 0;
    z-index: -1;
    opacity: 0;
    background: radial-gradient(260px circle at var(--mx) var(--my), rgba(16,185,129,.16), transparent 70%);
    transition: opacity .3s;
}

.link-card:hover {
    transform: translateY(-4px);
    background: var(--card-hover);
    border-color: rgba(16,185,129,.45);
    box-shadow: var(--shadow-hover);
}
.link-card:hover::before { opacity: 1; }
.link-card:active { transform: translateY(-1px) scale(.99); }

.link-main {
    display: flex; align-items: center; gap: 14px;
    min-height: 78px;
    padding: 14px 54px 14px 14px;
}

.link-icon {
    flex-shrink: 0;
    width: 46px; height: 46px;
    display: grid; place-items: center;
    border-radius: 14px;
    font-size: 23px;
    color: var(--mint);
    background: var(--mint-soft);
    transition: transform .35s var(--ease), color .25s, background .25s, box-shadow .25s;
}
.link-card:hover .link-icon {
    color: #fff;
    background: var(--grad);
    transform: rotate(-7deg) scale(1.08);
    box-shadow: 0 8px 20px rgba(16,185,129,.35);
}

.link-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.link-text strong {
    display: flex; align-items: center; gap: 4px;
    font-size: 14px; font-weight: 700; letter-spacing: -.1px;
    transition: color .2s;
}
.link-card:hover .link-text strong { color: var(--mint); }

.ext {
    font-size: 14px; color: var(--mint);
    opacity: 0;
    transform: translate(-4px, 4px);
    transition: opacity .25s, transform .3s var(--ease);
}
.link-card:hover .ext { opacity: 1; transform: none; }

.link-text small {
    font-size: 12px; line-height: 1.45; color: var(--text-2);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}

/* pin favorit */
.pin-btn {
    position: absolute; right: 10px; top: 50%;
    width: 36px; height: 36px;
    display: grid; place-items: center;
    margin-top: -18px;
    border-radius: 11px;
    font-size: 18px;
    color: var(--text-3);
    transition: color .2s, background .2s, transform .25s var(--ease);
}
.pin-btn:hover { color: var(--amber); background: rgba(245,165,36,.12); }
.pin-btn.on { color: var(--amber); }
.pin-btn.pop { animation: pop .45s var(--ease); }
@keyframes pop {
    30% { transform: scale(1.45) rotate(-12deg); }
    100% { transform: scale(1); }
}


/* ---------- REVEAL ---------- */

.reveal { opacity: 0; }
.reveal.in { opacity: 1; animation: rise .55s var(--ease) backwards; animation-delay: var(--d, 0ms); }
.searching .reveal { opacity: 1; animation: none; }


/* ---------- EMPTY ---------- */

.empty-state { padding: 70px 20px; text-align: center; animation: rise .4s var(--ease); }
.empty-icon {
    width: 72px; height: 72px;
    display: inline-grid; place-items: center;
    border-radius: 22px;
    font-size: 32px;
    color: var(--mint); background: var(--mint-soft);
}
.empty-state h3 { margin-top: 16px; font-size: 18px; }
.empty-state p { margin-top: 6px; font-size: 13px; color: var(--text-2); }
.btn-reset {
    margin-top: 18px; height: 40px; padding: 0 18px;
    border-radius: 12px;
    font-size: 13px; font-weight: 600; color: #fff;
    background: var(--grad);
    transition: transform .2s;
}
.btn-reset:hover { transform: translateY(-2px); }


/* ---------- FOOTER ---------- */

.footer { border-top: 1px solid var(--line); background: var(--card); }
.footer-inner {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 18px;
    padding: 26px 0;
}
.footer-brand { display: flex; align-items: center; gap: 11px; }
.footer-brand > div { display: flex; flex-direction: column; line-height: 1.3; }
.footer-brand strong { font-size: 13px; }
.footer-brand span { font-size: 11px; color: var(--text-3); }

.footer-social { display: flex; gap: 8px; }
.footer-social a {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 11px;
    font-size: 19px;
    color: var(--text-2);
    background: var(--soft);
    transition: color .2s, background .25s, transform .25s var(--ease);
}
.footer-social a:hover { color: #fff; background: var(--grad); transform: translateY(-3px); }

.footer-copy { font-size: 11px; color: var(--text-3); }


/* ---------- TO TOP ---------- */

.to-top {
    position: fixed; right: 18px; bottom: 18px; z-index: 60;
    width: 46px; height: 46px;
    display: grid; place-items: center;
    border-radius: 14px;
    font-size: 20px; color: #fff;
    background: var(--grad);
    box-shadow: 0 10px 26px rgba(16,185,129,.35);
    animation: rise .3s var(--ease);
    transition: transform .2s;
}
.to-top:hover { transform: translateY(-3px); }


/* ---------- RESPONSIVE ---------- */

@media (min-width: 900px) {
    .toolbar-inner { flex-direction: row; align-items: center; gap: 14px; }
    .search { max-width: 340px; flex-shrink: 0; }
    .chips { flex: 1; min-width: 0; }
}

@media (max-width: 640px) {
    .topbar { padding: 10px 0 6px; }
    .btn-wa span { display: none; }
    .btn-wa { width: 40px; padding: 0; justify-content: center; }
    .brand-info strong { max-width: 150px; }

    .search input { height: 50px; font-size: 14px; }
    .search-key { display: none; }

    .directory { padding-bottom: 32px; }
    .cat-section { margin-bottom: 28px; }
    .link-grid { grid-template-columns: 1fr; gap: 10px; }
    .cat-title h2 { font-size: 17px; }

    .footer-inner { flex-direction: column; align-items: flex-start; }

    /* tanpa hover di layar sentuh: tampilkan indikator tetap */
    .ext { opacity: .7; transform: none; }
}

@media (hover: none) {
    .link-card:hover { transform: none; }
    .link-card:hover .link-icon { transform: none; }
}


/* ---------- REDUCED MOTION ---------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
    .reveal { opacity: 1; }
}