@font-face {
    font-family: "Vazirmatn Variable";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(/assets/Vazirmatn-RD[wght].woff2) format(woff2);
}

@property --ai-angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

.fade-up {
    opacity: 0;
    transform: translateY(30px);
    animation: reveal both;
    animation-timeline: view();
    animation-range: entry 10% cover 30%;
}

@keyframes reveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

:root {
    --bg: #e5edf5;
    --shadow-dark: rgba(95, 157, 231, 0.45);
    --shadow-light: rgba(255, 255, 255, 0.9);
    --text-primary: #2d3748;
    --text-secondary: #879fbe;
    --accent-darken: #c95e00;
    --accent: #e75a08;
    --radius: 24px;
    --transition: 0.4s ease-in-out;
    --raised: -8px -8px 16px var(--shadow-light), 8px 8px 16px var(--shadow-dark);
    --hero: -15px -15px 30px var(--shadow-light), 15px 15px 30px var(--shadow-dark);
    --subtle: -4px -4px 8px var(--shadow-light), 4px 4px 8px var(--shadow-dark);
    --pressed: inset 6px 6px 12px var(--shadow-dark), inset -6px -6px 12px var(--shadow-light);
    --pressed-deep: inset 10px 10px 20px var(--shadow-dark), inset -10px -10px 20px var(--shadow-light);
    /* timeline geometry (viewBox 0 0 60 800) */
    --tl-path-start: 61;
    --tl-path-end: 739;
    --tl-path-len: 678;
    --tl-layout-h: 800;
    font-family: 'Vazirmatn Variable', sans-serif;
    font-size: 15px;
    font-weight: 400;
    background-color: var(--bg);
}

body {
    display: flex;
    height: 100svh;
    timeline-scope: --services-track;
    color: var(--text-primary);
    margin: 0;
    overflow: hidden;
}

main {
    overflow-y: scroll;
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    display: flex;
    scrollbar-color: var(--accent-darken) transparent;
    flex-wrap: wrap;
    scroll-padding-block: 3rem;
    padding-block-start: 3rem;
    align-items: center;

    >section {
        display: flex;
        width: min(90vw, 900px);
        scroll-snap-align: start;
        box-sizing: border-box;
        gap: 2rem;
        flex-direction: column;
        align-items: center;
        min-height: 100svh;
        padding: 2.5rem 1.5rem;
        margin: auto;
    }
}


#footer {
    min-height: fit-content;
    margin-top: 4rem;
    margin-bottom: 4rem;
}

nav {
    position: fixed;
    top: 1.3rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background-color: var(--bg);
    border-radius: 40px;
    box-shadow: var(--raised);
    border: 2px solid rgba(255, 255, 255, 0.4);
    align-items: center;
    scroll-target-group: auto;
    .visually-hidden {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
        pointer-events: none;
    }
}

nav a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: bold;
    font-size: 0.85rem;
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    transition: var(--transition);
    font-family: inherit;

    &:hover {
    color: var(--accent);
    }

    &:target-current {
        color: var(--accent);
        box-shadow: var(--pressed);
    }
}

h1 {
    flex: 1;
    font-size: clamp(2rem, 3vw, 4rem);
    line-height: 1.2;
    font-weight: 800;
}

h2 {
    font-size: clamp(2rem, 2.8vw, 4rem);
    text-align: center;
    font-weight: 700;
}

h3 {
    font-size: 1rem;
    margin-bottom: 0;
    color: var(--text-primary);
    font-weight: 600;
}

p {
    line-height: 1.8;
    color: var(--text-secondary);
    padding: 0 1rem;
}

.accent-text {
    color: var(--accent);
}

.btn {
    background-color: var(--bg);
    color: var(--text-primary);
    border: 2px solid rgb(255 255 255 / 15%);
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    box-shadow: var(--raised);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    text-decoration: none;
    font-size: 0.95em;
    font-family: inherit;
    width: fit-content;
    justify-content: center;
    white-space: nowrap;
    align-items: center;
    align-content: center;
    flex-wrap: wrap;
}

