/*
  Toolsite, design F.
  A calm, documentation style look: white pages, one gray working band, one blue accent,
  no shadows, no gradients, corners 4 px on controls and 6 px on panels.

  The custom property names (--s-6, --c-accent, --fs-3 ...) are the same as in the static
  site's globals.css, so tool plugins built from that site's components fit in without change.

  Sections
   1. Tokens
   2. Base
   3. Header, brand, menus
   4. Footer
   5. Page head, breadcrumbs
   6. Prose (post and page content)
   7. Buttons
   8. Cards, lists, pagination
   9. Single post: meta, hero, contents list, try box, related
  10. Patterns (FAQ, note box)
  11. Search form
  12. Phones (640, 375, 320)
  13. Reduced motion, high contrast
*/

/* ------------------------------------------------------------------ 1. Tokens */
:root,
.editor-styles-wrapper {
	/* colour */
	--c-page: #FFFFFF;
	--c-band: #F2F4F6;
	--c-band-line: #E1E5E9;
	--c-ink: #14181D;
	--c-ink-2: #4F5965;
	--c-line: #D9DEE3;
	--c-line-strong: #7F8892; /* 3.26:1 on the band, 3.60:1 on white */
	--c-accent: #0A63AD;
	--c-accent-hover: #08518F;
	--c-accent-press: #064173;
	--c-accent-tint: #E9F1F9;
	--c-on-accent: #FFFFFF;
	--c-disabled-bg: #ECEFF2;
	--c-disabled-ink: #717B86;
	--c-error: #B3261E;
	--c-error-tint: #FBEDEC;
	--c-ad-line: #C3CAD1;

	/* type */
	--font: "Golos Text", "Segoe UI", Arial, sans-serif;
	--fs-1: 48px;
	--fs-2: 36px;
	--fs-3: 24px;
	--fs-4: 18px;
	--fs-5: 16px;
	--fs-6: 14px;
	--lh-tight: 1.1;
	--lh-head: 1.25;
	--lh-body: 1.6;
	--lh-small: 1.5;
	--w-regular: 400;
	--w-medium: 500;
	--w-semi: 600;

	/* space */
	--s-1: 4px;
	--s-2: 8px;
	--s-3: 12px;
	--s-4: 16px;
	--s-5: 24px;
	--s-6: 32px;
	--s-7: 48px;
	--s-8: 64px;
	--s-9: 96px;

	/* shape */
	--r-1: 4px;
	--r-2: 6px;
	--bw: 1px;
	--focus-w: 2px;

	/* layout */
	--wrap: 1184px;      /* 1120 content + 2 x 32 side margins */
	--gutter: 32px;
	--col-gap: 24px;
	--measure: 720px;    /* longest comfortable line of text */
	--header-h: 64px;
	--control-h: 44px;
	--tap: 44px;
}

@media (max-width: 760px) {
	:root,
	.editor-styles-wrapper {
		--fs-1: 34px;
		--fs-2: 28px;
		--fs-3: 22px;
		--gutter: 20px;
		--header-h: 56px;
	}
}

@media (max-width: 340px) {
	:root,
	.editor-styles-wrapper { --gutter: 16px; }
}

/* ------------------------------------------------------------------ 2. Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--c-page);
	color: var(--c-ink);
	font-family: var(--font);
	font-size: var(--fs-5);
	line-height: var(--lh-body);
	font-weight: var(--w-regular);
	font-variant-numeric: tabular-nums;
	-webkit-font-smoothing: antialiased;
	/* A long address inside a sentence breaks instead of making the page wider. */
	overflow-wrap: break-word;
}

.wp-site-blocks { padding: 0; }
.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }

