/*
 * NUYO Blog Widget — Stylesheet
 * Version: 1.0.0
 */

/* ═══════════════════════════════════════
   TOKENS
═══════════════════════════════════════ */
:root {
  --nb-pink:    #F53167;
  --nb-pink-d:  #c8204f;
  --nb-ink:     #0f0f0f;
  --nb-white:   #ffffff;
  --nb-off:     #fafaf8;
  --nb-muted:   #888880;
  --nb-border:  rgba(15,15,15,0.10);
  --nb-r:       14px;

  --nb-cat-scienza:     #F53167;
  --nb-cat-sonno:       #7c3aed;
  --nb-cat-ingredienti: #2563eb;
  --nb-cat-lifestyle:   #d97706;
  --nb-cat-wellness:    #059669;
}

/* ═══════════════════════════════════════
   WIDGET WRAPPER
═══════════════════════════════════════ */
.nb-widget {
  font-family: 'DM Sans', sans-serif;
  color: var(--nb-ink);
  background: transparent;
  width: 100%;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════
   FILTER BAR
═══════════════════════════════════════ */
.nb-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--nb-border);
  margin-bottom: 32px;
}

.nb-filter {
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 9px 20px;
  border-radius: 100px;
  border: 1.5px solid var(--nb-border);
  background: var(--nb-white);
  color: var(--nb-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}
.nb-filter:hover {
  border-color: rgba(245, 49, 103, 0.35);
  color: var(--nb-pink);
  background: #fff8fa;
}
.nb-filter.active {
  background: var(--nb-pink);
  border-color: var(--nb-pink);
  color: #fff;
}

/* Per-category active pill colours */
.nb-filter[data-slug="sonno"].active      { background: var(--nb-cat-sonno);       border-color: var(--nb-cat-sonno); }
.nb-filter[data-slug="ingredienti"].active { background: var(--nb-cat-ingredienti); border-color: var(--nb-cat-ingredienti); }
.nb-filter[data-slug="lifestyle"].active   { background: var(--nb-cat-lifestyle);   border-color: var(--nb-cat-lifestyle); }
.nb-filter[data-slug="wellness"].active    { background: var(--nb-cat-wellness);    border-color: var(--nb-cat-wellness); }

.nb-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  color: var(--nb-muted);
  white-space: nowrap;
}

/* ═══════════════════════════════════════
   CARD BASE
═══════════════════════════════════════ */
.nb-card {
  background: var(--nb-white);
  border-radius: var(--nb-r);
  border: 1px solid var(--nb-border);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.28s ease, box-shadow 0.28s ease;
  position: relative;
}
.nb-card::before {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(90deg, var(--nb-pink), #ff8fa8);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s ease;
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2;
}
.nb-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 48px rgba(245, 49, 103, 0.10);
}
.nb-card:hover::before { transform: scaleX(1); }

/* ── Card Image ── */
.nb-img {
  width: 100%;
  height: 196px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.nb-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  transition: transform 0.4s ease;
}
.nb-card:hover .nb-img img { transform: scale(1.04); }

.nb-img-letter {
  font-family: 'Syne', sans-serif;
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -2px;
  opacity: 0.55;
}