.btn:hover {
    color: var(--accent-darken);
    transform: translateY(-2px);
}

.btn:active,
.btn:focus {
    box-shadow: var(--pressed);
    transform: translateY(0);
}

#landing {
    flex-direction: row;

    img {
        width: min(75vw, 275px);
        filter: drop-shadow(rgba(95, 157, 231, 0.45) 10px 10px 14px) drop-shadow(rgb(255, 255, 255) -10px -10px 14px);
        background: url(map-art.svg) center center / 100% 100%;
        aspect-ratio: 1;
        object-fit: contain;
        flex: 1;
        /* animation: float 6s ease-in-out infinite; */
    }
}

.hero-text {
    display: flex;
    flex: 2;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    align-content: flex-start;
    flex-wrap: wrap;
    .actions {
        gap: 1.4rem;
        display: flex;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

.products-grid {
    display: flex;
    gap: 3.5rem;
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
}

.product-card {
    background: var(--bg);
    padding: 0 0 2rem;
    border-radius: var(--radius);
    box-shadow: var(--raised);
    transition: var(--transition);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    max-width: 280px;
    flex: 280px;
    flex-wrap: wrap;
    align-content: center;
    justify-content: space-between;
}

.product-icon {
    width: 100%;
    height: auto;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 22px;
    overflow: hidden;
    border: 2px #e5edf5 solid;

    img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

.product-cta {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.6rem;
    border-radius: 16px;
    background-color: var(--bg);
    box-shadow: var(--raised);
    transition: var(--transition);
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 700;
    overflow: visible;
    font-family: inherit;
    border: none;
}

.product-cta::before {
    content: '';
    position: absolute;
    inset: -2px;
    padding: 2px;
    border-radius: 18px;
    background: conic-gradient(from var(--ai-angle), #ffb600 0deg, rgb(229 237 245) 90deg, #ffffff 180deg, #e5edf5 270deg, #ff8d00 360deg);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: destination-out;
    filter: blur(2px);
    z-index: -1;
    animation: rotate-border 5s linear infinite;
}

.product-cta:hover,
.product-cta:focus {
    background-color: var(--accent);
    color: white;
}

.product-cta:active {
    box-shadow: var(--pressed);
}

@keyframes rotate-border {
    to {
        --ai-angle: 360deg;
    }
}

.footer-card {
    background: var(--bg);
    padding: 2rem 1rem;
    border-radius: 40px;
    box-shadow: var(--pressed-deep);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.newsletter {
    display: flex;
    gap: 1.5rem;
    max-width: 500px;
    margin: 2rem auto;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.newsletter input {
    flex: 1;
    padding: 1rem 1.5rem;
    border-radius: 18px;
    border: none;
    background: var(--bg);
    box-shadow: var(--pressed);
    outline: none;
    font-family: inherit;
    transition: var(--transition);
}

.newsletter input:focus {
    box-shadow: var(--pressed-deep);
}

.social-links {
    display: flex;
    gap: 1.5rem;
    margin: 1rem auto;
}

.social-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--raised);
    color: var(--text-secondary);
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}

.social-btn:hover,
.social-btn:focus {
    box-shadow: var(--pressed);
    color: var(--accent);
    transform: scale(0.9);
}

#ai-agent {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: var(--bg);
    box-shadow: var(--raised);
    border: 1px var(--bg) solid;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: var(--transition);
    isolation: isolate;
}

#ai-agent::before {
    content: '';
    position: absolute;
    inset: -3px;
    padding: 2px;
    border-radius: 50%;
    background: conic-gradient(from var(--ai-angle), #ffb600 0deg, rgb(229 237 245) 90deg, #ffffff 180deg, #e5edf5 270deg, #ff8d00 360deg);
    filter: blur(2px);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: destination-out;
    animation: rotate-border 5s linear infinite;
}

#chatDialog {
    border: none;
    padding: 0;
    width: 380px;
    height: 520px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 2px var(--bg) solid;
    box-shadow: var(--hero);
    z-index: 999;
    flex-direction: column;
    overflow: hidden;
    font-family: inherit;
    margin: auto;
}

#chatDialog[open] {
    display: flex;
}

#chatDialog::backdrop {
    background-color: rgba(229, 237, 245, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.chat-header {
    padding: 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scrollbar-color: var(--accent-darken) var(--bg);
    scrollbar-width: thin;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--bg);
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: var(--accent-darken);
    border-radius: 10px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px;
}

.typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--accent);
    border-radius: 50%;
    animation: typing-dot 1.4s infinite both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-dot {

    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.chat-bubble {
    padding: 0.8rem 1rem;
    border-radius: 18px;
    max-width: 80%;
    font-size: 0.9rem;
    box-shadow: var(--subtle);
    line-height: 1.6;
}

.chat-bubble.ai {
    align-self: flex-start;
    color: var(--text-primary);
    border: 1px rgb(255 255 255 / 50%) solid;
    border-bottom-left-radius: 4px;
}

.chat-bubble.user {
    align-self: flex-end;
    background-color: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-input-area {
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
    width: 100%;
    background: var(--bg);
    box-sizing: border-box;

    button {
        padding: 0 0.7rem;
    }

    input {
        width: inherit;
        padding: 0.8rem;
        border-radius: 15px;
        border: none;
        background: var(--bg);
        box-shadow: var(--pressed);
        outline: none;
        font-family: inherit;
    }
}

input,
button,
textarea,
select {
    font-family: inherit;
}

#authDialog {
    border: none;
    padding: 2rem;
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: var(--hero);
    color: var(--text-primary);
    width: 90%;
    max-width: 350px;
    margin: auto;
    font-family: inherit;
}

#authDialog::backdrop {
    background-color: rgba(229, 237, 245, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#authDialog h3 {
    margin-top: 0;
    color: var(--accent);
    text-align: center;
}

#authDialog input {
    width: 100%;
    box-sizing: border-box;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 15px;
    border: none;
    background: var(--bg);
    box-shadow: var(--pressed);
    outline: none;
    font-family: inherit;
}

