/* ==========================================================================
   warranty-funnel buyer-side "Warranty home" (official plugin official.warranty-funnel)
   Surface = operator config (theme_paper / theme_paper_deep), hero art = home_image.
   Layout: centered brand facade + product picker card (hidden until Activate Warranty).
   Picker keeps the original image-card grid; search / QR scan / sort are first-class entry paths.
   Zero framework, no external fonts.
   ========================================================================== */

:root {
    --wf-accent: var(--sys-color, #a4761f);
    --wf-font: var(--sys-font-family, "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif);
    --wf-paper: #f6f2e9;
    --wf-paper-deep: #efe8d8;
    --wf-ink: #16302a;
    --wf-ink-soft: #5c6a60;
    --wf-ink-faint: #9aa59a;
    --wf-line: #d8cfba;
    --wf-card: #fffdf7;
    --wf-gold: #a4761f;
    --wf-gold-bg: #f5ecd9;
    --wf-danger: #b4441f;
    --wf-amber: #9a6a18;
    --wf-amber-bg: #f7edd8;
    --wf-ok: #2c7a52;
    --wf-serif: "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
    --wf-serif-display: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
    --wf-radius: 16px;
    --wf-radius-sm: 10px;
    --wf-shadow: 0 24px 60px -26px rgba(22, 48, 42, .38);
    --wf-shadow-soft: 0 12px 34px -18px rgba(22, 48, 42, .28);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* Page surface = configured paper colors (nothing hard-coded to a dark theme) */
body.wf-body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1200px 520px at 85% -10%, rgba(164, 118, 31, .07), transparent 60%),
        linear-gradient(180deg, var(--wf-paper) 0%, var(--wf-paper-deep) 100%);
    color: var(--wf-ink);
    font-family: var(--wf-font);
    font-size: 16px;
    line-height: 1.6;
}

.wf-noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: .5;
    background-image:
        repeating-linear-gradient(0deg, rgba(22, 48, 42, .012) 0 1px, transparent 1px 3px),
        repeating-linear-gradient(90deg, rgba(22, 48, 42, .012) 0 1px, transparent 1px 3px),
        radial-gradient(140% 90% at 50% 0%, rgba(255, 255, 255, .5), transparent 70%);
}

.wf-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Top bar ---------- */
.wf-topbar { position: relative; z-index: 3; padding: 14px 20px; }
.wf-topbar-inner {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.wf-brand {
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    font-size: 12.5px;
    color: var(--wf-ink);
}
.wf-brand::before {
    content: "\25C6";
    margin-right: 9px;
    font-size: 9px;
    color: var(--wf-gold);
    vertical-align: 2px;
}
.wf-lang { display: flex; gap: 2px; flex-wrap: wrap; }
.wf-lang-item {
    min-width: 38px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    font-size: 11.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--wf-ink-soft);
    border-radius: 999px;
    transition: color .2s, background .2s;
}
.wf-lang-item:hover { color: var(--wf-ink); background: rgba(22, 48, 42, .06); }
.wf-lang-item.is-active {
    color: var(--wf-ink);
    font-weight: 700;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wf-gold) 55%, transparent);
}

/* ---------- Layout ---------- */
.wf-main { position: relative; z-index: 1; }
.wf-home-main { max-width: 720px; margin: 0 auto; padding: 0 20px 28px; }

