/* =========================================================
   MAIN.CSS
   Kiyan Rahmati Portfolio
========================================================= */


/* =========================================================
   GLOBAL
========================================================= */

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-family);
    line-height: 1.7;
    transition:
        background-color var(--transition),
        color var(--transition);
}

.container {
    width: min(
        calc(100% - 40px),
        var(--container-width)
    );

    margin-inline: auto;
}

.section {
    padding: var(--space-20) 0;
}

.section-header {
    max-width: 720px;
    margin-bottom: var(--space-10);
}

.section-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    margin-bottom: var(--space-4);

    color: var(--purple-light);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.section-label span:first-child {
    color: var(--purple);
}

.section-title {
    margin-bottom: var(--space-4);

    font-size: clamp(
        28px,
        4vw,
        var(--text-3xl)
    );

    line-height: 1.25;
}

.section-description {
    color: var(--text-muted);
    font-size: var(--text-md);
    max-width: 680px;
}


/* =========================================================
   NAVBAR
========================================================= */

.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;

    height: var(--navbar-height);

    background: color-mix(
        in srgb,
        var(--bg) 88%,
        transparent
    );

    border-bottom: 1px solid var(--border);

    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.navbar-inner {
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: var(--space-6);
}

.logo {
    display: inline-flex;
    align-items: center;

    color: var(--text);

    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: var(--weight-bold);

    white-space: nowrap;
}

.logo span {
    color: var(--purple-light);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-links a {
    position: relative;

    padding: 8px 12px;

    color: var(--text-secondary);

    font-size: var(--text-sm);
    font-weight: var(--weight-medium);

    border-radius: var(--radius-sm);

    transition:
        color var(--transition-fast),
        background var(--transition-fast);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
    background: var(--surface);
}

.nav-links a.active::after {
    content: "";

    position: absolute;

    left: 12px;
    right: 12px;
    bottom: 2px;

    height: 2px;

    background: var(--purple);

    border-radius: var(--radius-full);
}

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

.nav-btn,
.mobile-menu-btn {
    width: 38px;
    height: 38px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    color: var(--text-secondary);

    background: transparent;

    border: 1px solid transparent;
    border-radius: var(--radius-sm);

    cursor: pointer;

    transition:
        color var(--transition-fast),
        background var(--transition-fast),
        border-color var(--transition-fast),
        transform var(--transition-fast);
}

.nav-btn:hover,
.mobile-menu-btn:hover {
    color: var(--text);
    background: var(--surface);
    border-color: var(--border);
}

.nav-btn:active,
.mobile-menu-btn:active {
    transform: scale(.95);
}

.language-btn {
    width: auto;
    padding: 0 10px;

    font-family: var(--font-family);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
}

.mobile-menu-btn {
    display: none;
    font-size: 20px;
}


/* =========================================================
   HERO
========================================================= */

.hero {
    position: relative;
    min-height: calc(100vh - var(--navbar-height));

    display: flex;
    align-items: center;

    padding: var(--space-16) 0;

    overflow: hidden;
}

.hero::before {
    content: "";

    position: absolute;

    width: 420px;
    height: 420px;

    top: 5%;
    right: -180px;

    background: var(--purple);

    opacity: .08;

    filter: blur(90px);
    border-radius: 50%;

    pointer-events: none;
}

.hero-inner {
    position: relative;
    z-index: 1;

    display: grid;
    grid-template-columns: 1.2fr .8fr;

    align-items: center;

    gap: var(--space-16);
}

.hero-content {
    max-width: 720px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    margin-bottom: var(--space-6);
    padding: 7px 12px;

    color: var(--text-secondary);

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-full);

    font-size: var(--text-xs);
}

.hero-badge::before {
    content: "";

    width: 7px;
    height: 7px;

    background: var(--success);

    border-radius: 50%;

    box-shadow: 0 0 0 4px rgba(74, 222, 128, .08);
}

.hero h1 {
    margin-bottom: var(--space-4);

    font-size: clamp(
        42px,
        7vw,
        72px
    );

    line-height: 1.05;
    letter-spacing: -2px;
}