img, video { max-width: 100%; height: auto; }
img { display: block; }
[hidden] { display: none !important; }

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: var(--w-medium); color: var(--c-ink); overflow-wrap: break-word; }
h1 { font-size: var(--fs-2); line-height: var(--lh-tight); letter-spacing: -0.022em; }
h2 { font-size: var(--fs-3); line-height: var(--lh-head); letter-spacing: -0.015em; }
h3 { font-size: var(--fs-5); line-height: var(--lh-head); letter-spacing: -0.008em; font-weight: var(--w-semi); }
h4, h5, h6 { font-size: var(--fs-5); line-height: var(--lh-head); font-weight: var(--w-semi); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
strong, b { font-weight: var(--w-semi); }

a {
	color: var(--c-accent);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}
a:hover { color: var(--c-accent-hover); text-decoration-thickness: 2px; }
a:active { color: var(--c-accent-press); }

/* Focus: a 2 px ring in the accent colour with a 2 px gap, on everything you can reach. */
:focus-visible {
	outline: var(--focus-w) solid var(--c-accent);
	outline-offset: 2px;
	border-radius: var(--r-1);
}
/* <main> has tabindex="-1" so the skip link can move focus into it. It is not a control, so no ring. */
main[tabindex="-1"]:focus { outline: none; }

::selection { background: var(--c-accent-tint); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

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

/* Skip link: off screen until it gets focus. */
.skip {
	position: absolute; left: var(--s-4); top: -100px; z-index: 50;
	padding: var(--s-3) var(--s-4);
	background: var(--c-ink); color: var(--c-page);
	border-radius: var(--r-1); text-decoration: none; font-weight: var(--w-medium);
}
.skip:focus { top: var(--s-3); color: var(--c-page); }

/* Page area. The main element has no padding of its own; sections bring their own. */
.site-main { display: block; min-height: 40vh; padding-bottom: var(--s-8); }

/*
  Page and front page content sits "on the edge": ordinary blocks line up with the left edge of the
  1120 px content area and stay at the text measure; wide blocks (tool plugins) use the full 1120 px;
  full width blocks (the gray tool band) run edge to edge.
*/
.ts-edge { --ts-edge: max(var(--gutter), calc((100% - var(--wrap)) / 2 + var(--gutter))); }
.ts-edge > * {
	max-width: var(--measure);
	margin-left: var(--ts-edge);
	margin-right: var(--gutter);
}
.ts-edge > .alignwide {
	max-width: none;
	margin-left: var(--ts-edge);
	margin-right: var(--ts-edge);
}
.ts-edge > .alignfull {
	max-width: none;
	margin-left: 0;
	margin-right: 0;
}

/* ------------------------------------------------------------------ 3. Header, brand, menus */
.site-header {
	position: relative; z-index: 20;
	background: var(--c-page);
	border-bottom: var(--bw) solid var(--c-line);
}
.header-row {
	display: flex; align-items: center; justify-content: space-between;
	gap: var(--s-6);
	min-height: var(--header-h);
}

/* The site name is plain type: no logo, no box. */
.wp-block-site-title.brand,
.brand {
	margin: 0;
	min-width: 0; max-width: 100%;
	font-size: 21px; font-weight: var(--w-semi); letter-spacing: -0.035em; line-height: 1;
}
.brand a {
	display: inline-flex; align-items: center; min-height: var(--tap);
	color: var(--c-ink); text-decoration: none; overflow-wrap: anywhere;
}
.brand a:hover { color: var(--c-ink); text-decoration: none; }

/* Menus (block toolsite/menu). */
.ts-menu-list { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1); list-style: none; margin: 0; padding: 0; }
.ts-menu-list li { margin: 0; padding: 0; }
.ts-menu-list a {
	display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s-3);
	color: var(--c-ink-2); font-size: var(--fs-6); font-weight: var(--w-medium); text-decoration: none;
	border-radius: var(--r-1);
}
.ts-menu-list a:hover { color: var(--c-ink); background: var(--c-band); text-decoration: none; }
.ts-menu-list .current-menu-item > a,
.ts-menu-list a[aria-current] { color: var(--c-ink); }

/* Wide screens show the list; the details disclosure is for phones (see section 12). */
.ts-menu-disclosure { display: none; }
.ts-menu-button {
	display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s-4);
	background: var(--c-page); color: var(--c-ink);
	border: var(--bw) solid var(--c-line-strong); border-radius: var(--r-1);
	font-size: var(--fs-6); font-weight: var(--w-medium); cursor: pointer; list-style: none;
	user-select: none;
}
.ts-menu-button::-webkit-details-marker { display: none; }
.ts-menu-button:hover { background: var(--c-band); }

