/* Redesign R1 · Phase A (PO 2026-10-26): shared pieces for the 4-tab shell —
   问&办事 hub, home hero, 发现 "do it together" row, 我的 guest panel. */

.s5-page {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.s5-page__title { margin: 0; font-size: 1.6rem; font-weight: 800; color: var(--color-text); letter-spacing: -0.01em; }
.s5-page__sub { margin: 0.35rem 0 0; color: var(--color-subtitle); font-size: 0.95rem; }

.s5-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 1.1rem;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.s5-card__title { margin: 0 0 0.6rem; font-size: 1.05rem; font-weight: 700; }

.s5-ask__form { display: flex; gap: 0.5rem; align-items: stretch; }
.s5-ask__input {
  flex: 1;
  min-width: 0;
  min-height: 4.6rem;
  resize: none;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--color-border);
  border-radius: 0.85rem;
  font: inherit;
  font-size: 1rem;
  line-height: 1.4;
  background: var(--color-surface-subtle, #f1f5f9);
}
.s5-ask__input:focus { outline: none; border-color: var(--color-primary); background: #fff; }
.s5-ask__btn {
  flex: none;
  min-width: 4rem;
  padding: 0 1.1rem;
  border: 0;
  border-radius: 0.85rem;
  background: var(--color-primary);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.s5-ask__btn:hover { background: var(--color-primary-hover, #1d4ed8); }

.s5-sec__title { margin: 0 0 0.6rem; font-size: 1.1rem; font-weight: 700; }
.s5-sec__sub { margin: -0.35rem 0 0.7rem; color: var(--color-subtitle); font-size: 0.875rem; }
.s5-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.s5-tools { margin-top: 0; }

.s5-link-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: inherit;
  text-decoration: none;
}
.s5-link-card:hover { border-color: var(--color-primary); }
.s5-link-card__icon { font-size: 1.6rem; flex: none; }
.s5-link-card__text { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; min-width: 0; }
.s5-link-card__title { font-weight: 700; }
.s5-link-card__sub { color: var(--color-subtitle); font-size: 0.85rem; }
.s5-link-card__go { flex: none; color: var(--color-primary); font-weight: 600; font-size: 0.9rem; }
.s5-link-card--sos { background: #fff5f5; border-color: #fecaca; }
.s5-link-card--sos .s5-link-card__go { color: #b91c1c; }

/* ── Home ── */
.s5-hero { padding: 0.25rem 0 0.75rem; }
.s5-hero__title { margin: 0; font-size: 1.55rem; line-height: 1.25; font-weight: 800; color: var(--color-text); letter-spacing: -0.01em; }
.s5-hero__sub { margin: 0.4rem 0 0; color: var(--color-subtitle); font-size: 0.95rem; }
@media (min-width: 769px) {
  .s5-hero__title { font-size: 2rem; }
}
.s5-home-sec { margin-top: 1.25rem; }
.s5-home-sec__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.6rem; }
.s5-home-sec__title { margin: 0; font-size: 1.15rem; font-weight: 750; }
.s5-home-sec__sub { margin: 0.2rem 0 0; color: var(--color-subtitle); font-size: 0.85rem; }
.s5-home-sec__more { flex: none; color: var(--color-primary); font-weight: 600; font-size: 0.9rem; text-decoration: none; white-space: nowrap; }

/* Carousel keeps its space while loading, so nothing below jumps. */
.home-page .hv2-carousel.s5-carousel { display: block; }
.home-page .hv2-carousel.s5-carousel[hidden] { display: block; visibility: hidden; }
.home-page .hv2-carousel.s5-carousel.s5-carousel--empty { display: none; }

/* Home community: a short preview, the rest lives in 社区. */
.home-page.s5-home .hf-grid > :nth-child(n + 5) { display: none; }

/* ── 发现: do it together ── */
.s5-social { margin: 1.25rem 0; }
.s5-social__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
@media (min-width: 769px) {
  .s5-social__grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.s5-social__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 0.4rem;
  border-radius: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  line-height: 1.2;
}
.s5-social__item:hover { border-color: var(--color-primary); }
.s5-social__ico { font-size: 1.5rem; }

/* ── 我的: guest panel and tool links ── */
.s5-me { max-width: 46rem; margin: 0 auto; padding: 1.25rem 1rem 2rem; display: flex; flex-direction: column; gap: 1rem; }
.s5-me__login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.75rem;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.s5-me__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
@media (min-width: 769px) {
  .s5-me__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.s5-me__tool {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.8rem;
  border-radius: 0.9rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.s5-me__tool:hover { border-color: var(--color-primary); }
.s5-me__tool span:first-child { font-size: 1.25rem; }

/* Home layout (mobile gutters follow PM-02B: sections are edge-to-edge,
   each block applies the 16px gutter itself). */
.s5-home #hfTabs { display: none; }
.s5-home .s5-carousel .hv2-carousel__viewport { aspect-ratio: 16 / 10; }
@media (min-width: 860px) {
  /* PO 2026-10-29 (小法 review): on desktop the photo carousel was the biggest block on the page
     (1200×457) and outweighed search and tools — now ~1200×320. Phones unchanged. */
  .s5-home .s5-carousel .hv2-carousel__viewport { aspect-ratio: 15 / 4; }
  .s5-home .s5-carousel .hv2-slide { aspect-ratio: 15 / 4; padding: 1.75rem 2.5rem; }
  .s5-home .s5-carousel .hv2-slide__title { font-size: 1.75rem; }
}
.s5-home .s5-picks-head { margin-bottom: -0.5rem; }
.s5-home .s5-tools-block .s5-home-sec__head { margin-bottom: 0.5rem; }
.s5-home .hv2-tools.s5-tools--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 768px) {
  .s5-home .s5-gutter { margin-left: var(--hm-gutter, 16px); margin-right: var(--hm-gutter, 16px); }
  body.home-page.s5-home main > .home-hero { order: 1; }
  body.home-page.s5-home main > .hv2-week { order: 2; }
  body.home-page.s5-home main > #posts { order: 3; }
}
@media (min-width: 769px) {
  .s5-home .s5-hero { margin-bottom: 1rem; }
  .s5-home .s5-tools-block { margin-top: 1.25rem; }
  .s5-home .s5-picks-head { margin-top: 1.75rem; margin-bottom: 0.75rem; }
}

/* 本周去哪 posters with a real photo: dark gradient keeps the rank readable. */
.hv2-poster__img.s5-has-photo { background-size: cover; background-position: center; }
.hv2-poster__img.s5-has-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.55));
  border-radius: inherit;
  pointer-events: none;
}
.hv2-poster__img.s5-has-photo > .hv2-poster__rank,
.hv2-poster__img.s5-has-photo > .hv2-poster__badge { z-index: 1; }
@media (max-width: 768px) {
  .s5-home .s5-tools--3 .hv2-tools__item { flex-direction: column; justify-content: flex-start; text-align: center; gap: 0.35rem; padding: 0.7rem 0.4rem; }
  .s5-home .s5-tools--3 .hv2-tools__desc { display: none; }
  .s5-home .s5-tools--3 .hv2-tools__title { font-size: 0.85rem; line-height: 1.2; }
}
@media (max-width: 768px) {
  .s5-social__grid { display: flex; overflow-x: auto; gap: 0.5rem; padding-bottom: 0.25rem; scrollbar-width: none; }
  .s5-social__grid::-webkit-scrollbar { display: none; }
  .s5-social__item { flex: 0 0 5.6rem; }
}
/* Journey cards: who it covers must be readable, not cut by an ellipsis (Work review). */
.hv4-journey__desc { -webkit-line-clamp: 3 !important; line-clamp: 3; }

/* R1: poster without a photo — light tile with the category icon. */
.hv2-poster__img.s5-no-photo { background: #f1f5f9; border: 1px solid #e2e8f0; display: grid; place-items: center; }
.hv2-poster__img.s5-no-photo .hv2-poster__rank { color: #94a3b8; text-shadow: none; }
.s5-no-photo__icon { font-size: 2.6rem; opacity: 0.85; }

/* R1 · Discover on phones: results sooner. */
.dv-fold__summary { cursor: pointer; font-weight: 700; font-size: 0.875rem; color: #1e40af; list-style: none; }
.dv-fold__summary::-webkit-details-marker { display: none; }
.dv-fold__summary::after { content: " ▾"; }
.dv-fold[open] > .dv-fold__summary { margin-bottom: 0.5rem; }
.dv-fold[open] > .dv-fold__summary::after { content: " ▴"; }
@media (max-width: 768px) {
  .dv .dv__intro { display: none; }
  .dv .dv-food { padding: 0.6rem 0.8rem; }
  .s5-social { margin: 0.5rem 0 0.75rem; }
  .s5-social .s5-home-sec__sub { display: none; }
  .s5-social__item { flex: 0 0 auto; flex-direction: row; gap: 0.35rem; padding: 0.45rem 0.75rem; border-radius: 999px; font-size: 0.8rem; white-space: nowrap; }
  .s5-social__ico { font-size: 1rem; }
}

.search-fold { margin: 0.5rem 0; }
.search-fold__summary { cursor: pointer; font-weight: 700; font-size: 0.9rem; color: #1e40af; padding: 0.4rem 0; list-style: none; }
.search-fold__summary::-webkit-details-marker { display: none; }
.search-fold__summary::after { content: " ▾"; }
.search-fold[open] > .search-fold__summary::after { content: " ▴"; }

/* Cards whose photo fails to load are hidden (display rules must not override [hidden]). */
.hv2-poster[hidden], .dv li[hidden], .dv a[hidden], .dv article[hidden] { display: none !important; }

/* AI illustration label on 福利 covers. */
.dv-has-ai { position: relative; }
.dv-ai-badge { position: absolute; right: 0.35rem; bottom: 0.35rem; padding: 0.1rem 0.4rem; border-radius: 999px; background: rgba(15, 23, 42, 0.72); color: #fff; font-size: 0.65rem; font-weight: 700; line-height: 1.4; pointer-events: none; }
