* {
    box-sizing: border-box;
}

:root {
    color-scheme: light;
    --page: #f5f1eb;
    --surface: #fffdf9;
    --surface-strong: #ffffff;
    --ink: #201f1d;
    --muted: #746f68;
    --line: rgba(32, 31, 29, 0.12);
    --accent: #8b6e56;
    --accent-soft: #e9ded3;
    --shadow: 0 18px 50px rgba(57, 45, 35, 0.09);
    --radius-lg: 24px;
    --radius-md: 16px;
    --content-width: 1440px;
}

html {
    scroll-behavior: smooth;
    background: var(--page);
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--page);
    color: var(--ink);
    font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

button,
.product-card {
    -webkit-tap-highlight-color: transparent;
}

[hidden] {
    display: none !important;
}

.site-shell {
    min-height: 100vh;
}

.hero {
    position: relative;
    min-height: clamp(230px, 42vw, 500px);
    overflow: hidden;
    background: #e7e0d7;
    isolation: isolate;
}

.hero-image,
.hero-shade {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.hero-image {
    object-fit: cover;
    object-position: center;
}

.hero-shade {
    z-index: 1;
    background: linear-gradient(90deg, rgba(26, 24, 22, 0.54) 0%, rgba(26, 24, 22, 0.13) 48%, rgba(26, 24, 22, 0.04) 100%);
}

.hero-copy {
    position: relative;
    z-index: 2;
    display: flex;
    min-height: inherit;
    width: min(var(--content-width), 100%);
    margin: 0 auto;
    padding: clamp(32px, 6vw, 88px) clamp(20px, 5vw, 72px);
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    color: #fff;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.22);
}

.eyebrow,
.section-kicker {
    margin: 0 0 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.22em;
}

.hero-copy h1 {
    margin: 0;
    font-family: "SimSun", "Songti SC", serif;
    font-size: clamp(38px, 7vw, 82px);
    font-weight: 500;
    letter-spacing: 0.08em;
}

.hero-copy > p:last-child {
    margin: 14px 0 0;
    font-size: clamp(14px, 2vw, 18px);
    letter-spacing: 0.12em;
}

.catalog-shell {
    width: min(var(--content-width), 100%);
    margin: 0 auto;
    padding: clamp(28px, 5vw, 64px) clamp(14px, 4vw, 48px) 64px;
}

.catalog-heading {
    display: flex;
    gap: 24px;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-kicker {
    color: var(--accent);
}

.catalog-heading h2 {
    margin: 0;
    font-family: "SimSun", "Songti SC", serif;
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 600;
}

.catalog-count {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}

.catalog-tools {
    position: sticky;
    top: 0;
    z-index: 20;
    margin: 0 -4px 28px;
    padding: 10px 4px 12px;
    background: color-mix(in srgb, var(--page) 92%, transparent);
    backdrop-filter: blur(16px);
}

.search-box {
    display: flex;
    width: min(520px, 100%);
    min-height: 48px;
    margin-bottom: 14px;
    padding: 0 10px 0 15px;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 253, 249, 0.92);
    box-shadow: 0 8px 22px rgba(57, 45, 35, 0.04);
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 110, 86, 0.12);
}

.search-box svg {
    width: 20px;
    flex: 0 0 auto;
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.8;
    stroke-linecap: round;
}

.search-box input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font-size: 14px;
}

.search-box input::placeholder {
    color: #99928a;
}

.search-clear {
    padding: 7px 9px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font-size: 13px;
}

.category-nav {
    overflow: hidden;
}

.category-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 1px 5px;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.category-tab {
    min-height: 42px;
    padding: 0 18px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 253, 249, 0.78);
    color: var(--muted);
    cursor: pointer;
    scroll-snap-align: start;
    transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.category-tab:hover {
    border-color: rgba(139, 110, 86, 0.42);
    color: var(--ink);
}

