/* ===== Calciomercato.in — clean minimal (white/blue) ===== */
:root {
  --blue-900: #0a3f87;
  --blue-700: #1554a8;
  --blue-500: #1e6fd9;
  --blue-50:  #eef4fc;
  --ink:      #0f172a;
  --ink-2:    #334155;
  --ink-3:    #64748b;
  --line:     #e5eaf2;
  --bg:       #ffffff;
  --bg-soft:  #f7f9fc;
  --radius:   12px;
  --shadow:   0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.05);
  --maxw:     1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg-soft);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
}
.logo { height: 48px; width: auto; }
.refresh-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--blue-50); color: var(--blue-900);
  border: 1px solid #d6e3f5;
  padding: 8px 14px; border-radius: 999px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.refresh-btn:hover { background: #e1ecfa; }
.refresh-btn:active { transform: scale(.97); }
.refresh-btn.spinning svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Filtri ===== */
.filters {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 77px; z-index: 20;
}
.filters-inner {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 12px 20px;
  scrollbar-width: thin;
}
.filters-inner::-webkit-scrollbar { height: 6px; }
.filters-inner::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.chip {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13.5px; font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
}
.chip:hover { border-color: var(--blue-500); color: var(--blue-700); }
.chip.active {
  background: var(--blue-900);
  color: #fff;
  border-color: var(--blue-900);
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ===== Main ===== */
.main { padding: 24px 20px 60px; }
.status-bar {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 18px;
  color: var(--ink-3); font-size: 13.5px;
}
.updated-at { font-weight: 500; }
.count { font-variant-numeric: tabular-nums; }

/* ===== Grid notizie ===== */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: #cbd9ee;
}
.card a.card-link {
  display: flex; flex-direction: column; height: 100%; color: inherit;
}

.card-img {
  width: 100%; aspect-ratio: 16/9; background: var(--blue-50);
  object-fit: cover;
}
.card-img-fallback {
  width: 100%; aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--blue-50) 0%, #dbe7f8 100%);
  display: flex; align-items: center; justify-content: center;
  color: var(--blue-900); font-weight: 800; font-size: 24px;
  letter-spacing: -0.5px;
}

.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.card-source {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--blue-900);
  margin-bottom: 6px;
}
.card-source .src-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.card-title {
  font-size: 16.5px; line-height: 1.35; font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-summary {
  font-size: 14px; color: var(--ink-2);
  margin: 0 0 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  margin-top: auto;
  font-size: 12.5px; color: var(--ink-3);
  display: flex; align-items: center; justify-content: space-between;
}
.card-meta .read-more { color: var(--blue-700); font-weight: 600; }

/* ===== Empty ===== */
.empty {
  grid-column: 1 / -1;
  text-align: center; padding: 40px 20px;
  color: var(--ink-3);
  background: #fff; border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 28px 0;
  margin-top: 40px;
}
.footer-inner { color: var(--ink-2); font-size: 13.5px; }
.footer-inner p { margin: 4px 0; }
.footer-inner .muted { color: var(--ink-3); font-size: 12.5px; }

/* ===== Loading state ===== */
.news-grid.loading .card { opacity: 0.4; pointer-events: none; transition: opacity .15s; }

/* ===== Mobile ===== */
@media (max-width: 640px) {
  .logo { height: 40px; }
  .header-inner { padding: 12px 16px; }
  .refresh-btn span { display: none; }
  .refresh-btn { padding: 8px 10px; }
  .news-grid { grid-template-columns: 1fr; gap: 14px; }
  .filters { top: 65px; }
  .container { padding: 0 16px; }
}
