/* Long text (templates/page.html: main.ub-page, post-content .ub-text): the legal pages, Despre noi and
   any page on the default template. A measure of about 70 characters (42rem at 17 px), headings with
   room above and close to their text, lists, links that wrap, tables that scroll inside their box on
   phones. Wide and full-width blocks still break out. Loaded on pages (functions.php) and in the editor.
   WooCommerce's own pages on this template (the account and its withdrawal form, .ub-text > .woocommerce)
   keep checkout.css's look: none of this applies to them. */

.ub-page { --wp--style--global--content-size: 42rem; }
.ub-page > .wp-block-post-title {
	margin-block-end: 0;
	padding-block-end: clamp(1rem, 2vw, 1.5rem);
	border-block-end: 1px solid var(--wp--preset--color--line);
	font-size: clamp(2rem, 1.4rem + 2.2vw, 3rem);
	letter-spacing: -0.03em;
}
.ub-page > .wp-block-post-title + .ub-text:not(:has(> .woocommerce)) { margin-block-start: clamp(1.5rem, 3vw, 2.25rem); }

.ub-text:not(:has(> .woocommerce)) { font-size: 1.0625rem; line-height: 1.7; }
.ub-text:not(:has(> .woocommerce)) > * { margin-block: 0; }
.ub-text:not(:has(> .woocommerce)) > * + * { margin-block-start: 1.1em; }
.ub-text:not(:has(> .woocommerce)) > :is(h2, h3, h4, h5, h6) { margin-block-start: 2.1em; }
.ub-text:not(:has(> .woocommerce)) > :is(h2, h3, h4, h5, h6) + * { margin-block-start: 0.6em; }
.ub-text:not(:has(> .woocommerce)) > :first-child { margin-block-start: 0; }
.ub-text:not(:has(> .woocommerce)) :is(h2, h3, h4, h5, h6) { line-height: 1.25; text-wrap: balance; }
.ub-text:not(:has(> .woocommerce)) h2 { font-size: clamp(1.375rem, 1.15rem + 0.8vw, 1.75rem); letter-spacing: -0.02em; }
.ub-text:not(:has(> .woocommerce)) h3 { font-size: clamp(1.1875rem, 1.05rem + 0.45vw, 1.375rem); letter-spacing: -0.01em; }
.ub-text:not(:has(> .woocommerce)) :is(h4, h5, h6) { font-size: 1.0625rem; letter-spacing: 0; }
.ub-text:not(:has(> .woocommerce)) p { text-wrap: pretty; }

.ub-text:not(:has(> .woocommerce)) :is(ul, ol) { padding-inline-start: 1.4em; }
.ub-text:not(:has(> .woocommerce)) li + li,
.ub-text:not(:has(> .woocommerce)) li > :is(ul, ol) { margin-block-start: 0.45em; }
.ub-text:not(:has(> .woocommerce)) li::marker { color: var(--wp--preset--color--primary); }
.ub-text:not(:has(> .woocommerce)) ol > li::marker { font-weight: 700; }

.ub-text:not(:has(> .woocommerce)) a { text-decoration-thickness: 1px; text-underline-offset: 0.18em; overflow-wrap: anywhere; }
.ub-text:not(:has(> .woocommerce)) a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.ub-text:not(:has(> .woocommerce)) strong, .ub-text:not(:has(> .woocommerce)) b { color: var(--wp--preset--color--ink); font-weight: 700; }

.ub-text:not(:has(> .woocommerce)) blockquote {
	padding: 0.25rem 0 0.25rem 1.25rem;
	border-inline-start: 3px solid var(--wp--preset--color--accent);
	color: var(--wp--preset--color--muted);
}
.ub-text:not(:has(> .woocommerce)) .wp-block-separator { margin-block: 2.5em; border: 0; border-block-start: 1px solid var(--wp--preset--color--line); }

