:root {
    --bg: #f4f1ea;
    --surface: #ffffff;
    --ink: #181818;
    --muted: #686868;
    --line: #d9d5cc;
    --accent: #d85b20;
    --accent-dark: #a93f10;
    --soft: #ebe6dc;
    --success: #1f6d45;
    --danger: #8e2f2f;
    --radius: 14px;
    --shadow: 0 8px 30px rgba(0,0,0,.07);
    --max: 1240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; }

.wrap { width: min(var(--max), calc(100% - 32px)); margin: 0 auto; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(244,241,234,.94);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.header-inner {
    min-height: 72px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}
.brand { display: flex; align-items: baseline; gap: 8px; letter-spacing: -.03em; }
.brand-main { font-size: 1.35rem; font-weight: 900; }
.brand-sub { font-size: .82rem; font-weight: 800; letter-spacing: .16em; color: var(--accent); }
.nav { display: flex; gap: 8px; }
.nav a { padding: 10px 14px; border-radius: 10px; font-weight: 700; }
.nav a:hover { background: var(--soft); }

.hero {
    padding: 76px 0;
    border-bottom: 1px solid var(--line);
    background:
        radial-gradient(circle at 85% 20%, rgba(216,91,32,.14), transparent 30%),
        linear-gradient(180deg, #f7f4ee 0%, var(--bg) 100%);
}
.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
    gap: 64px;
    align-items: center;
}
.hero h1 {
    margin: 8px 0 20px;
    max-width: 800px;
    font-size: clamp(3rem, 8vw, 6.8rem);
    line-height: .88;
    letter-spacing: -.07em;
}
.hero p { max-width: 700px; color: var(--muted); font-size: 1.1rem; }
.hero-actions { margin-top: 28px; }
.hero-panel {
    background: var(--ink);
    color: white;
    padding: 34px;
    border-radius: 22px;
    box-shadow: var(--shadow);
}
.hero-number { font-size: clamp(4rem, 10vw, 7rem); line-height: .9; font-weight: 900; letter-spacing: -.06em; color: #ff7c3f; }
.hero-label { font-size: 1.15rem; font-weight: 800; margin-top: 12px; }
.hero-rule { height: 1px; background: rgba(255,255,255,.22); margin: 26px 0; }
.hero-panel p { color: rgba(255,255,255,.72); margin: 0; }

.eyebrow {
    text-transform: uppercase;
    letter-spacing: .14em;
    font-size: .74rem;
    font-weight: 900;
    color: var(--accent-dark);
}
.page-pad { padding: 44px 0 72px; }
.section-pad { padding: 58px 0 72px; }
.page-heading, .section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 24px;
    margin-bottom: 28px;
}
.page-heading h1, .section-heading h2 { margin: 4px 0 0; font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.045em; }
.result-count { color: var(--muted); font-weight: 700; }
.text-link { color: var(--accent-dark); font-weight: 800; }

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 800;
    cursor: pointer;
}
.button:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.button.primary { background: var(--accent); border-color: var(--accent); color: white; }
.button.primary:hover { background: var(--accent-dark); }
.button.large { min-height: 52px; padding: 13px 20px; }

.shop-controls {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(180px, .35fr) minmax(170px, .3fr) auto;
    gap: 10px;
    margin-bottom: 28px;
}
.search-input, select {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    padding: 10px 12px;
    color: var(--ink);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}
.product-card {
    min-width: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: transform .15s ease, box-shadow .15s ease;
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.product-card-image {
    display: block;
    aspect-ratio: 1 / 1;
    background: #eeeae1;
    overflow: hidden;
}
.product-card-image img { width: 100%; height: 100%; object-fit: cover; }
.product-card-body { padding: 16px; }
.product-card h3 { margin: 5px 0 14px; font-size: 1rem; line-height: 1.3; }
.card-bottom { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.price { font-size: 1.15rem; }
.stock-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 99px;
    padding: 5px 9px;
    background: #e6f2eb;
    color: var(--success);
    font-size: .75rem;
    font-weight: 900;
}
.stock-badge.out { background: #f5e6e6; color: var(--danger); }
.image-placeholder {
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 700;
}
.image-placeholder.large { min-height: 480px; }

.product-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(320px, .88fr);
    gap: 46px;
    align-items: start;
}
.breadcrumbs { font-size: .86rem; color: var(--muted); margin-bottom: 22px; }
.breadcrumbs a { color: var(--accent-dark); }
.main-image-wrap {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: white;
    aspect-ratio: 1 / 1;
}
.main-image { width: 100%; height: 100%; object-fit: contain; }
.thumb-row { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 3px; }
.thumb {
    width: 76px;
    height: 76px;
    flex: 0 0 auto;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 9px;
    overflow: hidden;
    background: white;
    cursor: pointer;
}
.thumb.active { border-color: var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

.product-info { position: sticky; top: 100px; }
.product-info h1 { margin: 5px 0 14px; font-size: clamp(2rem, 4.5vw, 3.5rem); line-height: .98; letter-spacing: -.055em; }
.product-meta-line { display: flex; gap: 12px; align-items: center; margin: 12px 0; }
.condition { font-size: .9rem; color: var(--muted); font-weight: 700; }
.product-price { font-size: 2rem; font-weight: 900; margin: 20px 0; }
.buy-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0; }
.availability-note {
    margin: 22px 0;
    padding: 14px;
    background: var(--soft);
    border-radius: 10px;
    color: var(--muted);
    font-weight: 650;
}
.quick-specs {
    margin-top: 26px;
    border-top: 1px solid var(--line);
}
.quick-specs div {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 16px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}
.quick-specs span { color: var(--muted); font-size: .88rem; }
.quick-specs strong { overflow-wrap: anywhere; }

.product-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 38px;
}
.content-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
}
.content-card h2 { margin-top: 0; font-size: 1.3rem; }
.description { color: #333; }
.spec-table { margin: 0; }
.spec-table > div {
    display: grid;
    grid-template-columns: minmax(110px, .45fr) 1fr;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}
.spec-table > div:last-child { border-bottom: 0; }
.spec-table dt { color: var(--muted); }
.spec-table dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    border: 1px dashed #c8c2b7;
    border-radius: var(--radius);
}
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 34px; }
.pagination a {
    min-width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    font-weight: 800;
}
.pagination a.active { background: var(--ink); color: white; border-color: var(--ink); }

