/* ==========================================================================
   Flukko website — blog list only
   Search · filter bar · post cards · pagination · sidebar (tags, archive, CTA)
   ========================================================================== */

/* ---------- Search ---------- */
.blog-hero { padding-bottom: 56px; }
.blog-search {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 560px;
  margin: 32px auto 0;
  padding: 6px 6px 6px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow);
}
.blog-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(1, 107, 252, 0.14); }
.blog-search > svg { flex: none; width: 20px; height: 20px; color: var(--muted); }
.blog-search input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15.5px;
}
.blog-search input:focus { outline: none; }
.blog-search input::placeholder { color: #98a6b8; }

/* ---------- Layout ---------- */
.blog { padding-bottom: 96px; }
.blog__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 40px;
  align-items: start;
}

/* ---------- Active filter ---------- */
.blog-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 24px;
  padding: 12px 16px;
  border: 1px solid var(--brand-100);
  border-radius: var(--radius);
  background: var(--brand-50);
  color: var(--ink-2);
  font-size: 15px;
}
.blog-filter[hidden] { display: none; }
.blog-filter strong { color: var(--ink); }
.blog-filter__clear {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--brand-100);
  border-radius: 999px;
  background: #fff;
  color: var(--brand);
  font-size: 13.5px;
  font-weight: 600;
  text-transform: capitalize;
}
.blog-filter__clear:hover { border-color: var(--brand); }
.blog-filter__clear svg { width: 14px; height: 14px; }

/* ---------- Post cards ---------- */
.post-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }

.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s var(--ease);
}
.post-card:hover { border-color: #cfdbec; box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.post-card:focus-within { border-color: var(--brand); }

/* Cover: the post image when the CMS has one, else a tag-coloured cover */
.post-card__cover {
  position: relative;
  display: flex;
  align-items: flex-end;
  aspect-ratio: 16 / 9;
  padding: 18px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--c1, #016bfc), var(--c2, #3d8bff));
  color: #fff;
}
.post-card__cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.post-card__cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 85% 20%, rgba(255, 255, 255, 0.22) 0 70px, transparent 71px),
    radial-gradient(circle at 105% 95%, rgba(255, 255, 255, 0.14) 0 120px, transparent 121px),
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: auto, auto, 28px 28px, 28px 28px;
}
.post-card__cover.has-image::before { display: none; }
.post-card__mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.post-card__mark svg { width: 24px; height: 24px; }

.post-card__body { display: flex; flex: 1; flex-direction: column; padding: 22px 24px 24px; }
.post-card__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.post-tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--brand-50);
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
}
.post-card h2,
.post-card h3 { margin-top: 12px; font-size: 19px; line-height: 1.3; letter-spacing: -0.01em; }
.post-card h2 a,
.post-card h3 a { color: var(--ink); }
/* Whole card is clickable through the title link */
.post-card h2 a::after,
.post-card h3 a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.post-card h2 a:focus-visible,
.post-card h3 a:focus-visible { outline: none; }
.post-card__excerpt {
  display: -webkit-box;
  margin-top: 10px;
  overflow: hidden;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.post-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: auto;
  padding-top: 18px;
  color: var(--muted);
  font-size: 13.5px;
}
.post-card__meta span { display: inline-flex; align-items: center; gap: 6px; }
.post-card__meta svg { width: 15px; height: 15px; }
.post-card__read {
  margin-left: auto;
  color: var(--brand);
  font-weight: 600;
  text-transform: capitalize;
}

