/* ============================================================
   Lapita Blog Post Styles v4
   Brute-force Elementor template overrides + JS support.
   Hosted at: https://lapita-chatbot.vercel.app/wp/lapita-blog-styles.css
   ============================================================ */

/* ─── NUKE the awkward left-side "Date" column ──────────────
   Elementor often uses a 2-column layout on single posts with
   a thin left column containing post-info. We hide it AND force
   the right column to take full width.
*/
body.single-post .elementor-widget-post-info,
body.single-post [data-widget_type="post-info.default"],
body.single-post [data-widget_type*="post-info"],
body.single-post .elementor-post-info,
body.single-post .elementor-post__meta-data {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  position: absolute !important;
  pointer-events: none !important;
}

/* If left column has no other content after hiding post-info, collapse it */
body.single-post .elementor-column:has(.elementor-widget-post-info:only-child),
body.single-post .elementor-column:has([data-widget_type*="post-info"]:only-child) {
  display: none !important;
}

/* Two-column section → collapse so right column takes full width */
body.single-post .elementor-section.elementor-section-boxed > .elementor-container {
  display: flex !important;
  flex-direction: column !important;
}
body.single-post .elementor-section .elementor-column[data-element_type*="column"]:has([data-widget_type*="post-info"]) {
  display: none !important;
}

/* ─── Force ALL post titles out of UPPERCASE ────────────────
   The Elementor theme has text-transform: uppercase baked in
   on heading widgets. Override with maximum specificity.
*/
body.single-post .elementor-heading-title,
body.single-post h1,
body.single-post h2,
body.single-post h3,
body.single-post h1.entry-title,
body.single-post .entry-title,
body.single .post-title,
body.single .elementor-widget-theme-post-title,
body.single .elementor-widget-theme-post-title .elementor-heading-title,
body.single .elementor-widget-theme-post-title h1,
body.single .elementor-widget-theme-post-title h2,
body.single .elementor-widget-heading h1,
body.single .elementor-widget-heading h2 {
  text-transform: none !important;
  font-variant: normal !important;
  letter-spacing: normal !important;
}

/* ─── Body container width ───────────────────────────────── */
body.single-post .elementor-section-wrap > .elementor-section,
body.single-post .elementor-section .elementor-container {
  max-width: 100%;
}

/* Reading column — narrow, comfortable for long-form */
.single-post .entry-content,
.single-post .post-content,
.single .post .entry-content,
.elementor-widget-theme-post-content,
body.single .elementor-widget-theme-post-content > .elementor-widget-container {
  max-width: 720px !important;
  margin: 0 auto !important;
  font-family: 'Charter', 'Georgia', 'New York', -apple-system, BlinkMacSystemFont, serif;
  font-size: 1.1rem;
  line-height: 1.7;
  color: #1f2937;
  letter-spacing: -0.003em;
}

/* ─── Page header title (BIG title above featured image) ── */
/* Force out of uppercase, sentence case, refined typography */
body.single-post h1.entry-title,
body.single-post .entry-title,
body.single .post-title,
body.single h1.elementor-heading-title,
body.single .elementor-widget-theme-post-title h1,
body.single .elementor-widget-theme-post-title .elementor-heading-title,
body.single-post .elementor-widget-theme-post-title .elementor-heading-title {
  text-transform: none !important;
  font-size: clamp(2rem, 4.5vw, 3rem) !important;
  font-weight: 700 !important;
  line-height: 1.15 !important;
  margin: 1.5rem auto 1rem !important;
  letter-spacing: -0.025em !important;
  color: #0f172a !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif !important;
  max-width: 720px !important;
  text-align: left !important;
}

/* ─── Hide the AWKWARD left-side DATE column ─────────────── */
/* Elementor often puts post info on the left as a column */
body.single-post .elementor-widget-post-info,
body.single-post .elementor-post-info,
body.single .elementor-post__meta-data,
body.single-post .post-info-vertical,
body.single-post [class*="post-info"][class*="vertical"],
body.single-post .elementor-widget-post-info[data-widget_type="post-info.default"]:not(.lapita-meta) {
  display: none !important;
}

