/* ============================================================
   PORTFOLIO — Amir Benyahia  ·  v3  ·  Minimal / Editorial
   ============================================================ */

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

/* -- Tokens ------------------------------------------------- */
:root {
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --max-w: 720px;
    --radius: 10px;
    --radius-sm: 6px;
    --ease: 0.22s ease;
}

/* Dark */
[data-theme="dark"] {
    --bg: #101014;
    --bg-alt: #18181e;
    --card: #1c1c24;
    --border: #27272f;
    --tx: #e4e4e8;
    --tx2: #8b8b9e;
    --tx3: #56566a;
    --accent: #4f8ff7;
    --nav-bg: rgba(16, 16, 20, .88);
}

/* Light */
[data-theme="light"] {
    --bg: #fafafa;
    --bg-alt: #f2f2f5;
    --card: #ffffff;
    --border: #e2e2e8;
    --tx: #1a1a22;
    --tx2: #555568;
    --tx3: #8888a0;
    --accent: #2563eb;
    --nav-bg: rgba(250, 250, 250, .88);
}

/* -- Base --------------------------------------------------- */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 72px;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--tx);
    line-height: 1.65;
    overflow-x: hidden;
    transition: background var(--ease), color var(--ease);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

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

/* -- Reveal ------------------------------------------------- */
.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .55s ease, transform .55s ease;
}

.reveal.active {
    opacity: 1;
    transform: none;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 28px;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color var(--ease), box-shadow var(--ease);
}

.navbar.scrolled {
    border-bottom-color: var(--border);
    box-shadow: 0 1px 8px rgba(0, 0, 0, .08);
}

.nav-logo {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -.03em;
}

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

.nav-links {
    display: flex;
    list-style: none;
    gap: 2px;
}

.nav-link {
    padding: 6px 14px;
    font-size: .84rem;
    font-weight: 500;
    color: var(--tx2);
    border-radius: var(--radius-sm);
    transition: color var(--ease), background var(--ease);
}

.nav-link:hover,
.nav-link.active {
    color: var(--tx);
    background: var(--bg-alt);
}

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

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 34px;
    height: 34px;
    cursor: pointer;
    color: var(--tx2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--ease);
}

.theme-toggle:hover {
    border-color: var(--tx3);
    color: var(--tx);
}

[data-theme="dark"] .icon-sun {
    display: block;
}

[data-theme="dark"] .icon-moon {
    display: none;
}

[data-theme="light"] .icon-sun {
    display: none;
}

[data-theme="light"] .icon-moon {
    display: block;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.hamburger span {
    width: 20px;
    height: 2px;
    background: var(--tx);
    border-radius: 2px;
    transition: all var(--ease);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 20px 80px;
}

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

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 14px;
    border-radius: 50px;
    border: 1px solid var(--border);
    font-size: .78rem;
    font-weight: 600;
    color: var(--tx2);
    margin-bottom: 32px;
}

.hero-badge .badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .35
    }
}

.hero-name {
    font-size: clamp(2.4rem, 6vw, 3.4rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -.04em;
    margin-bottom: 16px;
}

.hero-description {
    font-size: .98rem;
    color: var(--tx2);
    line-height: 1.7;
    margin-bottom: 32px;
}

.hero-cta {
    display: flex;
    gap: 10px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

/* -- Buttons ------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .88rem;
    font-family: var(--font);
    cursor: pointer;
    border: none;
    transition: all var(--ease);
}

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

.btn-primary:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
}

.btn-outline {
    background: none;
    color: var(--tx);
    border: 1.5px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--tx3);
}

.btn-cv {
    background: none;
    color: var(--tx2);
    border: 1.5px solid var(--border);
}

.btn-cv:hover {
    border-color: var(--tx3);
    color: var(--tx);
}

/* -- Socials ------------------------------------------------ */
.hero-socials {
    display: flex;
    gap: 14px;
}

.hero-socials a {
    color: var(--tx3);
    transition: color var(--ease);
}

.hero-socials a:hover {
    color: var(--tx);
}

/* -- Scroll indicator --------------------------------------- */
.scroll-indicator {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--tx3);
    font-size: .7rem;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    animation: float 3s ease-in-out infinite;
}

.mouse {
    width: 20px;
    height: 32px;
    border: 2px solid var(--tx3);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    padding-top: 5px;
}

.mouse-wheel {
    width: 2px;
    height: 6px;
    border-radius: 2px;
    background: var(--tx3);
    animation: scroll-wheel 2s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateX(-50%) translateY(0)
    }

    50% {
        transform: translateX(-50%) translateY(-5px)
    }
}

@keyframes scroll-wheel {
    0% {
        opacity: 1;
        transform: translateY(0)
    }

    100% {
        opacity: 0;
        transform: translateY(6px)
    }
}

