/*
 * Home page (/) — plan §5.1. Builds on the site.css v2 component library;
 * only home-specific layout lives here. Mobile-first, breakpoints
 * 600 / 960 / 1280 px.
 */

.home { overflow-x: clip; }
.home .tcard__link { color: inherit; text-decoration: none; }
.home a.tcard__link:hover, .home .tcard:focus-within .tcard__link { text-decoration: underline; text-underline-offset: 3px; }
.home-sec { padding-block: var(--sp-7); }
.home-sec .section-head h2 { font-size: var(--fs-2xl); }
@media (min-width: 960px) { .home-sec { padding-block: var(--sp-8); } }

/* ---------- 1. Hero ---------- */

.home-hero .home-hero__inner {
  min-height: min(72vh, 560px);
  padding-top: calc(var(--site-header-h) + var(--sp-6));
  padding-bottom: var(--sp-8);
}
.home-hero__bg img {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1.2s ease, transform 8s linear;
}
.home-hero__bg img.is-on { opacity: 1; transform: none; }
.home-hero::before {
  background:
    url("/images/brand/contour-dark.svg") center / 720px auto,
    linear-gradient(180deg, rgba(11, 46, 34, .55) 0%, rgba(11, 46, 34, .5) 40%, rgba(11, 46, 34, .94) 100%),
    linear-gradient(90deg, rgba(11, 46, 34, .75) 0%, rgba(11, 46, 34, .1) 75%);
}
.home-hero__copy { min-width: 0; }
.home-hero__copy .eyebrow { color: var(--c-moss-300); }
.home-hero h1 { text-shadow: 0 2px 24px rgba(0, 0, 0, .25); }
.home-hero h1 > span { display: inline-block; }
.home-hero .hero-v2__lead { margin-bottom: var(--sp-5); }

