Redesign public site: minimal light editorial theme
deploy / deploy (push) Successful in 1m20s

Full design refactor of the public surface (home, blog, layout) using the
taste-skill anti-slop rules. Admin CMS is untouched.

- Single locked light theme: #fafafa bg, #18181b text, one accent #2563eb
- Syne headings + system body + Vazirmatn (fa); hairline rules, no glows/cards
- Remove AI tells: 5-colour palette, gradient text, neon glows, custom cursor,
  particle canvas, typewriter, scroll cue, per-section eyebrows, progress bars
- Replace window scroll listener with an IntersectionObserver sentinel
- 8 distinct section layouts; portfolio uses typographic covers (no broken imgs)
- Zero em-dashes in visible copy; fix relative-path-safe asset refs
- Add missing wwwroot/logo-mark.svg (was 404)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-21 05:16:06 +03:30
parent a55c75b928
commit 97bd2a12df
7 changed files with 433 additions and 810 deletions
+127 -89
View File
@@ -1,115 +1,152 @@
/* ─── Design tokens ──────────────────────────────────────────────────── */
/* ════════════════════════════════════════════════════════════════════════
Minimal editorial theme - light, single accent.
Public site styles are scoped under `.site` so the dark admin (which shares
this file via _AdminLayout) is left untouched. Admin-only classes (.glass,
.label-mono, .admin-nav-link) keep their dark definitions at the bottom.
════════════════════════════════════════════════════════════════════════ */
:root {
--bg: #020510;
--electric: #38bdf8;
--violet: #818cf8;
--magenta: #e879f9;
--emerald: #34d399;
--cyan: #22d3ee;
--radius: 14px;
color-scheme: dark;
--bg: #fafafa;
--surface: #ffffff;
--text: #18181b; /* zinc-900 */
--text-2: #52525b; /* zinc-600 */
--text-3: #a1a1aa; /* zinc-400 */
--line: #e4e4e7; /* zinc-200 */
--line-strong: #d4d4d8; /* zinc-300 */
--accent: #2563eb; /* blue-600 - the single accent */
--accent-ink: #1d4ed8; /* blue-700 */
--accent-weak: #eff4ff;
--radius: 8px;
}
html, body {
background: var(--bg);
font-feature-settings: 'ss01','cv11';
-webkit-font-smoothing: antialiased;
* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
::selection { background: #dbe5ff; color: #18181b; }
a:focus-visible, button:focus-visible,
input:focus-visible, textarea:focus-visible, select:focus-visible {
outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}
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; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 3px solid var(--bg); }
/* ─── Component classes (used across Razor templates) ────────────────── */
/* ─── Public base (scoped to .site) ──────────────────────────────────── */
body.site {
background: var(--bg);
color: var(--text);
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Vazirmatn', sans-serif;
font-size: 1rem; line-height: 1.6;
-webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
[dir='rtl'] body.site { font-family: 'Vazirmatn', system-ui, sans-serif; }
.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);
.site h1, .site h2, .site h3, .site h4 {
font-family: 'Syne', system-ui, sans-serif;
font-weight: 700; color: var(--text);
letter-spacing: -0.02em; line-height: 1.12;
}
[dir='rtl'] .site h1, [dir='rtl'] .site h2,
[dir='rtl'] .site h3, [dir='rtl'] .site h4 {
font-family: 'Vazirmatn', system-ui, sans-serif; letter-spacing: 0;
}
.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;
}
/* ─── Navigation ─────────────────────────────────────────────────────── */
.nav-link { font-size: .9rem; color: var(--text-2); transition: color .18s ease; }
.nav-link:hover { color: var(--text); }
#navbar { transition: background .25s ease, border-color .25s ease; border-bottom: 1px solid transparent; }
#navbar.scrolled { background: rgba(250,250,250,.82); backdrop-filter: blur(12px); border-bottom-color: var(--line); }
.label-mono {
font-family: 'SpaceMono',ui-monospace,monospace;
font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: #94a3b8;
/* ─── Buttons (one shape: 8px radius, no pills, no glow) ──────────────── */
.btn, .btn-primary {
display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
padding: .7rem 1.15rem; border-radius: var(--radius);
font-weight: 600; font-size: .92rem;
background: var(--accent); color: #fff; border: 1px solid var(--accent);
transition: background .18s ease, transform .12s ease;
}
.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:hover, .btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn:active, .btn-primary:active { transform: translateY(1px); }
.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;
display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
padding: .7rem 1.15rem; border-radius: var(--radius);
font-weight: 500; font-size: .92rem;
color: var(--text); background: transparent; border: 1px solid var(--line-strong);
transition: border-color .18s ease, background .18s ease, transform .12s ease;
}
.btn-ghost:hover { border-color: rgba(56,189,248,.6); background: rgba(56,189,248,.06); transform: translateY(-1px); }
.btn-ghost:hover { border-color: var(--text); background: #fff; }
.btn-ghost:active { transform: translateY(1px); }
.nav-link {
font-size: .875rem; color: #94a3b8;
transition: color .2s ease; text-decoration: none;
/* ─── Type helpers ───────────────────────────────────────────────────── */
.kicker {
font-size: .76rem; letter-spacing: .14em; text-transform: uppercase;
color: var(--text-3); font-weight: 500;
}
.nav-link:hover { color: #e2e8f0; }
[dir='rtl'] .kicker { letter-spacing: .06em; }
.lede { color: var(--text-2); font-size: 1.05rem; line-height: 1.7; max-width: 44rem; }
#navbar.scrolled { background: rgba(2,5,16,.85); backdrop-filter: blur(20px); border-bottom: 1px solid rgba(255,255,255,.05); }
.sec-head { margin-bottom: 3rem; max-width: 46rem; }
.sec-head h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); }
.sec-head .lede { margin-top: .9rem; }
/* ─── 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; }
/* ─── Neutral tag chip (one shape) ───────────────────────────────────── */
.chip {
display: inline-flex; align-items: center;
border: 1px solid var(--line); border-radius: 6px;
padding: .2rem .55rem; font-size: .72rem; color: var(--text-2);
background: #fff; white-space: nowrap;
}
/* ─── Service cards ──────────────────────────────────────────────── */
.service-card { transition: border-color .3s, box-shadow .3s, transform .3s; }
.service-card:hover { transform: translateY(-2px); }
/* ─── Surface card (portfolio, contact) ──────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-link { transition: border-color .18s ease, transform .18s ease; }
.card-link:hover { border-color: var(--line-strong); 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; }
/* ─── Form fields ────────────────────────────────────────────────────── */
.flabel { display: block; font-size: .85rem; font-weight: 500; color: var(--text-2); margin-bottom: .4rem; }
.field {
width: 100%; font-family: inherit; font-size: .92rem; color: var(--text);
background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius);
padding: .7rem .85rem; transition: border-color .18s ease, box-shadow .18s ease;
}
.field::placeholder { color: var(--text-3); }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
/* ─── 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); }
/* ─── Scroll reveal (MOTION_INTENSITY 3: subtle, transform+opacity only) ─ */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }
/* ─── Portfolio modal ────────────────────────────────────────────── */
#portfolio-modal { transition: opacity .25s ease; }
#portfolio-modal.hidden { pointer-events: none; }
/* ─── Blog prose ─────────────────────────────────────────────────────── */
.prose-custom { color: var(--text-2); line-height: 1.8; font-size: 1.02rem; }
.prose-custom h2, .prose-custom h3 { color: var(--text); font-family: 'Syne', system-ui, sans-serif; margin: 2rem 0 .6rem; }
[dir='rtl'] .prose-custom h2, [dir='rtl'] .prose-custom h3 { font-family: 'Vazirmatn', system-ui, sans-serif; }
.prose-custom p { margin-bottom: 1.2rem; }
.prose-custom a { color: var(--accent); text-decoration: underline; text-underline-offset: .2em; }
.prose-custom strong { color: var(--text); }
.prose-custom code { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; background: #f4f4f5; border: 1px solid var(--line); border-radius: 5px; padding: .12em .4em; font-size: .88em; color: #3f3f46; }
.prose-custom pre { background: #f4f4f5; border: 1px solid var(--line); border-radius: 8px; padding: 1.1rem; overflow-x: auto; margin: 1.4rem 0; }
.prose-custom pre code { background: none; border: 0; padding: 0; color: #27272a; }
.prose-custom ul, .prose-custom ol { padding-inline-start: 1.4rem; margin-bottom: 1.2rem; }
.prose-custom li { margin-bottom: .4rem; }
.prose-custom blockquote { border-inline-start: 3px solid var(--accent); padding-inline-start: 1rem; color: var(--text-2); margin: 1.4rem 0; }
/* ─── Admin nav ──────────────────────────────────────────────────── */
/* ════════════════════════════════════════════════════════════════════════
Admin (dark) - preserved. _AdminLayout has its own dark Tailwind config;
these classes keep working on its dark surface. Do not light-theme these.
════════════════════════════════════════════════════════════════════════ */
.glass {
background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015));
border: 1px solid rgba(255,255,255,.10);
border-radius: 14px;
box-shadow: inset 0 1px 0 0 rgba(255,255,255,.05);
}
.label-mono {
font-family: 'SpaceMono', ui-monospace, monospace;
font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: #94a3b8;
}
.admin-nav-link {
display: block; padding: .5rem .75rem; border-radius: .5rem;
color: #94a3b8; font-size: .875rem; text-decoration: none;
@@ -118,10 +155,11 @@ html { scroll-behavior: smooth; }
.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 ─────────────────────────────────────────────── */
/* ─── Reduced motion ─────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
*,*::before,*::after {
*, *::before, *::after {
animation-duration: .001ms !important; animation-iteration-count: 1 !important;
transition-duration: .001ms !important; scroll-behavior: auto !important;
}
.reveal { opacity: 1 !important; transform: none !important; }
}
+36 -215
View File
@@ -1,257 +1,78 @@
/* ─── 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)');
});
})();
/* ════════════════════════════════════════════════════════════════════════
Minimal interactions. MOTION_INTENSITY 3: hover + a single subtle reveal.
No custom cursor, no particle canvas, no typewriter, no scroll listeners.
════════════════════════════════════════════════════════════════════════ */
/* ─── Navbar scroll shadow ────────────────────────────────────────────── */
/* ─── Navbar border on scroll (IntersectionObserver, not a scroll listener) */
(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();
const sentinel = document.getElementById('nav-sentinel');
if (!nav || !sentinel) return;
const io = new IntersectionObserver(
([entry]) => nav.classList.toggle('scrolled', !entry.isIntersecting),
{ threshold: 0 }
);
io.observe(sentinel);
})();
/* ─── Mobile menu toggle ─────────────────────────────────────────────── */
/* ─── 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));
const hidden = menu.classList.toggle('hidden');
btn.setAttribute('aria-expanded', String(!hidden));
});
menu.querySelectorAll('a').forEach(a => a.addEventListener('click', () => menu.classList.add('hidden')));
})();
/* ─── Scroll-reveal (Intersection Observer) ───────────────────────────── */
/* ─── Scroll reveal (one subtle entry per element, then unobserve) ────── */
(function () {
const els = document.querySelectorAll('.reveal');
if (!els.length) return;
if (!('IntersectionObserver' in window)) {
els.forEach(el => el.classList.add('visible'));
return;
}
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);
if (e.isIntersecting) { e.target.classList.add('visible'); io.unobserve(e.target); }
});
}, { threshold: 0.5 });
document.querySelectorAll('.counter').forEach(el => io.observe(el));
}, { threshold: 0.12, rootMargin: '0px 0px -8% 0px' });
els.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) ─────────────────────────────────────────────── */
/* ─── Contact form (AJAX, JSON → /contact) ───────────────────────────── */
(function () {
const form = document.getElementById('contact-form');
if (!form) return;
const status = document.getElementById('contact-status');
form.addEventListener('submit', async e => {
form.addEventListener('submit', async (e) => {
e.preventDefault();
const data = Object.fromEntries(new FormData(form));
const btn = form.querySelector('[type="submit"]');
btn.disabled = true;
if (btn) btn.disabled = true;
const setStatus = (msg, cls) => { if (status) { status.textContent = msg; status.className = 'mt-1 text-sm ' + cls; } };
try {
const res = await fetch('/contact', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
body: JSON.stringify(data),
});
if (res.ok) {
if (status) { status.textContent = form.dataset.successMsg || 'Sent!'; status.className = 'mt-3 text-sm text-emerald-400'; }
setStatus(form.dataset.successMsg || 'Sent.', 'text-emerald-600');
form.reset();
} else {
if (status) { status.textContent = form.dataset.errorMsg || 'Something went wrong.'; status.className = 'mt-3 text-sm text-red-400'; }
setStatus(form.dataset.errorMsg || 'Something went wrong.', 'text-red-600');
}
} catch {
if (status) { status.textContent = form.dataset.errorMsg || 'Network error.'; status.className = 'mt-3 text-sm text-red-400'; }
setStatus(form.dataset.errorMsg || 'Network error.', 'text-red-600');
} finally {
btn.disabled = false;
if (btn) btn.disabled = false;
}
});
})();
+4
View File
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32" role="img" aria-label="Soroush Asadi">
<rect width="32" height="32" rx="7" fill="#18181b"/>
<text x="16" y="21.5" text-anchor="middle" font-family="Syne, system-ui, sans-serif" font-size="13.5" font-weight="700" letter-spacing="-0.6" fill="#fafafa">SA</text>
</svg>

After

Width:  |  Height:  |  Size: 353 B