/* =================================================================
   PEAK PULSE — Smart Home Team
   Full redesign · Dark/Light theming · RTL
   ================================================================= */

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

/* ===== Design tokens ===== */
:root {
    /* Brand */
    --brand: #6d5efc;
    --brand-2: #00d4c8;
    --brand-3: #ff5d8f;
    --gradient: linear-gradient(135deg, #6d5efc 0%, #00d4c8 100%);
    --gradient-warm: linear-gradient(135deg, #ff8a3d, #ff5d8f);

    /* Radii / motion */
    --radius: 18px;
    --radius-sm: 12px;
    --radius-lg: 28px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

    --maxw: 1200px;
    --nav-h: 72px;
}

/* Dark theme (default) */
[data-theme="dark"] {
    --bg: #07070f;
    --bg-2: #0d0d1c;
    --surface: #12122a;
    --surface-2: #1a1a3a;
    --elev: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #f2f2fb;
    --text-muted: #a3a3c2;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.35);
    --glow: rgba(109, 94, 252, 0.35);
    --grid-line: rgba(255, 255, 255, 0.035);
    color-scheme: dark;
}

/* Light theme */
[data-theme="light"] {
    --bg: #f6f7fc;
    --bg-2: #ffffff;
    --surface: #ffffff;
    --surface-2: #f1f2fa;
    --elev: rgba(15, 23, 42, 0.02);
    --border: rgba(15, 23, 42, 0.09);
    --border-strong: rgba(15, 23, 42, 0.16);
    --text: #14142b;
    --text-muted: #5b5b7a;
    --shadow: 0 24px 60px rgba(76, 70, 140, 0.16);
    --shadow-sm: 0 8px 24px rgba(76, 70, 140, 0.12);
    --glow: rgba(109, 94, 252, 0.22);
    --grid-line: rgba(15, 23, 42, 0.04);
    color-scheme: light;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    scroll-padding-top: var(--nav-h);
}

body {
    font-family: 'Vazirmatn', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.85;
    overflow-x: hidden;
    transition: background var(--transition), color var(--transition);
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

.container {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 24px;
}

.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Latin numerals/labels look better in display font */
.logo-text,
.hero-badge,
.ribbon,
.seg-btn,
.hud-val,
.stat-number { font-family: 'Space Grotesk', 'Vazirmatn', sans-serif; }

/* ===== Scroll progress ===== */
.scroll-progress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 0%;
    background: var(--gradient);
    z-index: 2000;
    transition: width 0.1s linear;
}

/* ===== Navbar ===== */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-h);
    z-index: 1000;
    display: flex;
    align-items: center;
    transition: var(--transition);
}
.navbar.scrolled {
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
}
.nav-container {
    max-width: var(--maxw);
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.15rem;
}
.logo-mark {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: var(--gradient);
    display: grid;
    place-items: center;
    box-shadow: 0 6px 18px var(--glow);
}
.logo-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 0 rgba(255,255,255,0.7);
    animation: pulse 2s infinite;
}
.logo-text { letter-spacing: 0.5px; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
}
.nav-links a {
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
}
.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
    background: color-mix(in srgb, var(--brand) 14%, transparent);
}

.nav-actions { display: flex; align-items: center; gap: 8px; }

.theme-toggle {
    width: 42px; height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--elev);
    color: var(--text);
    transition: var(--transition);
}
.theme-toggle:hover { border-color: var(--brand); color: var(--brand); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    padding: 6px;
}
.nav-toggle span {
    width: 24px; height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 26px;
    border-radius: 50px;
    font-size: 0.98rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}
