@import url("https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700;800;900&display=swap&subset=hebrew");

/* המשתנים; accent וגופן מוחלשים ב-inline מההגדרות/גוף */
:root {
  --ap-primary:        #1a1a2e;
  --ap-primary-light:  #16213e;
  --ap-accent:         #e94560;
  --ap-accent-hover:   #c73652;
  --ap-white:          #ffffff;
  --ap-bg:             #f8f9fa;
  --ap-surface:        #ffffff;
  --ap-border:         #e9ecef;
  --ap-shadow-sm:      0 2px 8px rgba(0,0,0,0.06);
  --ap-shadow-md:      0 8px 32px rgba(0,0,0,0.12);
  --ap-shadow-lg:      0 20px 60px rgba(0,0,0,0.18);
  --ap-font:           "Heebo", "Assistant", Arial, sans-serif;
  --ap-text-dark:      #1a1a2e;
  --ap-text-body:      #4a4a6a;
  --ap-text-muted:     #8892a4;
  --ap-radius-sm:      6px;
  --ap-radius-md:      12px;
  --ap-radius-lg:      20px;
  --ap-radius-full:    999px;
  --ap-transition:     0.3s ease;
  --ap-transition-slow:0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.ap-articles-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0;
  font-family: var(--ap-font);
  direction: rtl;
}

/* Feed + כניסה לתצוגה (IntersectionObserver) */
.ap-article-item {
  display: flex;
  flex-direction: row-reverse;
  gap: 28px;
  padding: 32px 0;
  border-bottom: 1px solid var(--ap-border);
  cursor: pointer;
  transition: transform var(--ap-transition);
  background: transparent;
}

.ap-article-item.ap-io-item { opacity: 0; transform: translateY(24px); }
.ap-article-item.ap-io-item.is-inview {
  animation: apFadeUp 0.5s ease forwards;
}
.ap-article-item.ap-io-item.is-inview:nth-of-type(1) { animation-delay: 0.05s; }
.ap-article-item.ap-io-item.is-inview:nth-of-type(2) { animation-delay: 0.12s; }
.ap-article-item.ap-io-item.is-inview:nth-of-type(3) { animation-delay: 0.19s; }
.ap-article-item.ap-io-item.is-inview:nth-of-type(4) { animation-delay: 0.26s; }
.ap-article-item.ap-io-item.is-inview:nth-of-type(5) { animation-delay: 0.33s; }
.ap-article-item.ap-io-item.is-inview:nth-of-type(6) { animation-delay: 0.4s; }
.ap-article-item.ap-io-item.is-inview:nth-of-type(7) { animation-delay: 0.47s; }
.ap-article-item.ap-io-item.is-inview:nth-of-type(8) { animation-delay: 0.54s; }
.ap-grid-wrap .ap-article-item.ap-io-item { opacity: 0; }
.ap-grid-wrap .ap-article-item.ap-io-item.is-inview { animation: apFadeUp 0.5s ease forwards; }

.ap-article-item:hover {
  transform: translateX(-4px);
}

.ap-article-item:hover .ap-article-title { color: var(--ap-accent); }
.ap-article-item:hover .ap-article-image-wrap img { transform: scale(1.05); }
.ap-article-image-wrap { position: relative; flex-shrink: 0; width: 220px; height: 155px; border-radius: var(--ap-radius-md); overflow: hidden; }
.ap-article-hero .ap-article-hero-image,
.ap-magazine-hero .ap-article-hero-image { width: 100% !important; max-width: none; height: 400px; border-radius: var(--ap-radius-md); }
.ap-article-hero { flex-direction: column; border-bottom: 1px solid var(--ap-border); padding: 0 0 32px; }

.ap-magazine-hero { flex-direction: column; }
.ap-article-hero .ap-article-hero-image,
.ap-magazine-hero .ap-article-hero-image { height: 400px; width: 100% !important; }
.ap-article-hero .ap-article-hero-image img { width: 100% !important; height: 100% !important; }
.ap-mag-hero-title { font-size: 32px !important; }
.ap-mag-row { display: flex; flex-wrap: wrap; gap: 24px; width: 100%; margin: 0 auto 0; }
.ap-mag-left, .ap-mag-right { flex: 1 1 45%; min-width: 280px; }
.ap-magazine-item { flex-direction: row-reverse; padding: 16px 0; }
.ap-magazine-item .ap-article-image-wrap { width: 120px; height: 80px; }

