/*
 * Skin for ama-services-core plugin markup.
 *
 * The plugin owns markup + server logic (library CPT screens, charity form).
 * This file maps its .ama-* classes onto the Magic Castle parchment look
 * established by global.css / send-invitation.css. The plugin's
 * ama-services.css enqueues with no dependencies, so it prints before the
 * theme chain and equal-specificity ties resolve in the theme's favor; deep
 * selectors are used where the plugin's own rules are more specific.
 */

/* ------------------------------------------------------------------ *
 * Library: search
 * ------------------------------------------------------------------ */

/* Search card in the member-card language: cream panel, gold frame, red
 * small-caps heading (WCAG: #9D1721/#42382C/#5B4A36 on #F6ECD6 all >= 4.5:1
 * at the rendered sizes; labels #5B4A36 >= 4.5:1 on the same cream). */
.parchment .ama-search-card {
	background: #f6ecd6;
	border: 1px solid #c9a96a;
	box-shadow:
		0 1px 0 rgba(66, 56, 44, 0.12),
		inset 0 0 0 4px rgba(255, 255, 255, 0.35);
}

/* Neutralize the about-page h2 art (bg image line + 50px padding, from
 * about.css) and the parchment-wide uppercase — the search header keeps the
 * clean straight gold line, same as the info-box titles. */
.parchment .ama-search-card .ama-card-head h2 {
	padding: 0 0 0.45rem;
	background: none;
	text-transform: none;
	font-variant: small-caps;
	letter-spacing: 0.08em;
	color: #9d1721;
	font-size: 1.05rem;
	line-height: 1.25;
	margin: 0 0 0.6rem;
	border-bottom: 1px solid #c9a96a;
}

.parchment .ama-search-card .ama-card-head a {
	color: #0c5346;
}

.parchment .ama-search-card .ama-field span {
	color: #5b4a36;
}

.parchment .ama-search-card input,
.parchment .ama-search-card select {
	background: #fffdf7;
	border-color: #c9a96a;
	color: #42382c;
}

.parchment .ama-search-card button {
	background: #9d1721;
	color: #f2e3c4;
	border: 1px solid #7d1219;
	font-variant: small-caps;
	letter-spacing: 0.06em;
}

.parchment .ama-search-card button:hover,
.parchment .ama-search-card button:focus-visible {
	background: #7d1219;
	color: #f2e3c4;
}

.parchment .ama-results-count {
	color: #5b4a36;
}

/* Grid-item meta lines on page parchment (was pale — failed contrast) */
.parchment .ama-library-item p,
.parchment .ama-library-item .library-item__author,
.parchment .ama-library-item .author-link,
.parchment .ama-library-item .ama-code {
	color: #5b4a36;
}

.parchment .ama-library-shortcode {
	width: 100%;
}

/* Info grid: auto-fitting grid (robust on narrow/about wrappers) */
.parchment .ama-info-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 1.1rem;
	margin: 1.4rem 0;
	align-items: stretch;
}

.parchment .ama-info-grid .ama-info-box {
	min-width: 0;
}
.parchment .ama-search-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 0 2%;
}
.parchment .ama-search-grid .ama-field {
	flex: 1 1 23%;
	display: block;
	margin-bottom: 1rem;
}
.parchment .ama-search-grid .ama-field-wide {
	flex: 2 1 48%;
}
.parchment .ama-field span {
	display: block;
	margin-bottom: 6px;
	font-size: 14px;
	font-size: 0.875rem;
	text-transform: uppercase;
	letter-spacing: 1px;
}

.parchment .ama-search-grid input,
.parchment .ama-search-grid select {
	width: 100%;
	margin: 0;
	padding: 8px 10px;
	border: 1px solid #999382;
	border-radius: 12px;
	background: #fff;
	color: #211f1b;
	font-size: 17px;
	font-size: 1.0625rem;
	box-sizing: border-box;
}
.parchment .ama-search-grid button {
	padding: 8px 22px;
	border: 1px solid #211f1b;
	border-radius: 12px;
	background: transparent;
	color: #211f1b;
	cursor: pointer;
}

