/*
 * TehranWeb English Single Post — Hero Layout Fix v2.0
 * November 2026
 * Append this stylesheet to the END of the active theme file:
 * wp-content/themes/tehranweb-1.9.0/assets/dist/css/single-article-en.css
 *
 * This deliberately targets the ACTUAL body/hero markup, not a nonexistent
 * .twref-article-page descendant or a nonexistent .twref-hero__inner.
 * Only English single-post pages receive the parent CSS file.
 * No PHP / JS / fonts / requests added.
 */

/* Consistent English text without downloading new webfonts. */
body.single-post.twref-article-page .twref-page {
  direction: ltr !important;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif !important;
  font-synthesis: none;
}

/* The reference CSS forces 348px maximum height and clips longer English copy. */
@media (min-width: 821px) {
  body.single-post.twref-article-page .twref-page .twref-hero--reference {
    display: grid !important;
    grid-template-columns: minmax(0, 45%) minmax(0, 55%) !important;
    direction: ltr !important;
    height: auto !important;
    min-height: 475px !important;
    max-height: none !important;
    align-items: stretch !important;
    overflow: hidden !important;
    isolation: isolate;
  }
  body.single-post.twref-article-page .twref-page .twref-hero__copy {
    grid-column: 1 !important;
    grid-row: 1 !important;
    position: relative !important;
    z-index: 4 !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 475px !important;
    max-height: none !important;
    padding: 28px 30px 32px clamp(22px, 2.7vw, 48px) !important;
    margin: 0 !important;
    overflow: visible !important;
    direction: ltr !important;
    text-align: left !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: center !important;
  }
  body.single-post.twref-article-page .twref-page .twref-hero__media {
    grid-column: 2 !important;
    grid-row: 1 !important;
    position: relative !important;
    z-index: 1 !important;
    min-width: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 475px !important;
    max-height: none !important;
    align-self: stretch !important;
    overflow: hidden !important;
  }
  body.single-post.twref-article-page .twref-page .twref-hero__media img {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center !important;
    border-radius: 0 !important;
  }
  body.single-post.twref-article-page .twref-page .twref-hero--reference::before {
    background: linear-gradient(90deg, #06172d 0%, #06172d 35%, rgba(6,23,45,.88) 45%, rgba(6,23,45,.05) 67%, transparent 78%) !important;
    z-index: 2 !important;
  }
  body.single-post.twref-article-page .twref-page .twref-hero__media::after {
    background: linear-gradient(90deg, #06172d 0%, rgba(6,23,45,0) 100%) !important;
    inset-inline-start: -1px !important;
    inset-inline-end: auto !important;
    width: 22% !important;
  }
}

/* Fix the real collision: an absolutely positioned breadcrumb and a tag pill.
   Both now participate in normal flex layout and cannot overlap. */
body.single-post.twref-article-page .twref-page .twref-breadcrumbs--hero {
  position: static !important;
  inset: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  display: flex !important;
  flex: 0 0 auto !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  align-self: stretch !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 18px !important;
  max-height: none !important;
  margin: 0 0 15px !important;
  padding: 0 !important;
  gap: 7px !important;
  direction: ltr !important;
  text-align: left !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  font-size: 11.5px !important;
  line-height: 1.6 !important;
}
body.single-post.twref-article-page .twref-page .twref-breadcrumbs--hero a,
body.single-post.twref-article-page .twref-page .twref-breadcrumbs--hero > span:not(.twref-breadcrumbs__current) {
  display: inline-block !important;
  flex: 0 0 auto !important;
  white-space: nowrap !important;
  max-width: none !important;
}
body.single-post.twref-article-page .twref-page .twref-breadcrumbs--hero .twref-breadcrumbs__current {
  display: block !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
body.single-post.twref-article-page .twref-page .twref-tags {
  display: flex !important;
  flex: 0 0 auto !important;
  justify-content: flex-start !important;
  align-items: center !important;
  align-self: flex-start !important;
  min-height: 25px !important;
  height: auto !important;
  margin: 0 0 13px !important;
  padding: 0 !important;
  direction: ltr !important;
  position: static !important;
}
body.single-post.twref-article-page .twref-page .twref-tags a {
  min-height: 25px !important;
  height: auto !important;
  padding: 4px 12px !important;
  font-size: 11px !important;
  line-height: 1.35 !important;
}

/* Title, excerpt and metadata each get their own natural height. */
body.single-post.twref-article-page .twref-page .twref-hero h1 {
  flex: 0 0 auto !important;
  width: 100% !important;
  max-width: none !important;
  max-height: none !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  color: #fff !important;
  font-family: inherit !important;
  font-size: clamp(28px, 2.3vw, 39px) !important;
  line-height: 1.2 !important;
  font-weight: 800 !important;
  letter-spacing: -.025em !important;
  direction: ltr !important;
  text-align: left !important;
  text-wrap: balance !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
}
body.single-post.twref-article-page .twref-page .twref-subtitle {
  flex: 0 0 auto !important;
  width: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 13px 0 0 !important;
  padding: 0 !important;
  display: block !important;
  overflow: visible !important;
  -webkit-line-clamp: unset !important;
  color: #d7e0ea !important;
  font-family: inherit !important;
  font-size: clamp(13px, .9vw, 15px) !important;
  line-height: 1.65 !important;
  font-weight: 400 !important;
  text-align: left !important;
  white-space: normal !important;
}
body.single-post.twref-article-page .twref-page .twref-meta--hero {
  display: grid !important;
  grid-template-columns: 1.32fr 1fr 1.06fr .82fr !important;
  align-items: stretch !important;
  width: 100% !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 72px !important;
  max-height: none !important;
  margin: 22px 0 0 !important;
  padding: 5px 6px !important;
  border: 1px solid #e3aa32 !important;
  border-radius: 10px !important;
  overflow: visible !important;
  direction: ltr !important;
  background: rgba(2, 15, 31, .88) !important;
}
body.single-post.twref-article-page .twref-page .twref-meta--hero > div {
  min-width: 0 !important;
  min-height: 62px !important;
  height: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  margin: 0 !important;
  padding: 8px 10px !important;
  overflow: visible !important;
  border-inline-start: 1px solid rgba(255,255,255,.13) !important;
  direction: ltr !important;
}
body.single-post.twref-article-page .twref-page .twref-meta--hero > div:first-child {
  border-inline-start: 0 !important;
}
body.single-post.twref-article-page .twref-page .twref-meta__icon {
  flex: 0 0 27px !important;
  width: 27px !important;
  height: 27px !important;
}
body.single-post.twref-article-page .twref-page .twref-meta--hero .twref-meta__text {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: center !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  gap: 4px !important;
  overflow: visible !important;
  white-space: normal !important;
  text-align: left !important;
  direction: ltr !important;
}
body.single-post.twref-article-page .twref-page .twref-meta--hero small,
body.single-post.twref-article-page .twref-page .twref-meta--hero strong {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  text-align: left !important;
  font-family: inherit !important;
}
body.single-post.twref-article-page .twref-page .twref-meta--hero small {
  color: #aebdd0 !important;
  font-size: 10px !important;
  line-height: 1.2 !important;
  font-weight: 500 !important;
}
body.single-post.twref-article-page .twref-page .twref-meta--hero strong {
  color: #fff !important;
  font-size: 11.5px !important;
  line-height: 1.4 !important;
  font-weight: 700 !important;
}

/* Narrow desktop / tablet: avoid cramming four metadata cells into 500px. */
@media (min-width: 821px) and (max-width: 1350px) {
  body.single-post.twref-article-page .twref-page .twref-hero--reference,
  body.single-post.twref-article-page .twref-page .twref-hero__copy,
  body.single-post.twref-article-page .twref-page .twref-hero__media {
    min-height: 540px !important;
  }
  body.single-post.twref-article-page .twref-page .twref-meta--hero {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  body.single-post.twref-article-page .twref-page .twref-meta--hero > div:nth-child(odd) {
    border-inline-start: 0 !important;
  }
  body.single-post.twref-article-page .twref-page .twref-meta--hero > div:nth-child(n+3) {
    border-top: 1px solid rgba(255,255,255,.13) !important;
  }
}

@media (max-width: 820px) {
  body.single-post.twref-article-page .twref-page .twref-hero--reference,
  body.single-post.twref-article-page .twref-page .twref-hero__copy {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  body.single-post.twref-article-page .twref-page .twref-hero__copy {
    padding: 22px 18px 23px !important;
    direction: ltr !important;
  }
  body.single-post.twref-article-page .twref-page .twref-hero h1 {
    font-size: clamp(26px, 6vw, 35px) !important;
  }
  body.single-post.twref-article-page .twref-page .twref-breadcrumbs--hero {
    font-size: 11px !important;
    margin-bottom: 12px !important;
  }
  body.single-post.twref-article-page .twref-page .twref-meta--hero {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    margin-top: 18px !important;
  }
  body.single-post.twref-article-page .twref-page .twref-meta--hero > div {
    padding: 8px !important;
  }
  body.single-post.twref-article-page .twref-page .twref-meta--hero > div:nth-child(odd) {
    border-inline-start: 0 !important;
  }
  body.single-post.twref-article-page .twref-page .twref-meta--hero > div:nth-child(n+3) {
    border-top: 1px solid rgba(255,255,255,.13) !important;
  }
}
@media (max-width: 480px) {
  body.single-post.twref-article-page .twref-page .twref-meta--hero {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  body.single-post.twref-article-page .twref-page .twref-meta--hero > div {
    border-inline-start: 0 !important;
    border-top: 1px solid rgba(255,255,255,.13) !important;
  }
  body.single-post.twref-article-page .twref-page .twref-meta--hero > div:first-child {
    border-top: 0 !important;
  }
}
