/* Phones (a narrow, upright screen): the same pages in one column.
 * Loaded last on every page, and only takes effect at 900px wide or less (phones, and tablets held upright), so the desktop layout is untouched.
 * Both themes are covered: the 2011 "breakbit" pages (home, artists, releases, news) and the 2012 "breakbit_8"
 * artist and release pages. */
/* the album page's row of square link icons (built by release.js) is only for phones; wide screens keep the side menu */
.svcbar, #newstop { display: none; }   /* phone-only parts: the album icon row, the news page year buttons and folding blog list */

@media (max-width: 900px) {
  html { overflow-x: hidden; }
  body, #_body { min-width: 0 !important; }
  /* the 1280px background picture sticks out past the screen; "clip" (not "hidden") so nothing can scroll it sideways */
  body.b8 #_body, #bodybg { overflow: hidden; overflow: clip; }
  /* "clip" (unlike "hidden") lets the first box's top margin leak out above the page and open a dark gap under the header: keep it in */
  body.b8 #_body, #bodybg { display: flow-root; }
  body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

  /* header: logo on the left; on the right the search box, with the three page tabs under it, the search box as wide as the three */
  #bbtop { height: auto; padding-bottom: 22px; }   /* 96px tall, like the desktop header: the background picture starts at 96px */
  #bbtop .in { width: auto; padding: 0 12px; display: flex; justify-content: space-between; align-items: flex-start; }
  #bbtop a.logo { float: none; height: 62px; margin: 12px 0 0; }
  #bbtop a.logo img { height: 62px; }
  #bbtop .nav { float: none; margin: 12px 0 0; display: grid; grid-template-columns: auto auto auto; column-gap: 6px; row-gap: 6px; }
  #bbtop .nav a.tab { margin: 0; grid-row: 2; text-align: center; }
  #bbtop .nav form { grid-row: 1; grid-column: 1 / -1; float: none; display: flex; }
  #bbtop .nav form input.q { flex: 1; min-width: 0; width: auto; font-size: 16px; }
  #bbtop .in > #clearfix { display: none; }

  /* the 2011 pages: one column, sidebar under the main column */
  #titlearea, #page, #artistlogo { width: auto; }
  #titlearea { margin: 12px 10px; }
  /* home page spotlight: Prev / Next sit at its bottom-left; room under them before the Featured releases box */
  #titlearea:has(#ABGbut) { margin-bottom: 26px; }
  ul#ABGbut { left: 4px; }
  /* one cover instead of the stack of three, and the artist name (or logo) kept to the space left of it */
  #ABGalbums ul#thumbnails li._frontpage:not(.first) { display: none; }
  a.ABGartistlink { box-sizing: border-box; padding: 40px 160px 40px 0; background-origin: content-box; background-size: contain; }
  a.ABGartistlink .ABGname { position: static; display: block; margin-top: 0; padding-top: 0; font-size: 30px; line-height: 32px; letter-spacing: -2px; overflow-wrap: anywhere; }
  a.ABGartistlink { display: flex; align-items: center; }
  #notsidebar, #sidebar { float: none; width: auto; }
  #page { margin: 0 10px; }
  /* Artist and Release Index: search, then the results, then About the Archive at the bottom */
  #page[data-kind="artists"], #page[data-kind="releases"] { display: flex; flex-direction: column; }
  #page[data-kind="artists"] #sidebar, #page[data-kind="releases"] #sidebar { display: contents; }
  #page[data-kind] #panel.about { order: 2; }
  #page[data-kind] #notsidebar { padding-top: 0; }
  #page[data-kind] #notsidebar #panel { min-height: 0 !important; }
  #page[data-kind] #sidebar > #panel:first-child { margin-top: 10px; }
  #page[data-kind] #panel select, #page[data-kind] #panel input[type="text"] { max-width: 100%; font-size: 16px; }

  /* release tiles: three across, each a third of the column */
  ul#thumbnails { width: auto !important; }
  ul#thumbnails li._releasetiles { width: 33.333%; height: auto; top: 0; left: 0; padding: 0 6px 8px 0 !important; box-sizing: border-box; vertical-align: top; background: none; }
  ul#thumbnails li._releasetiles #fullcontents { position: relative; top: 0; left: 0; }
  ul#thumbnails li._releasetiles #image { position: relative; top: 0; left: 0; width: 100%; height: auto; padding-top: 100%; }
  ul#thumbnails li._releasetiles #image img { top: 2px; left: 2px; width: calc(100% - 4px); height: calc(100% - 4px); }
  ul#thumbnails li._releasetiles #container { position: static; width: auto; padding: 4px 2px 2px; }
  ul#thumbnails li._releasetiles #container p { padding-right: 0; }
  ul#thumbnails li._releasetiles .newtag { width: auto; right: 2px; }
  ul#thumbnails li._releasetiles:hover { box-shadow: none; background: none; }

  /* wide list rows (search results, discography) */
  ul#thumbnails li._listhuge, ul#thumbnails li._listhuge #fullcontents { width: 100%; }
  ul#thumbnails li._listhuge #container { width: auto; right: 60px; left: 0; }
  ul#thumbnails li._listhuge h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px; }

  /* folding panels (index search boxes, news Blogs list): the heading opens and closes them, with a triangle at its right (bb.js) */
  .foldpanel h2.foldhead { position: relative; cursor: pointer; padding-right: 24px; user-select: none; -webkit-tap-highlight-color: transparent; }
  .foldpanel .foldarrow { position: absolute; right: 4px; top: 50%; margin-top: -4px; width: 0; height: 0;
    border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 8px solid #ddd; transition: transform 0.15s ease-out; }
  .foldpanel.closed .foldarrow { transform: rotate(180deg); }
  .foldpanel.closed .foldbody { display: none !important; }
  .foldpanel.closed { padding-bottom: 6px; }

  /* news page: year buttons and the folding Blogs list at the top instead of in the sidebar */
  #newstop { display: block; padding-top: 10px; }
  .newsside-archive, .newsside-blogs { display: none; }
  .newsyears { display: flex; gap: 4px; margin-bottom: 10px; }
  .newsyears a { flex: 1 1 0; min-width: 0; padding: 10px 0; text-align: center; background: #333; color: #ddd; font-weight: bold; text-decoration: none; white-space: nowrap; }
  .newsyears a.on { background: #DDD; color: #222; }
  .newsyears a:first-child { flex-grow: 1.4; }
  #newstop .newsblogs ul.newsfilter { margin-top: 8px; }
  #page[data-kind="news"] #sidebar { display: flex; flex-direction: column; }
  #page[data-kind="news"]:not(.single) #sidebar #panel.about { order: -1; }   /* lists: About the Archive right under the page numbers (a single post keeps it under More from…) */

  /* news posts: less padding, pictures on their own line instead of beside narrow text */
  .story.newsstory { padding: 10px 2px; }
  .newsstory .alignright, .newsstory .alignleft { float: none; display: block; margin: 10px auto; }
  .newsstory img { float: none !important; }
  .newsnav a.newer, .newsnav a.older { max-width: 46%; }
  .newsnav.pages a, .newsnav.pages b { padding: 6px 9px; margin: 0 3px 4px 0; }
  ul.newsfilter { column-count: 2; column-gap: 16px; }
  ul.newsfilter li { break-inside: avoid; }

  /* ---- the 2012 artist and release pages ---- */
  #bigtitle { width: auto; margin: 14px 10px; padding: 0; min-height: 0; }
  #bigtitle h1 { font-size: 34px; line-height: 34px; letter-spacing: -2px; overflow-wrap: anywhere; }
  #bigtitle h1 img, h1 img.artistlogo, #artisttitle img { max-width: 100%; max-height: 90px; }
  #bigtitle p.by { font-size: 17px; line-height: 21px; }
  #bigtitle .floatright img { width: 56px; height: 56px; border-width: 2px; }
  body.b8 #page, #page.tabs { width: auto; margin: 0 10px; padding: 10px 10px 0; }
  /* menu: the tabs in a row. The side menu's link buttons are replaced by the icon row under the info box (.svcbar) */
  #tabsidebar { float: none; width: auto; }
  ul#sidebaractions { display: none; }
  .svcbar { display: flex; justify-content: center; gap: 6px; margin: 0 0 10px; }
  .svcbar .svc { flex: 1 1 0; min-width: 0; max-width: 56px; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
    background: #2a782c; border: 1px solid #111; box-sizing: border-box; }
  .svcbar .svc img { display: block; width: 18px; height: 18px; }
  .svcbar .svc.off { background: #2c2c2c; cursor: default; }
  .svcbar .svc.off img { opacity: 0.25; filter: grayscale(1); }
  ul#tabs.tabsidebar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 0; }
  ul#tabs.tabsidebar li { flex: 1 1 auto; width: auto; margin: 0; text-align: center; }
  ul#tabs.tabsidebar li a { padding: 12px 10px; }
  /* artist pages: Discography goes last, so when the tabs need two rows it is the one on the second row, full width */
  ul#tabs.tabsidebar li#discography { order: 1; }
  ul#tabscontent { float: none; width: auto !important; min-height: 0; margin: 0 -10px; padding: 10px; }
  ul#tabscontent li #notsidebar, ul#tabscontent li #sidebar, ul#tabscontent #sidebar { float: none; width: auto; }
  /* release info: the cover first, the details under it (they sat side by side over the blurred cover) */
  #panel.artwork { height: auto; background-size: cover; }
  #panel.artwork #overlay { height: auto; padding: 14px 0 0; }
  #releaseart { position: relative; left: 0; margin: 0 auto; width: 240px; height: 240px; }
  #releasedesc { position: static; right: auto; padding: 14px 0 0; background: none; }
  #scroller.releasedesc { height: auto; }
  /* if the page was opened wide and then narrowed, the desktop scroll box (flexcroll.js) is already built: undo its fixed sizes */
  #scroller.releasedesc .mcontentwrapper, #scroller.releasedesc .scrollwrapper { width: auto !important; height: auto !important; position: static !important; }
  #scroller.releasedesc .scrollgeneric { display: none !important; }
  /* section headings (the blog post title is one) can run to two lines */
  body.b8 #section > h2 { height: auto; min-height: 20px; line-height: 13px; padding-bottom: 6px; }
  .story img.artistphoto { float: none; display: block; margin: 0 auto 12px; width: 200px; height: 200px; }
  #artistart { position: relative; left: 0; margin: 0 auto 10px; width: 200px; height: auto; }
  /* track lists: no Popular / Facebook columns, and a narrower artist column */
  #BBP .Cpopular, #BBP .Cfacebook { display: none; }
  #BBP .Cartist { max-width: 90px !important; min-width: 0 !important; width: 90px !important; }
  #BBP .Clength { max-width: 40px; min-width: 0; width: 40px; }
  #BBP .Cartist { max-width: 70px !important; width: 70px !important; }
  #BBP .Cdownload, #BBP .Cgo { max-width: 34px; min-width: 0; width: 34px; padding-left: 4px; }
  #BBP tr a.downloadtrack { width: 22px; }
  #BBP tr a.downloadtrack .small { display: none; }

  /* the 2012 pages' release tiles (More from…, Discography box): three across like the 2011 pages */
  body.b8 ul#thumbnails._releasetiles { width: auto; margin-right: -6px; }
  body.b8 ul#thumbnails li._releasetiles { margin: 0; overflow: visible; }
  body.b8 ul#thumbnails li._releasetiles #fullcontents { height: auto; }
  body.b8 ul#thumbnails li._releasetiles #container { font-size: 12px; line-height: 15px; padding: 4px 2px 2px; }
  body.b8 ul#thumbnails li._releasetiles #image img { position: absolute; }
  body.b8 ul#thumbnails li._releasetiles:hover { border: none; padding: 0 6px 8px 0; top: 0; left: 0; }

  /* comments: replies indented less, so deep threads keep room for their text */
  ul.cmtlist ul.cmtlist { margin-left: 18px; }

  /* footer: just the logo column (logo, then the text and links under it); the artist columns are left off */
  #footer, body.b8 #footer { min-height: 0; }
  #footer ul.footer, body.b8 #footer ul.footer { width: auto; padding: 0 10px; display: flex; flex-wrap: wrap; }
  #footer ul.footer li.section.first, body.b8 #footer ul.footer li.section.first { width: 100%; min-height: 0; margin-top: 30px; border: none; }
  #footer ul.footer li.section:not(.first), #footer #footerartists { display: none !important; }
}
/* wider than a phone (a tablet held upright, a small window): more tiles to a row */
@media (min-width: 560px) and (max-width: 900px) {
  ul#thumbnails li._releasetiles { width: 25%; }
  ul.cmtlist ul.cmtlist { margin-left: 46px; }
}
@media (min-width: 720px) and (max-width: 900px) {
  ul#thumbnails li._releasetiles { width: 20%; }
}

/* Home page on narrow screens: the Featured releases grid ends on a full row (the tiles that would start a part-filled
   last row are left off: 3, 4 or 5 to a row, as set above), and the News archive box in the sidebar is left off */
@media (max-width: 900px) {
  #panel.newspanel { display: none; }
}
@media (max-width: 559px) {
  ul#thumbnails.newreleases > li:nth-child(3n+1):nth-last-child(-n+2), ul#thumbnails.newreleases > li:nth-child(3n+1):nth-last-child(-n+2) ~ li { display: none !important; }
}
@media (min-width: 560px) and (max-width: 719px) {
  ul#thumbnails.newreleases > li:nth-child(4n+1):nth-last-child(-n+3), ul#thumbnails.newreleases > li:nth-child(4n+1):nth-last-child(-n+3) ~ li { display: none !important; }
}
@media (min-width: 720px) and (max-width: 900px) {
  ul#thumbnails.newreleases > li:nth-child(5n+1):nth-last-child(-n+4), ul#thumbnails.newreleases > li:nth-child(5n+1):nth-last-child(-n+4) ~ li { display: none !important; }
}

/* touch screens (phones, tablets): no Game tab, since the Flash games need a mouse and keyboard.
   !important: the pages show the tab with an inline style when the release or artist has a game */
@media (hover: none) and (pointer: coarse) {
  ul#tabs li#game { display: none !important; }
}
