/*
Theme Name: Sage's Brain
Theme URI: https://www.sagesbrain.com/
Description: Child theme of Twenty Twenty-Five for sagesbrain.com. Counter grey, receipt paper, one printed receipt.
Author: Sage's Brain
Template: twentytwentyfive
Version: 1.0.0
Requires at least: 6.4
License: GPL-2.0-or-later
Text Domain: sagesbrain
*/

/* ---------- Base ---------- */

body {
	font-variation-settings: "wdth" 100;
	-webkit-font-smoothing: antialiased;
}

h1, h2 {
	font-variation-settings: "wdth" 84, "opsz" 72;
}

:where(a, button, input, .wp-element-button):focus-visible {
	outline: 3px solid var(--wp--preset--color--ink);
	outline-offset: 3px;
	border-radius: 4px;
}

.sb-faded { color: var(--wp--preset--color--faded); }

/* ---------- Header and footer ---------- */

.sb-header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.75rem 2rem;
}

.sb-wordmark {
	font-size: 1.375rem;
	font-weight: 800;
	font-variation-settings: "wdth" 80, "opsz" 48;
	letter-spacing: -0.02em;
	text-decoration: none;
	color: var(--wp--preset--color--ink);
}

.sb-nav {
	display: flex;
	gap: 1.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
	font-weight: 500;
}

.sb-nav a { text-decoration: none; }
.sb-nav a:hover { text-decoration: underline; }

.sb-footer {
	border-top: 2px dashed var(--wp--preset--color--rule);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--faded);
}

.sb-footer a { color: inherit; }

/* ---------- Hero ---------- */

.sb-hero {
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
	gap: 3rem 4rem;
	align-items: center;
}

.sb-hero h1 { max-width: 12em; margin-top: 0; }

.sb-hero__lead {
	font-size: var(--wp--preset--font-size--lead);
	color: var(--wp--preset--color--faded);
}

.sb-hero .sb-hero__lead { max-width: 32em; }

.sb-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.5rem;
	align-items: center;
	margin-top: 2rem;
}

.sb-link-quiet { font-weight: 600; }

@media (max-width: 860px) {
	.sb-hero { grid-template-columns: 1fr; }
}

/* ---------- The receipt ---------- */

.sb-receipt-wrap {
	justify-self: center;
	filter: drop-shadow(0 1px 0 rgba(31, 37, 43, 0.08)) drop-shadow(0 14px 18px rgba(31, 37, 43, 0.12));
	transform: rotate(1.4deg);
}

.sb-receipt {
	--zz: 9px;
	box-sizing: border-box;
	width: min(100%, 344px);
	padding: 1.75rem 1.5rem 2.5rem;
	background: var(--wp--preset--color--paper);
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--receipt);
	font-size: 0.8125rem;
	line-height: 1.6;
	text-transform: uppercase;
	/* torn zigzag bottom edge */
	-webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(var(--zz) * 2) 100%;
	mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(var(--zz) * 2) 100%;
}

.sb-receipt p { margin: 0; }

.sb-receipt__head {
	text-align: center;
	padding-bottom: 0.9rem;
	margin-bottom: 0.9rem;
	border-bottom: 1px dashed currentColor;
}

.sb-receipt__head p:first-child { font-weight: 600; }

.sb-receipt__lines {
	list-style: none;
	margin: 0;
	padding: 0;
}

.sb-receipt__lines li {
	display: grid;
	grid-template-columns: auto 1fr auto auto;
	gap: 0 0.75rem;
}

.sb-receipt__lines .no { color: var(--wp--preset--color--declined); font-weight: 600; }
.sb-receipt__lines .t { color: var(--wp--preset--color--faded); }

.sb-receipt__note {
	margin-top: 0.6rem !important;
	text-align: center;
	color: var(--wp--preset--color--faded);
}

.sb-receipt__stamp {
	margin: 1.1rem auto 0;
	width: fit-content;
	padding: 0.35rem 0.9rem 0.45rem;
	border: 2px solid var(--wp--preset--color--blocked);
	border-radius: 4px;
	color: var(--wp--preset--color--blocked);
	text-align: center;
	transform: rotate(-4deg);
}

.sb-receipt__stamp b { display: block; font-size: 1.375rem; letter-spacing: 0.12em; }
.sb-receipt__stamp span { font-size: 0.6875rem; }

.sb-receipt__foot {
	margin-top: 1.25rem !important;
	padding-top: 0.9rem;
	border-top: 1px dashed currentColor;
	display: flex;
	justify-content: space-between;
}

