/**
 * Global foundations.
 * Resets are deliberately conservative so legacy Elementor/plugin pages can
 * coexist while the native theme is migrated section by section.
 */

html {
    box-sizing: border-box;
    background: var(--pp-color-page);
    direction: rtl;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

body {
    margin: 0;
    color: var(--pp-color-text);
    background: var(--pp-color-page);
    font-family: var(--pp-font-body);
    font-size: var(--pp-text-base);
    font-weight: 400;
    line-height: var(--pp-leading-normal);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

:where(img, svg, video, canvas) {
    display: block;
    max-width: 100%;
}

:where(img) {
    height: auto;
}

:where(button, input, textarea, select) {
    font: inherit;
}

:where(button, [role="button"]) {
    touch-action: manipulation;
}

:where(a) {
    color: inherit;
}

:where(h1, h2, h3, h4, h5, h6, p) {
    overflow-wrap: break-word;
}

:where(h1, h2, h3, h4, h5, h6) {
    margin-block: 0;
    color: var(--pp-color-secondary);
    font-family: var(--pp-font-body);
    line-height: var(--pp-leading-tight);
}

:where(p) {
    margin-block: 0 1em;
}

/* Consistent paragraph justification throughout the Theme. Component-specific
 * alignments (e.g. centered labels) retain their more specific rules. */
p {
    text-align: justify;
}

:focus-visible {
    outline: 3px solid var(--pp-color-focus);
    outline-offset: 3px;
}

:focus:not(:focus-visible) {
    outline: none;
}

::selection {
    color: #ffffff;
    background: var(--pp-color-primary);
}

.screen-reader-text,
.pp-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.screen-reader-text:focus {
    position: fixed !important;
    z-index: 100000;
    inset-block-start: var(--pp-space-4);
    inset-inline-start: var(--pp-space-4);
    width: auto;
    height: auto;
    padding: var(--pp-space-3) var(--pp-space-4);
    clip: auto;
    color: #ffffff;
    background: var(--pp-color-primary);
    border-radius: var(--pp-radius-sm);
    box-shadow: var(--pp-shadow-soft);
    text-decoration: none;
    white-space: normal;
}

/* The page canvas is intentionally shared by every native route. Keep surface,
 * cream and brand fills on cards, dialogs and headers untouched. The specificity
 * prevents route CSS from reverting the canvas to the old surface-soft color. */
body .pp-main {
    min-width: 0;
    background: var(--pp-color-page);
}

/* Shared page-to-footer rhythm for fallback templates. Dedicated routes use
 * the same --pp-page-footer-gap token in their own terminal wrapper. */
.pp-main:not(.pp-home):not(.pp-single-product):not(.pp-article):not(.pp-about):not(.pp-contact):not(.pp-delivery):not(.pp-terms):not(.pp-order):not(.pp-payment):not(.pp-returns):not(.pp-faq):not(.pp-catalog):not(.pp-blog):not(.pp-not-found) > .pp-container {
    padding-block: var(--pp-space-6) var(--pp-page-footer-gap);
}

.pp-container {
    width: min(calc(100% - (2 * var(--pp-gutter))), var(--pp-container-max));
    margin-inline: auto;
}

.pp-section {
    padding-block: var(--pp-section-space);
}

.pp-flow > * + * {
    margin-block-start: var(--pp-flow-space, var(--pp-space-4));
}


/* Root page scrollbar — brand aligned, does not affect nested carousels/carts. */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--pp-color-primary) var(--pp-color-cream);
}

html::-webkit-scrollbar {
    width: 7px;
}

html::-webkit-scrollbar-track {
    background: var(--pp-color-cream);
}

html::-webkit-scrollbar-thumb {
    background: var(--pp-color-primary);
    border: 1px solid var(--pp-color-cream);
    border-radius: 999px;
}

html::-webkit-scrollbar-thumb:hover {
    background: #741416;
}

@media (forced-colors: active) {
    html {
        scrollbar-color: auto;
    }
}
