/*
 * 檔案名稱：public/assets/css/site.css
 * 修改日期：2026/07/22 19:40（UTC+8）
 * 檔案用途：網站前台與行動版導覽樣式
 * 修改說明：修正手機未開啟選單時可橫向滑動露出側邊選單的問題
 */

:root {
    --ink: #201812;
    --coffee: #5c301d;
    --coffee-dark: #24130d;
    --latte: #c99d6d;
    --cream: #f8f1e7;
    --paper: #fffdf9;
    --line: rgba(42, 26, 17, 0.14);
    --danger: #a33a35;
    --success: #316b4f;
    --shadow: 0 22px 70px rgba(45, 25, 14, 0.13);
    --container: min(1180px, calc(100vw - 40px));
}

* {
    box-sizing: border-box;
}

html {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
    overscroll-behavior-x: none;
    scroll-behavior: smooth;
}

body {
    width: 100%;
    max-width: 100%;
    margin: 0;
    overflow-x: clip;
    overscroll-behavior-x: none;
    color: var(--ink);
    background: var(--paper);
    font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    line-height: 1.7;
}

body.menu-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
.btn {
    white-space: nowrap;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(31, 18, 12, 0.94);
    color: #fff;
    backdrop-filter: blur(16px);
}

.site-header__bar {
    width: var(--container);
    min-height: 84px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 30px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    flex: 0 0 auto;
}

.brand__mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 50%;
    color: #f3d6ae;
    font-family: Georgia, serif;
    font-size: 25px;
}

.brand__text {
    display: grid;
    line-height: 1.25;
}

.brand__text strong {
    font-size: 16px;
    letter-spacing: 0.04em;
}

.brand__text small {
    color: #cdb899;
    font-family: Georgia, serif;
    font-size: 10px;
    letter-spacing: 0.16em;
}

.main-nav {
    flex: 1 1 auto;
}

.main-nav > ul {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(12px, 2vw, 30px);
    margin: 0;
    padding: 0;
    list-style: none;
}

.main-nav > ul > li {
    position: relative;
    display: flex;
    align-items: center;
}

.main-nav a {
    display: block;
    padding: 28px 0;
    font-size: 14px;
    letter-spacing: 0.05em;
}

.submenu {
    position: absolute;
    top: calc(100% - 10px);
    left: 50%;
    min-width: 220px;
    margin: 0;
    padding: 14px;
    list-style: none;
    background: #fff;
    color: var(--ink);
    border-radius: 16px;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 12px);
    transition: 0.22s ease;
}

.submenu a {
    padding: 9px 12px;
    border-radius: 9px;
}

.submenu a:hover {
    background: var(--cream);
}

.has-children:hover > .submenu,
.has-children:focus-within > .submenu {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.submenu-toggle,
.main-nav__mobile-head,
.main-nav__mobile-actions,
.menu-toggle,
.menu-backdrop {
    display: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 0 0 auto;
    font-size: 13px;
}

.cart-link {
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
}

.cart-link span {
    min-width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    margin-left: 5px;
    border-radius: 50%;
    background: var(--latte);
    color: var(--coffee-dark);
    font-weight: 700;
}

.hero {
    min-height: calc(100vh - 84px);
    position: relative;
    display: grid;
    align-items: end;
    overflow: hidden;
    background: #1f120c;
}

.hero__media {
    position: absolute;
    inset: 0;
}

.hero__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.72;
}

.hero__media::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(19, 9, 5, 0.83), rgba(19, 9, 5, 0.18) 68%),
        linear-gradient(0deg, rgba(19, 9, 5, 0.8), transparent 58%);
}

.hero__content {
    position: relative;
    z-index: 1;
    width: var(--container);
    margin: 0 auto;
    padding: 120px 0 90px;
    color: #fff;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    color: #e7c99f;
    font-family: Georgia, serif;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.eyebrow::before {
    content: "";
    width: 44px;
    height: 1px;
    background: currentColor;
}

.hero h1 {
    max-width: 760px;
    margin: 0;
    font-family: Georgia, "Noto Serif TC", serif;
    font-size: clamp(48px, 8vw, 108px);
    font-weight: 500;
    line-height: 0.98;
    letter-spacing: -0.04em;
}

.hero p {
    max-width: 620px;
    margin: 28px 0 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: clamp(16px, 2vw, 20px);
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 34px;
}

.btn {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: 0.2s ease;
}

.btn--primary {
    background: var(--latte);
    color: var(--coffee-dark);
    font-weight: 700;
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.btn--light {
    border-color: rgba(255, 255, 255, 0.42);
    color: #fff;
}

.btn--outline {
    border-color: var(--line);
    background: transparent;
}

.btn--danger {
    background: var(--danger);
    color: #fff;
}

.section {
    padding: 110px 0;
}

.section--cream {
    background: var(--cream);
}

.section__inner {
    width: var(--container);
    margin: 0 auto;
}

.section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.55fr);
    align-items: end;
    gap: 40px;
    margin-bottom: 50px;
}

