/* Device Frame Components
 * Reusable frames for displaying screenshots in phone, tablet, and laptop devices
 * Usage: Wrap your image in the appropriate device-frame class
 */

/* Base frame styles */
.device-frame {
  display: inline-block;
  position: relative;
  margin: 0;
  padding: 0;
}

.device-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

/* Phone Frame */
.phone-frame {
  width: 240px;
  position: relative;
}

.phone-frame svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Tablet Frame */
.tablet-frame {
  width: 480px;
  position: relative;
}

.tablet-frame svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Laptop Frame */
.laptop-frame {
  width: 640px;
  position: relative;
}

.laptop-frame svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Container for multiple device frames */
.device-frames {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  align-items: flex-start;
  margin: 2rem 0;
}

/* Multi-frame layout: fit up to 4 frames on the same line. Each item takes a
   quarter of the row (minus the three 1.5rem gaps between four items) and the
   frame's fixed pixel width is neutralised inside this container so the SVG
   scales to fill its cell. Scoped to .device-frames so standalone frames used
   elsewhere (two-column blocks, .phone-tile, .feature-column) keep their sizes. */
.device-frames {
  gap: 1.5rem;
}
.device-frames > .device-frame,
.device-frames > figure.device-frame {
  flex: 1 1 calc(25% - 1.5rem);
  min-width: 160px;
  max-width: calc(25% - 1.5rem);
}
.device-frames > .device-frame.phone-frame,
.device-frames > .device-frame.tablet-frame,
.device-frames > .device-frame.laptop-frame {
  width: auto;
}

/* Reset default figure margins */
.device-frames figure {
  margin: 0;
}

/* Captions */
.device-frame figcaption {
  text-align: center;
  color: #666;
  margin-top: 1rem;
  font-size: 0.9rem;
  line-height: 1.4;
  overflow-wrap: break-word;
  word-break: break-word;
  text-wrap: balance;
}

/* Responsive adjustments */
/* Standalone frames (not inside .device-frames) keep their responsive sizes. */
@media (max-width: 900px) {
  .phone-frame {
    width: 68%;
    max-width: 280px;
  }

  .tablet-frame {
    width: 85%;
    max-width: 440px;
  }

  .laptop-frame {
    width: 100%;
    max-width: 580px;
  }

  /* Multi-frame rows step down to 2-up on tablets. */
  .device-frames > .device-frame,
  .device-frames > figure.device-frame {
    flex-basis: calc(50% - 1.5rem);
    max-width: calc(50% - 1.5rem);
  }
}

@media (min-width: 900px) {
  .device-frames {
    flex-wrap: wrap;
    align-items: flex-start;
  }
}

/* Very small screens: one frame per line for legibility. */
@media (max-width: 520px) {
  .device-frames > .device-frame,
  .device-frames > figure.device-frame {
    flex-basis: 100%;
    max-width: 100%;
  }
}