.btn-primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 10px 28px var(--glow);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 16px 40px var(--glow); }
.btn-ghost {
    background: var(--elev);
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-ghost:hover { transform: translateY(-3px); border-color: var(--brand); color: var(--brand); }
.btn-block { width: 100%; }

/* ===== Hero ===== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: calc(var(--nav-h) + 40px) 0 60px;
    overflow: hidden;
}
.hero-grid-bg {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 40%, transparent 100%);
}
.hero-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.55;
    pointer-events: none;
}
.hero-glow-1 { width: 420px; height: 420px; background: var(--brand); top: -80px; right: -60px; }
.hero-glow-2 { width: 380px; height: 380px; background: var(--brand-2); bottom: -100px; left: -40px; opacity: 0.4; }

.hero-inner {
    position: relative;
    z-index: 2;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 48px;
    align-items: center;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    border-radius: 50px;
    background: color-mix(in srgb, var(--brand) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 22px;
    animation: fadeUp 0.7s var(--ease-out) both;
}
.pulse-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--brand-2);
    box-shadow: 0 0 0 0 var(--brand-2);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-2) 70%, transparent); }
    70% { box-shadow: 0 0 0 8px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}
.hero-title {
    font-size: clamp(2.1rem, 5vw, 3.6rem);
    font-weight: 900;
    line-height: 1.25;
    margin-bottom: 20px;
    animation: fadeUp 0.7s var(--ease-out) 0.1s both;
}
.hero-subtitle {
    font-size: 1.08rem;
    color: var(--text-muted);
    max-width: 540px;
    margin-bottom: 30px;
    animation: fadeUp 0.7s var(--ease-out) 0.2s both;
}
.hero-buttons {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 44px;
    animation: fadeUp 0.7s var(--ease-out) 0.3s both;
}
.hero-stats {
    display: flex;
    gap: 36px;
    flex-wrap: wrap;
    animation: fadeUp 0.7s var(--ease-out) 0.4s both;
}
.stat { position: relative; }
.stat-number {
    font-size: 2.3rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}
.stat-suffix { color: var(--text-muted); font-weight: 700; font-size: 1rem; margin-right: 2px; }
.stat-label { display: block; font-size: 0.82rem; color: var(--text-muted); }

/* Hero visual / device card */
.hero-visual {
    position: relative;
    animation: fadeUp 0.8s var(--ease-out) 0.3s both;
}
.hero-card-glow {
    position: absolute;
    inset: 10% 14%;
    background: var(--gradient);
    filter: blur(70px);
    opacity: 0.35;
    border-radius: 50%;
}
.device-card {
    position: relative;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}
.device-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-size: 0.85rem;
}
.device-status { display: inline-flex; align-items: center; gap: 7px; color: var(--brand-2); font-weight: 600; }
.device-name { color: var(--text-muted); font-weight: 600; }
.mini-room {
    aspect-ratio: 16 / 11;
    border-radius: var(--radius-sm);
    background: var(--bg-2);
    border: 1px solid var(--border);
    display: grid;
    overflow: hidden;
}
.mini-cell { border: 0.5px solid var(--grid-line); transition: background 0.3s; }
.mini-cell.obstacle { background: color-mix(in srgb, var(--brand) 55%, var(--surface)); }
.mini-cell.clean { background: color-mix(in srgb, var(--brand-2) 30%, transparent); }
.mini-cell.robot { background: var(--brand-3); box-shadow: 0 0 10px var(--brand-3); }
.device-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 14px;
}
.metric {
    text-align: center;
    padding: 10px 6px;
    background: var(--elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.metric-val { display: block; font-weight: 700; font-size: 1.05rem; color: var(--brand); }
.metric-lbl { font-size: 0.72rem; color: var(--text-muted); }

.scroll-indicator {
    position: absolute;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}
.mouse {
    display: block;
    width: 24px; height: 38px;
    border: 2px solid var(--text-muted);
    border-radius: 12px;
    position: relative;
}
.wheel {
    position: absolute;
    top: 6px; left: 50%;
    width: 4px; height: 8px;
    background: var(--text-muted);
    border-radius: 2px;
    transform: translateX(-50%);
    animation: wheel 1.5s infinite;
}
@keyframes wheel {
    0% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(12px); }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Ribbon ===== */
.ribbon {
    overflow: hidden;
    border-block: 1px solid var(--border);
    background: var(--bg-2);
    padding: 14px 0;
}
.ribbon-track {
    display: flex;
    gap: 28px;
    width: max-content;
    align-items: center;
    animation: marquee 28s linear infinite;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 1px;
}
.ribbon-track span:not(:nth-child(2n)) { color: var(--brand); }
@keyframes marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* ===== Section base ===== */
.section { padding: 100px 0; }
.section-header { text-align: center; max-width: 640px; margin: 0 auto 56px; }
.section-tag {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 50px;
    background: color-mix(in srgb, var(--brand) 14%, transparent);
    color: var(--brand);
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 14px;
}
.section-title {
    font-size: clamp(1.7rem, 4vw, 2.6rem);
    font-weight: 800;
    margin-bottom: 14px;
    line-height: 1.3;
}
.section-desc { color: var(--text-muted); font-size: 1.02rem; }

/* ===== About ===== */
.about { background: var(--bg-2); }
.about-layout { display: grid; grid-template-columns: 1fr 1.2fr; gap: 48px; align-items: start; }
.about-lead p { color: var(--text-muted); margin-bottom: 18px; font-size: 1.02rem; }
.about-lead b { color: var(--text); }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.about-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    transition: var(--transition);
}
.about-card:hover {
    transform: translateY(-6px);
    border-color: color-mix(in srgb, var(--brand) 40%, transparent);
    box-shadow: var(--shadow-sm);
}
.about-icon { font-size: 2rem; margin-bottom: 12px; }
.about-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.about-card p { color: var(--text-muted); font-size: 0.92rem; line-height: 1.8; }

/* ===== Robot / 3D ===== */
.robot { background: var(--bg); }
.robot-stage {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: stretch;
}
.robot-canvas-wrap {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface), var(--bg-2));
    min-height: 480px;
    box-shadow: var(--shadow);
}
#vacuumCanvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.canvas-loading {
    position: absolute; inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--text-muted);
    background: var(--bg-2);
    transition: opacity 0.5s;
}
.canvas-loading.hidden { opacity: 0; pointer-events: none; }
.loader-ring {
    width: 42px; height: 42px;
    border: 3px solid var(--border-strong);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.canvas-hud {
    position: absolute;
    top: 16px; right: 16px;
    background: color-mix(in srgb, var(--bg) 70%, transparent);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: grid;
    gap: 6px;
    min-width: 170px;
    font-size: 0.82rem;
}
.hud-row { display: flex; justify-content: space-between; gap: 12px; }
.hud-key { color: var(--text-muted); }
.hud-val { font-weight: 700; color: var(--brand); }

.robot-controls {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.robot-controls h3 { font-size: 1.2rem; }
.controls-desc { color: var(--text-muted); font-size: 0.9rem; margin-top: -8px; }
.control-group { display: flex; flex-direction: column; gap: 8px; }
.control-label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.seg {
    display: flex;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}
.seg-btn {
    flex: 1;
    padding: 9px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    transition: var(--transition);
}
.seg-btn.active { background: var(--gradient); color: #fff; box-shadow: 0 6px 16px var(--glow); }
.control-buttons { display: flex; flex-direction: column; gap: 10px; }
.legend { display: grid; gap: 8px; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--border); }
.legend li { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; color: var(--text-muted); }
.dot { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }
.dot-robot { background: var(--brand-3); }
.dot-obstacle { background: #6b6b8c; }
.dot-path { background: var(--brand-2); }
.dot-clean { background: color-mix(in srgb, var(--brand-2) 45%, var(--surface)); }

/* ===== Tech ===== */
.tech { background: var(--bg-2); }
.tech-layout { display: grid; grid-template-columns: 1fr 1.1fr; gap: 48px; align-items: center; }
.skills { display: flex; flex-direction: column; gap: 22px; }
.skill-head { display: flex; justify-content: space-between; font-size: 0.92rem; font-weight: 600; margin-bottom: 8px; }
.skill-bar { height: 10px; background: var(--surface-2); border-radius: 50px; overflow: hidden; border: 1px solid var(--border); }
.skill-bar i {
    display: block;
    height: 100%;
    width: 0;
    background: var(--gradient);
    border-radius: 50px;
    transition: width 1.2s var(--ease-out);
}
.skill-bar.animate i { width: var(--w); }
.tech-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tech-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
    transition: var(--transition);
}
.tech-card:hover { transform: translateY(-6px); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.tc-icon { font-size: 1.7rem; display: block; margin-bottom: 8px; }
.tech-card h4 { font-size: 0.98rem; margin-bottom: 6px; font-family: 'Space Grotesk', sans-serif; }
.tech-card p { font-size: 0.8rem; color: var(--text-muted); line-height: 1.6; }

/* ===== Members ===== */
.members { background: var(--bg); }

/* اعضا بر اساس پایه در ردیف‌های جداگانه؛ هر ردیف وسط‌چین */
.members-rows { display: flex; flex-direction: column; gap: 40px; }
.members-grade-title {
    text-align: center;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.members-grade-title::before,
.members-grade-title::after {
    content: '';
    width: 46px; height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--border));
}
.members-grade-title::after { background: linear-gradient(90deg, var(--border), transparent); }
.members-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 22px;
}
.members-row .member-card { flex: 1 1 240px; max-width: 300px; }

.member-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}
.member-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-sm);
    border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}
