/* ═══════════════════════════════════════════════════════════════════════════
   ELEANOR WHITMORE — BLOG PAGE
   blog.css · Additive stylesheet · Depends on style.css
   ═══════════════════════════════════════════════════════════════════════════

   TABLE OF CONTENTS
   ─────────────────────────────────────────────────────────────────────
   1.  Page-level tokens (blog page only)
   2.  Blog Masthead
   3.  Featured Article
   4.  Archive Section Wrapper
   5.  Archive Controls (search + filters + count)
      — shared class names with poems.css; redeclared here so blog.html
        does not depend on poems.css being loaded.
   6.  Blog Grid & Card Extensions
   7.  Archive Empty State & Pagination
   8.  Animations
   9.  Responsive — Tablet (≤1024px)
   10. Responsive — Mobile (≤768px)
   11. Responsive — Small Mobile (≤480px)
   12. Reduced Motion
   ═══════════════════════════════════════════════════════════════════════════ */


/* ───────────────────────────────────────────────────────────────────────────
   1. PAGE-LEVEL TOKENS (blog page only)
─────────────────────────────────────────────────────────────────────────── */
.page-blog {
  --category-on-writing-bg:     rgba(184, 150, 90, 0.10);
  --category-on-writing-color:  #7A5E2A;

  --category-reading-bg:        rgba(107, 91, 78, 0.08);
  --category-reading-color:     var(--color-text-secondary);

  --category-commentary-bg:     rgba(123, 45, 53, 0.08);
  --category-commentary-color:  var(--color-accent);

  --category-place-bg:          rgba(74, 102, 78, 0.08);
  --category-place-color:       #3F5C42;
}


/* ───────────────────────────────────────────────────────────────────────────
   2. BLOG MASTHEAD
─────────────────────────────────────────────────────────────────────────── */
.blog-masthead {
  background-color: var(--color-bg);
  padding-top: var(--space-20);
  padding-bottom: var(--space-12);
  position: relative;
  overflow: hidden;
  text-align: center;
}

/* Faint ruled-paper texture, matching the poetry page treatment */
.blog-masthead::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 31px,
    var(--color-border-light) 31px,
    var(--color-border-light) 32px
  );
  opacity: 0.3;
  pointer-events: none;
}

.blog-masthead__inner {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin-inline: auto;
}

.blog-masthead__eyebrow {
  font-family: var(--font-caps);
  font-size: var(--text-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-4);

  animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.05s;
}

.blog-masthead__heading {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 300;
  font-style: italic;
  line-height: 0.98;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin-bottom: var(--space-6);

  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.15s;
}

.blog-masthead__description {
  font-family: var(--font-body);
  font-size: var(--text-md);
  font-style: italic;
  color: var(--color-text-secondary);
  line-height: 1.7;
  max-width: 48ch;
  margin-inline: auto;
  margin-bottom: var(--space-10);

  animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.3s;
}

/* Magazine-style issue line: rule — text — rule */
.blog-masthead__issue-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);

  animation: fadeIn 1s ease both;
  animation-delay: 0.45s;
}

.blog-masthead__issue-rule {
  flex: 1;
  max-width: 120px;
  height: 1px;
  background-color: var(--color-border);
}

.blog-masthead__issue-text {
  font-family: var(--font-caps);
  font-size: var(--text-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  opacity: 0.7;
  white-space: nowrap;
}


/* ───────────────────────────────────────────────────────────────────────────
   3. FEATURED ARTICLE
─────────────────────────────────────────────────────────────────────────── */
.blog-featured {
  background-color: var(--color-surface);
  padding-block: var(--space-20);
  border-top: 1px solid var(--color-border-light);
  border-bottom: 1px solid var(--color-border-light);
}

.blog-featured__label {
  font-family: var(--font-caps);
  font-size: var(--text-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  opacity: 0.75;
  margin-bottom: var(--space-8);
}

/* Editorial split layout: image left, text right on desktop */
.featured-article {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-10);
  align-items: stretch;

  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.1s;
}

.featured-article__media-link {
  display: block;
}

.featured-article__media {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-book);
  height: 100%;
}

.featured-article__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 10 / 7;
  display: block;
  transition: transform var(--transition-slow);
}

