/**
 * SharpTutor compact typography.
 *
 * This stylesheet is deliberately isolated from the theme. Disable the whole
 * layer by defining SHARPTUTOR_COMPACT_TYPOGRAPHY as false in wp-config.php.
 * No fixed heights, clipping, negative leading, or line clamping are used.
 */

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) {
  --stct-flow-space: 0.55rem;
  --stct-section-space: 0.8rem;
  --stct-body-leading: 1.4;
  --stct-heading-leading: 1.14;
}

@supports (width: 1cqw) {
  :where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) {
    --stct-flow-space: clamp(7px, 0.7cqw, 11px);
    --stct-section-space: clamp(10px, 1cqw, 15px);
  }
}

@supports (container-type: inline-size) {
  :where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) :where(
    .page-shell,
    .page-content-panel,
    .panel,
    .card,
    .posts-grid .wp-block-post
  ) {
    container-type: inline-size;
  }
}

body.st-compact-typography {
  line-height: 1.4;
}

/* Gutenberg flow gaps otherwise remain at the theme.json value of 1.2rem. */
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) :is(
  .is-layout-flow,
  .is-layout-constrained
) > * + *,
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) .page-shell > * + * {
  margin-block-start: var(--stct-flow-space);
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) :is(
  .is-layout-flex,
  .is-layout-grid,
  .wp-block-columns,
  .wp-block-buttons
) {
  row-gap: var(--stct-flow-space);
}

/* Headings: px/vw fallback first, then container-responsive cqw sizing. */
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) h1,
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) .page-title,
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) .wp-block-post-title.page-title {
  margin-block: 0.3rem 0.55rem;
  font-size: clamp(30px, 4.4vw, 52px);
  font-size: clamp(30px, calc(24px + 2.35cqw), 52px);
  line-height: 1.12;
  overflow-wrap: break-word;
  text-wrap: pretty;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) .hero-banner .wp-block-heading {
  margin-block: 0 0.45rem;
  font-size: clamp(30px, 4.6vw, 54px);
  font-size: clamp(30px, calc(24px + 2.5cqw), 54px);
  line-height: 1.12;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) h2,
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) .section-heading {
  margin-block: 0.65rem 0.32rem;
  font-size: clamp(24px, 3.2vw, 36px);
  font-size: clamp(24px, calc(20px + 1.45cqw), 36px);
  line-height: var(--stct-heading-leading);
  overflow-wrap: break-word;
  text-wrap: pretty;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) h3 {
  margin-block: 0.55rem 0.25rem;
  font-size: clamp(20px, 2.2vw, 27px);
  font-size: clamp(20px, calc(18px + 0.75cqw), 27px);
  line-height: 1.16;
  overflow-wrap: break-word;
  text-wrap: pretty;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) h4 {
  margin-block: 0.48rem 0.22rem;
  font-size: clamp(18px, 1.8vw, 22px);
  font-size: clamp(18px, calc(17px + 0.45cqw), 22px);
  line-height: 1.18;
  overflow-wrap: break-word;
  text-wrap: pretty;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) h5 {
  margin-block: 0.44rem 0.2rem;
  font-size: clamp(17px, 1.55vw, 20px);
  font-size: clamp(17px, calc(16.5px + 0.3cqw), 20px);
  line-height: 1.2;
  overflow-wrap: break-word;
  text-wrap: pretty;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) h6 {
  margin-block: 0.4rem 0.18rem;
  font-size: clamp(16px, 1.35vw, 18px);
  font-size: clamp(16px, calc(15.5px + 0.25cqw), 18px);
  line-height: 1.2;
  overflow-wrap: break-word;
  text-wrap: pretty;
}

/* Reading text keeps a 16px floor while tightening leading and margins. */
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) p,
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) li,
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) dt,
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) dd,
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) address {
  font-size: clamp(16px, 1.5vw, 18px);
  font-size: clamp(16px, calc(15.2px + 0.22cqw), 18px);
  line-height: var(--stct-body-leading);
  overflow-wrap: break-word;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) p {
  margin-block: 0.32rem 0.62rem;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) :where(ul, ol, dl) {
  margin-block: 0.35rem 0.68rem;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) li + li {
  margin-block-start: 0.2rem;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) dt {
  margin-block-start: 0.4rem;
  font-weight: 700;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) dd {
  margin-block: 0.12rem 0.45rem;
  margin-inline-start: 1.1rem;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) .lead {
  font-size: clamp(17px, 1.8vw, 21px) !important;
  font-size: clamp(17px, calc(16px + 0.42cqw), 21px) !important;
  line-height: 1.38;
}

