/*

██████╗ ██╗      █████╗  ██████╗██╗  ██╗ ██████╗██╗  ██╗ ██████╗ ██████╗ ██╗███╗   ███╗ █████╗          ██████╗ ██████╗ ███╗   ███╗
██╔══██╗██║     ██╔══██╗██╔════╝██║ ██╔╝██╔════╝██║  ██║██╔═══██╗██╔══██╗██║████╗ ████║██╔══██╗        ██╔════╝██╔═══██╗████╗ ████║
██████╔╝██║     ███████║██║     █████╔╝ ██║     ███████║██║   ██║██████╔╝██║██╔████╔██║███████║        ██║     ██║   ██║██╔████╔██║
██╔══██╗██║     ██╔══██║██║     ██╔═██╗ ██║     ██╔══██║██║   ██║██╔══██╗██║██║╚██╔╝██║██╔══██║        ██║     ██║   ██║██║╚██╔╝██║
██████╔╝███████╗██║  ██║╚██████╗██║  ██╗╚██████╗██║  ██║╚██████╔╝██║  ██║██║██║ ╚═╝ ██║██║  ██║ █████╗ ╚██████╗╚██████╔╝██║ ╚═╝ ██║
╚═════╝ ╚══════╝╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝ ╚═════╝ ╚═╝  ╚═╝╚═╝╚═╝     ╚═╝╚═╝  ╚═╝ ╚════╝  ╚═════╝ ╚═════╝ ╚═╝     ╚═╝
*/
/* Estilos para los ejemplos de Grid */
.grid-container {
    background-color: #f0f0f0;
    border: 2px dashed #999;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 8px;
    display: grid;
    gap: 10px;
}

