/**
 * Builder Blocks — default styles.
 * Aligned with themes/seeitalytravel (theme.json + _tokens.scss).
 */

/** Variables — theme palette and spacing */
:root {
    /* Pure */
    --color-pure-white: #ffffff;
    --color-pure-black: #000000;

    /* Theme palette (theme.json) */
    --color-white: #ffffff;
    --color-black: #000000;
    --color-basics-black: #3e3e3e;
    --color-basics-dark-gray: #2c2c2c;
    --color-basics-beige: #e8dfd4;
    --color-basics-ulight-beige: #fbfaf6;
    --color-basics-light-beige: #fbf2e7;
    --color-basics-dark-beige: #b6a38c;
    --color-basics-light-blue: #afc0bc;

    /* Semantic aliases */
    --color-canvas: var(--color-basics-ulight-beige);
    --color-surface: var(--color-basics-beige);
    --color-ink: var(--color-basics-black);
    --color-sand: var(--color-basics-dark-beige);
    --color-accent: var(--color-basics-dark-beige);
    --color-primary: var(--color-basics-black);
    --color-secondary: var(--color-basics-dark-beige);
    --color-light: var(--color-basics-ulight-beige);
    --color-dark: var(--color-basics-dark-gray);

    /*
     * Gray ramp (compat for legacy blocks using gray-100…900).
     * Mapped to the theme beige / ink hierarchy, not the old neutral scale.
     */
    --color-gray-100: var(--color-basics-ulight-beige);
    --color-gray-200: var(--color-basics-beige);
    --color-gray-300: #d4c8b8;
    --color-gray-400: var(--color-basics-dark-beige);
    --color-gray-500: #8a7a66;
    --color-gray-600: var(--color-basics-black);
    --color-gray-700: var(--color-basics-dark-gray);
    --color-gray-800: #242424;
    --color-gray-900: #1a1a1a;

    /* Spacing (theme.json spacingSizes) */
    --spacer-xxs: 0.5rem;
    --spacer-xs: 1rem;
    --spacer-sm: 1.5rem;
    --spacer-md: 2rem;
    --spacer-lg: 3rem;
    --spacer-xl: 5rem;
    --spacer-xxl: 8rem;
    --spacer-navigation: var(--navigation-height, 80px);
    --spacer-section: clamp(15px, 1em, 16px);

    /* Layout (theme.json settings.layout) */
    --builder-layout-content-size: var(
        --wp--style--global--content-size,
        clamp(960px, 100% - 4rem, 1440px)
    );
    --builder-layout-wide-size: var(
        --wp--style--global--wide-size,
        clamp(1200px, 100% - 4rem, 1920px)
    );

    /* Theme custom tokens */
    --side-padding: var(--wp--custom--side-padding, 2rem);
    --font-heading: var(--wp--preset--font-family--heading, "Salvager", Georgia, serif);
    --font-body: var(--wp--preset--font-family--body, "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
    --radius-sm: var(--wp--custom--radius--sm, 0.25rem);
    --radius-md: var(--wp--custom--radius--md, 0.5rem);
    --radius-lg: var(--wp--custom--radius--lg, 0.75rem);
    --radius-pill: var(--wp--custom--radius--pill, 999px);
    --transition-short: var(--wp--custom--transitions--short, all 0.5s cubic-bezier(0.19, 0.91, 0.36, 0.99));
    --transition-base: var(--wp--custom--transitions--base, all 1.5s cubic-bezier(0.19, 0.91, 0.36, 0.99));
}

/**
 * Gutenberg layout (without wp-block-library / global-styles on the front).
 * Aligned with theme.json settings.layout.contentSize.
 * Content width applies only to layout roots, not leaf blocks
 * (heading, paragraph, image, button, …) or descendants already inside a constrained container.
 */

/* Overflow clip (optional / disabled):
:is(
    .block-editor-content,
    [data-block-builder="gutemberg"],
    section.editor-content,
    .term-editor-content,
    body.homepage,
    body.page-template-homepage,
    .editor-styles-wrapper
) {
    overflow-x: clip;
}
*/

/* Layout roots: only the first eligible section ancestor, not nested children. */
:is(body, .editor-styles-wrapper)
    :is(.container, .wp-block-group, .wp-block-columns):not(.alignfull):not(
        :is(.container, .wp-block-group, .wp-block-columns)
            :is(.container, .wp-block-group, .wp-block-columns)
    ) {
    box-sizing: border-box;
    margin-inline: auto;
    width: 100%;
    max-width: var(--builder-layout-content-size);
}

/*
 * Explicit reset: nested non-constrained groups/containers fill the parent.
 * Excludes is-layout-constrained so responsive max-width (e.g. 100ch) still applies.
 */
:is(body, .editor-styles-wrapper)
    :is(.container, .wp-block-group, .wp-block-columns)
    :is(.container, .wp-block-group, .wp-block-columns):not(.alignfull):not(
        .is-layout-constrained
    ):not(.wp-block-group-is-layout-constrained):not(.wp-block-columns-is-layout-constrained):not(
        .has-custom-max-width
    ) {
    width: 100%;
    max-width: none;
    margin-inline: 0;
}

/*
 * Gutenberg constrains direct children of constrained layouts (--wp--style--global--content-size).
 * The inner flex row must stretch to the full width of the outer container.
 */
:is(body, .editor-styles-wrapper)
    :is(.is-layout-constrained, .wp-block-group-is-layout-constrained)
    > :is(.wp-block-group, .wp-block-columns, .container, .wp-block-group__inner-container):not(
        .alignfull
    ):not(.alignwide):not(.has-custom-max-width),
:is(body, .editor-styles-wrapper)
    :is(.is-layout-constrained, .wp-block-group-is-layout-constrained)
    > .wp-block-group__inner-container
    > :is(.wp-block-group, .wp-block-columns, .container):not(.alignfull):not(.alignwide):not(
        .has-custom-max-width
    ) {
    width: 100%;
    max-width: none;
    margin-inline: 0;
}

/* Wide: only on layout roots with alignwide (e.g. group/columns in patterns). */
:is(body, .editor-styles-wrapper)
    :is(.wp-block-group, .wp-block-columns).alignwide:not(.alignfull):not(
        :is(.container, .wp-block-group, .wp-block-columns)
            :is(.wp-block-group, .wp-block-columns)
    ) {
    max-width: var(--builder-layout-wide-size);
}

/* Wide/full images (optional / disabled):
:is(.block-editor-content, [data-block-builder="gutemberg"], section.editor-content, .term-editor-content, body.homepage, body.page-template-homepage) figure.wp-block-image.alignwide {
    width: min(var(--wp--style--global--wide-size, 1920px), 100vw);
    max-width: min(var(--wp--style--global--wide-size, 1920px), 100vw);
}

:is(.block-editor-content, [data-block-builder="gutemberg"], section.editor-content, .term-editor-content, body.homepage, body.page-template-homepage) figure.wp-block-image.alignfull {
    width: 100vw;
    max-width: 100vw;
}
*/

/** Gutenberg Styles */
body .wp-block-heading {
    white-space: pre-wrap;
    text-transform: none;
}

body span.seeitaly-font-heading {
    font-family: var(--font-heading) !important;
    font-size: 1.05em;
    line-height: 0.9;
    translate: 0 0.035em;
}

body span.seeitaly-font-body {
    font-family: var(--font-body) !important;
}

/**
 * Core font-size presets → theme scale (theme.json typography.fontSizes).
 * small → caption, medium → body, large → h5, x-large → h4
 */

body .has-small-font-size,
body .has-caption-font-size {
    font-size: var(--wp--preset--font-size--caption, 0.85rem) !important;
}

body .has-medium-font-size,
body .has-body-font-size {
    font-size: var(--wp--preset--font-size--body, 1rem) !important;
}

body .has-large-font-size,
body .has-h-5-font-size,
body .has-h5-font-size,
body .has-sm-font-size {
    font-size: var(--wp--preset--font-size--sm, clamp(20px, 1.95vw, 28px)) !important;
}

body .has-x-large-font-size,
body .has-h-4-font-size,
body .has-h4-font-size,
body .has-md-font-size {
    font-size: var(--wp--preset--font-size--md, clamp(28px, 2.5vw, 36px)) !important;
}

/** Core::Image (excluding wide/full, handled above) */
body .is-layout-flow > figure.wp-block-image.size-full:not(.alignwide):not(.alignfull) {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
}

body .is-layout-flex {
    align-items: unset;
}

/** Core::Paragraph */
body .wp-block-paragraph {
    white-space: pre-wrap;
    text-wrap: auto;
    font-family: var(--font-body);
    color: var(--color-ink);
}

/** Core::Components */
.wp-block-list {
    font-size: var(--font-size, var(--wp--preset--font-size--body, 1rem));
    font-family: var(--font-body);
    color: var(--color-ink);
}

ol.wp-block-list {
    list-style-type: decimal;
}

ul.wp-block-list {
    list-style-type: disc;
}

.wp-block-table {
    font-size: var(--font-size, var(--wp--preset--font-size--body, 1rem));
    font-family: var(--font-body);
    color: var(--color-ink);
}

/** Core::Image (excluding wide/full) */
figure.wp-block-image.size-full:not(.alignwide):not(.alignfull) {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
}

/** Core::Image — img always fills the figure wrapper */
figure.wp-block-image img {
    display: block;
    width: 100% !important;
    height: auto;
    max-width: 100%;
}

figure.wp-block-image figcaption {
    position: absolute;
    inset: auto var(--spacer-xs) var(--spacer-xs) var(--spacer-xs);
    margin: 0;
    color: var(--wp--preset--color--white, var(--color-white));
    font-family: var(--font-body);
    font-size: var(--wp--preset--font-size--caption, 0.85rem);
}

/** Core::Group custom max-width (mobile defaults to 100% unless opted in) */
:is(body, .editor-styles-wrapper) .wp-block-group.has-custom-max-width {
    max-width: 100% !important;
}

@media (min-width: 768px) {
    :is(body, .editor-styles-wrapper) .wp-block-group.has-custom-max-width {
        max-width: var(--group-max-width) !important;
    }
}

:is(body, .editor-styles-wrapper) .wp-block-group.has-custom-max-width.has-custom-max-width-on-mobile {
    max-width: var(--group-max-width) !important;
}

/**
 * core/heading signature (%valore% + SVG).
 * Mirrors .moods-hero__heading svg placement.
 */
.signature-invisble,
.signature-invisible {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.wp-block-heading.has-signature,
.heading-signature-wrap {
    position: relative;
    /* Room for absolute SVG (top: 100% + translateY -25%) */
    margin-bottom: 5.5rem;
}

@media (max-width: 991.98px) {
    .wp-block-heading.has-signature,
    .heading-signature-wrap {
        margin-bottom: 4.5rem;
    }
}

.wp-block-heading.has-signature .heading-signature,
.heading-signature-wrap > .heading-signature {
    position: absolute;
    left: 50%;
    top: 100%;
    z-index: 1;
    display: block;
    width: auto;
    max-width: min(100%, 12rem);
    height: auto;
    transform: translate3d(-50%, -25%, 0);
    pointer-events: none;
}

.heading-signature-wrap {
    display: block;
    width: 100%;
}

.list-article-index > li > a {
    text-decoration: none;
}

.list-article-index > li > a:hover {
    color: var(--color-accent);
    text-decoration: none;
}
