/* =========================================================================
   THEORYS — LEGAL CENTER
   Loaded only on the Legal Center index and the eight document pages
   (thr_legal_assets() in theorys-legal.php), on top of theorys-shop.css.

   Every colour, radius and face comes from the brand tokens in style.css, so a
   legal page reads as the same website as the catalogue rather than as a
   pasted-in text dump. Two rules of the house style matter here:

   1. theorys-shop.css declares `.thr-shell h1,h2,h3,h4 { color: var(--ink) }`
      at specificity (0,1,1), which beats any single-class selector. Anything
      that needs a different heading colour is therefore written with a matching
      or higher-specificity selector — see the callout and card rules below.
   2. Storefront out-specifies the child theme on links inside the content area,
      so prose links are set with `.thr-legal-prose a` plus the `.thr-shell`
      prefix where Storefront competes.
   ========================================================================= */

/* Sticky header is 68px, and the announcement bar scrolls away above it, so a
   deep-linked section needs to clear the header only. */
.thr-legal :target,
.thr-legal-section { scroll-margin-top: 92px; }

/* ---------- 1. DOCUMENT HEAD --------------------------------------------- */

.thr-legal-head {
	background: var(--white);
	padding: 40px 0 30px;
	border-bottom: 1px solid var(--line);
}
.thr-legal-crumbs { margin-bottom: 18px; }
.thr-legal-title {
	font-size: clamp(29px, 4.6vw, 44px);
	line-height: 1.06;
	margin: 0 0 14px;
	max-width: 22ch;
}
.thr-legal-blurb { max-width: 68ch; }

.thr-legal-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 40px;
	margin: 26px 0 0;
}
.thr-legal-meta-item { min-width: 0; }
.thr-legal-meta dt {
	font-family: var(--font-head);
	font-size: 10.5px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--platinum-lo);
	margin: 0 0 4px;
	font-weight: 600;
}
.thr-legal-meta dd {
	margin: 0;
	font-size: 14px;
	color: var(--ink);
}
.thr-legal-meta dd code,
.thr-legal-foot-note code,
.thr-legal-card-ver code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12.5px;
	background: var(--off-white);
	border: 1px solid var(--line);
	border-radius: 6px;
	padding: 2px 7px;
	color: var(--forest-deep);
}

/* ---------- 2. LAYOUT ---------------------------------------------------- */

.thr-legal-layout,
.thr-legal-index-wrap { padding-top: 34px; padding-bottom: 72px; }

@media (min-width: 1024px) {
	.thr-legal-layout {
		display: grid;
		grid-template-columns: 262px minmax(0, 1fr);
		gap: 56px;
		align-items: start;
		padding-top: 44px;
	}
}

/* ---------- 3. TABLE OF CONTENTS ----------------------------------------- */

/* <details> so the list collapses on narrow screens (theorys-legal.js closes it
   below 1024px on load) without a second markup path for desktop. */
.thr-legal-toc {
	background: var(--off-white);
	border: 1px solid var(--line);
	border-radius: 14px;
	padding: 4px 18px 8px;
	margin: 0 0 30px;
}
.thr-legal-toc-summary {
	display: flex;
	align-items: center;
	gap: 10px;
	font-family: var(--font-head);
	font-size: 11.5px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--forest-mid);
	font-weight: 600;
	padding: 14px 0;
	cursor: pointer;
	/* The default disclosure triangle sits flush against the text and cannot be
	   spaced with letter-spacing inherited from the label, so it is replaced with
	   a chevron that rotates with the open state. */
	list-style: none;
}
.thr-legal-toc-summary::-webkit-details-marker { display: none; }
.thr-legal-toc-summary::before {
	content: "";
	width: 7px;
	height: 7px;
	flex: none;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg) translate(-1px, -1px);
	transition: transform .15s ease;
}
.thr-legal-toc[open] .thr-legal-toc-summary::before {
	transform: rotate(-135deg) translate(-1px, -1px);
}
.thr-legal-toc-summary:focus-visible { outline: 2px solid var(--forest-mid); outline-offset: 3px; }
.thr-legal-toc-list {
	list-style: none;
	margin: 0 0 10px;
	padding: 0;
	counter-reset: none;
}
.thr-legal-toc-list li { margin: 0; }
.thr-legal-toc-list a {
	display: grid;
	grid-template-columns: 22px minmax(0, 1fr);
	gap: 8px;
	padding: 7px 8px 7px 0;
	font-size: 13.5px;
	line-height: 1.45;
	color: #4b544e;
	text-decoration: none;
	border-radius: 8px;
}
.thr-legal-toc-list a:hover { color: var(--forest-deep); }
.thr-legal-toc-n {
	font-family: var(--font-head);
	font-size: 11.5px;
	color: var(--platinum-lo);
	padding-top: 2px;
}
.thr-legal-toc-list a.is-current { color: var(--forest-deep); font-weight: 600; }
.thr-legal-toc-list a.is-current .thr-legal-toc-n { color: var(--forest-mid); }