/* ------------------------------------------------------------------ 4. Footer */
.site-footer {
	border-top: var(--bw) solid var(--c-line);
	padding: var(--s-8) 0 var(--s-6);
	font-size: var(--fs-6); color: var(--c-ink-2);
}
.footer-grid {
	display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
	column-gap: var(--col-gap); row-gap: var(--s-6);
}
.footer-about { grid-column: 1 / span 6; }
.footer-about p { margin-top: var(--s-2); max-width: 30em; }
.footer-about a { color: var(--c-ink-2); }
.footer-about a:hover { color: var(--c-accent); }

.footer-col { grid-column: span 4; }
.footer-col.footer-legal-menu { grid-column: 9 / span 4; }
.ts-menu-heading {
	margin: 0 0 var(--s-2);
	font-size: var(--fs-6); font-weight: var(--w-semi); letter-spacing: 0; line-height: var(--lh-small);
	color: var(--c-ink);
}
.footer-col .ts-menu-list { display: block; }
.footer-col .ts-menu-list a {
	min-height: var(--tap); min-width: var(--tap); padding: 0;
	color: var(--c-ink-2); font-weight: var(--w-regular); font-size: var(--fs-6);
}
.footer-col .ts-menu-list a:hover { color: var(--c-accent); background: none; text-decoration: underline; }

/* The other sites: a full width row of links, since site names can be long. */
.footer-col.footer-sites { grid-column: 1 / span 12; }
.footer-sites .ts-menu-list { display: flex; flex-wrap: wrap; gap: 0 var(--s-6); }
.footer-sites a { overflow-wrap: anywhere; }

.footer-legal {
	grid-column: 1 / span 12;
	display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2) var(--s-6);
	padding-top: var(--s-5); margin-top: var(--s-4);
	border-top: var(--bw) solid var(--c-line);
}

/* ------------------------------------------------------------------ 5. Page head, breadcrumbs */
.breadcrumb { padding-top: var(--s-2); }
.breadcrumb ol {
	display: flex; flex-wrap: wrap; align-items: center; list-style: none;
	font-size: var(--fs-6); color: var(--c-ink-2);
}
.breadcrumb li { display: inline-flex; align-items: center; margin: 0; }
.breadcrumb li + li::before {
	content: ""; width: 6px; height: 6px; margin: 0 var(--s-3) 0 var(--s-2);
	border-top: 1.5px solid var(--c-line-strong); border-right: 1.5px solid var(--c-line-strong);
	transform: rotate(45deg);
}
.breadcrumb a {
	display: inline-flex; align-items: center; min-height: var(--tap);
	color: var(--c-ink-2); text-decoration: none;
}
.breadcrumb a:hover { color: var(--c-accent); text-decoration: underline; }
.breadcrumb [aria-current] { color: var(--c-ink-2); overflow-wrap: anywhere; }

.page-head { padding-bottom: var(--s-5); }
/* The front page has no breadcrumb, so the heading gets its room here. */
.page-head.no-crumb { padding-top: var(--s-6); }
.page-head h1,
.ts-page-title { font-size: var(--fs-2); line-height: var(--lh-tight); letter-spacing: -0.022em; margin-top: 0; }
.intro { margin-top: var(--s-3); max-width: 860px; color: var(--c-ink-2); }

/* ------------------------------------------------------------------ 6. Prose */
.prose { font-size: var(--fs-5); line-height: var(--lh-body); }
.prose > * + * { margin-top: var(--s-4); }
.prose > :first-child { margin-top: 0; }

.prose h2:not(.tsw-tool *){
	font-size: var(--fs-3); line-height: var(--lh-head); letter-spacing: -0.015em;
	margin-top: var(--s-7); margin-bottom: 0;
	scroll-margin-top: var(--s-6);
}
.prose h2 + *:not(.tsw-tool *){ margin-top: var(--s-3); }
.prose h3:not(.tsw-tool *){ font-size: var(--fs-5); margin-top: var(--s-5); scroll-margin-top: var(--s-6); }
.prose h3 + *:not(.tsw-tool *){ margin-top: var(--s-2); }
.prose h4:not(.tsw-tool *), .prose h5:not(.tsw-tool *), .prose h6:not(.tsw-tool *){ margin-top: var(--s-5); }

