/*
 * Base typography and layout. Uses only tokens from the active theme (themes/<name>/tokens.css).
 * Art direction rules (D-051): justified prose with a comfortable measure, clear type scale,
 * 4px spacing rhythm, generous whitespace, restrained motion.
 */

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

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

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: calc(var(--step-0) * var(--font-body-scale, 1));
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    color: var(--color-text);
    background: var(--color-bg);
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
    text-align: start; /* headings are never justified (docs/DESIGN-STANDARDS.md 1) */
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
    line-height: var(--leading-heading);
    color: var(--color-heading);
    margin: 0 0 var(--space-4);
    text-wrap: balance;
}

h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p {
    margin: 0 0 var(--space-4);
}

/*
 * Owner standard, permanent (docs/DESIGN-STANDARDS.md 1, 21 Aban 1405): Persian paragraph text is justified
 * with its last line at the start (right). One place for the whole site and every theme. A one-line text looks
 * the same either way, so this never hurts labels written as <p>. Headings, buttons, menus, labels, table cells,
 * form fields and captions are not paragraphs and are not touched. A block that the approved design centres
 * (a short intro under a centred heading) sets --p-align and --p-align-last to center; nothing else may opt out.
 * Narrow columns: never drop justify; fix wide gaps with column width or spacing.
 */
p,
dd,
blockquote,
.prose li,
.richtext li {
    text-align: var(--p-align, justify);
    text-align-last: var(--p-align-last, start);
    text-justify: inter-word;
}

/* Blocks the approved designs centre on purpose (short one- or two-line texts). */
.links-page,
.doctor-card {
    --p-align: center;
    --p-align-last: center;
}

a {
    color: var(--color-primary);
    text-underline-offset: 0.25em;
}

a:hover {
    color: var(--color-primary-strong);
}

img,
svg,
video {
    max-width: 100%;
    height: auto;
}

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

/* Long-form text: justified, readable measure; never used for UI labels or headings. */
.prose {
    max-width: var(--measure);
}


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

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

.section--alt {
    background: var(--color-bg-alt);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Numbers and phone numbers keep their reading order inside RTL text. */
.ltr {
    direction: ltr;
    unicode-bidi: isolate;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
