@import url(./reset.css);

/* Main color variables */
:root {
    --font-family: 'Open Sans', sans-serif;
    --border-radius: 20px;

    --color-white: white;
    --color-black: black;
    --transparent: transparent;
    --color-hover: aqua;
    --color-primary: #7595e6;
    --color-secondary: #162757;
    --social-media: invert(100%) sepia(100%) saturate(1%) hue-rotate(196deg) brightness(107%) contrast(102%);
    --social-media-hover: invert(90%) sepia(89%) saturate(5893%) hue-rotate(100deg) brightness(106%) contrast(101%);
}

:root[theme="light"]{
    --principal-page-color: linear-gradient(to right, #273c75, #7595e6);
    --second-page-color: var(--color-white);
    --second-paragraph: var(--color-black);
}

:root[theme="dark"]{
    --principal-page-color: linear-gradient(to right, #000000, #273c75);
    --second-page-color: #101010;
    --second-paragraph: var(--color-white);
}

/* @media (prefers-color-scheme: dark) {
    :root[theme] {
        color: yellow;
    }
} */

/* HTML */
html {
    scroll-behavior: smooth;
    background-color: var(--second-page-color);
}

/* BODY */
body {
    min-width: 296px;
    width: 100%;
}

/* HEAD */
.header-container {
    position: fixed;
    width: 100%;
    top: 0;
    padding-block: 3vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

@media screen and (max-width: 767px) {
    #menu:checked ~ .header-container {
        background: var(--color-primary);
        padding-block: 3vh;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        z-index: 100;
        width: 80%;
        max-height: 100vh;
        top: 10%;
        right: 10%;
    }

    #menu:not(:checked) ~ .header-container, 
    .header-container {
        right: 100%;
    }
}

#menu {
    position: fixed;
}

.menu_mobile-color {
    background: var(--color-primary);
    border-radius: var(--border-radius);
    color: var(--color-white);
    position: fixed;
    padding: 1vh;
    margin: 1vh 0 0 1vh;
    z-index: 100;
    font-size: 30px;
    cursor: pointer;
}

.options {
    text-align: left;
    margin: 0 auto 0 5%;
}

.center-toggle {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

.dark-mode-label {
    margin: 0 10px;
    color: var(--color-white);
}

@media screen and (max-width: 767px) {
    .options {
        text-align: center;
        margin: 0;
        padding: 0;
    }

    .languages, 
    .dark-mode-label {
        margin: 3vh 0 0 0;
        padding: auto;
    }
}

.options .languages, .options .center-toggle, 
li:has(.nav__link) {
    display: inline-block;
}

@media screen and (max-width: 767px) {
    .options .languages, .options .center-toggle, 
    li:has(.nav__link) {
        display: flex;
        flex-direction: column;
    }
}

#toggle:checked + .switch {
    background: var(--color-primary);
}

@media screen and (max-width: 767px) {
    #toggle:checked + .switch {
        background: var(--color-secondary);
    }
}

#toggle:checked + .switch::after {
    left: unset;
    right: 2.5px;
}

.offscreen {
    position: absolute;
    left: -9999px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    margin: 0 0 -4px 0;
    background-color: rgb(117, 117, 117);
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: all .5s ease;
}

.switch:hover{
    background-color: rgb(94, 94, 94);
}

.switch::after {
    content: "";
    position: absolute;
    width: 15px;
    height: 15px;
    background-color: white;
    top: 2.5px;
    left: 2.5px;
    right: unset;
    border-radius: var(--border-radius);
    transition: all .5s ease;
    box-shadow: 0 0 2px 2px  rgb(0, 0, 0, .2);
}

.nav {
    text-align: right;
    margin: auto 5% auto auto;
    clear: both;
}

@media screen and (max-width: 767px) {
    .nav {
        text-align: center;
        margin: 0;
    }
    
    .nav__link {
        margin: 3vh 0 0 0;
    }
}

.nav__link {
    text-decoration: none;
    color: var(--color-white);
    border-radius: var(--border-radius);
    margin-right: 20px;
    padding: 1vh;
    transition: background-color 0.5s ease-in, 
    color 0.3s ease-in;
}

.nav__link:hover {
    color: var(--color-secondary);
    background-color: var(--color-white);
}

.nav__link:active {
    color: var(--color-primary)
}

