/* ==========================================================================
   FX LAYER — terminal mode, liquid cursor, scramble, journey, galaxy,
   phone mockup, easter egg, sound / language toggles, contact form
   ========================================================================== */

/* ---------- Nav extra buttons ---------- */
.fx-nav-btn {
    background: var(--secondary-background);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    border-radius: 999px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font: 600 0.85rem var(--font-primary);
    transition: var(--transition-smooth);
}
.fx-nav-btn:hover { background: var(--primary-color); color: #fff; }
.fx-nav-btn.is-on { border-color: var(--primary-color); color: var(--primary-color); }
.fx-nav-btn.is-on:hover { color: #fff; }
.nav-actions { gap: 8px; }
@media (max-width: 480px) {
    .fx-nav-btn { min-width: 34px; height: 34px; padding: 0 8px; font-size: 0.75rem; }
    .fx-nav-btn .fx-label { display: none; }
}

/* ---------- Time-of-day sky tint ---------- */
body::before {
    content: '';
    position: fixed;
    inset: 0 0 auto 0;
    height: 70vh;
    pointer-events: none;
    z-index: -1;
    opacity: 0.35;
    transition: background 1.5s ease;
}
body.tod-dawn::before { background: linear-gradient(180deg, rgba(251, 146, 60, .35), rgba(244, 114, 182, .15) 45%, transparent); }
body.tod-day::before { background: linear-gradient(180deg, rgba(56, 189, 248, .25), transparent 60%); }
body.tod-dusk::before { background: linear-gradient(180deg, rgba(249, 115, 22, .35), rgba(139, 92, 246, .2) 50%, transparent); }
body.tod-night::before { background: linear-gradient(180deg, rgba(30, 27, 75, .55), rgba(76, 29, 149, .15) 55%, transparent); }

.tod-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.6rem;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--secondary-background);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---------- Text scramble ---------- */
.scramble-char { color: var(--primary-color); opacity: 0.7; font-family: ui-monospace, monospace; }

/* ---------- Liquid cursor ---------- */
.fx-cursor, .fx-cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 10000;
    border-radius: 50%;
    will-change: transform;
}
.fx-cursor {
    width: 38px;
    height: 38px;
    margin: -19px 0 0 -19px;
    background: var(--brand-gradient);
    opacity: 0.35;
    filter: blur(2px);
    mix-blend-mode: difference;
    transition: width .25s, height .25s, margin .25s, opacity .25s;
}
.fx-cursor.is-hover { width: 70px; height: 70px; margin: -35px 0 0 -35px; opacity: 0.25; }
.fx-cursor.is-text { width: 6px; height: 34px; margin: -17px 0 0 -3px; border-radius: 3px; opacity: .6; }
.fx-cursor.is-down { width: 26px; height: 26px; margin: -13px 0 0 -13px; opacity: .6; }
.fx-cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--primary-color); }
.fx-trail {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 50%;
    background: var(--primary-color);
    opacity: 0;
}
body.fx-has-cursor, body.fx-has-cursor a, body.fx-has-cursor button { cursor: none; }
body.fx-has-cursor input, body.fx-has-cursor textarea { cursor: text; }
.fx-magnetic { transition: transform .2s ease-out; }

