/**
 * One Act of Kindness Cards — front end.
 *
 * Scoped under .oak so it sits inside a theme without leaking styles out.
 */

.oak {
	--oak-radius: 14px;
	--oak-gap: 24px;
	--oak-ink: #1b1f2a;
	--oak-muted: #6b7280;
	--oak-line: #e6e8ee;
	--oak-surface: #fff;
	--oak-accent: #2f6feb;

	/* Overridden inline from the Typography settings. */
	--oak-font-script: "Yellowtail", "Brush Script MT", "Segoe Script", cursive;
	--oak-font-ui: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

	box-sizing: border-box;
	color: var(--oak-ink);
	font-family: var(--oak-font-ui);
}

.oak *,
.oak *::before,
.oak *::after {
	box-sizing: inherit;
}

.oak-empty {
	padding: 16px;
	border: 1px dashed var(--oak-line);
	border-radius: var(--oak-radius);
	color: var(--oak-muted);
}

/* ---------------------------------------------------------------- Grid -- */

.oak-grid {
	display: grid;
	gap: var(--oak-gap);
	grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 640px) {
	.oak-grid--cols-2,
	.oak-grid--cols-3,
	.oak-grid--cols-4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 960px) {
	.oak-grid--cols-3 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.oak-grid--cols-4 {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.oak-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--oak-surface);
	border: 1px solid var(--oak-line);
	border-radius: var(--oak-radius);
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
	transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.oak-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 28px rgba(16, 24, 40, 0.1);
}

.oak-card__band {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 180px;
	padding: 20px;
	background-position: center;
	background-size: cover;
}