.hero h1 span {
    color: var(--purple-light);
}

.hero-subtitle {
    margin-bottom: var(--space-5);

    color: var(--text-secondary);

    font-size: clamp(
        20px,
        3vw,
        28px
    );

    font-weight: var(--weight-semibold);
}

.hero-description {
    max-width: 650px;

    margin-bottom: var(--space-8);

    color: var(--text-muted);

    font-size: var(--text-lg);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}


/* =========================================================
   BUTTONS
========================================================= */

.btn {
    min-height: 44px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    padding: 0 18px;

    border: 1px solid transparent;
    border-radius: var(--radius-md);

    font-family: var(--font-family);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);

    cursor: pointer;

    transition:
        transform var(--transition-fast),
        background var(--transition-fast),
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    color: #fff;
    background: var(--purple);

    box-shadow: var(--shadow-purple);
}

.btn-primary:hover {
    background: var(--purple-dark);
}

.btn-secondary {
    color: var(--text-secondary);
    background: var(--surface);
    border-color: var(--border);
}

.btn-secondary:hover {
    color: var(--text);
    background: var(--surface-2);
}


/* =========================================================
   HERO PROFILE
========================================================= */

.hero-visual {
    display: flex;
    justify-content: center;
}

.profile-card {
    position: relative;

    width: min(100%, 360px);

    padding: 12px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-xl);

    box-shadow: var(--shadow-lg);
}

.profile-card::before {
    content: "";

    position: absolute;

    inset: -1px;

    border-radius: inherit;

    background: linear-gradient(
        135deg,
        rgba(139, 92, 246, .35),
        transparent 45%
    );

    z-index: -1;
}

.profile-photo {
    width: 100%;
    aspect-ratio: 1;

    object-fit: cover;

    border-radius: calc(
        var(--radius-xl) - 8px
    );
}

.profile-fallback {
    width: 100%;
    aspect-ratio: 1;

    display: flex;
    align-items: center;
    justify-content: center;

    color: var(--purple-light);

    background: var(--surface-2);

    border-radius: calc(
        var(--radius-xl) - 8px
    );

    font-family: var(--font-mono);
    font-size: 80px;
    font-weight: var(--weight-bold);
}


/* =========================================================
   QUICK STATS
========================================================= */

.quick-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);

    margin-top: var(--space-12);

    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.quick-stat {
    padding: var(--space-6);

    text-align: center;
}

.quick-stat + .quick-stat {
    border-inline-start: 1px solid var(--border);
}

.quick-stat strong {
    display: block;

    margin-bottom: 4px;

    color: var(--text);

    font-family: var(--font-mono);
    font-size: var(--text-xl);
}

.quick-stat span {
    color: var(--text-muted);
    font-size: var(--text-xs);
}


/* =========================================================
   ABOUT
========================================================= */

.about-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);

    gap: var(--space-5);
}

.about-card {
    padding: var(--space-6);

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    transition:
        transform var(--transition),
        border-color var(--transition),
        background var(--transition);
}

.about-card:hover {
    transform: translateY(-4px);
    background: var(--surface-2);
    border-color: rgba(139, 92, 246, .35);
}

.about-card h3 {
    margin-bottom: var(--space-3);

    font-size: var(--text-lg);
}

.about-card p {
    color: var(--text-muted);
}


/* =========================================================
   SKILLS
========================================================= */

.skills-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);

    gap: 12px;
}

.skill {
    padding: 16px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    transition:
        transform var(--transition-fast),
        background var(--transition-fast),
        border-color var(--transition-fast);
}

.skill:hover {
    transform: translateY(-3px);

    background: var(--surface-2);

    border-color: rgba(
        139,
        92,
        246,
        .4
    );
}

.skill-name {
    color: var(--text);
    font-weight: var(--weight-semibold);
}

.skill-category {
    display: block;

    margin-top: 4px;

    color: var(--text-muted);

    font-size: var(--text-xs);
}

