/* ============================================================
   INSTAWHEW — BLOG / CONTENT SECTIONS
   Archive, single post, blog cards, newsletter, author bio
   ============================================================ */

/* Homepage posts grid ------------------------------------- */
.iw-posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: var(--space-4);
}
.iw-post-card__thumb { display: block; aspect-ratio: 16/9; overflow: hidden; border-radius: var(--radius-md) var(--radius-md) 0 0; }
.iw-post-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.iw-post-card__date { font-size: var(--text-xs); color: var(--text-3); display: block; margin-bottom: var(--space-2); }
.iw-post-card__title { font-size: var(--text-base); font-weight: 700; margin-bottom: var(--space-2); }
.iw-post-card__title a { color: var(--text-1); text-decoration: none; }
.iw-post-card__title a:hover { color: var(--accent-600); }
.iw-post-card__excerpt { font-size: var(--text-sm); color: var(--text-2); }

/* Articles archive ---------------------------------------- */
.iw-archive-header {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--line-subtle);
}
.iw-archive-header__title { font-size: var(--text-3xl); font-weight: 800; margin-bottom: var(--space-3); }
.iw-archive-header__sub { font-size: var(--text-lg); color: var(--text-2); }
.iw-posts-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}
.iw-post-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--line-subtle);
}
@media (min-width: 600px) {
  .iw-post-row { grid-template-columns: 180px 1fr; }
}
.iw-post-row__thumb { display: block; border-radius: var(--radius-md); overflow: hidden; aspect-ratio: 4/3; }
.iw-post-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.iw-post-row__date { font-size: var(--text-xs); color: var(--text-3); display: block; margin-bottom: var(--space-2); }
.iw-post-row__title { font-size: var(--text-lg); font-weight: 700; margin-bottom: var(--space-3); }
.iw-post-row__title a { color: var(--text-1); text-decoration: none; }
.iw-post-row__title a:hover { color: var(--accent-600); }
.iw-post-row__excerpt { font-size: var(--text-sm); color: var(--text-2); margin-bottom: var(--space-3); }
.iw-post-row__read { font-size: var(--text-sm); color: var(--accent-600); text-decoration: none; font-weight: 600; }
.iw-post-row__read:hover { text-decoration: underline; }
.iw-no-posts { color: var(--text-3); }

/* Single post --------------------------------------------- */
.iw-single-layout { max-width: 720px; margin-inline: auto; }
.iw-single__header { margin-bottom: var(--space-5); }
.iw-single__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-3);
  margin-bottom: var(--space-3);
}
.iw-single__sep { color: var(--line); }
.iw-single__cat { color: var(--accent-600); font-weight: 600; }
.iw-single__title { font-size: var(--text-3xl); font-weight: 800; line-height: var(--leading-tight); margin-bottom: var(--space-4); }
.iw-single__thumb { border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 16/9; }
.iw-single__thumb img { width: 100%; height: 100%; object-fit: cover; }
.iw-single__body { font-size: var(--text-base); line-height: var(--leading-relaxed); color: var(--text-2); }
.iw-single__body p { margin-bottom: var(--space-3); }
.iw-single__body h2,
.iw-single__body h3 { color: var(--text-1); font-weight: 700; margin-top: var(--space-5); margin-bottom: var(--space-3); }
.iw-single__body h2 { font-size: var(--text-xl); }
.iw-single__body h3 { font-size: var(--text-lg); }
.iw-single__body a { color: var(--accent-600); }
.iw-single__body code { font-size: 0.875em; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1px 5px; }
.iw-single__body pre { background: var(--base-950); color: var(--base-100); padding: var(--space-4); border-radius: var(--radius-md); overflow-x: auto; font-size: var(--text-sm); margin-block: var(--space-4); }
.iw-single__body pre code { background: none; border: none; padding: 0; color: inherit; }
.iw-single__footer { margin-top: var(--space-6); padding-top: var(--space-5); border-top: 1px solid var(--line-subtle); }
.iw-single__tags { font-size: var(--text-sm); color: var(--text-3); margin-bottom: var(--space-3); }
.iw-single__tags a { color: var(--text-2); text-decoration: none; }
.iw-single__tags a:hover { color: var(--accent-600); }
.iw-single__nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
}
.iw-single__nav a { color: var(--accent-600); text-decoration: none; }
.iw-single__nav a:hover { text-decoration: underline; }

/* Blog card grid ------------------------------------------ */
.iw-blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: var(--space-4);
}
.iw-blog-card {
  background: var(--surface);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--dur-fast) var(--ease);
}
.iw-blog-card:hover { box-shadow: var(--shadow-md); }
.iw-blog-card__thumb {
  aspect-ratio: 16/9;
  background: var(--surface-2);
  overflow: hidden;
}
.iw-blog-card__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.iw-blog-card__body { padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); flex: 1; }
.iw-blog-card__cat  { font-size: var(--text-xs); font-weight: 700; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--accent-600); }
.iw-blog-card__title { font-size: var(--text-base); font-weight: 700; line-height: var(--leading-snug); }
.iw-blog-card__title a { color: var(--text-1); text-decoration: none; }
.iw-blog-card__title a:hover { color: var(--accent-600); }
.iw-blog-card__excerpt { font-size: var(--text-sm); color: var(--text-2); line-height: var(--leading-loose); flex: 1; }
.iw-blog-card__meta { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-xs); color: var(--text-3); margin-top: auto; padding-top: var(--space-2); border-top: 1px solid var(--line-subtle); }