/* Sections */
.section {
    min-height: 100vh;
    height: fit-content;
    border: 0 solid var(--transparent);
}

/* Utils */
h1, h2, h4 {
    display: block;
    padding: 10px;
}

.main-back {
    background: var(--principal-page-color);
}

.center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.paragraph {
    margin: 50px 0;
    line-height: 30px;
    max-width: 460px;
    text-wrap: pretty;
}

.for-nav-down {
    margin-top: 15vh;
}

/* Home */
#Home {
    display: grid;
    gap: 0;
}

.div-next-to-img {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Horizontal */
@media screen and (min-width: 1024px) {
    #Home {
        grid-template-columns: 50% 50%;
    }
    .div-next-to-img {
        margin: auto 0 auto 5%;
    }
}

/* Vertical */
@media screen and (max-width: 1023px) {
    #Home {
        grid-template-rows: 50vh 30vh;
    }

    #Home > :nth-child(1) {
        grid-row: 2;
    }
    
    #Home > :nth-child(2) {
        grid-row: 1;
    }
    
    .div-next-to-img {
        margin: auto auto auto 5%;
    }
}

/* About */
#About {
    display: grid;
    gap: 0;
}

/* Horizontal  */
@media screen and (min-width: 1024px) {
    #About {
        grid-template-columns: 50% 50%;
        width: 80%;
        margin: 0 auto;
    }
}

/* Vertical  */
@media screen and (max-width: 1023px) {
    #About {
        margin: 10px auto;
    }
    
    .about-vertical {
        margin: auto 20px;
    }
}

@media screen and (min-width: 768px) and (max-width: 1023px) {
    #About {
        grid-template-rows: 50vh 50vh 5vh;
    }
}

@media screen and (min-width: 298px) and (max-width: 767px) {
    #About {
        grid-template-rows: 50vh 50vh 30vh;
    }
}

@media screen and (max-width: 297px) {
    #About {
        grid-template-rows: 30vh 50vh 80vh;
    }
}

/* Skills and Certificates */
.certificates, .certificates h2 {
    padding-bottom: 50px;
}

.certificates a {
    margin: 20px;
}

@media screen and (max-width: 287px) {
    #Skills .paragraph {
        margin: 50px 20px;
    }
}

#cButtonSNPP, #cButtonPS {
    margin-top: 20px;
}

#cButtonSNPP1, #cButtonSNPP2, #cButtonSNPP3, #cButtonSNPP4,
#cButtonPS1, #cButtonPS2, #cButtonPS3, #cButtonPS4,
#cButtonPS5, #cButtonPS6, #cButtonPS7, #cButtonPS8 {
    margin-bottom: 20px;
}

form {
    display: flex;
    flex-direction: column;
    border: 0px;
}

form #buttonClose, #buttonClose2 {
    background-color: #e67575;
}

dialog { /*PASO 2. AL CERRARLO*/
    border: 0px;
    background-color: var(--second-page-color);
    transition: scale .3s ease, display .3s ease allow-discrete;
    scale: 0;
    &[open]{ /*PASO 1. AL ABRIRLO*/
        scale: 1;
        transition: scale .3s ease-in-out, opacity .3s ease,
        translate 1s ease;
        translate: 0px 0px;

        @starting-style { /*PASO 0. ESTADO INICIAL*/
            scale: 0;
            translate: 0px 100px;
        }
    }
}

/* Projects */
#Projects {
    display: flex;
    flex-direction: column;
}

#projects {
    margin-bottom: 50px;
}

.project-box {
    min-width: 350px;
    width: 35%;
    height: fit-content;
    padding: 2vh;
    margin: 0 auto 25px auto;
    border: 0 solid var(--transparent);
    border-radius: var(--border-radius);
    background: var(--principal-page-color);
}

.project-box.last {
    margin-bottom: 100px;
}

.label {
    color: var(--color-secondary);
    background-color: gainsboro;
    margin: 10px 10px 10px 0;
    padding: 1vh;
    border-radius: var(--border-radius);
    border: 0 solid var(--transparent);
}

.project-languages, .project-buttons {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
}

.project-buttons {
    margin-top: 60px;
}

.project-buttons a {
    margin: 0 10px 0 0;
}

.disabled,
.disabled:active,
.disabled:hover {
    color: var(--color-black);
    background-color: var(--color-secondary);
}

/* Contact */
#Contact {
    display: grid;
}