/* Links in text are always underlined. */
.prose a:not(.tsw-tool *) { text-decoration: underline; }

.prose ul:not(.tsw-tool *){ list-style: disc; padding-left: var(--s-5); }
.prose ol:not(.tsw-tool *){ list-style: decimal; padding-left: var(--s-5); }
.prose li + li:not(.tsw-tool *){ margin-top: var(--s-2); }
.prose li > ul:not(.tsw-tool *), .prose li > ol:not(.tsw-tool *){ margin-top: var(--s-2); }
.prose li:not(.tsw-tool *)::marker{ color: var(--c-ink-2); }

/* Block quote: a quiet rule on the left, no big quote marks. */
.prose blockquote:not(.tsw-tool *),
.wp-block-quote {
	margin-left: 0; margin-right: 0;
	padding: 0 0 0 var(--s-4);
	border-left: 2px solid var(--c-line-strong);
	color: var(--c-ink-2);
}
.prose blockquote > * + *:not(.tsw-tool *){ margin-top: var(--s-3); }
.prose blockquote cite:not(.tsw-tool *),
.wp-block-quote cite { display: block; margin-top: var(--s-2); font-size: var(--fs-6); font-style: normal; }

/* Code. */
.prose code:not(.tsw-tool *),
.prose kbd:not(.tsw-tool *),
.prose samp:not(.tsw-tool *){
	padding: 1px 5px;
	background: var(--c-band); border: var(--bw) solid var(--c-band-line); border-radius: var(--r-1);
	font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
	font-size: 0.9em;
}
.prose pre:not(.tsw-tool *){
	margin-left: 0; margin-right: 0;
	padding: var(--s-4);
	background: var(--c-band); border: var(--bw) solid var(--c-band-line); border-radius: var(--r-2);
	overflow-x: auto;
	font-size: var(--fs-6); line-height: var(--lh-small);
	white-space: pre; overflow-wrap: normal;
}
.prose pre code:not(.tsw-tool *){ padding: 0; background: none; border: 0; font-size: inherit; }

/* Figures and captions. */
/* Side margins 0, except on wide-edge pages (.ts-edge), where every child keeps the page's left edge. */
.prose figure:not(.ts-edge > *):not(.tsw-tool *) { margin-left: 0; margin-right: 0; }
.prose figure img:not(.tsw-tool *){ border-radius: var(--r-2); }
.prose figcaption:not(.tsw-tool *),
.wp-element-caption {
	margin-top: var(--s-2);
	font-size: var(--fs-6); line-height: var(--lh-small); color: var(--c-ink-2);
	text-align: left;
}
.prose hr:not(.tsw-tool *){
	border: 0; border-top: var(--bw) solid var(--c-line);
	margin-top: var(--s-7); margin-bottom: var(--s-7);
}

/* Tables, set like documentation: header over a strong rule, quiet row lines, scroll inside its own box. */
.prose .wp-block-table:not(.tsw-tool *) { overflow-x: auto; }
.prose .wp-block-table:not(.ts-edge > *):not(.tsw-tool *) { margin-left: 0; margin-right: 0; }
.prose table:not(.tsw-tool *){
	width: 100%; border-collapse: collapse;
	font-size: var(--fs-6); line-height: var(--lh-small);
}
.prose caption:not(.tsw-tool *){ text-align: left; color: var(--c-ink-2); caption-side: bottom; padding-top: var(--s-2); }
.prose th:not(.tsw-tool *), .prose td:not(.tsw-tool *){
	padding: 11px var(--s-4) 11px 0;
	text-align: left; vertical-align: top;
	border: 0; border-bottom: var(--bw) solid var(--c-line);
}
.prose th:last-child:not(.tsw-tool *), .prose td:last-child:not(.tsw-tool *){ padding-right: 0; }
.prose thead:not(.tsw-tool *){ border: 0; }
.prose thead th:not(.tsw-tool *){
	padding-top: 0;
	font-weight: var(--w-medium); color: var(--c-ink-2);
	border-bottom: var(--bw) solid var(--c-line-strong);
	white-space: nowrap;
}
.prose tbody th:not(.tsw-tool *){ font-weight: var(--w-regular); }
.prose tfoot:not(.tsw-tool *){ border: 0; }
.prose tfoot th:not(.tsw-tool *), .prose tfoot td:not(.tsw-tool *){ font-weight: var(--w-semi); border-top: var(--bw) solid var(--c-ink); border-bottom: 0; }
.prose .has-text-align-right:not(.tsw-tool *){ text-align: right; }
.prose .wp-block-table.is-style-stripes:not(.tsw-tool *){ border: 0; }
.prose .wp-block-table.is-style-stripes tbody tr:nth-child(odd):not(.tsw-tool *){ background: none; }
.prose .wp-block-table table:not(.tsw-tool *){ min-width: 460px; }