/* First post on page 1: wide featured card */
.post-card--featured { grid-column: 1 / -1; flex-direction: row; }
.post-card--featured .post-card__cover { flex: 0 0 46%; aspect-ratio: auto; min-height: 280px; }
/* A real cover image is shown whole on the featured card (no cropping of text in the image) */
.post-card--featured .post-card__cover.has-image { background: var(--bg-dark); }
.post-card--featured .post-card__cover.has-image img { object-fit: contain; }
.post-card--featured .post-card__body { padding: 32px; }
.post-card--featured h2 { font-size: clamp(22px, 2.4vw, 28px); }
.post-card--featured .post-card__excerpt { -webkit-line-clamp: 4; font-size: 16px; }
.post-card__topic {
  position: relative;
  margin-left: 12px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.post-card__badge {
  position: relative;
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
}

/* Loading skeleton */
.post-card--skeleton { pointer-events: none; }
.post-card--skeleton .post-card__cover { background: var(--line-2); }
.post-card--skeleton .post-card__cover::before { display: none; }
.post-card--skeleton .post-card__body span {
  display: block;
  height: 12px;
  margin-top: 12px;
  border-radius: 6px;
  background: var(--line-2);
}
.post-card--skeleton .post-card__body span:first-child { width: 30%; margin-top: 0; }
.post-card--skeleton .post-card__body span:nth-child(2) { width: 90%; height: 18px; }
.post-card--skeleton .post-card__body span:last-child { width: 70%; }
.post-card--skeleton .post-card__cover,
.post-card--skeleton .post-card__body span { animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ---------- Empty / error ---------- */
.blog-empty {
  padding: 56px 24px;
  border: 1px dashed #cfdbec;
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  text-align: center;
}
.blog-empty[hidden] { display: none; }
.blog-empty h2 { margin-top: 16px; font-size: 20px; }
.blog-empty p { margin: 8px auto 0; max-width: 420px; color: var(--muted); }
.blog-empty .btn { margin-top: 20px; }
.blog-noscript { padding: 24px; border-radius: var(--radius); background: var(--bg-soft); }

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 40px;
}
.pagination[hidden] { display: none; }
.pagination > a,
.pagination > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pagination > a:hover { border-color: #b9c6d8; color: var(--ink); }
.pagination__step span { display: inline-flex; align-items: center; gap: 6px; }
.pagination [aria-current="page"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.pagination .is-disabled { color: #b4bcc8; pointer-events: none; }
.pagination .pagination__gap { border: 0; background: transparent; min-width: 20px; padding: 0; }
.pagination svg { width: 16px; height: 16px; }
.pagination__step { text-transform: capitalize; }

/* ---------- Sidebar ---------- */
.blog__side { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 20px; }
.side-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
}
.side-card[hidden] { display: none; }
.side-card h2 { font-size: 16px; letter-spacing: 0; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tag-cloud a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}
.tag-cloud a:hover { border-color: var(--brand); color: var(--brand); }
.tag-cloud a[aria-current="true"] { border-color: var(--brand); background: var(--brand); color: #fff; }
.tag-cloud small { color: inherit; opacity: 0.65; font-size: 12px; }

.archive { margin-top: 12px; display: grid; gap: 4px; }
.archive details { border-bottom: 1px solid var(--line-2); }
.archive details:last-child { border-bottom: 0; }
.archive summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.archive summary::-webkit-details-marker { display: none; }
.archive summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s;
}
.archive details[open] summary::after { transform: rotate(-135deg); }
.archive ul { display: grid; gap: 2px; padding-bottom: 10px; }
.archive a {
  display: flex;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 14.5px;
}
.archive a:hover { background: var(--bg-soft); color: var(--ink); }
.archive a[aria-current="true"] { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.archive a small { color: var(--muted); font-variant-numeric: tabular-nums; }

.side-card--cta {
  position: relative;
  overflow: hidden;
  border-color: transparent;
  background: var(--bg-dark);
  color: #c6d2e4;
  isolation: isolate;
}
.side-card--cta::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 260px;
  height: 260px;
  right: -110px;
  top: -130px;
  border-radius: 50%;
  background: rgba(1, 107, 252, 0.5);
  filter: blur(60px);
}
.side-card--cta .icon-tile { width: 42px; height: 42px; background: rgba(255, 255, 255, 0.08); color: #fff; }
.side-card--cta .icon-tile svg { width: 21px; height: 21px; }
.side-card--cta h2 { margin-top: 16px; color: #fff; font-size: 18px; }
.side-card--cta p { margin-top: 8px; font-size: 14.5px; }
.side-card--cta .btn { margin-top: 18px; width: 100%; }
.side-card--cta .link-arrow { margin-top: 14px; color: #7fb2ff; font-size: 14.5px; }
.side-card--cta .link-arrow:hover { color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .blog__grid { grid-template-columns: 1fr; }
  .blog__side { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-card--cta { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .post-grid { grid-template-columns: 1fr; }
  .post-card--featured { flex-direction: column; }
  .post-card--featured .post-card__cover { flex: none; aspect-ratio: 16 / 9; min-height: 0; }
  .post-card--featured .post-card__body { padding: 22px 24px 24px; }
}

@media (max-width: 640px) {
  .blog { padding-bottom: 64px; }
  .blog-search { margin-top: 24px; }
  .blog__side { grid-template-columns: 1fr; }
  .pagination__step span span { display: none; }
}
