/* ==========================================================================
   OpenPress — Misc Components
   ========================================================================== */

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  transition: all var(--dur-fast) var(--ease-apple);
  white-space: nowrap;
}

.btn--primary {
  background: var(--color-text-primary);
  color: var(--color-bg);
}
.btn--primary:hover { opacity: 0.82; }

.btn--secondary {
  background: var(--color-surface);
  color: var(--color-text-primary);
}
.btn--secondary:hover { background: var(--color-surface-hover); }

.btn--full { width: 100%; }

/* ---- Search overlay ---- */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  visibility: hidden;
  pointer-events: none;
}
.search-overlay.is-open { visibility: visible; pointer-events: auto; }

.search-overlay__scrim {
  position: absolute;
  inset: 0;
  background: var(--overlay-scrim);
  opacity: 0;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: opacity var(--dur-base) var(--ease-apple);
}
.search-overlay.is-open .search-overlay__scrim { opacity: 1; }

.search-overlay__panel {
  position: relative;
  max-width: 680px;
  margin: 90px auto 0;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  opacity: 0;
  transform: translateY(-14px) scale(0.98);
  transition: all var(--dur-base) var(--ease-apple);
  max-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.search-overlay.is-open .search-overlay__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.search-overlay__input-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-divider);
}
.search-overlay__input-row svg { width: 20px; height: 20px; color: var(--color-text-tertiary); flex-shrink: 0; }

.search-overlay__input {
  flex: 1;
  border: none;
  background: none;
  font-size: 1.15rem;
  font-family: var(--font-display);
  outline: none;
}
.search-overlay__input::placeholder { color: var(--color-text-tertiary); }

.search-overlay__close {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  padding: 6px 10px;
  flex-shrink: 0;
}
.search-overlay__close:hover { color: var(--color-text-primary); }

.search-overlay__results {
  overflow-y: auto;
  padding: 8px;
}

.search-result {
  display: flex;
  gap: 14px;
  padding: 12px;
  border-radius: var(--radius-sm);
  align-items: center;
}
.search-result:hover { background: var(--color-surface); }

.search-result__thumb {
  width: 56px; height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--color-surface);
  flex-shrink: 0;
}

.search-result__title { font-weight: 600; font-size: 0.92rem; margin-bottom: 4px; line-height: 1.3; }
.search-result__cat { font-size: 0.76rem; color: var(--color-text-tertiary); }

.search-overlay__empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--color-text-tertiary);
  font-size: 0.92rem;
}

/* ---- Newsletter band ---- */
.newsletter {
  background: var(--color-text-primary);
  color: var(--color-bg);
  border-radius: var(--radius-lg);
  padding: clamp(36px, 6vw, 64px);
  margin: 0 auto;
  max-width: var(--container-max);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.newsletter__text { max-width: 480px; }
.newsletter__text .type-h2 { color: var(--color-bg); margin-bottom: 10px; }
.newsletter__text p { color: rgba(255,255,255,0.7); font-size: 1rem; line-height: var(--lh-relaxed); }

html[data-theme="dark"] .newsletter__text p { color: rgba(0,0,0,0.6); }

.newsletter__form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 320px;
  flex: 1;
}

.newsletter__input {
  flex: 1;
  min-width: 200px;
  padding: 14px 18px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.12);
  color: var(--color-bg);
  outline: none;
  font-size: 0.92rem;
}
html[data-theme="dark"] .newsletter__input { background: rgba(0,0,0,0.08); color: var(--color-text-primary); }
.newsletter__input::placeholder { color: rgba(255,255,255,0.5); }
html[data-theme="dark"] .newsletter__input::placeholder { color: rgba(0,0,0,0.45); }

.newsletter__btn {
  padding: 14px 26px;
  border-radius: var(--radius-pill);
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-weight: 600;
  font-size: 0.92rem;
  flex-shrink: 0;
  transition: opacity var(--dur-fast) var(--ease-apple);
}
.newsletter__btn:hover { opacity: 0.85; }

.newsletter__note {
  width: 100%;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
  margin-top: 4px;
}
html[data-theme="dark"] .newsletter__note { color: rgba(0,0,0,0.45); }

.newsletter__success {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 600;
}
.newsletter__success svg { width: 18px; height: 18px; }

/* ---- Back to top ---- */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--color-text-primary);
  color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-elevated);
  z-index: 500;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all var(--dur-fast) var(--ease-apple);
}
.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top svg { width: 18px; height: 18px; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-text-primary);
  color: var(--color-bg);
  padding: 13px 22px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: all var(--dur-fast) var(--ease-apple);
  box-shadow: var(--shadow-elevated);
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast svg { width: 16px; height: 16px; }

/* ---- Page header (category / search / 404 pages) ---- */
.page-header {
  padding: calc(var(--nav-height) + 48px) 0 36px;
  border-bottom: 1px solid var(--color-divider);
  margin-bottom: 44px;
}
.page-header__eyebrow { margin-bottom: 14px; }
.page-header__title { margin-bottom: 12px; }
.page-header__desc { max-width: 56ch; }

/* ---- 404 ---- */
.not-found {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(var(--nav-height) + 40px) 20px 60px;
}
.not-found__code {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(4rem, 14vw, 8rem);
  line-height: 1;
  letter-spacing: var(--ls-tight);
  margin-bottom: 8px;
}
.not-found__title { margin-bottom: 14px; }
.not-found__desc { margin-bottom: 28px; max-width: 44ch; margin-inline: auto; }

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
}
.pagination__btn {
  min-width: 38px; height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  display: flex; align-items: center; justify-content: center;
}
.pagination__btn:hover { background: var(--color-surface); }
.pagination__btn.is-active { background: var(--color-text-primary); color: var(--color-bg); }
.pagination__btn[disabled] { opacity: 0.35; pointer-events: none; }
.pagination__btn svg { width: 15px; height: 15px; }

/* ---- Scroll reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease-apple), transform 0.7s var(--ease-apple);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 700px) {
  .newsletter { flex-direction: column; align-items: flex-start; }
  .newsletter__form { width: 100%; }
}
