/* Global box model */
html {
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #ffffff;
}

.wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem;
}

/* Generic layout */
.row {
  display: flex;
  flex-flow: row wrap;
  margin-bottom: 1.5rem;
}

article {
  padding: 1rem;
  background-color: #e0f0f8;
}

.row-2 article,
.row-4 article {
  background-color: #fff6cc;
}

.row-3 article {
  background-color: #d0e8ff;
}

.row-5 article {
  background-color: #cde6f5;
}

.row-6 .mini-card {
  background-color: #f5f5f5;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin-bottom: 0.5rem;
}

h2, h3 {
  margin-top: 0;
}

a {
  color: #006699;
}

/* Mobile-first columns: full width */
[class*="col-"] {
  margin-left: 4%;
  flex: 0 0 92%;
}

.row-6 {
  display: flex;
  flex-wrap: wrap;
}

.row-6 .mini-card {
  padding: 0.5rem 1rem;
  margin: 0.5rem 0;
  flex: 0 0 92%;
  margin-left: 4%; 
  text-align: center;
}

/* Default / mobile order for row 5 */
.row-5 .item-a { order: 1; }
.row-5 .item-b { order: 2; }
.row-5 .item-c { order: 3; }

/* Tablet layout: 2 columns */
@media only screen and (min-width: 480px) and (max-width: 767px) {

  .col-1,
  .col-2,
  .col-3,
  .col-4 {
    flex: 0 0 44%;
  }

  /* Row 4 stays full width on tablet */
  .row-4 .col-4 {
    flex: 0 0 92%;
  }

  /* Row 5: order and width on tablet (adjust as needed for screenshot) */
  .row-5 .item-a,
  .row-5 .item-b,
  .row-5 .item-c {
    flex: 0 0 44%;
  }
  .row-5 .item-a { order: 2; }
  .row-5 .item-b { order: 1; }
  .row-5 .item-c { order: 3; }

  /* Row 6: 2 mini cards per row on tablet */
  .row-6 .mini-card {
    flex: 0 0 44%;
    margin-left: 4%;   
  }
}

/* Desktop layout: 4-column grid */
@media only screen and (min-width: 768px) {

  /* 4-column system */
  .col-1 { flex: 0 0 20%; }   /* 1 column wide  */
  .col-2 { flex: 0 0 44%; }   /* 2 columns wide */
  .col-3 { flex: 0 0 68%; }   /* 3 columns wide */
  .col-4 { flex: 0 0 92%; }   /* 4 columns wide */

  /* Row 3: 1–3 layout */
  .row-3 .col-1 { flex: 0 0 20%; }
  .row-3 .col-3 { flex: 0 0 68%; }

  /* Row 4: full-width */
  .row-4 .col-4 { flex: 0 0 92%; }

  /* Row 5: 1–2–1 layout and order */
  .row-5 .item-a { flex: 0 0 20%; order: 1; }
  .row-5 .item-b { flex: 0 0 44%; order: 2; }
  .row-5 .item-c { flex: 0 0 20%; order: 3; }

  /* Row 6: five mini cards across */
  .row-6 {
    justify-content: flex-start;  /* no extra space-between stretch */
  }

  .row-6 .mini-card {
    flex: 0 0 16%;             
    margin-left: 3%;             
  }

  /* first card: align with the 4% left gutter used by other rows */
  .row-6 .mini-card:first-child {
    margin-left: 4%;
  }
}