.featured-article__media-link:hover .featured-article__image,
.featured-article__media-link:focus-visible .featured-article__image {
  transform: scale(1.02);
}

.featured-article__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-5);
}

.featured-article__meta {
  font-family: var(--font-caps);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.featured-article__category {
  color: var(--color-accent);
}

.featured-article__separator {
  color: var(--color-border);
  margin-inline: 2px;
}

.featured-article__title {
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 3.5vw, 2.75rem);
  font-weight: 400;
  font-style: italic;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.featured-article__title-link {
  text-decoration: none;
  color: var(--color-text);
  transition: color var(--transition-fast);
}

.featured-article__title-link:hover,
.featured-article__title-link:focus-visible {
  color: var(--color-accent);
}

.featured-article__excerpt {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: 1.75;
  max-width: 54ch;
}

.featured-article__footer {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

.featured-article__byline {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--color-text-secondary);
  opacity: 0.8;
}

.featured-article__author {
  font-style: normal;
  color: var(--color-text);
}

@media (min-width: 860px) {
  .featured-article {
    grid-template-columns: 1.1fr 1fr;
  }
}


/* ───────────────────────────────────────────────────────────────────────────
   4. ARCHIVE SECTION WRAPPER
─────────────────────────────────────────────────────────────────────────── */
.blog-archive {
  background-color: var(--color-bg);
  padding-block: var(--space-24);
}


/* ───────────────────────────────────────────────────────────────────────────
   5. ARCHIVE CONTROLS
   Same component pattern as poems.css's archive-controls, re-declared so
   blog.html works standalone without requiring poems.css to be present.
─────────────────────────────────────────────────────────────────────────── */
.archive-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-bottom: var(--space-10);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--color-border-light);
}

.archive-search {
  width: 100%;
  max-width: 540px;
}

.archive-search__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.archive-search__icon {
  position: absolute;
  left: var(--space-4);
  color: var(--color-text-secondary);
  pointer-events: none;
  flex-shrink: 0;
}

.archive-search__input {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-style: italic;
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.7rem var(--space-10) 0.7rem calc(var(--space-4) + 22px);
  height: 48px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
}

.archive-search__input::placeholder {
  color: var(--color-text-secondary);
  opacity: 0.6;
}

.archive-search__input:focus {
  outline: none;
  border-color: var(--color-accent-light);
  box-shadow: 0 0 0 3px rgba(196, 146, 138, 0.18);
}

.archive-search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.archive-search__clear {
  position: absolute;
  right: var(--space-3);
  background: none;
  border: none;
  padding: var(--space-2);
  cursor: pointer;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color var(--transition-fast), background-color var(--transition-fast);
  min-width: 28px;
  min-height: 28px;
}

.archive-search__clear:hover {
  color: var(--color-text);
  background-color: var(--color-border-light);
}

.archive-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.filter-pill {
  font-family: var(--font-caps);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  background-color: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-4);
  cursor: pointer;
  min-height: 36px;
  white-space: nowrap;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.filter-pill:hover,
.filter-pill:focus-visible {
  border-color: var(--color-accent-light);
  color: var(--color-text);
}

.filter-pill--active,
.filter-pill[aria-pressed="true"] {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-white);
}

.filter-pill--active:hover,
.filter-pill[aria-pressed="true"]:hover {
  background-color: #621f27;
  border-color: #621f27;
}

.archive-results-count {
  font-family: var(--font-caps);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  color: var(--color-text-secondary);
  opacity: 0.8;
}

#results-number {
  font-weight: 500;
  color: var(--color-text);
}


/* ───────────────────────────────────────────────────────────────────────────
   6. BLOG GRID & CARD EXTENSIONS
   .blog-card / .blog-card__* base rules already live in style.css.
   These rules extend them for the dedicated archive grid context:
   the grid layout itself, category colour-coding, and the read-time tag.
─────────────────────────────────────────────────────────────────────────── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: var(--space-6);
  list-style: none;
  margin-bottom: var(--space-4);
}

/* Hidden state applied by JS during filter/search */
.blog-card[hidden],
.blog-card[aria-hidden="true"] {
  display: none;
}

