/*
 * Gutenberg / WordPress Block Editor Styles
 * Scoped to .wp-content to avoid leaking into the rest of the site.
 *
 * Source files (compiled, no React needed):
 *   @wordpress/block-library@9.47.0/build-style/style.css  → wp-blocks.css
 *   @wordpress/block-library@9.47.0/build-style/theme.css  → wp-blocks-theme.css
 *
 * Usage: wrap rendered WordPress HTML in <div class="wp-content">…</div>
 */

/* ─── Base reset for block content ──────────────────────────────────────── */
.wp-content {
  line-height: 1.75;
  word-break: break-word;
}

.wp-content p {
  margin-bottom: 1.25em;
}

.wp-content h1,
.wp-content h2,
.wp-content h3,
.wp-content h4,
.wp-content h5,
.wp-content h6 {
  margin-top: 1.5em;
  margin-bottom: 0.6em;
  line-height: 1.3;
  font-weight: 700;
}

.wp-content h1 {
  font-size: 44px;
}
.wp-content h2 {
  font-size: 36px;
}
.wp-content h3 {
  font-size: 28px;
}
.wp-content h4 {
  font-size: 24px;
}
.wp-content h5 {
  font-size: 22px;
}
.wp-content h6 {
  font-size: 20px;
}

.wp-content ul,
.wp-content ol {
  padding-left: 1.75em;
  margin-bottom: 1.25em;
  list-style: initial;
}

.wp-content li {
  margin-bottom: 0.4em;
}

.wp-content blockquote {
  border-left: 4px solid #0045AB;
  margin: 1.5em 0;
  padding: 0.75em 1.25em;
  color: #555;
  font-style: italic;
}

.wp-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.wp-content a {
  color: var(--ilf-secondary-500);
  text-decoration: underline;
}

/* .wp-content a:hover {
  color: #44bae9;
} */

.wp-content figure {
  margin: 1.5em 0;
}

.wp-content figcaption {
  font-size: 0.875em;
  color: #666;
  text-align: center;
  margin-top: 1.5em;
}

.wp-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5em;
}

.wp-content th,
.wp-content td {
  padding: 0.6em 0.9em;
  border: 1px solid #ddd;
  text-align: start;
}

.wp-content th {
  background: #f4f6fa;
  font-weight: 700;
}

.wp-content hr {
  border: none;
  border-top: 2px solid #eee;
  margin: 2em 0;
}

.wp-content pre,
.wp-content code {
  background: #f4f6fa;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
}

.wp-content pre {
  padding: 1em;
  overflow-x: auto;
}

.wp-content code {
  padding: 0.15em 0.4em;
}

/* ─── Dark-mode overrides ────────────────────────────────────────────────── */
.dark-theme .wp-content blockquote {
  border-left-color: #44bae9;
  color: #ccc;
}

.dark-theme .wp-content th {
  background: #2a2a3a;
}

.dark-theme .wp-content th,
.dark-theme .wp-content td {
  border-color: #444;
}

.dark-theme .wp-content pre,
.dark-theme .wp-content code {
  background: #1e1e2e;
  color: #e0e0e0;
}

.dark-theme .wp-content hr {
  border-top-color: #444;
}

.dark-theme .wp-content figcaption {
  color: #aaa;
}

/* ─── RTL support (Persian) ──────────────────────────────────────────────── */
.lang-fa .wp-content {
  direction: rtl;
  text-align: right;
}

.lang-fa .wp-content ul,
.lang-fa .wp-content ol {
  padding-left: 0;
  padding-right: 1.75em;
}

.lang-fa .wp-content blockquote {
  border-left: none;
  border-right: 4px solid #0045AB;
  padding-left: 0;
  padding-right: 1.25em;
}

/* ─── WordPress block-specific helpers ───────────────────────────────────── */

/* Image alignment */
.wp-content .alignleft {
  float: left;
  margin: 0.5em 1.5em 1em 0;
}

.wp-content .alignright {
  float: right;
  margin: 0.5em 0 1em 1.5em;
}

.wp-content .aligncenter {
  /* display: block; */
  margin-left: auto;
  margin-right: auto;
}

.wp-content .alignfull {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.wp-content .alignwide {
  width: calc(100% + 4rem);
  margin-left: -2rem;
  margin-right: -2rem;
}

/* Separator block */
.wp-content .wp-block-separator {
  border: none;
  border-top: 2px solid #eee;
  margin: 2em auto;
}

/* Quote block */
.wp-content .wp-block-quote {
  border-left: 4px solid #0045AB;
  margin: 1.5em 0;
  padding: 0.75em 1.25em;
}

.wp-content .wp-block-quote cite {
  display: block;
  font-size: 0.875em;
  color: #888;
  margin-top: 0.5em;
}

/* Pullquote */
.wp-content .wp-block-pullquote {
  border-top: 4px solid #0045AB;
  border-bottom: 4px solid #0045AB;
  text-align: center;
  padding: 1.5em;
}

/* Cover block */
.wp-content .wp-block-cover {
  position: relative;
  background-size: cover;
  background-position: center;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

/* Columns block */
.wp-content .wp-block-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5em;
  margin-bottom: 1.5em;
}

.wp-content .wp-block-column {
  flex: 1 1 200px;
}

/* Media & text block */
.wp-content .wp-block-media-text {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5em;
  align-items: center;
  margin-bottom: 1.5em;
}

@media (max-width: 600px) {
  .wp-content .wp-block-media-text {
    grid-template-columns: 1fr;
  }

  .wp-content .alignleft,
  .wp-content .alignright {
    float: none;
    margin: 0 0 1em 0;
  }

  .wp-content .alignwide {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
}

/* Button block */
.wp-content .wp-block-button__link {
  display: inline-block;
  padding: 0.6em 1.4em;
  background: #0045AB;
  color: #fff !important;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s;
}

.wp-content .wp-block-button__link:hover {
  background: #44bae9;
  color: #fff !important;
}

/* Gallery block */
.wp-content .wp-block-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75em;
  margin-bottom: 1.5em;
}

.wp-content .wp-block-gallery .wp-block-image {
  flex: 1 1 200px;
}

/* Embed block */
.wp-content .wp-block-embed {
  margin-bottom: 1.5em;
}

.wp-content .wp-block-embed__wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
}

.wp-content .wp-block-embed__wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}