* { box-sizing: border-box; margin: 0; padding: 0; }

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400..700;1,400..700&display=swap');

.lora-regular {  font-family: "Lora", serif; font-optical-sizing: auto; font-weight: 400; font-style: normal;}
.lora-light {  font-family: "Lora", serif; font-optical-sizing: auto; font-weight: 300; font-style: normal;}
.lora-bold {  font-family: "Lora", serif; font-optical-sizing: auto; font-weight: 700; font-style: normal;}
.lora-italic {  font-family: "Lora", serif; font-optical-sizing: auto; font-weight: 400; font-style: italic;}

@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Lora:ital,wght@0,400..700;1,400..700&display=swap');

.lato-thin {  font-family: "Lato", sans-serif; font-weight: 100; font-style: normal;  }
.lato-light { font-family: "Lato", sans-serif; font-weight: 300; font-style: normal; }
.lato-regular { font-family: "Lato", sans-serif; font-weight: 400; font-style: normal; }
.lato-bold { font-family: "Lato", sans-serif; font-weight: 700; font-style: normal; }
.lato-black { font-family: "Lato", sans-serif; font-weight: 900; font-style: normal; }
.lato-thin-italic { font-family: "Lato", sans-serif; font-weight: 100; font-style: italic; }
.lato-light-italic { font-family: "Lato", sans-serif; font-weight: 300; font-style: italic; }
.lato-regular-italic { font-family: "Lato", sans-serif; font-weight: 400; font-style: italic; }
.lato-bold-italic { font-family: "Lato", sans-serif; font-weight: 700; font-style: italic; }
.lato-black-italic { font-family: "Lato", sans-serif; font-weight: 900; font-style: italic; }

/* https://paletton.com/#uid=63n0u0kqkeSk9mZngiOtlbbwU7K */
:root {
    --primary-color: #0F3E49; /* #062E37 */
    --primary-color-darkest: #011F26; /* #001A1F */
    --primary-color-dark: #062E37;
    --primary-color-light: #0F3E49;
    --primary-color-lightest: #2C6471;
    --secondary-color: #105923;
    --secondary-color-dark: #002E0C;
    --secondary-color-light: #1A7B3C;
    --tertiary-color: #0C163C;
    --tertiary-color-dark: #050D2A;
    --tertiary-color-light: #37467C;
    --accent-color: #764515;
    --accent-color-dark: #3E1F00;
    --accent-color-light: #B77D44;
    --accent-color-lightest: #bd844b;
    --background-color: #ffffff;
    --text-color: #000000;
    --text-color-dark: #050D2A;
    --text-color-light: #B77D44;
    --menus-color: #965F29;
}
/* Global styles */

body {  
    font-family: Lato, sans-serif;
    font-size: 16px;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    display: grid;
    grid-template-rows: repeat(200px);
}

nav, footer {color: var(--accent-color-light);}
footer {background: var(--secondary-color);}
h1, h2, h3, h4, h5, h6 {
    color: var(--primary-color);
    font-family: Lora;
}
/* p {
    
} */
a {
    color: var(--primary-color);
    text-decoration: none;
}
a:hover {
    color: var(--primary-color-light);
    text-decoration: underline;
}
/* Header styles */
header {
    display: flex;
    background-color: var(--primary-color-darkest);
    color: var(--text-color-light);
    padding: 1em;
    text-align: center;
}
header h1 {color: var(--accent-color-light); max-width: 130px; font-size: 1.5rem;}
/* Navigation styles */
nav {
    background-color: var(--primary-color);
    padding: 0.5em;  
}
nav ul {
    list-style: none;
    padding: 0; 
    /* border: red solid 1px; */
    display: flex;  
    justify-content: center;
    align-items: center;
}
/* nav ul li {
    width: 108px;
}     */
nav ul li a {
    display: block;
    text-align: center;
    color: var(--menus-color);
    border:  var(--primary-color-lightest) 1px solid;
    padding: 0.5rem 1rem;
    width: 108px;
    font-weight: bold;
    border-radius: 8px;
    margin: 8px;
}
nav ul li a:hover {
    color: var(--accent-color-lightest);
    border: var(--accent-color-lightest) 1px solid;
    text-decoration: none;
    
}
/* Main content styles */
main {
    padding: 2em;
    background-color: var(--background-color);
    /* height: 60vh; 
    border: red dotted 1px; */
    
}

#exchange {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-evenly;
}