.grid-item {
    background-color: #e67e22;
    color: white;
    padding: 20px;
    text-align: center;
    font-size: 1.2em;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.grid-item:nth-child(even) {
    background-color: #d35400;
}

.grid-item:nth-child(3n) {
    background-color: #f39c12;
    color: #333;
}

.ejemplo-codigo {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 10px;
}

h3 {
    margin-top: 30px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

h4 {
    color: #555;
    margin-top: 20px;
}

/* --- Utility Classes for Grid Examples --- */

/* Grid Template Columns */
.cols-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.cols-mixed {
    grid-template-columns: 100px 1fr 2fr;
}

.cols-auto-fill {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
}

.cols-auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
}

/* Grid Template Rows */
.rows-2 {
    grid-template-rows: 100px 100px;
}

.rows-mixed {
    grid-template-rows: 50px 1fr 50px;
    height: 300px;
}

/* Grid Areas */
.grid-areas {
    grid-template-columns: 1fr 3fr;
    grid-template-areas:
        'header header'
        'sidebar main'
        'footer footer';
}

.area-header {
    grid-area: header;
    background: #8e44ad;
}

.area-sidebar {
    grid-area: sidebar;
    background: #2980b9;
}

.area-main {
    grid-area: main;
    background: #27ae60;
    height: 100px;
}

.area-footer {
    grid-area: footer;
    background: #c0392b;
}

/* Gap */
.gap-20 {
    gap: 20px;
}

.gap-row-col {
    row-gap: 10px;
    column-gap: 50px;
}

/* Justify Items (Horizontal in cell) */
.justify-items-start {
    justify-items: start;
}

.justify-items-end {
    justify-items: end;
}

.justify-items-center {
    justify-items: center;
}

.justify-items-stretch {
    justify-items: stretch;
}

/* Align Items (Vertical in cell) */
.align-items-start {
    align-items: start;
    height: 200px;
}

.align-items-end {
    align-items: end;
    height: 200px;
}

.align-items-center {
    align-items: center;
    height: 200px;
}

.align-items-stretch {
    align-items: stretch;
    height: 200px;
}

/* Justify Content (Horizontal Grid in Container) */
.justify-content-start {
    justify-content: start;
    width: 100%;
    grid-template-columns: 50px 50px 50px;
}

.justify-content-end {
    justify-content: end;
    width: 100%;
    grid-template-columns: 50px 50px 50px;
}

.justify-content-center {
    justify-content: center;
    width: 100%;
    grid-template-columns: 50px 50px 50px;
}

.justify-content-between {
    justify-content: space-between;
    width: 100%;
    grid-template-columns: 50px 50px 50px;
}

.justify-content-around {
    justify-content: space-around;
    width: 100%;
    grid-template-columns: 50px 50px 50px;
}

.justify-content-evenly {
    justify-content: space-evenly;
    width: 100%;
    grid-template-columns: 50px 50px 50px;
}

/* Align Content (Vertical Grid in Container) */
.align-content-start {
    align-content: start;
    height: 300px;
    grid-template-rows: 50px 50px;
}

.align-content-end {
    align-content: end;
    height: 300px;
    grid-template-rows: 50px 50px;
}

.align-content-center {
    align-content: center;
    height: 300px;
    grid-template-rows: 50px 50px;
}

.align-content-between {
    align-content: space-between;
    height: 300px;
    grid-template-rows: 50px 50px;
}

.align-content-around {
    align-content: space-around;
    height: 300px;
    grid-template-rows: 50px 50px;
}

.align-content-evenly {
    align-content: space-evenly;
    height: 300px;
    grid-template-rows: 50px 50px;
}

/* Grid Auto Flow */
.flow-row {
    grid-auto-flow: row;
}

.flow-column {
    grid-auto-flow: column;
}

.flow-dense {
    grid-auto-flow: dense;
}

/* Item Placement */
.col-span-2 {
    grid-column: span 2;
}

.col-start-1-end-3 {
    grid-column: 1 / 3;
}

.row-span-2 {
    grid-row: span 2;
}

.col-2-row-2 {
    grid-column: 2;
    grid-row: 2;
    background: #e74c3c;
}

/* Self Alignment */
.self-start {
    justify-self: start;
    align-self: start;
}

.self-center {
    justify-self: center;
    align-self: center;
}


.area-sidebar {
    grid-area: sidebar;
    background: #2980b9;
}

.area-main {
    grid-area: main;
    background: #27ae60;
    height: 100px;
}

.area-footer {
    grid-area: footer;
    background: #c0392b;
}

/* Gap */
.gap-20 {
    gap: 20px;
}

.gap-row-col {
    row-gap: 10px;
    column-gap: 50px;
}

/* Justify Items (Horizontal in cell) */
.justify-items-start {
    justify-items: start;
}

.justify-items-end {
    justify-items: end;
}

.justify-items-center {
    justify-items: center;
}

.justify-items-stretch {
    justify-items: stretch;
}

/* Align Items (Vertical in cell) */
.align-items-start {
    align-items: start;
    height: 200px;
}

.align-items-end {
    align-items: end;
    height: 200px;
}

.align-items-center {
    align-items: center;
    height: 200px;
}

.align-items-stretch {
    align-items: stretch;
    height: 200px;
}

/* Justify Content (Horizontal Grid in Container) */
.justify-content-start {
    justify-content: start;
    width: 100%;
    grid-template-columns: 50px 50px 50px;
}

.justify-content-end {
    justify-content: end;
    width: 100%;
    grid-template-columns: 50px 50px 50px;
}

.justify-content-center {
    justify-content: center;
    width: 100%;
    grid-template-columns: 50px 50px 50px;
}

.justify-content-between {
    justify-content: space-between;
    width: 100%;
    grid-template-columns: 50px 50px 50px;
}

.justify-content-around {
    justify-content: space-around;
    width: 100%;
    grid-template-columns: 50px 50px 50px;
}

.justify-content-evenly {
    justify-content: space-evenly;
    width: 100%;
    grid-template-columns: 50px 50px 50px;
}

/* Align Content (Vertical Grid in Container) */
.align-content-start {
    align-content: start;
    height: 300px;
    grid-template-rows: 50px 50px;
}

.align-content-end {
    align-content: end;
    height: 300px;
    grid-template-rows: 50px 50px;
}

.align-content-center {
    align-content: center;
    height: 300px;
    grid-template-rows: 50px 50px;
}

.align-content-between {
    align-content: space-between;
    height: 300px;
    grid-template-rows: 50px 50px;
}

.align-content-around {
    align-content: space-around;
    height: 300px;
    grid-template-rows: 50px 50px;
}

.align-content-evenly {
    align-content: space-evenly;
    height: 300px;
    grid-template-rows: 50px 50px;
}

/* Grid Auto Flow */
.flow-row {
    grid-auto-flow: row;
}

.flow-column {
    grid-auto-flow: column;
}

.flow-dense {
    grid-auto-flow: dense;
}

/* Item Placement */
.col-span-2 {
    grid-column: span 2;
}

.col-start-1-end-3 {
    grid-column: 1 / 3;
}

.row-span-2 {
    grid-row: span 2;
}

.col-2-row-2 {
    grid-column: 2;
    grid-row: 2;
    background: #e74c3c;
}

/* Self Alignment */
.self-start {
    justify-self: start;
    align-self: start;
}

.self-center {
    justify-self: center;
    align-self: center;
}

.self-end {
    justify-self: end;
    align-self: end;
}

.self-stretch {
    justify-self: stretch;
    align-self: stretch;
}

/* Helpers */
.h-200 {
    height: 200px;
}

.h-400 {
    height: 400px;
}

.w-full {
    width: 100%;
}

/* --- Advanced Grid Examples --- */

/* Sizing Functions */
.grid-sizing {
    grid-template-columns: min-content max-content fit-content(200px);
}

/* Dense Flow */
.grid-dense {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    grid-auto-flow: row dense;
}

/* 12-Column System */
.grid-12 {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 10px;
}

.span-1 {
    grid-column: span 1;
}

.span-2 {
    grid-column: span 2;
}

.span-3 {
    grid-column: span 3;
}

.span-4 {
    grid-column: span 4;
}

.span-6 {
    grid-column: span 6;
}

.span-8 {
    grid-column: span 8;
}

.span-12 {
    grid-column: span 12;
}

/* Holy Grail Layout */
.holy-grail {
    display: grid;
    grid-template-columns: 200px 1fr 200px;
    grid-template-rows: auto 1fr auto;
    min-height: 400px;
    gap: 0;
}

.hg-header {
    grid-column: 1 / -1;
    background: #2c3e50;
    color: white;
    padding: 20px;
}

.hg-left {
    background: #34495e;
    color: white;
    padding: 20px;
}

.hg-main {
    background: #ecf0f1;
    padding: 20px;
    color: #333;
}

.hg-right {
    background: #7f8c8d;
    color: white;
    padding: 20px;
}

.hg-footer {
    grid-column: 1 / -1;
    background: #2c3e50;
    color: white;
    padding: 20px;
}

/* Overlay Pattern */
.grid-overlay {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.overlay-item {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
}

.overlay-img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 8px;
}

.overlay-text {
    align-self: center;
    justify-self: center;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 20px;
    border-radius: 8px;
    z-index: 1;
}