/* Reset */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base */

html {
  height: 100%;
}

body {
  font-family: Courier, monospace;
  background: #fff;
  color: #000;
  height: 100%;
  -webkit-font-smoothing: antialiased;
}

/* Mobile — stacked, scrolling is fine */

.diptych {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6rem;
  padding: 6rem 4rem;
}

.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 400px;
}

.panel img {
  display: block;
  width: 100%;
  height: auto;
  filter: grayscale(100%);
}

.panel figcaption {
  margin-top: 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
  text-align: center;
}

/* Desktop — side by side, NO SCROLL, fits 100vh exactly */

@media (min-width: 768px) {
  html, body {
    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0;
  }

  .diptych {
    display: grid;
    grid-template-columns: minmax(0, 35vw) minmax(0, 35vw);  /* Equal max-width columns, closer together */
    grid-template-rows: 1fr auto;
    column-gap: 2rem;  /* Gap between columns */
    row-gap: 0.5rem;
    height: 100vh;
    max-width: 80vw;  /* Constrain total width */
    margin: 0 auto;  /* Center the grid */
    padding: 1.5rem;
    box-sizing: border-box;
    align-content: center;
    justify-content: center;
  }

  /* Use display:contents to make img/figcaption direct grid children */
  .panel {
    display: contents;
  }

  .panel img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    filter: grayscale(100%);
    /* Critical: allow grid to constrain below content size */
    min-height: 0;
    min-width: 0;
  }

  .panel:nth-child(1) img {
    grid-column: 1;
    grid-row: 1;
  }

  .panel:nth-child(2) img {
    grid-column: 2;
    grid-row: 1;
  }

  .panel figcaption {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    grid-row: 2;
    text-align: center;
    width: 100%;  /* Fill column width */
    /* Let captions be as tall as they need, but constrain by available space */
    align-self: start;
  }

  .panel:nth-child(1) figcaption {
    grid-column: 1;
  }

  .panel:nth-child(2) figcaption {
    grid-column: 2;
  }
}