.skill-level {
    display: inline-block;

    margin-top: 10px;
    padding: 3px 8px;

    color: var(--purple-light);

    background: rgba(
        139,
        92,
        246,
        .1
    );

    border-radius: var(--radius-full);

    font-size: 11px;
}


/* =========================================================
   PROJECTS
========================================================= */

.project-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);

    gap: var(--space-5);
}

.project-card {
    display: flex;
    flex-direction: column;

    min-width: 0;

    padding: var(--space-6);

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    transition:
        transform var(--transition),
        border-color var(--transition),
        background var(--transition),
        box-shadow var(--transition);
}

.project-card:hover {
    transform: translateY(-5px);

    background: var(--surface-2);

    border-color: rgba(
        139,
        92,
        246,
        .4
    );

    box-shadow: var(--shadow-md);
}

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

    margin-bottom: var(--space-5);
}

.project-icon {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: var(--purple-light);

    background: rgba(
        139,
        92,
        246,
        .1
    );

    border: 1px solid rgba(
        139,
        92,
        246,
        .18
    );

    border-radius: var(--radius-md);

    font-family: var(--font-mono);
    font-weight: var(--weight-bold);
}

.project-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-links a {
    color: var(--text-muted);

    font-family: var(--font-mono);
    font-size: var(--text-xs);

    transition: color var(--transition-fast);
}

.project-links a:hover {
    color: var(--purple-light);
}

.project-card h3 {
    margin-bottom: var(--space-3);

    font-size: var(--text-lg);
}

.project-card p {
    flex: 1;

    margin-bottom: var(--space-5);

    color: var(--text-muted);

    font-size: var(--text-sm);
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.project-tag {
    padding: 4px 8px;

    color: var(--text-secondary);

    background: var(--bg);

    border: 1px solid var(--border);
    border-radius: var(--radius-full);

    font-size: 11px;
}


/* =========================================================
   PROJECT CONTROLS
========================================================= */

.project-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    margin-bottom: var(--space-8);
}

.project-search {
    flex: 1;
    max-width: 500px;
}

.project-search input,
.project-sort select {
    width: 100%;
    height: 44px;

    padding: 0 14px;

    color: var(--text);

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    outline: none;

    font-family: var(--font-family);

    transition:
        border-color var(--transition-fast),
        background var(--transition-fast);
}

.project-search input::placeholder {
    color: var(--text-muted);
}

.project-search input:focus,
.project-sort select:focus {
    border-color: var(--purple);
}

.project-sort {
    width: 180px;
}

.project-sort select {
    cursor: pointer;
}


/* =========================================================
   GITHUB STATUS
========================================================= */

.github-status {
    margin-top: var(--space-8);

    color: var(--text-muted);

    font-size: var(--text-sm);
    text-align: center;
}


/* =========================================================
   ARTICLES
========================================================= */

.article-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);

    gap: var(--space-5);
}

.article-card {
    display: flex;
    flex-direction: column;

    padding: var(--space-6);

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    transition:
        transform var(--transition),
        background var(--transition),
        border-color var(--transition);
}

.article-card:hover {
    transform: translateY(-4px);

    background: var(--surface-2);

    border-color: rgba(
        139,
        92,
        246,
        .35
    );
}

.article-date {
    margin-bottom: var(--space-4);

    color: var(--purple-light);

    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

.article-card h3 {
    margin-bottom: var(--space-3);

    font-size: var(--text-lg);
}

.article-card p {
    flex: 1;

    margin-bottom: var(--space-5);

    color: var(--text-muted);

    font-size: var(--text-sm);
}

.article-read {
    color: var(--purple-light);

    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}


/* =========================================================
   TESTIMONIALS
========================================================= */

.testimonial-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);

    gap: var(--space-5);
}