/* Placeholder colour per category */
.nb-placeholder-scienza     { background: linear-gradient(135deg, #fff0f4, #ffd0db); color: #F53167; }
.nb-placeholder-sonno       { background: linear-gradient(135deg, #f5f0ff, #ddd0f8); color: #7c3aed; }
.nb-placeholder-ingredienti { background: linear-gradient(135deg, #eff6ff, #dbeafe); color: #2563eb; }
.nb-placeholder-lifestyle   { background: linear-gradient(135deg, #fefce8, #fef08a); color: #854d0e; }
.nb-placeholder-wellness    { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: #065f46; }
.nb-placeholder-default     { background: linear-gradient(135deg, #f4f4f2, #e8e8e4); color: #888880; }

/* ── Card Body ── */
.nb-body {
  padding: 22px 22px 26px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.nb-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.nb-badge {
  font-family: 'Syne', sans-serif;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 100px;
  color: #fff;
  flex-shrink: 0;
}

.nb-date,
.nb-read {
  font-size: 12px;
  color: var(--nb-muted);
  font-weight: 300;
}

.nb-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--nb-border);
  flex-shrink: 0;
}

.nb-title {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.18;
  color: var(--nb-ink);
  margin-bottom: 10px;
  transition: color 0.2s;
}
.nb-card:hover .nb-title { color: var(--nb-pink); }

.nb-title--featured {
  font-size: clamp(20px, 2.2vw, 26px);
  margin-bottom: 14px;
}

.nb-excerpt {
  font-size: 13.5px;
  font-weight: 300;
  color: var(--nb-muted);
  line-height: 1.65;
  margin-bottom: 18px;
  flex: 1;
}

.nb-link {
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--nb-pink);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  text-decoration: none;
}
.nb-arr { transition: transform 0.2s; display: inline-block; }
.nb-card:hover .nb-arr { transform: translateX(4px); }

/* ═══════════════════════════════════════
   FEATURED CARD
═══════════════════════════════════════ */
.nb-card.nb-featured {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex-direction: unset;
}
.nb-card.nb-featured::before {
  grid-column: 1 / -1;
  position: absolute;
}
.nb-card.nb-featured .nb-img {
  height: 100%;
  min-height: 280px;
  border-radius: 0;
}
.nb-card.nb-featured .nb-body {
  padding: 32px 28px;
}

/* ═══════════════════════════════════════
   GRID ROWS
═══════════════════════════════════════ */
.nb-row-featured,
.nb-row-3,
.nb-row-2,
.nb-extra-rows {
  margin-bottom: 20px;
}

.nb-row-featured { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.nb-row-3        { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.nb-row-2        { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

.nb-row-2 .nb-img   { height: 220px; }

/* ═══════════════════════════════════════
   FILTER HIDE / SHOW
═══════════════════════════════════════ */
.nb-card.nb-hidden { display: none !important; }

@keyframes nbFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.nb-card.nb-fade-in { animation: nbFadeIn 0.32s ease forwards; }

/* ═══════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════ */
.nb-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: var(--nb-muted);
  gap: 12px;
}
.nb-empty-icon { font-size: 40px; }
.nb-empty h4 {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--nb-ink);
  letter-spacing: -0.3px;
}
.nb-empty p { font-size: 14px; font-weight: 300; }

/* ═══════════════════════════════════════
   LOAD MORE
═══════════════════════════════════════ */
.nb-loadmore {
  display: flex;
  justify-content: center;
  padding: 44px 0 0;
}
.nb-btn-more {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  color: var(--nb-ink);
  border: 1.5px solid rgba(15, 15, 15, 0.2);
  border-radius: 100px;
  padding: 13px 36px;
  cursor: pointer;
  transition: all 0.22s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nb-btn-more:hover {
  border-color: var(--nb-ink);
  background: #f5f0e8;
}
.nb-btn-more:disabled {
  opacity: 0.38;
  cursor: default;
  pointer-events: none;
}
.nb-btn-more.loading .nb-btn-more-text::after {
  content: '…';
  animation: ellipsis 1s infinite;
}
@keyframes ellipsis {
  0%  { content: '.'; }
  33% { content: '..'; }
  66% { content: '…'; }
}

/* ═══════════════════════════════════════
   AJAX SPINNER
═══════════════════════════════════════ */
.nb-spinner {
  display: none;
  justify-content: center;
  padding: 24px;
}
.nb-spinner-ring {
  width: 28px; height: 28px;
  border: 2.5px solid var(--nb-border);
  border-top-color: var(--nb-pink);
  border-radius: 50%;
  animation: nbSpin 0.7s linear infinite;
}
@keyframes nbSpin {
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════
   RESPONSIVE — TABLET ≤ 900px
═══════════════════════════════════════ */
@media (max-width: 900px) {

  /* Featured: stack vertically */
  .nb-card.nb-featured {
    grid-template-columns: 1fr;
  }
  .nb-card.nb-featured .nb-img {
    height: 240px;
    min-height: unset;
  }
  .nb-card.nb-featured .nb-body { padding: 24px 22px 28px; }

  /* Row 1: full width stacked */
  .nb-row-featured { grid-template-columns: 1fr; }

  /* Row 3: 2-col */
  .nb-row-3 { grid-template-columns: repeat(2, 1fr); }

  /* Count on its own line */
  .nb-count { margin-left: 0; width: 100%; padding-top: 4px; }
}

/* ═══════════════════════════════════════
   RESPONSIVE — MOBILE ≤ 600px
═══════════════════════════════════════ */
@media (max-width: 600px) {

  .nb-filters { gap: 6px; padding-bottom: 20px; margin-bottom: 22px; }
  .nb-filter   { font-size: 11px; padding: 7px 14px; }

  .nb-row-featured,
  .nb-row-3,
  .nb-row-2 { grid-template-columns: 1fr; gap: 14px; }

  .nb-card.nb-featured { grid-template-columns: 1fr; }
  .nb-card.nb-featured .nb-img    { height: 200px; }
  .nb-card.nb-featured .nb-body   { padding: 20px 18px 24px; }
  .nb-title--featured              { font-size: 20px !important; }

  .nb-img       { height: 170px; }
  .nb-row-2 .nb-img { height: 190px; }
  .nb-body      { padding: 16px 16px 20px; }
  .nb-title     { font-size: 15px !important; }
  .nb-excerpt   { font-size: 13px; }

  .nb-row-featured,
  .nb-row-3,
  .nb-row-2,
  .nb-extra-rows { margin-bottom: 14px; }
}

/* ═══════════════════════════════════════
   RESPONSIVE — SMALL ≤ 380px
═══════════════════════════════════════ */
@media (max-width: 380px) {
  .nb-filter     { font-size: 10px; padding: 6px 11px; }
  .nb-img        { height: 150px; }
  .nb-body       { padding: 14px 14px 18px; }
  .nb-title      { font-size: 14px !important; }
}
