/*
 * archive.css — Recovery Library (Blog Archive)
 * Loaded on: is_home(), is_archive(), is_search()
 * via ir_get_page_css_slug() → 'archive'.
 *
 * SECTIONS
 *   1.  Library Hero           — two-column: copy + form
 *   2.  Hero Actions           — CTA button group
 *   3.  Hero Search            — integrated search form inside hero copy column
 *   4.  Library Orientation    — "Where to Begin" three-path panel
 *   5.  Topic Browsing         — future content cluster chips
 *   6.  Article Grid           — 3-col post cards
 *   7.  Article Cards          — .card styles (shared with content-card.php)
 *   8.  Read More Link
 *   9.  Pagination             — WordPress nav-links
 *  10.  No-results / search results heading
 *  11.  Responsive
 */


/* ─────────────────────────────────────────────────────────────────────────
   1. LIBRARY HERO — soft-blue, two-column
   ───────────────────────────────────────────────────────────────────────── */

.library-hero {
  background: var(--surface-soft-blue);
  padding: clamp(36px, 4.5vh, 56px) 0 clamp(28px, 3.5vh, 44px);
}

.library-hero-grid {
  display: grid;
  gap: clamp(28px, 4vw, 44px);
}

.library-hero-copy .eyebrow {
  margin-bottom: 14px;
}

.library-hero-copy h1 {
  font-size: clamp(2.2rem, 4.4vw, 3.4rem);
  line-height: 1.07;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
  text-wrap: balance;
}

.library-hero-copy .lead {
  font-size: clamp(1rem, 1.5vw, 1.1rem);
  line-height: 1.72;
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* Form column */
.library-hero-form {
  align-self: start;
}

.library-hero-form .form-card {
  padding: clamp(26px, 3.5vw, 40px);
}

.library-form-title {
  font-family: 'Roboto Slab', Georgia, serif;
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.library-form-note {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-bottom: 22px;
  line-height: 1.5;
}

/* Two-column hero at 860px */
@media (min-width: 860px) {
  .library-hero-grid {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: start;
  }
}


/* ─────────────────────────────────────────────────────────────────────────
   2. HERO ACTIONS
   ───────────────────────────────────────────────────────────────────────── */

.library-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.library-hero-actions .btn {
  flex: 1 1 auto;
  text-align: center;
  min-width: 160px;
}


/* ─────────────────────────────────────────────────────────────────────────
   3. HERO SEARCH — integrated pill search form inside .library-hero-copy
   ───────────────────────────────────────────────────────────────────────── */

.library-hero-search {
  display: flex;
  align-items: center;
  background: var(--surface-warm);
  border: 1.5px solid var(--border-light);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 26px;
  transition: border-color .15s, box-shadow .15s;
}

.library-hero-search:focus-within {
  border-color: var(--brand-aqua-hover);
  box-shadow: 0 0 0 3px rgba(11,162,163,.15);
}

.library-hero-search input[type="search"] {
  flex: 1;
  font-family: inherit;
  font-size: 0.96rem;
  padding: 13px 18px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  outline: none;
  min-width: 0;
}

.library-hero-search input[type="search"]::placeholder {
  color: var(--text-tertiary);
}

.library-hero-search input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.library-hero-search button[type="submit"] {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 4px;
  background: var(--brand-aqua);
  color: var(--text-primary);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s;
}

.library-hero-search button[type="submit"]:hover {
  background: var(--brand-aqua-hover);
}

.library-hero-search button[type="submit"]:focus-visible {
  outline: 3px solid var(--brand-aqua-hover);
  outline-offset: 2px;
}


/* ─────────────────────────────────────────────────────────────────────────
   4. LIBRARY ORIENTATION — "Where to Begin" three-path panel
   ───────────────────────────────────────────────────────────────────────── */

.library-orientation {
  background: var(--surface-warm);
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--border-light);
}

.library-orientation-inner {
  display: grid;
  gap: clamp(32px, 5vw, 56px);
}

@media (min-width: 860px) {
  .library-orientation-inner {
    grid-template-columns: 0.85fr 1.15fr;
    align-items: start;
  }
}

.library-orientation-copy .eyebrow {
  margin-bottom: 12px;
}

.library-orientation-copy h2 {
  margin-bottom: 16px;
}

.library-orientation-copy .lead {
  color: var(--text-secondary);
  margin-bottom: 0;
}

.library-orientation-paths {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 560px) {
  .library-orientation-paths {
    grid-template-columns: repeat(3, 1fr);
  }
}

.orientation-path {
  background: var(--surface-soft-blue);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: clamp(20px, 2.5vw, 28px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}

a.orientation-path:hover {
  border-color: var(--brand-aqua);
  box-shadow: 0 4px 20px rgba(115,215,238,.25);
  transform: translateY(-2px);
}

a.orientation-path:focus-visible {
  outline: 3px solid var(--brand-aqua-hover);
  outline-offset: 3px;
}

.orientation-path-icon {
  display: flex;
  color: var(--brand-aqua-hover);
  margin-bottom: 4px;
}

.orientation-path h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin: 0;
}

.orientation-path p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.orientation-path .morelink {
  margin-top: 4px;
  font-size: 0.85rem;
}


/* ─────────────────────────────────────────────────────────────────────────
   5. TOPIC BROWSING — future content cluster chips
   ───────────────────────────────────────────────────────────────────────── */

.library-topics {
  background: var(--brand-brown);
  padding: var(--space-md) 0;
}

.library-topics-head {
  margin-bottom: clamp(28px, 4vh, 40px);
}

.library-topics-head .eyebrow {
  color: rgba(255,255,255,.7);
}

.library-topics-head .eyebrow::before {
  background: rgba(255,255,255,.5);
}

.library-topics-head h2 {
  margin-top: 10px;
  color: #fff;
}

.topics-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.topic-card {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 16px 22px;
  background: rgba(255,255,255,.12);
  border: 1.5px solid rgba(255,255,255,.3);
  border-radius: var(--r-md);
  text-decoration: none;
  transition: background .2s, border-color .2s, transform .2s;
}

.topic-card:hover {
  background: rgba(255,255,255,.22);
  border-color: rgba(255,255,255,.7);
  transform: translateY(-2px);
}

.topic-card:focus-visible {
  outline: 3px solid rgba(255,255,255,.8);
  outline-offset: 3px;
  border-radius: var(--r-md);
}

.topic-card-name {
  font-family: 'Roboto Slab', Georgia, serif;
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  line-height: 1.3;
}


/* ─────────────────────────────────────────────────────────────────────────
   6. ARTICLE GRID — responsive 3-col post grid
   ───────────────────────────────────────────────────────────────────────── */

.library-posts {
  background: var(--surface-warm);
  padding: var(--space-lg) 0;
}

.library-posts-head {
  margin-bottom: clamp(24px, 4vh, 40px);
}

.library-posts-head h2 {
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  color: var(--text-primary);
}

.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(24px, 3vw, 32px);
}