.ap-article-image-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.ap-badge {
  position: absolute; top: 10px; right: 10px;
  background: var(--ap-accent); color: var(--ap-white);
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: var(--ap-radius-full);
  letter-spacing: 0.5px; text-transform: uppercase; z-index: 2;
}
.ap-badge:empty { display: none; }
.ap-article-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.ap-article-meta-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ap-category-tag {
  background: rgba(233, 69, 96, 0.1); color: var(--ap-accent);
  font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: var(--ap-radius-full); letter-spacing: 0.3px;
}
.ap-date { font-size: 13px; color: var(--ap-text-muted); font-weight: 400; }
.ap-dot { color: var(--ap-border); font-size: 16px; }
.ap-article-title {
  font-size: 21px; font-weight: 800; line-height: 1.3; color: var(--ap-text-dark); margin: 0;
  transition: color var(--ap-transition);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ap-article-excerpt {
  font-size: 15px; line-height: 1.65; color: var(--ap-text-body); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ap-article-meta-bottom { display: flex; align-items: center; justify-content: flex-start; margin-top: 4px; }
.ap-author { font-size: 13px; color: var(--ap-text-muted); font-weight: 500; }

/* Grid */
.ap-grid-wrap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; max-width: 1100px; margin: 0 auto; }
.ap-grid-body { position: relative; }
.ap-grid-card { background: var(--ap-surface); box-shadow: var(--ap-shadow-sm); border-radius: var(--ap-radius-md); border: 1px solid var(--ap-border); overflow: hidden; cursor: pointer; transition: transform 0.25s ease, box-shadow 0.25s; }
.ap-grid-card:hover { transform: translateY(-2px); box-shadow: var(--ap-shadow-md); }
.ap-grid-card .ap-article-image-wrap { width: 100% !important; height: 200px !important; }
.ap-grid-card .ap-article-image-wrap { border-right: 3px solid var(--ap-accent) !important; }
.ap-grid-hero { display: block; width: 100% !important; height: 100% !important; object-fit: cover; transition: transform 0.6s; }
.ap-grid-card:hover .ap-grid-hero { transform: scale(1.04); }
.ap-grid-title { font-size: 18px; font-weight: 800; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Modal (מפרט) */
.ap-modal-overlay { position: fixed; inset: 0; background: rgba(10, 10, 20, 0.75);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  z-index: 99999; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden;
  transition: opacity var(--ap-transition-slow), visibility var(--ap-transition-slow);
  padding: 20px;
}
.ap-modal-overlay.is-open { opacity: 1; visibility: visible; }
.ap-modal-container {
  background: var(--ap-white); width: 100%; max-width: 780px; max-height: 90vh;
  border-radius: var(--ap-radius-lg); overflow-y: auto; overflow-x: hidden; position: relative;
  box-shadow: var(--ap-shadow-lg); transform: translateY(40px) scale(0.97);
  transition: transform var(--ap-transition-slow);
  direction: rtl; scrollbar-width: thin; scrollbar-color: var(--ap-border) transparent;
}
.ap-modal-overlay.is-open .ap-modal-container { transform: translateY(0) scale(1); }
.ap-modal-close {
  position: absolute; top: 16px; left: 16px; z-index: 10; width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,0.45); color: #fff; border: none; font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background var(--ap-transition);
}
.ap-modal-close:hover { background: var(--ap-accent); }
.ap-modal-hero { position: relative; width: 100%; height: 360px; overflow: hidden; }
.ap-modal-hero-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ap-modal-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(10, 10, 20, 0.05) 0%, rgba(10, 10, 20, 0.3) 40%, rgba(10, 10, 20, 0.85) 100%);
}
.ap-modal-hero-content { position: absolute; bottom: 0; right: 0; left: 0; padding: 28px 32px; display: flex; flex-direction: column; gap: 8px; }
.ap-modal-badge:empty { display: none; }
.ap-modal-badge {
  align-self: flex-start; background: var(--ap-accent); color: #fff; font-size: 11px; font-weight: 800;
  padding: 3px 12px; border-radius: var(--ap-radius-full); text-transform: uppercase; letter-spacing: 1px;
}
.ap-modal-category { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.75); text-transform: uppercase; letter-spacing: 1.5px; }
.ap-modal-title { font-size: 30px; font-weight: 900; line-height: 1.25; color: #fff; margin: 0; text-shadow: 0 2px 12px rgba(0,0,0,0.3); }
.ap-modal-subtitle { font-size: 17px; font-weight: 400; color: rgba(255,255,255,0.82); margin: 0; }
.ap-modal-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.ap-modal-meta span { font-size: 13px; color: rgba(255,255,255,0.72); font-weight: 500; }
.ap-modal-body { padding: 36px 40px 48px; }
.ap-modal-excerpt:empty { display: none; }
.ap-modal-excerpt { font-size: 18px; font-weight: 500; line-height: 1.7; color: var(--ap-text-body);
  border-right: 4px solid var(--ap-accent); padding-right: 18px; margin: 0 0 32px; font-style: italic; }
.ap-modal-content { font-size: 16px; line-height: 1.85; color: var(--ap-text-body); }
.ap-modal-content p   { margin: 0 0 20px; }
.ap-modal-content h2  { font-size:22px; font-weight:800; color:var(--ap-text-dark); margin:32px 0 12px; }
.ap-modal-content h3  { font-size:18px; font-weight:700; color:var(--ap-text-dark); margin:24px 0 10px; }
.ap-modal-content img { max-width:100%; border-radius:var(--ap-radius-md); margin:16px 0; }
.ap-modal-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--ap-border); }
.ap-modal-gallery img { width: 100%; height: 120px; object-fit: cover; border-radius: var(--ap-radius-sm); cursor: zoom-in; transition: transform var(--ap-transition), box-shadow var(--ap-transition); }
.ap-modal-gallery img:hover { transform: scale(1.03); box-shadow: var(--ap-shadow-md); }
.ap-ap-spinner { text-align: center; padding: 50px; font-size: 15px; color: var(--ap-text-muted); }

