/* Align Self Demo Container */
.flex-align-self {
  display: flex;
  gap: 16px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(52, 152, 219, 0.04);
  padding: 1em;
  margin: 1em 0;
  flex-wrap: wrap;
  flex-direction: row;
}
/* Basic layout and typography */
body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(120deg, #f0e6fa 0%, #e3f6fd 100%);
  margin: 0;
  padding: 0;
  color: #222;
}
.page-header {
  background: #3498db;
  color: #fff;
  padding: 2rem 1rem 1rem 1rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.08);
}
.subtitle {
  font-size: 1.2rem;
  color: #ffd200;
  margin-top: 0.5rem;
}
main {
  max-width: 900px;
  margin: 2rem auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(52, 152, 219, 0.10);
  padding: 2rem 1.5rem 3rem 1.5rem;
}
.theory-section, .best-practices {
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e3f6fd;
}
.theory-section h2, .demo-section h2, .best-practices h2 {
  color: #3498db;
}
.demo-section {
  margin-bottom: 2.5rem;
}
.demo-block {
  margin-bottom: 2rem;
  padding: 1.2rem 1rem;
  background: #f9f6ff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(52, 152, 219, 0.06);
}
.demo-block h3 {
  margin-top: 0;
  color: #8e44ad;
}
pre {
  background: #222;
  color: #ffd200;
  padding: 0.8em 1em;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.98em;
  margin-top: 1em;
}
code {
  background: #f0e6fa;
  color: #3498db;
  padding: 0.1em 0.3em;
  border-radius: 4px;
  font-size: 1em;
}
/* Default flex-demo styles */
.flex-demo {
  display: flex;
  gap: 16px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(52, 152, 219, 0.04);
  padding: 1em;
  margin: 1em 0;
  flex-wrap: wrap;
  flex-direction: row;
}
/* Height utility classes for flex alignment demos */
.tall {
  height: 64px;
}
.short {
  height: 32px;
}

.flex-item {
  background: #e3f6fd;
  color: #222;
  border-radius: 6px;
  padding: 1em 1.5em;
  font-weight: bold;
  font-size: 1.1em;
  min-width: 48px;
  min-height: 32px;
  text-align: center;
  box-shadow: 0 1px 4px #3498db11;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.flex-item:hover {
  background: #3498db;
  color: #fff;
  transform: scale(1.08);
}
.flex-row {
  flex-direction: row;
}
.flex-column {
  flex-direction: column;
}
.flex-row-reverse { flex-direction: row-reverse; }
.flex-column-reverse { flex-direction: column-reverse; }
.flex-justify, .flex-justify-between {
  justify-content: space-between;
}
.flex-justify-start { justify-content: flex-start; }
.flex-justify-center { justify-content: center; }
.flex-justify-end { justify-content: flex-end; }
.flex-justify-around { justify-content: space-around; }
.flex-justify-evenly { justify-content: space-evenly; }
.flex-align {
  align-items: flex-end;
}
.flex-align-start { align-items: flex-start; }
.flex-align-center { align-items: center; }
.flex-align-end { align-items: flex-end; }
.flex-align-stretch { align-items: stretch; }
.flex-align-baseline { align-items: baseline; }
.flex-wrap-nowrap { flex-wrap: nowrap; }
.flex-wrap-wrap { flex-wrap: wrap; }
.flex-wrap-wrap-reverse { flex-wrap: wrap-reverse; }
.flex-gap {
  gap: 24px;
}
.flex-grow-demo .flex-grow1 { flex: 1; }
.flex-grow-demo .flex-grow2 { flex: 2; }
.flex-grow-demo .flex-grow3 { flex: 3; }
.flex-shrink1 { flex-shrink: 1; width: 200px; }
.flex-shrink3 { flex-shrink: 3; width: 200px; }
.flex-shrink5 { flex-shrink: 5; width: 200px; }
.flex-basis100 { flex-basis: 100px; }
.flex-basis200 { flex-basis: 200px; }
.flex-basis50 { flex-basis: 50px; }
.flex-shrink-demo .flex-item:nth-child(1) { flex-shrink: 1; width: 200px; }
.flex-shrink-demo .flex-item:nth-child(2) { flex-shrink: 3; width: 200px; }
.flex-shrink-demo .flex-item:nth-child(3) { flex-shrink: 5; width: 200px; }
.flex-basis-demo .flex-item:nth-child(1) { flex-basis: 100px; }
.flex-basis-demo .flex-item:nth-child(2) { flex-basis: 200px; }
.flex-basis-demo .flex-item:nth-child(3) { flex-basis: 50px; }
.flex-align-content-start, 
.flex-align-content-center, 
.flex-align-content-end,
.flex-align-content-between,
.flex-align-content-around,
.flex-align-content-stretch {
  flex-wrap: wrap;
  height: 180px;
}
.flex-align-content-start { align-content: flex-start; }
.flex-align-content-center { align-content: center; }
.flex-align-content-end { align-content: flex-end; }
.flex-align-content-between { align-content: space-between; }
.flex-align-content-around { align-content: space-around; }
.flex-align-content-stretch { align-content: stretch; }
.flex-flow-demo {
  flex-flow: row wrap;
  gap: 12px;
}
.demo-btn {
  display: inline-block;
  background: #ffd200;
  color: #3498db;
  padding: 0.7em 1.5em;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
  transition: background 0.2s, color 0.2s;
  margin-bottom: 0.5em;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.08);
}
.demo-btn:hover,
.demo-btn:focus {
  background: #3498db;
  color: #fff;
  outline: 2px solid #ffd200;
  outline-offset: 2px;
}
.demo-btn:active {
  background: #8e44ad;
}
.back-btn {
  margin-top: 2rem;
}
.axis-diagram {
  display: block;
  margin: 1em auto;
  max-width: 420px;
  border-radius: 8px;
  box-shadow: 0 2px 8px #3498db22;
}
.flex-order-1{
    order: 3;
}
.flex-order-2{
    order: 1;
}
.flex-order-3{
    order: 2;
}


@media (max-width: 700px) {
  main {
    padding: 1rem 0.5rem 2rem 0.5rem;
    max-width: 100vw;
  }
  .page-header {
    padding: 1.2rem 0.5rem 0.7rem 0.5rem;
  }
  .demo-block {
    padding: 0.7rem 0.5rem;
  }
  /* Increase specificity to override flex direction on small screens */
  body .flex-demo {
    flex-direction: column;
    gap: 10px;
    padding: 0.7em;
  }
}