/* ---------- Brand facade hero ---------- */
.wf-home-hero {
    padding: 20px 0 26px;
    text-align: center;
    animation: wf-rise .55s cubic-bezier(.22, .8, .3, 1) both;
}
.wf-home-illustration {
    display: block;
    width: 100%;
    max-width: 480px;
    height: auto;
    margin: 0 auto 22px;
    border-radius: 20px;
    box-shadow: 0 18px 40px -24px rgba(22, 48, 42, .5);
}
.wf-home-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 14px;
    padding: 6px 14px;
    font-size: 11px;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: var(--wf-gold);
    border: 1px solid color-mix(in srgb, var(--wf-gold) 46%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--wf-gold) 6%, transparent);
}
.wf-home-eyebrow::before { content: "\2726"; font-size: 10px; }
.wf-home-eyebrow:empty { display: none; }
.wf-home-title {
    margin: 0 0 12px;
    font-family: var(--wf-serif-display);
    font-size: clamp(34px, 7vw, 54px);
    line-height: 1.06;
    font-weight: 700;
    letter-spacing: -.012em;
    text-wrap: balance;
}
.wf-home-sub {
    margin: 0 auto 24px;
    max-width: 30em;
    color: var(--wf-ink-soft);
    font-size: 16.5px;
    text-wrap: balance;
}
.wf-home-sub:empty { display: none; }
.wf-home-actions { display: flex; justify-content: center; margin-top: 4px; }
.wf-home-activate {
    min-width: 220px;
    min-height: 54px;
    padding: 13px 34px;
    border-radius: var(--wf-radius-sm);
}

/* ---------- Product picker card ---------- */
.wf-picker {
    padding: 22px 18px 20px;
    background: var(--wf-card);
    border: 1px solid color-mix(in srgb, var(--wf-gold) 24%, var(--wf-line));
    border-radius: var(--wf-radius);
    box-shadow: var(--wf-shadow);
}
.wf-picker[hidden] { display: none; }
.wf-picker.is-open { animation: wf-rise .42s cubic-bezier(.22, .8, .3, 1) both; }
.wf-picker-head { text-align: center; margin-bottom: 16px; }
.wf-picker-title {
    margin: 0 0 6px;
    font-family: var(--wf-serif-display);
    font-size: clamp(22px, 4.6vw, 27px);
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -.01em;
}
.wf-picker-sub { margin: 0; color: var(--wf-ink-soft); font-size: 14px; }
.wf-picker-sub:empty { display: none; }

/* ---------- Lookup tools: search + scan, then count + sort ---------- */
.wf-picker-tools { margin: 0 0 14px; }
.wf-find { display: flex; gap: 10px; }
.wf-search { position: relative; display: flex; align-items: center; flex: 1 1 auto; min-width: 0; }
.wf-search-icon {
    position: absolute;
    left: 15px;
    width: 18px;
    height: 18px;
    color: var(--wf-ink-faint);
    pointer-events: none;
}
.wf-search-input {
    width: 100%;
    height: 48px;
    padding: 0 44px;
    font: inherit;
    font-size: 15px;
    color: var(--wf-ink);
    background: #fff;
    border: 1px solid var(--wf-line);
    border-radius: 999px;
    outline: none;
    transition: border-color .18s, box-shadow .18s;
    -webkit-appearance: none;
}
.wf-search-input::placeholder { color: var(--wf-ink-faint); }
.wf-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.wf-search-input:focus {
    border-color: color-mix(in srgb, var(--wf-gold) 62%, var(--wf-line));
    box-shadow: 0 0 0 4px rgba(164, 118, 31, .13);
}
.wf-search-clear {
    position: absolute;
    right: 10px;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 13px;
    color: var(--wf-ink-soft);
    background: rgba(22, 48, 42, .06);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}
.wf-search-clear[hidden] { display: none; }
.wf-search-clear:hover { background: rgba(22, 48, 42, .12); }

/* Scan entry: square, same height as the search field */
.wf-scan-btn {
    flex: 0 0 62px;
    width: 62px;
    height: 48px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 0;
    font: inherit;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--wf-ink);
    background: #fff;
    border: 1px solid var(--wf-line);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color .18s, box-shadow .18s, transform .18s;
}
.wf-scan-btn:hover {
    border-color: color-mix(in srgb, var(--wf-gold) 60%, var(--wf-line));
    box-shadow: 0 8px 20px -16px rgba(22, 48, 42, .5);
}
.wf-scan-icon { width: 16px; height: 16px; color: var(--wf-gold); }

