/* teisės.lt content typography and block styles; front end and editor.
   Colours read the BoltPress tokens (design-tokens.css) with fallbacks. */

:root {
	--ink: var(--boltpress-colors-ink, #16181b);
	--paper: var(--boltpress-colors-paper, #fff);
	--muted: var(--boltpress-colors-muted, #565c64);
	--line: var(--boltpress-colors-line, #d5d9de);
	--wash: var(--boltpress-colors-background-alt, #f3f4f5);
	--accent: var(--boltpress-colors-accent, #0e518d);
	--accent-deep: var(--boltpress-colors-accent-deep, #093a66);
	--accent-soft: var(--boltpress-colors-accent-soft, #e6eef6);
	--amber: var(--boltpress-colors-amber, #e8a300);
	--amber-soft: var(--boltpress-colors-amber-soft, #fdf3d6);
	--font: var(--boltpress-typography-font-family-body, "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
	--fs-xs: var(--boltpress-typography-font-size-xs, .8125rem);
	--fs-s: var(--boltpress-typography-font-size-small, .9375rem);
	--fs-m: var(--boltpress-typography-font-size-normal, 1.125rem);
	--fs-l: var(--boltpress-typography-font-size-large, 1.375rem);
	--fs-xl: var(--boltpress-typography-font-size-x-large, 1.75rem);
	--lh: var(--boltpress-typography-line-height-normal, 1.6);
	--radius: var(--boltpress-border-radius-md, 4px);
	--col: 42rem;   /* reading column: ~70 characters at 18px */
	--wide: 72rem;
	--gutter: clamp(1rem, 4vw, 2rem);
}

body {
	background: var(--paper);
	color: var(--ink);
	font-family: var(--font);
	font-size: var(--fs-m);
	line-height: var(--lh);
	font-kerning: normal;
	-webkit-font-smoothing: antialiased;
}

/* ---- Text ------------------------------------------------------------ */

:where(h1, h2, h3, h4, h5, h6) {
	color: var(--ink);
	font-family: var(--font);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -.01em;
	margin: 2em 0 .55em;
	text-wrap: balance;
}
:where(h1) { font-size: clamp(2.125rem, 1.55rem + 2.2vw, 2.875rem); font-weight: 800; line-height: 1.1; letter-spacing: -.02em; margin-top: 0; }
:where(h2) { font-size: clamp(1.5rem, 1.25rem + 1vw, 1.875rem); }
:where(h3) { font-size: var(--fs-l); }
:where(h4, h5, h6) { font-size: var(--fs-m); }
:where(h2 + h3) { margin-top: 1em; }

:where(p) { margin: 0 0 1.1em; }
:where(ul, ol) { margin: 0 0 1.1em; padding-left: 1.35em; }
:where(li) { margin: .3em 0; }
:where(li)::marker { color: var(--muted); }
:where(ol > li)::marker { font-variant-numeric: tabular-nums; font-weight: 700; }
:where(li > ul, li > ol) { margin: .3em 0 0; }
:where(strong, b) { font-weight: 700; }
:where(code, kbd) { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88em; background: var(--wash); padding: .1em .3em; border-radius: 2px; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--accent-deep); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.is-style-lead,
p.is-style-lead {
	font-size: var(--fs-l);
	line-height: 1.5;
	margin-bottom: 1.4em;
}

/* ---- Notice (amber) and card ---------------------------------------- */

.wp-block-group.is-style-notice {
	background: var(--amber-soft);
	border-left: 5px solid var(--amber);
	padding: 1rem 1.25rem;
	margin: 1.75rem 0;
}
.wp-block-group.is-style-card {
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 1.25rem 1.5rem;
	margin: 1.75rem 0;
}
:is(.is-style-notice, .is-style-card, .teises-cat) :is(.wp-block-group__inner-container, .block-editor-block-list__layout) > :last-child,
:is(.is-style-notice, .is-style-card, .teises-cat) > :last-child { margin-bottom: 0; }
:is(.is-style-notice, .is-style-card) :is(h2, h3, h4):first-child { margin-top: 0; }

/* ---- Steps: an ordered sequence with large counters ----------------- */

.wp-block-list.is-style-steps,
ol.is-style-steps {
	list-style: none;
	counter-reset: teises-step;
	padding-left: 0;
	margin: 2rem 0;
}
.is-style-steps > li {
	counter-increment: teises-step;
	position: relative;
	min-height: 2.5rem;
	margin: 0;
	padding: .2rem 0 1.5rem 3.5rem;
}
.is-style-steps > li::before {
	content: counter(teises-step);
	position: absolute;
	left: 0;
	top: 0;
	width: 2.25rem;
	color: var(--accent);
	font-size: 2rem;
	font-weight: 800;
	line-height: 1;
	text-align: center;
	font-variant-numeric: tabular-nums;
}
.is-style-steps > li:not(:last-child)::after {
	content: "";
	position: absolute;
	left: 1.0625rem;
	top: 2.5rem;
	bottom: .4rem;
	border-left: 2px solid var(--line);
}
.is-style-steps > li > :is(strong, b):first-child { display: block; font-size: var(--fs-l); line-height: 1.3; margin-bottom: .2em; }

/* ---- Tables: scroll sideways inside the figure on narrow screens ---- */

.wp-block-table {
	margin: 2rem 0;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-x: contain;
}
/* Tables with 3+ columns keep a readable width and scroll instead of
   squeezing every column to a few characters on phones. */
.wp-block-table table:has(tr > :nth-child(3)) { min-width: 36rem; }
.wp-block-table table:has(tr > :nth-child(4)) { min-width: 46rem; }
@media (max-width: 48rem) {
	.wp-block-table table.has-fixed-layout { table-layout: auto; }
}
.wp-block-table table {
	border-collapse: collapse;
	width: 100%;
	font-size: var(--fs-s);
	line-height: 1.45;
	font-variant-numeric: tabular-nums;
}
.wp-block-table thead,
.wp-block-table tfoot { border: 0; }
.wp-block-table th,
.wp-block-table td {
	border: 0;
	border-bottom: 1px solid var(--line);
	padding: .65rem .75rem .65rem 0;
	text-align: left;
	vertical-align: top;
}
.wp-block-table :is(th, td) + :is(th, td) { padding-left: .75rem; }
.wp-block-table thead :is(th, td) { border-bottom: 2px solid var(--ink); font-weight: 700; vertical-align: bottom; }
.wp-block-table.is-style-stripes { border-bottom: 0; }
.wp-block-table.is-style-stripes tbody tr:nth-child(odd) { background: var(--wash); }
.wp-block-table.is-style-stripes :is(th, td) { padding-left: .75rem; }
.wp-block-table figcaption { text-align: left; }
@media (max-width: 40rem) {
	.wp-block-table :is(th, td) { min-width: 7.5rem; }
}

/* ---- Details (accordion) and the FAQ wrapper ------------------------ */

.wp-block-details {
	border-top: 1px solid var(--line);
	margin: 0;
	padding: 0;
}
.wp-block-details:not(:has(+ .wp-block-details)) { border-bottom: 1px solid var(--line); margin-bottom: 1.75rem; }
.wp-block-details > summary {
	cursor: pointer;
	display: block;
	list-style: none;
	position: relative;
	padding: .95rem 2.75rem .95rem 0;
	font-weight: 700;
	line-height: 1.4;
}
.wp-block-details > summary::-webkit-details-marker { display: none; }
.wp-block-details > summary::after {
	content: "";
	position: absolute;
	right: .6rem;
	top: 1.2rem;
	width: .55rem;
	height: .55rem;
	border-right: 2px solid var(--accent);
	border-bottom: 2px solid var(--accent);
	transform: rotate(45deg);
	transition: transform .15s ease;
}
.wp-block-details[open] > summary::after { transform: translateY(.3rem) rotate(-135deg); }
.wp-block-details > summary:hover { color: var(--accent); }
.wp-block-details > summary:focus-visible { outline-offset: -3px; }
.wp-block-details[open] { padding-bottom: .6rem; }
.wp-block-details > :not(summary) { margin-top: 0; }
.teises-faq { margin: 2rem 0; }

/* ---- Licence category index ----------------------------------------- */
/* Each card leads with its category code set as a road-information-sign
   plate: traffic-blue field, white inset rule, heavy white letters. */

.teises-cat-index {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
	margin: 2rem 0 2.5rem;
	padding: 1px 0 0 1px;
}
.teises-cat-index > :is(.wp-block-group__inner-container, .block-editor-inner-blocks),
.teises-cat-index > .block-editor-inner-blocks > .block-editor-block-list__layout,
.teises-cat > :is(.wp-block-group__inner-container, .block-editor-inner-blocks),
.teises-cat > .block-editor-inner-blocks > .block-editor-block-list__layout { display: contents; }
.teises-cat {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	margin: -1px 0 0 -1px;
	padding: 1.25rem 1.25rem 1.35rem;
	border: 1px solid var(--line);
	background: var(--paper);
}
.teises-cat:hover,
.teises-cat:focus-within { background: var(--accent-soft); z-index: 1; }
.teises-cat > * { max-width: 100%; }
p.teises-cat__code,
.teises-cat__code {
	box-sizing: border-box;
	max-width: 100%;
	min-width: 3.4rem;
	height: 3.4rem;
	margin: 0 0 .9rem;
	padding: 0 .7rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--accent);
	color: #fff;
	border-radius: 6px;
	box-shadow: inset 0 0 0 3px var(--accent), inset 0 0 0 5px #fff;
	font-size: 1.375rem;
	font-weight: 800;
	line-height: 1;
	letter-spacing: .01em;
	white-space: nowrap;
	font-variant-numeric: lining-nums;
}
.teises-cat :is(h2, h3) {
	font-size: var(--fs-m);
	line-height: 1.3;
	margin: .15rem 0 .3rem;
}
.teises-cat :is(h2, h3) a { color: var(--ink); text-decoration: none; }
.teises-cat :is(h2, h3) a::after { content: ""; position: absolute; inset: 0; }
.teises-cat:hover :is(h2, h3) a { color: var(--accent-deep); text-decoration: underline; }
.teises-cat p:not(.teises-cat__code) { color: var(--muted); font-size: var(--fs-s); line-height: 1.45; margin: 0; }

/* ---- Media, captions, embeds, files --------------------------------- */

.wp-block-image,
.wp-block-embed { margin: 2rem 0; }
.wp-block-image img { height: auto; border-radius: 2px; }
.wp-element-caption,
.wp-block-image figcaption,
.wp-block-embed figcaption {
	color: var(--muted);
	font-size: var(--fs-s);
	line-height: 1.45;
	margin: .6rem 0 0;
	text-align: left;
}
.wp-block-embed iframe { max-width: 100%; }

.wp-block-file {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .75rem 1.25rem;
	margin: 1.75rem 0;
	padding: .9rem 1.1rem;
	border: 1px solid var(--line);
	border-left: 5px solid var(--ink);
	font-size: var(--fs-m);
}
.wp-block-file > a:not(.wp-block-file__button) { font-weight: 700; color: var(--ink); }
.wp-block-file .wp-block-file__button { margin-left: auto; }

/* ---- Buttons, separator, quote --------------------------------------- */

.wp-block-button__link,
.wp-element-button,
.wp-block-file .wp-block-file__button {
	display: inline-block;
	background: var(--accent);
	border: 2px solid var(--accent);
	border-radius: var(--radius);
	color: #fff;
	font-family: var(--font);
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.3;
	padding: .65em 1.15em;
	text-decoration: none;
	cursor: pointer;
}
:is(.wp-block-button__link, .wp-element-button, .wp-block-file__button):hover {
	background: var(--accent-deep);
	border-color: var(--accent-deep);
	color: #fff;
	text-decoration: none;
}
.wp-block-button.is-style-outline > .wp-block-button__link {
	background: transparent;
	color: var(--accent);
}
.wp-block-button.is-style-outline > .wp-block-button__link:hover { background: var(--accent-soft); color: var(--accent-deep); }
.wp-block-buttons { margin: 1.75rem 0; gap: .75rem; }

hr.wp-block-separator,
.wp-block-separator {
	border: 0;
	border-top: 1px solid var(--line);
	height: 0;
	margin: 2.75rem 0;
	opacity: 1;
}
.wp-block-separator.is-style-dots { border-top: 0; }

blockquote,
.wp-block-quote {
	margin: 2rem 0;
	padding: 0 0 0 1.25rem;
	border-left: 3px solid var(--ink);
	font-size: var(--fs-l);
	line-height: 1.5;
}
:is(blockquote, .wp-block-quote) cite {
	display: block;
	margin-top: .6rem;
	color: var(--muted);
	font-size: var(--fs-s);
	font-style: normal;
}
