/*
 * Teuvan spacing system — 2026-09-24.
 * Section padding: 64 / 40. Content chapters: 48 / 32.
 * Components: 32 / 24. Text: 16. Eyebrows: 12. Buttons: 24 with 12 gap.
 * Scope: main content only; navigation, forms and interactive widget internals
 * retain their own layout. Vertical margins have one owner (the later block).
 */
:root {
  --tvn-space-section: 64px;
  --tvn-space-chapter: 48px;
  --tvn-space-component: 32px;
  --tvn-space-card: 24px;
  --tvn-space-grid: 24px;
  --tvn-space-text: 16px;
  --tvn-space-label: 12px;
  --tvn-space-actions: 24px;
}

body.page:not(.home) .site-main > article > .entry-content:first-child:has(> :first-child:is(h1, .tvn-eyebrow)) {
  padding-top: var(--tvn-space-section);
}
.site-main .tvn-entry-content { padding-bottom: var(--tvn-space-section); }
.site-main .tvn-section { padding-block: var(--tvn-space-section); }
.site-main .entry-content > .tvn-home-opz { padding-block: var(--tvn-space-section); }
.site-main .tvn-entry-header { padding-block: var(--tvn-space-section) var(--tvn-space-component); }
.site-main .tvn-article-hero,
.site-main .tvn-product-hero,
.site-main .tvn-article-content { padding-block: var(--tvn-space-section); }
.site-main .tvn-section.tvn-application-models { padding-block: var(--tvn-space-chapter) 0; }

/* Reset only editorial blocks; never reset the children of a grid or form. */
.site-main :is(.entry-content, .tvn-section, .tvn-panel, .tvn-entry-header, .wp-block-column) > :where(h1,h2,h3,h4,p,ul,ol,figure,.wp-block-buttons,.tvn-actions,.tvn-grid,.tvn-panel,.wp-block-columns,.tvn-model-links,.tvn-document-list,.tvn-notice,.tvn-contact-form,.tvn-selector,.tvn-compare) {
  margin-block: 0;
}
.site-main :is(.entry-content, .tvn-section, .tvn-panel, .tvn-entry-header, .wp-block-column) > * + :where(h1,h2,h3,h4,p,ul,ol,figure,.wp-block-buttons,.tvn-actions,.tvn-grid,.tvn-panel,.wp-block-columns,.tvn-model-links,.tvn-document-list,.tvn-notice,.tvn-contact-form,.tvn-selector,.tvn-compare) {
  margin-top: var(--tvn-space-text);
}

/* A new chapter is separated from the preceding content, including CTAs. */
.site-main :is(.entry-content, .tvn-section, .wp-block-column) > * + h2 {
  margin-top: var(--tvn-space-chapter);
}
.site-main :is(.entry-content, .tvn-section, .wp-block-column) > * + :is(h3,h4) {
  margin-top: var(--tvn-space-component);
}
.site-main :is(.entry-content, .tvn-section, .tvn-panel, .tvn-entry-header, .wp-block-column) > .tvn-eyebrow + :is(h1,h2,h3),
.site-main :is(.entry-content, .tvn-section, .tvn-panel, .tvn-entry-header, .wp-block-column) > :is(h2,h3,h4) + :is(h3,h4) {
  margin-top: var(--tvn-space-label);
}
.site-main :is(.entry-content, .tvn-section, .tvn-panel, .tvn-entry-header, .wp-block-column) > h1 + :is(p,.tvn-lead) {
  margin-top: var(--tvn-space-actions);
}

/* Bordered panels, media, lists of cards and tools share the component gap. */
.site-main :is(.entry-content, .tvn-section, .tvn-panel, .wp-block-column) > * + :is(.tvn-grid,.tvn-panel,figure,.wp-block-columns,.tvn-model-links,.tvn-document-list,.tvn-notice,.tvn-contact-form,.tvn-selector,.tvn-compare),
.site-main :is(.entry-content, .tvn-section, .wp-block-column) > :is(.tvn-panel,.tvn-grid,.tvn-document-list,.tvn-notice) + p {
  margin-top: var(--tvn-space-component);
}
.site-main :is(.entry-content, .tvn-section, .tvn-panel, .wp-block-column) > :is(h2,h3,h4) + :is(figure,.tvn-grid,.tvn-panel,.tvn-document-list,.tvn-model-links) {
  margin-top: var(--tvn-space-actions);
}
.site-main :is(.entry-content, .tvn-section, .tvn-panel, .wp-block-column) > * + :is(.tvn-actions,.wp-block-buttons) {
  margin-top: var(--tvn-space-actions);
}
.site-main :is(.tvn-actions,.wp-block-buttons) { gap: var(--tvn-space-label); }

