:root {
    --bg-obsidian: #090A0F;
    --bg-surface: rgba(17, 21, 32, 0.72);
    --bg-surface-hover: rgba(24, 30, 46, 0.88);
    --border-subtle: rgba(148, 163, 184, 0.14);
    --border-accent: rgba(34, 211, 238, 0.35);
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --accent-cyan: #22D3EE;
    --accent-emerald: #10B981;
    --accent-violet: #8B5CF6;
    --accent-amber: #F59E0B;
    --danger: #EF4444;
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --font-sans: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="light"] {
    --bg-obsidian: #F8FAFC;
    --bg-surface: rgba(255, 255, 255, 0.85);
    --bg-surface-hover: rgba(255, 255, 255, 0.98);
    --border-subtle: rgba(15, 23, 42, 0.12);
    --border-accent: rgba(2, 132, 199, 0.35);
    --text-primary: #0F172A;
    --text-secondary: #334155;
    --text-muted: #64748B;
    --accent-cyan: #0284C7;
    --accent-emerald: #059669;
    --accent-violet: #7C3AED;
    --accent-amber: #D97706;
}

[data-theme="light"] .site-header {
    background: rgba(248, 250, 252, 0.85);
}

[data-theme="light"] .bg-fallback {
    background:
        radial-gradient(circle at 15% 15%, rgba(2, 132, 199, 0.08), transparent 40%),
        radial-gradient(circle at 85% 75%, rgba(5, 150, 105, 0.07), transparent 45%),
        var(--bg-obsidian);
}

[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select,
[data-theme="light"] .form-group textarea {
    background: #FFFFFF;
}

[data-theme="light"] .toast {
    background: #FFFFFF;
}

[data-theme="light"] .mobile-nav {
    background: rgba(248, 250, 252, 0.94);
}

.theme-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid var(--border-subtle);
}

.theme-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.78rem;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.theme-btn.is-active {
    background: var(--accent-cyan);
    color: #FFFFFF;
    font-weight: 600;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    margin: 0;
    background-color: var(--bg-obsidian);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

#bg-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
}

.bg-fallback {
    position: fixed;
    inset: 0;
    z-index: -3;
    background:
        radial-gradient(circle at 15% 15%, rgba(34, 211, 238, 0.08), transparent 40%),
        radial-gradient(circle at 85% 75%, rgba(16, 185, 129, 0.07), transparent 45%),
        var(--bg-obsidian);
}

#cursor-spotlight {
    position: fixed;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.07), transparent 65%);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.container {
    width: min(1160px, 92%);
    margin-inline: auto;
}

.mono-text {
    font-family: var(--font-mono);
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: rgba(9, 10, 15, 0.78);
    border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-block: 0.9rem;
    gap: 1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
}

.brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 12px var(--accent-cyan);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.main-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.92rem;
    transition: color 0.2s ease;
}

.main-nav a:hover {
    color: var(--text-primary);
}

.main-nav .nav-cta {
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    background: rgba(34, 211, 238, 0.12);
    border: 1px solid var(--border-accent);
    color: var(--accent-cyan);
}

/* Bento Card */
.bento-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: transform 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}

.bento-card:hover {
    border-color: rgba(148, 163, 184, 0.3);
    background: var(--bg-surface-hover);
}

/* Hero Bento */
.hero-bento {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    gap: 1.25rem;
    padding-block: 2.5rem 1.5rem;
}

.hero-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: var(--accent-emerald);
    font-size: 0.82rem;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-emerald);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(1.3); }
}

.mono-tag {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent-cyan);
    background: rgba(34, 211, 238, 0.1);
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
}

.hero-title {
    margin: 0;
    font-size: clamp(1.9rem, 3.6vw, 2.8rem);
    line-height: 1.25;
}

.hero-role {
    margin: 0;
    font-size: 1.15rem;
    color: var(--accent-cyan);
    font-weight: 600;
}

.hero-bio {
    margin: 0;
    color: var(--text-secondary);
    max-width: 62ch;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-top: 0.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.35rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), #0EA5E9);
    color: #06121A;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(34, 211, 238, 0.28);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--accent-cyan);
}

.btn-full {
    width: 100%;
}