.member-photo {
    position: relative;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    background:
        radial-gradient(120% 120% at 30% 20%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 60%),
        var(--surface-2);
}
.member-initial {
    font-size: 4.5rem;
    font-weight: 900;
    color: var(--accent);
    opacity: 0.9;
    text-shadow: 0 6px 30px color-mix(in srgb, var(--accent) 40%, transparent);
}
/* عکس عضو: اگر فایل عکس وجود داشته باشد روی حرف اول می‌نشیند؛ در غیر این صورت حرف اول می‌ماند */
.member-img {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    z-index: 1;
}
.member-grade {
    z-index: 2;
    position: absolute;
    top: 12px; right: 12px;
    padding: 4px 12px;
    border-radius: 50px;
    background: color-mix(in srgb, var(--bg) 60%, transparent);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    font-size: 0.74rem;
    font-weight: 600;
}
.member-info { padding: 20px; }
.member-name { font-size: 1.15rem; font-weight: 700; margin-bottom: 4px; }
.member-role {
    display: inline-block;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    margin-bottom: 12px;
}
.member-desc { color: var(--text-muted); font-size: 0.86rem; line-height: 1.75; margin-bottom: 14px; }
.member-link { color: var(--accent); font-weight: 600; font-size: 0.86rem; transition: var(--transition); }
.member-link:hover { opacity: 0.7; }