/* ============================================================
   SECTION SHARED
   ============================================================ */
.section {
    padding: 88px 0;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: 6px;
}

.section-subtitle {
    color: var(--tx2);
    font-size: .92rem;
    margin-bottom: 40px;
}

.section-alt {
    background: var(--bg-alt);
}

/* ============================================================
   ABOUT
   ============================================================ */
.about-grid {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 32px;
    align-items: start;
}

.avatar-frame {
    width: 100px;
    height: 100px;
    position: relative;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg-alt);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
}

.avatar-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--accent);
    animation: spin 6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.about-text p {
    color: var(--tx2);
    font-size: .93rem;
    line-height: 1.75;
    margin-bottom: 14px;
}

.about-text strong {
    color: var(--tx);
    font-weight: 600;
}

.about-langs {
    display: flex;
    gap: 8px;
    margin: 12px 0 20px;
    flex-wrap: wrap;
}

.lang-tag {
    padding: 4px 12px;
    border-radius: 50px;
    font-size: .78rem;
    font-weight: 500;
    color: var(--tx2);
    background: var(--bg-alt);
    border: 1px solid var(--border);
}

.about-stats {
    display: flex;
    gap: 12px;
}

.stat-card {
    flex: 1;
    text-align: center;
    padding: 14px 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: transform var(--ease);
}

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

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
}

.stat-label {
    display: block;
    font-size: .72rem;
    color: var(--tx3);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: 2px;
}

/* ============================================================
   SKILLS
   ============================================================ */
.skills-categories {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.skill-category {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: border-color var(--ease);
}

.skill-category:hover {
    border-color: var(--tx3);
}

.skill-category-title {
    font-size: .74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--accent);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.skill-category-title svg {
    width: 15px;
    height: 15px;
}

.skill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.skill-tag {
    padding: 5px 12px;
    border-radius: 50px;
    font-size: .8rem;
    font-weight: 500;
    color: var(--tx);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    transition: border-color var(--ease);
}

.skill-tag:hover {
    border-color: var(--tx3);
}

/* ============================================================
   TIMELINE  (Formation + Expérience)
   ============================================================ */
.formation-timeline {
    position: relative;
    padding-left: 28px;
    max-width: 600px;
}

.formation-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 28px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -28px;
    top: 6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--bg);
    z-index: 1;
}

.section-alt .timeline-dot {
    border-color: var(--bg-alt);
}

.timeline-content {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    transition: border-color var(--ease), transform var(--ease);
}

.timeline-content:hover {
    border-color: var(--tx3);
    transform: translateX(3px);
}

.timeline-date {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    color: var(--accent);
    background: none;
    padding: 0;
    margin-bottom: 6px;
}

.timeline-content h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.timeline-institution {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .82rem;
    color: var(--tx3);
    font-weight: 500;
    margin-bottom: 8px;
}

.timeline-institution svg {
    color: var(--accent);
    flex-shrink: 0;
}

.timeline-content p:last-of-type,
.timeline-content ul {
    color: var(--tx2);
    font-size: .88rem;
    line-height: 1.7;
    margin: 0;
}

.timeline-content ul {
    list-style: none;
    padding: 0;
}

.timeline-content ul li {
    padding-left: 14px;
    position: relative;
    margin-bottom: 3px;
}

.timeline-content ul li::before {
    content: '–';
    position: absolute;
    left: 0;
    color: var(--tx3);
}

.timeline-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.timeline-tech span {
    font-size: .72rem;
    padding: 2px 9px;
    border-radius: 50px;
    border: 1px solid var(--border);
    color: var(--tx2);
    font-weight: 500;
}

/* ============================================================
   PROJECTS
   ============================================================ */
.projects-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.project-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    flex-direction: column;
    transition: border-color var(--ease), transform var(--ease);
    opacity: 0;
    transform: translateY(12px);
    animation: fadeUp .45s forwards;
}

.project-card:nth-child(1) {
    animation-delay: 0s
}

.project-card:nth-child(2) {
    animation-delay: .06s
}

.project-card:nth-child(3) {
    animation-delay: .12s
}

.project-card:nth-child(4) {
    animation-delay: .18s
}

.project-card:nth-child(5) {
    animation-delay: .24s
}

.project-card:nth-child(6) {
    animation-delay: .3s
}

.project-card:nth-child(7) {
    animation-delay: .36s
}

.project-card:nth-child(8) {
    animation-delay: .42s
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: none;
    }
}

