/* Golden scale: full steps multiply by 1.618; half steps by sqrt(1.618).
 * The common fluid base preserves the ratios at every viewport width. */
:root, .editor-styles-wrapper {
  --vernalia-type-base: clamp(1rem, .958333rem + .208333vw, 1.125rem);
  --vernalia-type-small: calc(var(--vernalia-type-base) * 0.78615963);
  --vernalia-type-body: calc(var(--vernalia-type-base) * 1.00000000);
  --vernalia-type-lead: calc(var(--vernalia-type-base) * 1.27200629);
  --vernalia-type-title-sm: calc(var(--vernalia-type-base) * 1.61800000);
  --vernalia-type-title-md: calc(var(--vernalia-type-base) * 2.05810618);
  --vernalia-type-title-lg: calc(var(--vernalia-type-base) * 2.61792400);
  --vernalia-type-display: calc(var(--vernalia-type-base) * 3.33001579);
  --vernalia-type-hero: calc(var(--vernalia-type-base) * 4.23580103);
}
:where(body, .editor-styles-wrapper) { font-size:var(--vernalia-type-body); --vernalia-paragraph-original:var(--vernalia-type-body); line-height:1.618; }
:where(h1,h2,h3,h4,h5,h6) { line-height:1.18; }
:where(input,select,textarea) { font-size:var(--vernalia-type-body); --vernalia-paragraph-original:var(--vernalia-type-body); }

/* Inherited text must not fall back to browser heading/small multipliers. */
:where(body, .editor-styles-wrapper) :where(h1) { font-size:var(--vernalia-type-title-lg); --vernalia-paragraph-original:var(--vernalia-type-title-lg); }
:where(body, .editor-styles-wrapper) :where(h2) { font-size:var(--vernalia-type-title-md); --vernalia-paragraph-original:var(--vernalia-type-title-md); }
:where(body, .editor-styles-wrapper) :where(h3) { font-size:var(--vernalia-type-title-sm); --vernalia-paragraph-original:var(--vernalia-type-title-sm); }
:where(body, .editor-styles-wrapper) :where(h4) { font-size:var(--vernalia-type-lead); --vernalia-paragraph-original:var(--vernalia-type-lead); }
/* Preserve the previous H4 presentation after correcting MailerLite's outline. */
.mailerlite-form-response > h3 { font-size:var(--vernalia-type-lead); --vernalia-paragraph-original:var(--vernalia-type-lead); margin-block:1.33em; }
:where(body, .editor-styles-wrapper) :where(h5,h6) { font-size:var(--vernalia-type-body); --vernalia-paragraph-original:var(--vernalia-type-body); }
:where(body, .editor-styles-wrapper) :where(small,sub,sup) { font-size:var(--vernalia-type-small); --vernalia-paragraph-original:var(--vernalia-type-small); }
/* WooCommerce owns these selectors and otherwise supplies unrelated pixel sizes. */
body .woocommerce form :is(input.input-text,textarea,select),
body :is(.wc-block-components-text-input,.wc-block-components-combobox) input { font-size:var(--vernalia-type-body); --vernalia-paragraph-original:var(--vernalia-type-body); }
body .wc-block-grid__product,
body .wc-block-grid__product .wp-block-button__link,
body .wc-block-components-product-name,
body .wc-block-components-title,
body .wc-block-components-totals-item,
body .wc-block-components-checkout-step__description,
body .wc-block-components-checkbox__label,
body .wc-block-components-radio-control__label,
body .wc-block-components-button,
body .wc-block-components-validation-error { font-size:var(--vernalia-type-body); --vernalia-paragraph-original:var(--vernalia-type-body); }
body .wc-block-components-product-metadata,
body .wc-block-components-product-details,
body .wc-block-components-order-summary-item__description,
body .wc-block-components-order-summary-item__quantity { font-size:var(--vernalia-type-small); --vernalia-paragraph-original:var(--vernalia-type-small); }
body .woocommerce p.stars a { font-size:var(--vernalia-type-lead); --vernalia-paragraph-original:var(--vernalia-type-lead); }

