/* ── Blog index page ──────────────────────────────────────────────── */

/* Topbar fitting parity with index, but less clipping on blog */
.topbar {
  gap: 8px;
}

.topbar .brandWrap {
  flex: 1 1 auto;
  overflow: visible;
}

.topbar .brandWrap > div:not(.logo) {
  overflow: visible;
}

.topbar .topActions {
  gap: 6px;
  margin-left: -4px;
}

@media (max-width: 760px) {
  .topbar .topActions .btn {
    padding: 7px 9px;
    font-size: 12.5px;
  }
}

/* ── Hero ── */
.blogHero {
  padding: 20px 0 32px;
}

.blogHeroTitle {
  font-family: Fraunces, serif;
  font-size: clamp(36px, 7vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.5px;
  margin: 0 0 14px;
}

.blogHeroCopy {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

/* ── Category filter row ── */
.blogFilters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

/* Search icon button + modal */
.blogSearchBtn{
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadowSoft);
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 100ms ease;
}
.blogSearchBtn:hover{ color: var(--text); border-color: var(--focus); }
.blogSearchBtn:active{ transform: translateY(1px); }
.blogSearchBtn svg{ width: 16px; height: 16px; }

.blogSearchModal{
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.blogSearchModal.isOpen{ display: flex; }
.blogSearchBackdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
}
.blogSearchPanel{
  position: relative;
  width: min(560px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 14px;
}
.blogSearchRow{ display: flex; align-items: center; gap: 10px; }
.blogSearchField{
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface2);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.blogSearchField::placeholder{ color: var(--muted2); }
.blogSearchField:focus{ border-color: var(--text); box-shadow: 0 0 0 3px rgba(0,0,0,.08); }
html[data-theme="dark"] .blogSearchField:focus{ box-shadow: 0 0 0 3px rgba(255,255,255,.10); }
.blogSearchClose{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.blogSearchClose:hover{ color: var(--text); background: var(--btnHover); }
.blogSearchHint{ margin: 10px 2px 0; font-size: 12px; color: var(--muted2); }

.filterBtn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 20px;
  font: 600 15px/1 inherit;
  cursor: pointer;
  box-shadow: var(--shadowSoft);
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 100ms ease;
  white-space: nowrap;
}

.filterBtn:hover {
  color: var(--text);
  border-color: var(--focus);
}

.filterBtn.active {
  background: var(--text);
  color: var(--bg);
  border-color: transparent;
  box-shadow: none;
}

.filterBtn:active { transform: translateY(1px); }

.filterBtn:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ── Post grid ── */
.postGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
  align-items: stretch;
}

/* Featured post — first in the grid, spans full width */
.postCard.featured {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: stretch;
}

.postCard.featured .postCover {
  width: clamp(200px, 36%, 340px);
  flex-shrink: 0;
  aspect-ratio: 4 / 3;
  min-height: 260px;
  max-height: 360px;
  border-bottom: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
}

.postCard.featured .postBody {
  padding: 28px 30px;
  justify-content: center;
}

.postCard.featured .postTitle {
  font-size: clamp(20px, 2.5vw, 28px);
  line-height: 1.2;
}

.postCard.featured .postSnippet {
  font-size: 15px;
  line-height: 1.6;
  -webkit-line-clamp: 4;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.postCard.featured .postMeta { margin-bottom: 4px; }

@media (max-width: 640px) {
  .postCard.featured {
    flex-direction: column;
  }
  .postCard.featured .postCover {
    width: 100%;
    aspect-ratio: 4 / 3;
    min-height: 220px;
    max-height: 260px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .postCard.featured .postBody { padding: 18px; }
}

@media (max-width: 560px) {
  .postGrid { grid-template-columns: 1fr; }
}

/* ── Cards ── */
.postCard {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadowSoft);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.postCard:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.postCard:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Cover */
.postCover {
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 220px;
  max-height: 260px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  display: grid;
  place-items: center;
}

.postCoverImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 320ms ease;
}
.postCard:hover .postCoverImg { transform: scale(1.04); }

/* Mood-tinted placeholder backgrounds */
.postCoverPlaceholder {
  font-family: Fraunces, serif;
  font-size: 56px;
  color: var(--muted2);
  user-select: none;
  line-height: 1;
}

.postCover[data-mood="Light"]        { background: rgba(255,227,168,.48); }
.postCover[data-mood="Sad"]          { background: rgba(90,65,170,.28); }
.postCover[data-mood="Romantic"]     { background: rgba(245,197,211,.48); }
.postCover[data-mood="Dark"]         { background: rgba(201,214,247,.40); }
.postCover[data-mood="Adventurous"]  { background: rgba(189,238,219,.48); }
.postCover[data-mood="Inspirational"]{ background: rgba(255,217,138,.45); }
.postCover[data-mood="Fun"]          { background: rgba(155,227,255,.42); }
.postCover[data-mood="Tense"]        { background: rgba(255,180,166,.45); }
.postCover[data-mood="Historical"]   { background: rgba(204,154,100,.32); }
.postCover[data-mood="Political"]    { background: rgba(24,85,204,.20); }
.postCover[data-mood="Fantasy"]      { background: rgba(136,40,232,.20); }
.postCover[data-mood="Mystery"]      { background: rgba(26,56,120,.24); }

html[data-theme="dark"] .postCover[data-mood="Light"]        { background: rgba(255,227,168,.18); }
html[data-theme="dark"] .postCover[data-mood="Sad"]          { background: rgba(110,85,200,.22); }
html[data-theme="dark"] .postCover[data-mood="Romantic"]     { background: rgba(245,197,211,.18); }
html[data-theme="dark"] .postCover[data-mood="Dark"]         { background: rgba(201,214,247,.18); }
html[data-theme="dark"] .postCover[data-mood="Adventurous"]  { background: rgba(189,238,219,.18); }
html[data-theme="dark"] .postCover[data-mood="Inspirational"]{ background: rgba(255,217,138,.18); }
html[data-theme="dark"] .postCover[data-mood="Fun"]          { background: rgba(155,227,255,.16); }
html[data-theme="dark"] .postCover[data-mood="Tense"]        { background: rgba(255,180,166,.18); }

/* Card body */
.postBody {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}

/* Meta row */
.postMeta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  font-size: 12.5px;
  flex-wrap: wrap;
}

.postMood   { font-weight: 600; color: var(--muted); }
.postDot    { opacity: 0.4; }
.postDate   { color: var(--muted2); }

/* Category badge on card */
.postCategoryTag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--text);
  color: var(--bg);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-left: 0;
}