.info-strip { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--soft); }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.info-grid > div { padding: 26px; border-right: 1px solid var(--line); }
.info-grid > div:last-child { border-right: 0; }
.info-grid strong, .info-grid span { display: block; }
.info-grid span { color: var(--muted); margin-top: 5px; }

.site-footer { padding: 44px 0; }
.footer-inner { display: flex; justify-content: space-between; gap: 30px; }
.site-footer p { color: var(--muted); margin: 6px 0 0; }
.footer-links { display: flex; gap: 18px; }

@media (max-width: 980px) {
    .hero-grid, .product-layout { grid-template-columns: 1fr; }
    .product-info { position: static; }
    .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .shop-controls { grid-template-columns: 1fr 1fr; }
    .search-input { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
    .wrap { width: min(100% - 22px, var(--max)); }
    .header-inner { min-height: 62px; }
    .brand-main { font-size: 1.05rem; }
    .brand-sub { font-size: .68rem; }
    .nav a { padding: 8px 9px; }
    .hero { padding: 48px 0; }
    .hero-grid { gap: 28px; }
    .hero h1 { font-size: clamp(3rem, 17vw, 5.2rem); }
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .product-card-body { padding: 12px; }
    .product-card h3 { font-size: .92rem; }
    .card-bottom { align-items: flex-start; flex-direction: column; gap: 7px; }
    .shop-controls { grid-template-columns: 1fr; }
    .search-input { grid-column: auto; }
    .page-heading, .section-heading { align-items: flex-start; flex-direction: column; }
    .product-content-grid, .info-grid { grid-template-columns: 1fr; }
    .info-grid > div { border-right: 0; border-bottom: 1px solid var(--line); }
    .info-grid > div:last-child { border-bottom: 0; }
    .footer-inner { flex-direction: column; }
    .main-image-wrap { border-radius: 12px; }
    .quick-specs div, .spec-table > div { grid-template-columns: 95px 1fr; }
}


/* v1.1 — real Flip Tracker categories */
.category-link {
    display: inline-block;
}
.category-link:hover,
.category-inline-link:hover {
    text-decoration: underline;
}
.category-section {
    padding-top: 54px;
    padding-bottom: 20px;
}
.category-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.category-tile {
    position: relative;
    min-height: 112px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.category-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: #bdb5a7;
}
.category-name {
    padding-right: 28px;
    font-size: 1.05rem;
    line-height: 1.18;
    font-weight: 850;
    letter-spacing: -.02em;
}
.category-count {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
}
.category-arrow {
    position: absolute;
    right: 16px;
    top: 14px;
    color: var(--accent);
    font-size: 1.25rem;
    font-weight: 900;
}

@media (max-width: 980px) {
    .category-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .category-tile {
        min-height: 104px;
        padding: 14px;
    }
    .category-name {
        font-size: .96rem;
    }
}


/* v1.2 — homepage + proactive shop filters */

.hero-copy {
    min-width: 0;
}

.hero-lead {
    max-width: 760px;
    margin: 0 0 12px;
    color: var(--ink);
    font-size: 1.18rem;
    line-height: 1.55;
    font-weight: 620;
}

.hero-secondary {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.55;
}

.home-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    max-width: 760px;
    margin-top: 28px;
}

