/* =============================================================================
   IAB Next Up - public styles (forms, directory, notices)

   Reads the theme's design tokens through CSS custom properties, with hard
   fallbacks so the plugin still renders correctly if it is ever activated
   alongside a different theme.
   ========================================================================== */

.iab-form-wrap,
.iab-directory,
.iab-latest,
.iab-notice {
	--iab-primary: var(--wp--preset--color--primary, #19423C);
	--iab-primary-deep: var(--wp--preset--color--primary-deep, #0F2B27);
	--iab-primary-soft: var(--wp--preset--color--primary-soft, #EAF2F0);
	--iab-accent: var(--wp--preset--color--accent, #00FF9D);
	--iab-surface: var(--wp--preset--color--surface, #FFFFFF);
	--iab-muted: var(--wp--preset--color--muted, #D6D7D6);
	--iab-ink: var(--wp--preset--color--ink, #030F0B);
	--iab-ink-soft: var(--wp--preset--color--ink-soft, #5B6B66);
	--iab-danger: #B3261E;
	--iab-radius-sm: 10px;
	--iab-radius-md: 16px;
	--iab-border: 1px solid var(--iab-muted);

	font-family: var(--wp--preset--font-family--archivo, inherit);
	color: var(--iab-ink);
}

/* --- Notices --------------------------------------------------------------- */

.iab-notice {
	margin: 0 0 24px;
	padding: 16px 20px;
	border-radius: var(--iab-radius-sm);
	border-left: 4px solid var(--iab-primary);
	background: var(--iab-primary-soft);
	font-size: 15px;
	line-height: 1.6;
}

.iab-notice p {
	margin: 0 0 8px;
}

.iab-notice p:last-child {
	margin-bottom: 0;
}

.iab-notice--error {
	border-left-color: var(--iab-danger);
	background: #fdecea;
	color: #6b1a15;
}

.iab-notice--closed {
	border-left-color: var(--iab-ink-soft);
	background: #f1f3f2;
}

.iab-notice--open {
	border-left-color: var(--iab-primary);
}

.iab-notice__title {
	font-size: 18px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--iab-primary);
}

/* A notice arrives with the same short rise the theme uses for its heroes, so
   a status banner reads as something that just appeared. */
@media (prefers-reduced-motion: no-preference) {
	.iab-notice {
		animation: iab-notice-in 0.4s cubic-bezier(0.22, 0.9, 0.3, 1) both;
	}
}

@keyframes iab-notice-in {
	from {
		opacity: 0;
		translate: 0 10px;
	}
}

/* --- Layout ---------------------------------------------------------------- */

.iab-grid {
	display: grid;
	gap: 20px;
}

@media (min-width: 700px) {
	.iab-grid--2 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.iab-grid--3 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* --- Steps ---------------------------------------------------------------- */

.iab-step {
	padding: 0 0 8px;
	margin: 0 0 32px;
}

.iab-step[hidden] {
	display: none;
}

/* The step that just became current rises in shortly, so switching steps
   feels like a move rather than a hard swap. Pure CSS: toggling the hidden
   attribute restarts the animation, so the form's JavaScript is untouched. */
@media (prefers-reduced-motion: no-preference) {
	.iab-step:not([hidden]) {
		animation: iab-step-in 0.3s cubic-bezier(0.22, 0.9, 0.3, 1) both;
	}
}

@keyframes iab-step-in {
	from {
		opacity: 0;
		translate: 0 10px;
	}
}

.iab-step__head {
	margin: 0 0 24px;
	padding-bottom: 16px;
	border-bottom: var(--iab-border);
}

.iab-step__eyebrow {
	margin: 0 0 6px;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--iab-primary);
}

.iab-step__title {
	margin: 0;
	font-size: 24px;
	line-height: 1.3;
	font-weight: 500;
}

/* --- Progress ------------------------------------------------------------- */

.iab-form__progress {
	margin: 0 0 28px;
}

.iab-form__progress[hidden] {
	display: none;
}

.iab-form__progress-label {
	margin: 0 0 8px;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--iab-ink-soft);
}

.iab-form__progress-track {
	height: 6px;
	border-radius: 999px;
	background: var(--iab-muted);
	overflow: hidden;
}

.iab-form__progress-bar {
	display: block;
	height: 100%;
	width: 33%;
	border-radius: 999px;
	background: var(--iab-primary);
	transition: width 220ms ease;
}

/* --- Fields --------------------------------------------------------------- */

.iab-field {
	margin: 0 0 24px;
	padding: 0;
	border: 0;
	min-width: 0;
}

.iab-field--group {
	padding: 20px 22px;
	border: var(--iab-border);
	border-radius: var(--iab-radius-md);
	background: var(--iab-surface);
}

.iab-field__label {
	display: block;
	margin: 0 0 6px;
	padding: 0;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--iab-ink);
}

.iab-field__required {
	margin-left: 3px;
	color: var(--iab-danger);
}

/* Guidance for a single control sits under the input, so that two fields
   sharing a grid row keep their inputs on the same line even when only one of
   them carries a hint. */
.iab-field__hint {
	margin: 6px 0 0;
	font-size: 12px;
	line-height: 1.5;
	color: var(--iab-ink-soft);
}

/* Checkbox and radio groups keep their hint above the options, because it must
   be read before choosing, so the spacing flips to the other side. */
.iab-field__hint--above {
	margin: 0 0 10px;
	font-size: 14px;
	line-height: 1.55;
}

.iab-field__input {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 12px 14px;
	font-family: inherit;
	font-size: 16px; /* 16px avoids the iOS zoom-on-focus jump. */
	line-height: 1.5;
	color: var(--iab-ink);
	background: var(--iab-surface);
	border: 1px solid #b9c4c1;
	border-radius: var(--iab-radius-sm);
	transition: border-color 120ms ease, box-shadow 120ms ease;
}

.iab-field__input:hover {
	border-color: var(--iab-ink-soft);
}

.iab-field__input:focus {
	outline: none;
	border-color: var(--iab-primary);
	box-shadow: 0 0 0 3px rgba(25, 66, 60, 0.16);
}

.iab-field__textarea {
	resize: vertical;
	min-height: 120px;
}

.iab-field__select {
	appearance: none;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235B6B66' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	padding-right: 40px;
}

.iab-field__counter {
	margin: 6px 0 0;
	font-size: 14px;
	color: var(--iab-ink-soft);
	text-align: right;
}

.iab-field__counter.is-near-limit {
	color: #8a5a00;
}

.iab-field__counter.is-over-limit {
	color: var(--iab-danger);
	font-weight: 600;
}

.iab-field__error {
	margin: 8px 0 0;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.5;
	color: var(--iab-danger);
}

.iab-field--error .iab-field__input {
	border-color: var(--iab-danger);
}

.iab-field--error.iab-field--group {
	border-color: var(--iab-danger);
}

/* --- Choices -------------------------------------------------------------- */

.iab-choices {
	display: grid;
	gap: 10px 20px;
}

@media (min-width: 640px) {
	.iab-choices--cols-2 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.iab-choices--cols-3 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.iab-choice {
	position: relative;
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 8px 10px 8px 8px;
	border-radius: var(--iab-radius-sm);
	font-size: 14px;
	line-height: 1.45;
	cursor: pointer;
	transition: background-color 120ms ease;
}

.iab-choice:hover {
	background: var(--iab-primary-soft);
}

/* The native control stays in the accessibility tree and keeps keyboard
   behaviour; only its painting is replaced. */
.iab-choice input {
	position: absolute;
	width: 20px;
	height: 20px;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.iab-choice__box {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	margin-top: 1px;
	border: 2px solid #9fb0ac;
	border-radius: 5px;
	background: var(--iab-surface);
	transition: border-color 120ms ease, background-color 120ms ease;
}

.iab-choice__box--round {
	border-radius: 50%;
}

.iab-choice input:checked ~ .iab-choice__box,
.iab-consent input:checked ~ .iab-choice__box {
	border-color: var(--iab-primary);
	background: var(--iab-primary);
	background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='11' viewBox='0 0 14 11'%3E%3Cpath fill='%2300FF9D' d='M4.9 8.3 1.6 5 0 6.6l4.9 4.9L14 2.4 12.4.8z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
}

.iab-choice input:checked ~ .iab-choice__box--round {
	background-image: none;
	box-shadow: inset 0 0 0 4px var(--iab-surface);
}

/* A checked box settles with a short pop, so a click visibly lands. The
   animation only runs while the selector matches: unchecking resets it, and
   rechecking plays it again. */
@media (prefers-reduced-motion: no-preference) {
	.iab-choice input:checked ~ .iab-choice__box,
	.iab-consent input:checked ~ .iab-choice__box {
		animation: iab-check-pop 220ms cubic-bezier(0.22, 0.9, 0.3, 1);
	}
}

@keyframes iab-check-pop {
	50% {
		scale: 1.18;
	}
}

.iab-choice input:focus-visible ~ .iab-choice__box,
.iab-consent input:focus-visible ~ .iab-choice__box {
	outline: 3px solid var(--iab-primary);
	outline-offset: 2px;
}

.iab-choice__text {
	flex: 1 1 auto;
}

/* --- Consent -------------------------------------------------------------- */

.iab-field--consent {
	padding: 16px 18px;
	border: var(--iab-border);
	border-radius: var(--iab-radius-md);
	background: var(--iab-primary-soft);
}

.iab-consent {
	position: relative;
	display: flex;
	align-items: flex-start;
	gap: 12px;
	font-size: 14px;
	line-height: 1.6;
	cursor: pointer;
}

.iab-consent input {
	position: absolute;
	width: 20px;
	height: 20px;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.iab-consent__text a {
	color: var(--iab-primary);
	text-decoration: underline;
}

/* --- Priorities ----------------------------------------------------------- */

.iab-priorities {
	background: var(--iab-primary-soft);
}

/* --- Honeypot ------------------------------------------------------------- */

.iab-honeypot {
	position: absolute !important;
	left: -9999px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

/* --- Buttons -------------------------------------------------------------- */

.iab-form__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
	margin: 32px 0 0;
	padding-top: 24px;
	border-top: var(--iab-border);
}

.iab-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 14px 30px;
	font-family: inherit;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	color: var(--iab-surface);
	background: var(--iab-primary);
	border: 2px solid var(--iab-primary);
	border-radius: 999px;
	cursor: pointer;
	text-decoration: none;
	transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.iab-btn:hover {
	background: var(--iab-primary-deep);
	border-color: var(--iab-primary-deep);
	color: var(--iab-surface);
	transform: translateY(-2px);
}

.iab-btn[hidden] {
	display: none;
}

.iab-btn--ghost {
	color: var(--iab-primary);
	background: transparent;
}

.iab-btn--ghost:hover {
	color: var(--iab-surface);
}

.iab-btn--small {
	padding: 10px 22px;
	font-size: 14px;
}

.iab-form__footnote {
	margin: 16px 0 0;
	font-size: 14px;
	color: var(--iab-ink-soft);
}

/* --- Directory ------------------------------------------------------------ */

.iab-directory__filters {
	display: grid;
	gap: 16px;
	margin: 0 0 24px;
	padding: 20px 22px;
	border: var(--iab-border);
	border-radius: var(--iab-radius-md);
	background: var(--iab-primary-soft);
}

@media (min-width: 800px) {
	.iab-directory__filters {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		align-items: end;
	}
}

.iab-directory__filter label {
	display: block;
	margin: 0 0 6px;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--iab-ink-soft);
}

.iab-directory__filter input,
.iab-directory__filter select {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 11px 14px;
	font-family: inherit;
	font-size: 15px;
	color: var(--iab-ink);
	background: var(--iab-surface);
	border: 1px solid #b9c4c1;
	border-radius: var(--iab-radius-sm);
}

.iab-directory__filter--actions {
	display: flex;
	align-items: center;
	gap: 16px;
}

.iab-directory__reset {
	font-size: 14px;
	color: var(--iab-primary);
}

.iab-directory__count {
	margin: 0 0 20px;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--iab-ink-soft);
}

/* The track count follows the real container width rather than the viewport:
   the content column is far narrower than the window, so viewport breakpoints
   were squeezing three cards into ~200px each and breaking names onto two
   lines. A minimum track keeps the photo and the name side by side. */
.iab-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* The home row: at most three abreast, so six mentors fill two even rows. The
   track never goes below a third of the row, which caps the count at three;
   the 260px floor still collapses it to two and then one on smaller screens. */
.iab-latest .iab-cards,
.iab-directory .iab-cards {
	grid-template-columns: repeat(auto-fill, minmax(max(260px, calc((100% - 40px) / 3)), 1fr));
}

.iab-latest__all {
	margin: 24px 0 0;
}

.iab-logos {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 44px;
	margin: 4px 0 8px;
}

.iab-logo {
	margin: 0;
}

.iab-logo img {
	display: block;
	height: 52px;
	width: auto;
	max-width: 200px;
	object-fit: contain;
}

/* The photo now sits beside the name rather than above it, so the collapsed
   card stays short. */
.iab-card__photo {
	display: block;
	flex: 0 0 auto;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	object-fit: cover;
	margin: 0;
}

.iab-card__head {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0 0 14px;
}

.iab-card__identity {
	min-width: 0;
}

.iab-card {
	display: flex;
	flex-direction: column;
	padding: 22px 24px;
	border: var(--iab-border);
	border-radius: var(--iab-radius-md);
	background: var(--iab-surface);
	transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1), border-color 220ms ease, box-shadow 220ms ease;
}

/* A quiet lift on hover, in step with the theme's tiles and the sponsor wall. */
.iab-card:hover {
	transform: translateY(-3px);
	border-color: rgba(25, 66, 60, 0.45);
	box-shadow: 0 18px 36px -22px rgba(15, 43, 39, 0.35);
}

.iab-card__eyebrow {
	margin: 0 0 8px;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--iab-primary);
}

.iab-card__name {
	margin: 0 0 4px;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.3;
}

.iab-card__role {
	margin: 0 0 14px;
	font-size: 14px;
	color: var(--iab-ink-soft);
}

.iab-card__blurb {
	margin: 0 0 16px;
	font-size: 14px;
	line-height: 1.6;
}

.iab-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 16px;
	padding: 0;
	list-style: none;
}

.iab-tag {
	padding: 4px 10px;
	font-size: 14px;
	line-height: 1.4;
	border-radius: 999px;
	background: var(--iab-primary-soft);
	color: var(--iab-primary-deep);
}

.iab-tag--more {
	background: transparent;
	border: 1px dashed var(--iab-muted);
	color: var(--iab-ink-soft);
}

.iab-card__meta {
	margin: 0;
	padding: 14px 0 0;
	border-top: var(--iab-border);
	font-size: 14px;
}

.iab-card__meta > div {
	display: flex;
	gap: 8px;
	margin: 0 0 4px;
}

.iab-card__meta dt {
	flex: 0 0 auto;
	font-weight: 600;
	color: var(--iab-ink-soft);
}

.iab-card__meta dd {
	margin: 0;
}

.iab-card__link {
	margin: 14px 0 0;
	font-size: 14px;
}

/* The apply button closes every card. When a card has no collapsible detail,
   the button itself takes the auto margin so it still sits on the bottom edge. */
.iab-card__cta {
	margin: 16px 0 0;
}

.iab-card__cta:not(.iab-card__more + .iab-card__cta) {
	margin-top: auto;
	padding-top: 16px;
}

.iab-card__cta .iab-btn {
	width: 100%;
	box-sizing: border-box;
}

/* --- Collapsible card detail ---------------------------------------------
   A native <details> element, so expanding a profile needs no JavaScript and
   stays keyboard accessible. The toggle is pinned to the bottom of the card so
   a row of cards lines up regardless of how much each mentor wrote. */

.iab-card__more {
	margin: auto 0 0;
	border-top: var(--iab-border);
	padding: 12px 0 0;
}

.iab-card__more summary {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	color: var(--iab-primary);
	cursor: pointer;
	list-style: none;
}

/* Suppress both the WebKit marker and the standards-track one. */
.iab-card__more summary::-webkit-details-marker {
	display: none;
}

.iab-card__more summary::marker {
	content: "";
}

.iab-card__more summary::after {
	content: "";
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg) translateY(-2px);
	transition: transform 0.15s ease;
}

.iab-card__more[open] summary::after {
	transform: rotate(-135deg) translateY(-2px);
}

.iab-card__more summary:focus-visible {
	outline: 2px solid var(--iab-primary);
	outline-offset: 3px;
	border-radius: var(--iab-radius-sm);
}

.iab-card__panel {
	padding: 14px 0 0;
}

/* Expanding a profile unfolds the detail down from the toggle rather than
   dumping it in. Opening a closed <details> re-renders the panel, which
   starts the animation - no script involved. */
@media (prefers-reduced-motion: no-preference) {
	.iab-card__more[open] .iab-card__panel {
		animation: iab-panel-in 0.25s cubic-bezier(0.22, 0.9, 0.3, 1) both;
	}
}

@keyframes iab-panel-in {
	from {
		opacity: 0;
		translate: 0 -6px;
	}
}

.iab-card__group {
	margin: 0 0 12px;
}

.iab-card__group h4 {
	margin: 0 0 6px;
	font-size: 14px;
	font-weight: 600;
	color: var(--iab-ink-soft);
}

.iab-card__panel .iab-tags {
	margin: 0;
}

.iab-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 28px 0 0;
}

.iab-pagination a,
.iab-pagination__current {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 10px;
	font-size: 14px;
	border-radius: var(--iab-radius-sm);
	border: var(--iab-border);
	text-decoration: none;
	color: var(--iab-ink);
}

.iab-pagination__current {
	background: var(--iab-primary);
	border-color: var(--iab-primary);
	color: var(--iab-surface);
	font-weight: 600;
}

.iab-pagination__gap {
	padding: 0 2px;
	color: var(--iab-ink-soft);
}

.iab-pagination a {
	transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}

.iab-pagination a:hover {
	border-color: var(--iab-primary);
	color: var(--iab-primary);
}

/* --- Reduced motion ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.iab-form__progress-bar,
	.iab-field__input,
	.iab-choice,
	.iab-card,
	.iab-pagination a,
	.iab-card__more summary::after,
	.iab-btn {
		transition: none;
	}
}
