/* =========================================
   GLOBAL DESIGN FOUNDATION
   Tema: putih hangat + slate, minimal & playful
   ========================================= */

:root {
    --bg: #fdfdfc;
    --ink: #0f172a;          /* slate-900 */
    --ink-soft: #475569;     /* slate-600 */
    --muted: #64748b;        /* slate-500 */
    --faint: #94a3b8;        /* slate-400 */
    --border: #f1f5f9;       /* slate-100 */
    --border-strong: #e2e8f0;/* slate-200 */
    --accent: #2563eb;       /* blue-600 */
    --accent-soft: #dbeafe;  /* blue-100 */

    /* Easing khas: lembut di ujung (expo-out) & kenyal (spring) */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 12px 24px -6px rgba(15, 23, 42, 0.1), 0 4px 8px -4px rgba(15, 23, 42, 0.05);
}

/* --- Base polish --- */
html {
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Scrollbar ramping, senada tema */
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
    border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Focus ring yang jelas tapi tidak norak (hanya untuk keyboard) */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

/* Gambar tidak bisa ke-drag tanpa sengaja */
img { -webkit-user-drag: none; }

/* =========================================
   ENTRANCE ANIMATION
   (class ini sudah dipakai semua section,
    tapi keyframes-nya baru didefinisikan di sini)
   ========================================= */
.animate-fade-in-up {
    opacity: 0;
    animation: fadeInUpSoft 0.7s var(--ease-out) both;
}

@keyframes fadeInUpSoft {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section di bawah layar: ditahan oleh JS, baru main saat di-scroll */
.rv-wait { animation-play-state: paused; }
.rv-wait.in-view { animation-play-state: running; }

/* =========================================
   NAVBAR
   ========================================= */

/* Bayangan halus muncul saat halaman di-scroll */
#site-nav {
    transition: box-shadow 0.3s var(--ease-out), background-color 0.3s ease;
}
#site-nav.nav-scrolled {
    box-shadow: 0 4px 20px -8px rgba(15, 23, 42, 0.12);
}

/* Link menu: underline meluncur dari kiri */
.nav-link {
    position: relative;
    padding: 0.25rem 0;
}
.nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background-color: var(--ink);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s var(--ease-out);
}
.nav-link:hover::after,
.nav-link.nav-active::after {
    transform: scaleX(1);
}
.nav-link.nav-active {
    color: var(--ink);
    font-weight: 700;
}

/* =========================================
   BACK TO TOP (kiri bawah — kanan milik chat)
   ========================================= */
#back-to-top {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 9998;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    color: var(--muted);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.3s var(--ease-out),
                transform 0.3s var(--ease-out),
                visibility 0.3s,
                color 0.2s,
                border-color 0.2s;
}
#back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
#back-to-top:hover {
    color: var(--ink);
    border-color: #cbd5e1;
    transform: translateY(-2px);
}
#back-to-top:active { transform: translateY(0) scale(0.95); }

@media (max-width: 640px) {
    #back-to-top { bottom: 1rem; left: 1rem; }
}

/* =========================================
   CUSTOM CURSOR (Among Us) — digerakkan rAF di script.js
   ========================================= */
#custom-cursor { will-change: transform; }
#cursor-img {
    transition: width 0.25s var(--ease-spring),
                height 0.25s var(--ease-spring);
}

/* =========================================
   AKSESIBILITAS: hormati preferensi reduksi gerakan
   ========================================= */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    .animate-fade-in-up {
        animation: none;
        opacity: 1;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