/* Tables: their own sideways scroll on narrow screens, never the page's */
.ub-text:not(:has(> .woocommerce)) .wp-block-table { overflow-x: auto; }
.ub-text:not(:has(> .woocommerce)) table { inline-size: 100%; border-collapse: collapse; font-size: 0.9375rem; line-height: 1.5; }
.ub-text:not(:has(> .woocommerce)) :is(th, td) { padding: 0.625rem 0.75rem; border: 1px solid var(--wp--preset--color--line); text-align: start; vertical-align: top; }
.ub-text:not(:has(> .woocommerce)) thead th, .ub-text:not(:has(> .woocommerce)) tr > th:first-child { background: var(--wp--preset--color--surface); font-weight: 700; }
.ub-text:not(:has(> .woocommerce)) figcaption { color: var(--wp--preset--color--muted); font-size: 0.875rem; }

@media (max-width: 599px) {
	.ub-text:not(:has(> .woocommerce)) { font-size: 1rem; line-height: 1.65; }
	/* Wide tables keep readable columns and scroll inside their focusable box (inc/text-page.php) */
	.ub-text:not(:has(> .woocommerce)) .wp-block-table table { table-layout: auto; min-inline-size: 36rem; }
	.ub-text:not(:has(> .woocommerce)) .wp-block-table:focus-visible { outline: 2px solid var(--wp--preset--color--primary); outline-offset: 2px; }
}

/* ---- The text page template (templates/page-text.html: the legal pages) ------------------------------
   A header band (pages.css: .ub-phead--text) with the breadcrumb, the title and "Ultima actualizare", then
   the text on the left of the wide column and, from 1024 px, a side column that stays in view under the
   header: the table of contents (ub/page-toc, from 3 H2s) and a small "Ai întrebări?" card with the phone,
   e-mail and hours. On phones and tablets the contents fold above the text and the card follows it.
   Headings land below the sticky header when a contents link is followed (UB Kit's scroll-padding-top). */
.ub-page--text > .ub-textpage { margin-block-start: clamp(2rem, 4vw, 3.5rem); }
.ub-textpage { display: flex; flex-direction: column; gap: 2rem; }
.ub-textpage > *,
.ub-textpage__side > * { margin: 0; }
.ub-textpage__side { display: contents; }
.ub-textpage > .ub-text { order: 1; }
.ub-textpage__help { order: 2; }
.ub-textpage__help {
	padding: 1.25rem 1.5rem;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 16px;
	background: var(--wp--preset--color--surface);
	font-size: 0.9375rem;
	--ub-ic-color: var(--wp--preset--color--primary);
}
.ub-textpage__help > * { margin-block: 0; }
.ub-textpage__help > * + * { margin-block-start: 0.5rem; }
.ub-textpage__help .ub-ic { align-items: center; }
.ub-textpage__help-title { color: var(--wp--preset--color--ink); font-family: var(--wp--preset--font-family--heading); font-size: 1.0625rem; font-weight: 700; }
.ub-textpage__help a { color: var(--wp--preset--color--ink); font-weight: 600; text-decoration: none; }
.ub-textpage__help a:hover { color: var(--wp--preset--color--primary); text-decoration: underline; text-underline-offset: 0.2em; }
/* From 1024 px the two columns span the whole wide column: the text up to 50rem (about 90 characters),
   the side column (up to 20rem) at its right edge, what is left between them. With 44rem + 18rem a
   third of the row stayed empty on the right at 1600 px (colleague's bug1, 2026-10-30). */
@media (min-width: 1024px) {
	.ub-textpage {
		display: grid;
		grid-template-columns: minmax(0, 50rem) minmax(15rem, 20rem);
		justify-content: space-between;
		gap: clamp(3rem, 5vw, 5rem);
		align-items: start;
	}
	.ub-textpage > .ub-text { grid-column: 1; grid-row: 1; }
	.ub-textpage__side {
		display: flex;
		flex-direction: column;
		gap: 2rem;
		grid-column: 2;
		grid-row: 1;
		position: sticky;
		inset-block-start: calc(var(--ub-header-h, 8rem) - var(--ub-topbar-h) + 2rem);
		max-block-size: calc(100vh - var(--ub-header-h, 8rem) + var(--ub-topbar-h) - 4rem);
		overflow-y: auto;
		overscroll-behavior: contain;
	}
}
.ub-page--text .ub-text:not(:has(> .woocommerce)) > h2 { padding-block-start: 0.25rem; }
