/* 宿也 · 首页（移动优先，min-width 600 / 1024 / 1440 逐级增强） */

.home-section {
    margin-top: var(--section-gap);
}

/* ---------- ① 主图 + H1 ---------- */
.home-hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    /* 手机 4:5，最高 78svh；用高度而非 aspect-ratio，避免 min-height 反推宽度造成横向溢出 */
    height: clamp(420px, 125vw, 78svh);
    overflow: hidden;
    background: var(--night);
    color: #fff;
}

.home-hero-media {
    position: absolute;
    inset: 0;
}

.home-hero-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(31, 42, 38, .18) 0%, transparent 30%, transparent 46%, rgba(31, 42, 38, .78) 100%);
}

.hero-real-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 60%;
}

.home-hero-media.is-fallback {
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 30% 120%, #2E5A4D 0 40%, transparent 41%),
        radial-gradient(circle at 80% 130%, #254F43 0 45%, transparent 46%),
        var(--night);
}

.hero-fallback-mark {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin-bottom: 30%;
    border: 1.5px solid rgba(246, 243, 236, .5);
    border-radius: var(--radius-s);
    font-family: var(--font-serif);
    font-size: 20px;
    letter-spacing: .1em;
    color: rgba(246, 243, 236, .7);
}

.home-hero-copy {
    position: relative;
    z-index: 1;
    padding-bottom: 104px;
}

.home-hero h1 {
    font-size: var(--fs-display);
    line-height: 1.25;
    letter-spacing: .04em;
    text-shadow: 0 1px 12px rgba(31, 42, 38, .35);
}

/* ---------- ② 悬浮分段搜索 ---------- */
.home-search {
    position: relative;
    z-index: 5;
    margin-top: -72px;
}

.search-card {
    display: grid;
    gap: 0;
    padding: var(--space-2);
    border-radius: var(--radius-l);
    background: var(--paper-raised);
    box-shadow: var(--shadow-float);
}

.search-segment {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    min-height: 60px;
    padding: 10px 14px;
    border: 0;
    border-radius: var(--radius-m);
    background: transparent;
    text-align: left;
    transition: background var(--motion-fast);
}

.search-segment:hover {
    background: var(--paper);
}

.search-segment:focus-within {
    background: var(--paper);
}

.field-label {
    display: block;
    font-size: var(--fs-caption);
    font-weight: 500;
    letter-spacing: .04em;
    color: var(--stone);
}

.search-segment strong {
    display: block;
    overflow: hidden;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.destination input {
    width: 100%;
    min-width: 0;
    padding: 2px 0 0;
    border: 0;
    background: transparent;
    font-size: 16px;
    font-weight: 600;
    outline: none;
}

.destination input::placeholder {
    color: var(--stone);
    font-weight: 500;
}

.destination:focus-within {
    box-shadow: inset 0 0 0 2px var(--pine);
}

.search-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--line);
}

.search-fields .search-field:nth-child(2) {
    border-left: 1px solid var(--line);
    border-radius: 0;
}

.search-fields .search-field:nth-child(3) {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    border-radius: 0;
}

.search-submit {
    width: 100%;
    margin-top: var(--space-2);
}

