/* ==========================================================================
   blog.css — blog listing (featured + grid) and single-post article layout
   ========================================================================== */

.blog-hero {
  text-align: center;
  padding-block: clamp(3rem, 6vw, 4.5rem) var(--space-6);
  background:
    radial-gradient(50% 60% at 50% 0%, rgba(91,52,240,0.10), transparent 70%),
    linear-gradient(180deg, #ffffff 0%, var(--color-bg-alt) 100%);
}
.blog-hero h1 { font-size: var(--fs-hero); margin-top: var(--space-3); }
.blog-hero .lead { margin-top: var(--space-4); }

/* ---- Post card ------------------------------------------------------------ */
.post-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; text-decoration: none; }
.post-card__media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--color-bg-alt); }
.post-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-slow) var(--ease-out); }
.post-card:hover .post-card__media img { transform: scale(1.05); }
.post-card__tag {
  position: absolute; top: var(--space-3); left: var(--space-3);
  background: rgba(255,255,255,0.9); color: var(--color-primary);
  font-size: var(--fs-small); font-weight: var(--fw-semibold);
  padding: 4px 12px; border-radius: var(--radius-pill);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.post-card__body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); flex: 1; }
.post-card__title { font-size: 1.2rem; color: var(--color-primary); }
.post-card:hover .post-card__title { color: var(--color-accent); }
.post-card__excerpt { color: var(--color-text-muted); font-size: 0.95rem; }
.post-card__meta { margin-top: auto; display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; row-gap: 4px; color: var(--color-text-muted); font-size: var(--fs-small); }
.post-card__meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }

/* ---- Featured post -------------------------------------------------------- */
.post-featured { display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; overflow: hidden; padding: 0; }
.post-featured .post-card__media { aspect-ratio: auto; height: 100%; min-height: 320px; }
.post-featured .post-card__body { padding: clamp(1.5rem, 4vw, 3rem); justify-content: center; }
.post-featured .post-card__title { font-size: clamp(1.5rem, 3vw, 2.25rem); }
.post-featured .post-card__excerpt { font-size: 1.05rem; }
@media (max-width: 800px) {
  .post-featured { grid-template-columns: 1fr; }
  /* Stacked, the media has no sibling to borrow its height from, so height:100% +
     min-height left the image only partly filling the box. Give it a real 16:9 ratio
     box and let object-fit:cover fill it edge to edge. */
  .post-featured .post-card__media { aspect-ratio: 16 / 9; height: auto; min-height: 0; }
  .post-featured .post-card__body { padding: var(--space-5); }
}

/* ---- Posts grid ----------------------------------------------------------- */
.posts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); margin-top: var(--space-8); }
@media (max-width: 900px) { .posts-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .posts-grid { grid-template-columns: 1fr; } }

/* ==========================================================================
   Single post article
   ========================================================================== */
.article-hero { padding-block: clamp(2.5rem, 5vw, 4rem) var(--space-6); text-align: center; }
.article-hero .eyebrow { display: inline-block; }
.article-hero h1 { font-size: clamp(2rem, 4vw, 3.25rem); margin-top: var(--space-3); max-width: 20ch; margin-inline: auto; }
.article-meta { margin-top: var(--space-5); display: flex; gap: var(--space-3); align-items: center; justify-content: center; color: var(--color-text-muted); font-size: var(--fs-small); flex-wrap: wrap; }
.article-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.article-cover { max-width: 1000px; margin: var(--space-6) auto 0; padding-inline: var(--container-pad); }
.article-cover img { width: 100%; border-radius: var(--radius-lg); aspect-ratio: 16/9; object-fit: cover; }

.article-body { max-width: 720px; margin-inline: auto; }
.article-body h2 { font-size: var(--fs-h2); margin-top: var(--space-8); scroll-margin-top: 90px; }
.article-body h3 { font-size: var(--fs-h3); margin-top: var(--space-6); }
.article-body p { margin-top: var(--space-4); max-width: none; }
.article-body ul, .article-body ol { margin-top: var(--space-4); padding-left: var(--space-5); }
.article-body ul { list-style: disc; } .article-body ol { list-style: decimal; }
.article-body li { margin-top: var(--space-2); }
.article-body blockquote {
  margin: var(--space-6) 0; padding: var(--space-4) var(--space-5);
  border-left: 4px solid var(--color-accent); background: var(--color-bg-alt);
  border-radius: 0 var(--radius-md) var(--radius-md) 0; font-size: 1.15rem; color: var(--color-primary);
}
.article-body img { margin-top: var(--space-6); border-radius: var(--radius-md); }