.section-heading h2 {
    margin: 0;
    font-family: Georgia, "Noto Serif TC", serif;
    font-size: clamp(38px, 5.2vw, 72px);
    font-weight: 500;
    line-height: 1.05;
}

.section-heading p {
    margin: 0;
    color: #6f625a;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 22px;
}

.category-card {
    position: relative;
    min-height: 340px;
    grid-column: span 4;
    overflow: hidden;
    border-radius: 28px;
    background: #1d120d;
    color: #fff;
    box-shadow: var(--shadow);
}

.category-card:nth-child(1),
.category-card:nth-child(5) {
    grid-column: span 8;
}

.category-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.category-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(20, 10, 6, 0.84), rgba(20, 10, 6, 0.05) 70%);
}

.category-card:hover img {
    transform: scale(1.035);
}

.category-card__content {
    position: absolute;
    z-index: 1;
    left: 28px;
    right: 28px;
    bottom: 24px;
}

.category-card h3 {
    margin: 0 0 6px;
    font-family: Georgia, "Noto Serif TC", serif;
    font-size: 30px;
}

.category-card p {
    margin: 0;
    color: rgba(255, 255, 255, 0.72);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
}

.product-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: #fff;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow);
}

.product-card__image {
    aspect-ratio: 4 / 3;
    background: var(--cream);
}

.product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-card__body {
    padding: 20px;
}

.product-card__sku {
    color: #92745d;
    font-family: monospace;
    font-size: 12px;
    letter-spacing: 0.08em;
}

.product-card h3 {
    min-height: 2.8em;
    margin: 8px 0 8px;
    line-height: 1.4;
}

.price {
    color: var(--coffee);
    font-size: 20px;
    font-weight: 800;
}

.price--inquiry {
    color: #6f625a;
    font-size: 14px;
    font-weight: 600;
}

.content-shell {
    width: var(--container);
    margin: 0 auto;
    padding: 70px 0 110px;
}

.page-hero {
    padding: 80px 0 60px;
    background: var(--coffee-dark);
    color: #fff;
}

.page-hero__inner {
    width: var(--container);
    margin: 0 auto;
}

.page-hero h1 {
    margin: 0;
    font-family: Georgia, "Noto Serif TC", serif;
    font-size: clamp(42px, 6vw, 76px);
    font-weight: 500;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 34px;
}

.filter-link {
    padding: 9px 15px;
    border: 1px solid var(--line);
    border-radius: 999px;
}

.filter-link.is-active {
    background: var(--coffee-dark);
    color: #fff;
}

.product-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.86fr);
    gap: clamp(40px, 7vw, 100px);
    align-items: start;
}

.product-detail__image {
    overflow: hidden;
    border-radius: 30px;
    background: var(--cream);
    box-shadow: var(--shadow);
}

.product-detail__image img {
    width: 100%;
    object-fit: contain;
}

.product-detail h1 {
    margin: 10px 0;
    font-family: Georgia, "Noto Serif TC", serif;
    font-size: clamp(38px, 5vw, 64px);
    line-height: 1.08;
}

.stock-note {
    display: inline-flex;
    margin: 14px 0;
    padding: 6px 11px;
    border-radius: 999px;
    background: #edf5ef;
    color: var(--success);
    font-size: 13px;
}

.stock-note.is-empty {
    background: #f6ecea;
    color: var(--danger);
}

.form-card,
.table-card,
.member-card {
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 12px 40px rgba(54, 30, 18, 0.06);
}

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

.field {
    display: grid;
    gap: 7px;
}

.field--full {
    grid-column: 1 / -1;
}

.field label {
    font-weight: 700;
    font-size: 14px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    border: 1px solid #d8cdc3;
    border-radius: 10px;
    background: #fff;
}

.field textarea {
    min-height: 120px;
    resize: vertical;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: #705f54;
    font-size: 13px;
}

.cart-product {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 260px;
}

.cart-product img {
    width: 70px;
    height: 58px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--cream);
}

.order-timeline {
    position: relative;
    display: grid;
    gap: 0;
    padding-left: 26px;
}

.order-timeline::before {
    content: "";
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: 7px;
    width: 2px;
    background: #dfd1c6;
}

.timeline-item {
    position: relative;
    padding: 0 0 28px 18px;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -26px;
    top: 8px;
    width: 14px;
    height: 14px;
    border: 3px solid var(--paper);
    border-radius: 50%;
    background: var(--latte);
    box-shadow: 0 0 0 2px var(--latte);
}

.timeline-item h3 {
    margin: 0;
    font-size: 16px;
}

.timeline-item time {
    color: #8c7b70;
    font-size: 12px;
}

.cms-content {
    max-width: 860px;
    overflow-wrap: anywhere;
}

.cms-content img {
    max-width: 100%;
    height: auto;
}

.cms-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

.cms-content iframe,
.cms-content video {
    max-width: 100%;
}

.cms-content h2,
.cms-content h3,
.cms-content h4 {
    margin-top: 1.8em;
    line-height: 1.3;
}

.cms-content blockquote,
.content-note,
.content-highlight {
    margin: 1.5em 0;
    padding: 18px 22px;
    border-left: 4px solid var(--latte);
    background: var(--cream);
}

