/*  ----------------------------------------------------------------------------
    Portal2017 - mobile improvements (phones, max-width 767px)
    Loaded after style.css. It only applies to small screens, the desktop layout is not changed.
    The colors use the theme color from the panel (--td-mobile-accent is set inline by functions.php)
*/

:root {
  --td-mobile-accent: #4db2ec;
  --td-mobile-text: #1f2328;
  --td-mobile-muted: #5f6670;
  --td-mobile-border: #e6e8eb;
  --td-mobile-gutter: 16px;
}

/* all the phones: no text inflation on rotation, crisp fonts, no blue tap flash */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (max-width: 767px) {

  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.06);
    overflow-x: hidden; /* safety net: no horizontal scroll */
  }

  /*  ---------------------------------------------------------------------------
      layout: comfortable side gutters (was 10px) + notch safe areas
  */
  .td-container {
    padding-left: max(var(--td-mobile-gutter), env(safe-area-inset-left));
    padding-right: max(var(--td-mobile-gutter), env(safe-area-inset-right));
  }
  .td-header-menu-wrap .td-container,
  .td-header-style-8 .td-header-menu-wrap .td-container {
    padding-left: 0;
    padding-right: 0;
  }
  img,
  iframe,
  video,
  embed,
  object {
    max-width: 100%;
  }
  .td-image-box-row {
    margin-left: 0;
    margin-right: 0;
  }

  /*  ---------------------------------------------------------------------------
      mobile header bar
  */
  #td-header-menu {
    min-height: 54px;
  }
  .td-mobile-logo-text {
    position: absolute;
    top: 0;
    left: 56px;
    right: 56px;
    height: 54px;
    line-height: 54px;
    text-align: center;
    color: #fff !important;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 1;
  }
  #td-top-mobile-toggle a,
  .td-header-wrap .td-search-btns-wrap,
  .td-header-wrap #td-header-search-button-mob {
    min-width: 48px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /*  ---------------------------------------------------------------------------
      typography - readable sizes for phones
  */
  .td-post-content,
  .td-post-content p,
  .td-page-content,
  .td-page-content p,
  .comment-content p {
    font-size: 17px;
    line-height: 1.65;
    color: var(--td-mobile-text);
  }
  .td-post-content p,
  .td-page-content p {
    margin-bottom: 20px;
  }
  .td-post-content h2 { font-size: 23px; line-height: 1.3; }
  .td-post-content h3 { font-size: 20px; line-height: 1.35; }
  .td-post-content h4 { font-size: 18px; line-height: 1.4; }
  .td-post-content blockquote p {
    font-size: 19px;
    line-height: 1.5;
  }
  .td-post-header .entry-title,
  .td-post-title .entry-title {
    font-size: 26px;
    line-height: 1.25;
    letter-spacing: -0.2px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
  }
  .td-post-sub-title {
    font-size: 17px;
    line-height: 1.5;
    color: var(--td-mobile-muted);
  }

  /* titles of the modules in lists / blocks */
  .td-module-title,
  .td-module-title a {
    overflow-wrap: anywhere;
  }
  .td_module_wrap .entry-title.td-module-title {
    line-height: 1.3;
  }

  /* meta: author, date, comments, views - were 9-11px and very light */
  .td-module-meta-info,
  .td-post-header .meta-info,
  .td-post-author-name,
  .td-post-date,
  .td-module-date,
  .td-post-views,
  .td-post-comments,
  .td-module-comments {
    font-size: 12px;
    line-height: 1.5;
  }
  .td-post-date,
  .td-module-date,
  .td-post-header .td-post-date .entry-date {
    color: var(--td-mobile-muted);
  }

  /* breadcrumbs */
  .entry-crumbs {
    font-size: 12px;
    line-height: 1.6;
    color: var(--td-mobile-muted);
    padding-top: 10px;
  }
  .entry-crumbs a {
    color: var(--td-mobile-muted);
  }

  /* category label */
  .td-category li a,
  .td-post-category {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 3px;
  }

  /*  ---------------------------------------------------------------------------
      images and videos: rounded, no layout jump
  */
  .td-post-featured-image img,
  .td-post-content img {
    border-radius: 6px;
    height: auto;
  }
  .td-post-featured-image {
    margin-bottom: 18px;
  }
  .td-post-content iframe[src*="youtube"],
  .td-post-content iframe[src*="vimeo"],
  .wpb_video_wrapper iframe {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
  }
  .td-module-thumb .entry-thumb {
    border-radius: 4px;
  }
  .wp-caption-text,
  .wp-caption-dd {
    font-size: 13px;
    line-height: 1.5;
    color: var(--td-mobile-muted);
  }

  /*  ---------------------------------------------------------------------------
      share buttons - full width row, big touch targets
  */
  .td-post-sharing .td-default-sharing {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    justify-content: stretch;
  }
  .td-post-sharing .td-default-sharing .td-social-sharing-buttons {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    height: 44px;
    line-height: 44px;
    margin: 0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .td-post-sharing .td-default-sharing .td-social-sharing-buttons .td-social-but-text {
    display: none;
  }
  .td-post-sharing .td-default-sharing .td-social-sharing-buttons i {
    position: static;
    line-height: 44px;
    font-size: 16px;
  }
  .td-post-sharing-top {
    margin-bottom: 18px;
  }

  /*  ---------------------------------------------------------------------------
      touch targets: pagination arrows, load more, page numbers
  */
  .td-next-prev-wrap a {
    width: 40px;
    height: 40px;
    line-height: 38px;
    font-size: 14px;
    margin-right: 8px;
    border-radius: 6px;
  }
  .td-load-more-wrap a {
    padding: 12px 24px;
    font-size: 13px;
    border-radius: 6px;
  }
  .page-nav a,
  .page-nav span {
    min-width: 40px;
    height: 40px;
    line-height: 38px;
    padding: 0 10px;
    margin: 0 4px 8px 0;
    border-radius: 6px;
    font-size: 14px;
  }
  .td-smart-list-pagination a,
  .td-smart-list-button {
    min-height: 44px;
  }

  /* previous / next article - stacked, easy to read */
  .td-post-next-prev-content {
    width: 100% !important;
    float: none !important;
    padding: 12px 0 !important;
    border-top: 1px solid var(--td-mobile-border);
  }
  .td-post-next-prev-content a {
    font-size: 15px;
    line-height: 1.4;
  }
  .td-post-next-prev-content span {
    font-size: 12px;
  }

  /* related posts */
  .td-related-title a,
  .td-related-title .td-related-left,
  .td-related-title .td-related-right {
    font-size: 13px;
    padding: 8px 12px;
  }

  /* tags */
  .td-tags li a,
  .td-tags li span {
    font-size: 12px;
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: 3px;
  }

  /*  ---------------------------------------------------------------------------
      forms: 16px font (iOS does not zoom the page on focus), touch friendly
  */
  input[type="text"],
  input[type="email"],
  input[type="url"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px !important;
    min-height: 46px;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--td-mobile-border);
    box-sizing: border-box;
    max-width: 100%;
  }
  input[type="text"],
  input[type="email"],
  input[type="url"],
  input[type="search"],
  textarea {
    -webkit-appearance: none;
    appearance: none;
  }
  textarea {
    min-height: 130px;
  }
  input:focus,
  textarea:focus,
  select:focus {
    outline: 2px solid var(--td-mobile-accent);
    outline-offset: 0;
    border-color: var(--td-mobile-accent);
  }
  .comment-respond .form-submit input,
  #respond .form-submit input {
    min-height: 48px;
    border-radius: 6px;
    font-size: 15px !important;
    width: 100%;
  }
  .comment-form-cookies-consent {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 14px;
    line-height: 1.5;
  }
  .comment-form-cookies-consent input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
  }

  /* mobile search panel */
  .td-search-form-widget .td-widget-search-input,
  #td-header-search-mob {
    font-size: 16px !important;
  }

  /*  ---------------------------------------------------------------------------
      footer
  */
  .td-sub-footer-container {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .td-sub-footer-copy,
  .td-sub-footer-menu {
    text-align: center;
    line-height: 1.6;
  }
  .td-footer-wrapper .td-social-icon-wrap a,
  .td-social-icon-wrap .td-icon-font {
    min-width: 40px;
    min-height: 40px;
  }

  /* author box */
  .author-box-wrap .avatar {
    border-radius: 50%;
  }
  .author-box-wrap .td-author-description {
    font-size: 15px;
    line-height: 1.6;
  }
}

/* phones and users that prefer less motion: the images are visible immediately.
   The theme loading animation keeps the images invisible (opacity 0) until a scroll script runs - on slow phones
   the visitor sees empty boxes */
@media (max-width: 767px), (prefers-reduced-motion: reduce) {
  body.td-animation-stack-type0 .td-animation-stack .entry-thumb,
  body.td-animation-stack-type0 .post img,
  body.td-animation-stack-type1 .td-animation-stack .entry-thumb,
  body.td-animation-stack-type1 .post .entry-thumb,
  body.td-animation-stack-type1 .post img[class*="wp-image-"],
  body.td-animation-stack-type1 .post a.td-sml-link-to-image > img,
  body.td-animation-stack-type2 .td-animation-stack .entry-thumb,
  body.td-animation-stack-type2 .post .entry-thumb,
  body.td-animation-stack-type2 .post img[class*="wp-image-"],
  body.td-animation-stack-type2 .post a.td-sml-link-to-image > img {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