@media (min-width: 1024px) {
	.thr-legal-toc {
		position: sticky;
		top: 92px;
		margin: 0;
		max-height: calc(100vh - 120px);
		overflow-y: auto;
	}
}

/* ---------- 4. RESEARCH-USE CALLOUT ------------------------------------- */

.thr-legal-ruo {
	background: var(--forest-deep);
	border-radius: 16px;
	padding: 24px 26px;
	margin: 0 0 40px;
}
.thr-legal-ruo-head {
	font-family: var(--font-head);
	font-size: 13px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	font-weight: 600;
	color: var(--white);
	margin: 0 0 10px;
}
.thr-legal-ruo-body {
	margin: 0;
	font-size: 14.5px;
	line-height: 1.65;
	color: rgba(255, 255, 255, 0.86);
	max-width: 76ch;
}

/* ---------- 5. SECTIONS + PROSE ----------------------------------------- */

.thr-legal-section { margin: 0 0 40px; }
.thr-legal-h2 {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 12px;
	align-items: baseline;
	font-size: clamp(19px, 2.4vw, 23px);
	line-height: 1.25;
	margin: 0 0 14px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--line);
}
.thr-legal-h2-n { color: var(--forest-mid); font-variant-numeric: tabular-nums; }

.thr-legal-prose { max-width: 74ch; }
.thr-legal-prose p,
.thr-legal-prose li {
	font-size: 15.5px;
	line-height: 1.72;
	color: #333b36;
}
.thr-legal-prose p { margin: 0 0 15px; }
.thr-legal-prose > :last-child { margin-bottom: 0; }
.thr-legal-prose ul,
.thr-legal-prose ol { margin: 0 0 16px; padding-left: 22px; }
.thr-legal-prose li { margin: 0 0 8px; }
.thr-legal-prose ul { list-style: disc; }
.thr-legal-prose ol { list-style: decimal; }
.thr-legal-prose ul ul,
.thr-legal-prose ol ol { margin: 8px 0 0; }
.thr-legal-prose strong { color: var(--ink); font-weight: 600; }
.thr-legal-prose h3 {
	font-family: var(--font-head);
	font-size: 16px;
	font-weight: 600;
	letter-spacing: -0.01em;
	margin: 26px 0 10px;
	color: var(--ink);
}
.thr-shell .thr-legal-prose a,
.thr-legal-prose a {
	color: var(--forest-mid);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}
.thr-shell .thr-legal-prose a:hover,
.thr-legal-prose a:hover { color: var(--forest-deep); }

/* An in-document emphasis block: the research-use restriction, the
   all-sales-final rule, the arbitration notice. Deliberately not the same
   treatment as the dark callout at the top, which is site-wide boilerplate. */
.thr-legal-prose .thr-legal-strong {
	background: var(--off-white);
	border-left: 3px solid var(--forest-mid);
	border-radius: 0 12px 12px 0;
	padding: 16px 20px;
	margin: 0 0 18px;
}
.thr-legal-prose .thr-legal-strong p:last-child { margin-bottom: 0; }
.thr-legal-prose .thr-legal-caps {
	font-family: var(--font-head);
	font-size: 13.5px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--ink);
	font-weight: 600;
	line-height: 1.55;
}

/* Unconfirmed business facts. Loud on purpose — a placeholder nobody notices in
   a live policy is worse than one that interrupts the page. */
.thr-legal-tbd {
	background: #FFF3CD;
	border: 1px dashed #B8860B;
	border-radius: 6px;
	padding: 1px 6px;
	color: #6B4E00;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.88em;
	letter-spacing: 0.01em;
	white-space: normal;
}

/* Tables (cookie inventory, retention schedule). Scroll rather than squash. */
.thr-legal-table-wrap { overflow-x: auto; margin: 0 0 20px; -webkit-overflow-scrolling: touch; }
.thr-legal-prose table {
	width: 100%;
	/* 720, not 560: at 560 the four columns squeeze the Purpose cell to about
	   160px, which wraps every entry into six or seven lines and leaves rows
	   ~200px tall with mostly whitespace on a phone. Wider columns mean a longer
	   horizontal scroll but far shorter rows, which reads better. */
	min-width: 720px;
	border-collapse: collapse;
	font-size: 14px;
	background: var(--white);
}
.thr-legal-prose th,
.thr-legal-prose td {
	text-align: left;
	vertical-align: top;
	padding: 11px 14px;
	border: 1px solid var(--line);
	line-height: 1.55;
	color: #333b36;
}
.thr-legal-prose th {
	font-family: var(--font-head);
	font-size: 11.5px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--forest-deep);
	background: var(--off-white);
	font-weight: 600;
}

/* Only worth saying where the table actually overflows. */
.thr-legal-table-hint { display: none; }
@media (max-width: 900px) {
	.thr-legal-prose .thr-legal-table-hint {
		display: block;
		margin: -12px 0 20px;
		font-size: 12.5px;
		color: var(--platinum-lo);
	}
}

