/* Category colour mapping
   Reuses site palette tokens — one property drives dot + label colour. */
.blogroll-item[data-category="bloggers"]    { --bcat: var(--slate-blue); }
.blogroll-item[data-category="craft"]       { --bcat: var(--clay); }
.blogroll-item[data-category="earth"]       { --bcat: var(--sage); }
.blogroll-item[data-category="photography"] { --bcat: var(--ochre); }
.blogroll-item[data-category="music"]       { --bcat: var(--violet-muted); }
.blogroll-item[data-category="opinion"]     { --bcat: var(--dusty-rose); }
.blogroll-item[data-category="art"]         { --bcat: var(--violet-muted); }
.blogroll-item[data-category="life"]        { --bcat: var(--sage); }
.blogroll-item[data-category="travel"]      { --bcat: var(--ochre); }
.blogroll-item[data-category="spirit"]      { --bcat: var(--warm-silver, #9e9894); }

/* ── Filter bar ──────────────────────────────────────────────────────────── */
.blogroll-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

/* ── Grid ────────────────────────────────────────────────────────────────── */
.blogroll-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 1px;
  padding-top: clamp(2rem, 4vw, 3rem);
  padding-bottom: calc(var(--gap) * 5);
  list-style: none;
  background: color-mix(in srgb, var(--ink) 8%, transparent); /* gap colour */
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.blogroll-item {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: clamp(1.25rem, 2vw, 1.75rem);
  transition: background 0.2s;
}

.blogroll-item:hover {
  background: var(--accent-pale);
}

/* Category label */
.blogroll-item__cat {
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bcat, var(--ink-light));
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.blogroll-item__cat::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--bcat, var(--ink-light));
  flex-shrink: 0;
}

/* Site name */
.blogroll-item__name {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  font-weight: 400;
  line-height: 1.2;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.2s;
}

/* External link arrow */
.blogroll-item__name::after {
  content: '\2197';
  font-size: 0.7em;
  margin-left: 0.2em;
  opacity: 0.4;
  transition: opacity 0.2s;
  font-family: var(--font-body);
}

.blogroll-item:hover .blogroll-item__name {
  color: var(--accent);
}

.blogroll-item:hover .blogroll-item__name::after {
  opacity: 0.8;
}

/* Description */
.blogroll-item__desc {
  font-size: 0.875rem;
  font-weight: 300;
  line-height: 1.65;
  color: var(--ink-mid);
  margin: 0;
  flex-grow: 1; /* pushes any future Phase 2 footer content to bottom */
}

/* ── Phase 2: last post + loading shimmer ───────────────────────────────── */

/* Hidden by default — JS sets display:flex once content is ready,
   or the .is-loading rule below reveals it as a shimmer placeholder. */
.blogroll-item__last-post {
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.blogroll-item__last-post a {
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--ink-mid);
  text-decoration: none;
  border-bottom: 1px dotted color-mix(in srgb, var(--ink-mid) 40%, transparent);
  line-height: 1.4;
  transition: color 0.2s, border-color 0.2s;
}

.blogroll-item__last-post a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.blogroll-item__last-date {
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-light);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Recency dot — same size as the category dot above the title */
.blogroll-item__last-date::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  background: currentColor;
}

/* ── Recency classes (added by JS after feed date is known) ──────────────── */

.blogroll-item.is-fresh .blogroll-item__last-date  { color: var(--sage); }
.blogroll-item.is-recent .blogroll-item__last-date { color: var(--ochre); }
.blogroll-item.is-quiet .blogroll-item__last-date  { color: var(--ink-light); }

.blogroll-item.is-dormant .blogroll-item__last-date {
  color: var(--ink-light);
  opacity: 0.5;
  font-style: italic;
}

/* Loading shimmer — revealed when .is-loading is on the card */
.blogroll-item.is-loading .blogroll-item__last-post {
  display: block;
}

.blogroll-item.is-loading .blogroll-item__last-post::after {
  content: '';
  display: block;
  height: 0.7rem;
  width: 65%;
  margin-top: 0.25rem;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--ink) 5%,  transparent) 25%,
    color-mix(in srgb, var(--ink) 11%, transparent) 50%,
    color-mix(in srgb, var(--ink) 5%,  transparent) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 2px;
}

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

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .blogroll-filters {
    gap: 0.3rem 0.5rem;
  }

  .blogroll-grid {
    gap: 1px;
  }
}
