/* =====================================================
   KEISARIYAN — site.css
   Light (default) + Dark · RTL (fa/ar) + LTR (en)
   ===================================================== */

:root {
    --bg: #f5f7fb;
    --surface: rgba(255, 255, 255, .72);
    --surface-solid: #ffffff;
    --text: #0f1626;
    --text2: #475569;
    --muted: #718096;
    --border: rgba(15, 23, 42, .10);
    --blue: #1769e0;
    --blue2: #3182ff;
    --purple: #7654e8;
    --green: #16a36a;
    --p1: 23, 105, 224;
    --p2: 118, 84, 232;
    --shadow: 0 20px 60px rgba(15, 23, 42, .10);
    --radius: 20px;
    --max: 1180px;
    --grad: linear-gradient(135deg, var(--blue), var(--purple));
}

[data-theme="dark"] {
    --bg: #05070b;
    --surface: rgba(16, 24, 38, .62);
    --surface-solid: #0d131e;
    --text: #f4f7fb;
    --text2: #aab4c4;
    --muted: #7a869b;
    --border: rgba(255, 255, 255, .09);
    --blue: #287cff;
    --blue2: #55a0ff;
    --purple: #865fff;
    --green: #35d98d;
    --p1: 85, 160, 255;
    --p2: 134, 95, 255;
    --shadow: 0 25px 70px rgba(0, 0, 0, .45);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    font-family: "Vazirmatn", "Inter", system-ui, sans-serif;
    line-height: 1.85;
    overflow-x: hidden;
    transition: background .3s, color .3s;
}
html[lang="en"] body { font-family: "Inter", "Vazirmatn", system-ui, sans-serif; line-height: 1.7; }
img, video, audio { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { line-height: 1.3; }

.container { width: calc(100% - 40px); max-width: var(--max); margin-inline: auto; }
.muted { color: var(--muted); }
.skip { position: absolute; inset-inline-start: 10px; top: -60px; background: var(--blue); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 2000; }
.skip:focus { top: 10px; }

/* ---------- animated background ---------- */
#bg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; pointer-events: none; }
.orbs { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.orbs i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .35; animation: drift 22s ease-in-out infinite alternate; }
.orbs i:nth-child(1) { width: 520px; height: 520px; background: rgb(var(--p1)); top: -140px; inset-inline-start: -120px; }
.orbs i:nth-child(2) { width: 460px; height: 460px; background: rgb(var(--p2)); bottom: -160px; inset-inline-end: -100px; animation-duration: 28s; animation-delay: -6s; }
.orbs i:nth-child(3) { width: 300px; height: 300px; background: #22d3ee; top: 45%; inset-inline-start: 45%; opacity: .16; animation-duration: 34s; animation-delay: -12s; }
[data-theme="dark"] .orbs i { opacity: .22; }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(70px, 50px) scale(1.18); } }

/* ---------- header ---------- */
.site-header {
    position: fixed; top: 0; inset-inline: 0; height: 76px; z-index: 1000;
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
    transition: box-shadow .3s;
}
.site-header.scrolled { box-shadow: 0 10px 30px rgba(0, 0, 0, .08); }
.navbar { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 20px; }

.brand { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1; flex-shrink: 0; color: var(--blue); }
.brand-script {
    font-family: "Great Vibes", "Segoe Script", "Brush Script MT", cursive;
    font-size: 40px; font-weight: 400; letter-spacing: .5px; direction: ltr;
    background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
    padding-inline: 2px;
}
.brand-swoosh { width: 100%; height: 8px; margin-top: -4px; color: var(--purple); opacity: .8; }

