/* Hybrid single v5: exact Elementor fidelity plus an independent editorial profile. */

:root {
  --td-single-max: 1160px;
  --td-single-main: 811px;
  --td-single-sidebar: 325px;
  --td-single-gap: 24px;
}

/*
 * Editorial mode owns its visual language, but uses the same audited horizontal
 * measure as template 15079. These scoped rules intentionally override the
 * obsolete 1420px / 390px prototype values in single-article.css.
 */
.td-single-style--editorial .td-single-layout {
  display: grid;
  width: min(calc(100% - 40px), var(--td-single-max));
  margin: 0 auto;
  padding: 24px 0 72px;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.td-single-style--editorial .td-single-layout:not(.has-toc) .td-single-main {
  width: min(100%, var(--td-single-main));
  margin-inline: auto;
}

.td-single-style--editorial .td-single-layout.has-toc {
  grid-template-columns: minmax(0, var(--td-single-main)) minmax(0, var(--td-single-sidebar));
  justify-content: center;
  gap: var(--td-single-gap);
}

/* Neutralize the old :not(.has-sidebar) rule when the real state is has-toc. */
.td-single-style--editorial .td-single-layout.has-toc .td-single-main {
  width: auto;
  min-width: 0;
  margin-inline: 0;
}

.td-single-style--editorial .td-single-sidebar {
  display: block;
  width: 100%;
  min-width: 0;
}

.td-single-style--editorial .td-single-sidebar.is-empty {
  display: none;
}

.td-single-style--editorial .td-single-sidebar > .tdrn,
.td-single-style--editorial .td-single-sidebar > [data-tdrn] {
  width: 100%;
  max-width: none;
  margin: 0;
}

.td-single-style--editorial .td-single-sidebar .tdrn__summary {
  min-width: 0;
}

.td-single-style--editorial .td-single-sidebar .tdrn__title {
  white-space: nowrap;
}

.td-single-style--editorial .td-single-sidebar .tdrn__link {
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

/*
 * Faithful mode deliberately restores the actual Theme Builder structure.
 * post-15079.css owns section width, column percentages, widget margins,
 * typography and mobile rules through the original Elementor IDs.
 */
.td-single-style--faithful .td-single-layout {
  display: block;
  width: 100%;
  margin: 1px 0;
  padding: 0;
}

.td-single-style--faithful .td-single-layout > .elementor-container {
  max-width: 1160px;
}

/*
 * The PHP template keeps semantic wrappers for maintainability. In faithful
 * mode they must not become extra flex items: Elementor widgets were direct
 * children of the original widget-wrap. display:contents restores that layout
 * tree while preserving the DOM hooks used by TDRN and tests.
 */
.td-single-style--faithful .td-single-hero,
.td-single-style--faithful .td-single-title-widget,
.td-single-style--faithful .td-single-faithful-post-info,
.td-single-style--faithful .td-single-excerpt-widget,
.td-single-style--faithful .td-single-content-widget {
  display: contents;
}

.td-single-style--faithful .td-single-footer {
  width: 100%;
}

/* The legacy template always owns both columns; reserve the rail before TDRN mounts. */
.td-single-style--faithful .td-single-sidebar.is-empty {
  display: flex;
}

/* Remove only child-theme spacing that does not exist in template 15079. */
.td-single-style--faithful .td-single-faithful-post-info,
.td-single-style--faithful .td-single-excerpt-widget,
.td-single-style--faithful .td-single-content-widget {
  margin-top: 0;
}

.td-single-style--faithful .td-single-excerpt-widget {
  max-width: none;
  padding-top: 0;
}

.td-single-style--faithful .td-single-excerpt-widget::before {
  display: none;
}

/* Elementor core uses a unit line-height and normal tracking for heading widgets. */
.td-single-style--faithful .td-single-title-widget .elementor-heading-title {
  line-height: 1;
  letter-spacing: normal;
}

/* WordPress fallbacks mirror the audited generated CSS when a Pro widget is absent. */
.td-single-style--faithful .td-single-title-widget > .entry-title {
  margin: 0 0 10px;
  color: var(--td-source-title-color, #000);
  font-family: Roboto, Arial, sans-serif;
  font-size: var(--td-source-title-size, 60px);
  font-weight: var(--td-source-title-weight, 600);
  line-height: 1;
  letter-spacing: normal;
  text-align: center;
}

.td-single-style--faithful .td-single-excerpt {
  margin: 30px 0;
  color: var(--td-source-excerpt-color, #54595f);
  font-size: var(--td-source-excerpt-size, 19px);
  font-weight: var(--td-source-excerpt-weight, 500);
  line-height: var(--td-source-excerpt-line-height, 1.8);
}

.td-single-style--faithful .td-single-content-widget {
  color: var(--td-source-content-color, #000);
  font-size: var(--td-source-content-size, 1.25rem);
  line-height: var(--td-source-content-line-height, 1.6);
}

.td-single-style--faithful .td-single-faithful-post-info {
  color: #54595f;
  font-size: 13px;
  text-align: center;
}

.td-single-style--faithful .td-single-faithful-post-info .elementor-icon-list-items,
.td-single-style--faithful .td-single-faithful-post-info .elementor-post-info {
  justify-content: center;
}

/* Editorial typography remains intentionally independent from the faithful contract. */
.td-single-style--editorial .td-single-title-widget .elementor-heading-title,
.td-single-style--editorial .td-single-title-widget .entry-title {
  color: #07172e;
  font-family: "Roboto Slab", Georgia, serif;
  font-size: 60px;
  font-weight: 400;
  line-height: 1.03;
  letter-spacing: -0.025em;
  text-align: left;
}

.td-single-style--editorial .td-single-excerpt-widget .elementor-widget-container,
.td-single-style--editorial .td-single-excerpt {
  color: var(--td-source-excerpt-color, #54595f);
  font-size: var(--td-source-excerpt-size, 19px);
  font-weight: var(--td-source-excerpt-weight, 500);
  line-height: var(--td-source-excerpt-line-height, 1.8);
}

.td-single-style--editorial .td-single-content-widget {
  color: #15191f;
  font-family: "Roboto Slab", Georgia, serif;
  font-size: 1.22rem;
  line-height: 1.72;
}

.td-single-native-share {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.td-single-native-share a,
.td-single-native-share button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #cfd5dc;
  background: #fff;
  color: #142544;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.td-single-native-share a:hover,
.td-single-native-share a:focus-visible,
.td-single-native-share button:hover,
.td-single-native-share button:focus-visible {
  border-color: var(--td-single-navy);
  outline: 2px solid transparent;
  background: var(--td-single-navy);
  color: #fff;
}

@media (max-width: 1199px) {
  .td-single-style--editorial .td-single-layout,
  .td-single-style--editorial .td-single-layout.has-toc {
    width: min(calc(100% - 40px), 920px);
    padding-top: 20px;
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .td-single-style--editorial .td-single-layout .td-single-main,
  .td-single-style--editorial .td-single-layout:not(.has-toc) .td-single-main,
  .td-single-style--editorial .td-single-layout.has-toc .td-single-main {
    width: 100%;
    margin-inline: 0;
  }

  .td-single-style--editorial .td-single-layout.has-toc .td-single-sidebar {
    grid-row: 1;
  }

  .td-single-style--editorial .td-single-layout.has-toc .td-single-main {
    grid-row: 2;
  }
}

@media (max-width: 767px) {
  .td-single-style--editorial .td-single-layout,
  .td-single-style--editorial .td-single-layout.has-toc {
    width: min(calc(100% - 28px), 680px);
    padding-top: 16px;
  }

  .td-single-style--editorial .td-single-title-widget .elementor-heading-title,
  .td-single-style--editorial .td-single-title-widget .entry-title {
    font-size: 34px;
    line-height: 1.08;
  }

  .td-single-style--faithful .td-single-title-widget .elementor-heading-title,
  .td-single-style--faithful .td-single-title-widget > .entry-title {
    font-size: var(--td-source-title-size-mobile, 33px);
  }

  .td-single-native-share {
    justify-content: flex-start;
  }
}
