/* NxCorp | css/theme.css
   Preloader, dark mode button, refined colours
   Load order matters: files are linked in index.html in this order. */

/* ========== SECTION: PRELOADER: PURE CSS, HIDES ITSELF AFTER ABOUT 1.2 SECONDS (CSS) ========== */
#pre {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    background: #0b0c1c;
    color: #eceeff;
    animation: preOut .5s 1.2s forwards;
}

@keyframes preOut {
    to {
        opacity: 0;
        visibility: hidden;
        transform: translateY(-3%);
    }
}

#pre .pw {
    width: min(320px, 80vw);
    text-align: center;
}

#pre .plogo {
    font: 800 46px 'Bricolage Grotesque', system-ui, sans-serif;
    letter-spacing: -.04em;
    animation: up .6s both;
}

#pre .plogo b {
    color: #818cf8;
}

#pre .pt {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    margin: 14px 0 18px;
    border-right: 2px solid #ff6b3d;
    font: 400 13px 'JetBrains Mono', ui-monospace, monospace;
    color: #a3a8cc;
    animation: ptype .8s steps(26) .2s forwards, pcaret .7s steps(1) infinite;
}

@keyframes ptype {
    to {
        width: 26ch;
    }
}

@keyframes pcaret {
    50% {
        border-color: transparent;
    }
}

#pre .pbar {
    height: 4px;
    background: #1d1f3d;
    border-radius: 99px;
    overflow: hidden;
}

#pre .pbar i {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #818cf8, #ff6b3d);
    animation: pfill 1s ease-out forwards;
}

@keyframes pfill {
    to {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    #pre {
        display: none;
    }
}

html.theme-fade *,
html.theme-fade *::before,
html.theme-fade *::after {
    transition: background-color .45s,color .45s,border-color .45s,box-shadow .45s!important;
}

/* ========== SECTION: DARK MODE BUTTON (CSS) ========== */
.hr {
    display: flex;
    align-items: center;
    gap: 10px;
}

.burger {
    margin-left: 0;
}

.theme {
    width: 42px;
    height: 42px;
    border: 1.5px solid var(--ink);
    border-radius: 12px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
    transition: transform .3s,background .3s;
}

.theme:hover {
    background: var(--lilac);
    transform: rotate(15deg);
}

.theme svg {
    width: 20px;
    height: 20px;
}

.theme .sun {
    display: none;
}

:root[data-theme="dark"] .theme .sun {
    display: block;
}

:root[data-theme="dark"] .theme .moon {
    display: none;
}

:root[data-theme="light"] {
    color-scheme: light;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b0c1b;
    --card: #15162f;
    --line: #262849;
    --lilac: #23244d;
    --blue: #6366f1;
    --hero-g: #1a1b45;
    --mute: #a9aed2;
}

:root[data-theme="dark"] ::selection {
    background: #6366f1;
    color: #fff;
}

:root[data-theme="dark"] .hero::before,
:root[data-theme="dark"] .hero::after {
    opacity: .3;
}

:root[data-theme="dark"] .badge {
    background: #171835;
}

:root[data-theme="dark"] .btn.alt {
    border-color: rgba(255,255,255,.55);
}

:root[data-theme="dark"] .win {
    box-shadow: 0 30px 70px -20px rgba(99,102,241,.45);
}

:root[data-theme="dark"] .chip,
:root[data-theme="dark"] .chip2 {
    background: #171835;
    border-color: rgba(255,255,255,.4);
}

:root[data-theme="dark"] .mq {
    background: #14152e;
    color: #eceeff;
}

:root[data-theme="dark"] .sec-h .mono,
:root[data-theme="dark"] .about .mono {
    color: #a5b4fc;
}

:root[data-theme="dark"] .proj,
:root[data-theme="dark"] .quote,
:root[data-theme="dark"] .brow,
:root[data-theme="dark"] .tp {
    box-shadow: 0 20px 40px -28px rgba(0,0,0,.9);
}

:root[data-theme="dark"] .proj:hover,
:root[data-theme="dark"] .brow:hover {
    border-color: var(--blue);
}

:root[data-theme="dark"] .mock {
    filter: brightness(.93);
}

:root[data-theme="dark"] .sv.a {
    background: linear-gradient(145deg,#5b54ee, #4338ca);
}

:root[data-theme="dark"] .sv.b {
    background: #202252;
    color: #eceeff;
}

:root[data-theme="dark"] .sv.b .ic {
    background: rgba(255,255,255,.1);
    color: #a5b4fc;
}

:root[data-theme="dark"] .sv.c {
    background: #1b1d3f;
    color: #eceeff;
    border: 1px solid var(--line);
}

:root[data-theme="dark"] .steps>div {
    border-top-color: rgba(255,255,255,.35);
}

:root[data-theme="dark"] .pr .amt {
    color: #a5b4fc;
}

:root[data-theme="dark"] .contact {
    background: linear-gradient(135deg,#1a1c45,#0f1026);
    color: #eceeff;
    border: 1px solid var(--line);
}

:root[data-theme="dark"] .contact input,
:root[data-theme="dark"] .contact textarea,
:root[data-theme="dark"] .contact select {
    border-color: rgba(255,255,255,.28);
}

:root[data-theme="dark"] .m.b {
    background: #23244d;
    color: #eceeff;
}

/* ========== SECTION: REFINED COLOURS, NOTICE BAR, CONTACT FORM (CSS) ========== */
:root {
    --grad: linear-gradient(135deg, #4f46e5, #7c3aed 60%, #a855f7);
}

:root[data-theme="dark"] {
    --grad: linear-gradient(135deg, #6366f1, #8b5cf6 60%, #c084fc);
}

.btn {
    background: var(--grad);
    background-size: 160% 100%;
    background-position: 0 0;
    transition: transform .2s, box-shadow .2s, background-position .5s;
}

.btn:hover {
    background-position: 100% 0;
}

.btn.alt {
    background: transparent;
}

.hero h1 .w:nth-child(4)>span,
.hero h1 .w:nth-child(5)>span {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

header {
    transition: box-shadow .3s, background-color .3s;
}

header.scrolled {
    box-shadow: 0 12px 30px -22px rgba(14, 17, 48, .5);
}

nav a.active {
    color: var(--ink);
}

nav a.active::after {
    transform: scaleX(1);
}

.proj,
.quote,
.brow,
.tp {
    box-shadow: 0 1px 2px rgba(14, 17, 48, .04), 0 14px 34px -20px rgba(14, 17, 48, .22);
}

.rv {
    filter: blur(4px);
    transition: opacity .8s cubic-bezier(.2, .7, .2, 1), transform .8s cubic-bezier(.2, .7, .2, 1), filter .8s;
}

.rv.in {
    filter: none;
}