/* The one orchestrated moment: the receipt prints line by line, then gets stamped. */
@media (prefers-reduced-motion: no-preference) {
	.sb-print {
		opacity: 0;
		animation: sb-print 0.01s linear forwards;
		animation-delay: calc(0.5s + var(--i) * 0.42s);
	}

	.sb-receipt__stamp.sb-print {
		animation: sb-stamp 0.28s cubic-bezier(0.2, 1.6, 0.4, 1) forwards;
		animation-delay: calc(0.5s + var(--i) * 0.42s);
	}

	@keyframes sb-print { to { opacity: 1; } }

	@keyframes sb-stamp {
		from { opacity: 0; transform: rotate(-4deg) scale(1.6); }
		to   { opacity: 1; transform: rotate(-4deg) scale(1); }
	}
}

/* ---------- Product lineup ---------- */

.sb-lineup {
	list-style: none;
	margin: 0;
	padding: 0;
	border-top: 2px dashed var(--wp--preset--color--rule);
}

.sb-lineup > li {
	display: grid;
	grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) minmax(0, 13rem);
	gap: 0.5rem 2.5rem;
	padding: 1.75rem 0;
	border-bottom: 2px dashed var(--wp--preset--color--rule);
	align-items: baseline;
}

.sb-lineup h3 { margin: 0; }
.sb-lineup p { margin: 0; }

.sb-lineup__status { font-size: var(--wp--preset--font-size--small); }
.sb-lineup__status strong { display: block; font-size: 1rem; }

@media (max-width: 760px) {
	.sb-lineup > li { grid-template-columns: 1fr; }
}

/* ---------- Emergency kit slip ---------- */

.sb-kit {
	background: var(--wp--preset--color--paper);
	border-radius: 6px;
	padding: clamp(1.75rem, 5vw, 3.5rem);
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 2rem 4rem;
	align-items: center;
}

.sb-kit h2 { margin-top: 0; }

@media (max-width: 860px) {
	.sb-kit { grid-template-columns: 1fr; }
}

.sb-signup label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.4rem;
}

.sb-signup__row {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.sb-signup input[type="email"] {
	flex: 1 1 14rem;
	min-width: 0;
	font: inherit;
	padding: 0.75rem 0.9rem;
	border: 2px solid var(--wp--preset--color--ink);
	border-radius: 6px;
	background: #fff;
	color: var(--wp--preset--color--ink);
}

.sb-signup button { cursor: pointer; border: 0; }

.sb-signup__hp { position: absolute; left: -9999px; }

.sb-signup__fine {
	margin: 0.6rem 0 0;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--faded);
}

.sb-signup__msg {
	margin: 0 0 0.75rem;
	font-weight: 600;
}

.sb-signup__msg--error { color: var(--wp--preset--color--declined); }

/* ---------- Notice on the kit page ---------- */

.sb-notice {
	box-sizing: border-box;
	border-left: 4px solid var(--wp--preset--color--blocked);
	background: var(--wp--preset--color--paper);
	padding: 1rem 1.25rem;
	border-radius: 0 6px 6px 0;
}

/* ---------- Long-form pages (the kit) ---------- */

.sb-doc h2 {
	margin-top: 3.5rem;
	padding-top: 1.5rem;
	border-top: 2px dashed var(--wp--preset--color--rule);
}

.sb-doc h3 { margin-top: 2.25rem; }

.sb-doc pre {
	background: var(--wp--preset--color--paper);
	border-radius: 6px;
	padding: 1rem 1.25rem;
	overflow-x: auto;
	font-family: var(--wp--preset--font-family--receipt);
	font-size: 0.8125rem;
	line-height: 1.6;
}

.sb-doc code {
	font-family: var(--wp--preset--font-family--receipt);
	font-size: 0.875em;
}

.sb-doc :not(pre) > code {
	background: var(--wp--preset--color--paper);
	padding: 0.1em 0.35em;
	border-radius: 3px;
}

.sb-doc table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--wp--preset--font-size--small);
	background: var(--wp--preset--color--paper);
}

.sb-doc th, .sb-doc td {
	text-align: left;
	vertical-align: top;
	padding: 0.6rem 0.75rem;
	border-bottom: 1px solid var(--wp--preset--color--rule);
}

.sb-doc ul:has(.sb-task) { list-style: none; padding-left: 0; }

.sb-task {
	display: grid;
	grid-template-columns: 1.5rem 1fr;
	gap: 0.6rem;
	align-items: start;
	margin-bottom: 0.75rem;
}

.sb-task input {
	width: 1.25rem;
	height: 1.25rem;
	margin-top: 0.2rem;
	accent-color: var(--wp--preset--color--blocked);
}

.sb-task input:checked + label {
	color: var(--wp--preset--color--faded);
	text-decoration: line-through;
}

/* ---------- Receipt on phones ---------- */

@media (max-width: 480px) {
	.sb-receipt-wrap { width: 100%; max-width: 344px; transform: rotate(0.8deg); }
	.sb-receipt { width: 100%; padding: 1.5rem 1rem 2.25rem; font-size: 0.6875rem; }
	.sb-receipt__lines li { gap: 0 0.4rem; }
}

.sb-hero > * { min-width: 0; }