.main-nav { display: flex; gap: 6px; }
.main-nav a { padding: 8px 16px; border-radius: 999px; color: var(--text2); font-weight: 500; font-size: 15px; transition: .2s; }
.main-nav a:hover { color: var(--text); background: var(--surface); }
.main-nav a.active { color: #fff; background: var(--grad); box-shadow: 0 8px 22px rgba(var(--p1), .35); }

.header-actions { display: flex; align-items: center; gap: 10px; }
.langs { display: flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--surface); }
.langs a { padding: 5px 11px; font-size: 12.5px; font-weight: 700; color: var(--text2); font-family: "Inter", sans-serif; }
.langs a.on { background: var(--grad); color: #fff; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; font-size: 17px; transition: .2s; }
.icon-btn:hover { transform: translateY(-2px); border-color: var(--blue); }
.burger { display: none; }

/* ---------- common ---------- */
main { padding-top: 76px; min-height: 80vh; }
.section { padding: 90px 0; }
.page { padding: 70px 0 90px; }
.page.center { text-align: center; padding-top: 120px; }
.eyebrow { display: inline-block; font-family: "Inter", sans-serif; font-size: 12.5px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--blue); }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--text2); font-size: 17px; max-width: 760px; }
.sec-head { margin-bottom: 36px; }
.sec-head h2, .page-head h1 { font-size: clamp(28px, 4vw, 44px); font-weight: 800; }
.sec-head.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.page-head { margin-bottom: 44px; }
.page-head .lead { margin-top: 12px; }
.sub-title { font-size: 20px; font-weight: 700; margin: 8px 0 20px; display: flex; align-items: center; gap: 10px; }
.sub-title::before { content: ""; width: 26px; height: 4px; border-radius: 4px; background: var(--grad); }
.empty { color: var(--muted); padding: 40px 0; }

