/**
 * Sam4Tech — Legal document styles.
 *
 * Loaded only on the Legal Document template (Privacy Policy, Terms of Service,
 * Cookie Policy, Accessibility Statement). Uses the design tokens and shared
 * marketing primitives from style.css.
 *
 * CONTENTS
 *   1. Document header
 *   2. Body layout & sticky contents list
 *   3. Document typography
 *   4. Foot — questions panel & related policies
 *   5. Responsive
 *   6. Motion & print
 */

/* ==========================================================================
   1. Document header
   ========================================================================== */

.s4t-legal-hero {
	padding-block: clamp(3rem, 6vw, var(--s4t-space-9)) clamp(2rem, 4vw, var(--s4t-space-7));
}

.s4t-legal-hero__inner {
	max-width: 720px;
}

.s4t-legal-hero .s4t-eyebrow {
	margin-block-end: var(--s4t-space-4);
}

.s4t-legal-hero__title {
	font-size: var(--s4t-text-4xl);
	margin-block-end: var(--s4t-space-4);
}

.s4t-legal-hero__text {
	font-size: var(--s4t-text-xl);
	margin-block-end: var(--s4t-space-5);
}

/* Last-updated line: quiet, but always visible above the fold. */
.s4t-legal-hero__meta {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0;
	padding: 0.4rem 0.9rem;
	background: var(--s4t-white);
	border: 1px solid var(--s4t-border);
	border-radius: var(--s4t-radius-pill);
	box-shadow: var(--s4t-shadow-xs);
	color: var(--s4t-ink);
	font-family: var(--s4t-font-display);
	font-size: var(--s4t-text-sm);
	font-weight: 600;
}

.s4t-legal-hero__meta .s4t-icon {
	color: var(--s4t-brand-strong);
	flex: none;
}

/* ==========================================================================
   2. Body layout & sticky contents list
   Contents rail on the left, document on the right. The rail collapses above
   the document on narrow screens, where sticky positioning would fight the
   sticky site header.
   ========================================================================== */

.s4t-legal-body {
	padding-block-end: clamp(3rem, 6vw, var(--s4t-space-9));
}

.s4t-legal-layout {
	display: grid;
	grid-template-columns: 260px minmax(0, 1fr);
	gap: clamp(2rem, 5vw, var(--s4t-space-8));
	align-items: start;
}

.s4t-legal-aside {
	position: sticky;
	top: calc(var(--s4t-header-height) + var(--s4t-space-5));
}

.s4t-legal-toc {
	background: var(--s4t-white);
	border: 1px solid var(--s4t-border);
	border-radius: var(--s4t-radius-lg);
	padding: var(--s4t-space-5);
	box-shadow: var(--s4t-shadow-xs);
	/* Long policies must not push the rail past the viewport. */
	max-height: calc(100vh - var(--s4t-header-height) - var(--s4t-space-8));
	overflow-y: auto;
	overscroll-behavior: contain;
}

.s4t-legal-toc__title {
	font-size: var(--s4t-text-xs);
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--s4t-body);
	margin-block-end: var(--s4t-space-4);
}

.s4t-legal-toc__list {
	counter-reset: s4t-legal-toc;
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: var(--s4t-text-sm);
	line-height: 1.5;
}

.s4t-legal-toc__list li {
	counter-increment: s4t-legal-toc;
}

.s4t-legal-toc__list li + li {
	margin-block-start: var(--s4t-space-1);
}

.s4t-legal-toc__list a {
	display: flex;
	gap: 0.6rem;
	padding: 0.4rem 0.55rem;
	border-radius: var(--s4t-radius-sm);
	color: var(--s4t-body);
	text-decoration: none;
	transition: background-color var(--s4t-duration) var(--s4t-ease),
		color var(--s4t-duration) var(--s4t-ease);
}