.hero-side {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.card-kicker {
    margin: 0 0 0.85rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.contact-chips {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.copy-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.copy-chip:hover {
    border-color: var(--accent-cyan);
}

.chip-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.chip-val {
    font-size: 0.88rem;
}

.copy-hint {
    font-size: 0.75rem;
    color: var(--accent-cyan);
}

.direct-links {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.9rem;
}

.mini-link {
    flex: 1;
    text-align: center;
    padding: 0.45rem;
    border-radius: var(--radius-sm);
    background: rgba(34, 211, 238, 0.08);
    color: var(--accent-cyan);
    text-decoration: none;
    font-size: 0.85rem;
}

.stats-card {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    text-align: center;
}

.stat-num {
    display: block;
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--accent-cyan);
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* Sections */
.section-block {
    padding-block: 2.5rem;
}

.section-head {
    margin-bottom: 1.5rem;
}

.section-head-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.section-kicker {
    display: block;
    font-size: 0.78rem;
    color: var(--accent-cyan);
    margin-bottom: 0.25rem;
}

.section-head h2 {
    margin: 0;
    font-size: 1.6rem;
}

/* Timeline */
.timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    padding-inline-start: 1.5rem;
    border-inline-start: 2px solid var(--border-subtle);
}

.timeline-item {
    position: relative;
}

.timeline-marker {
    position: absolute;
    inset-inline-start: calc(-1.5rem - 7px);
    top: 1.75rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
    border: 2px solid var(--bg-obsidian);
}

.timeline-marker.is-current {
    background: var(--accent-emerald);
    box-shadow: 0 0 12px var(--accent-emerald);
}

.timeline-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.job-role {
    margin: 0;
    font-size: 1.1rem;
}

.job-company {
    margin: 0.15rem 0 0;
    color: var(--accent-cyan);
    font-size: 0.95rem;
}

.period-badge {
    font-size: 0.82rem;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.job-highlights {
    margin: 0 0 0.9rem;
    padding-inline-start: 1.2rem;
    color: var(--text-secondary);
    font-size: 0.93rem;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.tech-tag {
    font-size: 0.76rem;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

/* Filters */
.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-btn,
.skill-filter-btn {
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn.is-active,
.skill-filter-btn.is-active {
    background: rgba(34, 211, 238, 0.14);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.2rem;
}

.project-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.project-card.is-hidden,
.skill-group-card.is-hidden {
    display: none;
}

.project-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.category-pill {
    font-size: 0.76rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    background: rgba(34, 211, 238, 0.12);
    color: var(--accent-cyan);
}

.project-role {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.project-title {
    margin: 0;
    font-size: 1.12rem;
}

.project-summary {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.92rem;
    flex-grow: 1;
}

.project-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    cursor: pointer;
    padding: 0;
}

.btn-text:hover {
    color: var(--accent-cyan);
}

.btn-link {
    color: var(--accent-emerald);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
}

.archived-badge {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Skills */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.15rem;
}

.skill-group-title {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    color: var(--accent-cyan);
}

.skill-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.skill-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    font-size: 0.84rem;
}

.skill-level {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Meta Bento */
.meta-bento {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.15rem;
}

.meta-title {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
    color: var(--accent-cyan);
}

.meta-primary {
    margin: 0 0 0.25rem;
    font-weight: 600;
}

.meta-sub,
.meta-note {
    margin: 0.25rem 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.divider {
    height: 1px;
    background: var(--border-subtle);
    margin-block: 0.85rem;
}

.meta-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.meta-list li {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.meta-list strong {
    color: var(--text-primary);
}

/* Contact */
.contact-bento {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.25rem;
}

.hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: rgba(9, 10, 15, 0.7);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

.field-error {
    color: var(--danger);
    font-size: 0.8rem;
    min-height: 1.1em;
}

.aside-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* Footer & Mobile Nav */
.site-footer {
    border-top: 1px solid var(--border-subtle);
    padding-block: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.mobile-nav {
    display: none;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.modal[hidden] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 6, 10, 0.78);
    backdrop-filter: blur(6px);
}

.modal-dialog {
    position: relative;
    width: min(560px, 100%);
    z-index: 1;
}

.modal-close {
    position: absolute;
    top: 1rem;
    inset-inline-end: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.6rem;
    cursor: pointer;
}

.modal-title {
    margin: 0.75rem 0 0.25rem;
}

.modal-role {
    margin: 0 0 0.85rem;
    color: var(--accent-cyan);
    font-size: 0.9rem;
}

.modal-desc {
    color: var(--text-secondary);
    margin: 0 0 1rem;
}

.modal-actions {
    margin-top: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 1.5rem;
    inset-inline-end: 1.5rem;
    z-index: 80;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    background: #111827;
    border: 1px solid var(--accent-cyan);
    color: var(--text-primary);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.toast.is-error {
    border-color: var(--danger);
}

@media (max-width: 860px) {
    .hero-bento,
    .contact-bento,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .main-nav {
        display: none;
    }

    .mobile-nav {
        position: fixed;
        bottom: 0;
        inset-inline: 0;
        z-index: 50;
        display: flex;
        justify-content: space-around;
        padding: 0.7rem 0.5rem;
        background: rgba(9, 10, 15, 0.92);
        backdrop-filter: blur(12px);
        border-top: 1px solid var(--border-subtle);
    }

    .mobile-nav a {
        color: var(--text-secondary);
        text-decoration: none;
        font-size: 0.82rem;
    }

    body {
        padding-bottom: 3.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    .pulse-dot {
        animation: none;
    }
    .bento-card,
    .btn {
        transition: none;
    }
}