/* ===== Timeline ===== */
.timeline-section { background: var(--bg-2); }
.timeline { position: relative; max-width: 820px; margin: 0 auto; }
.timeline::before {
    content: '';
    position: absolute;
    right: 50%;
    top: 0; bottom: 0;
    width: 3px;
    transform: translateX(50%);
    background: var(--gradient);
    border-radius: 2px;
}
.timeline-item { position: relative; width: 50%; padding: 16px 36px; }
.timeline-item:nth-child(odd) { margin-right: auto; text-align: left; }
.timeline-item:nth-child(even) { margin-left: auto; }
.timeline-item::before {
    content: '';
    position: absolute;
    top: 26px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--brand);
    border: 3px solid var(--bg-2);
    z-index: 2;
}
.timeline-item:nth-child(odd)::before { right: -8px; }
.timeline-item:nth-child(even)::before { left: -8px; }
.timeline-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    transition: var(--transition);
}
.timeline-content:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.timeline-content.highlight {
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 18%, var(--surface)), color-mix(in srgb, var(--brand-2) 14%, var(--surface)));
    border-color: color-mix(in srgb, var(--brand) 45%, transparent);
}
.timeline-date { color: var(--brand-2); font-size: 0.82rem; font-weight: 700; margin-bottom: 6px; }
.timeline-content h3 { font-size: 1.05rem; margin-bottom: 6px; }
.timeline-content p { color: var(--text-muted); font-size: 0.88rem; }

/* ===== Competition ===== */
.competition { background: var(--bg); }
.competition-content { display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px; align-items: stretch; }
.comp-main {
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 12%, var(--surface)), color-mix(in srgb, var(--brand-2) 8%, var(--surface)));
    border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
    border-radius: var(--radius-lg);
    padding: 38px;
}
.comp-flag { font-size: 3rem; margin-bottom: 12px; }
.comp-main h3 { font-size: 1.4rem; margin-bottom: 12px; }
.comp-main p { color: var(--text-muted); margin-bottom: 26px; }
.comp-details { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.comp-detail {
    padding: 14px;
    background: color-mix(in srgb, var(--bg) 40%, transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
}
.d-label { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; }
.d-value { font-weight: 700; color: var(--brand-2); }
.comp-side { display: flex; flex-direction: column; gap: 14px; }
.org-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: var(--transition);
}
.org-card:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.org-card h4 { font-size: 1.05rem; margin-bottom: 6px; }
.org-card p { color: var(--text-muted); font-size: 0.86rem; }
.org-card.accent {
    background: var(--gradient);
    border: none;
}
.org-card.accent h4, .org-card.accent p { color: #fff; }

/* ===== Contact ===== */
.contact { background: var(--bg-2); }
.contact-wrap { max-width: 620px; margin: 0 auto; }
.contact-form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-group { position: relative; }
.form-group.full { grid-column: 1 / -1; }
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 16px 18px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
    resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent);
}
.form-group label {
    position: absolute;
    top: 16px; right: 18px;
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
    transition: var(--transition);
    background: var(--surface);
    padding: 0 6px;
}
.form-group input:focus + label,
.form-group input:not(:placeholder-shown) + label,
.form-group textarea:focus + label,
.form-group textarea:not(:placeholder-shown) + label {
    top: -9px;
    font-size: 0.76rem;
    color: var(--brand);
}
.contact-form .btn { grid-column: 1 / -1; }
.form-note { grid-column: 1 / -1; text-align: center; font-size: 0.9rem; color: var(--brand-2); min-height: 1.2em; }