.s4t-legal-toc__list a::before {
	content: counter(s4t-legal-toc);
	flex: none;
	min-width: 1.35em;
	color: var(--s4t-body);
	font-family: var(--s4t-font-display);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.s4t-legal-toc__list a:hover,
.s4t-legal-toc__list a:focus-visible {
	background: var(--s4t-brand-tint);
	color: var(--s4t-ink);
}

.s4t-legal-toc__list a:hover::before,
.s4t-legal-toc__list a:focus-visible::before {
	color: var(--s4t-brand-strong);
}

/* ==========================================================================
   3. Document typography
   Denser and more sober than marketing copy: this is reference text people
   scan for one clause, so headings need to be findable and lines short.
   ========================================================================== */

.s4t-legal-doc {
	max-width: 76ch;
}

.s4t-legal-doc .entry-content {
	font-size: var(--s4t-text-base);
	line-height: 1.75;
}

.s4t-legal-doc .entry-content > h2 {
	font-size: var(--s4t-text-2xl);
	margin-block: var(--s4t-space-8) var(--s4t-space-4);
	padding-block-start: var(--s4t-space-5);
	border-top: 1px solid var(--s4t-border);
	/* Clears the sticky header when arriving from the contents list. */
	scroll-margin-top: calc(var(--s4t-header-height) + var(--s4t-space-5));
}

.s4t-legal-doc .entry-content > h2:first-child {
	margin-block-start: 0;
	padding-block-start: 0;
	border-top: 0;
}

/* Sub-headings have to out-rank the bold lead-ins used inside list items. */
.s4t-legal-doc .entry-content > h3 {
	font-size: var(--s4t-text-xl);
	color: var(--s4t-ink-deep);
	margin-block: var(--s4t-space-6) var(--s4t-space-3);
	scroll-margin-top: calc(var(--s4t-header-height) + var(--s4t-space-5));
}

.s4t-legal-doc .entry-content > * {
	margin-block-end: var(--s4t-space-4);
}

.s4t-legal-doc .entry-content ul,
.s4t-legal-doc .entry-content ol {
	padding-left: 1.15rem;
}

.s4t-legal-doc .entry-content li::marker {
	color: var(--s4t-brand-strong);
}

/* The lead paragraph of a document, and any pull-out note. */
.s4t-legal-doc .entry-content > .wp-block-paragraph:first-child {
	font-size: var(--s4t-text-lg);
	color: var(--s4t-ink);
}

.s4t-legal-doc .entry-content blockquote {
	font-size: var(--s4t-text-base);
	background: var(--s4t-white);
	border-left: 3px solid var(--s4t-brand);
	border-radius: 0 var(--s4t-radius-md) var(--s4t-radius-md) 0;
	padding: var(--s4t-space-4) var(--s4t-space-5);
	color: var(--s4t-body);
}

.s4t-legal-doc .entry-content blockquote p:last-child {
	margin-block-end: 0;
}

/* Cookie and data tables: scrollable on small screens, never cramped. */
.s4t-legal-doc .entry-content .wp-block-table {
	overflow-x: auto;
	border: 1px solid var(--s4t-border);
	border-radius: var(--s4t-radius-md);
	background: var(--s4t-white);
}

.s4t-legal-doc .entry-content .wp-block-table table {
	font-size: var(--s4t-text-sm);
	min-width: 32rem;
}

/* The wrapper already draws the outline; core's per-cell borders would double
   it and add vertical rules the rest of the site does not use. */
.s4t-legal-doc .entry-content .wp-block-table th,
.s4t-legal-doc .entry-content .wp-block-table td {
	border: 0;
	border-bottom: 1px solid var(--s4t-border);
	padding: var(--s4t-space-3) var(--s4t-space-4);
	vertical-align: top;
}

.s4t-legal-doc .entry-content .wp-block-table thead th {
	background: var(--s4t-cream-deep);
	font-size: var(--s4t-text-xs);
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.s4t-legal-doc .entry-content .wp-block-table tr:last-child td {
	border-bottom: 0;
}

/* ==========================================================================
   4. Foot — questions panel & related policies
   ========================================================================== */

.s4t-legal-foot {
	background: linear-gradient(180deg, #fffdfa 0%, #fdfbf7 100%);
	border-block-start: 1px solid rgba(240, 229, 215, 0.7);
	padding-block: clamp(3rem, 6vw, var(--s4t-space-9));
}

.s4t-legal-help {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--s4t-space-5);
	background: var(--s4t-white);
	border: 1px solid var(--s4t-border);
	border-radius: var(--s4t-radius-xl);
	padding: clamp(1.5rem, 3vw, var(--s4t-space-7));
	box-shadow: var(--s4t-shadow-sm);
}

.s4t-legal-help__body {
	max-width: 46ch;
}

.s4t-legal-help__title {
	font-size: var(--s4t-text-2xl);
	margin-block-end: var(--s4t-space-3);
}

.s4t-legal-help__text {
	margin: 0;
	font-size: var(--s4t-text-base);
}

.s4t-legal-help__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s4t-space-3);
}