.store-strip {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 40px;
    align-items: center;
    padding: 48px;
    border-radius: 30px;
    background: var(--coffee-dark);
    color: #fff;
}

.store-strip h2 {
    margin: 0 0 14px;
    font-family: Georgia, "Noto Serif TC", serif;
    font-size: clamp(34px, 5vw, 60px);
    line-height: 1.08;
}

.site-footer {
    padding: 70px 0 24px;
    background: #160d09;
    color: rgba(255, 255, 255, 0.78);
}

.site-footer__grid,
.site-footer__bottom {
    width: var(--container);
    margin: 0 auto;
}

.site-footer__grid {
    display: grid;
    grid-template-columns: 1.5fr 0.7fr 0.9fr;
    gap: 50px;
}

.site-footer h2,
.site-footer h3 {
    color: #fff;
}

.site-footer a {
    display: block;
    margin: 8px 0;
}

.site-footer__bottom {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 54px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 13px;
}

.toast-stack {
    position: fixed;
    z-index: 3000;
    right: 20px;
    bottom: 20px;
    display: grid;
    gap: 10px;
}

.toast {
    min-width: 280px;
    max-width: min(420px, calc(100vw - 40px));
    padding: 14px 17px;
    border-radius: 12px;
    background: #1f1712;
    color: #fff;
    box-shadow: var(--shadow);
    animation: toast-in 0.25s ease;
}

.toast.is-error {
    background: #8b302d;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1050px) {
    .header-actions {
        display: none;
    }

    .menu-toggle {
        width: 46px;
        height: 46px;
        display: grid;
        place-content: center;
        gap: 5px;
        margin-left: auto;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 50%;
        background: transparent;
        color: #fff;
    }

    .menu-toggle span {
        width: 20px;
        height: 2px;
        background: currentColor;
    }

    .main-nav {
        position: fixed;
        z-index: 1200;
        inset: 0 0 0 auto;
        width: min(390px, 88vw);
        max-width: 100vw;
        height: 100dvh;
        padding: 22px;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        background: #1a0f0a;
        clip-path: inset(0 0 0 100%);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition:
            clip-path 0.28s ease,
            opacity 0.2s ease,
            visibility 0s linear 0.28s;
        contain: layout paint;
    }

    body.menu-open .main-nav {
        clip-path: inset(0 0 0 0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition-delay: 0s;
    }

    .main-nav__mobile-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    }

    .main-nav__mobile-head button {
        border: 0;
        background: transparent;
        color: #fff;
        font-size: 34px;
    }

    .main-nav > ul {
        display: block;
        margin-top: 15px;
    }

    .main-nav > ul > li {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 44px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    }

    .main-nav a {
        padding: 15px 0;
    }

    .submenu-toggle {
        display: block;
        border: 0;
        background: transparent;
        color: #fff;
        font-size: 20px;
    }

    .submenu {
        position: static;
        grid-column: 1 / -1;
        min-width: 0;
        display: none;
        padding: 0 0 10px 16px;
        background: transparent;
        color: rgba(255, 255, 255, 0.78);
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .has-children.is-open > .submenu {
        display: block;
    }

    .main-nav__mobile-actions {
        display: flex;
        gap: 18px;
        padding-top: 20px;
    }

    .menu-backdrop {
        position: fixed;
        z-index: 1100;
        inset: 0;
        display: block;
        background: rgba(0, 0, 0, 0.56);
        opacity: 0;
        visibility: hidden;
        transition: 0.25s ease;
    }

    body.menu-open .menu-backdrop {
        opacity: 1;
        visibility: visible;
    }

    .product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    :root {
        --container: min(100% - 28px, 1180px);
    }

    .site-header__bar {
        min-height: 70px;
    }

    .brand__text strong {
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .hero {
        min-height: calc(92dvh - 70px);
    }

    .hero__content {
        padding: 100px 0 54px;
    }

    .hero h1 {
        font-size: clamp(48px, 15vw, 76px);
    }

    .section {
        padding: 76px 0;
    }

    .section-heading {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .category-grid,
    .product-grid {
        grid-template-columns: 1fr;
    }

    .category-card,
    .category-card:nth-child(1),
    .category-card:nth-child(5) {
        min-height: 310px;
        grid-column: 1;
    }

    .product-detail,
    .store-strip,
    .site-footer__grid {
        grid-template-columns: 1fr;
    }

    .store-strip {
        padding: 30px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .field--full {
        grid-column: auto;
    }

    .site-footer__bottom {
        flex-direction: column;
    }
}

/* Multi-level menu protection */
.submenu .has-children {
    position: relative;
}

.submenu .has-children > .submenu {
    top: -14px;
    left: calc(100% + 8px);
    transform: translate(12px, 0);
}

.submenu .has-children:hover > .submenu,
.submenu .has-children:focus-within > .submenu {
    transform: translate(0, 0);
}

@media (max-width: 880px) {
    .main-nav .submenu .submenu {
        margin-left: 14px;
        padding-left: 12px;
        border-left: 1px solid rgba(255, 255, 255, 0.18);
    }
}