.home-search input {
    width: 100%;
    min-height: 52px;
    padding: 12px 15px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.hero-stat {
    display: block;
}

.hero-points {
    display: grid;
    gap: 20px;
}

.hero-points div {
    display: grid;
    gap: 4px;
}

.hero-points strong {
    color: #fff;
    font-size: .95rem;
}

.hero-points span {
    color: rgba(255,255,255,.68);
    font-size: .88rem;
    line-height: 1.45;
}

.search-wrap {
    position: relative;
    min-width: 0;
}

.search-wrap .search-input {
    padding-right: 62px;
}

.clear-filters {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-dark);
    font-size: .78rem;
    font-weight: 850;
}

.clear-filters:hover {
    text-decoration: underline;
}

.shop-controls {
    grid-template-columns: minmax(280px, 1fr) minmax(190px, .35fr) minmax(180px, .3fr);
}

@media (max-width: 720px) {
    .home-search {
        grid-template-columns: 1fr;
    }

    .home-search .button {
        width: 100%;
    }

    .shop-controls {
        grid-template-columns: 1fr;
    }
}


/* v1.3 — compact buyer-first hero + header search */

.header-inner {
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr) auto;
    gap: 18px;
}

.header-search {
    width: 100%;
    max-width: 680px;
    justify-self: center;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface);
}

.header-search input {
    min-width: 0;
    height: 42px;
    border: 0;
    outline: 0;
    padding: 0 13px;
    background: transparent;
    color: var(--ink);
    font: inherit;
}

.header-search button {
    border: 0;
    border-left: 1px solid var(--line);
    padding: 0 14px;
    background: var(--ink);
    color: white;
    font-weight: 850;
    cursor: pointer;
}

.header-search button:hover {
    background: var(--accent-dark);
}

.hero {
    padding: 34px 0 30px;
}

.compact-hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(290px, .65fr);
    gap: 34px;
    align-items: stretch;
}

.compact-hero .hero-copy {
    align-self: center;
    padding: 10px 0;
}

.compact-hero .hero-copy h1 {
    margin: 7px 0 14px;
    max-width: 760px;
    font-size: clamp(2.65rem, 6vw, 5.35rem);
    line-height: .91;
}

.compact-hero .hero-lead {
    max-width: 720px;
    margin: 0;
    font-size: 1.06rem;
    line-height: 1.5;
}

.compact-hero .hero-actions {
    margin-top: 20px;
}

.hero-buyer-points {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 17px;
    color: var(--muted);
    font-size: .88rem;
}

.hero-buyer-points strong {
    color: var(--ink);
}

.featured-product {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(125px, .8fr) minmax(0, 1fr);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    transition: transform .16s ease, box-shadow .16s ease;
}

.featured-product:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 34px rgba(0,0,0,.11);
}

.featured-image {
    position: relative;
    min-height: 235px;
    background: #eeeae1;
    overflow: hidden;
}

.featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    display: inline-flex;
    width: fit-content;
    padding: 6px 9px;
    border-radius: 999px;
    background: var(--accent);
    color: white;
    font-size: .68rem;
    line-height: 1;
    font-weight: 950;
    letter-spacing: .11em;
}

.featured-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
}

.featured-body h2 {
    margin: 6px 0 18px;
    font-size: clamp(1.25rem, 2.3vw, 1.8rem);
    line-height: 1.08;
    letter-spacing: -.035em;
}

.featured-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.featured-bottom strong {
    font-size: 1.35rem;
}

.featured-bottom span {
    color: var(--accent-dark);
    font-size: .85rem;
    font-weight: 850;
    white-space: nowrap;
}

.featured-fallback {
    min-height: 235px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: end;
    gap: 8px;
    padding: 22px;
    border-radius: 18px;
    background: var(--ink);
    color: white;
}

.featured-fallback .featured-badge {
    position: static;
}

.featured-fallback a {
    color: #ff8a50;
    font-weight: 850;
}

.hero + .section-pad,
.hero + .wrap.section-pad {
    padding-top: 34px;
}

@media (max-width: 980px) {
    .header-inner {
        grid-template-columns: auto minmax(180px, 1fr) auto;
        gap: 10px;
    }

    .compact-hero {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .featured-product {
        max-width: 700px;
    }
}

@media (max-width: 720px) {
    .site-header {
        position: static;
    }

    .header-inner {
        grid-template-columns: 1fr auto;
        padding: 10px 0;
    }

    .brand {
        min-width: 0;
    }

    .nav {
        justify-self: end;
    }

    .header-search {
        grid-column: 1 / -1;
        grid-row: 2;
        max-width: none;
        order: 3;
    }

    .header-search input {
        height: 44px;
    }

    .hero {
        padding: 24px 0 22px;
    }

    .compact-hero .hero-copy h1 {
        font-size: clamp(2.65rem, 15vw, 4.4rem);
    }

    .hero-buyer-points {
        display: grid;
        gap: 6px;
    }

    .featured-product {
        grid-template-columns: 125px minmax(0, 1fr);
        border-radius: 14px;
    }

    .featured-image {
        min-height: 175px;
    }

    .featured-body {
        padding: 15px;
    }

    .featured-body h2 {
        margin-bottom: 12px;
        font-size: 1.12rem;
    }

    .featured-bottom {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
}