/* Category colour-coding on the badge text */
.blog-card[data-category="on-writing"] .blog-card__category {
  color: var(--category-on-writing-color);
}

.blog-card[data-category="reading"] .blog-card__category {
  color: var(--category-reading-color);
}

.blog-card[data-category="literary-commentary"] .blog-card__category {
  color: var(--category-commentary-color);
}

.blog-card[data-category="place-landscape"] .blog-card__category {
  color: var(--category-place-color);
}

/* Footer layout override for the archive cards: button + read time */
.blog-archive .blog-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.blog-card__read-time {
  font-family: var(--font-caps);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  opacity: 0.75; /* raised from 0.55 */
  white-space: nowrap;
}


/* ───────────────────────────────────────────────────────────────────────────
   7. ARCHIVE EMPTY STATE & PAGINATION
─────────────────────────────────────────────────────────────────────────── */
.archive-empty-state {
  padding-block: var(--space-16);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
}

.archive-empty-state__text {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.archive-pagination {
  padding-top: var(--space-12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  text-align: center;
  border-top: 1px solid var(--color-border-light);
  margin-top: var(--space-8);
}

.archive-pagination__note {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--color-text-secondary);
  opacity: 0.85; /* raised from 0.75 */
  line-height: 1.6;
  hyphens: auto;
}


/* ───────────────────────────────────────────────────────────────────────────
   8. ANIMATIONS
   (Keyframes fadeInUp / fadeIn already declared in style.css)
─────────────────────────────────────────────────────────────────────────── */
.blog-card {
  opacity: 0;
  transform: translateY(16px);
  animation: fadeInUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.blog-card:nth-child(1) { animation-delay: 0.05s; }
.blog-card:nth-child(2) { animation-delay: 0.10s; }
.blog-card:nth-child(3) { animation-delay: 0.15s; }
.blog-card:nth-child(4) { animation-delay: 0.20s; }
.blog-card:nth-child(5) { animation-delay: 0.25s; }
.blog-card:nth-child(6) { animation-delay: 0.30s; }
.blog-card:nth-child(7) { animation-delay: 0.35s; }
.blog-card:nth-child(8) { animation-delay: 0.40s; }
.blog-card:nth-child(9) { animation-delay: 0.45s; }


/* ───────────────────────────────────────────────────────────────────────────
   9. RESPONSIVE — TABLET (≤1024px)
─────────────────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {

  .featured-article {
    grid-template-columns: 1fr;
  }

  .featured-article__media {
    max-height: 420px;
  }

}


/* ───────────────────────────────────────────────────────────────────────────
   10. RESPONSIVE — MOBILE (≤768px)
─────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

  .blog-masthead {
    padding-top: var(--space-12);
    padding-bottom: var(--space-8);
  }

  .blog-masthead__heading {
    font-size: clamp(2.5rem, 13vw, 3.5rem);
  }

  .blog-masthead__description {
    font-size: var(--text-base);
  }

  .blog-featured {
    padding-block: var(--space-12);
  }

  .featured-article__title {
    font-size: clamp(1.625rem, 6vw, 2rem);
  }

  .featured-article__footer {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .blog-archive {
    padding-block: var(--space-16);
  }

  .archive-search {
    max-width: none;
  }

  .filter-pill {
    font-size: 0.625rem;
    padding: var(--space-1) var(--space-3);
    min-height: 32px;
  }

  .blog-grid {
    grid-template-columns: 1fr;
  }

  .blog-archive .blog-card__footer {
    flex-wrap: wrap;
  }

}


/* ───────────────────────────────────────────────────────────────────────────
   11. RESPONSIVE — SMALL MOBILE (≤480px)
─────────────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {

  .blog-masthead__issue-rule {
    max-width: 48px;
  }

  .blog-masthead__issue-text {
    font-size: 0.625rem;
  }

  .archive-pagination {
    text-align: left;
    align-items: flex-start;
  }

}


/* ───────────────────────────────────────────────────────────────────────────
   12. REDUCED MOTION
─────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {

  .blog-masthead__eyebrow,
  .blog-masthead__heading,
  .blog-masthead__description,
  .blog-masthead__issue-line,
  .featured-article,
  .blog-card {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .featured-article__media-link:hover .featured-article__image {
    transform: none;
  }

}