/* Lightbox */
.ap-lightbox-overlay { position: fixed; inset: 0; z-index: 200000; background: rgba(0,0,0,0.88);
  display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity 0.25s;
}
.ap-lightbox-overlay.is-open { opacity: 1; visibility: visible; }
.ap-lb-cell { max-width: 92vw; max-height: 88vh; }
.ap-lb-img { max-width: 100%; max-height: 88vh; object-fit: contain; border-radius: 4px; }
.ap-lb-close, .ap-lb-next, .ap-lb-prev { position: absolute; background: rgba(255,255,255,0.15); color: #fff; border: none; cursor: pointer; border-radius: 4px; padding: 6px 14px; z-index: 1; }
.ap-lb-close { top: 16px; right: 16px; }
.ap-lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.ap-lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.ap-lb-img { cursor: default; }

/* אנימציית fade */
@keyframes apFadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* רספונסיב */
@media (max-width: 768px) {
  .ap-article-item { flex-direction: column; }
  .ap-article-image-wrap { width: 100% !important; height: 200px !important; }
  .ap-article-title { font-size: 18px; }
  .ap-grid-wrap { grid-template-columns: 1fr; }
  .ap-mag-left, .ap-mag-right { flex: 1 1 100%; }
  .ap-modal-container { max-height: 95vh; border-radius: var(--ap-radius-md); }
  .ap-modal-hero { height: 260px; }
  .ap-modal-title { font-size: 22px; }
  .ap-modal-body { padding: 24px 20px 36px; }
  .ap-modal-gallery { grid-template-columns: repeat(2, 1fr); }
}

html.ap-modal-locked, body.ap-modal-locked { overflow: hidden; }