.home-search { max-width: 540px; }
.home-search > .icon { color: var(--c-rock-600); }
.home-search input { min-height: 44px; }
.home-search .btn { padding-inline: var(--sp-5); }
.home-search__scope {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: var(--sp-3) 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.home-search__scope label { position: relative; cursor: pointer; }
.home-search__scope input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.home-search__scope span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.home-search__scope input:checked + span { background: #fff; border-color: #fff; color: var(--c-forest-700); }
.home-search__scope input:focus-visible + span { outline: 3px solid var(--c-moss-300); outline-offset: 2px; }
.home-hero .hero-v2__actions { margin-top: var(--sp-5); }
@media (max-width: 599.98px) {
  .home-hero .hero-v2__actions .btn { flex: 1 1 0; justify-content: center; padding-inline: var(--sp-3); min-height: 48px; font-size: var(--fs-base); }
  .home-hero .hero-v2__lead { font-size: var(--fs-base); }
}
.home-hero__feature { margin-top: var(--sp-4); min-height: 36px; text-decoration: none; }
.home-hero__proof { margin-top: var(--sp-5); color: rgba(255, 255, 255, .92); }
.home-hero__proof b { color: #fff; font-size: 1.1em; }

/* Phone mockup: a real activity rendered like the App's record screen. */
.home-hero__phone { width: min(300px, 100%); }
.home-hero .phone { transform: rotate(-3deg); }
.home-app { display: flex; flex-direction: column; height: 100%; background: #fff; color: var(--c-text); }
.home-app--empty { display: grid; place-items: center; background: var(--c-forest-700) url("/images/brand/contour-dark.svg") center / 360px; }
.home-app__map {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  padding: 44px 22px 34px;
  background: var(--c-forest-700) url("/images/brand/contour-dark.svg") center / 380px auto;
}
.home-app__map .track-svg { width: 100%; height: auto; max-height: 100%; }
.home-app__map .track-svg .track-line { stroke-width: 4; }
.home-app__rec {
  position: absolute;
  top: 18px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.home-app__sheet {
  position: relative;
  display: grid;
  gap: 8px;
  margin-top: -18px;
  padding: 14px 14px 18px;
  border-radius: 18px 18px 0 0;
  background: #fff;
  font-size: 12px;
}
.home-app__sheet::before { content: ""; justify-self: center; width: 36px; height: 4px; border-radius: 4px; background: var(--c-rock-200); }
.home-app__sheet .author-row { font-size: 12px; }
.home-app__sheet .author-row .avatar { width: 22px; height: 22px; }
.home-app__title { font-size: 15px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.home-app__sheet .stat-strip { gap: 10px; font-size: 12px; }
.home-app__sheet .reaction-bar { font-size: 12px; padding-top: 8px; border-top: 1px solid var(--c-rock-100); }

/* Floating interaction bubbles (≥960 px). */
.home-bubbles .social-bubble { width: max-content; max-width: 250px; }
.home-hero__phone .social-bubble:nth-of-type(1) { top: 9%; left: -36%; }
.home-hero__phone .social-bubble:nth-of-type(2) { top: 34%; right: -30%; }
.home-hero__phone .social-bubble:nth-of-type(3) { top: 54%; bottom: auto; left: -40%; }
.home-bubbles .social-bubble .avatar { width: 32px; height: 32px; }
.home-bubbles .social-bubble.is-swap { animation: home-bubble-swap 700ms var(--ease) both; }
@keyframes home-bubble-swap {
  0% { opacity: 1; transform: none; }
  40% { opacity: 0; transform: translateY(-8px) scale(.96); }
  41% { opacity: 0; transform: translateY(10px) scale(.96); }
  100% { opacity: 1; transform: none; }
}

/* Mobile "剛剛發生" ticker at the bottom of the hero. */
.home-ticker {
  position: relative;
  padding: var(--sp-2) 0 calc(var(--sp-3) + clamp(28px, 5vw, 64px));
  margin-top: calc(-1 * var(--sp-7));
}
.home-ticker__inner { display: flex; align-items: center; gap: var(--sp-3); }
.home-ticker__label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  color: var(--c-moss-300);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .04em;
}
.home-ticker__viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 24px), transparent);
}
.home-ticker__track { display: flex; gap: var(--sp-2); width: max-content; padding-block: 4px; }
.home-ticker__track.is-running { animation: home-marquee var(--ticker-dur, 40s) linear infinite; }
.home-ticker__viewport:hover .home-ticker__track, .home-ticker__viewport:focus-within .home-ticker__track { animation-play-state: paused; }
.home-ticker .social-bubble { flex: none; max-width: 260px; padding: 6px 12px 6px 6px; animation: none; box-shadow: none; }
.home-ticker .social-bubble .avatar { width: 26px; height: 26px; }
.home-ticker .social-bubble__text { -webkit-line-clamp: 1; white-space: nowrap; }
@keyframes home-marquee { to { transform: translateX(-50%); } }
.home-hero__ridge { z-index: 1; }

@media (min-width: 960px) {
  .home-hero .home-hero__inner {
    min-height: min(88vh, 760px);
    padding-bottom: var(--sp-9);
  }
  .home-hero__phone { margin-right: 8%; }
}
@media (prefers-reduced-motion: reduce) {
  .home-hero__bg img { transition: none; }
  .home-ticker__viewport { overflow-x: auto; scrollbar-width: none; -webkit-mask-image: none; mask-image: none; }
  .home-hero .phone { transform: none; }
}

/* ---------- 2. Number band ---------- */

.home-band { position: relative; z-index: 2; padding-block: var(--sp-5) var(--sp-3); }
.home-band__list { margin: 0; padding: 0; list-style: none; gap: var(--sp-3); }
.home-band__list li {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: var(--sp-4) var(--sp-2);
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: var(--shadow-1);
}
.home-band__list .icon {
  width: 40px;
  height: 40px;
  padding: 9px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--c-moss-100);
  color: var(--c-forest-700);
}
.home-band__list { grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); }
@media (max-width: 599.98px) {
  .home-band__list { gap: var(--sp-2); }
  .home-band__list li { padding: var(--sp-3) 4px; }
  .home-band__list .icon { display: none; }
  .home-band__list .stat-band__value { font-size: var(--fs-xl); }
  .home-band__list .stat-band__label { font-size: var(--fs-xs); line-height: 1.4; }
}
@media (min-width: 960px) {
  .home-band { margin-top: calc(-1 * var(--sp-7)); }
  .home-band__list { gap: var(--sp-5); }
  .home-band__list li { padding: var(--sp-5) var(--sp-4); }
}

