/* home.css — homepage «community» layout. Family tokens only (gde-tokens.css):
   DomCom blue is the accent (tint, icons, tags), family emerald is the action colour. */

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "intro carousel"
    "index index";
  gap: var(--space-4) var(--space-5, 2rem);
  align-items: start;
}
.home-hero__intro { grid-area: intro; min-width: 0; }
.home-hero__carousel { grid-area: carousel; min-width: 0; }
.home-hero__index { grid-area: index; min-width: 0; }

.hero.home-hero h1 {
  max-width: 20ch;
  font-size: clamp(1.75rem, 3.2vw, 2.75rem);
  line-height: 1.15;
  text-wrap: balance;
}
.hero.home-hero .hero-lead { font-size: 1.08rem; line-height: 1.55; }

.home-search { max-width: 34rem; margin-top: var(--space-4); }
.home-search__label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--ink); }
.house-search-pill.home-search__form { flex-wrap: wrap; }
.house-search-pill.home-search__form input[type="search"] { flex: 1 1 14rem; min-width: 0; min-height: 44px; }
.house-search-pill.home-search__form > button[type="submit"] { min-height: 44px; white-space: nowrap; }

.home-hero__secondary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.home-hero__secondary .btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: normal;
}
.hero.home-hero .home-note {
  margin-top: var(--space-3);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-2);
}
.home-note a,
.home-link {
  color: var(--primary-hover);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
:root[data-theme="dark"] .home-note a,
:root[data-theme="dark"] .home-link { color: var(--primary); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .home-note a,
  :root:not([data-theme="light"]) .home-link { color: var(--primary); }
}
.home-note a, .home-link { display: inline-block; padding-block: 4px; }

.home-house {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--space-2);
  margin-top: var(--space-3);
  font-size: 0.95rem;
}
.home-house label { display: grid; gap: 4px; font-weight: 600; min-width: 0; }
.home-house select {
  min-height: 44px;
  max-width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}
.home-house .btn { min-height: 44px; }

/* ── Carousel ─────────────────────────────────────────────── */
.home-carousel {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg);
  box-shadow: var(--shadow-1);
  padding: var(--space-4);
}
/* Every slide sits in the same cell: the box is as tall as its longest slide, so switching
   never moves the page, and nothing is clipped. */
.home-carousel__viewport { display: grid; grid-template-columns: minmax(0, 1fr); touch-action: pan-y pinch-zoom; }
.home-slide { grid-area: 1 / 1; min-width: 0; visibility: hidden; display: flex; flex-direction: column; gap: var(--space-3); }
.home-slide.is-active { visibility: visible; }
.home-slide__head { display: flex; align-items: center; gap: 12px; }
.home-slide__icon {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent);
}
.home-slide__icon svg { width: 28px; height: 28px; }
.home-tag {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.hero.home-hero .home-slide__title,
.home-slide__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 1.7vw, 1.35rem);
  line-height: 1.3;
  color: var(--ink);
  overflow-wrap: break-word;
}
.home-slide__points { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.home-slide__points li { position: relative; padding-left: 22px; line-height: 1.5; color: var(--ink); }
.home-slide__points li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.home-scene { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.home-scene li {
  padding: 6px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.82rem;
}
.home-scene li.home-scene__label { border: 0; background: none; padding-inline: 0; font-weight: 700; }
.home-slide__cta { margin-top: auto; align-self: flex-start; }
.home-slide__cta.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: normal;
  text-align: center;
}
.home-carousel .home-slide__state { margin: 0; font-size: 0.85rem; color: var(--ink-2); }

.home-carousel__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: var(--space-3);
}
.home-carousel__btn--toggle { margin-right: auto; }
/* Without the script the buttons are useless, but their room is kept so nothing jumps when it arrives
   (the <noscript> style removes it). */
