/* Reset and General Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #CEC;
    color: #234;
    font-family: Verdana, sans-serif;
    padding: 20px;
}

h1 {
    text-align: center;
    margin: 8px 0;
    border-bottom: 2px solid #234;
    padding-bottom: 8px;
}

h2 {
    margin: 8px;
    font-weight: normal;
    background-color: #234;
    color: #CEC;
    padding: 4px;
}

/* Base Flex Parent and Child Styles */
.flex-parent {
    display: flex;
    margin: 8px 8px 40px 8px;
    border: 4px solid transparent; /* Changed per demo focus */
    min-height: 100px;
}

.flex-child {
    border: 4px solid green;
    margin: 8px;
    min-height: 80px;
    flex-grow: 1; /* Default for the first demo */
    text-align: center;
    font-weight: bold;
}

/* Demo 2: Space Around */
.demo2 .flex-parent {
    justify-content: space-around;
}
.demo2 .flex-child {
    flex-grow: 0;
    min-width: 16px;
    border-color: black;
}

/* Demo 3: Space Between */
.demo3 .flex-parent {
    justify-content: space-between;
}
.demo3 .flex-child {
    flex-grow: 0;
    min-width: 16px;
    border-color: black;
}

/* Demo 4: Space Evenly */
.demo4 .flex-parent {
    justify-content: space-evenly;
}
.demo4 .flex-child {
    flex-grow: 0;
    min-width: 16px;
    border-color: black;
}

/* Demo 5: Row Reverse */
.demo5 .flex-parent {
    flex-direction: row-reverse;
}
.demo5 .flex-child:last-child {
    background-color: yellow;
}

/* Demo 6: Flex Wrap */
.demo6 .flex-parent {
    flex-flow: row wrap; /* Shorthand for flex-direction and flex-wrap */
}
.demo6 .flex-child {
    min-width: 200px;
    background-color: pink;
}

/* Demo 7: Align Self (Vertical Centering) */
.demo7 .flex-parent {
    min-height: 200px;
    justify-content: center;
}
.demo7 .flex-child {
    flex-grow: 0;
    min-width: 100px;
    max-height: 100px;
    aspect-ratio: 1;
    align-self: center; /* Vertically centers this specific item */
}

/* Demo 8: Flex Basis */
.demo8 .flex-parent {
    flex-flow: row wrap;
    justify-content: center;
    gap: 10px;
}
.demo8 .flex-child {
    flex-basis: 25%; /* Acts similarly to width in a flex context */
    margin: 0;
}