/* Universal template normalization (moved from post.php inline styles) */

/* ✓ LAYER 1: UNIVERSAL CONTENT RESET & NORMALIZE
   Tüm templates için temel sıfırlama - spesifisitesi düşük
*/

:root {
  --post-padding: 0;
  --post-margin-collapse: 1;
  --section-gap: 24px;
  --h2-top-margin: 32px;
  --h2-bottom-margin: 16px;
  --h3-top-margin: 20px;
  --h3-bottom-margin: 12px;
  --p-bottom-margin: 16px;
  --blockquote-margin: 24px;
  --breadcrumb-height: 24px;
  --breadcrumb-gap: 8px;
}

/* ✓ Normalize breadcrumbs container - CRITICAL */
.breadcrumbs {
  display: block !important;
  width: 100% !important;
  position: relative !important;
  height: var(--breadcrumb-height) !important;
  line-height: var(--breadcrumb-height) !important;
  padding: 0 !important;
  margin: 0 0 4px 0 !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  color: #666 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* ✓ Breadcrumb links - consistent styling */
.breadcrumbs a {
  color: #666 !important;
  text-decoration: none !important;
  transition: color 0.2s ease !important;
}

.breadcrumbs a:hover {
  color: #333 !important;
  text-decoration: underline !important;
}

/* ✓ Breadcrumb separator - consistent */
.breadcrumbs > * {
  display: inline !important;
  vertical-align: middle !important;
}

/* ✓ Normalize article & content containers */
main article.post-article {
  padding-top: 0 !important;
  padding-left: max(40px, clamp(40px, 5vw, 80px)) !important;
  padding-right: max(40px, clamp(40px, 5vw, 80px)) !important;
  padding-bottom: max(40px, clamp(40px, 5vw, 80px)) !important;
}

.post-article h1 {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* ✓ Normalize post-main grid - CRITICAL */
.post-main {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 8px !important;
  align-items: start !important;
  padding: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

@media (min-width: 881px) {
  .post-main {
    grid-template-columns: 1fr 320px !important;
  }
}

/* ✓ Normalize post-content block margins and padding */
.post-content {
  background: transparent !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* ✓ Paragraph spacing normalization */
.post-content p {
  margin-top: 0 !important;
  margin-bottom: var(--p-bottom-margin) !important;
  line-height: 1.75 !important;
}

/* ✓ Heading vertical rhythm - Ensure consistent spacing */
.post-content h1 {
  margin-top: 0 !important;
  margin-bottom: var(--h2-bottom-margin) !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.post-content h2 {
  margin-top: var(--h2-top-margin) !important;
  margin-bottom: var(--h2-bottom-margin) !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.post-content h3 {
  margin-top: var(--h3-top-margin) !important;
  margin-bottom: var(--h3-bottom-margin) !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.post-content h4,
.post-content h5,
.post-content h6 {
  margin-top: 16px !important;
  margin-bottom: 8px !important;
  padding: 0 !important;
}

/* ✓ List items alignment */
.post-content ul,
.post-content ol {
  margin-top: 16px !important;
  margin-bottom: 16px !important;
  padding-left: 32px !important;
  clear: both;
}

.post-content li {
  margin-top: 6px !important;
  margin-bottom: 6px !important;
  word-break: break-word;
}

/* ✓ Blockquote normalization */
.post-content blockquote {
  margin-top: var(--blockquote-margin) !important;
  margin-bottom: var(--blockquote-margin) !important;
  padding-top: 16px !important;
  padding-bottom: 16px !important;
  padding-left: 20px !important;
  padding-right: 16px !important;
  clear: both;
  overflow: hidden;
}

/* ✓ Figure normalization */
.post-content figure {
  margin-top: 24px !important;
  margin-bottom: 24px !important;
  clear: both;
  display: block;
}

.post-content figure img {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  will-change: transform;
}

.post-content figcaption {
  margin-top: 8px !important;
  margin-bottom: 0 !important;
  padding: 8px 0 0 0 !important;
  position: relative !important;
  z-index: 101 !important;
}

/* ✓ Code blocks normalization */
.post-content code {
  word-break: break-word;
  overflow-wrap: break-word;
}

.post-content pre {
  margin-top: 16px !important;
  margin-bottom: 16px !important;
  overflow-x: auto;
  clear: both;
}

.post-content pre code {
  overflow-wrap: normal;
  word-break: normal;
}

/* ✓ LAYER 2: AUTHOR META ALIGNMENT (Kritik)
   Template'ler farklı layout kullanıyor - unified normalization
*/

.post-author-meta {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 16px !important;
  margin-top: 40px !important;
  margin-bottom: 40px !important;
  padding: 20px !important;
  grid-template-columns: unset !important;
  width: 100% !important;
  clear: both;
  overflow: visible;
}

/* Avatar consistency */
.header-author-avatar {
  width: 90px !important;
  height: 90px !important;
  border-radius: 8px !important;
  flex-shrink: 0 !important;
  object-fit: cover !important;
  display: block !important;
}

/* Author info container */
.author-meta {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  align-items: flex-start !important;
  text-align: left !important;
  flex: 1 !important;
  min-width: 0 !important;
}

/* Byline unified */
.byline {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
}

.byline-by {
  display: inline-block !important;
  margin: 0 !important;
  padding: 0 !important;
}

.author-name {
  margin: 0 !important;
  padding: 0 !important;
}

.meta-small {
  display: flex !important;
  gap: 12px !important;
  flex-wrap: wrap !important;
  width: 100% !important;
  align-items: center !important;
  margin: 4px 0 0 0 !important;
  padding: 0 !important;
}

.meta-published,
.meta-updated {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ✓ LAYER 3: RESPONSIVE BREAKPOINTS
   Tüm templates için mobile tutarlılığı
*/

@media (max-width: 768px) {
  main article.post-article {
    padding: clamp(20px, 4vw, 40px) !important;
  }

  .post-author-meta {
    flex-direction: row !important;
    gap: 12px !important;
    padding: 16px !important;
  }

  .header-author-avatar {
    width: 75px !important;
    height: 75px !important;
  }

  .post-content h2 {
    margin-top: 24px !important;
    font-size: 1.5rem !important;
  }

  .post-content h3 {
    margin-top: 16px !important;
    font-size: 1.2rem !important;
  }

  .post-content p {
    margin-bottom: 14px !important;
  }
}

@media (max-width: 480px) {
  main article.post-article {
    padding: clamp(16px, 3vw, 24px) !important;
  }

  .post-author-meta {
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  .author-meta {
    align-items: flex-start !important;
    text-align: left !important;
  }

  .header-author-avatar {
    width: 60px !important;
    height: 60px !important;
  }
}

/* ✓ LAYER 4: PRINT & ACCESSIBILITY
   Hacking attempts'e karşı sağlamlık
*/

@media print {
  main article.post-article {
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
  }

  .post-author-meta {
    break-inside: avoid;
  }
}

@media (prefers-reduced-motion: reduce) {
  .post-content figure img {
    will-change: auto;
    transition: none !important;
  }
}

/* Theme overrides (force weights) */
.post-intro, .post-intro *,
.post-conclusion, .post-conclusion *,
.slider-intro-p, .slider-intro-p *,
.slider-conclusion-p, .slider-conclusion-p * {
  font-weight: var(--theme-intro-conclusion-weight, 400) !important;
  font-style: var(--theme-intro-conclusion-style, italic) !important;
}

.post-content-h1, .post-content-h1 *,
main article.post-article h1.post-content-h1, main article.post-article h1.post-content-h1 * {
  font-weight: var(--theme-h1-weight, 700) !important;
  font-style: var(--theme-h1-style, normal) !important;
}

.post-content-h2, .post-content-h2 *,
main article.post-article h2.post-content-h2, main article.post-article h2.post-content-h2 *,
.slider-slide-h2, .slider-slide-h2 * {
  font-weight: var(--theme-h2-weight, 700) !important;
  font-style: var(--theme-h2-style, normal) !important;
}

.post-content-h3, .post-content-h3 *,
main article.post-article h3.post-content-h3, main article.post-article h3.post-content-h3 * {
  font-weight: var(--theme-h3-weight, 700) !important;
  font-style: var(--theme-h3-style, normal) !important;
}

.post-content-h4, .post-content-h4 *,
main article.post-article h4.post-content-h4, main article.post-article h4.post-content-h4 * {
  font-weight: var(--theme-h4-weight, 700) !important;
  font-style: var(--theme-h4-style, normal) !important;
}

.post-content figcaption, .post-content figcaption *,
.post-figure-caption, .post-figure-caption *,
.slider-slide-caption, .slider-slide-caption * {
  font-weight: var(--theme-image-caption-weight, 400) !important;
  font-style: var(--theme-image-caption-style, normal) !important;
}