/* ---------- Terminal ---------- */
.fx-terminal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(2, 6, 23, .7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.fx-terminal.is-open { display: flex; animation: fxTermIn .25s ease both; }
@keyframes fxTermIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.fx-term-window {
    width: min(860px, 100%);
    height: min(560px, 85vh);
    display: flex;
    flex-direction: column;
    background: #0a0f1a;
    border: 1px solid #1f2a3d;
    border-radius: 12px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 0 1px rgba(34, 197, 94, .08), 0 0 60px rgba(34, 197, 94, .08);
    overflow: hidden;
    font: 14px/1.55 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: #c9f7d4;
}
.fx-term-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #111827;
    border-bottom: 1px solid #1f2a3d;
    color: #6b7280;
    font-size: 12px;
}
.fx-term-bar i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.fx-term-bar i:nth-child(1) { background: #ef4444; cursor: pointer; }
.fx-term-bar i:nth-child(2) { background: #f59e0b; }
.fx-term-bar i:nth-child(3) { background: #22c55e; }
.fx-term-bar span { margin-left: auto; margin-right: auto; }
.fx-term-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    position: relative;
}
.fx-term-body::after { /* scanlines */
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px);
}
.fx-term-line { white-space: pre-wrap; word-break: break-word; }
.fx-term-line .c-g { color: #4ade80; }
.fx-term-line .c-b { color: #60a5fa; }
.fx-term-line .c-y { color: #facc15; }
.fx-term-line .c-m { color: #c084fc; }
.fx-term-line .c-d { color: #6b7280; }
.fx-term-line .c-r { color: #f87171; }
.fx-term-line a { color: #60a5fa; text-decoration: underline; }
.fx-term-input-row { display: flex; gap: 8px; align-items: center; }
.fx-term-input-row .prompt { color: #4ade80; white-space: nowrap; }
.fx-term-input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: 0;
    color: #e5ffe9;
    font: inherit;
    caret-color: #4ade80;
    min-width: 0;
}
.fx-term-hint {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 900;
    padding: 6px 12px;
    border-radius: 8px;
    background: #0a0f1a;
    color: #4ade80;
    border: 1px solid #1f2a3d;
    font: 12px ui-monospace, monospace;
    cursor: pointer;
    opacity: .85;
    transition: opacity .2s, transform .2s;
}
.fx-term-hint:hover { opacity: 1; transform: translateY(-2px); }
.fx-term-hint kbd { background: #1f2937; border-radius: 4px; padding: 0 5px; color: #fff; }
@media (max-width: 768px) {
    .fx-term-window { font-size: 12.5px; height: 80vh; }
    .fx-term-hint .fx-hint-key { display: none; }
}

/* ---------- Journey ---------- */
#journey { position: relative; }
.journey-track {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 0 40px;
}
.journey-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}
.journey-svg .j-base { fill: none; stroke: var(--border-color); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 2 10; }
.journey-svg .j-draw { fill: none; stroke: url(#jGrad); stroke-width: 5; stroke-linecap: round; filter: drop-shadow(0 0 6px var(--glow-primary)); }
.journey-traveler {
    position: absolute;
    top: 0;
    left: 0;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border-radius: 50%;
    background: var(--brand-gradient);
    box-shadow: 0 0 0 6px rgba(37, 99, 235, .15), 0 0 25px var(--glow-primary);
    z-index: 2;
    pointer-events: none;
}
.journey-stop {
    position: relative;
    width: calc(50% - 50px);
    margin: 0 0 70px;
    padding: 1.4rem 1.5rem;
    border-radius: var(--radius-md);
    background: var(--card-background);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    opacity: 0.25;
    transform: translateY(30px) scale(.96);
    transition: opacity .6s ease, transform .6s cubic-bezier(.2, .8, .2, 1), border-color .6s;
    z-index: 1;
}
.journey-stop.right { margin-left: auto; }
.journey-stop.is-reached { opacity: 1; transform: none; border-color: var(--primary-color); }
.journey-stop .j-year {
    display: inline-block;
    font: 700 0.8rem var(--font-primary);
    letter-spacing: .08em;
    color: #fff;
    background: var(--brand-gradient);
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 8px;
}
.journey-stop .j-icon { font-size: 1.6rem; float: right; opacity: .9; }
.journey-stop h3 { font-size: 1.1rem; margin-bottom: 4px; color: var(--heading-color); }
.journey-stop p { color: var(--text-muted); font-size: .92rem; margin: 0; }
.journey-stop.is-now { box-shadow: 0 0 0 2px var(--primary-color), 0 0 40px var(--glow-primary); }
@media (max-width: 768px) {
    .journey-stop, .journey-stop.right { width: calc(100% - 50px); margin-left: 50px; margin-bottom: 40px; }
}

/* ---------- Skills galaxy ---------- */
.skills-view-toggle {
    display: inline-flex;
    margin: -2.5rem auto 2rem;
    padding: 4px;
    border-radius: 999px;
    background: var(--secondary-background);
    border: 1px solid var(--border-color);
}
.skills-view-wrap { text-align: center; }
.skills-view-toggle button {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: 999px;
    font: 600 .9rem var(--font-primary);
    cursor: pointer;
    transition: var(--transition-smooth);
}
.skills-view-toggle button.active { background: var(--primary-color); color: #fff; }
.skills-galaxy {
    display: none;
    position: relative;
    width: min(760px, 100%);
    aspect-ratio: 1;
    margin: 0 auto;
    touch-action: pan-y;
}
#skills.is-galaxy .skills-content { display: none; }
#skills.is-galaxy .skills-galaxy { display: block; }
#skills.is-galaxy .galaxy-info { display: block; }
.galaxy-core {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18%;
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #fff, #93c5fd 20%, var(--primary-color) 55%, #4c1d95);
    box-shadow: 0 0 60px var(--glow-primary), 0 0 140px rgba(124, 58, 237, .35);
    display: grid;
    place-items: center;
    overflow: hidden;
    animation: corePulse 4s ease-in-out infinite;
}
.galaxy-core img { width: 82%; height: 82%; object-fit: cover; border-radius: 50%; }
@keyframes corePulse { 50% { box-shadow: 0 0 90px var(--glow-primary), 0 0 180px rgba(124, 58, 237, .45); } }
.galaxy-ring {
    position: absolute;
    left: 50%;
    top: 50%;
    border-radius: 50%;
    border: 1px dashed var(--border-color);
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.galaxy-planet {
    position: absolute;
    left: 0;
    top: 0;
    width: 46px;
    height: 46px;
    margin: -23px 0 0 -23px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    will-change: transform;
}
.galaxy-planet img { width: 60%; height: 60%; object-fit: contain; }
.galaxy-planet:hover, .galaxy-planet.is-active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .2), 0 0 30px var(--glow-primary);
    z-index: 5;
}
.galaxy-info {
    display: none;
    width: max-content;
    max-width: 100%;
    margin: 1.5rem auto 0;
    min-width: 220px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    text-align: center;
    font-size: .9rem;
    color: var(--text-muted);
    pointer-events: none;
}
.galaxy-info strong { display: block; color: var(--heading-color); font-size: 1.05rem; }
@media (max-width: 600px) {
    .galaxy-planet { width: 30px; height: 30px; margin: -15px 0 0 -15px; }
}

/* ---------- Phone mockup ---------- */
.phone-stage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
    margin-bottom: 4rem;
}
.phone-copy h3 { font-size: 1.6rem; margin-bottom: .6rem; color: var(--heading-color); }
.phone-copy p { color: var(--text-muted); margin-bottom: 1rem; }
.phone-copy .phone-dots { display: flex; gap: 8px; flex-wrap: wrap; }
.phone-copy .phone-dots button {
    border: 1px solid var(--border-color);
    background: var(--secondary-background);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    font: 600 .8rem var(--font-primary);
}
.phone-copy .phone-dots button.active { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.phone-scene {
    perspective: 1200px;
    display: grid;
    place-items: center;
    height: 560px;
    touch-action: pan-y;
    cursor: grab;
    user-select: none;
}
.phone-scene:active { cursor: grabbing; }
.phone {
    position: relative;
    width: 260px;
    height: 530px;
    transform-style: preserve-3d;
    will-change: transform;
}
.phone-face, .phone-back {
    position: absolute;
    inset: 0;
    border-radius: 42px;
    backface-visibility: hidden;
}
.phone-face {
    background: #0b0b0f;
    padding: 12px;
    box-shadow: inset 0 0 0 2px #2a2a33, inset 0 0 0 5px #0b0b0f, inset 0 0 0 6px #3a3a46;
}
.phone-back {
    transform: rotateY(180deg);
    background: linear-gradient(145deg, #1e293b, #0f172a 60%, #312e81);
    box-shadow: inset 0 0 0 2px #334155;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, .5);
    font: 700 1.1rem var(--font-heading);
}
.phone-back::before {
    content: '';
    position: absolute;
    top: 22px;
    left: 22px;
    width: 80px;
    height: 80px;
    border-radius: 24px;
    background: #0b1120;
    box-shadow: inset 0 0 0 2px #334155;
}
.phone-edge {
    position: absolute;
    top: 24px;
    bottom: 24px;
    width: 14px;
    background: linear-gradient(90deg, #1f2937, #4b5563, #1f2937);
}
.phone-edge.l { left: 0; transform: rotateY(-90deg); transform-origin: left; }
.phone-edge.r { right: 0; transform: rotateY(90deg); transform-origin: right; }
.phone-screen {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 32px;
    overflow: hidden;
    background: #f8fafc;
}
.phone-notch {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 90px;
    height: 24px;
    border-radius: 14px;
    background: #000;
    z-index: 5;
}
.phone-glare {
    position: absolute;
    inset: 0;
    border-radius: 42px;
    pointer-events: none;
    background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .12) 45%, transparent 55%);
    transform: translateZ(1px);
    backface-visibility: hidden;
}
.app {
    position: absolute;
    inset: 0;
    padding: 44px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-family: var(--font-primary);
    color: #0f172a;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity .45s ease, transform .45s ease;
}
.app.active { opacity: 1; transform: none; }
.app-head { display: flex; justify-content: space-between; align-items: center; }
.app-head b { font-size: 1.05rem; }
.app-head span { width: 30px; height: 30px; border-radius: 50%; background: var(--app-c); opacity: .9; }
.app-hero {
    border-radius: 18px;
    padding: 16px;
    color: #fff;
    background: linear-gradient(135deg, var(--app-c), var(--app-c2));
    font-size: .8rem;
}
.app-hero strong { display: block; font-size: 1.5rem; margin-top: 4px; }
.app-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
    font-size: .78rem;
    animation: appRowIn .5s ease both;
}
.app.active .app-row:nth-of-type(3) { animation-delay: .1s; }
.app.active .app-row:nth-of-type(4) { animation-delay: .2s; }
.app.active .app-row:nth-of-type(5) { animation-delay: .3s; }
@keyframes appRowIn { from { opacity: 0; transform: translateY(10px); } }
.app-row i.dot { width: 34px; height: 34px; border-radius: 10px; background: var(--app-c); opacity: .2; flex: none; }
.app-row div { flex: 1; }
.app-row small { display: block; color: #64748b; }
.app-bars { display: flex; align-items: flex-end; gap: 6px; height: 70px; padding: 8px; background: #fff; border-radius: 14px; }
.app-bars i { flex: 1; border-radius: 4px 4px 0 0; background: var(--app-c); animation: barGrow 1s ease both; transform-origin: bottom; }
@keyframes barGrow { from { transform: scaleY(0); } }
.app-nav { margin-top: auto; display: flex; justify-content: space-around; padding: 10px; border-radius: 18px; background: #fff; box-shadow: 0 -1px 4px rgba(0, 0, 0, .05); }
.app-nav i { width: 18px; height: 18px; border-radius: 6px; background: #cbd5e1; }
.app-nav i:first-child { background: var(--app-c); }
@media (max-width: 860px) {
    .phone-stage { grid-template-columns: 1fr; text-align: center; }
    .phone-copy .phone-dots { justify-content: center; }
    .phone-scene { height: 470px; }
}

/* ---------- Easter egg ---------- */
.fx-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 9500; }
.fx-toast {
    position: fixed;
    left: 50%;
    bottom: 30px;
    transform: translate(-50%, 20px);
    z-index: 9600;
    padding: 12px 20px;
    border-radius: 12px;
    background: #0f172a;
    color: #fff;
    box-shadow: var(--shadow-xl);
    font-weight: 600;
    opacity: 0;
    transition: opacity .3s, transform .3s;
    max-width: calc(100% - 32px);
    text-align: center;
}
.fx-toast.show { opacity: 1; transform: translate(-50%, 0); }
.fx-game {
    position: fixed;
    inset: 0;
    z-index: 9400;
    background: rgba(2, 6, 23, .85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #fff;
    font-family: var(--font-primary);
}
.fx-game canvas { background: #0b1120; border-radius: 14px; border: 1px solid #334155; max-width: calc(100vw - 32px); touch-action: none; }
.fx-game .hud { display: flex; gap: 24px; font: 600 1rem ui-monospace, monospace; }
.fx-game button { padding: 8px 18px; border-radius: 999px; border: 0; background: #2563eb; color: #fff; font-weight: 600; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
    .galaxy-core, .journey-stop, .app, .app-row, .app-bars i { animation: none !important; transition: none !important; }
}