.article-author {
  max-width: 720px; margin: var(--space-8) auto 0; padding: var(--space-5);
  display: flex; gap: var(--space-4); align-items: center;
  border-radius: var(--radius-lg); background: var(--color-bg-alt);
}
.article-author__avatar { flex: none; width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, var(--color-primary), var(--color-accent)); }
.article-author strong { color: var(--color-primary); }
.article-author p { margin-top: 2px; color: var(--color-text-muted); font-size: var(--fs-small); max-width: none; }

/* Optional SEO subheading (H2) under the article title. */
.article-hero .article-subtitle {
  margin-top: .6rem;
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
  font-weight: 500;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.82);
  max-width: 60ch;
}

/* ==========================================================================
   Article recommendations — inline product card, free tools, products,
   "read next". Rendered by blog/post.php, scored by includes/recommend.php.

   Namespaced .rec-* deliberately: home.css already defines a .tool-card, which
   is a bare flex column with no card chrome. Reusing that name here would give
   these cards styles they were never designed for and couple two unrelated
   components together.
   ========================================================================== */

/* ---- Inline card, dropped mid-article ------------------------------------ */
.article-inline {
  margin: var(--space-7) 0;
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  background: var(--color-bg-alt);
}
.article-inline__eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: var(--fw-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
}
.article-inline__title { margin: 6px 0 4px; font-size: 1.25rem; }
.article-inline__pitch {
  margin: 0 0 var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--fs-small);
  max-width: none;              /* the global p{max-width:65ch} would narrow it oddly */
}
.article-inline__cta {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: #fff;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-small);
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.article-inline__cta svg { width: 16px; height: 16px; }
.article-inline__cta:hover { background: var(--color-primary-600); color: #fff; transform: translateX(3px); }

/* ---- Section wrappers ---------------------------------------------------- */
.article-extra { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.article-extra--alt { background: var(--color-bg-alt); }
.article-extra__title { font-size: var(--fs-h3); }
.article-extra__sub { color: var(--color-text-muted); font-size: var(--fs-small); margin-top: 4px; }

/* ---- Card grid ----------------------------------------------------------- */
.rec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
  margin-top: var(--space-6);
}
.rec-grid--2 { grid-template-columns: repeat(2, 1fr); }

.rec-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.rec-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.rec-card--prod { border-top: 3px solid var(--color-primary); }

.rec-card__icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff;
  margin-bottom: var(--space-2);
}
.rec-card__icon svg { width: 22px; height: 22px; }
.rec-card__name { font-size: 1.05rem; color: var(--color-text); line-height: 1.35; }
.rec-card__excerpt { color: var(--color-text-muted); font-size: var(--fs-small); line-height: 1.55; }
.rec-card__cta {
  margin-top: auto;
  padding-top: var(--space-3);
  color: var(--color-accent);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-small);
}
.rec-card:hover .rec-card__cta { color: var(--color-primary); }