.home-carousel__controls[hidden] { display: flex; visibility: hidden; }
.home-carousel__btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
.home-carousel__btn:hover { background: var(--surface-2); }
.home-carousel__counter { min-width: 4.5ch; text-align: center; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.home-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── «Все возможности» ───────────────────────────────────── */
.home-hero__index .home-index__title { margin: 0 0 8px; font-size: 0.95rem; font-weight: 700; color: var(--ink); }
.home-index__list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.home-index__list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-size: 0.9rem;
  text-decoration: none;
}
.home-index__list a:hover { border-color: var(--line-strong); background: var(--surface-2); }
/* Current item: ring and tinted surface (no underline), none of which changes the pill's width
   (a wider pill could re-wrap the row every 12 s). */
.home-index__list a[aria-current="true"] {
  border-color: var(--accent);
  background: var(--accent-soft, rgba(37, 99, 235, 0.08));
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  text-decoration: none;
}

/* ── How to start (3-step strip) ─────────────────────────── */
.home-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.home-step {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
}
.home-step__num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent-soft, rgba(37, 99, 235, 0.1));
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
}
.home-step h3 { margin: 4px 0 0; font-size: 1rem; color: var(--ink); }
.home-step p { margin: 0; font-size: 0.9rem; line-height: 1.5; color: var(--ink-2); }

.home-carousel :focus-visible,
.home-index__list a:focus-visible,
.home-card__cta:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── Benefit clusters ────────────────────────────────────── */
.home-clusters { display: grid; gap: var(--space-5, 2rem); }
.home-cluster h3 { margin: 0 0 var(--space-3); font-size: 1.05rem; }
.home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.home-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  scroll-margin-top: 96px;
}
.home-card:target { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.home-card__head { display: flex; align-items: flex-start; gap: 10px; }
.home-card__icon { flex: 0 0 auto; display: inline-flex; color: var(--accent); }
.home-card h4 { margin: 0; font-size: 1rem; line-height: 1.35; color: var(--ink); overflow-wrap: break-word; }
.home-card p { margin: 0; color: var(--ink-2); font-size: 0.92rem; line-height: 1.5; }
.home-card .home-card__state { font-size: 0.82rem; font-style: italic; }
.home-card__cta { margin-top: auto; align-self: flex-start; min-height: 44px; display: inline-flex; align-items: center; }

.home-lead { max-width: 60ch; margin-block: var(--space-4) 0; color: var(--ink-2); line-height: 1.55; }
.home-receipt-lead { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.home-receipt-lead h2 { margin: 0 0 8px; font-size: clamp(1.4rem, 2.6vw, 2rem); }
.home-receipt-lead p { margin: 0 0 var(--space-3); max-width: 62ch; line-height: 1.55; }

/* Mobile-only compact CTA row (never affects desktop > 640px). */
@media (max-width: 640px) {
  .cta-strip .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }
  .cta-strip .actions .btn {
    width: 100%;
    min-height: 40px;
    padding: 0.5rem 0.6rem;
    font-size: 0.84rem;
    text-align: center;
    justify-content: center;
    white-space: normal;
    line-height: 1.25;
  }
}

@media (max-width: 900px) {
  .home-hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "intro" "carousel" "index";
  }
}
@media (max-width: 520px) {
  .home-carousel { padding: var(--space-3); }
  .house-search-pill.home-search__form > button[type="submit"] { flex: 1 1 100%; justify-content: center; text-align: center; }
  .home-hero__secondary .btn { flex: 1 1 100%; }
  .home-slide__cta { align-self: stretch; }
  .home-receipt-lead { padding-inline: var(--space-3); }
}
@media (max-width: 360px) {
  .home-carousel__btn { padding: 0 10px; }
}

@media (prefers-reduced-motion: no-preference) {
  .home-carousel.is-enhanced .home-slide.is-active { animation: home-slide-in 0.25s ease-out; }
}
@keyframes home-slide-in { from { opacity: 0; } to { opacity: 1; } }