/* Quotes, captions, code, tables, and disclosure text. */
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) blockquote,
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) .wp-block-quote {
  margin-block: 0.45rem 0.72rem;
  padding-block: 0.7rem;
  font-size: clamp(16px, 1.6vw, 19px);
  font-size: clamp(16px, calc(15.2px + 0.3cqw), 19px);
  line-height: 1.4;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) .wp-block-pullquote {
  margin-block: 0.5rem 0.75rem;
  padding-block: var(--stct-section-space);
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) :is(
  figcaption,
  caption,
  cite,
  small
),
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) .wp-element-caption,
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) :is(
  .wp-block-audio,
  .wp-block-embed,
  .wp-block-image,
  .wp-block-video
) figcaption,
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) .wp-block-table caption {
  margin-block: 0.22rem 0.48rem;
  font-size: clamp(13px, 1.2vw, 15px);
  font-size: clamp(13px, calc(12.5px + 0.16cqw), 15px);
  line-height: 1.35;
  overflow-wrap: break-word;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) :where(figure, table, pre) {
  margin-block: 0.45rem 0.72rem;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) .wp-block-table table {
  margin-block: 0;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) pre {
  padding-block: 0.72rem;
  font-size: clamp(14px, 1.3vw, 16px);
  line-height: 1.4;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) :where(code, kbd, samp) {
  font-size: 0.92em;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) .wp-block-table :is(th, td) {
  padding-block: 0.4rem;
  font-size: clamp(15px, 1.35vw, 17px);
  line-height: 1.35;
}

/* Form and interactive text; control padding and target sizes remain intact. */
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) :where(
  label,
  legend,
  summary,
  button,
  select,
  textarea,
  input:not([type]),
  input[type="text"],
  input[type="email"],
  input[type="url"],
  input[type="tel"],
  input[type="search"],
  input[type="number"],
  input[type="password"],
  input[type="date"],
  input[type="time"],
  input[type="submit"],
  input[type="reset"],
  input[type="button"]
) {
  font-size: clamp(16px, 1.35vw, 17px);
  font-size: clamp(16px, calc(15.4px + 0.16cqw), 17px);
  line-height: 1.3;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) :where(label, legend) {
  margin-block-end: 0.2rem;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) summary {
  margin-block: 0.25rem;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) :is(
  .wp-block-navigation-item__content,
  .wp-block-button__link,
  .wp-element-button,
  .st-button
) {
  font-size: clamp(15px, 1.45vw, 18px);
  font-size: clamp(15px, calc(14.2px + 0.28cqw), 18px);
  line-height: 1.2;
}

/* Component-aware adjustments that retain each component's own visual rules. */
:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) .st-carousel .st-carousel__title {
  font-size: clamp(30px, 4.4vw, 52px);
  font-size: clamp(30px, calc(24px + 2.35cqw), 52px);
  line-height: 1.12;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) .st-carousel .st-carousel__text {
  margin-block-start: 0.35rem;
  font-size: clamp(16px, 1.65vw, 20px) !important;
  font-size: clamp(16px, calc(15.2px + 0.3cqw), 20px) !important;
  line-height: 1.38;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) .st-carousel__actions {
  margin-block-start: 0.55rem;
  row-gap: 0.38rem;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) .wpcf7 form .wpcf7-response-output {
  margin-block: 0.7rem 0;
}

:where(body.st-compact-typography .wp-site-blocks, .editor-styles-wrapper) :where(
  .wp-block-comment-content,
  .comment-content
) p {
  margin-block: 0.3rem 0.6rem;
  line-height: var(--stct-body-leading);
}

/*
 * JavaScript adds this class only after measuring more than one rendered line.
 * The custom values are bounded and removed before every new measurement, so
 * the size cannot ratchet down after translation or resizing.
 */
.stct-auto-fit.stct-auto-fit.stct-auto-fit {
  font-size: clamp(
    var(--stct-fit-min, 13px),
    var(--stct-fit-size, 1rem),
    var(--stct-fit-max, 64px)
  ) !important;
  line-height: var(--stct-fit-leading, 1.2) !important;
}
