/* Phone and small-tablet layout. Desktop (wider than 760px) is the 1:1
   rebuild of the 2008 site and none of these rules touch it. */
@media (max-width: 760px) {

  /* ---- frame layout: one normally scrolling page instead of three frames ---- */
  body.frameset { display: block; height: auto; overflow: visible; }
  .frame-menu { position: sticky; top: 0; z-index: 10; height: 42px; }
  .frame-image { overflow: visible; min-height: calc(100dvh - 42px - 65px); }
  .frame-studio {
    height: 65px;
    /* studiobalk.gif is flat #ffc000 with the name at the left: scale it so
       the whole name fits on a phone (it ends at 455 of 1134px). */
    background-size: min(1134px, 230vw) auto;
    background-repeat: no-repeat;
  }

  /* menu: the five buttons share the width instead of a fixed 453px table */
  .frame-menu table, .frame-menu tbody, .frame-menu tr { display: flex; width: 100%; }
  .frame-menu tr { justify-content: space-evenly; }
  .frame-menu td { flex: 0 1 auto; min-width: 0; }
  .frame-menu a.rollover { max-width: 100%; }
  .frame-menu a.rollover img { max-width: 100%; height: auto; }

  /* photos never wider than the screen */
  .frame-image img { max-width: 100%; height: auto; }

  /* ---- assignments: 5-column table with gaps -> 3-column grid ---- */
  .frame-image table.thumbs { width: 100%; }
  .frame-image table.thumbs > tbody {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .frame-image table.thumbs tr { display: contents; }
  .frame-image table.thumbs td:empty { display: none; }
  .frame-image table.thumbs td img { width: 100%; height: auto; box-sizing: border-box; }

  /* ---- stock: (label, thumbnail) pairs, two per row ---- */
  .frame-image .fill { height: auto; }
  .frame-image .fill > table { height: auto; }
  .frame-image table.stock-grid { width: 100%; }
  .frame-image table.stock-grid > tbody {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 27% minmax(0, 1fr) 27%;
    gap: 14px 8px;
    align-items: center;
    padding: 16px 0;
  }
  .frame-image table.stock-grid tr { display: contents; }
  .frame-image table.stock-grid td[width], .frame-image table.stock-grid td.gone { display: none; } /* spacer cells, hidden entries */
  .frame-image table.stock-grid td img { width: 100%; height: auto; box-sizing: border-box; }

  /* ---- panoramas / objects: viewer on top, thumbnails below ---- */
  .split { display: flex; flex-direction: column; height: auto; }
  .split > * { overflow: visible; }
  .vr-menu, .vr-frame { height: auto; }
  .vr-frame { order: -1; padding: 8px 8px 0; }
  .vr {
    width: 100% !important;
    max-width: var(--w);
    height: auto !important;
    aspect-ratio: var(--ar);
    margin-top: 0 !important;
  }
  .vr-note { margin-top: 6px !important; white-space: normal; }
  .vr-menu { padding-top: 0; }
  .vr-hdr { margin-top: 12px; }
  .vr-thumb, .vr-thumb img { max-width: 100%; height: auto; }
  .vr-cap { white-space: normal; }

  /* ---- gallery windows (stock/<name>/, assignments/shoes/) ---- */
  body.quirk-img { margin: 8px; }
  body.quirk-img img { max-width: 100%; height: auto; }
  body.quirk-img table { max-width: 100%; }
  table.gallery-thumbs { width: 100% !important; height: auto !important; }
  table.gallery-thumbs > tbody {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  table.gallery-thumbs tr { display: contents; }
  table.gallery-thumbs td { min-width: 0; }
  table.gallery-thumbs td:not(:has(a)) { display: none; } /* &nbsp; filler cells */
}