/* ---------- 3. Alerts ---------- */

.home-alerts { padding-bottom: 0; }
.home-alerts__list { display: grid; gap: var(--sp-2); }
.home-alerts__list .alert-banner { margin: 0; }

/* ---------- 4. Activities ---------- */

.home .scroll-row { scroll-padding-inline: var(--gutter); }

.home-acts .tabs { margin-bottom: var(--sp-4); }
.home-acts__panel[hidden] { display: none; }
@media (min-width: 600px) and (max-width: 959.98px) {
  .home-acts__row.scroll-row {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    margin-inline: 0;
    padding-inline: 0;
  }
}

/* ---------- 5. Moments wall ---------- */

.home-moments { background-size: 640px auto; }
.home-moments__wall { columns: 2; column-gap: var(--sp-2); }
.home-moments__wall > * { margin-bottom: var(--sp-2); }
@media (min-width: 600px) { .home-moments__wall { columns: 3; column-gap: var(--sp-3); } .home-moments__wall > * { margin-bottom: var(--sp-3); } }
@media (min-width: 960px) { .home-moments__wall { columns: 5; } }
@media (max-width: 599.98px) {
  .home-moments__wall .card-moment__overlay { padding: var(--sp-2); font-size: var(--fs-xs); }
  .home-moments__wall .card-moment__text { display: none; }
}
.home-moments__wall .card-moment:nth-child(3n + 1) .media { aspect-ratio: 4 / 5; }
.home-moments__wall .card-moment:nth-child(4n + 2) .media { aspect-ratio: 3 / 4; }
.home-moments__wall .card-moment { display: block; box-shadow: var(--shadow-1); }
.home-moments__wall .media--shade::after {
  background: linear-gradient(180deg, rgba(11, 46, 34, 0) 35%, rgba(11, 46, 34, .7) 62%, rgba(11, 46, 34, .95) 100%);
}
.home-moments__wall .card-moment:hover { box-shadow: var(--shadow-2); }
.home-moments__wall .card-moment:hover .media > img { transform: scale(1.04); }

/* ---------- 7. Communities ---------- */

.home-comm__grid { display: grid; gap: var(--sp-5); }
.home-comm__intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--sp-6) var(--sp-5);
  border-radius: var(--r-lg);
  background: var(--c-forest-900) url("/images/brand/contour-dark.svg") center / 560px auto;
  color: #fff;
}
.home-comm__intro .eyebrow { color: var(--c-moss-300); }
.home-comm__intro h2 { margin: 0 0 var(--sp-3); font-size: var(--fs-2xl); font-weight: 800; color: #fff; }
.home-comm__intro p { color: rgba(255, 255, 255, .86); }
.home-comm__cta { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-2); }
.home-comm__cta .btn:not(.btn--accent) { background: transparent; border-color: rgba(255, 255, 255, .7); color: #fff; }
.home-comm__cta .btn:not(.btn--accent):hover { background: rgba(255, 255, 255, .12); }
@media (min-width: 960px) {
  .home-comm__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: stretch; }
  .home-comm__intro { padding: var(--sp-7) var(--sp-6); }
}

/* ---------- 8. Active hikers ---------- */

