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

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f5f7fb;
    color: #222;
    
    min-height: 100vh;

    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.container {
    width: 90%;
    max-width: 1100px;
    margin: 0 auto;
}


/* HEADER */

.site-header {
    background-color: #1f2937;
    color: white;
    padding: 20px 0;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 26px;
}

.main-nav {
    display: flex;
    gap: 20px;
}

.main-nav a {
    color: white;
    text-decoration: none;
}


/* HERO */

.hero {
    width: 100%;
}

.hero-image {
    position: relative;
    width: 100%;
}

.hero-image img {
    display: block;
    width: 100%;
    height: auto;
}

.hero-button {
    position: absolute;

    left: 5%;
    bottom: 8%;

    border: none;
    padding: 16px 30px;

    font-size: 18px;
    font-weight: bold;

    border-radius: 30px;

    background-color: #ffb521;
    color: #102a56;

    cursor: pointer;

    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    
     transition: transform 0.2s ease,
                box-shadow 0.2s ease;
}

.hero-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}


/* FEATURES */

.features {
    padding: 70px 0;
}

.features h2 {
    text-align: center;
    margin-bottom: 40px;
}

/* CARDS */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
}

.card {
    background-color: white;
    padding: 35px;
    border-radius: 12px;
    text-align: center;
}

.card-icon {
    font-size: 50px;
    margin-bottom: 20px;
}

.card-icon img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.card h3 {
    margin-bottom: 15px;
}

.card p {
    line-height: 1.6;
}


/* FOOTER */

.site-footer {
    text-align: center;
    padding: 30px;
    background-color: #1f2937;
    color: white;
}


/* MOBILE */

@media (max-width: 768px) {

    .site-header .container {
        flex-direction: column;
        gap: 20px;
    }

    .main-nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero h2 {
        font-size: 36px;
    }

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

.piece-info {
    grid-template-columns: 1fr;

    text-align: center;

    gap: 25px;
}

.piece-info-image img {
    max-width: 200px;
}

    .learn-header h2 {
    font-size: 34px;
    }
}

.page-content {
   
    padding: 80px 0;
}

.page-content h2 {
    font-size: 42px;
    margin-bottom: 20px;
}

.page-content p {
    font-size: 20px;
    line-height: 1.6;
}

/*Marcar pagina activa*/
.main-nav a {
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
}

.main-nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.main-nav a.active {
    background-color: #ffb521;
    color: #102a56;
}

.card-link {
    text-decoration: none;
    color: inherit;
}

/*articles links */
.card {
    background-color: white;
    padding: 35px;
    border-radius: 12px;
    text-align: center;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-5px);

    box-shadow:
        0 10px 25px
        rgba(0, 0, 0, 0.12);
}

/* =========================
   LEARN PAGE
========================= */

.learn-section {
    padding: 70px 0;
}

.learn-header {
    text-align: center;
    margin-bottom: 45px;
}

.learn-header h2 {
    font-size: 42px;
    margin-bottom: 15px;
}

.learn-header p {
    max-width: 650px;
    margin: 0 auto;

    font-size: 18px;
    line-height: 1.6;
}

/* PIECE SELECTOR */

.piece-selector {
    display: grid;

    grid-template-columns:
        repeat(6, 1fr);

    gap: 15px;

    margin-bottom: 50px;
}

