/* Study GovData. Everything is scoped to .sg-reader. Colours come from the theme's variables, with system fallbacks, so dark and light follow the site. */
.sg-reader {
	--sg-fg: var(--ink-0, var(--wp--preset--color--contrast, var(--color-text, CanvasText)));
	--sg-bg: var(--bg-0, var(--wp--preset--color--base, var(--color-bg, Canvas)));
	--sg-accent: var(--accent, var(--wp--preset--color--primary, var(--color-primary, LinkText)));
	--sg-paper: color-mix(in srgb, var(--sg-fg) 6%, var(--sg-bg));
	--sg-shade: rgba(0, 0, 0, .35);
	--sg-muted: color-mix(in srgb, var(--sg-fg) 72%, var(--sg-bg));
	--sg-line: color-mix(in srgb, var(--sg-fg) 25%, var(--sg-bg));
	color: var(--sg-fg);
	max-width: 64rem;
	margin: 0 auto;
	padding: 1rem;
	line-height: 1.6;
}
.sg-reader a { color: var(--sg-accent); }
.sg-reader a:focus-visible, .sg-reader button:focus-visible, .sg-reader input:focus-visible, .sg-reader select:focus-visible, .sg-reader textarea:focus-visible {
	outline: 3px solid var(--sg-accent); outline-offset: 2px;
}
.sg-skip { position: absolute; left: -999px; }
.sg-skip:focus { left: 1rem; top: 1rem; z-index: 99999; background: #fff; color: #000; padding: .5rem 1rem; }
.sg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sg-nav a { text-decoration: none; padding: .15rem .1rem; border-bottom: 2px solid transparent; } .sg-nav a:hover { border-bottom-color: var(--sg-accent); }
.sg-nav ul { display: flex; flex-wrap: wrap; gap: .25rem 1rem; list-style: none; margin: 0 0 .5rem; padding: 0; }
.sg-nav { border-bottom: 1px solid var(--sg-line); margin-bottom: 1rem; padding-bottom: .5rem; }
.sg-navsearch { display: inline-flex; gap: .25rem; }
.sg-account { margin: .25rem 0 0; }
.sg-lead { font-size: 1.2em; }
.sg-cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.sg-cards li { border: 1px solid var(--sg-line); padding: .9rem 1.1rem; border-radius: 10px; background: var(--sg-paper); }
.sg-button, .sg-reader button, .sg-reader input[type="submit"] {
	display: inline-block; padding: .45rem .9rem; border: 2px solid var(--sg-accent); border-radius: 6px;
	background: transparent; color: var(--sg-accent); font: inherit; text-decoration: none; cursor: pointer;
}
.sg-button:hover, .sg-reader button:hover { background: var(--sg-accent); color: var(--sg-bg); }
.sg-reader input[type="text"], .sg-reader input[type="search"], .sg-reader input[type="password"], .sg-reader input[type="email"], .sg-reader input[type="number"], .sg-reader select, .sg-reader textarea {
	font: inherit; padding: .35rem .5rem; border: 1px solid var(--sg-fg); background: var(--sg-bg); color: var(--sg-fg); border-radius: 4px; max-width: 100%;
}
.sg-notice { padding: .75rem 1rem; border: 1px solid var(--sg-fg); border-left-width: 6px; margin: 1rem 0; }
.sg-table { width: 100%; border-collapse: collapse; }
.sg-table th, .sg-table td { padding: .35rem .5rem; border-bottom: 1px solid var(--sg-line); text-align: left; vertical-align: top; }
@media (prefers-reduced-motion: reduce) { .sg-reader * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---- reader ---- */
.sg-reader { --sg-size: 1.125rem; --sg-measure: 38rem; }
.sg-fs-1 { --sg-size: 1rem; } .sg-fs-2 { --sg-size: 1.125rem; } .sg-fs-3 { --sg-size: 1.35rem; } .sg-fs-4 { --sg-size: 1.6rem; } .sg-fs-5 { --sg-size: 1.9rem; }
.sg-w-narrow { --sg-measure: 30rem; } .sg-w-medium { --sg-measure: 38rem; } .sg-w-wide { --sg-measure: 52rem; }
.sg-ff-serif .sg-text, .sg-ff-serif .sg-side section { font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; }
.sg-ff-sans .sg-text, .sg-ff-sans .sg-side section { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.sg-ff-dyslexic .sg-text, .sg-ff-dyslexic .sg-side section { font-family: Verdana, Tahoma, sans-serif; letter-spacing: .06em; word-spacing: .16em; line-height: 1.9; }
.sg-th-light { --sg-shade: rgba(0, 0, 0, .22); --sg-fg: #1a1a1a; --sg-bg: #fff; --sg-accent: #0b4f9c; background: var(--sg-bg); }
.sg-th-dark { --sg-fg: #e8e8e8; --sg-bg: #151515; --sg-accent: #8ab8ff; background: var(--sg-bg); }
.sg-th-sepia { --sg-shade: rgba(59, 47, 30, .3); --sg-fg: #3b2f1e; --sg-bg: #f4ecd8; --sg-accent: #7a3e00; background: var(--sg-bg); }
.sg-th-eink { --sg-shade: rgba(0, 0, 0, .5); --sg-fg: #000; --sg-bg: #fff; --sg-accent: #000; background: #fff; }
.sg-th-eink a { text-decoration: underline; } .sg-th-eink * { transition: none !important; }
.sg-crumbs { color: var(--sg-muted); margin: 0 0 .5rem; }
.sg-prefs { margin: .5rem 0 1rem; border: 1px solid var(--sg-line); padding: .5rem .75rem; border-radius: 6px; }
.sg-prefs summary { cursor: pointer; font-weight: 600; }
.sg-pager { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin: .75rem 0; }
.sg-off { opacity: .45; }
.sg-jump { margin-left: auto; display: inline-flex; gap: .25rem; } .sg-jump input { width: 6rem; }
.sg-page { margin: 0 0 1.5rem; padding: 1.25rem 1.5rem; border: 1px solid var(--sg-line); border-radius: 8px; background: var(--sg-paper); }
.sg-pagehead { border-bottom: 1px solid var(--sg-line); padding-bottom: .4rem; display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; color: var(--sg-muted); font-size: .9rem; margin-bottom: .5rem; }
.sg-badge { display: inline-block; padding: 0 .5rem; border: 1px solid currentColor; border-radius: 1rem; font-size: .8rem; color: var(--sg-fg); }
.sg-badge-soft { color: var(--sg-muted); }
.sg-text, .sg-side section { font-size: var(--sg-size); max-width: var(--sg-measure); }
.sg-text p, .sg-side p { margin: 0 0 1em; hyphens: manual; overflow-wrap: anywhere; }
.sg-h { font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; color: var(--sg-muted); }
.sg-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 1.5rem; max-width: none; }
.sg-side section { max-width: none; }
.sg-charts { margin: 1rem 0; } .sg-chart { margin: 1.5rem 0; max-width: 100%; } .sg-chart figcaption { color: var(--sg-muted, inherit); font-size: .9rem; margin-top: .5rem; }
.sg-tablewrap { overflow-x: auto; margin: 1rem 0; max-width: 100%; } .sg-tablewrap:focus { outline: 3px solid var(--sg-accent); }
.sg-figure { margin: 1rem 0; max-width: var(--sg-measure); } .sg-figure img { max-width: 100%; height: auto; display: block; background: #fff; }
.sg-figure figcaption { font-size: .9em; color: var(--sg-muted); }
.sg-marker { font-style: italic; color: var(--sg-muted); }
/* horizontal scroll: one page per screen-width column, snapping */
.sg-pages-horiz { display: flex; gap: 2rem; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 1rem; }
.sg-pages-horiz .sg-page { flex: 0 0 min(100%, calc(var(--sg-measure) + 4rem)); scroll-snap-align: start; border-bottom: 0; max-height: 80vh; overflow-y: auto; padding-right: 1rem; }

/* mode switcher: three links, no JavaScript */
.sg-modes { display: inline-flex; border: 1px solid var(--sg-line); border-radius: 999px; overflow: hidden; margin: 0 0 .75rem; }
.sg-modes a { padding: .35rem .9rem; text-decoration: none; color: var(--sg-fg); }
.sg-modes a + a { border-left: 1px solid var(--sg-line); }
.sg-modes a[aria-current="true"] { background: var(--sg-accent); color: var(--sg-bg); font-weight: 600; }
.sg-hint { color: var(--sg-muted); font-size: .9rem; margin: .25rem 0 .75rem; }

/* page turning: a strip of leaves that snap into place. Drag or swipe sideways. Wide and dual-screen devices show a two-page spread with a crease. */
.sg-m-flip { max-width: 92rem; }
.sg-pages-flip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; border-radius: 10px; box-shadow: 0 8px 28px rgba(0, 0, 0, .3); background: var(--sg-paper); }
.sg-pages-flip .sg-page { flex: 0 0 100%; box-sizing: border-box; scroll-snap-align: start; scroll-snap-stop: always; height: min(78vh, 56rem); overflow-y: auto; margin: 0; padding: 1.75rem 2rem 2.25rem; border: 0; border-radius: 0; background: var(--sg-paper); }
.sg-pages-flip .sg-text, .sg-pages-flip .sg-figure { max-width: none; }
/* while a mouse drags, snapping is paused */
.sg-dragging { scroll-snap-type: none !important; cursor: grabbing; user-select: none; }
.sg-pages-flip, .sg-pages-horiz { cursor: grab; }
@media (min-width: 60rem), (horizontal-viewport-segments: 2) {
	.sg-pages-flip .sg-page { flex-basis: 50%; }
	.sg-pages-flip .sg-page:nth-child(even) { scroll-snap-align: none; }
	.sg-pages-flip .sg-page:nth-child(odd) { background-image: linear-gradient(to left, var(--sg-shade), transparent 3.5rem); padding-right: 3rem; }
	.sg-pages-flip .sg-page:nth-child(even) { background-image: linear-gradient(to right, var(--sg-shade), transparent 3.5rem); padding-left: 3rem; border-left: 1px solid var(--sg-line); }
}
@media (horizontal-viewport-segments: 2) { .sg-m-flip { max-width: none; } .sg-pages-flip { box-shadow: none; border-radius: 0; } }
@media (max-width: 40rem) { .sg-reader { padding: .5rem; } .sg-jump { margin-left: 0; } }
@media print {
	.sg-nav, .sg-prefs, .sg-pager, .sg-skip, .sg-tools { display: none !important; }
	.sg-reader { max-width: none; color: #000; background: #fff; padding: 0; }
	.sg-pages-horiz, .sg-pages-flip { display: block; overflow: visible; box-shadow: none; } .sg-pages-horiz .sg-page, .sg-pages-flip .sg-page { max-height: none; height: auto; overflow: visible; background: none; }
	.sg-modes, .sg-hint { display: none !important; }
	.sg-page { break-inside: auto; border: 0; } .sg-figure, .sg-tablewrap { break-inside: avoid; }
	.sg-text a::after { content: ""; } a { color: #000; text-decoration: none; }
}

/* ---- scan viewer ---- */
.sg-tools { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: .75rem; font-size: .95rem; }
.sg-scan { overflow: auto; max-height: 85vh; border: 1px solid var(--sg-line); background: #fff; }
.sg-scantext { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1.5rem; align-items: start; }
.sg-pdf { width: 100%; height: 80vh; border: 1px solid var(--sg-line); }
.sg-muted { color: var(--sg-muted); }
.sg-results { padding-left: 1.5rem; } .sg-results li { margin-bottom: 1rem; } .sg-results mark { background: color-mix(in srgb, var(--sg-accent) 25%, transparent); color: inherit; }
.sg-filters label { margin-right: .25rem; } .sg-year { width: 6rem; }
.sg-cited { margin-top: 1rem; padding: .5rem 1rem; border: 1px solid var(--sg-line); border-radius: 6px; } .sg-cited h3 { margin: 0 0 .25rem; font-size: 1rem; }
.sg-code { overflow-x: auto; padding: .75rem 1rem; border: 1px solid var(--sg-line); background: color-mix(in srgb, var(--sg-fg) 5%, var(--sg-bg)); font-size: .9rem; white-space: pre-wrap; }
.sg-citation { font-size: 1.1rem; }
.sg-form input { width: min(100%, 24rem); }
.sg-form input[type="checkbox"] { width: auto; }
.sg-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- fix this text ---- */
.sg-markwrap { overflow: auto; max-height: 80vh; border: 1px solid var(--sg-line); background: #fff; margin-bottom: .5rem; }
.sg-markimg { position: relative; } .sg-markimg input[type="image"] { display: block; cursor: crosshair; border: 0; padding: 0; background: #fff; max-width: none; }
.sg-box { position: absolute; border: 3px solid #d00; background: rgba(220, 0, 0, .15); pointer-events: none; box-sizing: border-box; }
.sg-pin { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border: 3px solid #d00; border-radius: 50%; pointer-events: none; box-sizing: border-box; }
.sg-fixform fieldset { border: 1px solid var(--sg-line); } .sg-pct { width: 5.5rem !important; }
.sg-fixform textarea, .sg-fixform select { width: min(100%, 40rem); }
.sg-toc { padding-left: 1.5rem; } .sg-toc a[aria-current] { font-weight: 700; }

/* ---- study navigation: links on the left, search and account on the right, wrapping on small screens ---- */
.sg-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; padding-bottom: .75rem; margin-bottom: 1.5rem; }
.sg-nav ul { flex: 1 1 22rem; margin: 0; gap: .25rem 1.25rem; }
.sg-nav a { padding: .4rem .15rem; }
.sg-navsearch { flex: 0 1 18rem; display: flex; gap: .5rem; }
.sg-navsearch input { flex: 1 1 auto; min-width: 0; }
.sg-account { margin: 0; }

/* ---- search page (spacing on a 0.5rem grid, 2.75rem tall controls, one column on phones) ---- */
.sg-search { display: grid; gap: 1.25rem; max-width: 48rem; margin: 0 0 2rem; }
.sg-search-label { display: block; font-weight: 600; font-size: 1.1rem; margin-bottom: .5rem; }
.sg-search-bar { display: flex; gap: .75rem; align-items: stretch; }
.sg-reader .sg-search-bar input[type="search"] { flex: 1 1 auto; min-width: 0; min-height: 2.75rem; padding: .5rem .9rem; font-size: 1.1rem; border-width: 2px; border-radius: 8px; }
.sg-reader .sg-search-bar button { flex: 0 0 auto; min-height: 2.75rem; padding: .5rem 1.5rem; font-weight: 600; background: var(--sg-accent); color: var(--sg-bg); border-radius: 8px; }
.sg-reader .sg-search-bar button:hover { background: transparent; color: var(--sg-accent); }
.sg-search .sg-hint { margin: .5rem 0 0; }
.sg-refine { border: 1px solid var(--sg-line); border-radius: 10px; background: var(--sg-paper); padding: .25rem 1.25rem; }
.sg-refine > summary { cursor: pointer; padding: .75rem 0; min-height: 1.5rem; font-weight: 600; display: flex; align-items: center; gap: .75rem; }
.sg-refine[open] > summary { border-bottom: 1px solid var(--sg-line); margin-bottom: 1rem; }
.sg-refine-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem 1.5rem; }
.sg-field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; border: 0; padding: 0; margin: 0; }
.sg-field > label, .sg-field > legend { font-weight: 600; font-size: .95rem; padding: 0; }
.sg-reader .sg-field select, .sg-reader .sg-field input { width: 100%; min-height: 2.75rem; box-sizing: border-box; }
.sg-years-row { display: flex; align-items: center; gap: .5rem; margin-top: .35rem; }
.sg-refine-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; margin: 1.25rem 0 1rem; }
.sg-reader .sg-refine-actions button { min-height: 2.75rem; padding: .5rem 1.25rem; border-radius: 8px; }

.sg-results-h { font-size: 1.25rem; margin: 0 0 1rem; }
.sg-results { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 1rem; max-width: 48rem; }
.sg-results > li { padding: 1rem 1.25rem; border: 1px solid var(--sg-line); border-radius: 10px; background: var(--sg-paper); }
.sg-result-title { font-size: 1.1rem; font-weight: 600; }
.sg-results p { margin: .5rem 0 0; }
.sg-results mark { background: color-mix(in srgb, var(--sg-accent) 25%, transparent); color: inherit; padding: 0 .1em; border-radius: 2px; }
.sg-pager a { display: inline-block; padding: .5rem .25rem; }

@media (max-width: 40rem) {
	.sg-nav ul { flex-basis: 100%; }
	.sg-navsearch { flex-basis: 100%; }
	.sg-search-bar { flex-direction: column; }
	.sg-reader .sg-search-bar button { width: 100%; }
	.sg-refine { padding: .25rem 1rem; }
	.sg-refine-grid { grid-template-columns: 1fr; }
	.sg-refine-actions button { width: 100%; }
	.sg-results > li { padding: .9rem 1rem; }
}
