/* ====== Reset & Base ====== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #fafaf8;
    color: #1a1a1a;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    /* 只讓出 topbar 高度；品類欄初始位於 Hero 下方（正常流），
       滾動超過 Hero 後才透過 JS 切換為 fixed 吸頂。*/
    padding-top: 52px;
}
img { display: block; max-width: 100%; }
button { background: none; border: none; cursor: pointer; font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

:root {
    --bg: #fafaf8;
    --bg-2: #f4f2ee;
    --line: #e8e4dd;
    --ink: #1a1a1a;
    --ink-2: #6b6b6b;
    --ink-3: #a8a8a8;
    --accent: #1a1a1a;
    --serif: 'Cormorant Garamond', 'Songti SC', 'STSong', serif;
}

/* ====== Topbar ====== */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(250, 250, 248, 0.92);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--line);
}
.topbar-inner {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    max-width: 480px;
    margin: 0 auto;
}
.icon-btn {
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border-radius: 50%;
    color: var(--ink);
    transition: background .2s;
}
.icon-btn:active { background: var(--bg-2); }
.brand {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 22px;
    letter-spacing: 0.18em;
    text-align: center;
    line-height: 1;
}
.brand-sub {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 300;
    letter-spacing: 0.3em;
    color: var(--ink-2);
    margin-top: 3px;
}
.brand-small { font-size: 18px; }

/* ====== Layout container ====== */
section, .foot {
    max-width: 480px;
    margin: 0 auto;
}

/* ====== Hero ====== */
.hero {
    background: linear-gradient(180deg, #f4f2ee 0%, #ebe7df 100%);
    padding: 16px 24px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.6) 0%, transparent 40%),
        radial-gradient(circle at 20% 80%, rgba(200,180,150,0.15) 0%, transparent 50%);
    pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; }
.hero-eyebrow {
    font-size: 9px;
    letter-spacing: 0.4em;
    color: var(--ink-2);
    margin-bottom: 8px;
}
.hero-title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 22px;
    line-height: 1.25;
    letter-spacing: 0.04em;
    color: var(--ink);
    margin-bottom: 6px;
}
.hero-desc {
    font-size: 11px;
    line-height: 1.6;
    color: var(--ink-2);
    margin-bottom: 12px;
    letter-spacing: 0.05em;
}
.hero-btn {
    border: 1px solid var(--ink);
    color: var(--ink);
    padding: 7px 20px;
    font-size: 11px;
    letter-spacing: 0.2em;
    border-radius: 0;
    transition: all .25s;
}
.hero-btn:active {
    background: var(--ink);
    color: #fff;
}

/* ====== Categories ====== */
.categories {
    background: rgba(250, 250, 248, 0.95);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--line);
    position: relative;
    z-index: 90;
}
/* 滾動超過 Hero 後，由 JS 切換成吸頂狀態 */
.categories.is-fixed {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
}
/* 佔位元素：當品類欄變為 fixed 時，補上同等高度避免內容跳動 */
.cat-spacer {
    height: 0;
    transition: none;
}
.cat-spacer.is-active {
    /* 高度由 JS 動態設定 */
}
.cat-track {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    max-width: 480px;
    margin: 0 auto;
}
.cat-track::-webkit-scrollbar { display: none; }
.cat-item {
    flex: 0 0 auto;
    padding: 8px 16px;
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--ink-2);
    border: 1px solid transparent;
    border-radius: 999px;
    white-space: nowrap;
    transition: all .2s;
}
.cat-item.active {
    color: var(--ink);
    border-color: var(--ink);
    background: var(--ink);
    color: #fff;
}

/* ====== Section head ====== */
.section-head {
    padding: 28px 16px 16px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}
.section-head h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 24px;
    letter-spacing: 0.08em;
}
.section-hint {
    font-size: 11px;
    color: var(--ink-3);
    letter-spacing: 0.15em;
}

/* 品类筛选锚点偏移：避开吸顶的 topbar(52px) + categories(约 58px) */
#products {
    scroll-margin-top: 110px;
}

/* ====== Featured horizontal scroll ====== */
.featured-track {
    display: flex;
    gap: 12px;
    padding: 0 16px 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.featured-track::-webkit-scrollbar { display: none; }
.featured-card {
    flex: 0 0 72%;
    scroll-snap-align: start;
    background: #fff;
    overflow: hidden;
    transition: transform .3s;
    cursor: pointer;
}
.featured-card:active { transform: scale(0.98); }
.featured-card .img {
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--bg-2);
}
.featured-card .img img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .6s;
}
.featured-card:active .img img { transform: scale(1.04); }
.featured-card .meta {
    padding: 12px 14px 16px;
}
.featured-card .name {
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 4px;
    letter-spacing: 0.02em;
}
.featured-card .price {
    font-family: var(--serif);
    font-size: 16px;
    color: var(--ink);
}

/* ====== Product grid ====== */
.product-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 0 4px 32px;
}
.product-card {
    background: #fff;
    cursor: pointer;
    transition: opacity .2s;
}
.product-card:active { opacity: 0.85; }
.product-card .img {
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--bg-2);
}
.product-card .img img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.product-card .meta {
    padding: 10px 10px 18px;
}
.product-card .tag {
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--ink-3);
    margin-bottom: 6px;
}
.product-card .name {
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 8px;
    min-height: 34px;
}
.product-card .price {
    font-family: var(--serif);
    font-size: 16px;
    font-weight: 500;
}