.project-card:hover {
    border-color: var(--tx3);
    transform: translateY(-2px);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.project-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

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

.project-links a {
    color: var(--tx3);
    transition: color var(--ease);
}

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

.project-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.project-description {
    color: var(--tx2);
    font-size: .86rem;
    margin-bottom: 14px;
    flex-grow: 1;
    line-height: 1.65;
}

.project-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.project-lang {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: .76rem;
    color: var(--tx3);
    font-weight: 500;
}

.lang-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.project-stat {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: .76rem;
    color: var(--tx3);
}

/* Loader / skeleton */
.projects-loader {
    grid-column: 1/-1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px;
    color: var(--tx3);
}

.loader-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.skeleton-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton {
    border-radius: 4px;
    background: linear-gradient(90deg, var(--bg-alt) 25%, var(--border) 50%, var(--bg-alt) 75%);
    background-size: 200% 100%;
    animation: skel 1.4s ease-in-out infinite;
}

.skeleton-header {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
}

.skeleton-title {
    width: 60%;
    height: 16px;
}

.skeleton-text {
    width: 100%;
    height: 12px;
}

.skeleton-text.short {
    width: 70%;
}

.skeleton-meta {
    width: 40%;
    height: 12px;
    margin-top: 4px;
}

@keyframes skel {
    0% {
        background-position: 200% 0
    }

    100% {
        background-position: -200% 0
    }
}

/* Filters */
.project-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 16px;
    border-radius: 50px;
    border: 1px solid var(--border);
    background: none;
    color: var(--tx2);
    font-family: var(--font);
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--ease);
}

.filter-btn:hover {
    border-color: var(--tx3);
    color: var(--tx);
}

.filter-btn.active {
    background: var(--tx);
    color: var(--bg);
    border-color: var(--tx);
}

.project-card.filter-hidden {
    display: none;
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 28px;
    align-items: start;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--card);
    border: 1px solid var(--border);
    margin-bottom: 10px;
    transition: border-color var(--ease);
}

.contact-card:hover {
    border-color: var(--tx3);
}

.contact-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: var(--radius-sm);
    background: var(--bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.contact-card h3 {
    font-size: .78rem;
    font-weight: 600;
    margin-bottom: 1px;
}

.contact-card a,
.contact-card p {
    font-size: .84rem;
    color: var(--tx2);
}

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

.contact-form {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-group {
    position: relative;
    margin-bottom: 14px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--tx);
    font-family: var(--font);
    font-size: .9rem;
    transition: border-color var(--ease);
    outline: none;
}

.form-group textarea {
    resize: vertical;
    min-height: 110px;
}

.form-group label {
    position: absolute;
    left: 14px;
    top: 12px;
    color: var(--tx3);
    font-size: .88rem;
    pointer-events: none;
    transition: all var(--ease);
}

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

.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: -7px;
    left: 10px;
    font-size: .7rem;
    color: var(--accent);
    background: var(--card);
    padding: 0 5px;
    font-weight: 600;
}

.btn-submit {
    width: 100%;
    justify-content: center;
    padding: 12px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-logo {
    font-size: 1.1rem;
}

.footer-content p {
    color: var(--tx3);
    font-size: .78rem;
}

.footer-links {
    display: flex;
    gap: 10px;
}

.footer-links a {
    color: var(--tx3);
    transition: color var(--ease);
}

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

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media(max-width:768px) {
    .hamburger {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 240px;
        height: 100vh;
        background: var(--bg);
        flex-direction: column;
        padding: 80px 24px 24px;
        border-left: 1px solid var(--border);
        transition: right var(--ease);
        gap: 0;
    }

    .nav-links.open {
        right: 0;
    }

    .nav-link {
        padding: 10px 14px;
        font-size: .92rem;
    }

    .navbar {
        padding: 10px 16px;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        text-align: center;
    }

    .about-avatar {
        display: flex;
        justify-content: center;
    }

    .about-langs {
        justify-content: center;
    }

    .about-stats {
        flex-direction: column;
        gap: 8px;
    }

    .skills-categories {
        grid-template-columns: 1fr;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

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

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

    .hero-name {
        font-size: clamp(2rem, 9vw, 3rem);
    }

    .footer-content {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .section {
        padding: 60px 0;
    }

    .formation-timeline {
        padding-left: 24px;
    }

    .timeline-dot {
        left: -24px;
        width: 14px;
        height: 14px;
    }

    .formation-timeline::before {
        left: 6px;
    }
}

@media(max-width:480px) {
    .hero {
        padding: 100px 16px 60px;
    }

    .project-card {
        padding: 18px;
    }

    .contact-form {
        padding: 18px;
    }

    .skill-category {
        padding: 16px;
    }
}

/* -- GitHub language colors --------------------------------- */
.lang-javascript {
    background-color: #f1e05a
}

.lang-typescript {
    background-color: #3178c6
}

.lang-python {
    background-color: #3572A5
}

.lang-html {
    background-color: #e34c26
}

.lang-css {
    background-color: #563d7c
}

.lang-default {
    background-color: #4f8ff7
}