/* Shared page typography and vertical spacing for tuleshov.ru. */
:root {
  --page-title-size: clamp(32px, 4.25vw, 60px);
  --page-title-leading: 1.05;
  --reading-leading: 1.6;
}

body :is(main, #tc-calculator, #allrecords) :is(h1, h1#sheet-title) {
  font-size: var(--page-title-size);
  line-height: var(--page-title-leading);
  overflow-wrap: anywhere;
}

body :is(main, #tc-calculator, #allrecords) h1 + p {
  margin-block-start: var(--heading-space);
}

body :is(.site-article-body, .legal-sections, .service-extra, .proto-block, .sheet-section) p {
  line-height: var(--reading-leading);
}

body :is(.site-article-body, .service-extra > .tcdev-section, .proto-block, .sheet-section, .legal-sections > section) > p + p {
  margin-block-start: var(--paragraph-space);
}

body :is(.proto-block, .sheet-section, .legal-sections > section) > :is(h2, h3) {
  margin-block-end: var(--heading-space);
}

body :is(.proto-block, .sheet-section, .legal-sections > section) > :is(h2, h3) + p {
  margin-block-start: 0;
}

body main.legal-page .legal-sections > section,
body main.service-page .service-extra > .tcdev-section:not(.compact-contact) {
  padding-block: var(--section-inset);
}

/* Between a standalone example card and the next section, count the next
   section's leading inset as the second half of the gap. */
body main.service-page .service-extra > .service-examples + .tcdev-section {
  margin-block-start: var(--section-inset);
}

/* Keep the internal padding of boxed property features and calls to action. */
body main.property-sheet > .sheet-hero ~ section {
  margin-block-start: var(--section-space);
}

body main.property-sheet > :is(.sheet-section, .sheet-gallery) {
  padding-block: 0;
}

body main.wrap > .section.related-publications {
  margin-block-start: var(--section-inset);
}

body main.property-sheet > :is(.sheet-section, .sheet-gallery, .sheet-purchase) h2 {
  margin-block-end: var(--heading-space);
}

body main.legal-page .legal-sections p + p {
  margin-block-start: var(--paragraph-space);
}

/* Start the first visible block on the same line below the shared header. */
body > header.bar + :is(main, #allrecords) {
  margin-block-start: 0;
  padding-block-start: clamp(8px, 1vw, 12px);
}

body > header.bar + main > :is(.fit-hero, .service-hero, .error-hero):first-child {
  margin-block-start: 0;
}

body > header.bar + main > :is(.archive-title, .utility-heading:not(.error-hero)):first-child,
body > header.bar + main > article:first-child > .article-lead,
body #tc-calculator .tc-wrap {
  padding-block-start: 0;
}

body > header.bar + main > :is(.sheet-back, .proto-back):first-child,
body > header.bar + main > article:first-child > .article-lead > a:first-child {
  display: block;
  width: fit-content;
  margin-block: 0 var(--heading-space);
  line-height: 1.5;
}

body > header.bar + main > article:first-child > .article-lead > .article-heading {
  margin-block-start: 0;
}
