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

/* custom properties */

:root {
    --ff-primary: "Cairo", sans-serif;
    --ff-secondary: "Karla", serif;

    --fw-reg: 300;
    --fw-bold: 900;

    --clr-light: #eff;
    --clr-dark: #303030;
    --clr-accent: #16e0bd;

    --fs-h1: 3rem;
    --fs-h2: 2.25rem;
    --fs-h3: 1.25rem;
    --fs-body: 1rem;

    --bs: 0.25em 0.25em 0.75em #00000040, 0.125em 0.125em 0.25em #00000020;
}

@media (min-width: 768px) {
    :root {
        --fs-h1: 4.5rem;
        --fs-h2: 3.75rem;
        --fs-h3: 1.5rem;
        --fs-body: 1.125rem;
    }
}

/* general styles */
html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--clr-light);
    color: var(--clr-dark);
    font-family: var(--ff-primary);
    font-size: var(--fs-body);
    line-height: 1.6;
}

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

strong {
    font-weight: var(--fw-bold);
}

section {
    padding: 5em 2em;
}

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

/* Buttons */

.btn {
    display: inline-block;
    padding: 0.5em 2.5em;
    background-color: var(--clr-accent);
    text-decoration: none;
    cursor: pointer;
    color: var(--clr-dark);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: var(--fw-bold);
    transition: transform 200ms ease-in-out;
    border: none;
}

.btn:hover {
    transform: scale(1.2);
}

/* Typography */
h1,
h2,
h3 {
    line-height: 1.1;
    margin: 0;
}

h1 {
    font-size: var(--fs-h1);
}
h2 {
    font-size: var(--fs-h2);
}
h3 {
    font-size: var(--fs-h3);
}

.section__title {
    margin-bottom: 0.25em;
}

.section__title--intro {
    font-weight: var(--fw-reg);
}

.section__title--intro strong {
    display: block;
}

.section__subtitle {
    margin: 0;
    font-size: var(--fs-h2);
}

@media (min-width: 600px) {
    .section__title {
        align-self: flex-end;
    }

    .section__subtitle {
        font-size: var(--fs-body);
        align-self: flex-start;
    }
}

.section__subtitle--intro,
.section__subtitle--about {
    background-color: var(--clr-accent);
    font-family: var(--ff-secondary);
    margin-bottom: 1em;
    padding: 0.25em 0.5em;
    width: fit-content;
}

.section__subtitle--work {
    color: var(--clr-accent);
    font-weight: var(--fw-bold);
    margin-bottom: 2em;
}

/* GLITCH */

.glitch {
    display: none;
    position: relative;
    color: white;
    text-transform: uppercase;
}

.glitch span {
    position: absolute;
    top: 0;
    left: 0;
    color: #f00;
    clip: rect(0, 900px, 0, 0);
    animation: glitch 2s infinite;
}

.glitch span:nth-child(2) {
    color: #0ff;
    animation: glitch 2s infinite 0.2s;
}

@keyframes glitch {
    0% {
        clip: rect(0, 900px, 0, 0);
        transform: translate(0);
    }
    10% {
        clip: rect(10px, 900px, 50px, 0);
        transform: translate(-0.3em, -0.3em);
    }
    20% {
        clip: rect(30px, 900px, 80px, 0);
        transform: translate(0.3em, 0.3em);
    }
    30% {
        clip: rect(0, 900px, 0, 0);
        transform: translate(0);
    }
}

@keyframes flicker {
    0%,
    100% {
        background-color: black;
    }
    50% {
        background-color: #181818;
    }
}

.glitch__brackets {
    display: inline-block;
}

.glitch__brackets:hover .glitch {
    display: inline-block;
}

.glitch__brackets:hover {
    background: black;
    animation: flicker 1s infinite;
}

.glitch-anim {
    animation: img-glitch 0.3s cubic-bezier(.25, .46, .45, .94) infinite both;
}

@keyframes img-glitch {
    0% { transform: translate(0); filter: grayscale(0) hue-rotate(0deg); }
    20% { transform: translate(-2px, 2px); filter: grayscale(0.5) hue-rotate(45deg) contrast(120%); }
    40% { transform: translate(-2px, -2px); filter: grayscale(0.2) hue-rotate(-45deg); }
    60% { transform: translate(2px, 2px); filter: invert(0.2) hue-rotate(90deg); }
    80% { transform: translate(2px, -2px); filter: grayscale(0) hue-rotate(-90deg) contrast(120%); }
    100% { transform: translate(0); filter: grayscale(0) hue-rotate(0deg); }
}

