/* ==========================================================================
   Demeter State 鴻通貿易 — 前台樣式
   設計依據：202405-官網.xd（桌機 1920 / 手機 414）
   ========================================================================== */

:root {
    --brand: #308ca3;
    --brand-dark: #37828a;
    --brand-deep: #007a8a;
    --brand-band: #4294a8;
    --ink: #222;
    --ink-soft: #555;
    --muted: #707070;
    --line: #d1d1d1;
    --grey: #ededed;
    --paper: #f4f1ea;
    --white: #fff;
    --pin: #a72034;
    --radius: 6px;
    --container: 1140px;
    --header-h: 88px;
    --font: "Noto Sans TC", "Segoe UI", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
    --shadow: 0 10px 30px rgba(0, 0, 0, .08);
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.8;
    color: var(--ink);
    background: var(--white);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-deep); text-decoration: none; }
a:hover { color: var(--brand); }
h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .5em; font-weight: 500; }
p { margin: 0 0 1em; }
small { font-size: .85em; }

.container { width: 100%; max-width: calc(var(--container) + 48px); margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 760px; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: 16px; top: -60px; z-index: 1000;
    background: var(--brand-deep); color: #fff; padding: 8px 16px; border-radius: var(--radius);
}
.skip-link:focus { top: 12px; color: #fff; }

:focus-visible { outline: 3px solid rgba(48, 140, 163, .55); outline-offset: 3px; }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255, 255, 255, .97);
    backdrop-filter: saturate(160%) blur(8px);
    transition: box-shadow .25s ease;
}
.site-header.is-scrolled { box-shadow: 0 2px 16px rgba(0, 0, 0, .08); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }
.brand img { width: 200px; height: auto; }

.site-nav ul { list-style: none; display: flex; gap: 36px; margin: 0; padding: 0; }
.site-nav a {
    position: relative; display: block; padding: 6px 0;
    color: #333; font-size: 17px; letter-spacing: .06em;
}
.site-nav a::after {
    content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 2px;
    background: var(--brand); transition: right .25s ease;
}
.site-nav a:hover, .site-nav a.active { color: var(--brand-deep); }
.site-nav a:hover::after, .site-nav a.active::after { right: 0; }

.nav-toggle { display: none; }

/* ---------- Banner / Hero ---------- */
.page-banner {
    height: clamp(220px, 34vw, 560px);
    background: #cfd8da var(--banner) center / cover no-repeat;
}
.page-banner--empty { height: 24px; background: none; }

