/* Keep the homepage Chinese slogan as one complete line at every responsive width. */
.home-centerpiece h1 {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
}

.home-slogan-break {
  display: none;
}

.mobile-slogan-break {
  display: none;
}

.home-actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(1120px, 100%);
}

.home-upload-entry { position: relative; min-width: 0; }
.home-upload-entry > .home-action { width: 100%; }
.home-upload-popover {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 10px);
  z-index: 10;
  display: grid;
  gap: 6px;
  min-width: 235px;
  padding: 9px;
  border: 1px solid #9fbd8e;
  border-radius: 15px;
  background: rgba(249, 255, 242, .96);
  box-shadow: 0 18px 38px rgba(23, 58, 35, .24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(7px) scale(.97);
  transform-origin: bottom left;
  transition: opacity .2s ease, transform .25s cubic-bezier(.2,.82,.25,1);
}
.home-upload-popover::before { content: ''; position: absolute; right: -4px; bottom: -16px; left: -4px; height: 18px; pointer-events: auto; }
.home-upload-popover::after { content: ''; position: absolute; left: 25px; bottom: -6px; width: 10px; height: 10px; border-right: 1px solid #9fbd8e; border-bottom: 1px solid #9fbd8e; background: #f9fff2; transform: rotate(45deg); }
.home-upload-popover a { position: relative; z-index: 1; display: grid; gap: 3px; padding: 10px 12px; border-radius: 10px; color: var(--home-ink); text-decoration: none; transition: background-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease; }
.home-upload-popover a.is-selected, .home-upload-popover a:hover, .home-upload-popover a:focus-visible { background: var(--home-ink); color: #fff; outline: none; transform: translateX(2px); box-shadow: 0 6px 14px rgba(23, 36, 31, .18); }
.home-upload-popover span { font-size: 13px; font-weight: 800; }
.home-upload-popover small { color: #628068; font: 500 10px/1.4 Outfit, "Noto Sans SC", sans-serif; }
.home-upload-popover a.is-selected small, .home-upload-popover a:hover small, .home-upload-popover a:focus-visible small { color: #d9efc9; }
.home-upload-entry:hover .home-upload-popover, .home-upload-entry:focus-within .home-upload-popover, .home-upload-entry.is-open .home-upload-popover { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }

.site-credits {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px 14px;
  color: #5d7a65;
  font: 500 10px/1.5 Outfit, "Noto Sans SC", sans-serif;
  letter-spacing: .035em;
  text-align: center;
}

.site-credits span + span::before {
  content: "|";
  margin-right: 14px;
  color: #8eaa91;
}

.home-credits { margin: 32px auto 0; }

@media (max-width: 760px) {
  .home-centerpiece h1 {
    font-size: clamp(14px, 4.2vw, 20px);
  }

  .home-slogan-break {
    display: inline;
  }

  .mobile-slogan-break {
    display: inline;
  }

  /* Keep the four primary entries visible as a compact 2×2 mobile grid.
     Upload and template download intentionally share the first row. */
  .home-main { display: block; min-height: calc(100svh - 64px); }
  .home-centerpiece {
    display: flex;
    flex-direction: column;
    min-height: calc(100svh - 64px);
    padding-top: clamp(52px, 9vh, 96px);
    padding-bottom: clamp(18px, 4vh, 40px);
  }
  .home-eyebrow { margin-bottom: 10px; font-size: 9px; }
  .home-logo { width: min(300px, 72vw); max-height: 150px; }
  .home-centerpiece h1 { margin-top: 10px; font-size: clamp(15px, 4.8vw, 21px); }
  .home-slogan { margin-top: 8px; font-size: 10px; line-height: 1.35; }
  .home-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: auto;
  }
  .home-upload-entry { grid-column: 1; grid-row: 1; }
  .home-actions > a[href="/template"] { grid-column: 2; grid-row: 1; }
  .home-actions > a[href="/orders"] { grid-column: 1; grid-row: 2; }
  .home-actions > #contact-black-cat { grid-column: 2; grid-row: 2; }
  .home-action { min-height: 52px; padding: 0 10px; border-radius: 12px; gap: 6px; font-size: 12px; }
  .home-action-icon { width: 1.3em; height: 1.3em; font-size: 18px; }
  .home-action-arrow { font-size: 20px; }
  .home-upload-popover { right: 0; bottom: calc(100% + 8px); min-width: 0; transform-origin: bottom right; }
  .home-upload-popover::after { right: 24px; left: auto; }
  .home-credits { margin-top: 18px; font-size: 8px; gap: 3px 6px; }
  .site-credits span + span::before { margin-right: 8px; }
}

/* Balance the compact mobile homepage vertically: keep the identity block
   above, then give the entry grid and credits a deliberate lower position. */
@media (max-width: 760px) {
  .home-actions { margin-top: auto; }
}

@media (max-width: 980px) and (min-width: 761px) {
  .home-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