.parchment .ama-search-reset {
	float: right;
	margin: 0;
	font-size: 14px;
	font-size: 0.875rem;
}
.parchment .ama-results-count {
	margin: 0 0 1rem;
	font-size: 14px;
	font-size: 0.875rem;
	font-style: italic;
}

/* ------------------------------------------------------------------ *
 * Library: grid — map the plugin grid onto the .library-grid look
 * (global.css already lays out .library-grid/.library-item; only the
 * plugin-specific bits need skinning)
 * ------------------------------------------------------------------ */
.parchment .ama-library-grid {
	/* global.css aligns items flex-end (MC "books on a shelf"); with the
	 * owl placeholder cards that staggers the thumbs — align to top */
	align-items: flex-start;
	/* the plugin's .ama-library-grid rule (written for its own 2-col CSS
	 * grid) leaks `gap: 1.25rem` into this flex container — with the live
	 * item math (4 x 25.75% = exactly 100%) even 20px of gap wraps every
	 * 4th item to the next row */
	gap: 0;
}
.parchment .ama-library-item {
	display: block;
	border-top: 0;
	/* live sizing (22.75% + 3% = exactly 100% per row) has no slack under
	 * flex-wrap; 23% + 2% = 98% wraps safely into 4 columns */
	width: 23%;
	margin-right: 2%;
	padding: 0 !important;
}
.parchment .ama-library-item:nth-of-type(4n) {
	margin-right: 0;
}
.parchment .ama-library-thumb {
	display: block;
	aspect-ratio: 3 / 4;
	background: #eee8dc;
	overflow: hidden;
}
.parchment .ama-library-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.parchment .ama-library-item p,
.parchment .ama-library-item__author {
	line-height: 1.5;
	margin: 1rem 0;
}

/* ------------------------------------------------------------------ *
 * Library: single detail (live-style meta: p > span rows)
 * ------------------------------------------------------------------ */
.parchment .ama-library-detail {
	display: grid;
	grid-template-columns: minmax(180px, 30%) 1fr;
	gap: 2rem;
}
.parchment .ama-library-cover img {
	max-width: 100%;
	height: auto;
}
.parchment .library-item-single h3 {
	margin-top: 0;
}
.parchment .library-item-single .library-meta p,
.parchment .library-item-single > p {
	margin: 0.3rem 0;
}
.parchment .library-item-single p span {
	font-weight: 700;
}
.parchment .library-item-single h2 {
	font-size: 1em;
	letter-spacing: 3px;
	text-transform: uppercase;
	margin: 1.5rem 0 0.75rem;
}
.parchment .back {
	display: inline-block;
	margin: 0.5rem 0;
}

/* Pagination */
.parchment .pagination {
	margin: 2rem 0;
	text-align: center;
}
.parchment .pagination .page-numbers {
	display: inline-block;
	padding: 4px 10px;
}

/* ------------------------------------------------------------------ *
 * Charity form — themed layout
 * (markup: ama-services-core/templates/charity-form.php v0.1.1+)
 * ------------------------------------------------------------------ */
/* The themed page (page-charity.php) renders the charity header graphic +
 * title; the plugin's internal header is redundant. The retired pass-codes
 * control (and any leftover invites UI) stays off the page. */
.parchment .ama-charity > header,
.parchment .ama-retired-control,
.parchment #sent_invite_list,
.parchment .ama-invites-toggle {
	display: none;
}
.parchment .ama-charity {
	width: 100%;
	max-width: 860px;
	margin: 0 auto;
}

.parchment .ama-charity-form fieldset.ama-fieldset {
	border: 0;
	margin: 1.75rem 0 0;
	padding: 0;
	background: none;
}
/* header sits OUT and ABOVE the bordered group */
.parchment .ama-charity-form fieldset.ama-fieldset legend {
	float: none;
	display: block;
	width: auto;
	padding: 0 0 10px;
	font-weight: 700;
	letter-spacing: 3px;
	text-transform: uppercase;
	font-size: 15px;
	font-size: 0.9375rem;
	color: #211f1b;
}
.parchment .ama-charity-form .ama-fieldset-body {
	border: 1px solid #d8d0c2;
	border-radius: 6px;
	padding: 1.25rem 1.5rem 1.5rem;
	background: rgba(255, 255, 255, 0.35);
}
.parchment .ama-member-line {
	text-align: center;
	margin: 0 0 1rem;
}

