/*Styles for the pages of a single language (java.php for now).
The palette comes from style.css, which is always loaded first*/
:root{
    --celeste-card: #29839b;
    --consola: #1e2a30; /*Dark background for the console output */
    --sombra: 0 4px 4px rgba(0, 0, 0, 0.25); /*Same shadow as the language cards */
}

/*The index links slide down to each topic instead of jumping*/
html{
    scroll-behavior: smooth;
}

/*=========== LAYOUT ===========*/

/*The lesson on the left and the index on the right. min-width:0 lets the
article shrink, so long lines of code scroll inside their box*/
.leccion{
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 40px;
    align-items: start;
}

.titulo-lenguaje{
    display: inline-block;
    margin: 0 0 10px;
    padding: 5px 25px;
    background-color: var(--celeste-card);
    color: var(--blanco);
    border-radius: 8px;
    box-shadow: var(--sombra);
    font-size: 70px;
}

/*Every topic is separated from the next one by a thin line*/
.tema{
    padding: 30px 0;
    border-bottom: 1px solid var(--borde);
    /*Leaves some space above the title when we arrive from the index*/
    scroll-margin-top: 20px;
}

.tema h2{
    margin: 0 0 15px;
    font-size: 40px;
    color: var(--celeste-oscuro);
}

.tema p{
    font-size: 18px;
    line-height: 1.6;
}

/*=========== CODE BLOCKS ===========*/

.codigo{
    margin: 20px 0;
    padding: 15px 20px 20px;
    background-color: var(--light-celeste);
    border: 1px solid var(--borde);
    border-radius: 10px;
}

.codigo h3{
    margin: 0 0 12px;
    font-size: 18px;
    color: var(--texto);
}

/*overflow-x:auto adds a scrollbar only when a line does not fit*/
.codigo pre{
    margin: 0;
    padding: 15px;
    overflow-x: auto;
    background-color: var(--blanco);
    border: 1px solid var(--borde);
    border-radius: 8px;
    font-family: "Courier New", Courier, monospace;
    font-size: 16px;
    line-height: 1.5;
    color: var(--texto-suave);
}

