/* ═══════════════════════════════════════════════════════════
   cnhsync.dev — style.css
   ═══════════════════════════════════════════════════════════ */

/* ─── CSS Variables (Themes) ────────────────────────────── */
:root {
    --accent: #ffca28;
    --accent-dim: rgba(255, 202, 40, 0.15);
    --accent-glow: rgba(255, 202, 40, 0.3);
    --font-main: 'Fira Code', monospace;
    --radius: 12px;
    --transition: 0.25s ease;
}

body.theme-dark {
    --bg: #121212;
    --bg2: #1e1e1e;
    --text: #e0e0e0;
    --text-dim: rgba(224, 224, 224, 0.55);
    --border: rgba(255, 202, 40, 0.12);
}

body.theme-light {
    --bg: #f5f0e8;
    --bg2: #ede8dc;
    --text: #1a1a1a;
    --text-dim: rgba(26, 26, 26, 0.55);
    --border: rgba(180, 130, 0, 0.2);
}

/* ─── Reset & Base ──────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-main);
    margin: 0;
    min-height: 100vh;
    line-height: 1.6;
    cursor: none;
    /* custom cursor aktif */
    transition: background-color 0.4s, color 0.4s;
}

/* ─── Custom Cursor ─────────────────────────────────────── */
#cursor {
    position: fixed;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: transform 0.1s, width 0.2s, height 0.2s, opacity 0.2s;
    mix-blend-mode: difference;
}

#cursorTrail {
    position: fixed;
    width: 32px;
    height: 32px;
    border: 1.5px solid var(--accent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    transition: left 0.12s ease, top 0.12s ease, width 0.2s, height 0.2s, opacity 0.2s;
    opacity: 0.5;
}

body:has(a:hover) #cursor,
body:has(button:hover) #cursor {
    width: 20px;
    height: 20px;
}

body:has(a:hover) #cursorTrail,
body:has(button:hover) #cursorTrail {
    width: 48px;
    height: 48px;
    opacity: 0.8;
}

/* ─── Preloader ─────────────────────────────────────────── */
#preloader {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

#preloader.hidden {
    opacity: 0;
    pointer-events: none;
}

.preloader-inner {
    font-family: var(--font-main);
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 2px;
}

.preloader-bracket {
    opacity: 0.4;
}

.preloader-cursor {
    animation: blink 0.6s step-end infinite;
}

/* ─── Scroll Progress Bar ───────────────────────────────── */
#scrollProgress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), rgba(255, 202, 40, 0.4));
    z-index: 9000;
    transition: width 0.1s linear;
    box-shadow: 0 0 8px var(--accent-glow);
}

/* ─── Theme Toggle ──────────────────────────────────────── */
#themeToggle {
    position: fixed;
    top: 1.2rem;
    right: 1.2rem;
    z-index: 500;
    background: var(--bg2);
    color: var(--accent);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: none;
    font-size: 1rem;
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

#themeToggle:hover {
    border-color: var(--accent);
    transform: rotate(15deg) scale(1.1);
}

/* ─── Floating Side Navbar ──────────────────────────────── */
.floating-nav {
    position: fixed;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nav-dot {
    position: relative;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 202, 40, 0.25);
    border: 2px solid rgba(255, 202, 40, 0.4);
    display: block;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.nav-dot:hover,
.nav-dot.active {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.35);
    box-shadow: 0 0 8px var(--accent-glow);
}

.nav-dot-label {
    position: absolute;
    right: 1.8rem;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-main);
    font-size: 0.72rem;
    color: var(--accent);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.nav-dot:hover .nav-dot-label {
    opacity: 1;
}

/* ─── Section Base ──────────────────────────────────────── */
.containervh {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    box-sizing: border-box;
}

#contact {
    padding-bottom: 90px;
}

.subcont {
    width: 65%;
    padding: 1rem;
    position: relative;
    z-index: 1;
}

/* ─── Fade-in on scroll ─────────────────────────────────── */
.fade-in-section {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}

.fade-in-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* stagger children inside a fade-in parent */
.fade-in-section:nth-child(2) {
    transition-delay: 0.1s;
}

.fade-in-section:nth-child(3) {
    transition-delay: 0.2s;
}

.fade-in-section:nth-child(4) {
    transition-delay: 0.3s;
}

/* ─── Hero ──────────────────────────────────────────────── */
#heroCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.hero-subcont {
    background: transparent;
    border: none;
    border-radius: 1em;
    padding: 2.5rem 2rem;
}

.hero-tag {
    font-size: 0.82rem;
    color: rgba(255, 202, 40, 0.45);
    margin-bottom: 0.8rem;
    letter-spacing: 0.12em;
}

h1 {
    color: var(--accent);
    font-size: 2.5rem;
    margin: 0.2rem 0 0.5rem;
    min-height: 3.2rem;
}

#heroTitle::after {
    content: '█';
    animation: blink 0.75s step-end infinite;
    font-size: 0.8em;
}