/* ---- Read next ----------------------------------------------------------- */
.next-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); margin-top: var(--space-6); }
.next-card {
  display: flex; flex-direction: column;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.next-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.next-card__media { display: block; aspect-ratio: 16 / 9; background: var(--color-bg-alt); overflow: hidden; }
.next-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.next-card__body { display: flex; flex-direction: column; gap: 6px; padding: var(--space-5); flex: 1; }
.next-card__cat {
  font-size: 0.7rem; font-weight: var(--fw-bold); letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--color-accent);
}
.next-card__title { font-size: 1.05rem; color: var(--color-text); line-height: 1.35; }
.next-card__excerpt {
  color: var(--color-text-muted); font-size: var(--fs-small); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.next-card__meta { margin-top: auto; padding-top: var(--space-3); color: var(--color-text-muted); font-size: 0.8rem; }

@media (max-width: 900px) {
  .rec-grid, .rec-grid--2, .next-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .rec-grid, .rec-grid--2, .next-cards { grid-template-columns: 1fr; }
  .article-inline { padding: var(--space-4) var(--space-5); }
}

/* ==========================================================================
   Blog listing with sidebar (search, categories, tool/product carousels)
   ========================================================================== */
/* ---- Share + like (blog/post.php) ---------------------------------------- */
.share-row { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.share-row__label { font-size: var(--fs-small); font-weight: var(--fw-semibold); color: var(--color-text-muted); margin-right: 2px; }
.share-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0;
  border: 1px solid var(--color-border); border-radius: 50%;
  background: var(--color-surface); color: var(--color-text-muted); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.share-btn svg { width: 17px; height: 17px; }
.share-btn:hover { transform: translateY(-2px); color: #fff; }
.share-btn--x:hover        { background: #000;     border-color: #000; }
.share-btn--linkedin:hover { background: #0a66c2;  border-color: #0a66c2; }
.share-btn--facebook:hover { background: #1877f2;  border-color: #1877f2; }
.share-btn--whatsapp:hover { background: #25d366;  border-color: #25d366; }
.share-btn--email:hover,
.share-btn--copy:hover     { background: var(--color-accent); border-color: var(--color-accent); }
.share-btn--copy.is-copied { background: #1f9d55; border-color: #1f9d55; color: #fff; }
.share-row--top { margin-top: var(--space-4); }

.post-actions {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); flex-wrap: wrap;
  margin: var(--space-8) 0 0; padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}
.like-btn {
  display: inline-flex; align-items: center; gap: 9px; line-height: 1;
  padding: .7rem 1.3rem; border: 1px solid var(--color-border); border-radius: var(--radius-pill);
  background: var(--color-surface); color: var(--color-text); font: inherit; font-weight: var(--fw-semibold); line-height: 1; cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
/* display:block + overflow:visible so the heart (and its scale-up when liked) is
   never clipped by the pill; flex:none stops it being squashed on small screens. */
.like-btn__heart { width: 19px; height: 19px; flex: none; display: block; overflow: visible; transition: transform var(--dur-fast) var(--ease-out); }
.like-btn__count { font-variant-numeric: tabular-nums; }
.like-btn:hover { border-color: #e0517a; color: #e0517a; }
.like-btn.is-liked { border-color: #e0517a; color: #e0517a; background: #fdeef2; }
.like-btn.is-liked .like-btn__heart { fill: #e0517a; stroke: #e0517a; transform: scale(1.08); }

.blog-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: clamp(2.5rem, 4.5vw, 4rem); align-items: start; }
.blog-main { min-width: 0; }
/* Inside the narrower main column, the featured card and grid tighten up. */
.blog-main .post-featured { grid-template-columns: 1fr; }
.blog-main .post-featured .post-card__media { min-height: 240px; }
.blog-main .posts-grid { grid-template-columns: repeat(2, 1fr); margin-top: var(--space-6); }
.blog-noresults { text-align: center; color: var(--color-text-muted); padding: var(--space-8) 0; }
.blog-noresults button { border: 0; background: none; padding: 0; font: inherit; color: var(--color-accent); font-weight: var(--fw-semibold); cursor: pointer; }
.blog-noresults button:hover { text-decoration: underline; }
/* A class-level display (e.g. .post-featured{display:grid}) would otherwise beat the
   [hidden] UA rule, so filtered-out cards need this to actually disappear. */
.post-card[hidden] { display: none; }

.blog-side { position: sticky; top: 88px; display: flex; flex-direction: column; gap: var(--space-5); }
.side-card { padding: var(--space-5); border-radius: var(--radius-lg); border: 1px solid var(--color-border); background: var(--color-surface); box-shadow: var(--shadow-sm); }
.side-card > h3 { font-size: .78rem; letter-spacing: .07em; text-transform: uppercase; color: var(--color-text-muted); margin: 0 0 var(--space-4); }

/* Flex row so the icon always sits left of the input — no absolute overlap. */
.side-search { display: flex; align-items: center; gap: .55rem; padding: 0 .9rem; border: 1px solid var(--color-border); border-radius: var(--radius-pill); background: var(--color-surface); box-shadow: var(--shadow-sm); }
.side-search svg { flex: 0 0 auto; width: 16px; height: 16px; color: var(--color-text-muted); pointer-events: none; }
.side-search input { flex: 1 1 auto; min-width: 0; width: 100%; padding: .72rem 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; font: inherit; font-size: .95rem; color: var(--color-text);
  /* iOS renders type=search with its own pill radius + inset shadow, which showed
     THROUGH the container and made the bar read as a round blob on phones. Kill it. */
  -webkit-appearance: none; appearance: none; }
.side-search input:focus { outline: none; }
.side-search:focus-within { border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(91,52,240,.15); }
/* Drop the native clear affordance so it can't fight our layout. */
.side-search input::-webkit-search-decoration,
.side-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

.side-cats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.side-cats button { width: 100%; text-align: left; display: flex; justify-content: space-between; gap: 8px; padding: .5rem .7rem; border: 0; background: transparent; border-radius: var(--radius-md); font: inherit; font-size: .9rem; color: var(--color-text); cursor: pointer; transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.side-cats button:hover { background: var(--color-bg-alt); }
.side-cats button.is-active { background: var(--color-accent); color: #fff; }
.side-cats__n { color: var(--color-text-muted); font-variant-numeric: tabular-nums; font-size: .82rem; }
.side-cats button.is-active .side-cats__n { color: rgba(255,255,255,.8); }

/* Carousels */
.side-carousel__view { overflow: hidden; }
.side-carousel__track { display: flex; transition: transform .55s var(--ease-out); }
.side-carousel__slide { flex: 0 0 100%; min-width: 0; }
.cs-card { display: block; text-decoration: none; }
.cs-name { display: block; font-weight: var(--fw-semibold); color: var(--color-primary); line-height: 1.3; }
.cs-pitch { margin: 6px 0 0; color: var(--color-text-muted); font-size: .85rem; line-height: 1.5; max-width: none; }
.cs-card:hover .cs-name { color: var(--color-accent); }
.side-carousel__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: var(--space-4); }
.carousel-dots { display: flex; gap: 6px; }
.carousel-dots button { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 50%; background: var(--color-border); cursor: pointer; transition: width var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out); }
.carousel-dots button.is-active { background: var(--color-accent); width: 18px; border-radius: 4px; }
.side-more { font-size: .82rem; font-weight: var(--fw-semibold); color: var(--color-accent); white-space: nowrap; }
.side-more:hover { color: var(--color-primary); }

/* Brand-styled product carousel — lifts the design language from the homepage. */
.side-carousel--brand { position: relative; overflow: hidden; background: linear-gradient(160deg, var(--color-primary), var(--color-primary-700)); border: 0; color: #fff; }
.side-carousel--brand > h3 { color: rgba(255,255,255,.72); }
.side-carousel--brand .cs-name { color: #fff; }
.side-carousel--brand .cs-pitch { color: rgba(255,255,255,.82); }
.side-carousel--brand .cs-card:hover .cs-name { color: #d8ccff; }
.side-carousel--brand .carousel-dots button { background: rgba(255,255,255,.3); }
.side-carousel--brand .carousel-dots button.is-active { background: #fff; }
.side-carousel--brand .side-more { color: #fff; }

.side-cta { text-align: center; }
.side-cta > h3 { color: var(--color-text-muted); }
.side-cta p { color: var(--color-text-muted); font-size: .88rem; margin: 0 0 var(--space-4); max-width: none; }
.side-cta .btn { width: 100%; justify-content: center; }

@media (max-width: 980px) {
  .blog-layout { grid-template-columns: 1fr; }
  .blog-side { position: static; flex-direction: row; flex-wrap: wrap; }
  .blog-side .side-card { flex: 1 1 260px; }
  /* Search sits full-width on its own line ABOVE the cards, as a rounded rectangle
     (not the desktop pill). Squeezed into a wrapping 260px flex slot it collapsed
     toward a circle on phones — full width + radius-md fixes the "round" look. */
  .blog-side .side-search { flex: 1 1 100%; order: -1; border-radius: var(--radius-md); }
  /* The auto-advancing gradient carousels are a desktop-sidebar nicety. On a
     phone they land at the bottom of the page (below every post, so useless for
     discovery) AND their continuous translateX repaint on a large gradient is a
     real memory/battery cost — the likely cause of iOS Safari's "a problem
     repeatedly occurred" tab crash. Drop them entirely below the sidebar break;
     the JS also refuses to start a carousel that isn't visible (see index.php). */
  .blog-side .side-carousel { display: none; }
}
@media (max-width: 600px) {
  .blog-side { flex-direction: column; }
  .blog-main .posts-grid { grid-template-columns: 1fr; }
  /* Tighten the remaining sidebar cards so they don't read as oversized blocks. */
  .side-card { padding: var(--space-4); }
  .side-cta p { font-size: .85rem; }
}
