/* ==========================================================================
   fallahiali.github.io: single stylesheet, no framework

   Structure:
     1. Design tokens (dark is the default theme, light overrides tokens)
     2. Base and typography
     3. Layout primitives
     4. Header and navigation
     5. Mobile drawer
     6. Side rails
     7. Sections: hero, about, education/experience, projects, contact
     8. Buttons
     9. Footer
    10. Utilities and accessibility
   ========================================================================== */

/* 1. Design tokens ------------------------------------------------------- */

:root {
    color-scheme: dark;

    --bg: #0a192f;
    --bg-raised: #112240;
    --bg-header: rgba(10, 25, 47, 0.85);
    --border: #233554;
    --text-1: #ccd6f6;
    --text-2: #8892b0;
    --text-3: #5f6c8c;
    --accent: #3b82f6;
    --accent-soft: rgba(59, 130, 246, 0.1);
    --shadow-card: 0 10px 30px -10px rgba(2, 12, 27, 0.7);
    --shadow-header: 0 10px 30px -10px rgba(2, 12, 27, 0.7);

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SF Mono", "Cascadia Code", "Fira Code", "JetBrains Mono",
        Consolas, "Roboto Mono", monospace;

    --fs-sm: 0.8125rem;
    --fs-base: 1rem;
    --fs-md: 1.125rem;
    --fs-lg: 1.375rem;
    --fs-xl: clamp(1.5rem, 4vw, 2rem);
    --fs-hero-sub: clamp(1.75rem, 6vw, 3.25rem);
    --fs-hero: clamp(2.5rem, 8vw, 4.5rem);

    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2.5rem;
    --space-xl: 6rem;

    --radius-sm: 6px;
    --radius-md: 12px;

    --header-h: 72px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --speed: 0.25s;
}

[data-theme="light"] {
    color-scheme: light;

    --bg: #f6f9fc;
    --bg-raised: #ffffff;
    --bg-header: rgba(246, 249, 252, 0.85);
    --border: #d8e2ef;
    --text-1: #172a45;
    --text-2: #49586d;
    --text-3: #7a8699;
    --accent: #0b63ce;
    --accent-soft: rgba(11, 99, 206, 0.08);
    --shadow-card: 0 10px 30px -12px rgba(23, 42, 69, 0.18);
    --shadow-header: 0 4px 16px -6px rgba(23, 42, 69, 0.12);
}

/* 2. Base ---------------------------------------------------------------- */

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: 1.65;
    color: var(--text-2);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background-color var(--speed) var(--ease),
        color var(--speed) var(--ease);
}

h1,
h2,
h3 {
    margin: 0;
    color: var(--text-1);
    line-height: 1.2;
}

p {
    margin: 0 0 1rem;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

svg {
    display: block;
}

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

.accent {
    color: var(--accent);
}

/* 3. Layout -------------------------------------------------------------- */

.container {
    width: min(100% - 3rem, 1100px);
    margin-inline: auto;
}

.section {
    max-width: 48rem;
    margin-inline: auto;
    padding-block: var(--space-xl);
}

.section--wide {
    max-width: 58rem;
}

.section__heading {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    font-family: var(--font-mono);
    font-size: var(--fs-lg);
    white-space: nowrap;
}

.section__heading .num {
    color: var(--accent);
    font-size: 0.9em;
}

.section__heading::after {
    content: "";
    height: 1px;
    width: 100%;
    max-width: 300px;
    background-color: var(--border);
}

/* 4. Header and navigation ------------------------------------------------ */

.site-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 40;
    height: var(--header-h);
    background-color: var(--bg-header);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: box-shadow var(--speed) var(--ease),
        background-color var(--speed) var(--ease);
}