/* Embedded video and similar. */
.prose .wp-block-embed iframe,
.prose iframe:not(.tsw-tool *){ max-width: 100%; }

/* ------------------------------------------------------------------ 7. Buttons */
.btn,
.wp-block-button__link,
.wp-element-button {
	display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
	min-height: var(--control-h); padding: 0 var(--s-5);
	border: var(--bw) solid transparent; border-radius: var(--r-1);
	font: inherit; font-size: var(--fs-5); font-weight: var(--w-medium); line-height: 1.2;
	text-decoration: none; cursor: pointer;
}
.btn-primary,
.wp-block-button:not(.is-style-outline) > .wp-block-button__link {
	background: var(--c-accent); color: var(--c-on-accent); border-color: var(--c-accent);
}
.btn-primary:hover,
.wp-block-button:not(.is-style-outline) > .wp-block-button__link:hover {
	background: var(--c-accent-hover); border-color: var(--c-accent-hover); color: var(--c-on-accent); text-decoration: none;
}
.btn-primary:active,
.wp-block-button:not(.is-style-outline) > .wp-block-button__link:active {
	background: var(--c-accent-press); border-color: var(--c-accent-press); color: var(--c-on-accent);
}
/* Secondary: white with a strong edge. */
.btn-secondary,
.wp-block-button.is-style-outline > .wp-block-button__link {
	background: var(--c-page); color: var(--c-ink); border: var(--bw) solid var(--c-line-strong);
}
.btn-secondary:hover,
.wp-block-button.is-style-outline > .wp-block-button__link:hover {
	background: var(--c-band); color: var(--c-ink); text-decoration: none;
}
.btn-quiet { background: transparent; color: var(--c-accent); padding: 0 var(--s-3); }
.btn-quiet:hover { background: var(--c-accent-tint); color: var(--c-accent-hover); text-decoration: none; }

.ts-actions { margin-top: var(--s-5); display: flex; flex-wrap: wrap; gap: var(--s-3); }
.ts-actions .wp-block-button { margin: 0; }

/* ------------------------------------------------------------------ 8. Cards, lists, pagination */
.list-area { padding-top: var(--s-4); }

.ts-cards {
	list-style: none; margin: 0; padding: 0;
	display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--s-6) var(--col-gap);
}
.ts-cards > li { margin: 0; }
.ts-card {
	position: relative;
	display: flex; flex-direction: column; height: 100%;
	background: var(--c-page);
	border: var(--bw) solid var(--c-line); border-radius: var(--r-2);
	overflow: hidden;
}
.ts-card .card-media { margin: 0; background: var(--c-band); }
.ts-card .card-media img {
	display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover;
	border-radius: 0;
}
.ts-card .card-body { display: flex; flex-direction: column; flex: 1; padding: var(--s-4) var(--s-4) var(--s-5); }
.ts-card .card-title { font-size: var(--fs-4); line-height: var(--lh-head); font-weight: var(--w-medium); letter-spacing: -0.008em; }
.ts-card .card-title a { color: var(--c-ink); text-decoration: none; }
/* The title link covers the whole card, so the card is one big click target and one tab stop. */
.ts-card .card-title a::after { content: ""; position: absolute; inset: 0; }
.ts-card:hover .card-title a { color: var(--c-accent); text-decoration: underline; }
.ts-card .card-title a:focus-visible { outline: none; }
.ts-card:has(.card-title a:focus-visible) { outline: var(--focus-w) solid var(--c-accent); outline-offset: 2px; }
.ts-card .card-excerpt { margin-top: var(--s-2); color: var(--c-ink-2); font-size: var(--fs-6); line-height: var(--lh-small); }
.ts-card .card-excerpt p { margin: 0; }
.ts-card .card-date { display: block; margin-top: auto; padding-top: var(--s-3); color: var(--c-ink-2); font-size: var(--fs-6); }

