﻿/* Responsive additions for artbadal.com. Original styles are retained. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: border-box; }
img { max-width: 100%; height: auto; }
body { max-width: 100%; overflow-x: hidden; }
@media screen and (max-width: 760px) {
  #nav { width: 100%; max-width: 100%; height: auto; margin: 0 auto; padding: 10px 12px 8px; }
  #navlist { width: 100%; padding: 0; margin: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; }
  #navlist li { display: flex; align-items: center; padding: 0; margin: 0; }
  #navlist li.last { padding-right: 0; }
  #navlist img { display: block; max-width: 100%; height: auto; }
  #mainContentText { width: 100%; height: auto; padding: 0 16px; }
  #mainText { width: 100%; max-width: 560px; margin: 30px auto 0; padding: 0 0 22px; font-size: 16px; line-height: 1.55; overflow-wrap: anywhere; }
  #mainText p { line-height: 1.55; }
  #mainText img { max-width: 100%; height: auto; }
  .gradPage { background-attachment: scroll; }
  #mainContent { width: 100%; max-width: 100%; }
  #mainContent > img[align="left"] { float: left; max-width: min(38%, 300px); height: auto; margin: 0 16px 12px 0; }
  #footer, #footerText, #footerScroller { height: auto; padding: 0 12px; }
  #footer p, #footerText p, #footerScroller p { line-height: 1.5; overflow-wrap: anywhere; }
  body.gallery-page #mainContent { position: relative; width: 100%; height: calc(100vh - 115px); height: calc(100svh - 115px); min-height: 360px; max-height: 780px; overflow: hidden; }
  body.gallery-page #imageFlow { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
  body.gallery-page #imageFlow .text { width: 100%; left: 0; }
  body.gallery-page #imageFlow .scrollbar { width: calc(100vw - 32px); max-width: 600px; margin-left: auto; margin-right: auto; }
  body.gallery-page #textAlign { width: 100%; max-width: 600px; left: 0; right: 0; margin-left: auto; margin-right: auto; padding: 0 8px; overflow-wrap: anywhere; }
}
@media screen and (max-width: 480px) {
  body { margin: 0; }
  #nav { padding: 8px 8px 6px; }
  #navlist { gap: 7px 8px; }
  #mainContent > h2 { margin: 0; padding: 0 14px; font-weight: normal; line-height: 1.55; }
  #mainContent > h2 > img:first-child { display: block; float: none !important; width: min(100%, 320px); max-width: 100%; height: auto !important; margin: 8px auto 18px; }
  #mainContent table { width: 100%; max-width: 100%; }
  #mainContent td { padding: 10px 0 !important; }
  #mainContent > img[align="left"] { display: block; float: none; width: min(100%, 300px); max-width: 100%; margin: 0 auto 18px; }
  body.gallery-page #mainContent { height: calc(100vh - 105px); height: calc(100svh - 105px); min-height: 340px; }
  body.gallery-page #imageFlow .title { font-size: 1em; }
  body.gallery-page #imageFlow .legend { font-size: .9em; }
}

/* Mobile corrections: article flow, complete photographs and footer placement. */
@media screen and (max-width: 760px) {
  html, body {
    height: auto !important;
    min-height: 100%;
  }

  body.gradPage {
    height: auto !important;
    min-height: 100%;
    background-attachment: scroll;
    background-image: linear-gradient(to bottom, #000000 0, #525252 360px);
    background-repeat: no-repeat;
    background-size: 100% 360px;
    background-color: #525252;
  }

  body.gradPage #wrapper {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  body.gradPage #mainContentText {
    display: flow-root;
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 16px 12px;
    overflow: visible !important;
  }

  body.gradPage #mainText {
    box-sizing: border-box;
    width: 100%;
    max-width: 560px;
    height: auto !important;
    min-height: 0 !important;
    margin: 24px auto 0;
    padding: 0 0 8px;
    overflow: visible !important;
    overflow-wrap: break-word;
  }

  body.gradPage #mainText p {
    max-width: 100%;
  }

  body.gradPage #mainContentText img {
    max-width: 100%;
    height: auto !important;
    object-fit: contain;
    object-position: center;
  }

  body.gradPage #footerText {
    display: block;
    position: static !important;
    clear: both;
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    margin: 18px 0 0;
    padding: 8px 0 4px;
    overflow: visible !important;
    text-align: center;
  }

  body.gradPage #footerText p {
    margin: 0;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  body.gradPage .clearfloat {
    display: block;
    clear: both;
    height: 0;
  }

  /* Keep the gallery viewport, but make every ImageFlow slide fit its width. */
  body.gallery-page #mainContent {
    overflow: hidden;
  }
}

/* Mobile text pages: keep long content in normal flow above the copyright footer. */
@media screen and (max-width: 760px) {
  body.gradPage #mainContentText {
    display: block;
    position: relative;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding-bottom: 0 !important;
  }
  body.gradPage #mainText {
    display: block;
    position: relative;
    float: none !important;
    height: auto !important;
    min-height: 0 !important;
    margin-bottom: 0 !important;
    padding-bottom: 16px !important;
    overflow: visible !important;
  }
  body.gradPage #footerText {
    display: block;
    position: relative !important;
    float: none !important;
    clear: both !important;
    box-sizing: border-box;
    height: auto !important;
    min-height: 0 !important;
    margin: 12px 0 0 !important;
    padding: 8px 12px 12px !important;
    background: transparent;
  }
}