/* ─── New: clean horizontal meta line right under image ─── */
/* Generated by PHP loader (.lapita-meta-line) */
.lapita-meta-line {
  max-width: 720px;
  margin: 1.5rem auto 2.5rem !important;
  padding: 0.85rem 0;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.85rem;
  color: #6b7280;
  align-items: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.lapita-meta-line .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.lapita-meta-line .meta-item.cat a {
  background: #eff6ff;
  color: #1e40af;
  padding: 0.2rem 0.65rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.lapita-meta-line .meta-item.cat a:hover {
  background: #dbeafe;
}
.lapita-meta-line .meta-dot { color: #d1d5db; }

/* ─── Featured image ─────────────────────────────────────── */
body.single-post .elementor-widget-theme-post-featured-image img,
body.single-post .post-thumbnail img,
body.single-post .wp-post-image {
  border-radius: 12px !important;
  max-width: 720px !important;
  height: auto;
  margin: 0 auto 1rem !important;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  display: block;
}

/* ─── Hide AI metadata leaks in old posts ────────────────── */
.single-post .entry-content > p:first-child:has(strong:first-child:contains("Featured Image")),
.single-post .entry-content p:where([data-leak]) {
  display: none !important;
}

/* JS-tagged AI-meta paragraphs (added by PHP loader) */
.lapita-ai-meta {
  display: none !important;
}

/* ─── Hide duplicate H1 inside entry-content ──────────────── */
/* WordPress page header shows the title, so the AI-generated <h1>
   at the start of the article body is redundant. */
.single-post .entry-content > h1:first-child,
.elementor-widget-theme-post-content > .elementor-widget-container > h1:first-child {
  display: none !important;
}

/* ─── Article body typography ────────────────────────────── */
.single-post .entry-content p,
.elementor-widget-theme-post-content p {
  margin: 0 0 1.4rem !important;
  font-size: 1.1rem;
  line-height: 1.7;
}

/* Drop-cap on first paragraph (subtle) */
.single-post .entry-content > p:first-of-type::first-letter,
.elementor-widget-theme-post-content > .elementor-widget-container > p:first-of-type::first-letter {
  font-size: 3.5rem;
  font-weight: 700;
  float: left;
  line-height: 1;
  margin: 0.1rem 0.5rem -0.1rem 0;
  color: #0077b6;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ─── Headings inside content ────────────────────────────── */
.single-post .entry-content h2,
.elementor-widget-theme-post-content h2 {
  font-size: 1.65rem !important;
  font-weight: 700 !important;
  margin: 2.75rem 0 1rem !important;
  color: #0f172a !important;
  letter-spacing: -0.015em;
  line-height: 1.3 !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

.single-post .entry-content h3,
.elementor-widget-theme-post-content h3 {
  font-size: 1.3rem !important;
  font-weight: 600 !important;
  margin: 2rem 0 0.75rem !important;
  color: #1e293b !important;
  line-height: 1.35 !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

.single-post .entry-content h4,
.elementor-widget-theme-post-content h4 {
  font-size: 1.1rem !important;
  font-weight: 600 !important;
  margin: 1.5rem 0 0.5rem !important;
  color: #1f2937 !important;
}

/* ─── Lists ──────────────────────────────────────────────── */
.single-post .entry-content ul,
.single-post .entry-content ol,
.elementor-widget-theme-post-content ul,
.elementor-widget-theme-post-content ol {
  padding-left: 1.5rem !important;
  margin: 1rem 0 1.6rem !important;
  list-style-position: outside !important;
}
.single-post .entry-content ul { list-style-type: disc !important; }
.single-post .entry-content ol { list-style-type: decimal !important; }
.single-post .entry-content li,
.elementor-widget-theme-post-content li {
  margin-bottom: 0.6rem !important;
  padding-left: 0.25rem;
  line-height: 1.7;
}
.single-post .entry-content li::marker {
  color: #0077b6 !important;
  font-weight: 700;
}

/* ─── Links ──────────────────────────────────────────────── */
.single-post .entry-content a,
.elementor-widget-theme-post-content a {
  color: #0077b6 !important;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  font-weight: 500;
  transition: color 0.15s;
}
.single-post .entry-content a:hover {
  color: #00b4d8 !important;
  text-decoration-thickness: 2px;
}

/* ─── Strong / em ────────────────────────────────────────── */
.single-post .entry-content strong,
.single-post .entry-content b {
  font-weight: 700;
  color: #0f172a;
}
.single-post .entry-content em,
.single-post .entry-content i { font-style: italic; }

/* ─── Blockquotes ────────────────────────────────────────── */
.single-post .entry-content blockquote,
.elementor-widget-theme-post-content blockquote {
  border-left: 4px solid #00b4d8 !important;
  background: #f0f9ff;
  padding: 1rem 1.5rem !important;
  margin: 1.75rem 0 !important;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: #1e3a8a;
  font-size: 1.1rem;
  line-height: 1.6;
}
.single-post .entry-content blockquote p { margin: 0 !important; }

/* ─── Inline images ──────────────────────────────────────── */
.single-post .entry-content img,
.elementor-widget-theme-post-content img {
  border-radius: 10px;
  margin: 1.75rem 0;
  max-width: 100%;
  height: auto;
}
.single-post .entry-content figure { margin: 1.5rem 0 !important; }
.single-post .entry-content figcaption {
  text-align: center;
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 0.5rem;
  font-style: italic;
}

/* ─── Code / pre ─────────────────────────────────────────── */
.single-post .entry-content code {
  background: #f3f4f6;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.9em;
  color: #be185d;
}
.single-post .entry-content pre {
  background: #1f2937;
  color: #e5e7eb;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.9rem;
  margin: 1.5rem 0;
}

/* ─── Tables ─────────────────────────────────────────────── */
.single-post .entry-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.single-post .entry-content table th,
.single-post .entry-content table td {
  padding: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}
.single-post .entry-content table th {
  background: #f9fafb;
  font-weight: 600;
  color: #0f172a;
}

/* ─── Prev/Next nav — clean centred ──────────────────────── */
.post-navigation,
body.single-post .post-navigation,
body.single-post .nav-links {
  max-width: 720px !important;
  margin: 4rem auto 2rem !important;
  padding: 1.5rem 0 0 !important;
  border-top: 1px solid #e5e7eb !important;
  display: flex !important;
  justify-content: space-between !important;
  gap: 1rem;
}
.post-navigation .nav-previous a,
.post-navigation .nav-next a {
  color: #0f172a !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: all 0.15s;
  display: inline-block;
}
.post-navigation .nav-previous a:hover,
.post-navigation .nav-next a:hover {
  border-color: #0077b6 !important;
  color: #0077b6 !important;
  background: #f9fafb;
}
.post-navigation .nav-previous a::before { content: "← "; opacity: 0.6; }
.post-navigation .nav-next a::after { content: " →"; opacity: 0.6; }

/* ─── "More Articles" / related posts section ────────────── */
body.single-post .elementor-widget-loop-grid,
body.single-post .related-posts,
body.single-post [class*="related"],
body.single-post [class*="more-articles"] {
  background: #f9fafb;
  padding: 3rem 0 !important;
  margin-top: 4rem !important;
  border-top: 1px solid #e5e7eb;
}

/* Section heading "MORE ARTICLES" — bigger, less awkward */
body.single-post .elementor-widget-heading h2,
body.single-post .related-posts-title,
body.single-post .more-articles-title {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  text-transform: none !important;
  letter-spacing: -0.02em !important;
  margin-bottom: 2rem !important;
  text-align: center !important;
  padding-left: 0 !important;
  border-left: none !important;
}

/* Related post cards — uniform grid */
body.single-post .elementor-loop-container,
body.single-post .related-posts-list {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  gap: 1.5rem !important;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
body.single-post .elementor-loop-container > article,
body.single-post .related-post-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: transform 0.2s, box-shadow 0.2s;
}
body.single-post .elementor-loop-container > article:hover,
body.single-post .related-post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Card image */
body.single-post .elementor-loop-container .elementor-widget-theme-post-featured-image img,
body.single-post .related-post-card img {
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  width: 100%;
  height: 200px;
  object-fit: cover;
  max-width: none !important;
}

/* Card title */
body.single-post .elementor-loop-container .elementor-widget-theme-post-title h2,
body.single-post .related-post-card h3 {
  font-size: 1.05rem !important;
  font-weight: 600 !important;
  line-height: 1.35 !important;
  margin: 1rem 1.25rem 0.5rem !important;
  color: #0f172a !important;
  text-transform: none !important;
  letter-spacing: -0.015em !important;
  border-bottom: none !important;
  padding-bottom: 0 !important;
  text-align: left !important;
}

/* Card date — moved to under image, small grey */
body.single-post .elementor-loop-container .elementor-widget-post-info,
body.single-post .related-post-card .date {
  font-size: 0.78rem !important;
  color: #6b7280 !important;
  margin: 0 1.25rem 1rem !important;
  padding: 0 !important;
  text-align: left !important;
}

/* Remove huge gaps */
body.single-post .elementor-section-stretched,
body.single-post .elementor-section > .elementor-container {
  padding-top: 1rem !important;
  padding-bottom: 1rem !important;
}

/* ─── Footer area cleanup ────────────────────────────────── */
body.single-post .elementor-widget-divider {
  margin: 2rem 0 !important;
}

/* ─── Reading progress bar (added by JS in loader) ───────── */
.lapita-progress {
  position: fixed; top: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, #0077b6, #00b4d8);
  z-index: 9999;
  width: 0%;
  transition: width 0.1s linear;
}

/* ─── Mobile ─────────────────────────────────────────────── */
@media (max-width: 720px) {
  .single-post .entry-content,
  .elementor-widget-theme-post-content {
    font-size: 1.05rem;
    line-height: 1.65;
    padding: 0 1rem;
  }
  .single-post .entry-content h2,
  .elementor-widget-theme-post-content h2 {
    font-size: 1.35rem !important;
    margin: 2rem 0 0.75rem !important;
  }
  .single-post .entry-content h3,
  .elementor-widget-theme-post-content h3 {
    font-size: 1.15rem !important;
  }
  body.single-post h1.entry-title,
  body.single-post .entry-title {
    font-size: 1.75rem !important;
    padding: 0 1rem;
  }
  .lapita-meta-line {
    padding: 0.75rem 1rem;
    font-size: 0.78rem;
    gap: 0.85rem;
  }
  .single-post .entry-content > p:first-of-type::first-letter {
    font-size: 2.8rem;
  }
  .post-navigation {
    flex-direction: column;
    padding: 1.5rem 1rem 0 !important;
  }
}

@media print {
  .post-navigation, .related-posts, .lapita-meta-line,
  nav, header, footer, .lapita-progress {
    display: none !important;
  }
}