/* Archive, search and fallback lists: ruled rows. */
.ts-list { list-style: none; margin: 0; padding: 0; border-top: var(--bw) solid var(--c-ink); max-width: var(--measure); }
.ts-list > li { margin: 0; padding: var(--s-5) 0; border-bottom: var(--bw) solid var(--c-line); }
.ts-list .list-title { font-size: var(--fs-4); font-weight: var(--w-medium); line-height: var(--lh-head); }
.ts-list .list-title a { color: var(--c-ink); text-decoration: none; }
.ts-list .list-title a:hover { color: var(--c-accent); text-decoration: underline; }
.ts-list .list-excerpt { margin-top: var(--s-2); color: var(--c-ink-2); }
.ts-list .list-excerpt p { margin: 0; }
.ts-list .list-date { margin-top: var(--s-2); color: var(--c-ink-2); font-size: var(--fs-6); }

/* Pagination. */
.ts-pagination,
.wp-block-query-pagination {
	display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
	margin-top: var(--s-7);
	font-size: var(--fs-6);
}
.wp-block-query-pagination > * { margin: 0; }
.wp-block-query-pagination-numbers { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.wp-block-query-pagination a,
.wp-block-query-pagination .page-numbers {
	display: inline-flex; align-items: center; justify-content: center;
	min-height: var(--tap); min-width: var(--tap); padding: 0 var(--s-3);
	color: var(--c-ink); text-decoration: none; font-weight: var(--w-medium);
	border: var(--bw) solid var(--c-line-strong); border-radius: var(--r-1); background: var(--c-page);
}
.wp-block-query-pagination a:hover { background: var(--c-band); color: var(--c-ink); }
.wp-block-query-pagination .page-numbers.current {
	background: var(--c-accent); border-color: var(--c-accent); color: var(--c-on-accent);
}
.wp-block-query-pagination .page-numbers.dots { border-color: transparent; }

/* ------------------------------------------------------------------ 9. Single post */
.single-head h1 { max-width: 860px; }

/* Meta line: published, updated, author, reading time. */
.tsw-meta {
	display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-5);
	margin-top: var(--s-3);
	font-size: var(--fs-6); line-height: var(--lh-small); color: var(--c-ink-2);
}
.tsw-meta > * { margin: 0; }
.tsw-meta .tsw-label { color: var(--c-ink-2); }
.tsw-meta time { color: var(--c-ink); }
.tsw-meta .wp-block-post-author-name { color: var(--c-ink); }

.tsw-hero { margin: var(--s-5) 0 0; }
.tsw-hero img { display: block; width: 100%; height: auto; border-radius: var(--r-2); }

.single-body { padding-top: var(--s-6); }
.single-body > * { max-width: var(--measure); }
.single-body > * + * { margin-top: var(--s-6); }
.single-body > .prose { margin-top: var(--s-6); }

/* Contents list (block toolsite/toc). */
.ts-toc {
	padding: var(--s-4) var(--s-5);
	background: var(--c-band); border: var(--bw) solid var(--c-band-line); border-radius: var(--r-2);
}
.ts-toc-title { margin: 0 0 var(--s-2); font-size: var(--fs-6); font-weight: var(--w-semi); color: var(--c-ink); }
.ts-toc ol { list-style: none; margin: 0; padding: 0; }
.ts-toc li { margin: 0; }
.ts-toc a {
	display: flex; align-items: center; min-height: 36px; padding: 4px 0;
	color: var(--c-ink-2); text-decoration: none; font-size: var(--fs-6); line-height: 1.35;
}
.ts-toc a:hover { color: var(--c-accent); text-decoration: underline; }

/* Try the tool box (block toolsite/try-tool). */
.ts-try {
	padding: var(--s-5);
	background: var(--c-band); border: var(--bw) solid var(--c-band-line); border-radius: var(--r-2);
}
.ts-try-title { font-size: var(--fs-3); line-height: var(--lh-head); }
.ts-try-text { margin: var(--s-2) 0 var(--s-4); color: var(--c-ink-2); }
.ts-try .btn { text-align: center; }

