/* =============================================================================
   Baseline typography and vertical rhythm
   Sizes, weights, colours and rhythm tokens live in theme.json.
   This sheet pairs each size preset with its kit line-height and applies the
   rhythm between blocks. Tune spacing in theme.json settings.custom.rhythm.
   ============================================================================= */

/* --- Rendering ------------------------------------------------------------ */

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-kerning: normal;
    font-feature-settings: "kern", "liga", "calt";
}

p, li, dd, dt, figcaption, blockquote, .wp-block-post-excerpt__excerpt {
    text-wrap: pretty;
}

h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
    overflow-wrap: break-word;
}

strong, b { font-weight: 600; }

a:where(:not(.wp-element-button):not(.wp-block-navigation-item__content)) {
    text-underline-offset: 0.15em;
    text-decoration-thickness: 0.06em;
}

/* --- Kit line-heights per font-size preset --------------------------------- */

.has-paragraph-small-font-size  { line-height: 1.5; }
.has-paragraph-base-font-size   { line-height: 1.429; }
.has-paragraph-medium-font-size { line-height: 1.5; }
.has-paragraph-large-font-size  { line-height: 1.556; }

.has-display-1-font-size  { line-height: 1.5; }
.has-display-2-font-size  { line-height: 1.429; }
.has-display-3-font-size  { line-height: 1.375; }
.has-display-4-font-size  { line-height: 1.333; }
.has-display-5-font-size  { line-height: 1.4; }
.has-display-6-font-size  { line-height: 1.333; letter-spacing: -0.01em; }
.has-display-7-font-size  { line-height: 1.2;   letter-spacing: -0.01em; }
.has-display-8-font-size  { line-height: 1.111; letter-spacing: -0.02em; }
.has-display-9-font-size  { line-height: 1.05;  letter-spacing: -0.02em; }
.has-display-10-font-size { line-height: 1.05;  letter-spacing: -0.02em; }
.has-display-11-font-size { line-height: 1.0;   letter-spacing: -0.025em; }
.has-display-12-font-size { line-height: 1.0;   letter-spacing: -0.025em; }

/* --- Kit weights as block styles ------------------------------------------ */

.is-style-weight-regular   { font-weight: 400; }
.is-style-weight-semibold  { font-weight: 600; }
.is-style-weight-extrabold { font-weight: 800; }

/* Display/1/Uppercase */
.is-style-eyebrow {
    font-size: var(--wp--preset--font-size--display-1);
    line-height: 1.5;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* --- Vertical rhythm -------------------------------------------------------
   WordPress sets the default gap between siblings in flow and constrained
   layouts with zero-specificity rules. Everything below is 0,0,1 so it wins,
   and later rules win over earlier ones. Order matters. */

/* Objects get more room than text. */
body :where(.is-layout-flow, .is-layout-constrained) > :where(*) + :where(figure, .wp-block-image, .wp-block-gallery, .wp-block-embed, .wp-block-video, .wp-block-table, .wp-block-code, .wp-block-preformatted, .wp-block-quote, .wp-block-pullquote, .wp-block-separator, .wp-block-buttons, .wp-block-columns, .wp-block-group, .wp-block-details),
body :where(.is-layout-flow, .is-layout-constrained) > :where(figure, .wp-block-image, .wp-block-gallery, .wp-block-embed, .wp-block-video, .wp-block-table, .wp-block-code, .wp-block-preformatted, .wp-block-quote, .wp-block-pullquote, .wp-block-separator, .wp-block-buttons, .wp-block-columns, .wp-block-group, .wp-block-details) + :where(*) {
    margin-block-start: var(--wp--custom--rhythm--section);
}

/* Space before a heading scales with its level. */
body :where(.is-layout-flow, .is-layout-constrained) > :where(*) + :where(h1, h2) {
    margin-block-start: var(--wp--custom--rhythm--before-heading-large);
}
body :where(.is-layout-flow, .is-layout-constrained) > :where(*) + :where(h3) {
    margin-block-start: var(--wp--custom--rhythm--before-heading-medium);
}
body :where(.is-layout-flow, .is-layout-constrained) > :where(*) + :where(h4, h5, h6) {
    margin-block-start: var(--wp--custom--rhythm--before-heading-small);
}

/* Stacked headings sit together. */
body :where(.is-layout-flow, .is-layout-constrained) > :where(h1, h2, h3, h4, h5, h6) + :where(h1, h2, h3, h4, h5, h6) {
    margin-block-start: var(--wp--custom--rhythm--between-headings);
}

/* A heading hugs whatever follows it. */
body :where(.is-layout-flow, .is-layout-constrained) > :where(h1, h2, h3) + :where(:not(h1, h2, h3, h4, h5, h6)) {
    margin-block-start: var(--wp--custom--rhythm--after-heading-large);
}
body :where(.is-layout-flow, .is-layout-constrained) > :where(h4, h5, h6) + :where(:not(h1, h2, h3, h4, h5, h6)) {
    margin-block-start: var(--wp--custom--rhythm--after-heading-small);
}

/* Eyebrow above a heading reads as one unit. */
body :where(.is-layout-flow, .is-layout-constrained) > :where(.is-style-eyebrow) + :where(h1, h2, h3, h4, h5, h6) {
    margin-block-start: var(--wp--custom--rhythm--unit);
}

/* --- Lists ----------------------------------------------------------------- */

:where(.wp-block-list, .entry-content ul, .entry-content ol) li + li,
:where(.wp-block-list) li > :where(ul, ol) {
    margin-block-start: var(--wp--custom--rhythm--list-item);
}

/* --- Figures and captions ------------------------------------------------- */

figcaption, .wp-element-caption {
    margin-block-start: var(--wp--custom--rhythm--unit);
    font-size: var(--wp--preset--font-size--paragraph-small);
    line-height: 1.5;
    color: var(--wp--preset--color--gray-070);
}

/* --- Quotes --------------------------------------------------------------- */

.wp-block-quote p + p {
    margin-block-start: var(--wp--custom--rhythm--gap);
}
.wp-block-quote cite {
    display: block;
    margin-block-start: var(--wp--custom--rhythm--unit);
    font-size: var(--wp--preset--font-size--paragraph-small);
    font-style: normal;
    color: var(--wp--preset--color--gray-070);
}