.oak-card__art {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.oak-card__band-title {
	position: relative;
	font-size: 1.35rem;
	font-weight: 700;
	line-height: 1.25;
	color: #fff;
	text-align: center;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.oak-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 10px;
	padding: 20px;
}

.oak-card__title {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.3;
}

.oak-card__desc {
	margin: 0;
	color: var(--oak-muted);
	font-size: 0.95rem;
	line-height: 1.5;
}

.oak-card__meta {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	margin: 4px 0 0;
	color: var(--oak-muted);
	font-size: 0.85rem;
}

.oak-card__download {
	align-self: flex-start;
	margin-top: auto;
	padding: 8px 0;
	background: none;
	border: 0;
	color: var(--oak-ink);
	cursor: pointer;
	font: inherit;
	font-weight: 700;
	text-decoration: none;
}

.oak-card__download:hover,
.oak-card__download:focus-visible {
	color: var(--oak-accent);
	text-decoration: underline;
}

/* ------------------------------------------------------- Personaliser -- */

.oak-personalizer {
	margin-top: 48px;
	scroll-margin-top: 32px;
}

.oak-personalizer:focus {
	outline: none;
}

.oak-personalizer__head {
	margin-bottom: 24px;
	text-align: center;
}

.oak-personalizer__title {
	margin: 0 0 8px;
	font-size: 1.6rem;
	line-height: 1.25;
}

.oak-personalizer__intro {
	margin: 0 auto;
	max-width: 62ch;
	color: var(--oak-muted);
}

.oak-personalizer__intro p {
	margin: 0;
}

.oak-personalizer__layout {
	display: grid;
	gap: var(--oak-gap);
	grid-template-columns: minmax(0, 1fr);
	align-items: start;
}

@media (min-width: 900px) {
	.oak-personalizer__layout {
		grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
	}
}

/* ----------------------------------------------------- Live preview -- */

.oak-preview-wrap {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Sits above the card, not on it: the artwork already carries the logo in
   the top-left corner and an overlaid label collided with it. */
.oak .oak-preview__caption {
	font-family: var(--oak-font-ui);
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--oak-muted);
}

.oak-preview {
	position: relative;
	overflow: hidden;
	aspect-ratio: 252 / 144;
	border-radius: 18px;
	box-shadow: 0 18px 40px rgba(16, 24, 40, 0.16);
	transition: background-color 0.25s ease;

	/* Everything inside is sized against the card width, so the preview keeps
	   the printed proportions at any screen size. */
	container-type: inline-size;
}

.oak-preview__art {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.oak-preview__inner {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	padding: 6.5% 6% 6%;

	/* The accent the visitor picks, applied to every word on the card. */
	color: var(--oak-card-text, #fff);
}

/* The card message, in the same signature script as the printed cards.
   The long selector and !important are deliberate: themes commonly style
   .entry-content p, which would otherwise win on specificity. */
.oak .oak-preview .oak-preview__message {
	/* Clear the logo baked into the top-left of the artwork. */
	margin: 12% 0 0;
	max-width: 60%;
	font-family: var(--oak-font-script) !important;
	font-weight: 400 !important;
	font-size: clamp(0.95rem, 4vw, 1.95rem);
	line-height: 1.22;
	letter-spacing: 0.01em;
	text-shadow: 0 1px 3px var(--oak-card-shadow, rgba(0, 0, 0, 0.22));
}

@supports (font-size: 1cqw) {
	.oak .oak-preview .oak-preview__message {
		font-size: 6.8cqw;
	}
}

/* One span per forced line break. */
.oak .oak-preview .oak-preview__message > span {
	display: block;
}

.oak-preview__foot {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 4%;
	margin-top: auto;
	text-shadow: 0 1px 3px var(--oak-card-shadow, rgba(0, 0, 0, 0.22));
}

.oak-preview__lines {
	display: flex;
	flex-direction: column;
	gap: 0.2em;
	min-width: 0;
	font-family: var(--oak-font-ui);
	font-size: clamp(0.62rem, 1.9vw, 0.95rem);
}

@supports (font-size: 1cqw) {
	.oak-preview__lines { font-size: 3.2cqw; }
}

.oak-preview__lines > span {
	overflow-wrap: anywhere;
	line-height: 1.25;
}

.oak-preview__placeholder {
	opacity: 0.72;
}

.oak-preview__school,
.oak-preview__event {
	font-size: 0.84em;
	opacity: 0.9;
}

.oak-preview__qr {
	display: grid;
	flex: 0 0 auto;
	place-items: center;
	width: 13%;
	aspect-ratio: 1;
	background: #fff;
	border-radius: 6px;
}

.oak-preview__qr img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	padding: 8%;
}

.oak-form {
	padding: 28px;
	background: var(--oak-surface);
	border: 1px solid var(--oak-line);
	border-radius: 20px;
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.oak-form__chosen {
	margin: 0 0 18px;
	color: var(--oak-muted);
	font-size: 0.9rem;
}

.oak-field {
	margin: 0 0 16px;
	border: 0;
	padding: 0;
}

.oak-field label,
.oak-field legend {
	display: block;
	margin-bottom: 6px;
	font-size: 0.92rem;
	font-weight: 600;
}

.oak-field input[type="text"],
.oak-field input[type="email"],
.oak-field select {
	width: 100%;
	padding: 11px 14px;
	background: #fcfcfa;
	border: 1px solid var(--oak-line);
	border-radius: 10px;
	color: inherit;
	font: inherit;
}

.oak-field input:focus,
.oak-field select:focus {
	border-color: var(--oak-accent);
	outline: 2px solid transparent;
	box-shadow: 0 0 0 3px rgba(47, 111, 235, 0.18);
}

.oak-field--invalid input,
.oak-field--invalid select {
	border-color: #d92d20;
}

.oak-field__error:empty {
	display: none;
}

.oak-field__error {
	display: block;
	margin-top: 5px;
	color: #d92d20;
	font-size: 0.85rem;
}

.oak-req {
	color: #d92d20;
}

.oak-accents {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.oak-accent input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.oak-accent__pill {
	display: inline-block;
	padding: 9px 20px;
	background: var(--oak-surface);
	border: 1px solid var(--oak-line);
	border-radius: 999px;
	cursor: pointer;
	font-size: 0.92rem;
	font-weight: 600;
	transition: border-color 0.15s ease, color 0.15s ease;
}

.oak-accent input:checked + .oak-accent__pill {
	border-color: var(--oak-accent);
	color: var(--oak-accent);
	box-shadow: inset 0 0 0 1px var(--oak-accent);
}

.oak-accent input:focus-visible + .oak-accent__pill {
	outline: 2px solid var(--oak-accent);
	outline-offset: 2px;
}

.oak-form__note {
	margin: 0 0 18px;
	color: var(--oak-muted);
	font-size: 0.86rem;
}

/* Honeypot: off-screen rather than display:none, which some bots skip. */
.oak-form__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.oak-form__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 18px;
}

.oak-btn {
	display: inline-block;
	border: 0;
	border-radius: 10px;
	cursor: pointer;
	font: inherit;
	font-weight: 700;
	text-decoration: none;
}

.oak-btn--primary {
	padding: 13px 26px;
	background: var(--oak-accent);
	color: #fff;
	box-shadow: 0 6px 16px rgba(47, 111, 235, 0.28);
}

.oak-btn--primary:hover:not(:disabled) {
	filter: brightness(1.06);
}

.oak-btn--primary:disabled {
	cursor: default;
	opacity: 0.6;
}

.oak-btn--link {
	padding: 13px 0;
	background: none;
	color: var(--oak-ink);
}

.oak-btn--link:hover {
	color: var(--oak-accent);
	text-decoration: underline;
}

.oak-form__status:empty {
	display: none;
}

.oak-form__status {
	margin-top: 16px;
	padding: 11px 14px;
	border-radius: 10px;
	font-size: 0.92rem;
}

.oak-form__status--success {
	background: #ecfdf3;
	color: #05603a;
}

.oak-form__status--error {
	background: #fef3f2;
	color: #b42318;
}

/* The entry saved, but the PDF or the email did not go out. */
.oak-form__status--warning {
	background: #fffaeb;
	color: #93370d;
}

@media (prefers-reduced-motion: reduce) {
	.oak-card,
	.oak-preview {
		transition: none;
	}
}