/* Related posts (block toolsite/related-posts). */
.single-related { padding-top: var(--s-8); }
.ts-related { padding-top: var(--s-7); border-top: var(--bw) solid var(--c-line); }
.ts-related-title { font-size: var(--fs-3); margin-bottom: var(--s-5); }

/* ------------------------------------------------------------------ 10. Patterns */
/* Questions and answers: a ruled list of native disclosures. */
.tsw-faq > .wp-block-heading { margin-bottom: var(--s-4); }
.tsw-faq .wp-block-details {
	border-bottom: var(--bw) solid var(--c-line);
	margin: 0;
}
.tsw-faq .wp-block-details:first-of-type { border-top: var(--bw) solid var(--c-ink); }
.tsw-faq .wp-block-details + .wp-block-details { margin-top: 0; }
.tsw-faq summary {
	display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
	min-height: 64px; padding: var(--s-3) 0;
	cursor: pointer; list-style: none;
	font-weight: var(--w-medium); font-size: var(--fs-4); line-height: var(--lh-head);
}
.tsw-faq summary::-webkit-details-marker { display: none; }
.tsw-faq summary::after {
	content: ""; flex: none; width: 8px; height: 8px; margin-right: 4px;
	border-right: 1.5px solid var(--c-ink-2); border-bottom: 1.5px solid var(--c-ink-2);
	transform: rotate(45deg); transition: transform 120ms ease;
}
.tsw-faq details[open] > summary::after { transform: rotate(-135deg); }
.tsw-faq summary:hover { color: var(--c-accent); }
.tsw-faq summary:focus-visible { outline-offset: -2px; }
.tsw-faq details > :not(summary) { color: var(--c-ink-2); max-width: 680px; }
.tsw-faq details > p:last-child { padding-bottom: var(--s-5); }
.tsw-faq details > p { margin-top: 0; }

/* Note box. */
.tsw-note {
	padding: var(--s-4) var(--s-5);
	background: var(--c-band); border: var(--bw) solid var(--c-band-line); border-radius: var(--r-2);
	color: var(--c-ink);
}
.tsw-note > * + * { margin-top: var(--s-3); }

/* ------------------------------------------------------------------ 11. Search form */
.ts-search { margin-top: var(--s-4); max-width: 520px; }
.ts-search .wp-block-search__inside-wrapper { display: flex; gap: var(--s-2); }
.ts-search .wp-block-search__input {
	flex: 1; min-width: 0; height: var(--control-h); padding: 0 var(--s-3);
	font: inherit; font-size: var(--fs-5); color: var(--c-ink); background: var(--c-page);
	border: var(--bw) solid var(--c-line-strong); border-radius: var(--r-1);
}
.ts-search .wp-block-search__input:hover { border-color: var(--c-ink-2); }
.ts-search .wp-block-search__input:focus-visible { outline: var(--focus-w) solid var(--c-accent); outline-offset: 2px; border-color: var(--c-accent); }
.ts-search .wp-block-search__button { margin: 0; }

/* ------------------------------------------------------------------ 12. Wide and phone layouts */
@media (max-width: 1080px) {
	.ts-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
	.footer-about { grid-column: 1 / span 12; }
	.footer-col, .footer-col.footer-legal-menu { grid-column: 1 / span 12; }
}