/* ===== Footer ===== */
.footer { background: var(--bg); border-top: 1px solid var(--border); padding: 48px 0 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: flex-start; gap: 28px; flex-wrap: wrap; padding-bottom: 28px; }
.footer-brand p { color: var(--text-muted); font-size: 0.88rem; margin-top: 10px; max-width: 320px; }
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-links a { color: var(--text-muted); font-size: 0.9rem; transition: var(--transition); }
.footer-links a:hover { color: var(--brand); }
.footer-bottom { text-align: center; padding: 22px 0; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.84rem; }

/* ===== Scroll reveal ===== */
.reveal { opacity: 0; transform: translateY(34px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }

/* ===== Responsive ===== */
@media (max-width: 980px) {
    .hero-inner { grid-template-columns: 1fr; gap: 36px; }
    .hero-visual { max-width: 460px; }
    .about-layout, .tech-layout, .competition-content, .robot-stage { grid-template-columns: 1fr; }
    .tech-layout { gap: 36px; }
}

@media (max-width: 760px) {
    .nav-links {
        position: fixed;
        top: 0; right: -100%;
        width: min(82vw, 320px);
        height: 100vh;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: calc(var(--nav-h) + 16px) 22px 22px;
        background: var(--bg-2);
        border-left: 1px solid var(--border);
        box-shadow: var(--shadow);
        transition: right var(--transition);
    }
    .nav-links.active { right: 0; }
    .nav-links a { padding: 12px 14px; }
    .nav-toggle { display: flex; }
    .nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
    .nav-toggle.active span:nth-child(2) { opacity: 0; }
    .nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

    .about-grid, .tech-cards, .comp-details { grid-template-columns: 1fr 1fr; }
    .hero-stats { gap: 24px; }
    .stat-number { font-size: 1.9rem; }

    .timeline::before { right: 18px; transform: none; }
    .timeline-item { width: 100%; padding: 14px 0 14px 0; padding-right: 46px; text-align: right !important; margin: 0 !important; }
    .timeline-item::before { right: 11px !important; left: auto !important; }

    .contact-form { grid-template-columns: 1fr; }
}

@media (max-width: 460px) {
    .section { padding: 72px 0; }
    .about-grid, .tech-cards { grid-template-columns: 1fr; }
    .comp-details { grid-template-columns: 1fr; }
    .hero-buttons .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
    html { scroll-behavior: auto; }
}

/* =================================================================
   Member profile pages
   ================================================================= */
.profile-main { padding-top: var(--nav-h); }

.profile-hero {
    position: relative;
    padding: 70px 0 50px;
    overflow: hidden;
}
.profile-hero::before {
    content: '';
    position: absolute;
    top: -120px; right: -80px;
    width: 480px; height: 480px;
    border-radius: 50%;
    background: var(--accent, var(--brand));
    filter: blur(120px);
    opacity: 0.22;
    pointer-events: none;
}
.profile-head {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 44px;
    align-items: center;
    position: relative;
    z-index: 1;
}
.profile-avatar {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-lg);
    display: grid;
    place-items: center;
    overflow: hidden;
    background:
        radial-gradient(120% 120% at 30% 20%, color-mix(in srgb, var(--accent, var(--brand)) 60%, transparent), transparent 62%),
        var(--surface-2);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.profile-avatar span {
    font-size: 7rem;
    font-weight: 900;
    color: var(--accent, var(--brand));
    text-shadow: 0 10px 40px color-mix(in srgb, var(--accent, var(--brand)) 40%, transparent);
}
/* عکس پروفایل: اگر فایل عکس باشد روی حرف اول می‌نشیند */
.profile-img {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    z-index: 1;
}
.p-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 50px;
    background: color-mix(in srgb, var(--accent, var(--brand)) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent, var(--brand)) 30%, transparent);
    color: var(--accent, var(--brand));
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 14px;
}
.profile-name {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    margin-bottom: 8px;
}
.profile-role {
    display: inline-block;
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 18px;
    padding: 5px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50px;
}
.profile-bio { color: var(--text-muted); font-size: 1.04rem; max-width: 560px; }