@media (min-width: 400px) {
    .search-fields {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .search-fields .search-field:nth-child(3) {
        grid-column: auto;
        border-top: 0;
        border-left: 1px solid var(--line);
    }
}

/* ---------- ③ 意图入口 ---------- */
.scene-list {
    display: flex;
    gap: var(--space-2);
    margin: var(--space-5) calc(var(--page-pad) * -1) 0;
    padding: 0 var(--page-pad) 2px;
    overflow-x: auto;
    scrollbar-width: none;
}

.scene-list::-webkit-scrollbar {
    display: none;
}

.scene {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: 0 var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    font-size: 14px;
    white-space: nowrap;
    color: var(--ink);
    transition: border-color var(--motion-fast), background var(--motion-fast);
}

.scene .icon {
    width: 18px;
    height: 18px;
    color: var(--moss);
}

.scene:hover {
    border-color: var(--ink);
}

/* ---------- 横滑容器（推荐 / 最新 / 目的地，手机端） ---------- */
.stay-grid,
.destination-grid {
    display: grid;
    grid-auto-flow: column;
    gap: var(--space-4);
    margin-inline: calc(var(--page-pad) * -1);
    padding: 0 var(--page-pad) 4px;
    overflow-x: auto;
    scroll-padding-inline: var(--page-pad);
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.stay-grid::-webkit-scrollbar,
.destination-grid::-webkit-scrollbar {
    display: none;
}

.stay-grid {
    grid-auto-columns: 78%;
}

.stay-grid > .stay-card,
.destination-grid > a {
    scroll-snap-align: start;
}

/* ④ 推荐：手机 4:5 横滑卡 */
.stay-grid:not(.latest-stay-grid) .stay-card-media {
    aspect-ratio: 4 / 5;
}

.stay-grid > .empty-state,
.stay-grid > .empty-note {
    grid-column: 1 / -1;
}

.empty-state {
    padding: var(--space-6) var(--space-5);
    border: 1px dashed var(--line);
    border-radius: var(--radius-m);
    color: var(--moss);
}

.empty-state h3 {
    margin-bottom: var(--space-1);
    color: var(--ink);
}

.empty-note {
    color: var(--moss);
}

/* ---------- ⑤ 目的地 3:4 ---------- */
.destination-grid {
    grid-auto-columns: 62%;
    gap: var(--space-3);
}

.destination-card {
    position: relative;
    display: block;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: var(--radius-m);
    background: var(--sand);
    color: #fff;
}

.destination-card img,
.destination-fallback {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 600ms ease-out;
}

.destination-fallback {
    display: block;
    background:
        radial-gradient(circle at 50% 120%, #2E5A4D 0 40%, transparent 41%),
        var(--pine);
}

.destination-card:hover img {
    transform: scale(1.03);
}

.destination-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 48%, rgba(31, 42, 38, .72));
}

.destination-copy {
    position: absolute;
    z-index: 1;
    left: 18px;
    right: 18px;
    bottom: 18px;
}

.destination-copy strong {
    display: block;
    font-family: var(--font-serif);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: .08em;
    line-height: 1.3;
}

.destination-copy span {
    font-size: 13px;
    color: rgba(255, 255, 255, .86);
}

/* ---------- ⑥ 为什么包栋 ---------- */
.why-whole {
    display: grid;
    overflow: hidden;
    border-radius: var(--radius-l);
    background: var(--sand);
}

.why-whole-media {
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.why-whole-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 52%;
}

.why-whole-copy {
    display: grid;
    gap: var(--space-5);
    justify-items: start;
    padding: var(--space-6) var(--space-5);
}

.why-whole-list {
    display: grid;
    gap: var(--space-5);
    padding: 0;
    list-style: none;
    counter-reset: why;
}

.why-whole-list li {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 2px var(--space-3);
    counter-increment: why;
}

.why-whole-list li::before {
    content: "0" counter(why);
    grid-row: span 2;
    font-family: var(--font-serif);
    font-size: 15px;
    line-height: 1.7;
    color: var(--clay);
}

.why-whole-list strong {
    font-size: 16px;
    font-weight: 600;
}

.why-whole-list p {
    font-size: 14px;
    line-height: 1.75;
    color: var(--moss-deep);
}

/* ---------- ⑧ 周末灵感 ---------- */
.journal {
    display: grid;
    gap: var(--space-6);
}

.inspiration-card {
    display: grid;
    gap: var(--space-4);
    color: var(--ink);
}

.inspiration-media {
    aspect-ratio: 3 / 2;
    overflow: hidden;
    border-radius: var(--radius-m);
    background: var(--sand);
}

.inspiration-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 600ms ease-out;
}

.inspiration-card:hover img {
    transform: scale(1.03);
}

.inspiration-copy {
    display: grid;
    gap: var(--space-2);
    justify-items: start;
}

.inspiration-copy h3 {
    font-size: 22px;
    line-height: 1.4;
}

.inspiration-card:hover h3 {
    color: var(--pine);
}

.inspiration-copy p {
    font-size: 14px;
    color: var(--moss);
}

.journal-list {
    display: grid;
    align-content: start;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--line);
}

.journal-list a {
    display: grid;
    gap: 2px;
    min-height: 44px;
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--line);
}

.journal-list h3 {
    font-size: 17px;
    line-height: 1.5;
}

.journal-list a:hover h3 {
    color: var(--pine);
}

.journal-list time {
    font-size: var(--fs-caption);
    color: var(--stone);
}