/* Blog list view ------------------------------------------ */
.iw-blog-list { display: flex; flex-direction: column; }
.iw-blog-list-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  padding-block: var(--space-4);
  border-bottom: 1px solid var(--line-subtle);
}
@media (min-width: 600px) { .iw-blog-list-item { grid-template-columns: 160px 1fr; } }
.iw-blog-list-item:first-child { padding-top: 0; }
.iw-blog-list-item:last-child  { border-bottom: none; padding-bottom: 0; }
.iw-blog-list-item__thumb { border-radius: var(--radius-md); aspect-ratio: 4/3; overflow: hidden; background: var(--surface-2); }
.iw-blog-list-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.iw-blog-list-item__meta  { font-size: var(--text-xs); color: var(--text-3); margin-bottom: var(--space-2); }
.iw-blog-list-item__title { font-size: var(--text-lg); font-weight: 700; margin-bottom: var(--space-2); }
.iw-blog-list-item__title a { color: var(--text-1); text-decoration: none; }
.iw-blog-list-item__title a:hover { color: var(--accent-600); }
.iw-blog-list-item__excerpt { font-size: var(--text-sm); color: var(--text-2); margin-bottom: var(--space-3); }
.iw-blog-list-item__read { font-size: var(--text-sm); font-weight: 600; color: var(--accent-600); text-decoration: none; }
.iw-blog-list-item__read:hover { text-decoration: underline; }

/* Newsletter section --------------------------------------- */
.iw-newsletter { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); text-align: center; }
.iw-newsletter__form { width: 100%; max-width: 480px; }
.iw-newsletter__note { font-size: var(--text-xs); color: var(--text-3); }
/* Force wp:search input to fill available width inside newsletter form */
.iw-newsletter__form .wp-block-search,
.iw-newsletter__form .wp-block-search__inside-wrapper { width: 100%; display: flex; }
.iw-newsletter__form .wp-block-search__input { flex: 1 1 0; min-width: 0; width: auto !important; }

/* Blog — Author Bio */
.iw-author-bio { border-top: 2px solid var(--line-subtle); padding-top: var(--space-5); margin-top: var(--space-5); }
.iw-author-bio__photo { width: 80px; height: 80px; flex-shrink: 0; border-radius: var(--radius-full); overflow: hidden; }
.iw-author-bio__inner { display: flex; gap: var(--space-4); align-items: flex-start; }
.iw-author-bio__body { flex: 1; min-width: 0; }
.iw-author-bio__name { font-weight: 800; font-size: var(--text-lg); color: var(--text-1); margin: 0 0 var(--space-1); }
.iw-author-bio__role { font-size: var(--text-sm); color: var(--text-3); margin: 0 0 var(--space-3); }
.iw-author-bio__bio { font-size: var(--text-sm); color: var(--text-2); line-height: var(--leading-relaxed); margin: 0 0 var(--space-3); }
.iw-author-bio__social { display: flex; gap: var(--space-3); }
.iw-author-bio__social-link { font-size: var(--text-sm); font-weight: 600; color: var(--accent-600); text-decoration: none; }
.iw-author-bio__social-link:hover { text-decoration: underline; }
@media (max-width: 480px) { .iw-author-bio__inner { flex-direction: column; } }

/* Blog — Masonry */
.iw-posts-masonry { columns: 3 260px; column-gap: var(--space-4); }
.iw-posts-masonry .iw-blog-card { break-inside: avoid; margin-bottom: var(--space-4); }
@media (max-width: 640px) { .iw-posts-masonry { columns: 1; } }

/* Single — reading time + author byline -------------------- */
.iw-single__read { color: var(--text-3); }
.iw-single__author {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.iw-single__author-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.iw-single__author-name { font-size: var(--text-sm); font-weight: 600; color: var(--text-2); }

/* Archive header — result count subline -------------------- */
.iw-archive-header__meta { font-size: var(--text-sm); color: var(--text-3); margin-top: var(--space-2); }

/* Search form ----------------------------------------------- */
.iw-search-form { margin-top: var(--space-4); }
.iw-search-form__wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface);
  max-width: 520px;
  overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease);
}
.iw-search-form__wrap:focus-within { border-color: var(--accent-400); }
.iw-search-form__input {
  flex: 1;
  border: none;
  background: transparent;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  color: var(--text-1);
  font-family: inherit;
  outline: none;
}
.iw-search-form__input::placeholder { color: var(--text-3); }
.iw-search-form__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 0 var(--space-3);
  color: var(--text-3);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease);
  height: 100%;
}
.iw-search-form__btn:hover { color: var(--accent-600); }
.iw-search-form__btn:focus-visible { outline: 2px solid var(--accent-400); outline-offset: -2px; }