.profile-section { padding: 50px 0; }
.profile-section h2 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.profile-section h2::before {
    content: '';
    width: 6px; height: 24px;
    border-radius: 3px;
    background: var(--accent, var(--brand));
}
.p-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
}
.p-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
}
.p-card:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--accent, var(--brand)) 45%, transparent); }
.p-card .p-icon { font-size: 1.8rem; margin-bottom: 10px; }
.p-card h3 { font-size: 0.98rem; margin-bottom: 6px; }
.p-card p { color: var(--text-muted); font-size: 0.9rem; }

.p-skills { display: flex; flex-direction: column; gap: 20px; max-width: 640px; }
.p-skills .skill-bar i { background: linear-gradient(135deg, var(--accent, var(--brand)), var(--brand-2)); }

/* مهارت‌های مشترک تیم (یکسان برای همه‌ی اعضا) */
.p-common-note { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 18px; max-width: 640px; }
.p-common {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0; margin: 0;
}
.p-common li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 50px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.92rem;
    font-weight: 600;
    transition: var(--transition);
}
.p-common li:hover { border-color: color-mix(in srgb, var(--accent, var(--brand)) 45%, transparent); transform: translateY(-3px); }
.p-common li span { font-size: 1.15rem; }

.p-contribution {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    color: var(--text-muted);
    line-height: 2;
    max-width: 820px;
}
.p-contribution b { color: var(--text); }

.profile-back { padding: 30px 0 80px; text-align: center; }

@media (max-width: 760px) {
    .profile-head { grid-template-columns: 1fr; text-align: center; gap: 28px; }
    .profile-avatar { max-width: 220px; margin: 0 auto; }
    .profile-role, .p-badge { margin-inline: auto; }
}

/* =================================================================
   FIRA Air — drone section  (additive)
   ================================================================= */
.air { background: var(--bg); }

.air-rules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.rule-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: var(--transition);
}
.rule-card:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.rule-ic { font-size: 1.7rem; display: block; margin-bottom: 8px; }
.rule-card h4 { font-size: 1rem; margin-bottom: 6px; }
.rule-card p { color: var(--text-muted); font-size: 0.88rem; line-height: 1.75; }
.air-source { text-align: center; color: var(--text-muted); font-size: 0.86rem; margin: 0 0 36px; }
.air-source a { color: var(--brand); font-weight: 600; }

#airCanvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }

.dot-drone { background: var(--brand-2); }
.dot-gate { background: var(--brand); }
.dot-pillar { background: #6b6b8c; }
.dot-line { background: var(--brand-3); }

/* ===== Python code edit link ===== */
.code-edit-link {
    margin-top: 10px;
    background: none;
    border: 1px dashed var(--border-strong);
    color: var(--text-muted);
    border-radius: 10px;
    padding: 8px 12px;
    font-family: 'Space Grotesk', 'Vazirmatn', sans-serif;
    font-size: 0.82rem;
    transition: var(--transition);
    width: 100%;
}
.code-edit-link:hover { color: var(--brand); border-color: var(--brand); }

/* ===== Python modal ===== */
.code-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.code-modal.open { display: flex; }
.code-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 14, 0.6);
    backdrop-filter: blur(6px);
}
.code-dialog {
    position: relative;
    width: min(720px, 100%);
    max-height: 88vh;
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
}
.code-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.code-head h3 { font-size: 1.15rem; }
.code-x {
    width: 36px; height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--elev);
    color: var(--text);
    font-size: 1rem;
}
.code-x:hover { border-color: var(--brand-3); color: var(--brand-3); }
.code-help { color: var(--text-muted); font-size: 0.86rem; line-height: 1.9; margin-bottom: 14px; }
.code-help code {
    font-family: 'Space Grotesk', monospace;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1px 7px;
    color: var(--brand);
    direction: ltr;
    display: inline-block;
}
#codeArea {
    width: 100%;
    min-height: 280px;
    background: var(--bg-2);
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: 'Space Grotesk', 'Courier New', monospace;
    font-size: 0.86rem;
    line-height: 1.7;
    resize: vertical;
    outline: none;
    direction: ltr;
    text-align: left;
    tab-size: 4;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}
