/* ============================================================================
 * Groundcraft — legal documents (/terms/, /refund-policy/, /privacy-policy/,
 * /data-processing-addendum/).
 *
 * These pages are read by two people: a buyer checking one clause before they
 * pay, and someone with a problem looking for the paragraph that decides it.
 * Both are scanning, neither is browsing. So: a hard measure, headings that
 * carry their own number, tables that read as tables, and the one thing a legal
 * page must never bury — what is in force, and since when — pinned at the top.
 *
 * Loaded by groundcraft_site_page_sheet() for the legal slugs only.
 * ==========================================================================*/

/* The block template prints the page title, and the document shell prints its
   own with the eyebrow and the in-force stamp. Two H1s saying the same words is
   one too many; the template's goes, so the document keeps exactly one. */
.gc-page-terms .wp-block-post-title,
.gc-page-refund-policy .wp-block-post-title,
.gc-page-privacy-policy .wp-block-post-title,
.gc-page-data-processing-addendum .wp-block-post-title {
	display: none;
}

.gc-legal {
	--legal-measure: 68ch;
	--legal-rule: color-mix(in srgb, var(--ink, #1b1e19) 12%, transparent);
	max-width: var(--legal-measure);
	margin: 0 auto;
	padding: 0 0 96px;
}

/* ---- document header ---------------------------------------------------- */

.gc-legal-head {
	padding: 8px 0 34px;
	margin-bottom: 40px;
	border-bottom: 1px solid var(--legal-rule);
}

.gc-legal-eyebrow {
	margin: 0 0 14px;
	font-family: var(--font-mono), ui-monospace, monospace;
	font-size: 10.5px;
	font-weight: 400;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--brand-strong, #527d21);
}

.gc-legal-title {
	margin: 0 0 12px;
	font-family: var(--font-display), 'Space Grotesk', sans-serif;
	font-weight: 700;
	font-size: clamp(32px, 5vw, 46px);
	line-height: 1.06;
	letter-spacing: -0.02em;
	color: var(--ink, #1b1e19);
}

.gc-legal-standfirst {
	margin: 0 0 22px;
	font-size: 17px;
	line-height: 1.5;
	color: var(--ink-2, #525750);
	max-width: 52ch;
}

/* What is in force, and since when. The one fact a legal page must not bury. */
.gc-legal-stamp {
	display: inline-flex;
	align-items: baseline;
	gap: 8px;
	margin: 0;
	padding: 8px 14px;
	border: 1px solid var(--legal-rule);
	border-radius: 999px;
	font-family: var(--font-mono), ui-monospace, monospace;
	font-size: 11.5px;
	letter-spacing: 0.04em;
	color: var(--ink, #1b1e19);
	background: var(--surface, #fff);
}

.gc-legal-stamp span {
	color: var(--muted, #787d74);
	text-transform: uppercase;
	letter-spacing: 0.12em;
	font-size: 10px;
}

.gc-legal-dot { opacity: 0.5; }

/* ---- body --------------------------------------------------------------- */

.gc-legal-body {
	font-size: 15.5px;
	line-height: 1.68;
	color: var(--ink-2, #525750);
}

.gc-legal-body > h2 {
	margin: 52px 0 14px;
	font-family: var(--font-display), 'Space Grotesk', sans-serif;
	font-weight: 700;
	font-size: 21px;
	line-height: 1.25;
	letter-spacing: -0.01em;
	color: var(--ink, #1b1e19);
	scroll-margin-top: 96px;
}

.gc-legal-body > h2:first-child { margin-top: 0; }

.gc-legal-body > h3 {
	margin: 32px 0 10px;
	font-family: var(--font-display), 'Space Grotesk', sans-serif;
	font-weight: 700;
	font-size: 16.5px;
	color: var(--ink, #1b1e19);
}

.gc-legal-body p { margin: 0 0 18px; }
.gc-legal-body strong { color: var(--ink, #1b1e19); font-weight: 700; }

.gc-legal-body a {
	color: var(--brand-strong, #527d21);
	text-decoration: underline;
	text-underline-offset: 2px;
	text-decoration-thickness: 1px;
}
.gc-legal-body a:hover { text-decoration-thickness: 2px; }

.gc-legal-body ul,
.gc-legal-body ol { margin: 0 0 20px; padding-left: 0; list-style: none; }
.gc-legal-body ol { counter-reset: gc-legal-ol; }

.gc-legal-body li {
	position: relative;
	padding-left: 26px;
	margin-bottom: 9px;
}

.gc-legal-body ul > li::before {
	content: "";
	position: absolute;
	left: 6px;
	top: 11px;
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--brand-strong, #527d21);
}

.gc-legal-body ol > li {
	counter-increment: gc-legal-ol;
}

.gc-legal-body ol > li::before {
	content: counter(gc-legal-ol) ".";
	position: absolute;
	left: 0;
	top: 0;
	font-family: var(--font-mono), ui-monospace, monospace;
	font-size: 12px;
	line-height: 1.9;
	color: var(--brand-strong, #527d21);
}

.gc-legal-body hr {
	margin: 40px 0;
	border: 0;
	border-top: 1px solid var(--legal-rule);
}

.gc-legal-body code {
	font-family: var(--font-mono), ui-monospace, monospace;
	font-size: 0.9em;
	padding: 1px 5px;
	border-radius: 5px;
	background: color-mix(in srgb, var(--ink, #1b1e19) 6%, transparent);
}

/* ---- tables ------------------------------------------------------------- */
/* The refund ladder and the plan table are the two things people come here to
   read. They get to look like tables, and they scroll rather than squash. */

.gc-legal-table {
	margin: 0 0 26px;
	overflow-x: auto;
	border: 1px solid var(--legal-rule);
	border-radius: 12px;
	background: var(--surface, #fff);
}

.gc-legal-table table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.gc-legal-table th {
	text-align: left;
	padding: 13px 16px;
	font-family: var(--font-mono), ui-monospace, monospace;
	font-size: 10.5px;
	font-weight: 400;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--muted, #787d74);
	background: color-mix(in srgb, var(--ink, #1b1e19) 3%, transparent);
	border-bottom: 1px solid var(--legal-rule);
	white-space: nowrap;
}

.gc-legal-table td {
	padding: 13px 16px;
	vertical-align: top;
	line-height: 1.5;
	border-bottom: 1px solid color-mix(in srgb, var(--ink, #1b1e19) 7%, transparent);
}

.gc-legal-table tr:last-child td { border-bottom: 0; }
.gc-legal-table td:first-child { color: var(--ink, #1b1e19); font-weight: 600; }

/* ---- footer ------------------------------------------------------------- */

.gc-legal-foot {
	margin-top: 56px;
	padding-top: 28px;
	border-top: 1px solid var(--legal-rule);
	font-size: 14px;
	color: var(--ink-2, #525750);
}

.gc-legal-foot p { margin: 0 0 20px; }
.gc-legal-foot a { color: var(--brand-strong, #527d21); text-decoration: none; }
.gc-legal-foot a:hover { text-decoration: underline; }

.gc-legal-siblings {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.gc-legal-siblings a {
	padding: 8px 14px;
	border: 1px solid var(--legal-rule);
	border-radius: 999px;
	font-size: 12.5px;
	color: var(--ink-2, #525750);
	background: var(--surface, #fff);
	transition: border-color 0.15s, color 0.15s;
}

.gc-legal-siblings a:hover {
	border-color: var(--brand, #9bd45f);
	color: var(--ink, #1b1e19);
	text-decoration: none;
}

/* The current document is not a link to itself — the theme adds no aria-current,
   so this is handled by the page-slug body class below. */
.gc-page-terms .gc-legal-siblings a[href="/terms/"],
.gc-page-refund-policy .gc-legal-siblings a[href="/refund-policy/"],
.gc-page-privacy-policy .gc-legal-siblings a[href="/privacy-policy/"],
.gc-page-data-processing-addendum .gc-legal-siblings a[href="/data-processing-addendum/"] {
	border-color: var(--brand, #9bd45f);
	background: var(--brand-soft, #f2f9e8);
	color: var(--ink, #1b1e19);
	pointer-events: none;
}

/* ---- dark ---------------------------------------------------------------- */

[data-theme="dark"] .gc-legal { --legal-rule: rgba(247, 248, 244, 0.14); }
[data-theme="dark"] .gc-legal-title,
[data-theme="dark"] .gc-legal-body > h2,
[data-theme="dark"] .gc-legal-body > h3,
[data-theme="dark"] .gc-legal-body strong,
[data-theme="dark"] .gc-legal-table td:first-child { color: #f7f8f4; }
[data-theme="dark"] .gc-legal-stamp,
[data-theme="dark"] .gc-legal-table,
[data-theme="dark"] .gc-legal-siblings a { background: #161a12; }
[data-theme="dark"] .gc-legal-table th { background: rgba(247, 248, 244, 0.04); }

/* ---- narrow -------------------------------------------------------------- */

@media (max-width: 600px) {
	.gc-legal { padding-bottom: 64px; }
	.gc-legal-body { font-size: 15px; }
	.gc-legal-body > h2 { margin-top: 40px; font-size: 19px; }
	.gc-legal-table table { font-size: 13px; }
	.gc-legal-table th,
	.gc-legal-table td { padding: 11px 13px; }
}
