/* styles.css - Dark/Light + smooth transitions + fancy switch */

/* Default variables (dark) */
:root {
    --bg: #04060a;
    --panel: #091018;
    --muted: #9aa6b2;
    --accent: #00d1d1;
    --accent-2: #06b6d4;
    --card: #0c1216;
    --glass: rgba(255, 255, 255, 0.03);
    --radius: 18px;
    --maxwidth: 520px;
    --gap: 14px;
    --text: #e6eef6;
    --shadow-lg: 0 14px 40px rgba(2, 6, 23, 0.6);
    --transition: 350ms cubic-bezier(.2, .9, .2, 1);
    --cover-gradient: linear-gradient(180deg, rgba(6, 182, 212, 0.06), rgba(2, 6, 23, 0.20));
    --avatar-border: rgba(11, 17, 24, 0.85);
    --icon-bg: rgba(255, 255, 255, 0.16);
    --icon-color: var(--text);
}

/* Light theme overrides */
:root[data-theme="light"] {
    --bg: #f5f7fa;
    --panel: #ffffff;
    --muted: #000000;
    --accent: #0b99a0;
    --accent-2: #0b8590;
    --card: #ffffff;
    --glass: rgba(2, 6, 23, 0.03);
    --radius: 14px;
    --text: #0a1720;
    --shadow-lg: 0 10px 28px rgba(11, 20, 30, 0.08);
    --cover-gradient: linear-gradient(180deg, rgba(11, 153, 160, 0.06), rgba(6, 26, 34, 0.03));
    --avatar-border: rgba(255, 255, 255, 0.92);
    --icon-bg: rgba(10, 20, 25, 0.03);
    --icon-color: var(--text);
}

/* smooth transition helper: apply class .theme-transition to body for crossfade */
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
    transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition), fill var(--transition), transform calc(var(--transition) * 1.1);
}

/* Basic resets */
* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    background: transparent;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 28px 16px;
}

/* --- Cyber background canvas styling --- */
#cyberBg{
  position: fixed;
  inset: 0;              /* top:0; right:0; bottom:0; left:0 */
  width: 100vw;
  height: 100vh;
  z-index: 0;            /* di belakang konten (pastikan wrapper z-index > 0 jika perlu) */
  pointer-events: none;  /* tidak mengganggu interaksi */
  mix-blend-mode: screen; /* subtle blending, tweak or remove if undesired */
  opacity: 0.95;
  transition: opacity 300ms ease;
}

/* Pastikan konten di atas canvas */
.wrapper{
  position: relative;
  z-index: 2;
}

/* Jika ingin men-disable bg untuk reduced motion */
@media (prefers-reduced-motion: reduce) {
  #cyberBg { display: none; }
}

/* Jika ingin tombol toggle disable bg (optional CSS class) */
body.bg-disabled #cyberBg { display: none !important; }


/* wrapper */
.wrapper {
    width: 100%;
    max-width: var(--maxwidth);
    display: block;
}

/* profile */
.profile {
    position: relative;
    text-align: center;
    margin-bottom: 18px;
}