/* Under 640 px the header list becomes a "Menu" button that opens a panel (no JavaScript needed). */
@media (max-width: 639px) {
	.header-row { gap: var(--s-3); }
	.header-row .ts-menu-wide { display: none; }
	.header-row .ts-menu-disclosure { display: block; }
	.header-row .ts-menu-disclosure .ts-menu-list {
		position: absolute; left: 0; right: 0; top: 100%;
		display: block;
		padding: var(--s-2) var(--gutter) var(--s-4);
		background: var(--c-page);
		border-bottom: var(--bw) solid var(--c-line);
	}
	.header-row .ts-menu-disclosure .ts-menu-list a {
		display: flex; min-height: 48px; padding: 0 var(--s-2);
		font-size: var(--fs-5); color: var(--c-ink);
	}
	.header-row .ts-menu-disclosure .ts-menu-list li + li { border-top: var(--bw) solid var(--c-line); }
	/* Long domains (cardprocessingfeecalculator.com) must fit beside the Menu button at 320 px;
	   if they still do not, they break before the dot (a <wbr> added by the theme), not mid-word. */
	.wp-block-site-title.brand,
	.brand { font-size: clamp(13px, 3.9vw, 21px); line-height: 1.2; }
	.header-row { gap: var(--s-3); }
	.brand a { overflow-wrap: normal; }

	.ts-cards { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
	.site-main { padding-bottom: var(--s-7); }
	.prose h2:not(.tsw-tool *){ margin-top: var(--s-6); }
	.site-footer { padding-top: var(--s-7); }
	.tsw-hero img { border-radius: var(--r-1); }
	.single-related { padding-top: var(--s-7); }
	.ts-related { padding-top: var(--s-6); }
	.ts-try .btn,
	.ts-actions .wp-block-button,
	.ts-actions .wp-block-button__link { width: 100%; }
	/* A link that stands alone (the only thing in a list item or paragraph, such as "Report a
	   problem with this tool") gets a 44 px touch target on phones, as in design F. Links inside
	   running text keep their normal line. */
	.prose a.ts-lone-link:not(.tsw-tool *) {
		display: inline-flex; align-items: center; min-height: var(--tap, 44px);
	}
}

/* 375 px phones: touch targets stay at 44 px and nothing runs wider than the screen. */
@media (max-width: 375px) {
	.prose { font-size: var(--fs-5); }
	.ts-toc { padding: var(--s-3) var(--s-4); }
	.ts-toc a { min-height: var(--tap); }
	.tsw-meta { gap: var(--s-1) var(--s-4); }
	.ts-pagination, .wp-block-query-pagination { gap: var(--s-1); }
	.ts-search .wp-block-search__inside-wrapper { flex-direction: column; }
	.ts-search .wp-block-search__button { width: 100%; }
}

/* 320 px phones: the smallest screen the design supports. */
@media (max-width: 340px) {
	.header-row { gap: var(--s-2); }
	.ts-menu-button { padding: 0 var(--s-3); }
	.footer-sites .ts-menu-list { gap: 0 var(--s-4); }
	.tsw-faq summary { font-size: var(--fs-5); }
	.ts-try, .tsw-note { padding: var(--s-4); }
}

/* ------------------------------------------------------------------ 13. Reduced motion, high contrast */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		transition: none !important;
		animation: none !important;
		scroll-behavior: auto !important;
	}
}

/* Windows high contrast (forced colors): borders and rings use system colours so nothing disappears. */
@media (forced-colors: active) {
	:focus-visible { outline: 2px solid Highlight; }
	.btn,
	.wp-block-button__link { border: 1px solid ButtonText; }
	.ts-menu-button,
	.ts-card,
	.ts-toc,
	.ts-try,
	.tsw-note,
	.wp-block-query-pagination a,
	.wp-block-query-pagination .page-numbers { border: 1px solid CanvasText; }
	.wp-block-query-pagination .page-numbers.current { border-color: Highlight; }
	.breadcrumb li + li::before { border-color: CanvasText; }
	.tsw-faq summary::after { border-color: CanvasText; }
	.prose blockquote:not(.tsw-tool *), .wp-block-quote { border-left-color: CanvasText; }
	.prose th:not(.tsw-tool *), .prose td:not(.tsw-tool *){ border-bottom-color: CanvasText; }
	.ts-list > li { border-bottom-color: CanvasText; }
	.site-header, .site-footer, .footer-legal, .ts-related { border-color: CanvasText; }
	.ts-card:has(.card-title a:focus-visible) { outline-color: Highlight; }
}

/* ------------------------------------------------------------------ Page edge, last word
   On wide-edge pages (.ts-edge: the home page and the other tool pages) every block keeps the
   text column, whatever its own margins say (code blocks, quotes, figures, tables, separators).
   Wide and full-width blocks keep their own rules above. Found on the chat and CSV sites. */
.prose.ts-edge > *:not(.alignwide):not(.alignfull) {
	margin-left: var(--ts-edge);
	margin-right: var(--gutter);
}