#heroTitle.done::after {
    content: none;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.subtitle {
    font-size: 1.15rem;
    color: var(--text-dim);
    margin-bottom: 2rem;
    min-height: 1.8rem;
}

h2 {
    color: var(--accent);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

/* ─── Currently Building ────────────────────────────────── */
.currently-building {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--accent-dim);
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 0.35rem 1rem;
    font-size: 0.82rem;
    margin-bottom: 1.8rem;
}

.cb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.8s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 var(--accent-glow);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(255, 202, 40, 0);
    }
}

.cb-label {
    color: var(--text-dim);
}

.cb-value {
    color: var(--accent);
    font-weight: bold;
}

/* ─── About Grid ────────────────────────────────────────── */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    text-align: left;
    margin-bottom: 2rem;
}

.about-text p {
    margin-top: 0;
}

/* ─── GitHub Stats ──────────────────────────────────────── */
.github-stats {
    margin-top: 1.5rem;
}

.gh-profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* ─── Skill Badges ──────────────────────────────────────── */
.skills-title {
    font-size: 0.82rem;
    color: rgba(255, 202, 40, 0.45);
    margin-bottom: 1rem;
    letter-spacing: 0.1em;
}

.skill-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.skill-badge {
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(255, 202, 40, 0.22);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.skill-badge:hover {
    background: rgba(255, 202, 40, 0.22);
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* ─── Cards ─────────────────────────────────────────────── */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.card {
    background: var(--bg2);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.card p {
    flex-grow: 1;
}

.card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

.card h3 {
    color: var(--accent);
    margin-top: 0;
}

.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag {
    background: var(--accent-dim);
    color: var(--accent);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.card-actions {
    margin-top: auto;
    padding-top: 1.5rem;
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
    display: inline-block;
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: bold;
    cursor: none;
    transition: all 0.2s ease;
}

.btn:hover {
    background: var(--accent);
    color: var(--bg);
    transform: translateY(-3px);
    box-shadow: 0 4px 14px var(--accent-glow);
}

.btn.disabled,
.btn.disabled:hover {
    opacity: 0.45;
    cursor: not-allowed;
    background: transparent;
    color: var(--accent);
    transform: none;
    box-shadow: none;
}

.nav-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 2rem 0;
}

/* ─── Copy Email ────────────────────────────────────────── */
.copy-email-wrap {
    margin-top: 1rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.8rem;
}

.copy-email-wrap::before {
    content: "";
}

.copy-feedback {
    font-size: 0.82rem;
    color: #2ecc71;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    justify-self: start;
}

.copy-feedback.show {
    opacity: 1;
    transform: translateY(0);
}

/* ─── Contact Form ──────────────────────────────────────── */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    max-width: 500px;
    margin: 2rem auto 0;
}

.contact-form input,
.contact-form textarea {
    background: var(--bg2);
    border: 1px solid rgba(255, 202, 40, 0.28);
    color: var(--text);
    padding: 1rem;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 8px rgba(255, 202, 40, 0.18);
}

/* ─── Flash Messages ────────────────────────────────────── */
.flash-messages {
    max-width: 500px;
    margin: 0 auto 1.2rem auto;
}

.flash {
    padding: 1rem;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
}

.flash.success {
    background: rgba(46, 204, 113, 0.12);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.35);
}

.flash.error {
    background: rgba(231, 76, 60, 0.12);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.35);
}

/* ─── Footer ────────────────────────────────────────────── */
footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 0;
    background: var(--bg2);
    border-top: 1px solid rgba(255, 202, 40, 0.18);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
    font-size: 0.88rem;
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
}

/* ─── Grind Loader ──────────────────────────────────────── */
.grind-loader {
    width: 18px;
    height: 18px;
    border: 2px solid var(--accent);
    border-top-color: transparent;
    border-radius: 50%;
    display: inline-block;
    margin-right: 10px;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ─── Down Arrow ────────────────────────────────────────── */
.downarrow {
    display: inline-block;
    margin-top: 1.5rem;
    animation: bounce 1.1s ease-in-out infinite;
    cursor: none;
    opacity: 0.55;
    transition: opacity 0.2s;
}

.downarrow:hover {
    opacity: 1;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-7px);
    }
}

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
    .subcont {
        width: 85%;
    }

    .about-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .card-container {
        grid-template-columns: 1fr;
    }

    .cf-turnstile {
        transform: scale(0.9);
        transform-origin: center;
    }

    .subcont {
        width: 92%;
        padding: 0.5rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .nav-buttons {
        gap: 0.6rem;
    }

    #contact {
        padding-bottom: 140px;
    }

    footer {
        padding: 1.5rem 1rem;
    }

    .floating-nav {
        right: 0.7rem;
        gap: 0.7rem;
    }

    /* cursor: normal on touch devices */
    body {
        cursor: auto;
    }

    #cursor,
    #cursorTrail {
        display: none;
    }
}