/* ====== Footer ====== */
.foot {
    padding: 48px 24px 32px;
    text-align: center;
    border-top: 1px solid var(--line);
    margin-top: 16px;
}
.foot-brand {
    font-family: var(--serif);
    font-size: 24px;
    letter-spacing: 0.2em;
    margin-bottom: 8px;
}
.foot-copy {
    font-size: 10px;
    color: var(--ink-3);
    letter-spacing: 0.15em;
    margin-bottom: 24px;
}
.foot-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    font-size: 11px;
    color: var(--ink-2);
    letter-spacing: 0.1em;
}

/* ====== Detail page ====== */
.page-detail { background: #fff; padding-bottom: 0; }

.gallery {
    position: relative;
    background: var(--bg-2);
    max-width: 480px;
    margin: 0 auto;
}
.gallery-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    aspect-ratio: 3 / 4;
}
.gallery-slide img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.gallery-dots {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}
.gallery-dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    transition: all .3s;
}
.gallery-dot.active {
    width: 18px;
    border-radius: 999px;
    background: #fff;
}

.info {
    padding: 24px 20px 8px;
    max-width: 480px;
    margin: 0 auto;
}
.info-tag {
    font-size: 10px;
    letter-spacing: 0.3em;
    color: var(--ink-3);
    margin-bottom: 10px;
}
.info-title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 26px;
    line-height: 1.3;
    letter-spacing: 0.04em;
    margin-bottom: 16px;
}
.info-price {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 18px;
}
.price-now {
    font-family: var(--serif);
    font-size: 28px;
    font-weight: 500;
    color: var(--ink);
}
.price-now::before { content: '¥'; font-size: 16px; margin-right: 2px; }
.price-old {
    font-size: 13px;
    color: var(--ink-3);
    text-decoration: line-through;
}
.price-old::before { content: '¥'; }
.info-desc {
    font-size: 13px;
    line-height: 1.8;
    color: var(--ink-2);
    letter-spacing: 0.03em;
}

.block {
    padding: 28px 20px 8px;
    max-width: 480px;
    margin: 0 auto;
    border-top: 1px solid var(--line);
    margin-top: 24px;
}
.block-title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 18px;
    letter-spacing: 0.1em;
    margin-bottom: 18px;
}

.size-table {
    margin: 0 -4px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.size-table::-webkit-scrollbar { display: none; }
.size-table table {
    width: 100%;
    min-width: 320px;
    border-collapse: collapse;
    font-size: 12px;
}
.size-table th,
.size-table td {
    border: 1px solid var(--line);
    padding: 11px 6px;
    text-align: center;
    white-space: nowrap;
    letter-spacing: 0.04em;
}
.size-table th {
    background: var(--bg-2);
    color: var(--ink-2);
    font-weight: 400;
    font-size: 11px;
}
.size-table td {
    color: var(--ink);
}
.size-table td.size-name {
    font-weight: 500;
    background: #fdfcfa;
    font-family: var(--serif);
    font-size: 14px;
    letter-spacing: 0.1em;
}
.size-note {
    font-size: 11px;
    color: var(--ink-3);
    line-height: 1.6;
    padding: 0 0 20px;
    letter-spacing: 0.03em;
}

.spec-list {
    padding-bottom: 20px;
}
.spec-row {
    display: flex;
    padding: 10px 0;
    font-size: 13px;
    border-bottom: 1px dashed var(--line);
}
.spec-row:last-child { border-bottom: none; }
.spec-key {
    width: 90px;
    color: var(--ink-3);
    flex-shrink: 0;
    letter-spacing: 0.05em;
}
.spec-val {
    color: var(--ink);
    flex: 1;
    line-height: 1.7;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 20px;
}
.audience-tag {
    padding: 7px 14px;
    background: var(--bg-2);
    border-radius: 999px;
    font-size: 12px;
    color: var(--ink-2);
    letter-spacing: 0.05em;
}

.detail-images {
    max-width: 480px;
    margin: 24px auto 0;
}
.detail-images img {
    width: 100%;
    margin-bottom: 4px;
}

.foot-detail {
    margin-top: 0;
    border-top: none;
    padding-top: 24px;
}

/* 聯絡資訊區塊 */
.contact-info {
    max-width: 480px;
    margin: 32px auto 0;
    padding: 32px 20px;
    text-align: center;
    background: linear-gradient(180deg, #f4f2ee 0%, #ebe7df 100%);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.contact-label {
    font-size: 10px;
    letter-spacing: 0.4em;
    color: var(--ink-3);
    margin-bottom: 12px;
}
.contact-text {
    font-family: var(--serif);
    font-size: 18px;
    line-height: 1.6;
    letter-spacing: 0.08em;
    color: var(--ink);
}
.contact-text strong {
    font-weight: 500;
    border-bottom: 1px solid var(--ink);
    padding: 0 2px 1px;
    margin: 0 2px;
}

/* topbar 佔位元素，保持品牌置中 */
.icon-btn-placeholder {
    display: inline-block;
    width: 36px;
    height: 36px;
}

/* ====== Responsive desktop ====== */
@media (min-width: 768px) {
    .hero { padding: 40px 24px 48px; }
    .hero-title { font-size: 38px; }
    .product-grid { grid-template-columns: repeat(3, 1fr); }
    .featured-card { flex: 0 0 38%; }
}

/* fade-in animation */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.product-card, .featured-card {
    animation: fadeUp .5s ease both;
}