@media (min-width: 580px) {
  .post-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 940px) {
  .post-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}


/* ─────────────────────────────────────────────────────────────────────────
   7. ARTICLE CARDS — .card (output by content-card.php)
   ───────────────────────────────────────────────────────────────────────── */

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface-warm);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: box-shadow .25s, transform .25s;
}

.card:hover {
  box-shadow: 0 12px 40px rgba(14,95,122,.10);
  transform: translateY(-3px);
}

/* Image thumbnail */
.card-image {
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  flex: none;
  background: var(--placeholder-bg);
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}

.card:hover .card-image img {
  transform: scale(1.03);
}

/* Card body */
.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: clamp(18px, 2.4vw, 26px);
}

/* Category eyebrow inside card */
.card-body .eyebrow {
  margin-bottom: 8px;
  font-size: 0.72rem;
}

.card-title {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  line-height: 1.3;
  margin-bottom: 10px;
}

.card-title a {
  color: var(--text-primary);
  text-decoration: none;
}

.card-title a:hover {
  color: var(--brand-aqua-hover);
}

.card-excerpt {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 14px;
}

.card-meta {
  font-size: 0.77rem;
  color: var(--text-tertiary);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-bottom: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}


/* ─────────────────────────────────────────────────────────────────────────
   8. READ MORE LINK inside cards
   The .morelink class is defined globally in components.css.
   This overrides margin-top only to collapse the extra spacing in card context.
   ───────────────────────────────────────────────────────────────────────── */

.card .morelink {
  margin-top: 0;
  font-size: 0.85rem;
}


/* ─────────────────────────────────────────────────────────────────────────
   8b. BACK TO LIBRARY LINK — shown on paginated pages (page 2+)
   ───────────────────────────────────────────────────────────────────────── */

.library-back-link {
  margin-top: clamp(28px, 4vh, 40px);
}

.library-back-link a {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--brand-aqua-hover);
  text-decoration: none;
  transition: color .2s;
}

.library-back-link a:hover {
  color: var(--brand-brown);
}

.library-back-link a:focus-visible {
  outline: 3px solid var(--brand-aqua-hover);
  outline-offset: 3px;
  border-radius: 3px;
}


/* ─────────────────────────────────────────────────────────────────────────
   9. PAGINATION — WordPress the_posts_pagination() output
   ───────────────────────────────────────────────────────────────────────── */

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: clamp(36px, 5vh, 56px);
  padding-top: 28px;
  border-top: 1px solid var(--border-light);
}

.nav-links .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--brand-aqua-hover);
  border: 1.5px solid transparent;
  transition: background .2s, border-color .2s;
}

.nav-links .page-numbers:hover {
  background: var(--surface-soft-blue);
  border-color: var(--brand-aqua);
}

.nav-links .page-numbers.current {
  background: var(--brand-aqua);
  color: var(--text-primary);
  border-color: var(--brand-aqua);
}

.nav-links .page-numbers:focus-visible {
  outline: 3px solid var(--brand-aqua-hover);
  outline-offset: 3px;
}

/* Prev / Next labels */
.nav-links .prev,
.nav-links .next {
  padding: 0 20px;
}


/* ─────────────────────────────────────────────────────────────────────────
   10. NO-RESULTS & SEARCH RESULTS
   ───────────────────────────────────────────────────────────────────────── */

.no-results {
  padding: var(--space-md) 0;
}

.no-results h2 {
  margin-bottom: 12px;
}

/* Constrain the no-results block inside the grid */
.library-posts .no-results {
  grid-column: 1 / -1;
}


/* ─────────────────────────────────────────────────────────────────────────
   11. RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */

/* ── Narrow tablet: 600–859px ─────────────────────────────────────── */
@media (min-width: 600px) and (max-width: 859px) {

  .library-hero-copy h1 {
    font-size: clamp(1.9rem, 4vw, 2.6rem);
  }
}

/* ── Mobile: below 580px ─────────────────────────────────────────── */
@media (max-width: 579px) {

  .library-hero-copy h1 {
    font-size: clamp(1.8rem, 8vw, 2.4rem);
  }

  .library-hero-actions {
    flex-direction: column;
  }

  .library-hero-actions .btn {
    width: 100%;
    text-align: center;
  }

  .topics-grid {
    gap: 10px;
  }

  .topic-card {
    padding: 12px 16px;
  }
}