#hero {  display: grid; grid-template-rows: repeat(2, 3rem) 10rem; margin: 0 auto; max-width: 1000px;}
/* #hero img { width: 100%; grid-row: 1/-1;} */
#hero h1, #hero p {padding: 8px 2rem; z-index: 2; grid-column: 1; background-color: var(--accent-color-lightest); }
#hero h1 { grid-row: 1; animation: typetext 5s steps(60, end) infinite forwards; white-space: nowrap; width: 0;}
#hero p { grid-row: 2;}
#hero img { z-index: 1; width: 100%; height: 100%; object-fit: cover; grid-row: 1/-1; grid-column: 1/-1;}

#heroNews {
    display: grid;
    grid-template: 50px 200px 50px / 1fr 2fr;
    width: 900px;
    margin: 1rem auto;
    border: solid var(--accent-color-light) 2px;
    border-radius: 2rem;
    padding: 2rem;
    max-height: 364px;

    p { grid-area: 1/2/2/3; padding: 0.5rem 3rem; font-size: large;}

    img {height: 300px; grid-area: 1 / 1 / -1 / 2;}

    a { width: 200px; border: solid lightgray 2px; padding: 0.8rem; font-weight: 600;
        text-align: center; justify-self: end; grid-area: 3/2/4/3; }
    a:hover { background-color: var(--accent-color-dark); color: var(--background-color)}

    h1 {
        font-family: "lato";
        /* width: 0; */
        /* white-space: nowrap; */
        padding: 1rem 2rem;
        max-height: 0;
        display: block;
        overflow: hidden;
        grid-area: 2 / 2 / 3/ 3;
    }
    h1[data-change="true"] {
        /* animation: typetext 1s steps(40, end) forwards;  */
        animation: typetext-multi 3s steps(100) forwards;
    }
}
@keyframes typetext {
    from { width: 30%; }
    to { width: 100%; }
}     

/* #heroNews h1 {
  font-family: "lato", sans-serif;
  overflow: hidden;
  display: block;
  max-height: 0;
  animation: typetext-multi 4s steps(40) forwards;
} */

@keyframes typetext-multi {
  from { max-height: 0; }
  to { max-height: 180px; } /* Ajusta según número de líneas */
}

.fade-img {
    animation: fadeCycle 9s infinite;
}

.fade-img:nth-child(1) {
  animation-delay: 0s;
}
.fade-img:nth-child(2) {
  animation-delay: 3s;
}
.fade-img:nth-child(3) {
  animation-delay: 6s;
}

@keyframes fadeCycle {
  0% { opacity: 0; }
  10% { opacity: 1; }
  30% { opacity: 1; }
  40% { opacity: 0; }
  100% { opacity: 0; }
}

.container {
    max-width: 600px;
    /* margin: 0 auto; */
    background-color: #fff;
    padding: 1rem;
    border: solid rgba(0,0,0,0.2) 1px;
    border-radius: 8px;
    box-shadow: 8px 8px 16px rgba(0,0,0,0.1);
    margin: 2rem 0;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
th, td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}
th {
    background-color: #0F3E49;
    color: white;
    font-weight: bold;
}
tr:nth-child(even) {
    background-color: #f2f2f2;
}
#alphaData { width: 500px; padding: 1rem 2rem;}
td[data-abrev] { text-align: center;}
td[data-rate] { text-align: right; }

#news_data { display: flex; flex-wrap: wrap; border: solid var(--accent-color-lightest); justify-content: space-around; margin: 2rem 0; border-radius: 1rem;}
#news {  border: #0F3E49 solid 1px; max-width: 600px; padding: 2rem;}
.news_data { margin-bottom:2rem;}

#nytimes {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 2rem;  
    
    article { max-width: 400px; display: grid; grid-template-columns: 1fr 1fr ; padding: 1rem;
            border: var(--accent-color-dark) solid 2px; border-radius: 1rem; }
    img { width: 150px; height: auto; margin-right: 1rem; }
    h2 { width: 100%; border: solid 2px; text-align: center;}
    h3 { grid-area: 1 / -1; place-self: center; font-family: "Lato", sans-serif; font-weight: 600; font-style: normal;  }
}

