/* =====================================================
   MH Theme — Phase 151N.2.4 Legal Single Post TOC Parity
   Scope: locked Policy / Legal Page template + generated legal content only.
   Legal pages now use the real single-post article/TOC component classes;
   this file only owns legal metadata, generated clause cleanup, and small
   policy-specific readability hooks.
   ===================================================== */

.mht-policy-page {
  position: relative;
  --mht-policy-sticky-offset: calc(var(--nav-top-offset, 28px) + var(--nav-h, 64px) + clamp(12px, 1.4vw, 18px));
}

/* The article shell uses .mht-post-single__body / __body-inner in markup.
   Keep only legal-specific shell details here; article rhythm comes from
   assets/css/18__thinking.css and the shared TOC behavior from 45. */
.mht-policy-shell {
  width: var(--site-w, min(1120px, calc(100% - 24px)));
  max-width: var(--site-max, 1120px);
  margin-inline: auto;
}

.mht-policy-layout {
  width: 100%;
}

/* Compact meta rail: useful reference data, not a dashboard header. */
.mht-policy-intro {
  max-width: 72ch;
  margin: 0 auto clamp(24px, 4vw, 42px);
}

.mht-policy-page__article--has-toc .mht-policy-intro {
  max-width: none;
}

.mht-policy-meta-grid {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .56rem;
}

.mht-policy-meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .52rem;
  margin: 0;
  padding: .55rem .74rem;
  border: 1px solid rgba(221, 214, 227, .12);
  border-radius: 999px;
  background: rgba(246, 242, 247, .035);
  color: var(--text-secondary, #AFA4B8);
  font-family: var(--font-sans, "Blauer Nue", system-ui, sans-serif);
  font-size: .78rem;
  line-height: 1.25;
}