.wf-list-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 2px 0;
    font-size: 12.5px;
    color: var(--wf-ink-soft);
}
.wf-list-count b { color: var(--wf-ink); font-weight: 700; }
.wf-sort { display: inline-flex; align-items: center; gap: 8px; }
.wf-sort-label {
    font-size: 11px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--wf-ink-faint);
}
.wf-sort-select {
    height: 30px;
    padding: 0 26px 0 10px;
    font: inherit;
    font-size: 12.5px;
    color: var(--wf-ink);
    background-color: transparent;
    background-image: linear-gradient(45deg, transparent 50%, var(--wf-ink-soft) 50%),
                      linear-gradient(135deg, var(--wf-ink-soft) 50%, transparent 50%);
    background-position: calc(100% - 13px) 13px, calc(100% - 8px) 13px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    border: 1px solid transparent;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
.wf-sort-select:hover { border-color: var(--wf-line); }
.wf-sort-select:focus { border-color: var(--wf-gold); }

/* ---------- Product grid: the original image-card layout ---------- */
.wf-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}
.wf-model-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    background: var(--wf-card);
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-sm);
    overflow: hidden;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
    transition: transform .2s, box-shadow .2s, border-color .2s;
}
.wf-model-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--wf-gold) 46%, var(--wf-line));
    box-shadow: var(--wf-shadow-soft);
}
.wf-model-img {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    background: var(--wf-gold-bg);
    overflow: hidden;
}
.wf-model-img.has-img { background: var(--wf-paper-deep); }
.wf-model-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}
.wf-model-img:not(.has-img)::after {
    content: "\25C6";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wf-gold);
    opacity: .5;
    font-size: 30px;
}
.wf-model-body { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 14px; }
.wf-model-name { font-weight: 700; font-size: 15px; line-height: 1.3; }
.wf-model-brand { color: var(--wf-ink-faint); font-size: 12.5px; letter-spacing: .04em; }
.wf-model-brand:empty { display: none; }
.wf-model-go {
    display: inline-flex;
    align-self: flex-end;
    margin: -28px 14px 12px;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    color: var(--wf-gold);
    font-size: 16px;
    border: 1px solid color-mix(in srgb, var(--wf-gold) 40%, transparent);
    border-radius: 50%;
    background: var(--wf-card);
    transition: transform .2s;
}
.wf-model-card:hover .wf-model-go { transform: translateX(3px); }

.wf-picker-empty {
    margin: 0;
    padding: 24px 16px;
    text-align: center;
    color: var(--wf-ink-soft);
    font-size: 14px;
    border: 1px dashed var(--wf-line);
    border-radius: 12px;
    background: rgba(245, 236, 217, .3);
}
.wf-picker-empty[hidden] { display: none; }

/* ---------- Compliance footnote ---------- */
.wf-footnote {
    margin: 22px auto 0;
    text-align: center;
    font-size: 12.5px;
    color: var(--wf-ink-faint);
}
.wf-footnote:empty { display: none; }

/* ---------- Buttons ---------- */
.wf-btn-primary {
    background: var(--wf-ink);
    color: #fdfaf3;
    border: 1.5px solid var(--wf-ink);
    box-shadow: 0 12px 28px -16px rgba(22, 48, 42, .55);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    letter-spacing: .02em;
    transition: transform .2s, box-shadow .2s, background .2s;
}
.wf-btn-primary:hover { background: var(--wf-ink-soft); border-color: var(--wf-ink-soft); transform: translateY(-1px); }