.piece-button {
    border: 2px solid transparent;

    background-color: white;

    border-radius: 16px;

    padding: 15px;

    cursor: pointer;

    display: flex;
    flex-direction: column;

    align-items: center;

    gap: 10px;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.piece-button img {
    width: 90px;
    height: 90px;

    object-fit: contain;
}


.piece-button span {
    font-size: 17px;
    font-weight: bold;
}


.piece-button:hover {
    transform: translateY(-4px);

    box-shadow:
        0 8px 20px
        rgba(0, 0, 0, 0.10);
}

.piece-button.active {
    border-color: #ffb521;

    box-shadow:
        0 8px 20px
        rgba(0, 0, 0, 0.12);
}

/* PIECE INFORMATION */

.piece-info {
    background-color: white;

    border-radius: 20px;

    padding: 40px;

    display: grid;

    grid-template-columns:
        300px 1fr;

    gap: 50px;

    align-items: center;
}


.piece-info-image {
    text-align: center;
}

.piece-info-image img {
    max-width: 260px;
    width: 100%;
    height: auto;
}


.piece-label {
    font-size: 14px;
    font-weight: bold;

    color: #777;

    margin-bottom: 8px;
}


.piece-info-text h3 {
    font-size: 36px;

    margin-bottom: 20px;
}


.piece-info-text p {
    font-size: 19px;

    line-height: 1.7;
}

/* =========================
   GAMES PAGE
========================= */

.game-section {
    padding: 70px 0;
}

.game-header {
    text-align: center;
    margin-bottom: 40px;
}

.game-header h2 {
    font-size: 42px;
    margin-bottom: 15px;
}

.game-header p {
    font-size: 18px;
}

.game-layout {
    display: grid;

    grid-template-columns:
        minmax(0, 560px)
        minmax(250px, 1fr);

    gap: 40px;
    align-items: center;
}

/* CHESS BOARD */

.chess-board {
    width: 100%;
    max-width: 560px;

    aspect-ratio: 1 / 1;

    display: grid;

    grid-template-columns:
        repeat(8, 1fr);

    grid-template-rows:
        repeat(8, 1fr);

    border: 6px solid #1f2937;

    margin: 0 auto;
}


.square {
    position: relative;

    display: flex;

    justify-content: center;
    align-items: center;

    cursor: pointer;
}

.square.light {
    background-color: #f0d9b5;
}


.square.dark {
    background-color: #769656;
}


.square img {
    width: 80%;
    height: 80%;

    object-fit: contain;

    pointer-events: none;
}

.square.correct {
    box-shadow:
        inset 0 0 0 6px #ffb521;
}


.square.wrong {
    box-shadow:
        inset 0 0 0 6px #d94a4a;
}


/* GAME PANEL */

.game-panel {
    background-color: white;

    padding: 35px;

    border-radius: 20px;
}


.game-panel h3 {
    font-size: 28px;

    margin-bottom: 20px;
}

.game-panel p {
    font-size: 18px;

    line-height: 1.6;

    margin-bottom: 20px;
}


.game-message {
    font-weight: bold;
}


.game-button {
    border: none;

    background-color: #ffb521;
    color: #102a56;

    padding: 14px 24px;

    font-size: 17px;
    font-weight: bold;

    border-radius: 10px;

    cursor: pointer;
}



/* Responsive de la pagina Aprender.
   Debe permanecer despues de los estilos base de esta pagina para que
   la cascada no restaure las seis columnas en pantallas pequenas. */
@media (max-width: 768px) {
    .learn-section {
        padding: 45px 0;
    }

    .learn-header h2 {
        font-size: 34px;
    }

    .piece-selector {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        margin-bottom: 35px;
    }

    .piece-button {
        min-width: 0;
        padding: 12px 8px;
    }

    .piece-button img {
        width: min(90px, 100%);
        height: 80px;
    }

    .piece-info {
        grid-template-columns: minmax(0, 1fr);
        gap: 25px;
        padding: 25px 20px;
        text-align: center;
    }

    .piece-info-image img {
        max-width: 200px;
    }

    .piece-info-text {
        min-width: 0;
    }

    .piece-info-text h3 {
        font-size: 30px;
    }

    .piece-info-text p {
        font-size: 17px;
        overflow-wrap: anywhere;
    }
    
     .game-layout {
        grid-template-columns: 1fr;

        gap: 25px;
    }

    .game-header h2 {
        font-size: 30px;
    }

    .game-section {
        padding: 40px 0;
    }

    .game-panel {
        padding: 25px 18px;
    }

}