/* Old spacer blocks no longer add an extra gap on top of the shared rhythm. */
.site-main .entry-content > .wp-block-spacer {
  height: 0 !important;
  margin-block: 0 !important;
}
.site-main .tvn-panel { padding: var(--tvn-space-card); }
.site-main :is(.tvn-panel,.tvn-section,.tvn-entry-header) > :last-child { margin-bottom: 0; }
.site-main .tvn-panel > :first-child { margin-top: 0; }
.site-main .tvn-panel > * + :is(h2,h3,h4) { margin-top: var(--tvn-space-actions); }
.site-main .tvn-panel > .tvn-eyebrow + :is(h2,h3) { margin-top: var(--tvn-space-label); }
.site-main .tvn-grid { gap: var(--tvn-space-grid); }
.site-main .tvn-card-body { padding: var(--tvn-space-card); }
.site-main .tvn-card-body > p { margin-bottom: var(--tvn-space-text); }
.site-main .tvn-card-body > .tvn-eyebrow { margin-bottom: var(--tvn-space-label); }
.site-main .tvn-card-body > :last-child:not(.tvn-text-link) { margin-bottom: 0; }
.site-main .tvn-card-body > .tvn-text-link { padding-top: 8px; }

/* One text axis: a lead must not be narrower/indented compared with its H1. */
.site-main .entry-content > .tvn-lead,
.site-main .tvn-entry-header > .tvn-lead { max-width: 900px; }
.site-main .tvn-article-content > .entry-content > *:not(.alignfull):not(.alignwide),
.site-main .tvn-two-column .entry-content > *:not(.alignfull):not(.alignwide) {
  width: 100%;
  max-width: 100%;
}
.site-main .entry-content > .wp-block-table { max-width: 100%; overflow-x: auto; }
.site-main .entry-content > :is(ul,ol) > li + li { margin-top: 4px; }
.site-main .tvn-entry-header > h1,
.site-main .entry-content > h1 { text-wrap: balance; }

@media (max-width: 600px) {
  :root {
    --tvn-space-section: 40px;
    --tvn-space-chapter: 32px;
    --tvn-space-component: 24px;
    --tvn-space-card: 20px;
    --tvn-space-grid: 16px;
  }
}

/* Defence cover already spans its parent; 100vw included the scrollbar.
 * The summary strip follows the hero in normal flow instead of covering CTAs. */
.site-main .entry-content > .tvn-defence-hero {
  width: 100% !important;
  max-width: 100% !important;
  margin-inline: 0 !important;
  padding-block: var(--tvn-space-section);
}
.site-main .entry-content > .tvn-defence-hero-strip {
  margin-block: var(--tvn-space-component);
}

/* Full-width section wrappers also occur outside Gutenberg groups.
 * Keep their inner content aligned with the 900px homepage content column. */
.tvn-front-page .entry-content > section.tvn-section > * {
  width: 100%;
  max-width: 900px;
  margin-inline: auto;
}

/* A single published realization is a feature, not one of three empty slots. */
.site-main .tvn-realization-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
.site-main .tvn-realization-grid > .tvn-card:only-child {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
}
.site-main .tvn-realization-grid > .tvn-card:only-child .tvn-card-media {
  min-width: 0;
  padding: 0;
  height: 100%;
  min-height: 300px;
}
.site-main .tvn-realization-grid > .tvn-card:only-child .tvn-card-media img {
  width: 100%;
  height: 100%;
  min-height: 300px;
  object-fit: cover;
}
.site-main .tvn-realization-grid .tvn-card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.site-main .tvn-realization-grid .tvn-card-body h3 {
  overflow-wrap: anywhere;
}
@media (max-width: 700px) {
  .site-main .tvn-realization-grid > .tvn-card:only-child {
    grid-template-columns: minmax(0, 1fr);
  }
  .site-main .tvn-realization-grid > .tvn-card:only-child .tvn-card-media,
  .site-main .tvn-realization-grid > .tvn-card:only-child .tvn-card-media img {
    height: 240px;
    min-height: 0;
  }
}

