/* Design principle cards */
#design-principles .design-principles-grid {
  margin-top: 2rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#design-principles .principle-card {
  /* Supports either spelling of your global blue variable. */
  border-color: var(--blue, var(--bleu));
}

#design-principles .principle-card:hover {
  border-color: var(--yellow);
}

#design-principles .component-information {
  padding: 1.75rem;
}

#design-principles .principle-card h3 {
  margin: 0 0 1rem;
  color: var(--white);
  font-size: 1.35rem;
  font-weight: 700;
}

#design-principles .principle-description {
  margin: 0;
  color: var(--white);
  font-size: 1rem;
  line-height: 1.7;
}

@media (max-width: 900px) {
  #design-principles .design-principles-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  #design-principles .design-principles-grid {
    grid-template-columns: 1fr;
  }
}
/* Mechanical prototypes: images beside the description, with controls below. */
#hardwareCarousel.prototype-carousel {
  padding: 1.5rem 1.5rem 4.5rem;
  background: var(--background-color);
  border: 1px solid var(--blue);
  border-radius: 1.25rem;
  box-shadow: 0 1rem 2.5rem var(--background-color);
}
#hardwareCarousel.prototype-carousel .carousel-item { height: auto; }
#hardwareCarousel.prototype-carousel .carousel-item::after { display: none; }
.prototype-slide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 1.5rem;
}
.prototype-images { display: flex; align-items: center; gap: .75rem; min-width: 0; }
#hardwareCarousel.prototype-carousel .prototype-images img {
  width: 100%; height: auto; max-height: 480px; object-fit: contain; border-radius: .75rem; min-width: 0;
}
#hardwareCarousel.prototype-carousel .prototype-images:has(.prototype-lid) > img:first-child { width: 73%; }
#hardwareCarousel.prototype-carousel .prototype-images img.prototype-lid { width: 24%; }
.prototype-description h4 { color: var(--orange); }
.prototype-description p { margin-bottom: 1rem; }
#hardwareCarousel.prototype-carousel .carousel-control-prev,
#hardwareCarousel.prototype-carousel .carousel-control-next { top: auto; bottom: .75rem; width: 3rem; height: 2.5rem; }
#hardwareCarousel.prototype-carousel .carousel-control-prev { left: 1rem; }
#hardwareCarousel.prototype-carousel .carousel-control-next { right: 1rem; }
#hardwareCarousel.prototype-carousel .carousel-indicators { bottom: .75rem; margin-bottom: .5rem; }
@media (max-width: 767.98px) {
  .prototype-slide { grid-template-columns: 1fr; }
  #hardwareCarousel.prototype-carousel { padding: 1rem 1rem 4.5rem; }
  #hardwareCarousel.prototype-carousel .prototype-images img { max-height: 350px; }
}

/* Final prototype: crossfade between the two lid views without resizing. */
#hardwareCarousel .prototype-final-view { flex-direction: column; }
.prototype-lid-stage { display: grid; width: 100%; }
#hardwareCarousel.prototype-carousel .prototype-lid-stage img {
  grid-area: 1 / 1;
  align-self: center;
  transition: opacity .4s ease, transform .4s ease;
}
.prototype-with-lid { opacity: 0; visibility: hidden; transform: translateY(-.5rem); }
.prototype-final-view.is-with-lid .prototype-with-lid { opacity: 1; visibility: visible; transform: none; }
.prototype-final-view.is-with-lid .prototype-without-lid { opacity: 0; transform: translateY(.5rem); }
.prototype-lid-toggle {
  color: var(--orange); background: transparent; border: 1px solid var(--orange);
  border-radius: .75rem; padding: .5rem 1rem; font: inherit; cursor: pointer;
}
.prototype-lid-toggle:hover { background: color-mix(in srgb, var(--orange) 12%, transparent); }
.prototype-lid-toggle:focus-visible { outline: 2px solid var(--yellow); outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) {
  #hardwareCarousel.prototype-carousel .prototype-lid-stage img { transition: none; transform: none; }
}

/* Slightly reduce the final prototype's view with the lid. */
#hardwareCarousel.prototype-carousel .prototype-lid-stage .prototype-with-lid {
  width: 90%;
  justify-self: center;
}

/* Navigation sits below and outside the bordered carousel. */
.prototype-navigation { display: flex; justify-content: space-between; margin-top: .75rem; }
.prototype-navigation .carousel-control-prev,
.prototype-navigation .carousel-control-next {
  position: static;
  width: 3rem;
  height: 2.5rem;
  border: 1px solid var(--blue);
  border-radius: .75rem;
  background: var(--background-color);
}
.prototype-navigation button:hover { border-color: var(--orange); }

/* Keep the arrows beside the box and the indicators below it. */
#design-evolution .hardware-gallery {
  position: relative;
  width: 100%;
  padding-inline: 3.5rem;
}
#hardwareCarousel.prototype-carousel {
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  overflow: visible;
}
#hardwareCarousel.prototype-carousel .carousel-inner {
  padding: 1.5rem;
  border: 1px solid var(--blue);
  border-radius: 1.25rem;
  background: var(--background-color);
  box-shadow: 0 1rem 2.5rem var(--background-color);
}
#hardwareCarousel.prototype-carousel .carousel-indicators {
  bottom: -2rem;
  margin: 0;
}
#design-evolution .prototype-navigation {
  position: absolute;
  inset: 0;
  margin: 0;
  pointer-events: none;
}
#design-evolution .prototype-navigation button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: auto;
}
#design-evolution .prototype-navigation .carousel-control-prev { left: 0; }
#design-evolution .prototype-navigation .carousel-control-next { right: 0; }
@media (max-width: 575.98px) {
  #design-evolution .hardware-gallery { padding-inline: 2.5rem; }
  #design-evolution .prototype-navigation button { width: 2rem; }
  #hardwareCarousel.prototype-carousel .carousel-inner { padding: 1rem; }
}

/* Image sources are left empty for the prototyping photographs supplied later. */
.engineering-photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.engineering-photo-grid figure { margin: 0; min-width: 0; }
.engineering-photo-grid img { display: block; width: 100%; height: 240px; object-fit: contain; }
.engineering-photo-grid img[src=""] { border: 1px dashed var(--blue); background: var(--background-color); }
.engineering-prototype-section { margin-top: 2rem; scroll-margin-top: 130px; }

/* Five-photo groups: three equal frames, then two centered underneath. */
.engineering-photo-grid:has(> figure:nth-child(5):last-child) {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1.25rem;
}
.engineering-photo-grid:has(> figure:nth-child(5):last-child) > figure { grid-column: span 2; }
.engineering-photo-grid:has(> figure:nth-child(5):last-child) > figure:nth-child(4) { grid-column: 2 / span 2; }
.engineering-photo-grid:has(> figure:nth-child(5):last-child) > figure:nth-child(5) { grid-column: 4 / span 2; }
.engineering-photo-grid:has(> figure:nth-child(5):last-child) img { height: 240px; width: 100%; object-fit: contain; }
@media (max-width: 575.98px) {
  .engineering-photo-grid:has(> figure:nth-child(5):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .engineering-photo-grid:has(> figure:nth-child(5):last-child) > figure,
  .engineering-photo-grid:has(> figure:nth-child(5):last-child) > figure:nth-child(4),
  .engineering-photo-grid:has(> figure:nth-child(5):last-child) > figure:nth-child(5) { grid-column: auto; }
  .engineering-photo-grid:has(> figure:nth-child(5):last-child) > figure:last-child { grid-column: 1 / -1; width: calc(50% - .625rem); justify-self: center; }
}