.mht-policy-meta__label {
  color: var(--text-muted, #7C7284);
}

.mht-policy-meta__value {
  color: var(--text-primary, #F6F2F7);
  font-weight: 700;
}

/* Draft notice remains editor-only in template PHP and must not become article content. */
.mht-policy-admin-notice {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .54rem;
  max-width: 72ch;
  margin: 0 0 clamp(20px, 3vw, 32px);
  padding: .68rem .86rem;
  border: 1px solid rgba(183, 140, 255, .20);
  border-radius: 999px;
  background: rgba(246, 242, 247, .04);
  color: var(--text-secondary, #DDD6E3);
  font-family: var(--font-sans, "Blauer Nue", system-ui, sans-serif);
  font-size: .82rem;
  line-height: 1.3;
}

.mht-policy-admin-notice strong {
  color: var(--text-primary, #F6F2F7);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Policy content uses the single-post prose system through .mht-post-single__content.
   These hooks keep generated legal sections publish-safe and article-like. */
.mht-policy-content {
  min-width: 0;
}

.mht-policy-content :where(h2, h3, h4) {
  scroll-margin-top: calc(var(--mht-policy-sticky-offset) + 18px);
}

.mht-policy-page .mht-legal-generated-content {
  display: block;
}

.mht-policy-page .mht-legal-generated-content > .mht-policy-section {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.mht-policy-page .mht-legal-generated-content > .mht-policy-section + .mht-policy-section {
  margin-top: clamp(2.1em, 4vw, 2.75em);
}

.mht-policy-page .mht-legal-generated-content > .mht-policy-section > *:first-child {
  margin-top: 0;
}

.mht-policy-page .mht-legal-generated-content > .mht-policy-section > *:last-child {
  margin-bottom: 0;
}

.mht-policy-page .mht-policy-section p strong {
  color: var(--text-primary, #F6F2F7);
  font-weight: 800;
}

/* Public safety: legacy builder warnings/placeholders must never read as legal content. */
.mht-policy-page .mht-legal-draft-notice,
.mht-policy-page .mht-policy-section--placeholder,
.mht-policy-page .mht-legal-builder-preview-note {
  display: none !important;
}

/* Business details stay structured, but they no longer dominate the page. */
.mht-policy-page .mht-legal-detail-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin: 1.25rem 0 0;
  border-top: 1px solid rgba(221, 214, 227, .11);
}

.mht-policy-page .mht-legal-detail-list__row {
  display: grid;
  grid-template-columns: minmax(130px, 190px) minmax(0, 1fr);
  gap: .8rem;
  padding: .74rem 0;
  border-bottom: 1px solid rgba(221, 214, 227, .11);
}

.mht-policy-page .mht-legal-detail-list dt {
  color: var(--text-muted, #7C7284);
  font-family: var(--font-sans, "Blauer Nue", system-ui, sans-serif);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .12em;
  line-height: 1.25;
  text-transform: uppercase;
}

.mht-policy-page .mht-legal-detail-list dd {
  margin: 0;
  color: var(--text-primary, #F6F2F7);
}

.mht-policy-content :where(table) {
  min-width: min(680px, 100%);
  overflow: hidden;
  border-radius: 16px;
  background: rgba(13, 13, 13, .18);
}

.mht-policy-content :where(.wp-block-table) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mht-policy-content :where(.wp-block-table table) {
  margin-bottom: 0;
}

/* Light mode: mirror the article system; only legal metadata/detail rows need overrides. */
html[data-mht-theme-effective="light"] .mht-policy-meta,
html[data-mht-theme="light"] .mht-policy-meta {
  border-color: rgba(142, 99, 163, .16);
  background: rgba(255, 255, 255, .62);
  color: rgba(47, 31, 58, .68);
}

html[data-mht-theme-effective="light"] .mht-policy-meta__label,
html[data-mht-theme="light"] .mht-policy-meta__label {
  color: rgba(76, 52, 93, .62);
}

html[data-mht-theme-effective="light"] .mht-policy-meta__value,
html[data-mht-theme="light"] .mht-policy-meta__value {
  color: #2F1F3A;
}

html[data-mht-theme-effective="light"] .mht-policy-admin-notice,
html[data-mht-theme="light"] .mht-policy-admin-notice {
  border-color: rgba(142, 99, 163, .20);
  background: rgba(255, 255, 255, .70);
  color: rgba(47, 31, 58, .78);
}

html[data-mht-theme-effective="light"] .mht-policy-admin-notice strong,
html[data-mht-theme="light"] .mht-policy-admin-notice strong,
html[data-mht-theme-effective="light"] .mht-policy-page .mht-policy-section p strong,
html[data-mht-theme="light"] .mht-policy-page .mht-policy-section p strong {
  color: #2F1F3A;
}

html[data-mht-theme-effective="light"] .mht-policy-page .mht-legal-detail-list,
html[data-mht-theme="light"] .mht-policy-page .mht-legal-detail-list {
  border-top-color: rgba(76, 52, 93, .12);
}

html[data-mht-theme-effective="light"] .mht-policy-page .mht-legal-detail-list__row,
html[data-mht-theme="light"] .mht-policy-page .mht-legal-detail-list__row {
  border-bottom-color: rgba(76, 52, 93, .12);
}

html[data-mht-theme-effective="light"] .mht-policy-page .mht-legal-detail-list dt,
html[data-mht-theme="light"] .mht-policy-page .mht-legal-detail-list dt {
  color: rgba(76, 52, 93, .62);
}

html[data-mht-theme-effective="light"] .mht-policy-page .mht-legal-detail-list dd,
html[data-mht-theme="light"] .mht-policy-page .mht-legal-detail-list dd {
  color: #2F1F3A;
}

html[data-mht-theme-effective="light"] .mht-policy-content :where(table),
html[data-mht-theme="light"] .mht-policy-content :where(table) {
  background: rgba(255, 255, 255, .58);
}

@media (max-width: 680px) {
  .mht-policy-meta-grid {
    align-items: stretch;
  }

  .mht-policy-meta {
    width: 100%;
    justify-content: space-between;
    border-radius: 18px;
  }

  .mht-policy-page .mht-legal-detail-list__row {
    grid-template-columns: minmax(0, 1fr);
    gap: .35rem;
  }
}
