/* Pierwszy ekran + oryginalna wyszukiwarka AI (max 680px) */

.home-stage {
    --home-stage-pad-x: 40px;
    --home-stage-pad-bottom: 24px;
    --home-stage-height: calc(100vh / var(--page-zoom, 1));
    --home-stage-height: calc(100svh / var(--page-zoom, 1));
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-height: var(--home-stage-height);
    height: auto;
    max-height: none;
    padding-top: var(--header-height);
    padding-bottom: var(--home-stage-pad-bottom);
    width: 100%;
    overflow: visible;
}

.home-stage__search-core {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.home-stage__search {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    max-width: 920px;
    width: 100%;
    margin: 0 auto;
    padding: 24px var(--home-stage-pad-x);
    box-sizing: border-box;
    min-height: 0;
}

.home-stage__search::before {
    content: "";
    flex: 4 4 0;
    min-height: 0;
    width: 100%;
    pointer-events: none;
}
.home-stage__search::after {
    content: "";
    flex: 6 6 0;
    min-height: 0;
    width: 100%;
    pointer-events: none;
}

.home-stage__search-core > h1,
.home-stage__search-core > .hero-desc,
.home-stage__search-core > .hero-search,
.home-stage__search-core > .suggestions {
    position: relative;
    z-index: 1;
}

.home-stage > .ai-search {
    position: relative;
    z-index: 1;
}

.home-stage__featured {
    flex: 0 0 auto;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto !important;
    margin-bottom: 0 !important;
    padding: 0 var(--home-stage-pad-x);
    box-sizing: border-box;
}

.home-stage__featured .section-header {
    margin-bottom: 16px;
}

.home-stage__spotlight {
    flex: 0 0 auto;
    width: 100%;
    max-width: var(--max-width);
    margin: 28px auto 0;
    padding: 0 var(--home-stage-pad-x);
    box-sizing: border-box;
}

.home-stage.is-ai-open .home-stage__spotlight {
    display: none;
}

#mitoto-spotlight.mitoto-spotlight,
#mitoto-spotlight {
    margin-top: 28px !important;
    margin-bottom: 80px !important; /* jak .section - naturalny odstęp do Polecane */
}

.hero:not(.home-stage__search) {
    padding: calc(var(--header-height) + 72px) 40px 64px;
    text-align: center;
    max-width: 920px;
    margin: 0 auto;
}

.hero h1 {
    font-size: clamp(36px, 5.5vw, 56px);
    font-weight: 700;
    letter-spacing: -1.5px;
    line-height: 1.1;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #1d1d1f 0%, #434353 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.home-stage__search h1 { font-size: clamp(36px, 6.2vw, 52px); }

.hero-desc {
    font-size: clamp(17px, 2vw, 20px);
    color: var(--text-secondary);
    margin-bottom: 40px;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.home-stage__search .hero-desc { margin-bottom: 28px; }

.hero-search {
    position: relative;
    max-width: 680px;
    width: 100%;
    margin: 0 auto 28px;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 30px;
    padding: 8px 8px 8px 24px;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    box-sizing: border-box;
}

.hero-search:focus-within {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.hero-search > svg {
    width: 22px;
    height: 22px;
    color: var(--accent-blue);
    margin-right: 12px;
    flex-shrink: 0;
}

.hero-search input {
    flex: 1;
    border: none;
    font-size: 17px;
    outline: none;
    background: transparent;
    min-width: 0;
}

.hero-search input::placeholder { color: var(--text-secondary); }

/* Brak natywnego „x” (pole type=text + fallback) */
.hero-search input::-webkit-search-decoration,
.hero-search input::-webkit-search-cancel-button,
.hero-search input::-ms-clear {
    -webkit-appearance: none;
    appearance: none;
    display: none;
    width: 0;
    height: 0;
}

.hero-search .btn,
.hero-search [data-ai-search-btn] {
    background: #2f59ed;
    color: #fff;
    border-color: transparent;
}
.hero-search .btn:hover,
.hero-search [data-ai-search-btn]:hover {
    background: #2548d4;
    color: #fff;
}
.hero-search .btn:focus-visible,
.hero-search [data-ai-search-btn]:focus-visible {
    outline: 2px solid #2f59ed;
    outline-offset: 2px;
}

.suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    min-height: 40px;
}

/* Puste do czasu fraz z bazy - bez flasha domyślnych chipów */
.suggestions.is-loading {
    visibility: hidden;
}

.chip {
    background-color: rgba(0, 0, 0, 0.06);
    color: var(--text-primary, #1d1d1f);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.chip:hover {
    background-color: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

@media (max-width: 992px) {
    .home-stage { --home-stage-pad-x: 24px; }
}

@media (max-width: 768px) {
    .home-stage__search .suggestions { display: none; }
}

@media (max-height: 700px) {
    .home-stage__search .hero-desc,
    .home-stage__search .suggestions { display: none; }
    .home-stage__search h1 {
        font-size: clamp(30px, 5.5vw, 40px);
        margin-bottom: 14px;
    }
}


/* DESKTOP_HOME_STAGE_LOCK — wysokość z --home-stage-height (JS: visualViewport) */
@media (min-width: 1025px) and (min-device-width: 1025px) {
  html.is-desktop:not(.is-phone) .home-stage:not(.is-height-unlocked) {
    height: var(--home-stage-height);
    min-height: var(--home-stage-height);
    max-height: var(--home-stage-height);
    overflow: hidden;
    padding-bottom: var(--home-stage-pad-bottom);
  }
  html.is-desktop:not(.is-phone) .home-stage:not(.is-height-unlocked) .home-stage__search {
    flex: 1 1 auto;
    min-height: 0;
  }
  /* Przy DPI/zoom chipy w 1 linii — bez zawijania, które wywala lock */
  html.is-desktop:not(.is-phone) .home-stage:not(.is-height-unlocked) .suggestions {
    flex-wrap: nowrap;
    justify-content: center;
    max-width: min(920px, 100%);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  html.is-desktop:not(.is-phone) .home-stage:not(.is-height-unlocked) .suggestions::-webkit-scrollbar {
    display: none;
  }
}
