/*
 * mobile.css - phone layout for agapartments.com
 *
 * Linked on every page AFTER aaronglen.css. Everything that changes the
 * look is inside the (max-width: 768px) block, so the desktop layout is
 * untouched. The one rule outside it keeps the tap-to-call phone links
 * looking like plain text on desktop.
 */

/* Footer phone numbers are tap-to-call links; on desktop they look like plain text */
a[href^="tel:"],
a[href^="tel:"]:link,
a[href^="tel:"]:visited,
a[href^="tel:"]:hover {
  color: inherit;
  text-decoration: none;
}

/* Phone menu button (added by mobile.js) is never shown on desktop */
.menu-button {
  display: none;
}

@media (max-width: 768px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  body {
    margin: 0;
  }

  /* ---------------------------------------------------------------
   * Stack the table layout: photo column above the text, full width
   * --------------------------------------------------------------- */
  table,
  table > tbody,
  table > tbody > tr,
  table > tbody > tr > td {
    display: block;
    width: auto !important;
    box-sizing: border-box;
  }
  #stripe {
    padding: 12px;
  }
  #content {
    padding: 12px 0 0;
  }

  /* Pictures, videos and the parking map shrink to fit the screen */
  img,
  video,
  object,
  embed {
    max-width: 100%;
    height: auto;
  }

  /* Photo columns with several photos (Apartments, Guests, Location...):
     two photos per row instead of one long column */
  #stripe td:not(#content):has(> p:nth-of-type(2) > img) {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
  }
  #stripe td:not(#content):has(> p:nth-of-type(2) > img) > p {
    flex: 1 1 calc(50% - 8px);
    max-width: calc(50% - 4px);
    margin: 0;
  }
  #stripe td:not(#content):has(> p:nth-of-type(2) > img) > p:empty {
    display: none;
  }
  #stripe td:not(#content):has(> p:nth-of-type(2) > img) img {
    width: 100%;
  }

  /* ---------------------------------------------------------------
   * Readable text (the desktop design uses 70% size)
   * --------------------------------------------------------------- */
  p,
  ul {
    font-size: 15px;
    line-height: 1.5;
  }
  h1 {
    font-size: 19px;
  }
  h2 {
    font-size: 17px;
  }

  /* ---------------------------------------------------------------
   * Header: logo fits, menu becomes wrapping buttons
   * --------------------------------------------------------------- */
  body > div[align="right"] {
    text-align: center;
  }
  body > div[align="right"] img {
    display: block;
    margin: 8px auto;
    width: 90%;
    max-width: 484px;
  }
  #navcontainer ul {
    float: none;
    display: flex;
    flex-wrap: wrap;
    width: auto;
    margin: 0;
    font-size: 15px;
    border: none;
    border-top: 1px solid #000000;
  }
  #navcontainer ul li {
    display: block;
    flex: 1 1 50%;
    box-sizing: border-box;
    border-bottom: 1px solid #000000;
  }
  #navcontainer ul li:nth-child(odd) {
    border-right: 1px solid #000000;
  }
  #navcontainer ul li a,
  #navcontainer ul li a:link,
  #navcontainer ul li a:visited {
    color: #ffffff;
  }
  #navcontainer #uberlink a,
  #navcontainer #uberlink a:link,
  #navcontainer #uberlink a:visited,
  #navcontainer ul li a:hover {
    color: #000000;
  }
  #navcontainer ul li a {
    float: none;
    display: block;
    padding: 12px 8px;
    border-right: none;
    text-align: center;
  }

  /* ---------------------------------------------------------------
   * Hamburger menu (only when mobile.js has run; otherwise the
   * buttons above simply stay visible)
   * --------------------------------------------------------------- */
  .js-menu body > div[align="right"] td {
    position: relative;
  }
  .js-menu body > div[align="right"] img {
    width: calc(100% - 72px);
    margin: 10px 8px 10px auto;
  }
  .js-menu #navcontainer ul {
    display: none;
  }
  .js-menu #navcontainer.open ul {
    display: flex;
    flex-direction: column; /* single list when opened from the menu button */
  }
  .js-menu #navcontainer ul li {
    flex: none;
    border-right: none;
  }
  .js-menu #navcontainer ul li a {
    text-align: left;
    padding-left: 20px;
  }
  .menu-button {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0;
    left: 4px;
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
  }
  .menu-button span {
    display: block;
    width: 24px;
    height: 3px;
    margin: 3px 0;
    border-radius: 2px;
    background: #666699;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .menu-button.open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
  }
  .menu-button.open span:nth-child(2) {
    opacity: 0;
  }
  .menu-button.open span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
  }

  /* ---------------------------------------------------------------
   * Footer: centred, logo on its own line
   * --------------------------------------------------------------- */
  #footer {
    padding: 0 12px;
  }
  #footer p {
    text-align: center;
  }
  .secret-logo {
    float: none;
    display: block;
    width: 100px;
    margin: 12px auto 0;
  }
  a[href^="tel:"],
  a[href^="tel:"]:link,
  a[href^="tel:"]:visited {
    color: #666666;
    text-decoration: underline;
  }
}
