:root {
    --wall: #EDEFF2;
    --paper: #FFFFFF;
    --ink: #1B2230;
    --muted: #5B6473;
    --line: #D3D8E0;
    --accent: #2A4BA0;
    --sold: #B3261E;
    --serif: "Newsreader", Georgia, "Times New Roman", serif;
    --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--wall);
    color: var(--ink);
    font-family: var(--sans);
    line-height: 1.5;
}

a { color: var(--accent); }
a:focus-visible, button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- Intestazione ---------- */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 12px;
    padding: 28px 6vw;
    border-bottom: 1px solid var(--line);
}
.brand {
    font-family: var(--serif);
    font-size: 2.6rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
    text-decoration: none;
}
.main-nav a {
    margin-left: 28px;
    color: var(--ink);
    text-decoration: none;
}
.main-nav a:hover { color: var(--accent); }
.count {
    display: inline-block;
    min-width: 1.6em;
    padding: 0 .45em;
    border-radius: 1em;
    background: var(--ink);
    color: #fff;
    font-size: .8rem;
    text-align: center;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 6vw 80px;
}

h1, h2, h3 {
    font-family: var(--serif);
    font-weight: 600;
    line-height: 1.2;
}

/* ---------- Filtro artisti ---------- */
.filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 26px;
    margin-bottom: 36px;
}
.filter a {
    color: var(--muted);
    text-decoration: none;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
}
.filter a:hover { color: var(--ink); }
.filter a.active {
    color: var(--ink);
    font-weight: 600;
    border-bottom-color: var(--accent);
}

/* ---------- Scheda artista ---------- */
.artist-panel {
    display: flex;
    gap: 28px;
    align-items: center;
    margin-bottom: 44px;
    padding-bottom: 36px;
    border-bottom: 1px solid var(--line);
}
.artist-panel img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.artist-panel h2 { margin: 0 0 4px; font-size: 2rem; }
.artist-panel .country { margin: 0 0 10px; color: var(--muted); }
.artist-panel p { max-width: 62ch; margin: 0; }

/* ---------- Griglia opere ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 56px 36px;
}
.frame {
    background: var(--paper);
    border: 1px solid var(--line);
    padding: 18px;
}
.frame img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}
.work.is-sold .frame img { filter: grayscale(1); opacity: .6; }

.label { padding: 14px 2px 0; }
.label .title {
    margin: 0 0 2px;
    font-size: 1.35rem;
    font-style: italic;
    font-weight: 400;
}
.label .artist { margin: 0; font-weight: 600; }
.label .artist a { color: var(--ink); text-decoration: none; }
.label .artist a:hover { color: var(--accent); }
.label .meta { margin: 0; color: var(--muted); font-size: .92rem; }
.label .price { margin: 10px 0; font-family: var(--serif); font-size: 1.3rem; font-weight: 600; }
.sold-note { color: var(--sold); font-weight: 600; margin: 0 0 10px; }
.sold-note::before {
    content: "";
    display: inline-block;
    width: .6em; height: .6em;
    margin-right: .5em;
    border-radius: 50%;
    background: var(--sold);
}

/* ---------- Pulsanti ---------- */
.btn {
    font: inherit;
    font-weight: 600;
    padding: 10px 20px;
    border: 0;
    border-radius: 2px;
    background: var(--ink);
    color: #fff;
    cursor: pointer;
}
.btn:hover:not(:disabled) { background: var(--accent); }
.btn:disabled {
    background: var(--line);
    color: var(--muted);
    cursor: not-allowed;
}
.btn-link {
    font: inherit;
    padding: 0;
    border: 0;
    background: none;
    color: var(--sold);
    text-decoration: underline;
    cursor: pointer;
}

/* ---------- Messaggi ---------- */
.empty {
    padding: 40px;
    background: var(--paper);
    border: 1px dashed var(--line);
}
.confirmation {
    background: var(--paper);
    border-left: 4px solid var(--accent);
    padding: 24px 28px;
    margin-bottom: 40px;
}
.confirmation h2 { margin-top: 0; }

/* ---------- Carrello ---------- */
.table-wrap { overflow-x: auto; }
.cart-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--paper);
    margin-bottom: 28px;
}
.cart-table th, .cart-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.cart-table img { width: 72px; height: 54px; object-fit: cover; display: block; }
.cart-table .num { text-align: right; white-space: nowrap; }
.cart-table tfoot td { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; border-bottom: 0; }

@media (max-width: 600px) {
    .artist-panel { flex-direction: column; align-items: flex-start; }
    .main-nav a:first-child { margin-left: 0; }
}
