/* ==========================================================================
   BLOG.CSS
   – Blog index (hero, tabs, carousel)
   – Optional index list (if you show posts below the carousel)
   – Single post (article + sidebar)
   – Light/Dark adaptive bits
   ========================================================================== */

/* ========= Root tokens ========= */
:root {
  --blog-max: 1200px;
  --gap: 14px;
  --radius: 12px;
  --shadow-card: 0 6px 20px rgba(0,0,0,.06);
  --shadow-soft: 0 8px 22px rgba(0,0,0,.05);

  /* light theme defaults */
  --card: #fff;
  --text: #111;
  --muted: #6b7280;
  --border: #e8e8ef;
  --link: #0073e6;
  --accent: #0073e6;
  --fade-edge: rgba(255,255,255,.95);
}
.dark-mode {
  --card: #1f1f1f;
  --text: #f1f1f1;
  --muted: #a3a3a3;
  --border: #2b2b2b;
  --link: #7ab5ff;
  --accent: #7ab5ff;
  --fade-edge: rgba(0,0,0,.60);
}

/* ========= Shell & Hero ========= */
.blog-wrap { max-width: var(--blog-max); margin: 0 auto; padding: 0 16px; }
.blog-hero { margin: clamp(20px, 4vw, 36px) 0 8px; text-align: center; }
.blog-title { margin: 0; line-height: 1.2; font-size: clamp(28px, 2.6vw + 12px, 42px); }
.blog-meta  { margin-top: .5rem; color: var(--muted); }

/* Keep global .container from squeezing blog/post layouts */
.blog .container,
.post .container { max-width: none; padding-left: 0; padding-right: 0; }