/* Horizontal  */
@media screen and (min-width: 1024px) {
    #Contact {
        grid-template-columns: 40% 60%;
        grid-template-rows: 80vh 20vh;
        gap: 0;
    }

    .third {
        grid-column: span 2;
    }

    .div-next-to-img-contact {
        text-align: right;
        align-items: center;
        justify-content:right;
    }

    .div-next-to-img-contact h2 {
        margin-top: 5vh;
    }
}

/* Vertical */
@media screen and (max-width: 1023px) {
    #Contact {
        grid-template-rows: 50vh 40vh 10vh;
        grid-template-columns: 100%;
    }

    .div-next-to-img-contact {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        margin: 0 auto;
    }

    .div-next-to-img-contact .for-nav-down {
        margin-bottom: 4vh;
    }

    .div-next-to-img-contact a:not(:last-of-type) {
        margin-bottom: 3vh;
    }
}

/* Footer */
.footer {
    padding-top: 2vh;
    padding-bottom: 10vh;
}

/* Fonts */
/* Font Family */
*, select, .nav, .dark-mode-label, button {
    font-family: var(--font-family);
}

/* Font Color  */
/* Home, Skills and Contact section */
h1, h4, .principal-paragraph, 
#Skills h2, #Contact div h2, .copyright {
    color: var(--color-white);
}

/* About and Projects section */
#About h2, #Projects h2 {
    color: var(--color-primary);
}

.second-paragraph {
    color: var(--second-paragraph);
}

/* Font Size  */
/* Horizontal and Vertical */
h1 {
    font-size: clamp(3rem, 5vw, 4rem);
}

h2, h4 {
    font-size: clamp(2rem, 2vw, 3rem);
}

.nav__link, label, p, a, select, button, .label {
    font-size: clamp(1rem, 1vw, 2rem);
}

/* Vertical, smallest presentation */
@media screen and (max-width: 297px) {
    h1 {
        font-size: clamp(2rem, 2vw, 3rem);
    }

    h2, h4 {
        font-size: clamp(1rem, 2vw, 2rem);
    }

    .nav__link, label, p, a, select, button, .label {
        font-size: clamp(1rem, 0.5vw, 1.5rem);
    }

    .copyright {
        font-size: clamp(0.8rem, 0.5vw, 1rem);
    }
}

/* Links and Buttons */
.link-contact {
    color: var(--color-white);
    transition: color 0.5s ease-in-out;
}

.link-contact:hover {
    color: var(--color-hover);
}

.link-contact:active,
.link-contact:visited {
    color: var(--color-primary);
}

button {
    color: var(--color-white);
    background-color: var(--color-primary);
    padding: 1vh;
    border-radius: var(--border-radius);
    border: 0 solid var(--transparent);
    transition: background-color 0.5s ease-in, 
    color 0.3s ease-in;
}

button:hover {
    color: var(--color-secondary);
    background-color: var(--color-hover);
}

button:active {
    color: var(--color-hover);
    background-color: var(--color-secondary);
}

/* Icons */
.icons, .nav-list {
    cursor: default;
    list-style: none;
}

.icons li {
    display: inline-block;
    margin: auto 20px;
}

@media screen and (max-width: 297px) {
    .icons li {
        margin: auto 10px;
    }
}

.social-media {
    filter: var(--social-media);
    transition: filter 0.5s ease-in;
}

.social-media:hover {
    filter: var(--social-media-hover);
}

/* Images */
/* Base */
img {
    position: relative;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: var(--border-radius);
    border: 0 solid var(--transparent);
}

/* Horizontal  */
@media screen and (min-width: 1024px) {
    .img-home {
        width: 50%;
    }

    .img-about {
        width: 50%;
        margin-top: 5vh;
    }

    .img-contact {
        width: 70%;
    }
}

/* Vertical  */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    .img-home {
        width: 29%;
    }

    .img-about {
        width: 20%;
        margin-top: 5vh;
    }

    .img-contact {
        width: 50%;
    }
}

@media screen and (max-width: 767px) {
    .img-home, .img-contact {
        width: 50%;
    }
}

@media screen and (min-width: 298px) and (max-width: 767px) {
    .img-about {
        width: 25%;
        margin-top: 5vh;
    }
}

@media screen and (max-width: 297px) {
    .img-about {
        width: 30%;
        margin-top: 2vh;
    }
}