/* 0.0782 Up button */

.up-button {
    position: fixed;
    right: 1em;
    bottom: 1em;
    border: none;
    background-color: var(--clr-accent);
    padding: 0.5em;
    border-radius: 0.25em;
    cursor: pointer;
    display: none;
}

.up-button__close {
    font-family: fontAwesome;
    content: "\f057";
    position: absolute;
    top: 0px;
    right: 0;
    transform: translate(55%, -55%);
    color: #f00;
    opacity: 0;
    transition: opacity 350ms;
}

.up-button:hover .up-button__close {
    opacity: 1;
}

/* 1.0 Header */

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1em;
    position: fixed;
    z-index: 100;
    width: 100%;
    top: 0;
}

.logo {
    max-width: 60px;
}

.nav {
    position: fixed;
    background: var(--clr-dark);
    color: var(--clr-light);
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    opacity: 0.97;

    transform: translateX(100%);
    transition: transform 250ms cubic-bezier(0.5, 0, 0.5, 1);
}

.nav__list {
    list-style: none;
    display: flex;
    height: 100%;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav__link {
    color: inherit;
    font-weight: var(--fw-bold);
    font-size: var(--fs-h2);
    text-decoration: none;
}

.nav__link:hover {
    color: var(--clr-accent);
}

.slide-toggle {
    position: absolute;
    right: 1em;
    padding: 1em 0.5em;
    height: fit-content;
    background-color: #fff;
    border-radius: 1em;
    cursor: pointer;
    z-index: 1000;
    transition: transform 250ms cubic-bezier(0.5, 0, 0.5, 1);
}

.nav-open .nav {
    transform: translateX(0);
}

.nav-open .slide-toggle {
    position: fixed;
    top: 1em;
}

.nav-open .slider {
    transform: rotate(45deg);
}

.nav-open .slider::before {
    transform: rotate(90deg) translate(-10px);
}

.nav-open .slider::after {
    display: none;
}

.slider {
    display: block;
    position: relative;
    transition: transform 250ms cubic-bezier(0.5, 0, 0.5, 1);
}

.slider,
.slider::before,
.slider::after {
    background-color: var(--clr-dark);
    width: 2em;
    height: 3px;
    border-radius: 4em;
    transition: transform 250ms ease-in-out;
}

.slider::before,
.slider::after {
    content: "";
    position: absolute;
    top: 10px;
}

.slider::after {
    top: -10px;
}

/* 2.0 Intro section */

.intro {
    min-height: 100vh;
    text-align: center;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.intro__img {
    box-shadow: var(--bs);
}

@media (min-width: 600px) {
    .intro {
        text-align: left;
        display: grid;
        align-items: center;
        width: fit-content;
        margin: 0 auto;
        gap: 0 1em;
        grid-template-areas:
            "img title"
            "img subtitle";
        grid-template-columns: min-content max-content;
    }

    .intro__img {
        grid-area: img;
        min-width: 250px;
        position: relative;
        z-index: 2;
    }

    .section__subtitle--intro {
        padding-left: 0;
        width: 100%;
        position: relative;
    }

    .section__subtitle--intro::before {
        content: "";
        height: 100%;
        width: calc(2em + 250px);
        position: absolute;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        background-color: var(--clr-accent);
    }
}

/* 3.0 my services */
/* dark sections classe */
.dark-section {
    background-color: var(--clr-dark);
    background-size: cover;
    background-blend-mode: multiply;
    color: var(--clr-light);
    text-align: center;
}
.section__title--dark {
    color: var(--clr-accent);
    position: relative;
}

.section__title--dark::after {
    content: "";
    display: block;
    height: 1px;
    margin: 0.5em auto 1em;
    background-color: var(--clr-light);
}

/* service code */

.my-services {
    background-image: url(../images/services.jpg);
}

.section__title--services::after {
    width: 2em;
}

.service {
    max-width: 500px;
    margin: 0 auto;
    margin-bottom: 3em;
}

@media (min-width: 800px) {
    .services {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 2em;
    }
}

/* 4.0 Anout me */
.about-me {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.about-me__image {
    margin-bottom: 2em;
    box-shadow: var(--bs);
    max-width: 300px;
}

.about-me span {
    display: inline-block;
}

@media (min-width: 600px) {
    .about-me {
        display: grid;
        grid-template-columns: 1fr 200px;
        grid-template-areas:
            "title img"
            "subtitle img"
            "text img";
        grid-column-gap: 2em;
        text-align: left;
        align-items: flex-start;
    }

    .section__title--about {
        grid-area: title;
    }

    .section__subtitle--about {
        grid-area: subtitle;
        width: calc(100% + 3em + 200px);
        padding-left: 0;
    }

    .about-me__body {
        grid-area: text;
    }
    .about-me__image {
        grid-area: img;
        max-width: 200px;
    }
}

/* 5.0 Technical Skills */
.tech-skills {
    background-image: url(../images/technical_skills.jpg);
}

.section__title--skills::after {
    width: 4em;
}

.tech-skills__all-rows {
    max-width: 1000px;
    margin: auto;
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.tech-skills__skills-area {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.skills {
    display: grid;
    gap: 1em;
    justify-content: center;
    grid-template-columns: repeat(auto-fit,7em);
}

.skill {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1em;
    background-color: var(--clr-accent);
    padding-block: 1em;
    border-radius: 1em;
}

.skill__icon {
    font-size: 2.5em;
    justify-self: center;
}

.skill__text {
    margin: 0;
    line-height: 1.2;
    text-align: center;
}

/* 6.0 My Work */

.my-work {
    background-color: var(--clr-light);
    color: var(--clr-dark);
    text-align: center;
}

.portfolio {
    display: grid;
    gap: 0.5em;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.portfolio__item {
    background-color: var(--clr-accent);
    border: 2px solid var(--clr-accent);
    border-radius: 0.5em;
    overflow: hidden;
    position: relative;
}

.portfolio__img {
    transition:
        transform 750ms cubic-bezier(0.5, 0, 0.5, 1),
        opacity 250ms linear;
}

.portfolio__item:focus {
    position: relative;
    z-index: 2;
}

.portfolio__img:hover,
.portfolio__item:focus .portfolio__img {
    transform: scale(1.2);
    opacity: 0.5;
}

/* 7.0 footer */

footer {
    background-color: #111;
    color: var(--clr-accent);
    text-align: center;
    padding: 2.5em 0;
}

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

.footer__link {
    font-size: var(--fs-h3);
    font-weight: var(--fw-bold);
}

.social-list__link:hover,
.footer__link:hover {
    opacity: 0.7;
}

.footer__link:hover {
    text-decoration: underline;
}

.social-list {
    list-style: none;
    display: flex;
    justify-content: center;
    margin: 2em 0 0;
    padding: 0;
    gap: 2em;
}

.social-list__link {
    padding: 0.5em;
    font-size: var(--fs-h3);
}

/* Portfolio overlay */

.portfolio__overlay {
    position: absolute;
    inset: 0;
    background-color: var(--clr-dark);
    color: var(--clr-light);
    padding: 1.5em;
    display: flex;
    flex-direction: column;
    gap: 0.75em;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 400ms cubic-bezier(0.5, 0, 0.5, 1);
    text-align: left;
    font-size: 0.85rem;
    line-height: 1.5;
    scrollbar-width: none;
}

.portfolio__overlay::-webkit-scrollbar {
    display: none; 
}

.portfolio__item:hover .portfolio__overlay,
.portfolio__item:focus .portfolio__overlay,
.portfolio__item.is-open .portfolio__overlay {
    transform: translateY(0);
}

.portfolio__project-title {
    font-size: var(--fs-h3);
    color: var(--clr-accent);
    margin: 0;
}

.portfolio__tags {
    margin: 0;
    font-size: 0.75rem;
    opacity: 0.7;
    font-family: var(--ff-secondary);
}

.portfolio__detail {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
}

.portfolio__label {
    margin: 0;
    font-weight: var(--fw-bold);
    color: var(--clr-accent);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.portfolio__detail p:last-child {
    margin: 0;
}