.hero {
    position: relative;
    min-height: clamp(420px, 38.5vw, 740px);
    display: grid; place-items: center;
    background: #e9eef0 var(--banner) center / cover no-repeat;
    text-align: center; padding: 48px 24px;
}
.hero__inner { position: relative; display: flex; flex-direction: column; align-items: center; }
.hero__logo { margin: 0; }
.hero__logo img { width: min(460px, 78vw); }
.hero__rule { width: 74px; height: 4px; margin: 28px 0 24px; background: var(--brand); border-radius: 2px; }
.hero__slogan { margin: 0; font-size: clamp(15px, 1.2vw, 18px); color: #333; letter-spacing: .08em; line-height: 2; }

/* ---------- Sections ---------- */
.section { padding: clamp(56px, 7vw, 110px) 0; }
.section--tight { padding-top: 0; }
.section--grey { background: var(--grey); }
.section-more { text-align: center; margin: 40px 0 0; }

.section-heading { margin-bottom: 36px; }
.section-heading__zh {
    display: inline-flex; align-items: center; gap: 14px; margin: 0 0 6px;
    color: var(--brand-dark); font-size: 20px; letter-spacing: .45em; line-height: 1.4;
}
.section-heading__zh::after { content: ""; width: 44px; height: 1px; background: currentColor; }
.section-heading__en {
    margin: 0; color: var(--brand-dark);
    font-size: clamp(26px, 2.3vw, 36px); font-weight: 400; letter-spacing: .02em;
}
.section-heading.is-light .section-heading__zh,
.section-heading.is-light .section-heading__en { color: #fff; }
.section-heading.is-center { text-align: center; }
.section-heading.is-center .section-heading__zh { justify-content: center; }
.section-heading.is-center .section-heading__zh::before { content: ""; width: 44px; height: 1px; background: currentColor; }

.sub-heading { font-size: 22px; color: var(--brand-dark); margin: 56px 0 24px; }
.sub-heading.is-center { text-align: center; }

.prose { max-width: 620px; color: #333; font-size: 16px; line-height: 2; text-align: justify; }
.prose--wide { max-width: 900px; }
.prose--center { margin-left: auto; margin-right: auto; text-align: center; max-width: 820px; }
.prose p:last-child { margin-bottom: 0; }
.lead { font-size: 17px; color: #333; }
.tagline { font-size: clamp(18px, 1.6vw, 24px); color: var(--brand-dark); margin: 0 0 28px; letter-spacing: .04em; }
.tagline.is-center { text-align: center; }
.muted { color: var(--muted); }
.eyebrow { color: var(--brand); letter-spacing: .2em; font-size: 14px; margin: 0 0 6px; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

.watermark {
    position: absolute; left: 3%; bottom: -.18em; z-index: 1;
    font-size: clamp(56px, 7.3vw, 140px); line-height: 1; font-weight: 300;
    color: rgba(255, 255, 255, .78); white-space: nowrap; pointer-events: none; letter-spacing: .01em;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 32px; border: 0; border-radius: 999px; cursor: pointer;
    background: var(--brand-deep); color: #fff; font: inherit; font-size: 16px; letter-spacing: .1em;
    transition: background .2s ease, transform .2s ease;
}
.btn:hover { background: var(--brand); color: #fff; transform: translateY(-1px); }
.btn--light { background: #fff; color: var(--brand-deep); }
.btn--light:hover { background: #f1f7f8; color: var(--brand-deep); }
.btn-link {
    display: inline-flex; align-items: center; gap: 10px; color: var(--brand-deep); letter-spacing: .12em;
    border-bottom: 1px solid currentColor; padding-bottom: 2px;
}
.btn-link::after { content: "→"; transition: transform .2s ease; }
.btn-link:hover::after { transform: translateX(4px); }

/* ---------- Service curve ---------- */
.service-curve { position: relative; margin: 24px auto 0; max-width: 1132px; }
.service-curve__art { width: 100%; }
.service-list { list-style: none; margin: 0; padding: 0; }
.service-item__icon { display: none; }

@media (min-width: 900px) {
    .service-list { position: absolute; inset: 0; }
    .service-item { position: absolute; top: 37%; width: 25.5%; }
    .service-item:nth-child(1) { left: 4.8%; }
    .service-item:nth-child(2) { left: 39%; }
    .service-item:nth-child(3) { left: 72.5%; }
    .service-item__title {
        margin: 0 0 10px; text-align: center; color: var(--accent);
        font-size: clamp(17px, 1.6vw, 22px); letter-spacing: .4em; text-indent: .4em;
    }
    .service-item__body { margin: 0; font-size: clamp(13px, 1.05vw, 16px); line-height: 1.75; color: #333; }
}

@media (max-width: 899.98px) {
    .service-curve__art { display: none; }
    .service-list { display: grid; gap: 20px; }
    .service-item {
        position: relative; padding: 28px 24px 24px 88px; border-radius: 18px; background: #fff;
        box-shadow: var(--shadow); border-left: 5px solid var(--accent);
    }
    .service-item__icon {
        display: grid; place-items: center; position: absolute; left: 22px; top: 26px;
        width: 48px; height: 48px; border-radius: 50%; color: var(--accent);
        background: color-mix(in srgb, var(--accent) 12%, #fff);
    }
    .service-item__icon svg { width: 26px; height: 26px; }
    .service-item__title { color: var(--accent); font-size: 20px; letter-spacing: .3em; margin-bottom: 6px; }
    .service-item__body { margin: 0; color: #333; }
}

/* ---------- Home about ---------- */
.home-about { position: relative; display: grid; grid-template-columns: 1fr 1fr; background: var(--grey); min-height: 540px; overflow: hidden; }
.home-about__media {
    position: relative; background: #e6e2dc var(--img) center / cover no-repeat;
    clip-path: polygon(0 0, 100% 0, 78% 100%, 0 100%);
    margin-right: -14%;
}
.home-about__content { padding: clamp(48px, 6vw, 100px) 24px; padding-left: clamp(24px, 9vw, 160px); align-self: center; max-width: 720px; }
.home-about .prose { margin-bottom: 28px; }

/* ---------- About ---------- */
.about-intro .prose { max-width: 900px; }
.logo-story { display: grid; grid-template-columns: 200px 1fr; gap: 48px; align-items: center; margin-top: 56px; }
.logo-story__emblem { width: 200px; }
.logo-story__title { color: var(--brand-dark); font-size: 20px; }

.feature { display: grid; grid-template-columns: 1fr 1fr; align-items: center; min-height: 520px; background: #fff; }
.feature:nth-of-type(even) { background: #f6f6f6; }
.feature__media { position: relative; height: 100%; min-height: 380px; overflow: hidden; }
.feature__media img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.feature__content { padding: clamp(48px, 6vw, 96px) clamp(24px, 6vw, 110px); max-width: 760px; }
.feature--reverse .feature__media { order: 2; }
.feature--reverse .watermark { left: auto; right: 3%; }

/* ---------- Advantage ---------- */
.advantage { background: linear-gradient(var(--brand-band) 0 50%, var(--grey) 50% 100%); padding-bottom: 80px; }
.advantage__band { position: relative; padding: 80px 0 0; overflow: hidden; }
.advantage__band .watermark { color: rgba(255, 255, 255, .14); bottom: auto; top: 60px; left: 0; }
.advantage__band .section-heading { position: relative; z-index: 2; }
.advantage__grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; position: relative; z-index: 2; }
.advantage-card { background: #fff; padding: 40px 28px 36px; text-align: center; box-shadow: var(--shadow); }
.advantage-card img { width: 150px; margin: 0 auto 18px; }
.advantage-card h3 { color: var(--brand-dark); font-size: 22px; letter-spacing: .2em; }
.advantage-card p { margin: 0; color: #444; }

/* ---------- Products ---------- */
.product-grid { list-style: none; padding: 0; margin: 48px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px 40px; }
.product-grid--small { grid-template-columns: repeat(4, 1fr); gap: 24px; margin-top: 0; }
.product-card { display: block; color: var(--ink); text-align: center; }
.product-card__media { display: block; aspect-ratio: 3 / 2; overflow: hidden; background: #f3f3f3; }
.product-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.product-card:hover .product-card__media img { transform: scale(1.05); }
.product-card__name {
    display: inline-block; margin-top: 18px; padding-bottom: 8px; font-size: 20px; color: var(--brand-dark);
    border-bottom: 3px solid var(--brand-dark); letter-spacing: .08em;
}
.product-grid--small .product-card__name { font-size: 16px; border-bottom-width: 2px; }

.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--muted); margin-bottom: 32px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand-deep); }

.product-detail { display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: start; }
.product-detail__media img { width: 100%; border-radius: var(--radius); }
.product-detail h1 { color: var(--brand-dark); font-size: 32px; }
.product-detail .btn { margin-top: 28px; }

/* ---------- Contact ---------- */
.contact-cards { list-style: none; padding: 0; margin: 40px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.contact-cards a, .contact-cards div {
    display: flex; align-items: center; gap: 18px; height: 100%; padding: 26px 28px; border-radius: 10px;
    background: var(--brand-band); color: #fff; transition: background .2s ease;
}
.contact-cards a:hover { background: var(--brand-deep); color: #fff; }
.contact-cards svg { width: 40px; height: 40px; flex: none; fill: #fff; opacity: .9; }
.contact-cards span { display: grid; min-width: 0; }
.contact-cards small { font-size: 14px; opacity: .85; }
.contact-cards strong { font-size: clamp(16px, 1.4vw, 21px); font-weight: 500; word-break: break-all; }

.contact-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-top: 56px; align-items: start; }
.contact-address { display: flex; gap: 10px; align-items: center; font-size: 18px; color: var(--brand-dark); }
.contact-address svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
.contact-map iframe { width: 100%; aspect-ratio: 4 / 3; border: 0; border-radius: 10px; box-shadow: var(--shadow); }

.contact-form { background: #f6f8f8; padding: 32px; border-radius: 12px; }
.contact-form .sub-heading { margin-top: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 15px; color: #333; }
.field em { color: var(--pin); font-style: normal; }
.field input, .field select, .field textarea {
    width: 100%; font: inherit; font-size: 16px; padding: 10px 14px; border: 1px solid #c9d3d5; border-radius: 8px; background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(48, 140, 163, .18); }
.field textarea { resize: vertical; }
.field-error { color: var(--pin); font-size: 14px; }
.input-validation-error { border-color: var(--pin) !important; }
.form-errors ul { margin: 0 0 16px; padding: 12px 16px 12px 32px; background: #fdecee; color: var(--pin); border-radius: 8px; }
.validation-summary-valid { display: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Status pages ---------- */
.status-page { text-align: center; min-height: 50vh; }
.status-page__code { font-size: clamp(56px, 8vw, 110px); color: var(--brand); font-weight: 300; line-height: 1; margin-bottom: 12px; }
.status-page h1 { color: var(--brand-dark); }
.status-page .btn { margin-top: 12px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--brand-deep); color: #fff; padding: 56px 0 24px; font-size: 14px; }
.footer-inner { display: grid; grid-template-columns: 1.1fr 1fr 1.3fr; gap: 32px; align-items: start; }
.footer-brand img { width: 220px; }
.footer-contact { margin: 0; display: grid; gap: 6px; }
.footer-contact > div { display: grid; grid-template-columns: 56px 1fr; gap: 8px; }
.footer-contact dt { font-weight: 500; opacity: .9; }
.footer-contact dd { margin: 0; line-height: 1.7; }
.footer-contact a { color: #fff; }
.footer-contact a:hover { text-decoration: underline; color: #fff; }
.footer-contact .en { opacity: .85; }
.footer-social dt svg { width: 18px; height: 18px; margin-top: 4px; }
.footer-social dd { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-block; padding: 1px 10px; border-radius: 999px; background: #fff; color: var(--brand-deep) !important; font-size: 13px; line-height: 1.6; }
a.pill:hover { text-decoration: none !important; background: #e8f4f6; }
.copyright { text-align: center; margin: 40px 0 0; font-size: 12px; opacity: .85; }

.to-top {
    position: fixed; right: 20px; bottom: 20px; z-index: 90; width: 46px; height: 46px; border: 0; border-radius: 50%;
    background: var(--brand-deep); color: #fff; cursor: pointer; box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
    opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .25s ease, transform .25s ease;
}
.to-top svg { width: 22px; height: 22px; }
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- Reveal animation ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.js [data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .js [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
    .site-nav ul { gap: 22px; }
    .site-nav a { font-size: 16px; }
}

@media (max-width: 900px) {
    :root { --header-h: 68px; }
    .brand img { width: 160px; }

    .nav-toggle {
        display: grid; gap: 5px; width: 44px; height: 44px; padding: 12px 10px; border: 0; background: none; cursor: pointer;
    }
    .nav-toggle span { display: block; height: 2px; background: var(--brand-deep); border-radius: 2px; transition: transform .25s ease, opacity .25s ease; }
    .nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
    .nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .site-nav {
        position: fixed; inset: var(--header-h) 0 0; background: #fff; padding: 16px 24px;
        transform: translateX(100%); transition: transform .3s ease; overflow-y: auto;
    }
    .nav-open .site-nav { transform: none; }
    .nav-open { overflow: hidden; }
    .site-nav ul { flex-direction: column; gap: 0; }
    .site-nav a { padding: 16px 4px; font-size: 18px; border-bottom: 1px solid #eee; }
    .site-nav a::after { display: none; }

    .home-about { grid-template-columns: 1fr; }
    .home-about__media { min-height: 300px; margin-right: 0; clip-path: polygon(0 0, 100% 0, 100% 86%, 0 100%); }
    .home-about__content { padding: 48px 24px; }

    .feature { grid-template-columns: 1fr; min-height: 0; }
    .feature--reverse .feature__media { order: 0; }
    .feature__media { min-height: 260px; aspect-ratio: 16 / 10; }

    .advantage__grid, .contact-cards { grid-template-columns: 1fr; }
    .advantage { background: linear-gradient(var(--brand-band) 0 220px, var(--grey) 220px 100%); }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 32px 20px; }
    .product-grid--small { grid-template-columns: repeat(2, 1fr); }
    .product-detail, .contact-layout { grid-template-columns: 1fr; }
    .logo-story { grid-template-columns: 1fr; justify-items: center; text-align: left; gap: 24px; }
    .footer-inner { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    body { font-size: 15px; }
    .section-heading__zh { font-size: 17px; letter-spacing: .3em; }
    .product-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .contact-form { padding: 22px; }
}