/* top-controls (switch) */
.top-controls {
    position: absolute;
    right: 8px;
    top: 8px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* THEME SWITCH */
.theme-switch {
    display: inline-block;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.theme-switch input {
    display: none;
}

/* track */
.switch-track {
    display: inline-grid;
    grid-template-columns: 1fr;
    width: 72px;
    height: 38px;
    background: var(--icon-bg);
    border-radius: 999px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.03);
    box-shadow: 0 6px 18px rgba(2, 6, 23, 0.25);
    overflow: hidden;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

/* thumb */
.switch-thumb {
    position: absolute;
    left: 6px;
    top: 6px;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff, #f0f0f0);
    transform: translateX(0);
    transition: transform 260ms cubic-bezier(.2, .95, .2, 1), background 260ms ease;
    box-shadow: 0 6px 16px rgba(2, 6, 23, 0.3);
    z-index: 3;
}

/* icons inside track */
.switch-icon {
    position: absolute;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 2;
    opacity: 0.75;
    transition: opacity 220ms ease, transform 260ms ease;
}

.switch-icon.sun {
    right: 12px;
    top: 9px;
    transform: scale(1);
}

.switch-icon.moon {
    left: 12px;
    top: 9px;
    transform: scale(1);
}

/* checked state: move thumb to right and change visuals */
.theme-switch input:checked+.switch-track .switch-thumb {
    transform: translateX(34px);
    background: linear-gradient(180deg, #111827, #0b1220);
}

.theme-switch input:checked+.switch-track {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-color: rgba(6, 182, 212, 0.12);
    box-shadow: 0 10px 36px rgba(6, 182, 212, 0.08);
}

.theme-switch input:checked+.switch-track .switch-icon.sun {
    opacity: 0.0;
    transform: translateX(8px) scale(.9);
}

.theme-switch input:checked+.switch-track .switch-icon.moon {
    opacity: 1.0;
    transform: translateX(4px) scale(1.02);
}

/* default icons state (dark = unchecked shows sun) */
.theme-switch input:not(:checked)+.switch-track .switch-icon.sun {
    opacity: 1.0;
    transform: translateX(0) scale(1);
}

.theme-switch input:not(:checked)+.switch-track .switch-icon.moon {
    opacity: 0.22;
    transform: translateX(-6px) scale(.94);
}

/* cover */
.cover {
    width: 100%;
    height: 180px;
    background: var(--cover-gradient);
    border-radius: 16px;
    background-size: cover;
    background-position: center;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

/* avatar */
.avatar-wrap {
    position: relative;
    margin-top: -54px;
    display: flex;
    justify-content: center;
}

.avatar {
    width: 110px;
    height: 110px;
    border-radius: 999px;
    border: 6px solid var(--avatar-border);
    object-fit: cover;
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.6);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
}

/* profile meta */
.profile-meta {
    margin-top: 12px;
    padding: 6px 8px 0
}

.profile-meta h1 {
    margin: 6px 0 2px;
    font-size: 1.15rem;
    font-family: 'Poppins', system-ui, -apple-system, 'Inter';
    letter-spacing: -0.3px;
    font-weight: 700;
}

.profile-meta p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 400;
}

/* socials */
.socials {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 12px;
    flex-wrap: wrap
}

.socials a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--icon-bg);
    border: 1px solid rgba(255, 255, 255, 0.03);
    text-decoration: none;
    color: var(--icon-color);
    transition: transform var(--transition), box-shadow var(--transition), background .12s;
}

.socials a:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* links area */
.links-area {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

/* card */
.link-card {
    display: block;
    background: rgb(255 255 255 / 12%);
    border-radius: 14px;
    padding: 12px;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: transform var(--transition), box-shadow var(--transition), border-color .12s;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

:root[data-theme="light"] .link-card {
    background: var(--card);
    border: 1px solid rgba(11, 20, 30, 0.04);
}

.link-card:focus,
.link-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    outline: none;
    border-color: rgba(6, 182, 212, 0.12);
}

/* card layout */
.card-top {
    display: flex;
    gap: 12px;
    align-items: center;
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    flex: 0 0 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.02);
}

:root[data-theme="light"] .card-icon {
    background: var(--icon-bg);
    border: 1px solid rgba(11, 20, 30, 0.04);
}

.card-body {
    flex: 1;
    min-width: 0
}

.card-title {
    font-weight: 700;
    font-size: 1.02rem;
    margin-bottom: 4px;
    font-family: 'Poppins', 'Inter', sans-serif;
}

.card-sub {
    color: var(--muted);
    font-size: 0.90rem;
    margin-bottom: 6px;
}

/* media */
.card-media {
    margin-top: 10px;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    display: block;
    height: 170px;
    width: 100%;
    object-fit: cover;
}

.card-desc {
    color: var(--muted);
    font-size: 0.92rem;
    margin-top: 10px;
}

/* variants */
.w-small .card-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px
}

.h-small .card-media {
    height: 110px
}

.h-large .card-media {
    height: 260px
}

/* CTA */
.link-card.cta {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    color: #06121a;
    border: none;
}

.link-card.cta .card-title {
    color: #06121a;
}

.link-card.cta .card-sub {
    color: rgba(6, 18, 26, 0.85);
}

/* loading & footer */
.loading {
    text-align: center;
    color: var(--muted);
    padding: 18px;
    background: var(--glass);
    border-radius: 12px
}

.footer {
    text-align: center;
    margin-top: 18px;
    color: var(--muted);
    font-size: 0.84rem
}

/* responsive */
@media(min-width:900px) {
    .cover {
        height: 220px;
        border-radius: 18px;
    }

    .avatar {
        width: 128px;
        height: 128px;
        margin-top: -6px;
        border-width: 8px;
    }

    .card-media {
        height: 200px
    }
}