.home-hikers__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.home-hikers__grid .card-hiker { padding: var(--sp-5) var(--sp-3); }
.home-hikers__grid .card-hiker .btn { margin-top: auto; }
.home-hikers__grid .card-hiker__stat { line-height: 1.5; }
@media (min-width: 600px) { .home-hikers__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .home-hikers__grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* ---------- 9. How it works ---------- */

.home-steps > li { overflow: hidden; }
.home-steps__art {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--c-moss-100);
  color: var(--c-forest-700);
}
.home-steps__art .icon { width: 28px; height: 28px; }
.home-steps h3 { padding-right: 64px; }
@media (min-width: 960px) {
  .home-steps > li { overflow: visible; }
  .home-steps h3 { padding-right: 0; }
  .home-steps__art { position: static; display: grid; margin-bottom: var(--sp-3); }
  .home-steps > li::before { position: absolute; top: var(--sp-4); right: var(--sp-4); margin: 0; }
}
/*
 * The shared .steps connector assumes a top-left number and draws a
 * dashed trail through the card (skipping the last one). Homepage
 * cards put the icon left and the number top-right, so that line sits
 * inside the card and reads as decoration. Sequence is already in the
 * heading ("規劃 → 記錄 → 分享 → 揪團") and the 1–4 badges.
 */
:where(.site) .home-steps > li:not(:last-child)::after {
  content: none;
  border: 0;
  width: 0;
  height: 0;
  inset: auto;
  transform: none;
}

/* ---------- 10–11. Magazine, official posts ---------- */

.home-mag__rest { margin-top: var(--sp-5); }
.card-article .tcard__meta .icon { color: var(--c-forest-500); }
.home-posts { background: var(--c-bg-2); }
.card-post .tcard__head { padding-bottom: var(--sp-3); }
.card-post__text { -webkit-line-clamp: 4; }

/* ---------- 12. News + notices ---------- */

.home-news .cols { gap: var(--sp-7) var(--sp-6); }
.home-news .section-head h2 { font-size: var(--fs-xl); }
.home-news__col { min-width: 0; }
.home-news__item {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--c-line);
  color: inherit;
  text-decoration: none;
}
.home-news__item:hover .home-news__title { text-decoration: underline; }
.home-news__thumb {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--c-moss-100) url("/images/brand/contour.svg") center / 200px auto;
}
.home-news__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.home-news__title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; }
.home-news__item small { display: block; margin-top: 2px; color: var(--c-muted); font-size: var(--fs-sm); }
.home-notices .notice-row .badge { flex: none; }

/* ---------- 13. Store ---------- */

.home-store { background: var(--c-bg-2); }
.card-product .product-price { margin-top: auto; }
.home-store .cols--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
@media (min-width: 960px) { .home-store .cols--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-5); } }

/* ---------- 14. App CTA ---------- */

.home-cta .app-cta { overflow: hidden; }
.home-play {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px 20px 6px 14px;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: var(--r-sm);
  background: #000;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
  text-decoration: none;
}
.home-play .icon { width: 26px; height: 26px; }
.home-play small { display: block; font-size: 11px; font-weight: 500; opacity: .85; }
.home-play:hover { border-color: #fff; }
.home-feed { display: flex; flex-direction: column; gap: 8px; padding: 0 10px; background: var(--c-rock-100); }
.home-feed__bar {
  margin: 0 -10px;
  padding: 26px 14px 10px;
  background: #fff;
  color: var(--c-forest-700);
  font-size: 13px;
  font-weight: 800;
  border-bottom: 1px solid var(--c-rock-200);
}
.home-feed__item { position: relative; flex: none; height: 104px; overflow: hidden; border-radius: 12px; background: var(--c-moss-100); }
.home-feed__item img { width: 100%; height: 100%; object-fit: cover; }
.home-feed__item .author-row {
  position: absolute;
  left: 8px;
  bottom: 6px;
  color: #fff;
  font-size: 11px;
}
.home-feed__item .author-row__name { color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.home-feed__item .avatar { width: 20px; height: 20px; border: 1.5px solid #fff; }