.thr-legal-foot-note {
	margin: 44px 0 0;
	padding-top: 20px;
	border-top: 1px solid var(--line);
	font-size: 13px;
	line-height: 1.7;
	color: var(--platinum-lo);
}
.thr-legal-top { margin: 16px 0 0; font-size: 13px; }
.thr-shell .thr-legal-top a { color: var(--forest-mid); text-decoration: none; }
.thr-shell .thr-legal-top a:hover { text-decoration: underline; }

/* ---------- 6. RELATED DOCUMENTS ---------------------------------------- */

.thr-legal-related { margin: 56px 0 0; padding-top: 34px; border-top: 1px solid var(--line); }
.thr-legal-related-title {
	font-size: 13px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--platinum-lo);
	font-weight: 600;
	margin: 0 0 18px;
}
.thr-shell .thr-legal-related .thr-legal-related-title { color: var(--platinum-lo); }
.thr-legal-related-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
}
.thr-legal-related-list a {
	display: block;
	padding: 15px 18px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: var(--white);
	text-decoration: none;
	transition: border-color .15s ease, transform .15s ease;
}
.thr-legal-related-list a:hover { border-color: var(--forest-mid); transform: translateY(-1px); }
.thr-legal-related-name {
	display: block;
	font-family: var(--font-head);
	font-size: 15px;
	font-weight: 600;
	color: var(--ink);
	margin-bottom: 4px;
}
.thr-legal-related-blurb {
	display: block;
	font-size: 13px;
	line-height: 1.6;
	color: #5b6660;
}
.thr-legal-related-all { margin: 22px 0 0; }

@media (min-width: 700px) {
	.thr-legal-related-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- 7. INDEX CARDS ---------------------------------------------- */

.thr-legal-cards {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
	counter-reset: thrlegal;
}
.thr-legal-card { counter-increment: thrlegal; }
.thr-legal-card-link {
	display: flex;
	flex-direction: column;
	height: 100%;
	padding: 24px 24px 22px;
	border: 1px solid var(--line);
	border-radius: 16px;
	background: var(--white);
	text-decoration: none;
	transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.thr-legal-card-link:hover {
	border-color: var(--forest-mid);
	transform: translateY(-2px);
	box-shadow: 0 10px 30px rgba(14, 18, 15, 0.06);
}
.thr-legal-card-title {
	font-size: 18.5px;
	line-height: 1.25;
	margin: 0 0 10px;
	padding-left: 30px;
	position: relative;
}
.thr-legal-card-title::before {
	content: counter(thrlegal);
	position: absolute;
	left: 0;
	top: 1px;
	font-family: var(--font-head);
	font-size: 12px;
	font-weight: 600;
	color: var(--forest-mid);
	letter-spacing: 0.06em;
}
.thr-legal-card-blurb {
	margin: 0 0 16px;
	font-size: 14.5px;
	line-height: 1.65;
	color: #4b544e;
	flex: 1 1 auto;
}
.thr-legal-card-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
	margin: 0 0 14px;
	font-size: 12.5px;
	color: var(--platinum-lo);
}
.thr-legal-card-cta {
	font-family: var(--font-head);
	font-size: 13.5px;
	font-weight: 500;
	color: var(--forest-deep);
}
.thr-legal-card-link:hover .thr-legal-card-cta { color: var(--forest-mid); }

.thr-legal-notes { margin: 56px 0 0; padding-top: 34px; border-top: 1px solid var(--line); }

@media (min-width: 760px) {
	.thr-legal-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- 8. MOBILE --------------------------------------------------- */

@media (max-width: 767px) {
	.thr-legal-head { padding: 28px 0 24px; }
	.thr-legal-title { max-width: none; }
	.thr-legal-meta { gap: 14px 26px; margin-top: 20px; }
	.thr-legal-ruo { padding: 20px; border-radius: 14px; }
	.thr-legal-h2 { grid-template-columns: 1fr; gap: 2px; }
	.thr-legal-h2-n { font-size: 12px; letter-spacing: 0.1em; }
	.thr-legal-prose p, .thr-legal-prose li { font-size: 15px; }
	.thr-legal-layout, .thr-legal-index-wrap { padding-bottom: 52px; }
	.thr-legal-card-link { padding: 20px; }
}

/* ---------- 9. PRINT ---------------------------------------------------- */

@media print {
	.thr-announce, .thr-header, .thr-footer, .thr-legal-toc,
	.thr-legal-related, .thr-legal-top, .thr-legal-crumbs, #thr-ruo { display: none !important; }
	.thr-legal-layout { display: block; }
	.thr-legal-prose p, .thr-legal-prose li { font-size: 11pt; color: #000; }
	.thr-legal-ruo { background: none; border: 2px solid #000; }
	.thr-legal-ruo-head, .thr-legal-ruo-body { color: #000; }
	.thr-legal-tbd { background: none; }
	.thr-legal-section { page-break-inside: auto; }
	.thr-legal-h2 { page-break-after: avoid; }
}
