html {
    direction: rtl;
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

@supports (overflow: clip) {
    html,
    body {
        overflow-x: clip;
    }
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--versai-color-text);
    background: var(--versai-color-background);
    font-family: var(--versai-font-family);
    font-size: var(--versai-font-size-base);
    font-weight: 400;
    line-height: var(--versai-line-height-base);
    text-align: right;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

@supports (min-height: 100dvh) {
    body {
        min-height: 100dvh;
    }
}

body.versai-menu-open {
    overflow: hidden;
    overscroll-behavior: none;
}

::selection {
    color: var(--versai-color-white);
    background: var(--versai-color-primary);
}

img,
svg,
video,
canvas,
iframe {
    max-width: 100%;
}

img {
    height: auto;
}

iframe {
    border: 0;
}

a {
    color: var(--versai-color-primary);
    text-decoration: none;
    transition: color var(--versai-transition-fast), opacity var(--versai-transition-fast);
}

a:hover,
a:focus-visible {
    color: var(--versai-color-primary-dark);
}

button,
input,
textarea,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:disabled {
    pointer-events: none;
}

:focus-visible {
    outline: 3px solid rgba(var(--versai-color-accent-rgb), 0.72);
    outline-offset: 3px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    color: var(--versai-color-heading);
    font-weight: 700;
    line-height: var(--versai-line-height-heading);
    overflow-wrap: anywhere;
}

h1 { font-size: var(--versai-font-size-h1); }
h2 { font-size: var(--versai-font-size-h2); }
h3 { font-size: var(--versai-font-size-h3); }

p:last-child {
    margin-bottom: 0;
}

.site {
    width: 100%;
    min-height: 100vh;
}

.site-main {
    width: 100%;
    min-height: 60vh;
}

.versai-container {
    width: 100%;
    max-width: none;
    padding-right: max(var(--versai-page-gutter), var(--versai-safe-area-right));
    padding-left: max(var(--versai-page-gutter), var(--versai-safe-area-left));
}

.versai-content-area {
    padding-top: var(--versai-section-space);
    padding-bottom: var(--versai-section-space);
}

.versai-entry {
    padding-block: var(--versai-section-space-sm);
    border-bottom: 1px solid var(--versai-color-border);
}

.versai-entry__header {
    margin-bottom: 1.5rem;
}

.versai-entry__title {
    margin-bottom: 0;
}

.versai-entry__title a {
    color: inherit;
}

.versai-entry__content {
    max-width: var(--versai-reading-width);
}

.versai-entry__content > *:last-child {
    margin-bottom: 0;
}

.versai-error-code {
    margin-bottom: 0.5rem;
    color: var(--versai-color-accent-dark);
    font-size: clamp(4rem, 12vw, 10rem);
    font-weight: 800;
    line-height: 1;
}

/*
 * Global carousel direction contract.
 * Previous is always placed at inline-start and next at inline-end.
 * This automatically maps to right/left in RTL and left/right in LTR.
 */
[data-versai-carousel-control] {
    right: auto !important;
    left: auto !important;
}

[data-versai-carousel-control="previous"] {
    inset-inline-start: var(--versai-carousel-control-offset, 0) !important;
    inset-inline-end: auto !important;
}

[data-versai-carousel-control="next"] {
    inset-inline-start: auto !important;
    inset-inline-end: var(--versai-carousel-control-offset, 0) !important;
}

@media (pointer: coarse) {
    button,
    [role="button"],
    input[type="button"],
    input[type="submit"] {
        min-width: var(--versai-control-min-size);
        min-height: var(--versai-control-min-size);
    }
}