.s4t-legal-related__title {
	font-size: var(--s4t-text-xl);
	margin-block: clamp(2rem, 4vw, var(--s4t-space-7)) var(--s4t-space-4);
}

.s4t-legal-related {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--s4t-space-4);
	list-style: none;
	margin: 0;
	padding: 0;
}

.s4t-legal-related__link {
	display: flex;
	align-items: flex-start;
	gap: var(--s4t-space-3);
	height: 100%;
	background: var(--s4t-white);
	border: 1px solid var(--s4t-border);
	border-radius: var(--s4t-radius-lg);
	padding: var(--s4t-space-5);
	color: var(--s4t-body);
	text-decoration: none;
	box-shadow: var(--s4t-shadow-xs);
	transition: transform var(--s4t-duration) var(--s4t-ease),
		border-color var(--s4t-duration) var(--s4t-ease),
		box-shadow var(--s4t-duration) var(--s4t-ease);
}

.s4t-legal-related__link:hover {
	transform: translateY(-3px);
	border-color: var(--s4t-brand);
	box-shadow: var(--s4t-shadow-md);
	color: var(--s4t-body);
}

.s4t-legal-related__icon {
	display: grid;
	place-items: center;
	flex: none;
	width: 38px;
	height: 38px;
	border-radius: var(--s4t-radius-sm);
	background: var(--s4t-brand-soft);
	color: var(--s4t-brand-strong);
}

.s4t-legal-related__body {
	flex: 1 1 auto;
	min-width: 0;
}

.s4t-legal-related__label {
	display: block;
	font-family: var(--s4t-font-display);
	font-size: var(--s4t-text-base);
	font-weight: 700;
	color: var(--s4t-ink);
	margin-block-end: var(--s4t-space-1);
}

.s4t-legal-related__text {
	display: block;
	font-size: var(--s4t-text-sm);
	line-height: 1.6;
}

/* The trailing arrow sits on the card's baseline row, not the text. */
.s4t-legal-related__link > .s4t-icon {
	flex: none;
	margin-block-start: 0.6rem;
	color: var(--s4t-brand-strong);
	transition: transform var(--s4t-duration) var(--s4t-ease);
}

.s4t-legal-related__link:hover > .s4t-icon {
	transform: translateX(3px);
}

/* ==========================================================================
   5. Responsive
   ========================================================================== */

@media (max-width: 1024px) {
	.s4t-legal-layout {
		grid-template-columns: 220px minmax(0, 1fr);
	}

	.s4t-legal-related {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 900px) {
	.s4t-legal-layout {
		grid-template-columns: minmax(0, 1fr);
	}

	/* Unstick the rail: two stacked sticky elements trap the page. */
	.s4t-legal-aside {
		position: static;
	}

	.s4t-legal-toc {
		max-height: none;
		overflow: visible;
	}

	.s4t-legal-doc {
		max-width: none;
	}
}

@media (max-width: 640px) {
	.s4t-legal-related {
		grid-template-columns: minmax(0, 1fr);
	}

	.s4t-legal-help__actions .s4t-btn {
		width: 100%;
		justify-content: center;
	}
}

/* ==========================================================================
   6. Motion & print
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.s4t-legal-related__link,
	.s4t-legal-related__link > .s4t-icon {
		transition: none;
	}

	.s4t-legal-related__link:hover {
		transform: none;
	}

	.s4t-legal-related__link:hover > .s4t-icon {
		transform: none;
	}
}

/* Policies get printed and filed. Drop the furniture, keep the text. */
@media print {
	.s4t-legal-aside,
	.s4t-legal-foot,
	.s4t-legal-doc .entry-footer {
		display: none;
	}

	.s4t-legal-layout {
		display: block;
	}

	.s4t-legal-doc {
		max-width: none;
	}
}