/*The output of the program next to the button that opens the IDE*/
.consola{
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

/*.codigo pre gives the shape, here we only change the colors*/
.codigo .consola-salida{
    flex: 1;
    background-color: var(--consola);
    border-color: var(--consola);
    color: var(--blanco);
}

/*=========== ECOSYSTEM ===========*/

.ecosistema{
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 20px;
}

.componentes{
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/*A white box with a colored line on the left, like a note*/
.componentes li{
    padding: 15px;
    background-color: var(--blanco);
    border: 1px solid var(--borde);
    border-radius: 8px;
    line-height: 1.5;
    color: var(--texto-suave);
}

.tipos{
    padding: 20px;
    background-color: var(--light-celeste);
    border-radius: 10px;
}

.tipos h3{
    margin: 0 0 15px;
    color: var(--aqua);
}

/*Same check marks as the list in the home page*/
.tipos ul{
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding-left: 20px;
    list-style-type: "✓ ";
    line-height: 1.5;
    color: var(--texto-suave);
}

/*=========== TIPS ===========*/

/*fit-content makes the box as wide as its text, not the whole page*/
.tip{
    display: flex;
    align-items: center;
    gap: 12px;
    width: fit-content;
    max-width: 100%;
    padding: 12px 18px;
    background-color: var(--light-celeste);
    border: 1px solid var(--borde);
    border-radius: 8px;
    box-sizing: border-box;
}

.tip i{
    font-size: 20px;
    color: var(--aqua);
}

.tip p{
    margin: 0;
    font-size: 16px;
}

/*=========== CONCEPT CARDS ===========*/

/*auto-fit puts as many cards per row as fit (same idea as the footer)*/
.conceptos{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.concepto{
    padding: 20px;
    background-color: var(--blanco);
    border: 1px solid var(--borde);
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease;
}

.concepto:hover{
    transform: scale(1.05);
}

.concepto h3{
    margin: 0 0 10px;
    font-size: 20px;
    color: var(--aqua);
}

.concepto p{
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
}

/*=========== INDEX ===========*/

/*sticky keeps the index on screen while we scroll, like the side menu*/
.indice{
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 20px;
    background-color: var(--light-celeste);
    border: 1px solid var(--borde);
    border-radius: 10px;
}

.indice h3{
    margin: 0 0 10px;
    font-size: 30px;
    color: var(--texto);
}

.indice a{
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 15px;
    font-weight: bold;
    color: var(--texto-suave);
}

.indice a:hover{
    background-color: var(--blanco);
    color: var(--aqua);
}

.indice a.activo {
    color: var(--blanco);
    font-weight: bold;
    background-color: var(--aqua);
}

/*=========== OUTPUT OF EACH LANGUAGE ===========*/
/*Every language shows its result the way its own tool would show it*/

/*Terminal (Python and C++). .codigo pre already gives it the shape*/
.codigo .terminal{
    margin-top: 15px;
    background-color: var(--consola);
    border-color: var(--consola);
    color: var(--blanco);
}

.terminal .prompt{
    color: #7fd1e3;
}

.terminal .error{
    color: #ff8a80;
}

/*Console tab of the browser DevTools (JavaScript)*/
.devtools{
    margin-top: 15px;
    overflow: hidden;
    background-color: var(--blanco);
    border: 1px solid #cbcdd1;
    border-radius: 8px;
    font-family: "Courier New", Courier, monospace;
    font-size: 15px;
}

.devtools-pestanas{
    display: flex;
    gap: 20px;
    padding: 8px 15px 0;
    background-color: #f1f3f4;
    border-bottom: 1px solid #cbcdd1;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    color: #5f6368;
}

.devtools-pestanas span{
    padding-bottom: 6px;
}

.devtools-pestanas .activa{
    color: #1a73e8;
    border-bottom: 2px solid #1a73e8;
}

.devtools-linea{
    padding: 4px 15px;
    border-bottom: 1px solid #f0f0f0;
    white-space: pre;
    color: #202124;
}

/*What we type starts with › and what it returns with ←*/
.devtools-linea.entrada::before{
    content: "› ";
    color: #1a73e8;
}

.devtools-linea.retorno{
    color: #5f6368;
}

.devtools-linea.retorno::before{
    content: "← ";
}

/*The console paints numbers and booleans in blue*/
.devtools .valor{
    color: #1a1aa6;
}

.devtools-linea.error{
    background-color: #fdf2f2;
    border-color: #f9d6d5;
    color: #d93025;
}

/*Result of a query in phpMyAdmin (MySQL)*/
.pma{
    margin-top: 15px;
    overflow-x: auto;
    font-size: 14px;
}

.pma-mensaje{
    margin-bottom: 10px;
    padding: 8px 12px;
    background-color: #ebf8a4;
    border: 1px solid #a2d246;
    border-radius: 5px;
    color: #000000;
}

.pma table{
    border-collapse: collapse;
    background-color: var(--blanco);
}

.pma th{
    padding: 6px 12px;
    background: linear-gradient(#ffffff, #cccccc);
    border: 1px solid #aaaaaa;
    text-align: left;
    color: #235a81;
}

.pma td{
    padding: 6px 12px;
    border: 1px solid #cccccc;
    color: #000000;
}

.pma tr:nth-child(even) td{
    background-color: #dfdfdf;
}

.pma tr:hover td{
    background-color: #ccffcc;
}

/*phpMyAdmin writes NULL in italics so we don't confuse it with a text*/
.pma .nulo{
    font-style: italic;
    color: #888888;
}

/*Browser window with the rendered page (HTML and CSS)*/
.navegador{
    margin-top: 15px;
    overflow: hidden;
    background-color: var(--blanco);
    border: 1px solid var(--borde);
    border-radius: 8px;
}

.navegador-barra{
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background-color: #e8eaed;
}

.navegador-barra .punto{
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ff5f57;
}

.navegador-barra .punto:nth-child(2){
    background-color: #febc2e;
}

.navegador-barra .punto:nth-child(3){
    background-color: #28c840;
}

.navegador-url{
    flex: 1;
    margin-left: 10px;
    padding: 3px 12px;
    background-color: var(--blanco);
    border-radius: 12px;
    font-size: 13px;
    color: #5f6368;
}

/*Without CSS the browser uses Times New Roman and black text, so we copy that
and undo the styles of the lesson that would reach the preview*/
.navegador-pagina{
    padding: 15px 20px;
    font-family: "Times New Roman", Times, serif;
    font-size: 16px;
    color: #000000;
}

.navegador-pagina h1,
.navegador-pagina h2{
    margin: 0 0 10px;
    color: #000000;
}

.navegador-pagina h1{
    font-size: 32px;
}

.navegador-pagina h2{
    font-size: 24px;
}

.navegador-pagina p,
.tema .navegador-pagina p{
    margin: 0 0 10px;
    font-size: 16px;
    line-height: normal;
}

.navegador-pagina a{
    color: #0000ee;
    text-decoration: underline;
}

.navegador-pagina ul{
    margin: 0 0 10px;
}

/*Boxes for the parts of the page in the semantic tags preview*/
.esquema{
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 8px;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
    text-align: center;
    color: var(--blanco);
}

.esquema div{
    padding: 15px;
    border-radius: 5px;
    background-color: var(--celeste);
}

.esquema .esquema-header,
.esquema .esquema-footer{
    grid-column: 1 / 3;
    background-color: var(--celeste-oscuro);
}

.esquema .esquema-main{
    padding: 40px 15px;
    background-color: var(--aqua);
}

/*Box model drawn like the DevTools do it: margin, border, padding, content*/
.caja-modelo{
    padding: 10px 20px 20px;
    background-color: #f9cc9d;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    text-align: center;
}

.caja-modelo div{
    padding: 10px 20px 20px;
}

.caja-modelo .borde{
    background-color: #fddd9b;
    border: 2px solid #000000;
}

.caja-modelo .relleno{
    background-color: #c3d08b;
}

.caja-modelo .contenido-caja{
    padding: 15px;
    background-color: #8cb6c0;
}

/*The previews of the CSS examples apply the same rules that the code shows*/
.vista-padre{
    position: relative;
    padding: 20px;
    background-color: var(--light-celeste);
    border: 2px dashed var(--celeste);
    font-family: Arial, Helvetica, sans-serif;
}

.vista-cerrar{
    position: absolute;
    top: 10px;
    right: 10px;
    font-weight: bold;
}

.vista-flex{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 10px 15px;
    background-color: var(--celeste-oscuro);
    font-family: Arial, Helvetica, sans-serif;
    color: var(--blanco);
}

.vista-grid{
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.vista-grid div{
    padding: 20px;
    background-color: var(--celeste);
    border-radius: 5px;
    font-family: Arial, Helvetica, sans-serif;
    text-align: center;
    color: var(--blanco);
}

/*The same gallery at 768px or less, with a single column*/
.vista-grid.celular{
    grid-template-columns: 1fr;
}

/*A narrow window to show the page like on a phone*/
.navegador.celular{
    max-width: 240px;
}

/*In the first example the preview goes next to the button, like the console*/
.consola .navegador{
    flex: 1;
    margin-top: 0;
}

.navegador-pagina img{
    width: 150px;
}

/*Rules of the selectors example*/
.navegador-pagina .vista-titulo{
    color: var(--aqua);
}

.vista-destacado{
    background-color: #ffe08a;
}

#vista-aviso{
    font-weight: bold;
}

/*Memory of the C++ example: address, name and value of each variable*/
.memoria{
    margin-top: 15px;
    border-collapse: collapse;
    font-family: "Courier New", Courier, monospace;
}

.memoria th,
.memoria td{
    padding: 6px 15px;
    border: 1px solid var(--borde);
    text-align: left;
}

.memoria th{
    background-color: var(--celeste-oscuro);
    color: var(--blanco);
}

.memoria td{
    background-color: var(--blanco);
}

/*=========== RESPONSIVE ===========*/

/*1. TABLET BREAKPOINT (Under 1024px)*/
@media (max-width: 1024px){

    /*The index goes above the lesson and stops following the scroll*/
    .leccion{
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    .indice{
        position: static;
        order: -1;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .indice h3{
        width: 100%;
    }

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

/*2. CELLPHONE BREAKPOINT (Under 768px)*/
@media (max-width: 768px){

    /*The navbar and the menu stay on top here, so the title has to stop
    under both of them (js/menu.js measures their height)*/
    .tema{
        scroll-margin-top: calc(var(--alto-navbar, 118px) + var(--alto-menu, 0px) + 20px);
    }

    .titulo-lenguaje{
        font-size: 50px;
    }

    .tema h2{
        font-size: 28px;
    }

    .tema p{
        font-size: 16px;
    }

    .codigo{
        padding: 12px;
    }

    .codigo pre{
        font-size: 14px;
    }

    /*The memory table has long addresses, so it gets smaller to fit*/
    .memoria th,
    .memoria td{
        padding: 5px 6px;
        font-size: 12px;
    }

    /*The button goes under the output instead of beside it*/
    .consola{
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .indice a.activo{
        background-color: initial;
        color: var(--texto-suave);
    }
}
