/* components.css — Reusable UI components */

/* ─── Buttons ──────────────────────────────────────────── */
.btn {
  display:        inline-flex;
  align-items:    center;
  gap:            0.4rem;
  font-family:    var(--font-ui);
  font-size:      var(--text-sm);
  font-weight:    600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding:        0.6rem 1.2rem;
  border:         1px solid transparent;
  cursor:         pointer;
  transition:     background 0.15s, color 0.15s, border-color 0.15s;
  border-radius:  0;
}

.btn-primary   { background: var(--ink);        color: var(--white);  border-color: var(--ink);       }
.btn-secondary { background: transparent;        color: var(--ink);   border-color: var(--ink);       }
.btn-red       { background: var(--accent-red);  color: var(--white);  border-color: var(--accent-red);}
.btn-ghost     { background: transparent;        color: var(--muted); border-color: var(--rule);      }

.btn-primary:hover   { background: #333;                  }
.btn-secondary:hover { background: var(--ink); color: var(--white); }
.btn-red:hover       { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost:hover     { border-color: var(--ink); color: var(--ink); }

.btn-sm { font-size: var(--text-xs); padding: 0.4rem 0.9rem; }
.btn-lg { font-size: var(--text-base); padding: 0.85rem 1.75rem; }

/* ─── Post Card ────────────────────────────────────────── */
.post-card {
  background: var(--card-bg);
  transition: box-shadow 0.2s;
}

.post-card:hover { box-shadow: var(--shadow-md); }

.post-card-img {
  width:       100%;
  aspect-ratio: 16/9;
  object-fit:  cover;
  display:     block;
}

.post-card-img-wrap {
  overflow:    hidden;
  margin-bottom: 0.9rem;
}

.post-card-img-wrap img {
  transition:  transform 0.35s ease;
}
.post-card:hover .post-card-img-wrap img { transform: scale(1.03); }

.post-card-category { margin-bottom: 0.5rem; display: block; }

.post-card-title {
  font-family:   var(--font-serif);
  font-size:     var(--text-xl);
  font-weight:   700;
  line-height:   1.25;
  margin-bottom: 0.5rem;
  color:         var(--ink);
}

.post-card-title a:hover { color: var(--accent-red); }

.post-card-excerpt {
  font-family:   var(--font-body);
  font-size:     var(--text-base);
  color:         var(--muted);
  line-height:   1.55;
  margin-bottom: 0.75rem;
  display:       -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow:      hidden;
}

.post-card-footer {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  font-family:     var(--font-ui);
  font-size:       var(--text-xs);
  color:           var(--muted);
  border-top:      1px solid var(--rule);
  padding-top:     0.6rem;
  margin-top:      0.75rem;
  gap:             0.5rem;
}

.view-count {
  display:     flex;
  align-items: center;
  gap:         0.3rem;
}

.view-count svg { width: 14px; height: 14px; }

/* ─── Hero Article ─────────────────────────────────────── */
.hero-article { position: relative; }

.hero-article-img {
  width:        100%;
  aspect-ratio: 4/3;
  object-fit:   cover;
  display:      block;
  margin-bottom: 1rem;
}

.hero-article-title {
  font-family:  var(--font-serif);
  font-size:    clamp(1.6rem, 2.5vw, 2.4rem);
  font-weight:  900;
  line-height:  1.15;
  margin:       0.6rem 0;
}

.hero-article-title a:hover { color: var(--accent-red); }

.hero-article-excerpt {
  font-size:    var(--text-base);
  color:        var(--muted);
  line-height:  1.6;
  margin-bottom: 1rem;
  display:      -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow:     hidden;
}

/* ─── Sidebar / Trending ───────────────────────────────── */
.trending-list { list-style: none; }

.trending-list li {
  display:        flex;
  gap:            0.75rem;
  padding:        0.9rem 0;
  border-bottom:  1px solid var(--rule);
}

.trending-list li:last-child { border-bottom: none; }

.trending-rank {
  font-family:  var(--font-serif);
  font-size:    var(--text-3xl);
  font-weight:  900;
  color:        var(--rule-dark);
  line-height:  1;
  flex-shrink:  0;
  min-width:    2rem;
}

.trending-title {
  font-family:  var(--font-serif);
  font-size:    var(--text-base);
  font-weight:  700;
  line-height:  1.3;
}

.trending-title a:hover { color: var(--accent-red); }

.trending-meta {
  font-family: var(--font-ui);
  font-size:   var(--text-xs);
  color:       var(--muted);
  margin-top:  0.25rem;
  display:     flex;
  align-items: center;
  gap:         0.3rem;
}

/* ─── Middle Column Story ──────────────────────────────── */
.mid-story {
  padding-bottom:  1.25rem;
  border-bottom:   1px solid var(--rule);
  display:         flex;
  gap:             1rem;
}

.mid-story:last-child { border-bottom: none; padding-bottom: 0; }

.mid-story-img {
  width:        110px;
  height:       80px;
  object-fit:   cover;
  flex-shrink:  0;
}

.mid-story-title {
  font-family:  var(--font-serif);
  font-size:    var(--text-lg);
  font-weight:  700;
  line-height:  1.25;
  margin:       0.3rem 0;
}

.mid-story-title a:hover { color: var(--accent-red); }

/* ─── Search Bar ───────────────────────────────────────── */
.search-bar {
  display:  flex;
  border:   1px solid var(--rule);
  overflow: hidden;
}

.search-bar input {
  flex:       1;
  padding:    0.5rem 0.9rem;
  border:     none;
  outline:    none;
  font-family: var(--font-ui);
  font-size:  var(--text-sm);
  background: var(--white);
}

.search-bar button {
  padding:     0.5rem 0.9rem;
  background:  var(--ink);
  color:       var(--white);
  border:      none;
  cursor:      pointer;
  transition:  background 0.15s;
}

.search-bar button:hover { background: #333; }

/* ─── Pagination ───────────────────────────────────────── */
.pagination {
  display:         flex;
  justify-content: center;
  align-items:     center;
  gap:             0.25rem;
  padding:         2rem 0;
}

.page-btn {
  min-width:    2.25rem;
  height:       2.25rem;
  display:      flex;
  align-items:  center;
  justify-content: center;
  font-family:  var(--font-ui);
  font-size:    var(--text-sm);
  border:       1px solid var(--rule);
  background:   var(--white);
  color:        var(--ink);
  transition:   background 0.15s, color 0.15s;
}

.page-btn:hover      { background: var(--ink); color: var(--white); }
.page-btn.active     { background: var(--accent-red); color: var(--white); border-color: var(--accent-red); }
.page-btn:disabled   { opacity: 0.4; cursor: not-allowed; }

/* ─── Loading Skeleton ─────────────────────────────────── */
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #e8e4d9 25%, #f5f2eb 50%, #e8e4d9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 2px;
}

.skeleton-text  { height: 1em; margin-bottom: 0.5em; }
.skeleton-img   { width: 100%; aspect-ratio: 16/9; }
.skeleton-title { height: 1.5em; width: 80%; }

/* ─── Toast Notification ───────────────────────────────── */
.toast-container {
  position:   fixed;
  bottom:     1.5rem;
  right:      1.5rem;
  z-index:    9999;
  display:    flex;
  flex-direction: column-reverse;
  gap:        0.5rem;
}

.toast {
  display:     flex;
  align-items: center;
  gap:         0.75rem;
  background:  var(--ink);
  color:       var(--white);
  padding:     0.85rem 1.2rem;
  font-family: var(--font-ui);
  font-size:   var(--text-sm);
  max-width:   320px;
  box-shadow:  var(--shadow-md);
  animation:   toastIn 0.25s ease;
}

.toast.success { border-left: 3px solid #22c55e; }
.toast.error   { border-left: 3px solid var(--accent-red); }
.toast.info    { border-left: 3px solid #3b82f6; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(1rem); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Push Notification Popup ─────────────────────────── */
.push-popup {
  position:      fixed;
  bottom:        24px;
  right:         24px;
  background:    var(--paper-dark);
  border:        1px solid var(--rule);
  border-radius: 8px;
  box-shadow:    0 10px 25px rgba(0, 0, 0, 0.15);
  padding:       1.25rem 1.5rem;
  width:         350px;
  max-width:     calc(100vw - 32px);
  z-index:       1000;
  display:       flex;
  flex-direction: column;
  gap:           1rem;
  font-family:   var(--font-ui);
  animation:     slideInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

.push-popup-content {
  display:     flex;
  gap:         0.75rem;
  align-items: flex-start;
}

.push-popup-icon {
  font-size:   1.5rem;
  line-height: 1;
}

.push-popup-text h4 {
  font-family: var(--font-serif);
  font-size:   var(--text-base);
  font-weight: 700;
  margin:      0 0 0.25rem 0;
  color:       var(--ink);
}

.push-popup-text p {
  margin:      0;
  font-size:   var(--text-xs);
  color:       var(--muted);
  line-height: 1.4;
}

.push-popup-close {
  position:    absolute;
  top:         8px;
  right:       8px;
  background:  none;
  border:      none;
  font-size:   0.8rem;
  color:       var(--muted);
  cursor:      pointer;
  padding:     4px;
  line-height: 1;
  border-radius: 4px;
  transition:  all 0.15s ease;
}

.push-popup-close:hover {
  color:      var(--ink);
  background: rgba(0, 0, 0, 0.05);
}

/* Adjust styles for mobile views */
@media (max-width: 480px) {
  .push-popup {
    bottom: 16px;
    right:  16px;
    left:   16px;
    width:  auto;
  }
}

/* ─── Modal Overlay ────────────────────────────────────── */
.modal-overlay {
  position:   fixed;
  inset:      0;
  background: rgba(0,0,0,0.5);
  z-index:    1000;
  display:    flex;
  align-items: center;
  justify-content: center;
  padding:    1rem;
}

.modal {
  background: var(--white);
  max-width:  480px;
  width:      100%;
  padding:    2rem;
  box-shadow: var(--shadow-md);
}

.modal h3 { margin-bottom: 1rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ─── Tag Pills ────────────────────────────────────────── */
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }

.tag {
  font-family:    var(--font-ui);
  font-size:      var(--text-xs);
  font-weight:    500;
  color:          var(--muted);
  border:         1px solid var(--rule);
  padding:        2px 10px;
  transition:     border-color 0.15s, color 0.15s;
}

.tag:hover { border-color: var(--ink); color: var(--ink); }

/* ─── Empty State ──────────────────────────────────────── */
.empty-state {
  text-align:  center;
  padding:     4rem 2rem;
  color:       var(--muted);
}

.empty-state svg { margin: 0 auto 1rem; opacity: 0.3; }
.empty-state h3  { font-family: var(--font-serif); color: var(--ink); margin-bottom: 0.5rem; }
.empty-state p   { font-size: var(--text-base); }

/* ─── Decorative HR ────────────────────────────────────── */
hr.rule       { border: none; border-top: 1px solid var(--rule); margin: 1.5rem 0; }
hr.rule-thick { border: none; border-top: 3px solid var(--ink);  margin: 1.5rem 0; }
hr.rule-ornament {
  border:       none;
  text-align:   center;
  margin:       2rem 0;
  color:        var(--muted);
  font-size:    1.2rem;
  letter-spacing: 0.8rem;
}
hr.rule-ornament::after { content: '✦ ✦ ✦'; }

/* ─── Share Buttons ─────────────────────────────────────── */
.share-bar {
  display:    flex;
  gap:        0.5rem;
  flex-wrap:  wrap;
  margin:     1.5rem 0;
}

.share-btn {
  display:    flex;
  align-items: center;
  gap:        0.4rem;
  padding:    0.5rem 1rem;
  font-family: var(--font-ui);
  font-size:  var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border:     1px solid var(--rule);
  color:      var(--muted);
  background: var(--white);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  cursor:     pointer;
}

.share-btn:hover { background: var(--ink); color: var(--white); border-color: var(--ink); }

/* ─── Responsive Video Embeds ────────────────────────────── */
.video-container {
  position:       relative;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height:         0;
  overflow:       hidden;
  margin:         1.5rem 0;
  background:     #000;
}

.video-container iframe {
  position:  absolute;
  top:       0;
  left:      0;
  width:     100% !important;
  height:    100% !important;
  border:    none;
}

iframe.ql-video {
  display:      block;
  aspect-ratio: 16 / 9;
  width:        100% !important;
  max-width:    100%;
  height:       auto !important;
  margin:       1.5rem 0;
  border:       none;
}