.category-tab[aria-selected="true"] {
    border-color: var(--ink);
    background: var(--ink);
    color: #fff;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.product-card {
    min-width: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(32, 31, 29, 0.08);
    border-radius: var(--radius-md);
    background: var(--surface-strong);
    box-shadow: 0 8px 26px rgba(57, 45, 35, 0.05);
    cursor: zoom-in;
    text-align: left;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.product-image-wrap {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: linear-gradient(145deg, #f5f3ef, #eee9e2);
}

.product-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 260ms ease, opacity 180ms ease;
}

.product-image.is-loading {
    opacity: 0;
}

.product-image-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 16px;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

.product-info {
    display: flex;
    min-height: 62px;
    padding: 12px 13px 14px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.product-model {
    overflow: hidden;
    color: var(--ink);
    font-size: 14px;
    font-weight: 650;
    letter-spacing: 0.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-open-hint {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

.empty-state {
    min-height: 320px;
    padding: 56px 20px;
    border: 1px dashed rgba(32, 31, 29, 0.18);
    border-radius: var(--radius-lg);
    background: rgba(255, 253, 249, 0.52);
    color: var(--muted);
    text-align: center;
}

.empty-state > span {
    display: block;
    margin-bottom: 12px;
    font-size: 38px;
}

.empty-state h3 {
    margin: 0 0 8px;
    color: var(--ink);
    font-size: 18px;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

.site-footer {
    padding: 24px 20px calc(32px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    color: var(--muted);
    text-align: center;
    font-size: 12px;
    letter-spacing: 0.08em;
}

.back-to-top {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 30;
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(32, 31, 29, 0.92);
    box-shadow: var(--shadow);
    color: #fff;
    cursor: pointer;
}

.back-to-top svg,
.viewer-close svg,
.viewer-arrow svg {
    width: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.image-viewer {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    place-items: center;
}

.viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(18, 17, 16, 0.88);
    backdrop-filter: blur(12px);
}

.viewer-panel {
    position: relative;
    z-index: 1;
    display: flex;
    width: min(1100px, 100%);
    height: min(860px, 100%);
    padding: 16px;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 22px;
    background: rgba(28, 27, 25, 0.96);
    box-shadow: 0 28px 100px rgba(0, 0, 0, 0.42);
    color: #fff;
}

.viewer-header {
    display: flex;
    min-height: 56px;
    padding: 2px 2px 12px 8px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.viewer-header p,
.viewer-header h2 {
    margin: 0;
}

.viewer-header p {
    margin-bottom: 4px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.viewer-header h2 {
    font-size: 18px;
    font-weight: 650;
}

.viewer-close,
.viewer-arrow {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
}

.viewer-close {
    width: 44px;
    height: 44px;
}

.viewer-stage {
    display: grid;
    min-height: 0;
    flex: 1;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    align-items: center;
    gap: 12px;
}

.viewer-arrow {
    width: 46px;
    height: 46px;
}

.viewer-image-wrap {
    position: relative;
    display: grid;
    min-width: 0;
    height: 100%;
    min-height: 0;
    place-items: center;
    overflow: hidden;
    border-radius: 14px;
    background: #f4f1ed;
}

.viewer-image-wrap img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-fallback {
    color: #605b55;
    font-size: 14px;
}

.viewer-position {
    margin: 12px 0 0;
    color: rgba(255, 255, 255, 0.62);
    text-align: center;
    font-size: 12px;
}

body.viewer-open {
    overflow: hidden;
}

:focus-visible {
    outline: 3px solid rgba(139, 110, 86, 0.48);
    outline-offset: 3px;
}

@media (hover: hover) {
    .product-card:hover {
        transform: translateY(-5px);
        border-color: rgba(139, 110, 86, 0.24);
        box-shadow: 0 18px 44px rgba(57, 45, 35, 0.11);
    }

    .product-card:hover .product-image {
        transform: scale(1.025);
    }

    .viewer-close:hover,
    .viewer-arrow:hover {
        background: rgba(255, 255, 255, 0.16);
    }
}

@media (min-width: 700px) {
    .catalog-tools {
        display: grid;
        grid-template-columns: minmax(290px, 420px) minmax(0, 1fr);
        align-items: center;
        gap: 22px;
    }

    .search-box {
        margin: 0;
    }

    .category-tabs {
        justify-content: flex-end;
    }

    .products-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 18px;
    }
}

@media (min-width: 1000px) {
    .products-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 22px;
    }

    .product-info {
        padding: 14px 16px 16px;
    }
}

@media (min-width: 1320px) {
    .products-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .hero {
        min-height: 250px;
    }

    .hero-image {
        object-position: 46% center;
    }

    .hero-shade {
        background: linear-gradient(90deg, rgba(26, 24, 22, 0.57), rgba(26, 24, 22, 0.08));
    }

    .catalog-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .catalog-count {
        margin: 0;
    }

    .catalog-tools {
        margin-bottom: 18px;
    }

    .category-tab {
        min-height: 40px;
        padding: 0 15px;
        font-size: 14px;
    }

    .viewer-panel {
        padding: 12px;
        border-radius: 18px;
    }

    .viewer-stage {
        grid-template-columns: 38px minmax(0, 1fr) 38px;
        gap: 6px;
    }

    .viewer-arrow {
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 360px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
