/* HG Mobile Experience: every visible override is confined to <=800px. */
.hg-mobile-discovery,
.hg-read-mobile { display: none !important; }

@media (max-width: 800px), (max-width: 960px) and (max-height: 500px) and (pointer: coarse) {
  body #masthead #site-header-main { top: 0 !important; }
  body #masthead .site-header-bottom,
  body #masthead .site-header-bottom-fixed,
  body #masthead .site-header-bottom .site-header-inside { height: auto !important; min-height: 64px; }
  body #masthead .site-header-bottom .site-header-inside {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px !important;
  }
  body #masthead #branding {
    display: flex !important;
    align-items: center;
    float: none !important;
    min-width: 0;
    height: auto !important;
    flex: 1 1 auto;
  }
  body #masthead #site-text { top: auto !important; transform: none !important; min-width: 0; }
  body #masthead #site-title { font-size: 18px !important; line-height: 1.4 !important; max-width: 100%; overflow-wrap: anywhere; }
  body #masthead #site-title a { padding: 5px 8px !important; }
  body #masthead #access { display: none !important; }
  body #masthead .menu-burger { flex: 0 0 48px; float: none; width: 48px; height: 48px !important; }
  body #masthead .hamburger {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    display: block;
    width: 48px !important;
    height: 48px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid #c4d2d0 !important;
    border-radius: 10px !important;
    background: #fff !important;
    color: #174e4b !important;
    box-shadow: 0 1px 3px rgba(15, 40, 36, .05);
  }
  body #masthead .hamburger span {
    width: 24px !important;
    height: 2px !important;
    left: 11px !important;
    right: auto !important;
    background: #174e4b !important;
    transform-origin: center !important;
  }
  body #masthead .hamburger span:nth-child(1) { top: 15px !important; }
  body #masthead .hamburger span:nth-child(2) { top: 22px !important; }
  body #masthead .hamburger span:nth-child(3) { top: 29px !important; }
  body.burgermenu-active #masthead .hamburger {
    background: #066664 !important;
    border-color: rgba(255,255,255,.7) !important;
    color: #fff !important;
  }
  body.burgermenu-active #masthead .hamburger span { background: #fff !important; }
  body.burgermenu-active #masthead .hamburger span:nth-child(1) { top: 22px !important; transform: rotate(45deg) !important; }
  body.burgermenu-active #masthead .hamburger span:nth-child(2) { opacity: 0 !important; }
  body.burgermenu-active #masthead .hamburger span:nth-child(3) { top: 22px !important; transform: rotate(-45deg) !important; }
  body #masthead .hamburger:focus-visible { outline: 3px solid #174e4b; outline-offset: 3px; }
  body.burgermenu-active #masthead .hamburger:focus-visible { outline-color: #fff; }
  body #mobile-menu { padding: 76px 20px 24px !important; }
  body #mobile-menu .side-menu { min-width: 0 !important; max-width: 100% !important; width: min(100%, 440px); }
  body #mobile-menu #mobile-nav > li > a { display: block; min-height: 44px; }
  body #mobile-menu #mobile-nav > li > a:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
  body #mobile-menu .searchform input[type="search"] { font-size: 16px !important; }

  /* The original masthead occupies 1px and reserves space with container margin. */
  body.home.blog #container.two-columns-right { margin-top: calc(var(--hg-mobile-header-height, 64px) + 6px) !important; }
  body:is(.single, .archive, .category) #container.two-columns-right { margin-top: max(105px, calc(var(--hg-mobile-header-height, 64px) + 16px)) !important; }
  body.home.blog #main { margin-top: 0 !important; padding-top: 8px !important; }
  body.home.blog #main > .hg-site-trust-intro { display: none !important; }
  body.home.blog .hg-mobile-discovery { display: block !important; margin: 0 0 14px; }
  body.home.blog .hg-mobile-search {
    display: flex;
    gap: 8px;
    margin: 0 0 10px;
    padding: 0;
  }
  body.home.blog .hg-mobile-search input[type="search"] {
    flex: 1 1 0%;
    width: 0;
    min-width: 0;
    height: 46px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid #889d99;
    border-radius: 9px;
    background: #fff;
    color: #1f2937;
    font: 16px/1.5 system-ui, -apple-system, "Microsoft YaHei", sans-serif;
    appearance: none;
  }
  body.home.blog .hg-mobile-search input::placeholder { color: #576963; opacity: 1; }
  body.home.blog .hg-mobile-search button {
    flex: 0 0 64px;
    min-height: 46px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid #066664;
    border-radius: 9px;
    background: #066664;
    color: #fff;
    font: 600 15px/1.5 system-ui, -apple-system, "Microsoft YaHei", sans-serif;
    writing-mode: horizontal-tb;
  }
  body.home.blog .hg-mobile-categories {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
  }
  body.home.blog .hg-mobile-category {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 0;
    padding: 8px 4px;
    border: 1px solid #b5c6c2;
    border-radius: 9px;
    background: #fff;
    color: #174e4b;
    font: 600 14px/1.4 system-ui, -apple-system, "Microsoft YaHei", sans-serif;
    text-align: center;
    text-decoration: none;
    overflow-wrap: anywhere;
  }
  body.home.blog .hg-mobile-category[aria-current="page"] { background: #e6f2ef; border-color: #668d82; }
  body.home.blog .hg-mobile-category:hover { background: #e6f2ef; }
  body.home.blog .hg-mobile-tagline {
    margin: 10px 0 0;
    padding: 0;
    color: #52645e;
    font: 13px/1.65 system-ui, -apple-system, "Microsoft YaHei", sans-serif;
  }
  body.home.blog .hg-mobile-tagline a { color: #174e4b; text-decoration: underline; white-space: nowrap; }
  body.home.blog .hg-mobile-discovery :focus-visible { outline: 3px solid #066664; outline-offset: 2px; }

  /* Homepage cards only: article detail typography remains untouched. */
  body.home.blog #content-masonry article.post .entry-after-image { padding: 4px 6px 8px !important; }
  body.home.blog #content-masonry article.post .entry-title { font-size: 18px !important; line-height: 1.45 !important; }
  body.home.blog #content-masonry article.post .entry-summary,
  body.home.blog #content-masonry article.post .entry-content { font-size: 15px !important; line-height: 1.6 !important; color: #4b5563 !important; }
  body.home.blog #content-masonry article.post .entry-meta.aftertitle-meta { padding-bottom: 4px; }
  body.home.blog #content-masonry article.post .entry-meta .onDate,
  body.home.blog #content-masonry article.post .entry-meta .onDate time { color: #626e69 !important; }
  body.home.blog #content-masonry article.post .entry-utility:empty { display: none; }
  body.home.blog #content-masonry article.post .post-continue-container { margin-top: 6px; }
  body.home.blog #content-masonry article.post .continue-reading-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 14px !important;
    border: 1px solid #066664 !important;
    border-radius: 7px;
    background: #066664 !important;
    color: #fff !important;
    font-size: 14px !important;
    line-height: 1.5;
  }
  body.home.blog #content-masonry article.post .continue-reading-link span { color: inherit !important; }
  body.home.blog #content-masonry article.post .continue-reading-link .icon-continue-reading { display: none; }
  body.home.blog #content-masonry .continue-reading-link:focus-visible { outline: 3px solid #174e4b; outline-offset: 2px; }
  body.home.blog #content-masonry .hg-read-desktop { display: none !important; }
  body.home.blog #content-masonry .hg-read-mobile { display: inline !important; }

  /* Search should reveal results, not a full-screen stock photograph. */
  body.search #masthead #header-image-main,
  body.search #masthead #header-image-main-inside { display: none !important; height: 0 !important; }
  body.search #container.two-columns-right { margin-top: calc(var(--hg-mobile-header-height, 64px) + 6px) !important; }
  body.search #main { margin-top: 0 !important; padding-top: 8px !important; }
  body.search #main > .page-header.content-search { display: block !important; padding: 8px 0 18px !important; }
  body.search #main > .page-header.content-search .page-title { display: block !important; font-size: 23px !important; line-height: 1.4; color: #174e4b; }
  body.search #main > .page-header.content-search > br { display: none; }
  body.search #main > .page-header.content-search .searchform { display: flex; width: 100%; margin: 10px 0 0; }
  body.search #main > .page-header.content-search .searchform label { flex: 1; min-width: 0; }
  body.search #main > .page-header.content-search .searchform input[type="search"] { width: 100%; min-height: 44px; font-size: 16px; background: #fff; color: #1f2937; }
  body.search #main > .page-header.content-search .searchsubmit { min-width: 48px; min-height: 44px; background: #066664; color: #fff; }
}

@media (max-width: 359px) {
  body #masthead #site-title { font-size: 16px !important; }
  body.home.blog .hg-mobile-categories { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) and (max-height: 500px) and (pointer: coarse) {
  body #mobile-menu { justify-content: flex-start; }
}
