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

body {
  font-family: "Yrsa", serif;
  line-height: 1.6;
  font-size: 18px;
}

* {
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
}

main {
  background-color: #e4e72c;
  min-height: 100dvh;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
}
main section {
  padding: 20px;
  max-width: 820px;
  background-color: #eee;
  margin-left: auto;
  margin-right: auto;
}
main h2 {
  font-size: 1.5em;
  text-align: center;
}

.grid {
  display: -ms-grid;
  display: grid;
  grid-gap: 4vh;
}
.grid img {
  display: block;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}
.grid[columns="2"] {
  -ms-grid-columns: (1fr)[2];
  grid-template-columns: repeat(2, 1fr);
}
.grid[columns="3"] {
  -ms-grid-columns: (1fr)[3];
  grid-template-columns: repeat(3, 1fr);
}
.grid[columns="4"] {
  -ms-grid-columns: (1fr)[4];
  grid-template-columns: repeat(4, 1fr);
}
.grid .box {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
}

form {
  display: -ms-grid;
  display: grid;
  gap: 20px;
}

fieldset {
  background-color: white;
  display: -ms-grid;
  display: grid;
  gap: 5px;
  padding: 20px;
  border: 2px solid white;
}

label {
  font-size: 0.875em;
  letter-spacing: 0.1em;
  font-weight: 725;
  text-transform: uppercase;
}

input,
textarea,
select,
button {
  font-family: "Yrsa", serif;
  padding: 0.5em 1.25rem;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
}

input,
textarea,
select {
  font-size: 1em;
  border-width: 3px;
}

.button-holder {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: end;
      -ms-flex-align: end;
          align-items: end;
  -webkit-box-pack: end;
      -ms-flex-pack: end;
          justify-content: end;
}

button {
  background-color: #313131;
  color: #e4e72c;
  font-size: 1.5em;
  padding: 0.25em 1.25em;
  cursor: pointer;
}
button:hover, button:focus {
  background-color: #e4e72c;
  color: #313131;
}

#app[example-number="1"] {
  /* Basic styling for all card containers */
  /* Style the card container ONLY if it has an image */
  /* Optional: Basic image styling */
  /* Ensure the paragraph has some consistent styling */
}
#app[example-number="1"] .card-container {
  border: 1px solid #ccc;
  padding: 15px;
  margin-bottom: 20px;
  background-color: #f9f9f9;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  -webkit-box-pack: justify;
      -ms-flex-pack: justify;
          justify-content: space-between;
  min-height: 200px;
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
}
#app[example-number="1"] .card-container:has(img) {
  border-color: #007bff; /* Blue border */
  -webkit-box-shadow: 0 4px 8px rgba(0, 123, 255, 0.2);
          box-shadow: 0 4px 8px rgba(0, 123, 255, 0.2);
  background-color: #e6f2ff; /* Light blue background */
}
#app[example-number="1"] .card-container img {
  max-width: 100%;
  height: auto;
  display: block;
  margin-top: auto;
  margin-bottom: 0;
  -ms-flex-item-align: center;
      -ms-grid-row-align: center;
      align-self: center;
}
#app[example-number="1"] .card-container p {
  -webkit-box-flex: 1;
      -ms-flex-positive: 1;
          flex-grow: 1;
  margin-bottom: 10px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
}

#app[example-number="3"] fieldset:has([required]) label:after {
  content: "*";
  color: #ee2a2a;
}
#app[example-number="3"] fieldset:has(:focus) label {
  color: #4885ed !important;
}
#app[example-number="3"] fieldset:has(:focus) input,
#app[example-number="3"] fieldset:has(:focus) select,
#app[example-number="3"] fieldset:has(:focus) textarea {
  outline: none;
  border-color: #4885ed;
  color: #4885ed;
}
#app[example-number="3"] fieldset:has(:focus) option {
  color: #313131;
}
#app[example-number="3"] fieldset:has(input[required]:invalid) {
  border: 2px solid red;
}
#app[example-number="3"] fieldset:has(input[required]:invalid) label {
  color: #ee2a2a;
}
#app[example-number="3"] fieldset:has(select[required]:invalid) {
  border: 2px solid red;
}
#app[example-number="3"] fieldset:has(select[required]:invalid) label {
  color: #ee2a2a;
}

#app[example-number="4"] #AddBox,
#app[example-number="5"] #AddBox {
  position: fixed;
  bottom: 0;
  right: 0;
  font-size: 1em;
}
#app[example-number="4"] main section,
#app[example-number="5"] main section {
  width: 100%;
  max-width: 620px;
}
#app[example-number="4"] .grid,
#app[example-number="5"] .grid {
  width: 100%;
  gap: 20px;
}
#app[example-number="4"] .grid .box,
#app[example-number="5"] .grid .box {
  border: 2px solid #313131;
  background-color: #ddd;
  aspect-ratio: 1/1;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
}

#app[example-number="5"] .grid[four] {
  position: relative;
  padding-top: 10px;
}
#app[example-number="5"] .grid[four]:before {
  position: absolute;
  top: 0;
  left: 0;
  font-family: monospace;
  background-color: rgba(0, 0, 0, 0.15);
  padding: 3px 10px;
  color: #ac4b06;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: lowercase;
  border-bottom: 1px solid rgba(0, 0, 0, 0.4);
  border-right: 1px solid rgba(0, 0, 0, 0.4);
  top: -20px;
  left: -20px;
}
#app[example-number="5"] .grid[four=grid]:before {
  content: "display: grid";
}
#app[example-number="5"] .grid[four=flex]:before {
  content: "display: flex";
}
#app[example-number="5"] .grid[four=grid]:has(.box:nth-child(4)) {
  display: -ms-grid;
  display: grid;
  -ms-grid-columns: (1fr)[2];
  grid-template-columns: repeat(2, 1fr);
}
#app[example-number="5"] .grid[four=flex]:has(.box:nth-child(4)) {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex; /* Change to flexbox */
  -ms-flex-wrap: wrap;
      flex-wrap: wrap; /* Allow items to wrap to the next line */
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center; /* Horizontally center the items */
  gap: 20px; /* Maintain gap between items */
}
#app[example-number="5"] .grid[four=flex]:has(.box:nth-child(4)) .box {
  -ms-flex-preferred-size: 33.333%;
      flex-basis: 33.333%;
  max-width: calc(33.333% - 15px);
  margin: 0; /* Remove potential default margins */
}
#app[example-number="5"] #GridOrFlex {
  position: fixed;
  bottom: 0;
  right: 0;
  font-size: 1em;
}