/* Nimfa responsive layout: scoped to upgraded pages only. */

.sc-responsive .sc-private-shell {
  width: 90% !important;
  max-width: calc(100% - 16px) !important;
  table-layout: fixed;
}

.sc-responsive .sc-private-shell .sc-private-index,
.sc-responsive .sc-private-shell .sc-gallery-index,
.sc-responsive .sc-private-shell .sc-gallery-tabs,
.sc-responsive .sc-private-shell .sc-gallery-grid {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
}

@media screen and (max-width: 920px) {
  body.sc-responsive {
    box-sizing: border-box;
    max-width: 100%;
    margin: 0;
    padding: 0 0 110px;
    overflow-x: hidden;
    background-attachment: scroll;
  }

  .sc-responsive *,
  .sc-responsive *::before,
  .sc-responsive *::after {
    box-sizing: border-box;
  }

  .sc-responsive .sc-page-shell {
    width: 100% !important;
    max-width: 100% !important;
    margin-right: auto;
    margin-left: auto;
    table-layout: fixed;
  }

  .sc-responsive table,
  .sc-responsive td {
    max-width: 100% !important;
  }

  .sc-responsive .sc-page-shell > tbody > tr > td {
    width: auto !important;
    max-width: 100% !important;
    padding-right: 10px;
    padding-left: 10px;
  }

  .sc-responsive img {
    max-width: 100% !important;
    height: auto !important;
  }

  .sc-responsive p,
  .sc-responsive span,
  .sc-responsive font,
  .sc-responsive a {
    overflow-wrap: anywhere;
  }

  .sc-responsive dl,
  .sc-responsive dd,
  .sc-responsive form,
  .sc-responsive select,
  .sc-responsive input {
    max-width: 100% !important;
  }

  .sc-responsive dl,
  .sc-responsive dd {
    margin-right: 0;
    margin-left: 0;
  }

  .sc-responsive .sc-mobile-nav,
  .sc-responsive .sc-mobile-nav table {
    width: 100% !important;
  }

  .sc-responsive .sc-mobile-nav table {
    max-width: 500px !important;
    margin-right: auto;
    margin-left: auto;
    table-layout: fixed;
  }

  .sc-responsive .sc-mobile-nav td {
    width: 20% !important;
    min-width: 0;
    max-width: 20%;
  }

  .sc-responsive .sc-mobile-nav img {
    display: block;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
  }

  .sc-responsive .sc-free-preview {
    width: 100% !important;
    max-width: 100% !important;
  }

  .sc-responsive .sc-private-index,
  .sc-responsive .sc-private-index table {
    width: 100% !important;
    max-width: 100% !important;
  }

  .sc-responsive .sc-private-index .sc-gallery-index,
  .sc-responsive .sc-private-index .sc-gallery-tabs,
  .sc-responsive .sc-private-index .sc-gallery-grid {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .sc-responsive .sc-preview-latest {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .sc-responsive .sc-preview-card,
  .sc-responsive .sc-preview-label,
  .sc-responsive .sc-preview-image {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .sc-responsive .sc-photo-grid {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
  }

  .sc-responsive .sc-photo-grid > tbody {
    display: block;
  }

  .sc-responsive .sc-photo-grid > tbody > tr {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }

  .sc-responsive .sc-photo-grid > tbody > tr > td {
    display: block;
    flex: 0 1 50%;
    width: 50% !important;
    height: auto !important;
    padding: 6px !important;
  }

  .sc-responsive .sc-photo-grid > tbody > tr > td:empty {
    display: none !important;
    padding: 0 !important;
  }

  .sc-responsive .sc-photo-grid img {
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
  }
}

@media screen and (max-width: 767px) {
  body.sc-responsive {
    padding-bottom: 180px;
  }
}

/* SC main logo responsive sizing v5: never enlarge beyond 500x300. */
.sc-responsive img[src*="mainlogo"] {
  display: block;
  width: auto !important;
  max-width: 500px !important;
  max-height: 300px !important;
  height: auto !important;
  margin-right: auto;
  margin-left: auto;
}

@media screen and (max-width: 519px) {
  .sc-responsive img[src*="mainlogo"] {
    width: calc(100vw - 20px) !important;
  }
}

/* SC legacy mobile layout refinements v1 */
@media screen and (max-width: 920px) {
  /* Do not retain a desktop logo-cell height after the logo shrinks. */
  .sc-responsive .sc-page-shell > tbody > tr:first-child > td[height] {
    height: auto !important;
  }

  /* Constrain deeply nested custom-content tables without touching navigation or galleries. */
  .sc-responsive .sc-page-shell > tbody > tr > td > div[align]:not(.sc-mobile-nav):not(.sc-free-preview):not(.sc-private-index):not(.sc-gallery-index) {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .sc-responsive .sc-page-shell > tbody > tr > td > div[align]:not(.sc-mobile-nav):not(.sc-free-preview):not(.sc-private-index):not(.sc-gallery-index) > center,
  .sc-responsive .sc-page-shell > tbody > tr > td > div[align]:not(.sc-mobile-nav):not(.sc-free-preview):not(.sc-private-index):not(.sc-gallery-index) table {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .sc-responsive .sc-page-shell > tbody > tr > td > div[align]:not(.sc-mobile-nav):not(.sc-free-preview):not(.sc-private-index):not(.sc-gallery-index) td {
    width: auto !important;
    max-width: 100% !important;
  }
}

/* SC direct legacy content-table mobile fix v1 */
@media screen and (max-width: 920px) {
  /* Old thumbnail pages place their grid directly inside the page cell. */
  .sc-responsive .sc-page-shell > tbody > tr > td > table:not(.sc-mobile-nav):not(.sc-free-preview):not(.sc-private-index):not(.sc-gallery-index) {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
  }

  .sc-responsive .sc-page-shell > tbody > tr > td > table:not(.sc-mobile-nav):not(.sc-free-preview):not(.sc-private-index):not(.sc-gallery-index) td {
    box-sizing: border-box !important;
    width: auto !important;
    max-width: 100% !important;
  }

  .sc-responsive .sc-page-shell > tbody > tr > td > table:not(.sc-mobile-nav):not(.sc-free-preview):not(.sc-private-index):not(.sc-gallery-index) img {
    max-width: 100% !important;
    height: auto !important;
  }
}