.testimonial-card {
    padding: var(--space-6);

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.testimonial-quote {
    margin-bottom: var(--space-6);

    color: var(--purple-light);

    font-family: Georgia, serif;
    font-size: 42px;
    line-height: 1;
}

.testimonial-text {
    margin-bottom: var(--space-6);

    color: var(--text-secondary);
}

.testimonial-author {
    display: flex;
    align-items: center;
    gap: 12px;
}

.testimonial-avatar {
    width: 40px;
    height: 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: var(--purple-light);

    background: var(--surface-2);

    border-radius: 50%;

    font-family: var(--font-mono);
    font-weight: var(--weight-bold);
}

.testimonial-author strong {
    display: block;

    font-size: var(--text-sm);
}

.testimonial-author small {
    color: var(--text-muted);
}


/* =========================================================
   CTA
========================================================= */

.cta {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: var(--space-8);

    padding: var(--space-10);

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-xl);

    overflow: hidden;
}

.cta::after {
    content: "";

    position: absolute;

    width: 260px;
    height: 260px;

    right: -120px;
    bottom: -140px;

    background: var(--purple);

    opacity: .08;

    filter: blur(50px);

    border-radius: 50%;
}

.cta h2 {
    margin-bottom: var(--space-3);

    font-size: var(--text-2xl);
}

.cta p {
    max-width: 650px;

    color: var(--text-muted);
}


/* =========================================================
   PAGE HERO
========================================================= */

.page-hero {
    padding: var(--space-16) 0 var(--space-12);

    border-bottom: 1px solid var(--border);
}

.page-hero h1 {
    margin-bottom: var(--space-4);

    font-size: clamp(
        36px,
        6vw,
        56px
    );

    line-height: 1.15;
}

.page-hero p {
    max-width: 700px;

    color: var(--text-muted);

    font-size: var(--text-lg);
}


/* =========================================================
   CONTACT
========================================================= */

.contact-grid {
    display: grid;
    grid-template-columns: .8fr 1.2fr;

    gap: var(--space-10);

    align-items: start;
}

.contact-info h2 {
    margin-bottom: var(--space-4);

    font-size: var(--text-2xl);
    line-height: 1.3;
}

.contact-info > p {
    margin-bottom: var(--space-8);

    color: var(--text-muted);
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 14px;

    padding: 14px;

    margin-bottom: 10px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    transition:
        background var(--transition-fast),
        border-color var(--transition-fast),
        transform var(--transition-fast);
}

.contact-item:hover {
    background: var(--surface-2);

    border-color: rgba(
        139,
        92,
        246,
        .35
    );

    transform: translateX(3px);
}

.contact-icon {
    width: 42px;
    height: 42px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    color: var(--purple-light);

    background: rgba(
        139,
        92,
        246,
        .1
    );

    border-radius: var(--radius-sm);

    font-family: var(--font-mono);
    font-weight: var(--weight-bold);
}

.contact-item strong {
    display: block;

    color: var(--text);

    font-size: var(--text-sm);
}

.contact-item small {
    display: block;

    margin-top: 2px;

    color: var(--text-muted);

    font-size: var(--text-xs);
}

.contact-form-wrapper {
    padding: var(--space-8);

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: var(--text-secondary);

    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.form-group input,
.form-group textarea {
    width: 100%;

    padding: 12px 14px;

    color: var(--text);

    background: var(--bg);

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    outline: none;

    font-family: var(--font-family);
    font-size: var(--text-sm);

    transition:
        border-color var(--transition-fast),
        background var(--transition-fast),
        box-shadow var(--transition-fast);
}

.form-group input {
    height: 46px;
}

.form-group textarea {
    min-height: 140px;

    resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--purple);

    box-shadow:
        0 0 0 3px rgba(
            139,
            92,
            246,
            .1
        );
}

.form-notice {
    min-height: 20px;

    color: var(--text-muted);

    font-size: var(--text-xs);
}


/* =========================================================
   404
========================================================= */

.error-page {
    min-height: calc(
        100vh - var(--navbar-height) - 90px
    );

    display: flex;
    align-items: center;

    padding: var(--space-16) 0;
}

.error-content {
    max-width: 760px;

    margin-inline: auto;

    text-align: center;
}

.error-code {
    margin-bottom: var(--space-4);

    color: var(--purple-light);

    font-family: var(--font-mono);

    font-size: clamp(
        100px,
        20vw,
        220px
    );

    font-weight: var(--weight-extrabold);

    line-height: .9;

    letter-spacing: -8px;

    opacity: .15;
}