.card {
    position: relative; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    transition: transform .3s, border-color .3s;
    --mx: 50%; --my: 50%;
}
.card::after { /* mouse spotlight */
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
    background: radial-gradient(380px circle at var(--mx) var(--my), rgba(var(--p1), .14), transparent 60%);
}
.card:hover { transform: translateY(-5px); border-color: rgba(var(--p1), .45); }
.card:hover::after { opacity: 1; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 13px 26px; border-radius: 14px; font-weight: 700; border: 1px solid transparent; transition: .25s; cursor: pointer; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 14px 34px rgba(var(--p1), .38); }
.btn.primary:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(var(--p1), .5); }
.btn.ghost { border-color: var(--border); background: var(--surface); }
.btn.ghost:hover { border-color: var(--blue); transform: translateY(-3px); }
.btn.text { color: var(--blue); padding-inline: 10px; }
.link-arrow { color: var(--blue); font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.link-arrow span { transition: transform .2s; }
.link-arrow:hover span { transform: translateX(4px); }
[dir="rtl"] .link-arrow:hover span { transform: translateX(-4px); }
[dir="rtl"] .arr, [dir="rtl"] .link-arrow span { display: inline-block; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.chips li { padding: 4px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600; font-family: "Inter", sans-serif; }
.chips.small { margin-top: 10px; }
.chips.small li { font-size: 12px; padding: 2px 11px; color: var(--blue); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 50px; align-items: center; min-height: calc(100vh - 76px); padding-block: 50px; }
.badge { display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--text2); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(22, 163, 106, .6); animation: pulse 2s infinite; }
.dot.off { background: #e0a100; animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(22, 163, 106, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 163, 106, 0); } }
.hero .eyebrow { margin-top: 26px; }
.hero h1 { font-size: clamp(36px, 5.6vw, 66px); font-weight: 800; margin-top: 6px; display: flex; flex-direction: column; }
.hero h1 .hi { font-size: .45em; font-weight: 600; color: var(--text2); }
.headline { font-size: clamp(19px, 2.4vw, 27px); font-weight: 600; margin: 12px 0 14px; color: var(--text2); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.stats { display: flex; gap: 36px; margin-top: 36px; flex-wrap: wrap; }
.stats strong { display: block; font-size: 32px; font-weight: 800; font-family: "Inter", sans-serif; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stats span { color: var(--muted); font-size: 14px; }

.hero-visual { position: relative; display: grid; place-items: center; min-height: 440px; }
.avatar { width: min(380px, 78vw); aspect-ratio: 1; border-radius: 50%; overflow: hidden; z-index: 2; border: 6px solid var(--surface-solid); box-shadow: var(--shadow), 0 0 0 1px var(--border); background: var(--grad); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.ring { position: absolute; border-radius: 50%; border: 2px dashed rgba(var(--p1), .4); animation: spin 30s linear infinite; }
.ring.r1 { width: min(470px, 92vw); aspect-ratio: 1; }
.ring.r2 { width: min(560px, 100vw); aspect-ratio: 1; border-color: rgba(var(--p2), .3); animation-duration: 46s; animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.float { position: absolute; z-index: 3; padding: 8px 16px; border-radius: 14px; font-family: "Inter", sans-serif; font-weight: 700; font-size: 14px; background: var(--surface-solid); border: 1px solid var(--border); box-shadow: var(--shadow); animation: bob 5s ease-in-out infinite; }
.f1 { top: 8%; inset-inline-start: 6%; }
.f2 { top: 22%; inset-inline-end: 2%; animation-delay: -1.2s; color: var(--blue); }
.f3 { bottom: 16%; inset-inline-start: 2%; animation-delay: -2.4s; color: #d49a00; }
.f4 { bottom: 6%; inset-inline-end: 8%; animation-delay: -3.4s; color: var(--purple); }
@keyframes bob { 50% { transform: translateY(-14px); } }

/* ---------- about / resume ---------- */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
.about-text p { color: var(--text2); font-size: 16.5px; }
.about-text p + p { margin-top: 14px; }
.details { display: grid; gap: 14px; align-content: start; }
.details div { display: flex; justify-content: space-between; gap: 14px; padding-bottom: 12px; border-bottom: 1px dashed var(--border); }
.details div:last-child { border: 0; padding: 0; }
.details dt { color: var(--muted); }
.details dd { font-weight: 700; text-align: end; }
.details dd.ok { color: var(--green); }
.details a:hover { color: var(--blue); }

.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; margin-bottom: 50px; }
.skill h4 { font-size: 20px; }
.skill p { color: var(--text2); margin-top: 10px; font-size: 15px; }
.skill-img { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; margin-bottom: 12px; }
.bar { height: 7px; background: var(--border); border-radius: 7px; margin-top: 14px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--grad); border-radius: 7px; }

.resume-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; }
.timeline { position: relative; padding-inline-start: 30px; margin-bottom: 34px; }
.timeline::before { content: ""; position: absolute; inset-block: 6px; inset-inline-start: 7px; width: 2px; background: linear-gradient(var(--blue), var(--purple), transparent); }
.t-item { position: relative; display: flex; gap: 14px; margin-bottom: 26px; }
.t-item::before { content: ""; position: absolute; inset-inline-start: -30px; top: 8px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 3px solid var(--blue); box-shadow: 0 0 0 4px rgba(var(--p1), .15); }
.t-img { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; flex-shrink: 0; }
.t-period { font-size: 12.5px; color: var(--blue); font-weight: 700; }
.t-body h4 { font-size: 18px; }
.t-sub { color: var(--text2); font-size: 14.5px; }
.t-body p { color: var(--muted); font-size: 14.5px; margin-top: 4px; }

/* ---------- projects & blog cards ---------- */
.project, .post { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.project-media, .post-media { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--grad); }
.project-media img, .post-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.card:hover .project-media img, .card:hover .post-media img { transform: scale(1.06); }
.ph { width: 100%; height: 100%; display: grid; place-items: center; color: rgba(255, 255, 255, .85); font-size: 54px; font-weight: 800; font-family: "Inter", monospace; direction: ltr; }
.project-body, .post-body { padding: 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.project-body h3, .post-body h3 { font-size: 20px; }
.project-body p, .post-body p { color: var(--text2); font-size: 15px; flex: 1; }
.project-body .chips, .post-body .meta { margin-top: 0; }
.meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.tag { padding: 2px 12px; border-radius: 999px; background: rgba(var(--p1), .12); color: var(--blue); font-weight: 700; font-size: 12.5px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 30px; }
.filters a { padding: 6px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 14px; font-weight: 600; }
.filters a.on, .filters a:hover { background: var(--grad); color: #fff; border-color: transparent; }

/* ---------- article ---------- */
.article { max-width: 860px; }
.article .back { margin-bottom: 26px; }
.article-head h1 { font-size: clamp(28px, 4.4vw, 46px); font-weight: 800; margin: 14px 0; }
.cover { width: 100%; border-radius: var(--radius); margin: 28px 0; box-shadow: var(--shadow); }
.prose { font-size: 17.5px; color: var(--text2); line-height: 2; margin-block: 24px; }
.prose p + p { margin-top: 18px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 26px 0; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; transition: transform .3s; }
.gallery a:hover img { transform: scale(1.03); }
.media { width: 100%; border-radius: 16px; margin: 22px 0; background: #000; }
audio.media { background: transparent; }
.attach { margin-top: 30px; }
.attach h3 { margin-bottom: 12px; }
.attach li a { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.attach li a span { color: var(--blue); font-weight: 700; font-size: 14px; }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 28px; align-items: start; }
.contact-cards { display: grid; gap: 14px; }
.c-card { display: flex; align-items: center; gap: 16px; padding: 18px 22px; }
.c-card .ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 800; font-size: 18px; flex-shrink: 0; }
.c-card small { display: block; color: var(--muted); font-size: 12.5px; }
.c-card strong { font-size: 16px; word-break: break-all; }
.form { display: grid; gap: 16px; }
.form:hover { transform: none; }
.form h2 { font-size: 24px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: 14.5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form input, .form select, .form textarea {
    width: 100%; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--surface-solid); outline: none; transition: .2s; font-weight: 400;
}
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(var(--p1), .15); }
.form textarea { resize: vertical; }
.form .btn { justify-self: start; }
.alert { padding: 12px 16px; border-radius: 12px; font-weight: 600; }
.alert.ok { background: rgba(22, 163, 106, .14); color: var(--green); }
.alert.err { background: rgba(220, 38, 38, .12); color: #dc2626; }
.hp { position: absolute; inset-inline-start: -9999px; height: 0; overflow: hidden; }

.cta { text-align: center; padding: 56px 24px; background: var(--grad); color: #fff; border: 0; }
.cta p { margin: 10px auto 26px; max-width: 560px; opacity: .92; }
.cta h2 { font-size: clamp(24px, 3.6vw, 38px); }
.cta .btn.primary { background: #fff; color: var(--blue); box-shadow: none; }
.err-code { font-size: 90px; font-weight: 800; font-family: "Inter", sans-serif; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.1; }
.page.center .lead { margin: 12px auto 26px; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(10px); padding-top: 50px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 34px; padding-bottom: 34px; }
.footer-grid p { margin-top: 12px; font-size: 14.5px; max-width: 360px; }
.footer-links, .footer-contact { display: grid; gap: 8px; align-content: start; color: var(--text2); }
.footer-links a:hover, .footer-contact a:hover { color: var(--blue); }
.footer-bottom { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding-block: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13.5px; }

/* ---------- reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
    .hero, .about-grid, .contact-grid, .resume-cols { grid-template-columns: 1fr; }
    .hero { min-height: auto; padding-top: 30px; }
    .hero-visual { min-height: 400px; order: -1; }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
    .burger { display: grid; }
    .main-nav {
        position: absolute; top: 76px; inset-inline: 0; flex-direction: column; padding: 14px 20px 20px;
        background: var(--surface-solid); border-bottom: 1px solid var(--border);
        display: none; box-shadow: 0 20px 40px rgba(0, 0, 0, .12);
    }
    .site-header.open .main-nav { display: flex; }
    .main-nav a { padding: 12px 16px; border-radius: 12px; }
}
@media (max-width: 640px) {
    .grid-3, .row2, .footer-grid { grid-template-columns: 1fr; }
    .brand-script { font-size: 34px; }
    .section { padding: 60px 0; }
    .hero-visual { min-height: 340px; }
    .float { font-size: 12px; padding: 5px 11px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
    .js .reveal { opacity: 1; transform: none; }
}

/* clickable project cards */
.project .stretched::after { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: var(--radius); }
.project .stretched:hover { color: var(--blue); }
.project:focus-within { border-color: var(--blue); }