/* Title */
.postTitle {
  margin: 0;
  font-family: Fraunces, serif;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0.1px;
}

/* Snippet */
.postSnippet {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.6;
  flex: 1;
}

/* Reviewer */
.postAuthor {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted2);
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ── Newsletter section ───────────────────────────────────── */
.newsletterSection {
  margin-top: 48px;
  margin-bottom: 0;
}

main.container {
  padding-bottom: 8px;
}

.newsletterCard {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 28px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadowSoft);
}

.newsletterText { min-width: 0; width: 100%; }

.newsletterTitle {
  font-family: Fraunces, serif;
  font-size: 22px;
  margin: 0 0 5px;
  line-height: 1.15;
}

.newsletterCopy {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 2px;
  line-height: 1.4;
}

.newsletterForm { width: 100%; }

.newsletterInputRow {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
  width: 100%;
}

/* Desktop: keep a stronger subscribe button width and reduce trailing whitespace */
@media (min-width: 821px) {
  .newsletterInputRow .newsletterInput[name="name"] {
    flex: 1 1 34%;
    max-width: none;
  }
  .newsletterInputRow .newsletterInput[name="email"] {
    flex: 1 1 39%;
    max-width: none;
  }
  .newsletterInputRow .btn[type="submit"] {
    flex: 0 0 200px;
    min-width: 200px;
    justify-content: center;
  }
}

.newsletterInput {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-size: 14px;
  width: 100%;
  max-width: 320px;
  min-width: 180px;
  outline: none;
  transition: border-color 140ms ease;
}
.newsletterInput:focus  { border-color: var(--text); }
.newsletterInput::placeholder { color: var(--muted2); }

/* Email input slightly wider */
.newsletterInput[type="email"] { max-width: 360px; }

.newsletterSuccess {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  padding: 10px 0;
}

.newsletterError {
  font-size: 12px;
  color: #c0392b;
  margin: 0;
}

.newsletterConsent {
  font-size: 12px;
  color: var(--muted2);
  margin: 2px 0 0;
  line-height: 1.4;
}

@media (max-width: 820px) {
  .newsletterCard {
    gap: 8px;
    padding: 22px 20px;
  }
  .newsletterCopy {
    max-width: 44ch;
  }
  .newsletterInputRow {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }
  .newsletterInput,
  .newsletterInput[type="email"] {
    max-width: 100%;
    min-width: 0;
    flex: 1 1 0;
    padding: 9px 12px;
    font-size: 13px;
  }
  .newsletterInputRow .newsletterInput[name="name"] {
    flex: 0.9 1 0;
  }
  .newsletterInputRow .newsletterInput[name="email"] {
    flex: 1.2 1 0;
  }
  .newsletterInputRow .btn[type="submit"] {
    flex: 0.9 1 0;
    min-width: 98px;
    white-space: nowrap;
    padding: 9px 12px;
    font-size: 13px;
  }
}

/* ── Pagination ── */
.blogPagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 36px;
}

.blogPageBtn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 20px;
  font: 600 13px/1 inherit;
  cursor: pointer;
  box-shadow: var(--shadowSoft);
  transition: background 140ms ease, color 140ms ease;
}
.blogPageBtn:hover { color: var(--text); border-color: var(--text); }
.blogPageBtn:disabled { opacity: 0.35; cursor: default; pointer-events: none; }

.blogPageCount {
  font-size: 13px;
  color: var(--muted2);
  font-weight: 600;
}

/* ── Reduce cover image height on small/medium screens ── */
@media (max-width: 768px) {
  .postCover {
    aspect-ratio: 4 / 3;
    min-height: 200px;
    max-height: 240px;
  }
  .postCard.featured .postCover {
    aspect-ratio: 4 / 3;
    min-height: 210px;
    max-height: 250px;
  }
}


/* ── Empty state ── */
.blogEmpty {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 15px;
}