#codeArea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.code-status {
    min-height: 1.4em;
    font-size: 0.85rem;
    margin: 12px 0;
    color: var(--text-muted);
}
.code-status.ok { color: var(--brand-2); }
.code-status.err { color: var(--brand-3); white-space: pre-wrap; direction: ltr; text-align: left; font-family: 'Space Grotesk', monospace; }
.code-status.busy { color: var(--brand); }
.code-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
.code-actions .btn { width: auto; }

@media (max-width: 540px) {
    .code-actions { flex-direction: column-reverse; }
    .code-actions .btn { width: 100%; }
}

/* =================================================================
   DJI Tello — POV overlay + sensors  (additive)
   ================================================================= */

/* POV first-person overlay */
.pov-badge { position: absolute; inset: 0; display: none; pointer-events: none; z-index: 4; }
.pov-badge.show { display: block; }
.pov-badge::before,
.pov-badge::after {
    content: '';
    position: absolute; left: 0; right: 0;
    height: 64px;
    pointer-events: none;
}
.pov-badge::before { top: 0; background: linear-gradient(to bottom, rgba(0,0,0,0.45), transparent); }
.pov-badge::after { bottom: 0; background: linear-gradient(to top, rgba(0,0,0,0.45), transparent); }
.pov-rec {
    position: absolute;
    top: 14px; left: 16px;
    display: inline-flex; align-items: center; gap: 8px;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.8rem;
    color: #fff;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: #ff3b5c; box-shadow: 0 0 8px #ff3b5c; animation: pulse 1.4s infinite; }
.pov-cross {
    position: absolute; top: 50%; left: 50%;
    width: 46px; height: 46px;
    transform: translate(-50%, -50%);
    border: 1.5px solid rgba(255,255,255,0.55);
    border-radius: 50%;
}
.pov-cross::before, .pov-cross::after {
    content: ''; position: absolute; background: rgba(255,255,255,0.55);
}
.pov-cross::before { left: 50%; top: -10px; bottom: -10px; width: 1.5px; transform: translateX(-50%); }
.pov-cross::after { top: 50%; left: -10px; right: -10px; height: 1.5px; transform: translateY(-50%); }

/* Tello platform block */
.tello-block {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 30px;
    align-items: center;
    margin: 8px 0 40px;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.tello-intro h3 { font-size: 1.5rem; margin: 8px 0 10px; }
.tello-intro p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 16px; }
.tello-intro b { color: var(--text); }
.tello-specs { display: flex; flex-wrap: wrap; gap: 8px; }
.tello-specs span {
    font-size: 0.78rem;
    padding: 5px 12px;
    border-radius: 50px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.sensor-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.sensor-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: var(--transition);
}
.sensor-card:hover { border-color: color-mix(in srgb, var(--brand-2) 45%, transparent); transform: translateY(-3px); }
.sensor-ic { font-size: 1.4rem; display: block; margin-bottom: 6px; }
.sensor-card h4 { font-size: 0.92rem; margin-bottom: 4px; }
.sensor-card p { font-size: 0.8rem; color: var(--text-muted); line-height: 1.65; }

@media (max-width: 860px) {
    .tello-block { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .sensor-grid { grid-template-columns: 1fr; }
}

/* ===== Language toggle (FA/EN) — افزودنی ===== */
.lang-toggle {
    min-width: 42px; height: 42px; padding: 0 10px;
    display: grid; place-items: center;
    border-radius: 12px; border: 1px solid var(--border);
    background: var(--elev); color: var(--text);
    font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 0.9rem;
    cursor: pointer; transition: var(--transition);
}
.lang-toggle:hover { border-color: var(--brand); color: var(--brand); }