.site-header.is-scrolled {
    box-shadow: var(--shadow-header);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.logo {
    display: block;
    width: 44px;
    height: 44px;
    color: var(--accent);
}

.logo svg {
    width: 100%;
    height: 100%;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.site-nav__link {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    color: var(--text-2);
    transition: color var(--speed) var(--ease);
}

.site-nav__link:hover,
.site-nav__link.is-active {
    color: var(--accent);
    text-decoration: none;
}

.site-nav__link .num {
    color: var(--accent);
    margin-right: 0.25em;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    transition: color var(--speed) var(--ease),
        background-color var(--speed) var(--ease);
}

.icon-button:hover {
    color: var(--accent);
    background-color: var(--accent-soft);
}

.icon-button svg {
    width: 22px;
    height: 22px;
}

/* Theme toggle shows the icon for the mode you would switch TO */
[data-theme="dark"] .theme-toggle .icon-moon,
[data-theme="light"] .theme-toggle .icon-sun {
    display: none;
}

.nav-toggle {
    display: none;
}

/* 5. Mobile drawer --------------------------------------------------------- */

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 60;
    height: 100dvh;
    width: min(75vw, 320px);
    padding: var(--space-lg) var(--space-md);
    background-color: var(--bg-raised);
    box-shadow: var(--shadow-card);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.3s var(--ease), visibility 0.3s;
}

.drawer.is-open {
    transform: translateX(0);
    visibility: visible;
}

.drawer__close {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
}

.drawer__nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.drawer__nav .site-nav__link {
    font-size: var(--fs-base);
}

.overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background-color: rgba(2, 12, 27, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s var(--ease), visibility 0.3s;
}

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

/* 6. Side rails ------------------------------------------------------------ */

.rail {
    position: fixed;
    bottom: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.rail--left {
    left: 2.5rem;
}

.rail--right {
    right: 2.5rem;
}

.rail::after {
    content: "";
    width: 1px;
    height: 90px;
    background-color: var(--text-3);
}

.rail__link {
    padding: 0.6rem;
    color: var(--text-2);
    transition: color var(--speed) var(--ease),
        transform var(--speed) var(--ease);
}

.rail__link:hover {
    color: var(--accent);
    text-decoration: none;
    transform: translateY(-4px);
}

.rail__link svg {
    width: 20px;
    height: 20px;
}

.rail__email {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    letter-spacing: 0.1em;
    writing-mode: vertical-rl;
}

/* 7. Sections -------------------------------------------------------------- */

/* Hero */

.hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 48rem;
    margin-inline: auto;
    padding-block: var(--header-h) var(--space-xl);
}

.hero__eyebrow {
    font-family: var(--font-mono);
    color: var(--accent);
    margin-bottom: var(--space-md);
}

.hero__name {
    font-size: var(--fs-hero);
    font-weight: 700;
}

.hero__tagline {
    font-size: var(--fs-hero-sub);
    font-weight: 700;
    color: var(--text-2);
    margin-top: 0.5rem;
    line-height: 1.15;
}

.hero__intro {
    max-width: 36rem;
    margin-top: var(--space-md);
    font-size: var(--fs-md);
}

/* About */

.about__body {
    font-size: var(--fs-md);
}

.skills {
    display: grid;
    grid-template-columns: repeat(2, minmax(140px, 220px));
    gap: 0.4rem 1rem;
    margin-top: var(--space-md);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
}

/* Timeline entries (education + experience) */

.entry {
    margin-bottom: var(--space-lg);
}

.entry:last-child {
    margin-bottom: 0;
}

.entry__title {
    font-size: var(--fs-lg);
    font-weight: 600;
}

.entry__title .accent {
    font-weight: 600;
}

.entry__meta {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    color: var(--text-3);
    margin: 0.35rem 0 0.85rem;
}

/* ▹ bullet lists, shared by entries and skills */

.arrow-list li,
.skills li {
    position: relative;
    padding-left: 1.4rem;
    margin-bottom: 0.5rem;
}

.arrow-list li::before,
.skills li::before {
    content: "▹";
    position: absolute;
    left: 0;
    color: var(--accent);
}

/* Projects */

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: var(--space-md);
}

.card {
    display: flex;
    flex-direction: column;
    padding: var(--space-md);
    background-color: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    transition: transform var(--speed) var(--ease),
        border-color var(--speed) var(--ease);
}

.card:hover {
    transform: translateY(-6px);
    border-color: var(--accent);
}

.card__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-sm);
}

.card__icon {
    width: 38px;
    height: 38px;
    color: var(--accent);
}

.card__links {
    display: flex;
    gap: 0.25rem;
}

.card__links a {
    padding: 0.4rem;
    color: var(--text-2);
    transition: color var(--speed) var(--ease);
}

.card__links a:hover {
    color: var(--accent);
}

.card__links svg {
    width: 20px;
    height: 20px;
}

.card__title {
    font-size: var(--fs-md);
    margin-bottom: 0.5rem;
    transition: color var(--speed) var(--ease);
}

.card:hover .card__title {
    color: var(--accent);
}

.card__desc {
    font-size: var(--fs-sm);
    flex-grow: 1;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: var(--space-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-3);
}

/* Contact */

.contact {
    text-align: center;
    max-width: 38rem;
}

.contact__eyebrow {
    font-family: var(--font-mono);
    color: var(--accent);
    margin-bottom: var(--space-xs);
}

.contact__title {
    font-size: var(--fs-xl);
    margin-bottom: var(--space-sm);
}

/* 8. Buttons ---------------------------------------------------------------- */

.btn {
    display: inline-block;
    padding: 0.8rem 1.6rem;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    color: var(--accent);
    background: transparent;
    cursor: pointer;
    transition: background-color var(--speed) var(--ease),
        transform var(--speed) var(--ease);
}

.btn:hover {
    background-color: var(--accent-soft);
    text-decoration: none;
    transform: translateY(-3px);
}

.btn--lg {
    padding: 1.1rem 2rem;
    font-size: var(--fs-base);
    margin-top: var(--space-md);
}

/* 9. Footer ------------------------------------------------------------------ */

.site-footer {
    padding: var(--space-lg) var(--space-sm);
    text-align: center;
}

.site-footer a {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    color: var(--text-3);
    transition: color var(--speed) var(--ease);
}

.site-footer a:hover {
    color: var(--accent);
    text-decoration: none;
}

/* 10. Utilities and accessibility --------------------------------------------- */

.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    z-index: 100;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    background-color: var(--accent);
    color: #fff;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
}

.skip-link:focus {
    top: 1rem;
    text-decoration: none;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.no-scroll {
    overflow: hidden;
}

::selection {
    background-color: var(--accent);
    color: var(--bg);
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
    border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-3);
}

/* Responsive ------------------------------------------------------------------ */

@media (max-width: 860px) {
    .rail {
        display: none;
    }
}

@media (max-width: 768px) {
    .site-nav {
        display: none;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .site-header__actions {
        display: flex;
        align-items: center;
        gap: var(--space-xs);
    }

    .section {
        padding-block: 4rem;
    }

    .section__heading::after {
        max-width: 120px;
    }

    .skills {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 769px) {
    .site-header__actions {
        display: flex;
        align-items: center;
        gap: var(--space-md);
    }

    .drawer,
    .overlay {
        display: none;
    }
}

/* Reduced motion: keep the site usable, drop the choreography */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Print: just the content */

@media print {
    .site-header,
    .rail,
    .drawer,
    .overlay,
    .skip-link,
    .btn {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }
}