/* Field grids: 3-col member info, 2-col everything else */
.parchment .ama-grid {
	display: grid;
	gap: 0.9rem 1.5rem;
	align-items: end; /* inputs align on a common bottom line as label heights vary */
}
.parchment .ama-field {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
}
.parchment .ama-grid-2 {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}
.parchment .ama-grid-3 {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}
.parchment .ama-field span {
	display: block;
	margin-bottom: 5px;
	font-size: 13px;
	font-size: 0.8125rem;
	text-transform: uppercase;
	letter-spacing: 1px;
	color: #4a453c;
}
.parchment .ama-field span em {
	color: #a94442;
	font-style: normal;
}
/* The replica CSS (.membership .container form) display:none's checkboxes
 * and radios — it was written for the old page's own custom controls. Our
 * required consent checkbox hidden = Chrome's "not focusable" error and a
 * form that never submits. Restore visibility; the choice-card radio keeps
 * its opacity/1px treatment (still keyboard-focusable, unlike display:none). */
.parchment .ama-charity-form input[type="checkbox"] {
	display: inline-block !important;
	accent-color: #800000;
}
.parchment .ama-charity-form input[type="radio"] {
	display: inline-block !important;
}

.parchment .ama-charity-form input[type="text"],
.parchment .ama-charity-form input[type="email"],
.parchment .ama-charity-form input[type="tel"],
.parchment .ama-charity-form input[type="number"],
.parchment .ama-charity-form input[type="search"],
.parchment .ama-charity-form select {
	display: block;
	width: 100%;
	margin: 0;
	padding: 8px 12px;
	border: 1px solid #999382;
	border-radius: 4px;
	background: #fff;
	color: #211f1b;
	font-size: 16px;
	font-size: 1rem;
	box-sizing: border-box;
}
.parchment .ama-charity-form input:focus,
.parchment .ama-charity-form select:focus {
	outline: none;
	border-color: #800000;
	box-shadow: 0 0 0 2px rgba(128, 0, 0, 0.15);
}

/* Delivery options as selectable check cards */
.parchment .ama-choice-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin: 0.25rem 0 1rem;
}
.parchment .ama-choice {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0;
	padding: 9px 14px;
	border: 1px solid #999382;
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
	user-select: none;
	transition: border-color 0.15s ease-out, background 0.15s ease-out;
}
.parchment .ama-choice:hover {
	border-color: #800000;
}
.parchment .ama-choice input[type="radio"] {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}
.parchment .ama-choice .ama-choice-box {
	position: relative;
	width: 18px;
	height: 18px;
	flex: 0 0 18px;
	border: 1px solid #999382;
	border-radius: 3px;
	background: #fff;
}
.parchment .ama-choice input:checked ~ .ama-choice-box {
	background: #800000;
	border-color: #800000;
}
.parchment .ama-choice input:checked ~ .ama-choice-box::after {
	content: '';
	position: absolute;
	left: 6px;
	top: 2px;
	width: 4px;
	height: 9px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}
.parchment .ama-choice input:checked ~ .ama-choice-text {
	color: #800000;
	font-weight: 700;
}
.parchment .ama-choice input:focus-visible ~ .ama-choice-box {
	outline: 2px solid #800000;
	outline-offset: 2px;
}

/* Conditional mail / pickup groups */
.parchment .ama-sub {
	margin-top: 1rem;
	padding-top: 1rem;
	border-top: 1px dashed #d8d0c2;
}

/* Consent checkbox with the original certification text */
.parchment .ama-consent .ama-fieldset-body {
	background: rgba(255, 255, 255, 0.5);
}
.parchment .ama-consent-label {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	margin: 0;
	cursor: pointer;
}
.parchment .ama-consent-label input[type="checkbox"] {
	flex: 0 0 18px;
	width: 18px;
	height: 18px;
	margin: 3px 0 0;
	accent-color: #800000;
}
.parchment .ama-consent-label span {
	font-size: 14px;
	font-size: 0.875rem;
	line-height: 1.6;
	color: #4a453c;
}