/* ---------- 平板 ≥ 600 ---------- */
@media (min-width: 600px) {
    .home-hero {
        height: clamp(460px, 72svh, 640px);
    }

    .stay-grid {
        grid-auto-columns: 44%;
    }

    .latest-stay-grid {
        grid-auto-flow: row;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-6) var(--space-5);
        margin-inline: 0;
        padding: 0;
        overflow: visible;
    }

    .destination-grid {
        grid-auto-columns: 40%;
    }

    .why-whole-copy {
        padding: var(--space-7);
    }
}

/* ---------- 桌面 ≥ 1024 ---------- */
@media (min-width: 1024px) {
    .home-hero {
        height: min(80vh, 760px);
        min-height: 560px;
    }

    .home-hero-copy {
        padding-bottom: 120px;
    }

    .home-search {
        margin-top: -52px;
    }

    .search-card {
        grid-template-columns: 1.5fr minmax(0, 2.9fr) auto;
        align-items: center;
        padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3);
    }

    .search-segment {
        padding: 12px 22px;
    }

    .search-card > .destination {
        border-right: 1px solid var(--line);
        border-radius: 0;
    }

    .search-fields {
        grid-template-columns: 1fr 1fr .9fr;
        border-top: 0;
    }

    .search-fields .search-field:nth-child(2) {
        border-left: 0;
    }

    .search-fields .search-field + .search-field,
    .search-fields .search-field:nth-child(3) {
        border-left: 1px solid var(--line);
    }

    .search-submit {
        width: auto;
        min-height: 56px;
        margin: 0 0 0 var(--space-2);
        padding: 0 var(--space-6);
    }

    .scene-list {
        justify-content: center;
        flex-wrap: wrap;
        margin: var(--space-6) 0 0;
        padding: 0;
        overflow: visible;
    }

    /* ④ 编辑式错落：1 大 + 2 小，其余 3 张一行 */
    .stay-grid {
        grid-auto-flow: row;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--space-7) var(--space-6);
        margin-inline: 0;
        padding: 0;
        overflow: visible;
    }

    .stay-grid:not(.latest-stay-grid) .stay-card-media {
        aspect-ratio: 4 / 3;
    }

    .stay-grid:not(.latest-stay-grid) > .stay-card:first-child {
        grid-column: span 2;
        grid-row: span 2;
    }

    .stay-grid:not(.latest-stay-grid) > .stay-card:first-child .stay-card-media {
        flex: 1 1 auto;
        aspect-ratio: auto;
        min-height: 360px;
    }

    .stay-grid:not(.latest-stay-grid) > .stay-card:first-child .stay-card-media img {
        position: absolute;
        inset: 0;
    }

    .stay-grid:not(.latest-stay-grid) > .stay-card:first-child h3 {
        font-size: 28px;
    }

    .stay-grid:not(.latest-stay-grid) > .stay-card:first-child .card-summary {
        -webkit-line-clamp: 2;
    }

    .latest-stay-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--space-7) var(--space-6);
    }

    .destination-grid {
        grid-auto-flow: row;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--space-5);
        margin-inline: 0;
        padding: 0;
        overflow: visible;
    }

    .destination-copy strong {
        font-size: 32px;
    }

    .why-whole {
        grid-template-columns: 1fr 1fr;
        align-items: stretch;
    }

    .why-whole-media {
        aspect-ratio: auto;
        min-height: 520px;
    }

    .why-whole-copy {
        align-content: center;
        padding: var(--space-8);
    }

    .why-whole-copy h2 {
        font-size: 34px;
    }

    .journal {
        grid-template-columns: 7fr 5fr;
        gap: 56px;
    }

    .inspiration-copy h3 {
        font-size: 30px;
    }

    .journal-list h3 {
        font-size: 18px;
    }
}

/* ---------- 宽屏 ≥ 1440 ---------- */
@media (min-width: 1440px) {
    .stay-grid,
    .latest-stay-grid {
        column-gap: var(--space-6);
    }

    .home-hero h1 {
        letter-spacing: .06em;
    }
}

/* 首页主图：主地址与回退地址都失败时（media-fallback.js 标记 media-failed-host），
   沿用“无媒体”深色主视觉兜底，保证白色标题与失败提示都可读；不使用通用的浅砂色失败底（QA phase 7 r2） */
.home-hero-media.media-failed-host {
    background:
        radial-gradient(circle at 30% 120%, #2E5A4D 0 40%, transparent 41%),
        radial-gradient(circle at 80% 130%, #254F43 0 45%, transparent 46%),
        var(--night);
}

.home-hero-media.media-failed-host::before {
    place-items: start center;
    padding-top: 22%;
    color: var(--paper);
    font-size: 14px;
}