/* These plugin rules have higher specificity and may load after the theme. */
body .wc-block-grid .wc-block-grid__product,
body .wc-block-grid .wc-block-grid__product .wp-block-button__link { font-size:var(--vernalia-type-body) !important; --vernalia-paragraph-original:var(--vernalia-type-body); }
body .woocommerce p.stars a,
body .vp p.stars a { font-size:var(--vernalia-type-lead) !important; --vernalia-paragraph-original:var(--vernalia-type-lead); }

body .wc-block-components-form .wc-block-components-text-input :is(input,label),
body .wc-block-components-text-input :is(input,label),
body .wc-block-components-notice-banner { font-size:var(--vernalia-type-body) !important; --vernalia-paragraph-original:var(--vernalia-type-body); }
body .wc-blocks-components-select .wc-blocks-components-select__label { font-size:var(--vernalia-type-small) !important; --vernalia-paragraph-original:var(--vernalia-type-small); }

body .wc-block-components-order-summary-item__quantity > span,
body .wc-block-components-order-summary-item__description p,
body .wc-block-components-product-metadata p { font-size:var(--vernalia-type-small) !important; --vernalia-paragraph-original:var(--vernalia-type-small); }

/* Keep editable text legible in every form, including dynamically opened dialogs. */
body :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]):not([type=submit]):not([type=button]),textarea,select),
.editor-styles-wrapper :is(input:not([type=checkbox]):not([type=radio]),textarea,select) { font-size:var(--vernalia-type-body) !important; --vernalia-paragraph-original:var(--vernalia-type-body); }

/* Allow the order summary to reflow when text is enlarged. */
body .wc-block-components-order-summary-item { flex-wrap:wrap; }
body .wc-block-components-order-summary-item__description { min-width:0; }
body .wc-block-components-order-summary-item__total-price { margin-inline-start:auto; max-width:100%; }
body .wc-block-components-order-summary-item .wc-block-components-formatted-money-amount { white-space:normal; overflow-wrap:anywhere; }

body .wc-block-components-quantity-selector__button,
:is(body.woocommerce, body .woocommerce) .widget_price_filter .price_slider_amount .button { font-size:var(--vernalia-type-body) !important; --vernalia-paragraph-original:var(--vernalia-type-body); }

/* Paragraph adjustment: leave the heading scale and editable fields unchanged.
 * Specific component sizes are retained through their local paragraph token. */
:root, .editor-styles-wrapper { --vernalia-paragraph-factor: .9; }
:where(body, .editor-styles-wrapper) p {
    font-size:max(.75rem, calc(var(--vernalia-paragraph-original, var(--vernalia-type-body)) * var(--vernalia-paragraph-factor))) !important;
}

body .wc-block-components-order-summary-item__description p,
body .wc-block-components-product-metadata p {
    font-size:max(.75rem, calc(var(--vernalia-type-small) * var(--vernalia-paragraph-factor))) !important;
}

/* Preserve the size selected for native paragraph presets before reducing it. */
p.has-small-font-size { --vernalia-paragraph-original:var(--wp--preset--font-size--small); }
p.has-medium-font-size { --vernalia-paragraph-original:var(--wp--preset--font-size--medium); }
p.has-large-font-size { --vernalia-paragraph-original:var(--wp--preset--font-size--large); }
p.has-x-large-font-size { --vernalia-paragraph-original:var(--wp--preset--font-size--x-large); }
p.has-xx-large-font-size { --vernalia-paragraph-original:var(--wp--preset--font-size--xx-large); }
p.has-normal-font-size { --vernalia-paragraph-original:var(--wp--preset--font-size--normal); }
p.has-huge-font-size { --vernalia-paragraph-original:var(--wp--preset--font-size--huge); }

/* Keep prose and headings readable: wrap between words, never within them.
 * Override component and WordPress wrapping rules in both the site and editor. */
:is(body, .editor-styles-wrapper) :is(p, h1, h2, h3, h4, h5, h6, figcaption) {
    word-break: normal !important;
    overflow-wrap: normal !important;
    hyphens: none !important;
}