/* ========= Tabs (cosmetic filters) ========= */
.blog-tabs {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin: 10px 0 6px;
}
.blog-tabs .btn, .blog-tabs button {
  padding: 8px 14px; line-height: 1; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
}
.blog-tabs .is-active { background: var(--accent); color: #fff; border-color: transparent; }

/* ==========================================================================
   CAROUSEL (centered between arrows, fades at edges, responsive visible count)
   ========================================================================== */
.blog-carousel {
  /* arrows at sides, track in center */
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  position: relative;
  margin: 1.75rem auto 2rem;
  max-width: var(--blog-max);
  overflow: hidden;
  --vis: 5; /* number of visible cards on wide screens */
}

/* track in the middle column */
.blog-carousel .carousel-track {
  grid-column: 2;
  display: flex;
  gap: var(--gap);
  overflow: hidden;               /* we manage nav via arrows, hides native bar */
  scroll-snap-type: x mandatory;  /* still nice for touch */
}

/* arrows in outer columns */
.blog-carousel .carousel-prev { grid-column: 1; justify-self: center; }
.blog-carousel .carousel-next { grid-column: 3; justify-self: center; }
.blog-carousel .carousel-prev,
.blog-carousel .carousel-next {
  z-index: 3;
  background: var(--accent);
  color: #fff;
  border: 0;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 1.1rem; cursor: pointer;
}

/* cards */
.blog-card.sm {
  flex: 0 0 calc((100% - (var(--gap) * (var(--vis) - 1))) / var(--vis));
  scroll-snap-align: start;
  border-radius: 8px;
  overflow: hidden;
  background: var(--card);
  box-shadow: 0 2px 6px rgba(0,0,0,.10);
}
.blog-card__link { display: block; color: inherit; text-decoration: none; }
.blog-card.sm img {
  width: 100%; height: 160px; object-fit: cover; display: block;
}
.blog-card__meta { padding: .75rem; }
.blog-card__meta time { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.blog-card__title { margin: .25rem 0; font-size: 1rem; line-height: 1.3; }
.blog-card__cta { font-size: .875rem; color: var(--link); }

/* edge fades (light/dark aware) */
.blog-carousel::before,
.blog-carousel::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 72px;
  pointer-events: none;
  z-index: 2;
}

/* responsive visible counts */
@media (max-width: 1200px) { .blog-carousel { --vis: 4; } }
@media (max-width: 980px)  { .blog-carousel { --vis: 3; } }
@media (max-width: 720px)  { .blog-carousel { --vis: 2; } }
@media (max-width: 520px)  { .blog-carousel { --vis: 1; } }

/* ==========================================================================
   OPTIONAL: INDEX LIST (if you render a classic list below the carousel)
   ========================================================================== */
.blog-grid { display: grid; grid-template-columns: 1fr 320px; gap: 2.5rem; }
@media (max-width: 960px) { .blog-grid { grid-template-columns: 1fr; } }

.blog-article { background: transparent; }
.blog-list .post-card,
.post-card {
  padding: 1.25rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
}
.post-card__title { margin: .2rem 0; font-size: 1.6rem; line-height: 1.3; }
.post-card__meta  { margin: 0 0 1rem; color: var(--muted); }
.post-card__meta ul,
.post-card__meta .post-categories { list-style: none; margin: 0; padding: 0; }
.post-card__meta .post-categories li { display: inline; }
.post-card__meta .post-categories li + li::before { content: " • "; }
.post-card__thumb { margin: 0 0 1rem; }
.post-card__thumb img,
.post-card__thumb .wp-post-image {
  width: 100%; height: 220px; object-fit: cover; border-radius: 10px; display: block;
}
.post-card__excerpt { margin: 0 0 1.5rem; color: #374151; line-height: 1.6; }

/* Sidebar (if used on index pages) */
.blog-sidebar .widget {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 18px;
  box-shadow: var(--shadow-soft);
}
.blog-sidebar .widget-title { font-weight: 700; margin: 0 0 10px; }
.blog-sidebar ul { list-style: none; margin: 0; padding: 0; }
.blog-sidebar li + li { margin-top: 8px; }

/* Pagination (if used) */
.navigation.pagination { margin-top: 18px; }

/* ==========================================================================
   SINGLE POST
   ========================================================================== */
.post { max-width: var(--blog-max); margin: 0 auto; padding: 0 16px; }

/* grid container */
.post__grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 28px;
}
@media (max-width: 960px) { .post__grid { grid-template-columns: 1fr; } }

/* article */
.post__article {
  margin-top: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

/* sticky sidebar */
.post__aside { position: sticky; top: calc(var(--header-h, 80px) + 16px); min-width: 300px; height: fit-content; }
.post__widgets .widget { width: 100%; }

/* back link + meta + title */
.post__back { display: inline-block; margin: 0 0 8px; color: var(--accent); text-decoration: none; }
.post__back:hover { text-decoration: underline; }

.post__title {
  margin: 0 0 16px;
  font-family: "Josefin Slab","Cantarell",serif;
  font-weight: 600; letter-spacing: .2px;
  font-size: clamp(28px, 4.4vw, 44px);
  line-height: 1.15; color: var(--text);
}
.post__meta { margin: 0 0 10px; color: var(--muted); font-size: .95rem; line-height: 1.2; }
.post__cats { color: var(--text); opacity: .9; }

/* hero image */
.post__cover {
  margin: 14px 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 10px 26px rgba(0,0,0,.08);
}
.post__cover img { display: block; width: 100%; height: auto; object-fit: cover; }
.post__cover figcaption {
  font-size: .92rem;
  padding: 8px 12px;
  color: var(--muted);
  background: color-mix(in srgb, var(--text) 7%, transparent);
  border-top: 1px solid var(--border);
}
.dark-mode .post__cover figcaption {
  background: color-mix(in srgb, #000 22%, transparent);
  color: color-mix(in srgb, #fff 85%, transparent);
  border-top-color: color-mix(in srgb, #fff 10%, transparent);
}

/* body copy */
.post__body { margin-top: 10px; color: var(--text); font-size: clamp(16px, 1.15vw, 18px); line-height: 1.8; }
.post__body p { margin: 0 0 18px; }
.post__body h2 { margin: 24px 0 10px; font-family: "Josefin Slab","Cantarell",serif; font-weight: 600; font-size: clamp(20px, 2.2vw, 28px); line-height: 1.25; }
.post__body h3 { margin: 18px 0 8px; font-weight: 600; font-size: clamp(18px, 1.8vw, 22px); }
.post__body img {
  max-width: 100%; height: auto; display: block; margin: 10px auto 16px;
  border-radius: 10px; box-shadow: 0 8px 22px rgba(0,0,0,.10);
}
.post__body a { color: var(--accent); text-decoration: underline; }
.post__body blockquote {
  margin: 18px 0; padding: 12px 14px;
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--text) 6%, transparent);
  border-radius: 8px;
}

/* single sidebar widgets + latest posts block */
.post__section + .post__section { margin-top: 18px; }
.post__h3 { margin: 0 0 8px; font-weight: 700; font-size: 1rem; color: var(--text); }
.post__list { list-style: none; margin: 0; padding: 0; }
.post__list li + li { margin-top: 6px; }
.post__list a { color: var(--link); }

.post__recent { list-style: none; margin: 0; padding: 0; }
.post__recent .recent + .recent { margin-top: 10px; }
.recent__link { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; text-decoration: none; color: inherit; }
.recent__thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--card); border: 1px solid var(--border); }
.recent__title { display: block; font-weight: 600; line-height: 1.25; }
.recent__date  { display: block; color: var(--muted); font-size: .85rem; }

/* ==========================================================================
   GLOBAL BLOG UTILITIES
   ========================================================================== */

/* Tighten space under sticky header on single posts */
.site-header + .post { margin-top: 12px; }

/* WP content defaults inside posts/pages */
.entry-content img { max-width: 100%; height: auto; }
.entry-content figure { margin: 1rem 0; }

/* Newsletter section containment on blog page */
.section--newsletter { padding: 3rem 0; }
.section--newsletter .container { max-width: 1100px; padding: 0 16px; }
