/* Mobile layout fixes for Butterfly */

/* ---- Touch targets & icons ---- */
#toggle-menu,
#search-button,
#nav .site-page {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#toggle-menu {
  padding: 0 4px 0 8px;
}

#toggle-menu i,
#search-button i,
#rightside i,
.social-icon i {
  width: 1.1em;
  text-align: center;
}

#rightside > div > button,
#rightside > button,
.pagination .page-number,
.pagination .extend {
  min-width: 44px;
  min-height: 44px;
}

/* ---- Home hero: shorter on small screens ---- */
@media screen and (max-width: 768px) {
  #page-header.full_page {
    height: 52vh !important;
    min-height: 280px;
    max-height: 420px;
    background-attachment: scroll;
  }

  #page-header.full_page #site-info {
    top: 46%;
  }

  #page-header #site-title {
    font-size: 1.65em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.45);
  }

  #page-header #site-subtitle {
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  }

  #page-header.full_page:not(.not-top-img)::before {
    background-color: rgba(17, 27, 51, 0.42);
  }

  /* Social icons on hero: keep visible over dark photo */
  #site_social_icons .social-icon {
    color: #fff !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
  }

  /* Breathing room from screen edges */
  .layout {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  #content-inner {
    padding-left: 0;
    padding-right: 0;
  }

  .recent-post-item .recent-post-info {
    padding: 16px 16px 20px;
  }

  /* Article header meta: wrap instead of truncating */
  #page-header.post-bg {
    height: 320px;
  }

  #post-info {
    padding: 0 16px;
  }

  #post-info .post-title {
    font-size: 1.55em;
    line-height: 1.35;
  }

  #post-info #post-meta {
    font-size: 12px;
    line-height: 1.7;
  }

  #post-info #post-meta > .meta-firstline,
  #post-info #post-meta > .meta-secondline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 0;
  }

  #post-info #post-meta .post-meta-separator {
    margin: 0 4px;
  }

  /* Drop PV on very narrow screens to reduce header clutter */
  #post-info #post-meta .post-meta-pv-cv {
    display: none;
  }

  /* Content readability */
  #article-container {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #article-container .table-wrap,
  #article-container .highlight {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  #article-container .table-wrap {
    margin: 0 0 1em;
  }

  #article-container .table-wrap table,
  #article-container .highlight table {
    width: max-content;
    min-width: 100%;
    max-width: none;
  }

  /* Keep wide code/table blocks from blowing out the page */
  #article-container .highlight,
  #article-container figure.highlight {
    margin-left: 0;
    margin-right: 0;
  }

  #article-container ul ul,
  #article-container ol ol,
  #article-container ul ol,
  #article-container ol ul {
    padding-left: 1.1em;
  }

  #article-container code {
    word-break: break-word;
    white-space: break-spaces;
  }

  /* Side widgets: less tag density */
  #aside-content .card-tag-cloud a {
    font-size: 0.85em !important;
    padding: 2px 4px;
  }

  #aside-content .card-widget {
    margin-top: 14px;
  }

  /* FAB less obstructive */
  #rightside {
    right: 12px;
    bottom: 24px;
  }

  #rightside > div > button,
  #rightside > button {
    width: 42px;
    height: 42px;
    opacity: 0.92;
  }
}

/* Footer tone is owned by design-system.css (midnight indigo). */
