/* Chapter 11 — Responsive CSS and pseudo-elements */

body {
  margin: 0;
  padding: 1.25rem;
  background: #f4f1f7;
  color: #262034;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
}

.page {
  width: 94%;
  max-width: 68rem;
  margin: 0 auto;
}

nav {
  margin: 0 0 1.25rem;
  padding: 0.75rem;
  background: #e7def0;
  border: 1px solid #b6a4c8;
  border-radius: 0.75rem;
  text-align: center;
}

nav a {
  margin: 0.2rem;
  padding: 0.55rem 0.75rem;
  background: #ffffff;
  display: inline-block;
  border: 1px solid #80679a;
  border-radius: 999px;
  color: #4a286b;
  font-weight: 700;
}

header {
  margin: 0 0 1.25rem;
  padding: 2rem 1.25rem;
  background: #4a286b;
  border-radius: 1rem;
  color: #ffffff;
  text-align: center;
}

header h1 {
  margin: 0 0 0.5rem;
}

header h2 {
  margin: 0;
}

.panel h3,
.card h3 {
  margin: 0 0 0.5rem;
}

.panel p,
.card p {
  margin: 0 0 0.75rem;
}

header h2 {
  color: #eadff4;
  font-size: 1rem;
  font-weight: 400;
}

.panel,
.panel-alt {
  margin: 0 0 1.25rem;
  padding: 1.25rem;
  background: #ffffff;
  border: 1px solid #cfc3da;
  border-radius: 0.875rem;
}

.panel-alt {
  background: #eee8f3;
}

.code {
  color: #8b3d16;
  font-weight: 700;
}

.query-demo {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.card {
  min-width: 0;
  padding: 1rem;
  background: #f8f5fa;
  border: 2px solid #b6a4c8;
  border-radius: 0.75rem;
}

.breakpoint-state {
  padding: 0.75rem;
  background: #f6dfbd;
  border: 1px solid #b36c25;
  border-radius: 0.5rem;
  color: #653306;
  font-weight: 700;
  text-align: center;
}

.fluid-image {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 0.75rem;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
}

.image-frame {
  min-width: 0;
  margin: 0;
}

.crop-image {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  border-radius: 0.75rem;
}

.contain-image {
  object-fit: contain;
  background: #ddd2e7;
}

.image-frame figcaption {
  margin: 0.5rem 0 0;
  color: #554b61;
}

.pseudo-stage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
}

.pseudo-card {
  min-height: 9rem;
  padding: 1.5rem;
  background: #ffffff;
  position: relative;
  overflow: hidden;
  border: 1px solid #b6a4c8;
  border-radius: 0.875rem;
}

.pseudo-card::before {
  content: "";
  width: 0.65rem;
  height: 100%;
  background: #8b4f9f;
  position: absolute;
  top: 0;
  left: 0;
}

.pseudo-card::after {
  content: "";
  width: 4rem;
  height: 4rem;
  background: #efd48c;
  position: absolute;
  right: -1.5rem;
  bottom: -1.5rem;
  border-radius: 50%;
}

.pseudo-card h3,
.pseudo-card p {
  position: relative;
  z-index: 1;
}

.feature {
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
  background: #ffffff;
  position: relative;
  border: 1px solid #b6a4c8;
  border-radius: 1rem;
}

.feature::after {
  content: "";
  width: 6rem;
  height: 0.4rem;
  background: #efd48c;
  position: absolute;
  right: 1.25rem;
  bottom: 1rem;
}

.feature img {
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: cover;
}

.feature-copy {
  padding: 1.5rem;
}

.feature-copy h3 {
  margin: 0 0 0.75rem;
  color: #4a286b;
  font-size: 1.5rem;
}

@media (width >= 48rem) {
  .query-demo {
    grid-template-columns: repeat(3, 1fr);
  }

  .breakpoint-state {
    background: #d9ecd9;
    border-color: #4d8552;
    color: #225427;
  }
}

@media (min-width: 48rem) {
  .feature {
    grid-template-columns: minmax(18rem, 1fr) 1fr;
    align-items: center;
  }

  .feature img {
    height: 100%;
    aspect-ratio: 4 / 3;
  }

  .feature-copy {
    padding: 2.5rem;
  }
}
