/**
 * March AC membership form.
 *
 * Colours are pulled from the theme's palette where it defines them, with the
 * approved design's values as fallbacks so the form still looks right if the
 * plugin is ever used under a different theme.
 */

.macm {
	--macm-ink: var(--wp--preset--color--ink, #0e1424);
	--macm-navy: var(--wp--preset--color--navy, #1f3864);
	--macm-accent: var(--wp--preset--color--accent, #1428e0);
	--macm-border: var(--wp--preset--color--border, #dde2ee);
	--macm-muted: var(--wp--preset--color--muted, #55607a);
	--macm-surface: var(--wp--preset--color--surface, #ffffff);
	--macm-ok: var(--wp--preset--color--success, #0f7a4a);
	--macm-warn: var(--wp--preset--color--warning, #a15c00);
	--macm-alert: var(--wp--preset--color--alert, #a4142f);

	max-width: 46rem;
	margin-inline: auto;
	color: var(--macm-ink);
}

/* Honeypot: off-screen rather than display:none, because some bots skip
   hidden fields but not positioned ones. */
.macm-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.macm-section {
	border: 1px solid var(--macm-border);
	border-radius: 3px;
	background: var(--macm-surface);
	padding: 1.5rem;
	margin: 0 0 1.5rem;
}

.macm-section > legend {
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	font-size: 0.875rem;
	padding-inline: 0.5rem;
	color: var(--macm-navy);
}

.macm-field {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	margin: 0 0 1.1rem;
}

.macm-field label {
	font-weight: 600;
	font-size: 0.95rem;
}

.macm-req {
	color: var(--macm-alert);
	margin-left: 0.15rem;
}

.macm input[type="text"],
.macm input[type="email"],
.macm input[type="tel"],
.macm input[type="date"],
.macm select,
.macm textarea {
	width: 100%;
	padding: 0.7rem 0.75rem;
	border: 1px solid var(--macm-border);
	border-radius: 3px;
	background: var(--macm-surface);
	font: inherit;
	color: inherit;
	/* 16px minimum stops iOS zooming the viewport on focus. */
	font-size: max(1rem, 16px);
}

.macm textarea {
	min-height: 5.5rem;
	resize: vertical;
	line-height: 1.5;
}

.macm input:focus-visible,
.macm select:focus-visible,
.macm textarea:focus-visible,
.macm button:focus-visible,
.macm summary:focus-visible {
	outline: 3px solid var(--macm-accent);
	outline-offset: 2px;
}

.macm-hint {
	font-size: 0.85rem;
	color: var(--macm-muted);
	line-height: 1.45;
}

.macm-hint--block {
	display: block;
	border-top: 1px solid var(--macm-border);
	padding-top: 1rem;
	margin-top: 0.5rem;
}

/* The rule is there to separate a hint from what precedes it. Directly under
   a legend there is nothing to separate it from, and it reads as a stray line
   across the top of the box. */
.macm-section > legend + .macm-hint--block {
	border-top: 0;
	padding-top: 0;
	margin-top: 0;
}

/* "Why we ask" — the explanation behind a sensitive field.
   Deliberately a <details>, not a hover tooltip. Hover does not exist on a
   phone and cannot be reached from a keyboard, and the people most likely to
   want this explanation are the least likely to get it from hover. */
.macm-info {
	margin-top: 0.35rem;
	font-size: 0.85rem;
}

.macm-info > summary {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	cursor: pointer;
	color: var(--macm-accent);
	font-weight: 600;
	/* 44px of tappable height without 44px of visible chrome. */
	padding: 0.5rem 0;
	min-height: 44px;
	box-sizing: border-box;
}

.macm-info > summary::before {
	content: "i";
	display: inline-grid;
	place-items: center;
	width: 1.15rem;
	height: 1.15rem;
	border: 1px solid currentColor;
	border-radius: 50%;
	font-style: italic;
	font-size: 0.8rem;
	line-height: 1;
	flex: 0 0 auto;
}

.macm-info__body {
	border-left: 3px solid var(--macm-border);
	padding: 0.1rem 0 0.1rem 0.85rem;
	margin: 0 0 0.35rem;
	color: var(--macm-muted);
	line-height: 1.55;
	font-weight: 400;
}

.macm-radio {
	margin: 0 0 0.9rem;
}

/* Two markup shapes exist in the wild here: a wrapper carrying the class with
   a label inside it, and the label carrying the class itself. Both must lay
   out the same, or a bare label stays inline and the checkbox collides with
   its own text. Match both rather than relying on everyone writing the same
   shape next time. */
.macm-radio label,
.macm-check label,
label.macm-radio,
label.macm-check {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0.1rem 0.7rem;
	align-items: start;
	cursor: pointer;
	font-weight: 400;
}

.macm-radio input,
.macm-check input {
	/* Comfortable tap target, and aligned with the first line of text. */
	width: 1.35rem;
	height: 1.35rem;
	margin-top: 0.15rem;
	accent-color: var(--macm-accent);
}

.macm-radio .macm-hint {
	grid-column: 2;
}

.macm-check {
	border: 1px solid var(--macm-border);
	border-radius: 3px;
	padding: 1rem;
	margin: 0 0 1.1rem;
	background: var(--wp--preset--color--base, #fbfbfd);
}

.macm-callout {
	border-left: 3px solid var(--macm-accent);
	background: var(--wp--preset--color--base, #fbfbfd);
	padding: 0.9rem 1rem;
	margin: 1.25rem 0;
	font-size: 0.95rem;
	line-height: 1.55;
}

.macm-declaration {
	font-size: 0.9rem;
	line-height: 1.6;
	color: var(--macm-muted);
	max-height: 18rem;
	overflow-y: auto;
	border: 1px solid var(--macm-border);
	border-radius: 3px;
	padding: 1rem;
	margin-bottom: 1rem;
}

.macm-conduct {
	margin: 0 0 1.1rem;
}

.macm-conduct > summary {
	cursor: pointer;
	font-weight: 600;
	padding: 0.75rem 0;
	min-height: 44px;
	display: flex;
	align-items: center;
}

.macm-submit {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	align-items: flex-start;
}

.macm-submit button {
	background: var(--macm-accent);
	color: #fff;
	border: 0;
	border-radius: 3px;
	padding: 0.95rem 2.2rem;
	font: inherit;
	font-weight: 600;
	font-size: 1.15rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	cursor: pointer;
	min-height: 48px;
}

.macm-submit button:hover {
	background: var(--macm-navy);
}

.macm-notice {
	border-left: 4px solid var(--macm-muted);
	padding: 1rem 1.25rem;
	margin: 0 0 1.5rem;
	border-radius: 3px;
	background: var(--wp--preset--color--base, #fbfbfd);
}

.macm-notice p:last-child { margin-bottom: 0; }
.macm-notice--ok    { border-left-color: var(--macm-ok); }
.macm-notice--warn  { border-left-color: var(--macm-warn); }
.macm-notice--test  { border-left-color: var(--macm-warn); background: #fff8e5; }
.macm-notice--error { border-left-color: var(--macm-alert); background: #fdf1f3; }

.macm-notice--error ul {
	margin: 0.5rem 0 0 1.2rem;
}

@media (max-width: 600px) {
	.macm-section { padding: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
	.macm * { transition: none !important; animation: none !important; }
}

/* The party teaser. Reads its state from the plugin, so it cannot advertise a
   party that has closed. */
.macm-teaser {
	border-left: 3px solid var(--macm-accent);
	background: var(--wp--preset--color--base, #fbfbfd);
	padding: 1.1rem 1.35rem;
	margin: 0 0 2rem;
}

.macm-teaser p { margin: 0 0 0.4rem; }
.macm-teaser p:last-child { margin-bottom: 0; }

.macm-teaser__kicker {
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	font-weight: 700;
	color: var(--macm-muted);
}

.macm-teaser__title {
	font-size: 1.4rem;
	font-weight: 700;
	line-height: 1.2;
}

.macm-teaser__body { font-size: 0.95rem; line-height: 1.55; }
.macm-teaser__cta a { font-weight: 600; }

.macm-teaser--closed { border-left-color: var(--macm-border); }
.macm-teaser--closed .macm-teaser__title { color: var(--macm-muted); }