/* Submit */
.parchment .ama-charity-form button[type="submit"] {
	float: right;
	padding: 10px 34px;
	border: 0;
	border-radius: 4px;
	background: #800000;
	color: #fff;
	font-family: "FuturaPT", "Futura-Book", Futura, sans-serif;
	font-size: 15px;
	font-size: 0.9375rem;
	letter-spacing: 2px;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.2s ease-out;
}
.parchment .ama-charity-form button[type="submit"]:hover,
.parchment .ama-charity-form button[type="submit"]:focus {
	background: #9c1a1a;
}
.parchment .ama-charity-form::after {
	content: '';
	display: table;
	clear: both;
}

/* Success / error result panels */
.parchment .ama-success,
.parchment .ama-error {
	max-width: 720px;
	margin: 2rem auto;
	padding: 1.5rem 2rem;
	background: #fff;
	border: 1px solid #ded7cc;
	border-radius: 0.5rem;
	text-align: center;
}
.parchment .ama-error {
	border-color: #cc0000;
}
.parchment .ama-error h1 {
	color: #cc0000;
}

/* ------------------------------------------------------------------ *
 * Responsive (global.css breakpoints)
 * ------------------------------------------------------------------ */
@media only screen and (max-width: 800px) {
	.parchment .ama-search-grid .ama-field,
	.parchment .ama-search-grid .ama-field-wide {
		flex: 1 1 100%;
	}
	.parchment .ama-library-item {
		width: 47% !important;
	}
}
@media only screen and (max-width: 700px) {
	.parchment .ama-library-item {
		width: 100% !important;
		margin-right: 0;
	}
	.parchment .ama-library-detail,
	.parchment .ama-meta-list > div {
		grid-template-columns: 1fr;
	}
	.parchment .ama-radio-grid {
		flex-direction: column;
		align-items: center;
	}
}

/*
 * Info-box cards ([ama_library_hours], [ama_info_box] on member pages).
 * Same rules ship in member-home.css for the member pages; these keep the
 * library/charity pages (which load plugin-skin.css) on the same language.
 */
.ama-info-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 1.1rem;
	margin: 1.4rem 0;
	align-items: stretch;
}

.ama-info-grid .ama-info-box {
	flex: 1 1 240px;
}

.ama-info-box {
	background: #f6ecd6;
	border: 1px solid #c9a96a;
	box-shadow:
		0 1px 0 rgba(66, 56, 44, 0.12),
		inset 0 0 0 4px rgba(255, 255, 255, 0.35);
	padding: 1.1rem 1.2rem 1.2rem;
}

.ama-info-box-title {
	font-variant: small-caps;
	letter-spacing: 0.08em;
	color: #9d1721;
	font-size: 1.05rem;
	line-height: 1.25;
	margin: 0 0 0.6rem;
	padding-bottom: 0.45rem;
	border-bottom: 1px solid #c9a96a;
}

/* style="featured" on [ama_info_box] — ornate gold picture frame, dark purple
 * ground, white text (site-wide; member-home layers carry the same rules) */
.ama-info-box--featured,
.parchment .ama-info-box--featured {
	background: #2b1b45;
	border: 5px double #c9a96a;
	box-shadow:
		inset 0 0 0 1px #8a6d2f,
		0 2px 10px rgba(43, 27, 69, 0.4);
	color: #fff;
}

.ama-info-box--featured .ama-info-box-title,
.parchment .ama-info-box--featured .ama-info-box-title {
	color: #f2e3c4;
	border-bottom-color: #8a6d2f;
}

.ama-info-box--featured .ama-info-box-body,
.ama-info-box--featured .ama-info-box-body p,
.ama-info-box--featured .ama-info-box-body li,
.parchment .ama-info-box--featured .ama-info-box-body p,
.parchment .ama-info-box--featured .ama-info-box-body li {
	color: #fff;
}

.ama-info-box--featured .ama-info-box-body a,
.parchment .ama-info-box--featured .ama-info-box-body a {
	color: #f2e3c4;
	text-decoration-color: #c9a96a;
}

