/* Phone and tablet layout of the content pages shown in the site's frame: shop overview and
   product pages, Wir ueber uns, Das Besondere, Telefonberatung, Fragen, Kontakt, AGB, Datenschutz,
   Impressum. Desktop is untouched: every rule sits in the same media query the rest of the site uses
   for its mobile layout.

   On phones the page is laid out 900px wide (js/mobile-viewport.js) and shrunk to the screen, and
   the content frame is 882px wide: 1 CSS pixel is about 0.4 screen pixels, so sizes are large here
   (36px text is about 15px on the phone). Tablets shrink less, so --s scales everything down there.

   The desktop tables are turned into stacked blocks; js/mobile-content.js marks the cells that only
   hold spacers ("leer") so they can be hidden. */

@media only screen and (max-device-width: 999px) {
  html {
    --s: 1;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  /* White like on desktop: the grey text is hard to read on the dark mobile frame. */
  body {
    margin: 0;
    padding: 0 calc(18px * var(--s));
    background-color: #FFFFFF;
  }

  /* Tables become stacked blocks. */
  table, tbody, tr, td {
    display: block;
    width: auto !important;
    height: auto !important;
    box-sizing: border-box;
  }
  td {
    line-height: normal !important;
    text-align: left;
  }
  td.leer,
  img[src*="blind_gif"],
  img[src*="lutzpix"] {
    display: none !important;
  }

  /* Text. Base size for text without a class (cells need it too: these old pages run in quirks
     mode, where tables do not inherit the font size). */
  body, td, th {
    font-size: calc(34px * var(--s));
    line-height: calc(48px * var(--s));
  }
  img, iframe, object, embed {
    max-width: 100%;
  }
  img {
    height: auto;
  }
  /* Pictures nudged sideways for the desktop columns (e.g. the team photo on Wir ueber uns). */
  img[style*="translate"] {
    transform: none !important;
  }
  h1 { font-size: calc(48px * var(--s)); line-height: 1.25; }
  h2 { font-size: calc(44px * var(--s)); line-height: 1.25; }
  h3, h4 { font-size: calc(38px * var(--s)); line-height: 1.25; }
  .grundtext, .grundtext_fett, .grundtext_schwarz, .preis, .navigation {
    font-size: calc(34px * var(--s)) !important;
    line-height: calc(48px * var(--s)) !important;
  }
  .horoskop_datum, .shop-ueberschrift_fett {
    font-size: calc(38px * var(--s)) !important;
    line-height: calc(52px * var(--s)) !important;
  }
  .horoskop_ueberschrift_3, .horoskop_ueberschrift_4 {
    font-size: calc(42px * var(--s)) !important;
    line-height: calc(56px * var(--s)) !important;
  }
  .grundtext_personen, .grundtext_personen_3 {
    font-size: calc(36px * var(--s)) !important;
    line-height: calc(50px * var(--s)) !important;
  }
  .grundtext_personen_2 {
    font-size: calc(40px * var(--s)) !important;
    line-height: calc(54px * var(--s)) !important;
  }
  .horoskop_ueberschrift, .horoskop_ueberschrift_2 {
    font-size: calc(42px * var(--s)) !important;
    line-height: calc(56px * var(--s)) !important;
  }
  ol {
    padding-left: calc(56px * var(--s)) !important;
    margin-bottom: 0 !important;
  }
  ol li {
    font-size: calc(40px * var(--s));
  }
  /* overflow-wrap: long web addresses written out in the text (Datenschutz) break instead of
     making the page wider than the screen. */
  p {
    margin: calc(16px * var(--s)) 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }
  td, li {
    overflow-wrap: break-word;
  }
  a {
    word-wrap: break-word;
  }

  /* Overview: each product row becomes a card, picture and price tag side by side. */
  tr.produkt {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas: "bild preis" "text text" "link link";
    align-items: center;
    margin: 0 0 calc(28px * var(--s)) 0;
    padding: calc(20px * var(--s));
    background-color: #CCCCCC;
    border-radius: calc(16px * var(--s));
  }
  tr.produkt > td { padding: 0; }
  tr.produkt > td:nth-child(1) { display: none; }
  tr.produkt > td:nth-child(2) { grid-area: bild; }
  tr.produkt > td:nth-child(3) { grid-area: text; padding: calc(16px * var(--s)) 0; }
  tr.produkt > td:nth-child(4) { grid-area: preis; text-align: right; }
  tr.produkt > td:nth-child(5) { grid-area: link; }
  tr.produkt > td:nth-child(2) img {
    width: calc(272px * var(--s));
    height: auto;
  }
  tr.produkt > td:nth-child(2) p { margin: 0; }
  tr.produkt > td:nth-child(4) img {
    width: calc(230px * var(--s));
    height: auto;
    margin: 0;
  }
  tr.produkt > td:nth-child(5) a {
    display: block;
    padding: calc(18px * var(--s));
    background-color: #B40000;
    border-radius: calc(12px * var(--s));
    text-align: center;
    text-decoration: none;
  }
  tr.produkt > td:nth-child(5) a span {
    color: #FFFFFF !important;
  }
  tr.produkt > td:nth-child(5) br,
  tr.produkt > td:nth-child(5) a:empty {
    display: none;
  }
  /* Telephone price and "not available" (CSS boxes, not images) at the same size as the tags. */
  .preis_text, a.preis_text:link, a.preis_text:visited {
    width: calc(230px * var(--s)) !important;
    height: calc(136px * var(--s)) !important;
    font-size: calc(48px * var(--s)) !important;
    line-height: calc(136px * var(--s)) !important;
    margin: 0 !important;
  }
  .preis_text_nicht_lieferbar {
    height: calc(102px * var(--s)) !important;
    padding-top: calc(34px * var(--s)) !important;
    font-size: calc(28px * var(--s)) !important;
    line-height: calc(34px * var(--s)) !important;
  }

  /* Overview: offer date under the heading, shopping cart link and the four-step explanation. */
  b[style*="1.25rem"] {
    font-size: calc(42px * var(--s)) !important;
  }
  #warenkorbLink a span {
    font-size: calc(38px * var(--s)) !important;
  }
  #warenkorbLink img[src*="cart"] {
    width: calc(100px * var(--s));
    height: auto;
  }
  td[style*="background-color:#ae0000"],
  td[style*="background-color:#cccccc"] {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: calc(36px * var(--s)) !important;
    line-height: calc(50px * var(--s)) !important;
    padding: calc(12px * var(--s)) calc(18px * var(--s)) !important;
  }
  td[style*="font-size:28px"] {
    font-size: calc(48px * var(--s)) !important;
    text-align: left !important;
  }

  /* Product pages: big product picture, price options, offer note. */
  img[src*="shopgross"] {
    width: calc(440px * var(--s));
    height: auto;
  }
  .prognose_wahl {
    font-size: calc(36px * var(--s)) !important;
    line-height: calc(50px * var(--s)) !important;
    padding: calc(16px * var(--s)) calc(20px * var(--s)) !important;
    margin-bottom: calc(14px * var(--s)) !important;
  }
  .prognose_wahl input {
    width: calc(36px * var(--s));
    height: calc(36px * var(--s));
    margin-right: calc(14px * var(--s)) !important;
    vertical-align: -4px !important;
  }
  span[style*="background-color:#FFF200"] {
    font-size: calc(36px * var(--s)) !important;
    line-height: calc(48px * var(--s)) !important;
    padding: calc(6px * var(--s)) calc(14px * var(--s)) !important;
  }

  /* Product pages: order form, label above its field. */
  input[type="text"], input[type="date"], input[type="time"], select, textarea {
    display: block;
    width: 100%;
    min-width: 100%;
    box-sizing: border-box;
    margin: calc(6px * var(--s)) 0 calc(10px * var(--s)) 0;
    padding: calc(12px * var(--s)) calc(16px * var(--s));
    min-height: calc(80px * var(--s));
    font-size: calc(38px * var(--s));
    font-family: Verdana, Arial, Helvetica, sans-serif;
  }
  textarea {
    min-height: calc(260px * var(--s));
  }
  input[type="submit"] {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    margin: calc(20px * var(--s)) 0;
    padding: calc(24px * var(--s));
    border: 0;
    border-radius: calc(14px * var(--s));
    background-color: #B40000;
    color: #FFFFFF;
    font-size: calc(40px * var(--s));
    font-weight: bold;
  }
  input[type="submit"]:disabled {
    background-color: #999999;
  }
  tr[bgcolor="#CCCCCC"] > td {
    padding: calc(4px * var(--s)) calc(18px * var(--s)) !important;
  }
}

/* Tablets shrink the page less than phones: same layout, smaller sizes. */
@media only screen and (max-device-width: 999px) and (min-device-width: 600px) {
  html { --s: 0.6; }
}