.error-content .section-label {
    justify-content: center;
}

.error-content h1 {
    margin-bottom: var(--space-4);

    font-size: clamp(
        30px,
        5vw,
        48px
    );

    line-height: 1.2;
}

.error-content p {
    max-width: 620px;

    margin: 0 auto var(--space-8);

    color: var(--text-muted);
}


/* =========================================================
   FOOTER
========================================================= */

.footer {
    margin-top: var(--space-16);

    border-top: 1px solid var(--border);

    background: var(--surface);
}

.footer-inner {
    min-height: 120px;

    display: grid;
    grid-template-columns: 1fr auto 1fr;

    align-items: center;

    gap: var(--space-6);
}

.footer p {
    margin-top: 5px;

    color: var(--text-muted);

    font-size: var(--text-xs);
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 18px;
}

.footer-links a {
    color: var(--text-muted);

    font-size: var(--text-sm);

    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--purple-light);
}

.footer-copy {
    color: var(--text-muted);

    font-family: var(--font-mono);
    font-size: 11px;

    text-align: end;
}


/* =========================================================
   SEARCH OVERLAY
========================================================= */

.search-overlay {
    position: fixed;

    inset: 0;

    z-index: 9999;

    display: flex;
    align-items: flex-start;
    justify-content: center;

    padding: 12vh 20px;

    background: rgba(
        3,
        8,
        18,
        .72
    );

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity var(--transition),
        visibility var(--transition);
}

.search-overlay.open {
    opacity: 1;
    visibility: visible;
}

.search-box {
    width: min(
        100%,
        680px
    );

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-xl);

    box-shadow: var(--shadow-lg);

    overflow: hidden;
}

.search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 16px 18px;

    border-bottom: 1px solid var(--border);
}

.search-header strong {
    font-size: var(--text-sm);
}

.search-header button {
    width: 32px;
    height: 32px;

    color: var(--text-muted);

    background: transparent;

    border: 0;

    cursor: pointer;

    font-size: 22px;
}

.search-input {
    width: 100%;

    height: 54px;

    padding: 0 18px;

    color: var(--text);

    background: transparent;

    border: 0;
    outline: 0;

    font-family: var(--font-family);
    font-size: var(--text-md);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-results {
    max-height: 55vh;

    overflow-y: auto;
}

.search-result {
    display: block;

    padding: 14px 18px;

    border-top: 1px solid var(--border);

    transition: background var(--transition-fast);
}

.search-result:hover {
    background: var(--surface-2);
}

.search-result strong {
    display: block;

    color: var(--text);

    font-size: var(--text-sm);
}

.search-result span {
    display: block;

    margin-top: 3px;

    color: var(--text-muted);

    font-size: var(--text-xs);
}


/* =========================================================
   EMPTY / LOADING STATES
========================================================= */

.loading,
.empty-state {
    grid-column: 1 / -1;

    padding: var(--space-12);

    color: var(--text-muted);

    text-align: center;
}

.empty-state strong {
    display: block;

    margin-bottom: 6px;

    color: var(--text);
}


/* =========================================================
   UTILITY
========================================================= */

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

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

.mt-4 {
    margin-top: var(--space-4);
}

.mt-8 {
    margin-top: var(--space-8);
}

.mb-4 {
    margin-bottom: var(--space-4);
}

.mb-8 {
    margin-bottom: var(--space-8);
}


/* =========================================================
   RTL
========================================================= */

html[dir="rtl"] body {
    text-align: right;
}

html[dir="rtl"] .contact-item:hover {
    transform: translateX(-3px);
}

html[dir="rtl"] .footer-copy {
    text-align: start;
}

html[dir="rtl"] .quick-stat + .quick-stat {
    border-inline-start: 1px solid var(--border);
}


/* =========================================================
   CODE STYLE
========================================================= */

.code-text {
    font-family: var(--font-mono);
    color: var(--purple-light);
}


/* =========================================================
   ACCESSIBILITY
========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }

}