:root {
    --ink: #17212b;
    --muted: #667085;
    --line: #d8dee8;
    --surface: #ffffff;
    --soft: #f5f7fa;
    --brand: #f5a623;
    --accent: #1d7a8c;
    --good: #18864b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--soft);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
}

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

h1,
h2,
h3,
p {
    margin-top: 0;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 12px clamp(16px, 4vw, 56px);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
}

.brand,
.main-nav,
.market-tabs,
.market-card-top,
.market-card-actions,
.market-detail-actions {
    display: flex;
    align-items: center;
}

.brand {
    gap: 10px;
    font-weight: 800;
    text-decoration: none;
}

.brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.main-nav {
    gap: 6px;
    overflow-x: auto;
}

.main-nav a {
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--ink);
    background: #eef3f7;
}

main {
    min-height: 70vh;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.button.primary {
    border-color: var(--brand);
    background: var(--brand);
    color: #201500;
}

.button.ghost {
    background: transparent;
}

.market-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
    gap: clamp(20px, 4vw, 48px);
    align-items: end;
    padding: clamp(32px, 6vw, 76px) clamp(16px, 4vw, 56px);
    background: #fff;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.market-hero h1 {
    max-width: 760px;
    margin-bottom: 12px;
    font-size: clamp(34px, 5vw, 60px);
    line-height: 1.02;
}

.market-hero p,
.lead {
    max-width: 700px;
    color: var(--muted);
    font-size: 18px;
}

.market-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.market-stats div,
.empty-state,
.panel,
.filter-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.market-stats div {
    padding: 14px;
    background: #f8fafc;
}

.market-stats strong {
    display: block;
    font-size: 28px;
    line-height: 1;
}

.market-stats span,
.microcopy {
    color: var(--muted);
    font-size: 13px;
}

.market-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px clamp(16px, 4vw, 56px);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.market-tabs,
.market-card-top,
.market-card-actions,
.market-detail-actions,
.chip-list,
.section-heading {
    gap: 10px;
    flex-wrap: wrap;
}

.market-tabs a {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-weight: 800;
    text-decoration: none;
}

.market-tabs a.active,
.market-tabs a:hover {
    border-color: var(--accent);
    background: #e7f3f5;
    color: #0e5d6d;
}

.market-search {
    display: flex;
    align-items: end;
    gap: 10px;
}

label {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
    color: var(--muted);
    font-weight: 800;
}

.market-search label {
    min-width: min(360px, 55vw);
    margin: 0;
}

input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
}

.section,
.page-heading {
    padding: clamp(22px, 4vw, 44px) clamp(12px, 3vw, 40px);
}

.filter-section {
    padding-top: 18px;
    padding-bottom: 18px;
}

.filter-panel {
    max-width: 720px;
    padding: 16px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-heading h2 {
    margin: 0;
    font-size: 17px;
}

.section-heading a {
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
}

.chip-list {
    display: flex;
    align-items: center;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.chip:hover,
.chip.active {
    border-color: var(--accent);
    background: #e7f3f5;
    color: #0e5d6d;
}

.chip span {
    min-width: 22px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #eef3f7;
    color: #344054;
    text-align: center;
}

.chip small {
    color: var(--muted);
    font-size: 11px;
}

.page-heading {
    background: #fff;
}

.page-heading h1 {
    margin-bottom: 8px;
    font-size: clamp(30px, 4vw, 48px);
}

.market-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: clamp(10px, 1.4vw, 16px);
}

.market-card {
    display: flex;
    min-height: 100%;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.market-card-media {
    display: block;
    background: #f8fafc;
}

.market-card-media img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.market-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 9px;
    padding: 12px;
}

.market-card h2 {
    margin: 0;
    font-size: 15px;
    line-height: 1.25;
}

.market-card h2 a {
    text-decoration: none;
}

.market-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.market-meta {
    display: grid;
    gap: 3px;
}

.market-meta strong,
.price-large {
    color: var(--good);
    font-size: 19px;
    font-weight: 800;
}

.market-meta span {
    color: var(--muted);
    font-size: 13px;
}

.market-card-actions {
    margin-top: auto;
}

.source-pill,
.search-pill,
.owner-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.market-card-actions .button {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 13px;
}

.source-pill.vinted {
    background: #e2f7f4;
    color: #007782;
}

.source-pill.wallapop {
    background: #fff2cf;
    color: #8a5a00;
}

.source-pill.otro,
.search-pill {
    background: #eef3f7;
    color: #344054;
}

.owner-pill {
    background: #ecebff;
    color: #3730a3;
}

.market-detail {
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
    gap: clamp(24px, 5vw, 56px);
    padding: clamp(28px, 5vw, 56px) clamp(16px, 4vw, 56px);
    background: #fff;
}

.market-detail-media {
    align-self: start;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.market-detail-media img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

.market-detail-copy h1 {
    margin: 16px 0 8px;
    font-size: clamp(30px, 4vw, 48px);
    line-height: 1.08;
}

.facts,
.attribute-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 22px 0;
}

.facts div,
.attribute-list div {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.facts dt,
.attribute-list dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.facts dd,
.attribute-list dd {
    margin: 4px 0 0;
    font-weight: 800;
}

.detail-section {
    margin: 24px 0;
}

.panel,
.empty-state {
    padding: 22px;
}

.legal-content {
    display: grid;
    gap: 16px;
}

.site-footer {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 22px;
    padding: 28px clamp(16px, 4vw, 56px);
    border-top: 1px solid var(--line);
    background: #15202b;
    color: #fff;
}

.site-footer p {
    margin-bottom: 0;
    color: #c5ced8;
}

.site-footer nav {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.site-footer a {
    color: #fff;
}

.site-footer .disclaimer {
    grid-column: 1 / -1;
    color: #c5ced8;
}

@media (max-width: 1240px) {
    .market-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

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

@media (max-width: 820px) {
    .site-header,
    .market-hero,
    .market-detail,
    .filter-section,
    .site-footer {
        grid-template-columns: 1fr;
    }

    .site-header {
        align-items: flex-start;
    }

    .market-toolbar,
    .market-search {
        align-items: stretch;
        flex-direction: column;
    }

    .market-search label {
        min-width: 0;
    }

    .facts,
    .attribute-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .market-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .market-card-body {
        padding: 10px;
    }

    .market-card h2 {
        font-size: 14px;
    }

    .market-card p,
    .market-card-actions .button.ghost {
        display: none;
    }
}

@media (max-width: 380px) {
    .market-grid {
        grid-template-columns: 1fr;
    }
}