.ama-info-box--featured .ama-announcement {
	background: #3b2a5a;
	border: 1px solid #c9a96a;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
	color: #fff;
}
.ama-info-box--featured .ama-announcement .ama-announcement-title {
	color: #f2e3c4;
}
.ama-info-box--featured .ama-announcement .ama-announcement-when {
	color: #e5c877;
}
.ama-info-box--featured .ama-announcement .ama-announcement-body p {
	color: #fff;
}
.ama-info-box--featured .ama-announcement .ama-announcement-link a {
	color: #fff;
	text-decoration-color: #c9a96a;
}
.ama-info-box--featured .ama-announcement .ama-announcement-link a::after {
	color: #c9a96a;
}

.ama-info-box-body {
	color: #42382c;
	font-size: 1rem;
	line-height: 1.5;
}

.ama-info-box-body p {
	margin: 0.35rem 0;
}

.ama-info-box-body a {
	color: #9d1721;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

.ama-info-box-body a:hover,
.ama-info-box-body a:focus-visible {
	color: #7d1219;
}

.ama-hours-table {
	width: 100%;
	border-collapse: collapse;
}

.ama-hours-table th,
.ama-hours-table td {
	padding: 0.4rem 0;
	border-bottom: 1px dotted #c9a96a;
	text-align: left;
	vertical-align: top;
}

.ama-hours-table tr:last-child th,
.ama-hours-table tr:last-child td {
	border-bottom: 0;
}

.ama-hours-table th {
	font-variant: small-caps;
	letter-spacing: 0.04em;
	font-weight: 600;
	color: #6b5d4a;
	padding-right: 0.75rem;
	white-space: nowrap;
}

.ama-hours-table td {
	color: #42382c;
}

/* ------------------------------------------------------------------ *
 * Library page container + pagination ([ama_library])
 * ------------------------------------------------------------------ */
/* No inner scrollbars (the old overflow:auto turned any 1px overflow into
 * a scrollbar); keep content clear of the parchment's bottom-edge art. */
.parchment .container.ama-container {
	overflow: visible;
	padding-bottom: 3.5rem;
}

/* Search grid: real grid — the flex row's flex-basis totalled >100% and
 * overflowed. Five tracks: keyword (wide), genre, media, code, button. */
.parchment .ama-search-grid {
	display: grid;
	grid-template-columns: 1.7fr 1fr 1fr 1fr auto;
	gap: 0.9rem;
	align-items: end;
}

/* Card head: a single straight gold line under the title, exactly like the
 * info-box titles above it. */
.parchment .ama-search-card .ama-card-head {
	display: block;
}


/* ------------------------------------------------------------------ *
 * Pagination component ([ama_library] now; reusable for galleries)
 * One centered row: First / Previous / numbers / Next / Last, then the
 * "Page [n] of Y [Go]" jump field inline.
 * ------------------------------------------------------------------ */
.ama-pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 0.5rem;
	margin: 1.6rem 0 0;
	font-size: 0.95rem;
}

.ama-pagination .page-numbers {
	display: inline-block;
	padding: 0.3rem 0.65rem;
	border: 1px solid #c9a96a;
	background: #f6ecd6;
	color: #42382c;
	text-decoration: none;
	line-height: 1.4;
}

.ama-pagination .page-numbers.current {
	background: #9d1721;
	border-color: #7d1219;
	color: #f2e3c4;
}

.ama-pagination a.page-numbers:hover,
.ama-pagination a.page-numbers:focus-visible {
	background: #efe2c2;
	color: #42382c;
}

.ama-pagination .page-numbers.dots {
	border: 0;
	background: none;
}

.ama-page-jump {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	margin: 0 0 0 0.6rem;
}

.ama-page-jump-label {
	color: #42382c;
}

.ama-page-jump input[type="number"] {
	width: 5ch;
	padding: 0.25rem 0.35rem;
	border: 1px solid #c9a96a;
	border-radius: 2px;
	background: #fffdf7;
	color: #42382c;
	text-align: center;
	font: inherit;
	line-height: 1.4;
}

.ama-page-jump button {
	padding: 0.3rem 0.65rem;
	border: 1px solid #7d1219;
	border-radius: 2px;
	background: #9d1721;
	color: #f2e3c4;
	cursor: pointer;
	font: inherit;
	font-variant: small-caps;
	letter-spacing: 0.06em;
	line-height: 1.4;
}

.ama-page-jump button:hover,
.ama-page-jump button:focus-visible {
	background: #7d1219;
}