#newsIntro {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-evenly;
    gap: 3rem;

    article {
        text-align: center;
        border: lightgray solid 2px;
        max-width: 200px;
        display: grid;
        grid-template-columns: 1fr;
        padding: 1rem;
        margin: 1rem 0;
        border-radius: 1rem;
        p {  padding-left: 1rem; color: ligth; }
        h3 {  padding: 8px; font-family: "lora"; font-size: medium;}
        img { padding-left: 8px; max-width: 150px; height: 150px;}
        transform-style: preserve-3d;
        transition: transform 0.8s ease-in-out;


        &:hover {
            box-shadow: 8px 8px 16px rgba(0,0,0,0.1);
            border: solid 2px var(--accent-color-light);
            /* transform: rotate(360deg); */
            transform: rotateY(360deg);
        }
    }

    /* article {
        border: var(--menus-color) solid 2px;
        max-width: 350px;
        display: grid;
        grid-area: 1fr 1fr / 150px 1fr;
        padding: 1rem;
        margin: 2rem 0;
        border-radius: 1rem;
        p { grid-area: 1 / 2 / 2/ 3;  padding-left: 1rem; color: var(--accent-color-dark); }
        h3 { grid-area: 2 / 2 / 3 / 3; padding: 8px; font-family: "lora"; font-size: medium;}
        img { grid-area: 1 / 1 / 3 / 2;}
    } */
}

#newscontent {
    display: grid;
    grid-template: 50px auto 450px 1fr / 1fr;
    max-width: 700px;
    margin: 0 auto;
    img { margin: auto auto;}
}

/* Footer styles */
footer {
    text-align: center;    
    color: var(--text-color-light);
    position: relative;
    bottom: 0;
    width: 100%;
}
footer span { font-family: Lora;}
.footer_up {
    background-color: var(--tertiary-color);
    padding: 7px;
    color: var(--text-color-light);
    text-align: center;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.footer_down {
    background-color: var(--tertiary-color-dark);
    padding: 1em;
    color: var(--text-color-light);
    text-align: center;
    height: 100px;
}

#exchange-form {
    width: 432px;
    
    h2 {text-align: center;}
}
#form-exchange {
    width: 400px;

    legend { margin: 0 1.2rem; padding: 0 1rem;}
}
fieldset { margin: 1rem;}
input, label, option {
    display: block;
    margin: 0 auto;
    padding: 1rem;
    font-size: larger;
}
#currencies {
    display: flex;
    margin: 1rem;
    border: 0;
    input { width: 6rem; padding: 1rem;}
}
.inout {
    font-size: 2rem;
    text-align: right;
    width: 300px;
    margin: 2rem auto;
}

.table-slide {
  transform: translateY(30px);
  opacity: 0;
  transition: transform 0.6s ease-out, opacity 0.6s ease-out;
}

.table-slide.visible {
  transform: translateY(0);
  opacity: 1;
}

.table-fade {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.table-fade.visible {
  opacity: 1;
  transform: translateY(0);
}

.table-zoom {
  transform: scale(0.8);
  opacity: 0;
  transition: transform 5s ease, opacity 1s ease;
}

.table-zoom.visible {
  transform: scale(1);
  opacity: 1;
}


/* section animation */
.section-animate {
  opacity: 0;
  transform: translateY(200px) scale(0.8);
  transition: opacity 3s ease, transform 4s ease;
}
.section-animate.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* to animate currencies exchange */
.slide-in-right {
  opacity: 0;
  transform: translateX(200px);
  transition: transform 3s ease-out, opacity 4s ease-out;
}
.slide-in-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.slide-in-left {
  opacity: 0;
  transform: translateX(-200px);
  transition: transform 3s ease-out, opacity 4s ease-out;
}
.slide-in-left.visible {
  opacity: 1;
  transform: translateX(0);
}


@media (max-width: 450px)  {
    body {font-size: small;}

    header {
        h1 { font-size: 1.1rem; max-width: 100px;}
        img { height: 55px;} }

    main { padding: 1rem;}

    #heroNews {
        height: auto;
        display: grid;
        grid-template: 25px 200px 120px 40px / 1fr;
        max-width: 400px;
        padding: 1rem; 
        max-height: none;
        p { grid-area: 1/1/2/2; padding: 0; font-weight: 500;}
        h1 {  grid-area: 3/1/4/2; padding: 0;}
        a {  grid-area: 4/1/5/2; padding: 0.5rem 2rem 0px 2rem; justify-self: center;}
        img {  grid-area: 2/1/3/2; height:100%; width:100%; object-fit: cover; margin: 0 auto;}
    }
    #newsIntro {
        gap: 1rem;
        article { max-width: 180px;}
    }

    #newscontent { max-width: 395px;
        grid-template: 30px auto 350px 1fr / 1fr ;
        img { width: 390px;}
    }

    #exchange { justify-content:flex-start;     }
    #exchange-form { padding: 0; width: 395px;
        input { font-size: 1.5rem;}
    }
    #alphaData {width: 395px;}

    #footer_up {
        height: auto;
        p {display: grid; grid-template-columns: 1fr; padding: 1rem;}
    } 
}