Full rewrite of the portfolio site from Next.js 14 to .NET 10: - ASP.NET Core 10 Razor Pages, no Node.js dependency - EF Core 10 + SQLite (same schema as before — data survives upgrade) - Cookie authentication (same single-password model) - Resend contact form via HttpClient - Bilingual FA/EN via locale cookie + BasePageModel - All UI ported to Razor Pages with Tailwind CDN + custom CSS - Vanilla JS: particles, typewriter, cursor, animations, portfolio modal - Dockerfile: SDK 10.0-alpine → aspnet 10.0-alpine (no npm/Node needed) - CI/CD: dropped NPM_TOKEN, ADMIN_SESSION_SECRET — pure dotnet publish Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
/* ─── Design tokens ──────────────────────────────────────────────────── */
|
||||
:root {
|
||||
--bg: #020510;
|
||||
--electric: #38bdf8;
|
||||
--violet: #818cf8;
|
||||
--magenta: #e879f9;
|
||||
--emerald: #34d399;
|
||||
--cyan: #22d3ee;
|
||||
--radius: 14px;
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
html, body {
|
||||
background: var(--bg);
|
||||
font-feature-settings: 'ss01','cv11';
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
html { scroll-behavior: smooth; }
|
||||
|
||||
[dir='rtl'] body { font-family: 'Vazirmatn','VazirmatnLat','Syne',system-ui,sans-serif; }
|
||||
[dir='ltr'] body { font-family: 'Syne','Vazirmatn','VazirmatnLat',system-ui,sans-serif; }
|
||||
|
||||
::selection { background: rgba(56,189,248,.35); color: #f8fafc; }
|
||||
|
||||
::-webkit-scrollbar { width: 10px; height: 10px; }
|
||||
::-webkit-scrollbar-track { background: #050a1a; }
|
||||
::-webkit-scrollbar-thumb { background: linear-gradient(180deg,#38bdf8,#818cf8); border-radius:999px; border:2px solid #050a1a; }
|
||||
|
||||
/* ─── Component classes (used across Razor templates) ────────────────── */
|
||||
|
||||
.glass {
|
||||
background: linear-gradient(180deg,rgba(255,255,255,.04) 0%,rgba(255,255,255,.015) 100%);
|
||||
border: 1px solid rgba(56,189,248,.14);
|
||||
backdrop-filter: blur(14px);
|
||||
box-shadow: inset 0 1px 0 0 rgba(255,255,255,.06), 0 30px 60px -30px rgba(0,0,0,.6);
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
.chip {
|
||||
display: inline-flex; align-items: center; gap: .5rem;
|
||||
padding: .35rem .75rem; border-radius: 999px;
|
||||
border: 1px solid rgba(52,211,153,.25); background: rgba(52,211,153,.06);
|
||||
color: #a7f3d0;
|
||||
font-family: 'SpaceMono',ui-monospace,monospace;
|
||||
font-size: .72rem; letter-spacing: .04em; text-transform: uppercase;
|
||||
}
|
||||
|
||||
.label-mono {
|
||||
font-family: 'SpaceMono',ui-monospace,monospace;
|
||||
font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: #94a3b8;
|
||||
}
|
||||
|
||||
.gradient-text {
|
||||
background: linear-gradient(135deg,#38bdf8 0%,#818cf8 45%,#e879f9 100%);
|
||||
-webkit-background-clip: text; background-clip: text; color: transparent;
|
||||
background-size: 200% 200%; animation: gradient-pan 8s ease-in-out infinite;
|
||||
}
|
||||
@keyframes gradient-pan { 0%,100%{background-position:0% 50%} 50%{background-position:100% 50%} }
|
||||
|
||||
.btn-primary {
|
||||
display: inline-flex; align-items: center; gap: .6rem;
|
||||
padding: .85rem 1.4rem; border-radius: 999px;
|
||||
font-weight: 600; color: #020510;
|
||||
background: linear-gradient(135deg,#38bdf8 0%,#818cf8 60%,#e879f9 100%);
|
||||
background-size: 200% 200%;
|
||||
transition: transform .25s ease, box-shadow .25s ease, background-position .6s ease;
|
||||
box-shadow: 0 12px 40px -12px rgba(56,189,248,.55);
|
||||
}
|
||||
.btn-primary:hover { transform: translateY(-1px); background-position: 100% 0; box-shadow: 0 18px 50px -10px rgba(232,121,249,.55); }
|
||||
|
||||
.btn-ghost {
|
||||
display: inline-flex; align-items: center; gap: .6rem;
|
||||
padding: .8rem 1.35rem; border-radius: 999px;
|
||||
font-weight: 500; color: #e2e8f0;
|
||||
border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.02);
|
||||
transition: border-color .25s ease, background .25s ease, transform .25s ease;
|
||||
}
|
||||
.btn-ghost:hover { border-color: rgba(56,189,248,.6); background: rgba(56,189,248,.06); transform: translateY(-1px); }
|
||||
|
||||
.nav-link {
|
||||
font-size: .875rem; color: #94a3b8;
|
||||
transition: color .2s ease; text-decoration: none;
|
||||
}
|
||||
.nav-link:hover { color: #e2e8f0; }
|
||||
|
||||
#navbar.scrolled { background: rgba(2,5,16,.85); backdrop-filter: blur(20px); border-bottom: 1px solid rgba(255,255,255,.05); }
|
||||
|
||||
/* ─── Section header ─────────────────────────────────────────────── */
|
||||
.section-header { text-align: center; margin-bottom: 3.5rem; }
|
||||
.section-header .eyebrow { margin-bottom: 1rem; }
|
||||
.section-header h2 { font-family:'Syne',sans-serif; font-size:clamp(1.8rem,3.5vw,2.75rem); font-weight:800; color:#fff; margin-bottom:1rem; }
|
||||
[dir='rtl'] .section-header h2 { font-family:'Vazirmatn',sans-serif; }
|
||||
.section-header p { max-width:42rem; margin:0 auto; color:#94a3b8; font-size:1.0625rem; line-height:1.7; }
|
||||
|
||||
/* ─── Service cards ──────────────────────────────────────────────── */
|
||||
.service-card { transition: border-color .3s, box-shadow .3s, transform .3s; }
|
||||
.service-card:hover { transform: translateY(-2px); }
|
||||
|
||||
/* ─── Expertise bars ─────────────────────────────────────────────── */
|
||||
.bar-track { height: .375rem; background: rgba(255,255,255,.07); border-radius:999px; overflow:hidden; }
|
||||
.bar-fill { height: 100%; border-radius:999px; transform-origin:left; }
|
||||
[dir='rtl'] .bar-fill { transform-origin:right; }
|
||||
|
||||
/* ─── Scroll-reveal ──────────────────────────────────────────────── */
|
||||
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s cubic-bezier(.22,1,.36,1), transform .7s cubic-bezier(.22,1,.36,1); }
|
||||
.reveal.visible { opacity: 1; transform: none; }
|
||||
|
||||
/* ─── Portfolio modal ────────────────────────────────────────────── */
|
||||
#portfolio-modal { transition: opacity .25s ease; }
|
||||
#portfolio-modal.hidden { pointer-events: none; }
|
||||
|
||||
/* ─── Admin nav ──────────────────────────────────────────────────── */
|
||||
.admin-nav-link {
|
||||
display: block; padding: .5rem .75rem; border-radius: .5rem;
|
||||
color: #94a3b8; font-size: .875rem; text-decoration: none;
|
||||
transition: background .15s, color .15s;
|
||||
}
|
||||
.admin-nav-link:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }
|
||||
.admin-nav-link.active { background: rgba(56,189,248,.1); color: #38bdf8; }
|
||||
|
||||
/* ─── Reduced motion ─────────────────────────────────────────────── */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*,*::before,*::after {
|
||||
animation-duration: .001ms !important; animation-iteration-count: 1 !important;
|
||||
transition-duration: .001ms !important; scroll-behavior: auto !important;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,257 @@
|
||||
/* ─── Custom cursor ───────────────────────────────────────────────────── */
|
||||
(function () {
|
||||
const ring = document.getElementById('cursor');
|
||||
const dot = document.getElementById('cursor-dot');
|
||||
if (!ring || !dot) return;
|
||||
let mx = 0, my = 0, rx = 0, ry = 0;
|
||||
document.addEventListener('mousemove', e => { mx = e.clientX; my = e.clientY; });
|
||||
document.addEventListener('mouseenter', () => { ring.style.opacity = '1'; dot.style.opacity = '1'; });
|
||||
document.addEventListener('mouseleave', () => { ring.style.opacity = '0'; dot.style.opacity = '0'; });
|
||||
(function raf() {
|
||||
rx += (mx - rx) * 0.12; ry += (my - ry) * 0.12;
|
||||
ring.style.left = rx + 'px'; ring.style.top = ry + 'px';
|
||||
dot.style.left = mx + 'px'; dot.style.top = my + 'px';
|
||||
requestAnimationFrame(raf);
|
||||
})();
|
||||
document.querySelectorAll('a,button,label,input,textarea,select').forEach(el => {
|
||||
el.addEventListener('mouseenter', () => ring.style.transform = 'translate(-50%,-50%) scale(1.6)');
|
||||
el.addEventListener('mouseleave', () => ring.style.transform = 'translate(-50%,-50%) scale(1)');
|
||||
});
|
||||
})();
|
||||
|
||||
/* ─── Navbar scroll shadow ────────────────────────────────────────────── */
|
||||
(function () {
|
||||
const nav = document.getElementById('navbar');
|
||||
if (!nav) return;
|
||||
const update = () => nav.classList.toggle('scrolled', window.scrollY > 30);
|
||||
window.addEventListener('scroll', update, { passive: true });
|
||||
update();
|
||||
})();
|
||||
|
||||
/* ─── Mobile menu toggle ──────────────────────────────────────────────── */
|
||||
(function () {
|
||||
const btn = document.getElementById('menu-btn');
|
||||
const menu = document.getElementById('mobile-menu');
|
||||
if (!btn || !menu) return;
|
||||
btn.addEventListener('click', () => {
|
||||
const open = menu.classList.toggle('hidden');
|
||||
btn.setAttribute('aria-expanded', String(!open));
|
||||
});
|
||||
menu.querySelectorAll('a').forEach(a => a.addEventListener('click', () => menu.classList.add('hidden')));
|
||||
})();
|
||||
|
||||
/* ─── Scroll-reveal (Intersection Observer) ───────────────────────────── */
|
||||
(function () {
|
||||
const io = new IntersectionObserver((entries) => {
|
||||
entries.forEach(e => { if (e.isIntersecting) { e.target.classList.add('visible'); io.unobserve(e.target); } });
|
||||
}, { threshold: 0.12 });
|
||||
document.querySelectorAll('.reveal').forEach(el => io.observe(el));
|
||||
})();
|
||||
|
||||
/* ─── Particle canvas (hero background) ──────────────────────────────── */
|
||||
(function () {
|
||||
const canvas = document.getElementById('particle-canvas');
|
||||
if (!canvas) return;
|
||||
const ctx = canvas.getContext('2d');
|
||||
let W, H, particles = [], animId;
|
||||
|
||||
function resize() {
|
||||
W = canvas.width = canvas.offsetWidth;
|
||||
H = canvas.height = canvas.offsetHeight;
|
||||
}
|
||||
|
||||
function makeParticle() {
|
||||
return {
|
||||
x: Math.random() * W, y: Math.random() * H,
|
||||
vx: (Math.random() - 0.5) * 0.3, vy: (Math.random() - 0.5) * 0.3,
|
||||
r: Math.random() * 1.5 + 0.5,
|
||||
a: Math.random() * 0.5 + 0.1
|
||||
};
|
||||
}
|
||||
|
||||
function init() { particles = Array.from({ length: 90 }, makeParticle); }
|
||||
|
||||
function draw() {
|
||||
ctx.clearRect(0, 0, W, H);
|
||||
const MAX_DIST = 120;
|
||||
for (let i = 0; i < particles.length; i++) {
|
||||
const p = particles[i];
|
||||
p.x += p.vx; p.y += p.vy;
|
||||
if (p.x < 0) p.x = W; if (p.x > W) p.x = 0;
|
||||
if (p.y < 0) p.y = H; if (p.y > H) p.y = 0;
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.arc(p.x, p.y, p.r, 0, Math.PI * 2);
|
||||
ctx.fillStyle = `rgba(56,189,248,${p.a})`;
|
||||
ctx.fill();
|
||||
|
||||
for (let j = i + 1; j < particles.length; j++) {
|
||||
const q = particles[j];
|
||||
const dx = p.x - q.x, dy = p.y - q.y;
|
||||
const d = Math.sqrt(dx * dx + dy * dy);
|
||||
if (d < MAX_DIST) {
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(p.x, p.y); ctx.lineTo(q.x, q.y);
|
||||
ctx.strokeStyle = `rgba(56,189,248,${(1 - d / MAX_DIST) * 0.15})`;
|
||||
ctx.lineWidth = 0.5;
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
}
|
||||
animId = requestAnimationFrame(draw);
|
||||
}
|
||||
|
||||
resize(); init(); draw();
|
||||
window.addEventListener('resize', () => { resize(); });
|
||||
|
||||
// Pause when hidden
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
if (document.hidden) { cancelAnimationFrame(animId); } else { draw(); }
|
||||
});
|
||||
})();
|
||||
|
||||
/* ─── Typewriter ──────────────────────────────────────────────────────── */
|
||||
(function () {
|
||||
const el = document.getElementById('typewriter');
|
||||
if (!el) return;
|
||||
const words = JSON.parse(el.dataset.words || '[]');
|
||||
if (!words.length) return;
|
||||
let wi = 0, ci = 0, deleting = false;
|
||||
|
||||
function tick() {
|
||||
const word = words[wi];
|
||||
if (!deleting) {
|
||||
el.textContent = word.slice(0, ++ci);
|
||||
if (ci === word.length) { setTimeout(tick, 1800); deleting = true; return; }
|
||||
setTimeout(tick, 80);
|
||||
} else {
|
||||
el.textContent = word.slice(0, --ci);
|
||||
if (ci === 0) { deleting = false; wi = (wi + 1) % words.length; setTimeout(tick, 300); return; }
|
||||
setTimeout(tick, 40);
|
||||
}
|
||||
}
|
||||
tick();
|
||||
})();
|
||||
|
||||
/* ─── Animated counters ───────────────────────────────────────────────── */
|
||||
(function () {
|
||||
const io = new IntersectionObserver(entries => {
|
||||
entries.forEach(e => {
|
||||
if (!e.isIntersecting) return;
|
||||
const el = e.target;
|
||||
const target = parseInt(el.dataset.target || '0', 10);
|
||||
const duration = 1200;
|
||||
const start = performance.now();
|
||||
function step(now) {
|
||||
const t = Math.min((now - start) / duration, 1);
|
||||
const ease = 1 - Math.pow(1 - t, 3);
|
||||
el.textContent = el.dataset.prefix + Math.round(target * ease) + (el.dataset.suffix || '');
|
||||
if (t < 1) requestAnimationFrame(step);
|
||||
}
|
||||
requestAnimationFrame(step);
|
||||
io.unobserve(el);
|
||||
});
|
||||
}, { threshold: 0.5 });
|
||||
document.querySelectorAll('.counter').forEach(el => io.observe(el));
|
||||
})();
|
||||
|
||||
/* ─── Expertise bars (animate on scroll) ─────────────────────────────── */
|
||||
(function () {
|
||||
const io = new IntersectionObserver(entries => {
|
||||
entries.forEach(e => {
|
||||
if (!e.isIntersecting) return;
|
||||
const fill = e.target.querySelector('.bar-fill');
|
||||
if (fill) { fill.style.width = fill.dataset.w; }
|
||||
io.unobserve(e.target);
|
||||
});
|
||||
}, { threshold: 0.3 });
|
||||
document.querySelectorAll('.bar-track').forEach(el => io.observe(el));
|
||||
})();
|
||||
|
||||
/* ─── Portfolio modal ─────────────────────────────────────────────────── */
|
||||
(function () {
|
||||
const modal = document.getElementById('portfolio-modal');
|
||||
const overlay = document.getElementById('modal-overlay');
|
||||
if (!modal) return;
|
||||
|
||||
let images = [], idx = 0;
|
||||
|
||||
const imgEl = document.getElementById('modal-img');
|
||||
const titleEl = document.getElementById('modal-title');
|
||||
const bodyEl = document.getElementById('modal-body');
|
||||
const prevBtn = document.getElementById('modal-prev');
|
||||
const nextBtn = document.getElementById('modal-next');
|
||||
const closeBtn = document.getElementById('modal-close');
|
||||
|
||||
function showModal(card) {
|
||||
images = JSON.parse(card.dataset.gallery || '[]');
|
||||
idx = 0;
|
||||
if (titleEl) titleEl.textContent = card.dataset.title || '';
|
||||
if (bodyEl) bodyEl.innerHTML = card.dataset.summary || '';
|
||||
updateImg();
|
||||
modal.classList.remove('hidden');
|
||||
modal.style.opacity = '0';
|
||||
requestAnimationFrame(() => { modal.style.opacity = '1'; });
|
||||
document.body.style.overflow = 'hidden';
|
||||
}
|
||||
|
||||
function hideModal() {
|
||||
modal.style.opacity = '0';
|
||||
setTimeout(() => { modal.classList.add('hidden'); document.body.style.overflow = ''; }, 250);
|
||||
}
|
||||
|
||||
function updateImg() {
|
||||
if (!imgEl) return;
|
||||
imgEl.src = images[idx] || '';
|
||||
if (prevBtn) prevBtn.disabled = idx === 0;
|
||||
if (nextBtn) nextBtn.disabled = idx === images.length - 1;
|
||||
}
|
||||
|
||||
document.querySelectorAll('[data-portfolio-card]').forEach(card => {
|
||||
card.addEventListener('click', () => showModal(card));
|
||||
card.addEventListener('keydown', e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); showModal(card); } });
|
||||
});
|
||||
|
||||
if (closeBtn) closeBtn.addEventListener('click', hideModal);
|
||||
if (overlay) overlay.addEventListener('click', hideModal);
|
||||
if (prevBtn) prevBtn.addEventListener('click', () => { if (idx > 0) { idx--; updateImg(); } });
|
||||
if (nextBtn) nextBtn.addEventListener('click', () => { if (idx < images.length - 1) { idx++; updateImg(); } });
|
||||
|
||||
document.addEventListener('keydown', e => {
|
||||
if (modal.classList.contains('hidden')) return;
|
||||
if (e.key === 'Escape') hideModal();
|
||||
if (e.key === 'ArrowLeft') { if (idx > 0) { idx--; updateImg(); } }
|
||||
if (e.key === 'ArrowRight') { if (idx < images.length - 1) { idx++; updateImg(); } }
|
||||
});
|
||||
})();
|
||||
|
||||
/* ─── Contact form (AJAX) ─────────────────────────────────────────────── */
|
||||
(function () {
|
||||
const form = document.getElementById('contact-form');
|
||||
if (!form) return;
|
||||
const status = document.getElementById('contact-status');
|
||||
|
||||
form.addEventListener('submit', async e => {
|
||||
e.preventDefault();
|
||||
const data = Object.fromEntries(new FormData(form));
|
||||
const btn = form.querySelector('[type="submit"]');
|
||||
btn.disabled = true;
|
||||
try {
|
||||
const res = await fetch('/contact', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data)
|
||||
});
|
||||
if (res.ok) {
|
||||
if (status) { status.textContent = form.dataset.successMsg || 'Sent!'; status.className = 'mt-3 text-sm text-emerald-400'; }
|
||||
form.reset();
|
||||
} else {
|
||||
if (status) { status.textContent = form.dataset.errorMsg || 'Something went wrong.'; status.className = 'mt-3 text-sm text-red-400'; }
|
||||
}
|
||||
} catch {
|
||||
if (status) { status.textContent = form.dataset.errorMsg || 'Network error.'; status.className = 'mt-3 text-sm text-red-400'; }
|
||||
} finally {
|
||||
btn.disabled = false;
|
||||
}
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user