#authDialog input:focus {
    box-shadow: var(--pressed-deep);
}

/* ══════════════════════════════════════
           SERVICES TIMELINE — scroll-driven CSS
        ══════════════════════════════════════ */

@keyframes elegant-reveal {
    from {
        opacity: 0;
        transform: translateY(60px) scale(0.92);
        filter: blur(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes tl-icon-reveal {
    from {
        opacity: 0;
        transform: scale(0.3);
        filter: brightness(0.2) blur(2px);
    }

    to {
        opacity: 1;
        transform: scale(0.72);
        filter: brightness(1) blur(0);
    }
}

@keyframes liquid-draw {
    0% {
        stroke-dashoffset: var(--tl-path-len);
    }

    100% {
        stroke-dashoffset: 0;
    }
}

/* تعریف تایم‌لاین اختصاصی برای هماهنگی ۱۰۰ درصدی هر کارت با آیکون خودش */
.service-item[data-index="0"] {
    view-timeline: --card-0 block;
}

.service-item[data-index="1"] {
    view-timeline: --card-1 block;
}

.service-item[data-index="2"] {
    view-timeline: --card-2 block;
}

.service-item[data-index="3"] {
    view-timeline: --card-3 block;
}

.service-item[data-index="4"] {
    view-timeline: --card-4 block;
}

.services-layout {
    view-timeline: --services-track block;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    width: 100%;
    gap: 1.5rem;
    justify-content: center;
    position: relative;
}

.services-timeline {
    width: 60px;
    flex-shrink: 0;
    position: sticky;
    top: max(15svh, 100px);
}

.services-cards {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 600px;
    padding: 0;
}

.service-item {
    height: 160px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    scroll-snap-align: center;
}

.service-card-new {
    background: var(--bg);
    border-radius: 20px;
    box-shadow: var(--raised);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 1.2rem 1.4rem;
    transition: box-shadow var(--transition), transform var(--transition);
    width: 100%;
}

.service-card-new:hover {
    box-shadow: var(--hero);
    transform: translateX(-3px);
}

.service-card-new h3 {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
}

.service-card-new p {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.75;
    padding: 0;
}

.timeline-svg {
    width: 60px;
    height: 800px;
    display: block;
    overflow: visible;
}

.timeline-liquid {
    stroke-dasharray: var(--tl-path-len);
    stroke-dashoffset: var(--tl-path-len);
}

.tl-icon {
    opacity: 1;
    transform: scale(0.72);
    transform-box: fill-box;
    transform-origin: center;
}

.tl-icon-path {
    stroke: white;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@supports ((animation-timeline: view()) and (animation-range: entry)) {
    .service-item {
        animation: elegant-reveal cubic-bezier(0.16, 1, 0.3, 1) both;
        animation-timeline: view();
        animation-range: entry 25% cover 45%;
    }

    .timeline-liquid {
        animation: liquid-draw linear both;
        animation-timeline: --services-track;
        /* اصلاح شده برای جلوگیری از پرش و پس‌رفت نوار در انتهای اسکرول */
        animation-range: entry 15% cover 65%;
    }

    .tl-icon[data-node="0"] {
        animation: tl-icon-reveal cubic-bezier(0.16, 1, 0.3, 1) both;
        animation-timeline: --card-0;
        animation-range: entry 25% cover 45%;
    }

    .tl-icon[data-node="1"] {
        animation: tl-icon-reveal cubic-bezier(0.16, 1, 0.3, 1) both;
        animation-timeline: --card-1;
        animation-range: entry 25% cover 45%;
    }

    .tl-icon[data-node="2"] {
        animation: tl-icon-reveal cubic-bezier(0.16, 1, 0.3, 1) both;
        animation-timeline: --card-2;
        animation-range: entry 25% cover 45%;
    }

    .tl-icon[data-node="3"] {
        animation: tl-icon-reveal cubic-bezier(0.16, 1, 0.3, 1) both;
        animation-timeline: --card-3;
        animation-range: entry 25% cover 45%;
    }

    .tl-icon[data-node="4"] {
        animation: tl-icon-reveal cubic-bezier(0.16, 1, 0.3, 1) both;
        animation-timeline: --card-4;
        animation-range: entry 25% cover 45%;
    }
}

@supports not ((animation-timeline: view()) and (animation-range: entry)) {
    .timeline-liquid {
        stroke-dashoffset: 0;
    }
}

@media (prefers-reduced-motion: reduce) {

    .service-item,
    .tl-icon {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
    }

    .tl-icon {
        transform: scale(0.72) !important;
    }

    .timeline-liquid {
        animation: none !important;
        stroke-dashoffset: 0;
    }
}

@media (max-width: 900px) {
    .services-layout {
        gap: 0.8rem;
    }

    .services-timeline {
        width: 60px;
    }

    .service-item {
        height: 160px;
    }

    .service-card-new {
        padding: 0.8rem 1rem;
    }

    .service-card-new h3 {
        font-size: 0.95rem;
        margin-bottom: 0.25rem;
    }

    .service-card-new p {
        font-size: 0.75rem;
        line-height: 1.5;
    }

    .hero-text h1 {
        justify-content: center;
    }

    #landing {
        flex-direction: column;
        img {order: -1}
        .newsletter {flex-direction: column}
    }
    
    #chatDialog {
        width: 100%;
        height: 75svh;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }
}