/* Standalone merchant directory — aligned to the Figma Merchant Listing screen.
   Measurements use the application's 750px logical canvas. */

body {
    background: #f6f5ef;
}

#wrapper.merchant-directory-page {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--ds-bg);
    color: var(--ds-text);
    font-family: var(--ds-font);
    box-sizing: border-box;
}

.merchant-directory-header {
    position: sticky;
    top: 0;
    z-index: 10;
    padding-bottom: 22px;
    background: var(--ds-bg);
}

.merchant-directory-nav {
    height: 82px;
    display: flex;
    align-items: center;
    padding: 0 22px;
    box-sizing: border-box;
}

.merchant-directory-nav h1 {
    margin: 0;
    color: var(--ds-text);
    font-size: 32px;
    line-height: 42px;
    font-weight: 600;
}

.merchant-back {
    width: 53px;
    height: 64px;
    flex: 0 0 53px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin: 0 4px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ds-text);
    cursor: pointer;
}

.merchant-back svg {
    width: 32px;
    height: 32px;
}

.merchant-search {
    width: auto;
    height: 68px;
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 0 30px;
    padding: 0 22px;
    border: 2px solid rgba(229, 227, 216, .4);
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(56, 51, 24, .025);
    box-sizing: border-box;
}

.merchant-search svg {
    width: 27px;
    height: 27px;
    flex: 0 0 auto;
    color: var(--ds-text-tertiary);
}

.merchant-search input {
    min-width: 0;
    width: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    appearance: none;
    background: transparent;
    color: var(--ds-text);
    font: 400 22px/32px var(--ds-font);
}

.merchant-search input::-webkit-search-cancel-button {
    opacity: .55;
}

.merchant-search input::placeholder {
    color: var(--ds-placeholder);
}

.merchant-grid {
    display: grid;
    grid-template-columns: repeat(3, 208px);
    grid-auto-rows: 202px;
    justify-content: space-between;
    column-gap: 0;
    row-gap: 19px;
    padding: 34px 22px 64px;
    box-sizing: border-box;
}

.merchant-grid-item {
    width: 208px;
    height: 202px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    color: var(--ds-text);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.merchant-grid-logo {
    position: relative;
    width: 134px;
    height: 134px;
    flex: 0 0 134px;
    overflow: hidden;
    border-radius: 45px;
    /* 商戶 logo 統一用顏色托底（client feedback 2026-08 pp.5-6）*/
    background: var(--ds-logo-tint);
    padding: 12px;
    box-sizing: border-box;
    box-shadow: inset 0 0 0 2px var(--ds-border);
}

.merchant-grid-logo img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.merchant-logo-fallback {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--ds-bg-secondary);
    color: var(--ds-text-tertiary);
    font: 600 42px/1 var(--ds-font);
}

.merchant-grid-logo.is-fallback .merchant-logo-fallback {
    display: flex;
}

.merchant-grid-name {
    width: 187px;
    min-height: 60px;
    display: -webkit-box;
    overflow: hidden;
    color: var(--ds-text);
    font-size: 22px;
    line-height: 30px;
    font-weight: 400;
    text-align: center;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.merchant-grid-item:active .merchant-grid-logo {
    transform: scale(.97);
}

.merchant-state {
    grid-column: 1 / -1;
    padding: 80px 20px;
    color: var(--ds-text-tertiary);
    font-size: 24px;
    line-height: 36px;
    text-align: center;
}

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

@media (prefers-reduced-motion: no-preference) {
    .merchant-grid-logo {
        transition: transform .15s ease;
    }
}
