@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #111111;
  --surface:   #1c1c1c;
  --border:    #2a2a2a;
  --text:      #f0f0f0;
  --muted:     #888888;
  --accent:    #e8e0d0;
  --sold:      #cc3333;
  --radius:    10px;
  --gap:       20px;
  --max-w:     1200px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

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

/* ── Layout helpers ── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* ── Header ── */
#site-header {
  background: #0a0a0a;
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

#site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

#site-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  white-space: nowrap;
}

#site-subtitle {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
}

#site-header nav a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s;
}

#site-header nav a:hover { color: var(--text); }

/* ── Main ── */
main {
  flex: 1;
  padding: 36px 0 60px;
}

/* ── Filters ── */
#filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  user-select: none;
}

.filter-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
}

/* ── Grid ── */
#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--gap);
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.card-cover {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #0e0e0e;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.card:hover .card-cover img {
  transform: scale(1.04);
}

/* sold overlay */
.sold-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.58);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sold-badge {
  background: var(--sold);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  padding: 6px 18px;
  border-radius: 4px;
  text-transform: uppercase;
}

.card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.card-category {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  margin-left: auto;
}

/* ── Empty state ── */
#empty-state {
  display: none;
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 60px 0;
  font-size: 0.9rem;
}

/* ── Footer ── */
#site-footer {
  border-top: 1px solid var(--border);
  background: #0a0a0a;
  padding: 28px 0;
}

#site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: center;
}

.footer-contact {
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-contact a {
  color: var(--accent);
  transition: opacity 0.2s;
}

.footer-contact a:hover { opacity: 0.75; }

.footer-note {
  font-size: 0.78rem;
  color: var(--muted);
  width: 100%;
  margin-top: 4px;
}

/* ── Articolo page ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 24px;
  transition: color 0.2s;
}

.back-link:hover { color: var(--accent); }

#articolo-header { margin-bottom: 24px; }

#articolo-titolo {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 12px;
}

#articolo-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  font-size: 0.85rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.meta-item.prezzo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.meta-item.venduto-badge {
  background: var(--sold);
  color: #fff;
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#articolo-descrizione {
  font-size: 0.92rem;
  line-height: 1.7;
  color: #c8c8c8;
  max-width: 700px;
  margin-bottom: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── Foto grid (articolo) ── */
#foto-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 48px;
}

.foto-thumb {
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: 6px;
  background: #0e0e0e;
  cursor: pointer;
}

.foto-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.foto-thumb:hover img { transform: scale(1.05); }

/* ── CTA WhatsApp ── */
#cta-desktop {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #25d366;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 14px 28px;
  border-radius: 8px;
  transition: background 0.2s, transform 0.15s;
  margin-bottom: 24px;
}

#cta-desktop:hover {
  background: #1ebe5d;
  transform: translateY(-1px);
}

#cta-mobile {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: #25d366;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  padding: 16px;
  text-align: center;
  gap: 10px;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  #articolo-titolo { font-size: 1.4rem; }

  #foto-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  #cta-desktop { display: none; }
  #cta-mobile  { display: flex; }

  /* space for fixed CTA */
  body.articolo-page { padding-bottom: 64px; }
}

@media (max-width: 480px) {
  :root { --gap: 14px; }

  #grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .card-title { font-size: 0.85rem; }
  .card-price { font-size: 0.82rem; }

  #site-title  { font-size: 1rem; }
  #site-subtitle { display: none; }

  #foto-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Loading skeleton ── */
.skeleton {
  background: linear-gradient(90deg, #1c1c1c 25%, #242424 50%, #1c1c1c 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.card-skeleton {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-skeleton .sk-cover {
  aspect-ratio: 4/3;
}

.card-skeleton .sk-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-skeleton .sk-line {
  height: 12px;
  border-radius: 4px;
}

.card-skeleton .sk-line.wide  { width: 80%; }
.card-skeleton .sk-line.short { width: 45%; }