/* ---------- Bottom action bar ---------- */
.wf-bottom-bar {
    position: relative;
    z-index: 5;
    max-width: 720px;
    margin: 0 auto;
    padding: 4px 20px 40px;
    display: flex;
    gap: 12px;
    justify-content: center;
}
.wf-bottom-cta {
    flex: 1 1 0;
    min-height: 52px;
    padding: 13px 20px;
    border-radius: var(--wf-radius-sm);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .02em;
    text-decoration: none;
    cursor: pointer;
    text-align: center;
    transition: transform .2s, box-shadow .2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.wf-bottom-cta:hover { transform: translateY(-2px); }
.wf-bottom-contact {
    background: transparent;
    color: var(--wf-ink);
    border: 1.5px solid var(--wf-ink);
}
.wf-bottom-contact:hover { background: rgba(22, 48, 42, .06); }

/* ---------- Scan sheet ---------- */
.wf-scan {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.wf-scan[hidden] { display: none; }
.wf-scan-backdrop { position: absolute; inset: 0; background: rgba(7, 21, 16, .66); backdrop-filter: blur(2px); }
.wf-scan-sheet {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    padding: 16px 18px calc(18px + env(safe-area-inset-bottom));
    background: var(--wf-card);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -20px 50px -24px rgba(0, 0, 0, .5);
    animation: wf-rise .3s cubic-bezier(.22, .8, .3, 1) both;
}
.wf-scan-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.wf-scan-title { font-size: 15px; font-weight: 700; color: var(--wf-ink); }
.wf-scan-close {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 14px;
    color: var(--wf-ink-soft);
    background: rgba(22, 48, 42, .06);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}
.wf-scan-view {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    background: #0b1f19;
    aspect-ratio: 3 / 4;
    max-height: 46vh;
}
.wf-scan-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.wf-scan-frame {
    position: absolute;
    inset: 18% 14%;
    border-radius: 14px;
    box-shadow: 0 0 0 9999px rgba(7, 21, 16, .34);
    border: 2px solid rgba(220, 180, 106, .9);
}
.wf-scan-hint {
    margin: 12px 2px 14px;
    text-align: center;
    font-size: 13px;
    color: var(--wf-ink-soft);
}
.wf-scan-manual { width: 100%; min-height: 48px; border-radius: 12px; }

/* ---------- Toast ---------- */
.wf-toast {
    position: fixed;
    left: 50%;
    bottom: 32px;
    transform: translateX(-50%);
    z-index: 70;
    max-width: 86vw;
    padding: 11px 18px;
    background: var(--wf-ink);
    color: #fdfaf3;
    font-size: 14px;
    border-radius: var(--wf-radius-sm);
    box-shadow: var(--wf-shadow);
    animation: wf-rise .3s cubic-bezier(.22, .8, .3, 1) both;
}
.wf-toast[hidden] { display: none; }

/* ---------- Motion ---------- */
@keyframes wf-rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive (this page is opened from phones) ---------- */
@media (min-width: 720px) {
    .wf-picker { padding: 26px 24px 24px; }
    .wf-home-main { padding-bottom: 32px; }
}
@media (max-width: 768px) {
    .wf-bottom-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        max-width: none;
        padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
        background: rgba(255, 253, 247, .95);
        border-top: 1px solid var(--wf-line);
        backdrop-filter: blur(8px);
    }
    .wf-home-main { padding-bottom: 112px; }
}
/* Very narrow phones: two-column grid, stacked bottom actions (same as the previous design) */
@media (max-width: 520px) {
    .wf-picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .wf-bottom-bar { flex-direction: column; }
    .wf-bottom-cta { width: 100%; }
    .wf-home-main { padding-bottom: 140px; }
}
@media (max-width: 430px) {
    .wf-topbar { padding: 12px 16px; }
    .wf-lang { flex-wrap: nowrap; gap: 0; }
    .wf-lang-item {
        min-width: 0;
        min-height: 32px;
        padding: 4px 6px;
        font-size: 10.5px;
        letter-spacing: .04em;
    }
    .wf-brand { font-size: 11.5px; letter-spacing: .14em; }
    .wf-home-main { padding-left: 16px; padding-right: 16px; }
    .wf-home-hero { padding: 12px 0 20px; }
    .wf-home-illustration { max-width: 320px; }
    .wf-picker { padding: 18px 14px 16px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* Show more: prototype-style paged grid (first screen stays light) */
.wf-show-more {
    width: 100%;
    margin-top: 14px;
    min-height: 48px;
    padding: 0 16px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--wf-ink);
    background: transparent;
    border: 1.5px solid var(--wf-line);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color .18s, background .18s;
}
.wf-show-more:hover { border-color: var(--wf-gold); background: rgba(164, 118, 31, .05); }
.wf-show-more b { font-variant-numeric: tabular-nums; margin: 0 3px; }
.wf-show-more[hidden] { display: none; }

/* [hidden] must win over the card's own display:flex (search/paging hides cards) */
.wf-model-card[hidden] { display: none !important; }
