/**
 * HPN Auth: login, registration, account pages, header links and the
 * article gate. Uses the HPN theme's tokens, with fallbacks.
 */

/* Card
   ========================================================================== */

.entry-content > .hpn-auth-card {
	margin-inline: auto;
	margin-bottom: 2rem;
}

/* Login, register, forgot password, my account: centred title and card. */
.hpn-auth-page .entry-header,
.hpn-auth-page .entry-content {
	margin-inline: auto;
}

.hpn-auth-page .entry-header {
	text-align: center;
}

.hpn-auth-card {
	max-width: 440px;
	padding: clamp(20px, 4vw, 32px);
	border: 1px solid var(--hpn-line, #e3e6ea);
	border-top: 4px solid var(--hpn-brand, #3dae2b);
	border-radius: var(--hpn-radius, 6px);
	background: var(--hpn-white, #fff);
	box-shadow: 0 6px 24px rgb(22 25 29 / 0.06);
	color: var(--hpn-ink, #16191d);
	font-family: var(--hpn-font-sans, system-ui, sans-serif);
	font-size: 1rem;
	line-height: 1.5;
}

.hpn-auth-card--wide {
	max-width: var(--hpn-narrow, 760px);
}

.hpn-auth-card > :first-child {
	margin-top: 0;
}

.hpn-auth-card > :last-child {
	margin-bottom: 0;
}

.hpn-auth-card--done {
	text-align: center;
}

.hpn-auth-card--done h2 {
	margin: 0.75rem 0 0.5rem;
	font-size: 1.375rem;
}

.hpn-auth-done-icon {
	display: inline-grid;
	place-items: center;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: #e8f5e6;
	color: var(--hpn-brand-dark, #1f7a1a);
	font-size: 1.75rem;
	font-weight: 700;
}

.hpn-auth-lead {
	margin: 0 0 1.25rem;
	color: var(--hpn-muted, #5b6470);
}

.hpn-auth-subtitle {
	margin: 2rem 0 1rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--hpn-line, #e3e6ea);
	font-size: 1.125rem;
}

/* Steps
   ========================================================================== */

.hpn-auth-card ol.hpn-auth-steps {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0.5rem;
	margin: 0 0 1.75rem;
	padding: 0;
	list-style: none;
	counter-reset: hpn-step;
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--hpn-muted, #5b6470);
}

.hpn-auth-steps li {
	counter-increment: hpn-step;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding-top: 0.6rem;
	border-top: 3px solid var(--hpn-line, #e3e6ea);
	line-height: 1.3;
}

.hpn-auth-steps li::before {
	content: counter(hpn-step);
	flex: none;
	display: grid;
	place-items: center;
	width: 1.6rem;
	height: 1.6rem;
	border-radius: 50%;
	background: var(--hpn-surface, #f5f7f8);
	color: var(--hpn-ink, #16191d);
}

.hpn-auth-steps li.is-current {
	border-top-color: var(--hpn-brand-dark, #1f7a1a);
	color: var(--hpn-ink, #16191d);
}

.hpn-auth-steps li.is-current::before {
	background: var(--hpn-brand-dark, #1f7a1a);
	color: #fff;
}

/* Form
   ========================================================================== */

.hpn-auth-form {
	margin: 0;
}

.hpn-auth-group {
	min-width: 0;
	margin: 0 0 1.5rem;
	padding: 0;
	border: 0;
}

.hpn-auth-group legend {
	width: 100%;
	margin-bottom: 1rem;
	padding: 0 0 0.5rem;
	border-bottom: 1px solid var(--hpn-line, #e3e6ea);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--hpn-brand-dark, #1f7a1a);
}

.hpn-auth-grid {
	display: grid;
	gap: 0 1rem;
}

@media (min-width: 600px) {
	.hpn-auth-grid {
		grid-template-columns: 1fr 1fr;
	}
}

.hpn-auth-field {
	margin: 0 0 1.1rem;
}

.hpn-auth-field > label {
	display: block;
	margin-bottom: 0.35rem;
	font-size: 0.9375rem;
	font-weight: 600;
}

.hpn-auth-form input[type="text"],
.hpn-auth-form input[type="email"],
.hpn-auth-form input[type="tel"],
.hpn-auth-form input[type="password"],
.hpn-auth-form select,
.hpn-auth-form textarea {
	width: 100%;
	padding: 0.65em 0.8em;
	border: 1px solid #b9c0c8;
	border-radius: var(--hpn-radius, 6px);
	background: #fff;
	color: var(--hpn-ink, #16191d);
	font: inherit;
}

.hpn-auth-form input:focus-visible,
.hpn-auth-form select:focus-visible,
.hpn-auth-form textarea:focus-visible,
.hpn-auth-password__toggle:focus-visible {
	outline: 3px solid rgb(31 122 26 / 0.35);
	outline-offset: 1px;
	border-color: var(--hpn-brand-dark, #1f7a1a);
}

.hpn-auth-form input[type="file"] {
	display: block;
	width: 100%;
	padding: 0.75rem;
	border: 2px dashed #b9c0c8;
	border-radius: var(--hpn-radius, 6px);
	background: var(--hpn-surface, #f5f7f8);
	font: inherit;
	font-size: 0.9375rem;
	cursor: pointer;
}

.hpn-auth-form input[type="file"]::file-selector-button {
	margin-right: 0.75rem;
	padding: 0.45em 1em;
	border: 1px solid var(--hpn-brand-dark, #1f7a1a);
	border-radius: var(--hpn-radius, 6px);
	background: #fff;
	color: var(--hpn-brand-dark, #1f7a1a);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.hpn-auth-field--checkbox {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0.15rem 0.6rem;
	align-items: start;
}

.hpn-auth-field--checkbox input {
	width: 1.15rem;
	height: 1.15rem;
	margin: 0.15rem 0 0;
	accent-color: var(--hpn-brand-dark, #1f7a1a);
}

.hpn-auth-field--checkbox label {
	font-size: 0.9375rem;
	font-weight: 400;
}

.hpn-auth-field--checkbox .hpn-auth-help,
.hpn-auth-field--checkbox .hpn-auth-error {
	grid-column: 2;
}

.hpn-auth-req {
	color: var(--hpn-accent, #d7282f);
}

.hpn-auth-optional {
	color: var(--hpn-muted, #5b6470);
	font-size: 0.8125rem;
	font-weight: 400;
}

.hpn-auth-help {
	display: block;
	margin-top: 0.35rem;
	color: var(--hpn-muted, #5b6470);
	font-size: 0.8125rem;
	line-height: 1.4;
}

.hpn-auth-error {
	display: block;
	margin-top: 0.35rem;
	color: #b3141b;
	font-size: 0.875rem;
	font-weight: 600;
}

.hpn-auth-field:has(.hpn-auth-error) input:not([type="checkbox"]),
.hpn-auth-field:has(.hpn-auth-error) select,
.hpn-auth-field:has(.hpn-auth-error) textarea {
	border-color: #b3141b;
}

/* Password with show/hide */
.hpn-auth-password {
	position: relative;
	display: block;
}

.hpn-auth-form .hpn-auth-password input {
	padding-right: 4.5rem;
}

.hpn-auth-password__toggle {
	position: absolute;
	top: 50%;
	right: 0.35rem;
	transform: translateY(-50%);
	padding: 0.3rem 0.6rem;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: var(--hpn-brand-dark, #1f7a1a);
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 600;
	cursor: pointer;
}

.hpn-auth-password__toggle:hover {
	background: var(--hpn-surface, #f5f7f8);
}

.hpn-auth-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem 1rem;
	margin: 0 0 1.25rem;
	font-size: 0.9375rem;
}

.hpn-auth-check {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	cursor: pointer;
}

.hpn-auth-check input {
	accent-color: var(--hpn-brand-dark, #1f7a1a);
}

.hpn-auth-card a {
	color: var(--hpn-brand-dark, #1f7a1a);
}

.hpn-auth-card a.button {
	color: #fff;
}

.hpn-auth-card a.button--outline {
	color: var(--hpn-brand-dark, #1f7a1a);
}

.hpn-auth-card a.button--outline:hover {
	color: #fff;
}

.hpn-auth-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin: 1.5rem 0 0;
}

.hpn-auth-card--done .hpn-auth-actions {
	justify-content: center;
}

.hpn-auth-submit {
	min-width: 10rem;
}

.hpn-auth-form:not(.hpn-auth-card--wide *) .hpn-auth-submit {
	width: 100%;
}

.hpn-auth-switch {
	margin: 1.5rem 0 0;
	padding-top: 1.25rem;
	border-top: 1px solid var(--hpn-line, #e3e6ea);
	color: var(--hpn-muted, #5b6470);
	font-size: 0.9375rem;
	text-align: center;
}

.hpn-auth-switch a {
	font-weight: 600;
}

.hpn-auth-small {
	color: var(--hpn-muted, #5b6470);
	font-size: 0.8125rem;
}

.hpn-auth-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Alerts
   ========================================================================== */

.hpn-auth-alert {
	margin: 0 0 1.25rem;
	padding: 0.8rem 1rem;
	border-left: 4px solid;
	border-radius: 4px;
	font-size: 0.9375rem;
}

.hpn-auth-alert--error {
	border-color: #b3141b;
	background: #fdeced;
	color: #7d0e13;
}

.hpn-auth-alert--success {
	border-color: var(--hpn-brand-dark, #1f7a1a);
	background: #eaf6e8;
	color: #15520f;
}

/* My account
   ========================================================================== */

.hpn-auth-details {
	display: grid;
	grid-template-columns: minmax(8rem, max-content) 1fr;
	gap: 0.6rem 1.5rem;
	margin: 0;
}

.hpn-auth-details dt {
	color: var(--hpn-muted, #5b6470);
	font-size: 0.875rem;
}

.hpn-auth-details dd {
	margin: 0;
	font-weight: 600;
	overflow-wrap: anywhere;
}

@media (max-width: 479px) {
	.hpn-auth-details {
		grid-template-columns: 1fr;
		gap: 0.1rem;
	}

	.hpn-auth-details dd {
		margin-bottom: 0.6rem;
	}
}

.hpn-auth-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
	padding: 0.15em 0.6em;
	border-radius: 999px;
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.6;
	vertical-align: middle;
}

.hpn-auth-badge::before {
	content: "";
	width: 0.5em;
	height: 0.5em;
	border-radius: 50%;
	background: currentColor;
}

.hpn-auth-badge--approved {
	background: #e3f3e0;
	color: #15520f;
}

.hpn-auth-badge--pending {
	background: #fff3d6;
	color: #7a4f00;
}

.hpn-auth-badge--rejected {
	background: #fdeced;
	color: #8e1016;
}

/* Header links (theme top bar)
   ========================================================================== */

.hpn-auth-links {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	white-space: nowrap;
}

.hpn-auth-links a {
	color: #fff;
	text-decoration: none;
}

.hpn-auth-links a:hover,
.hpn-auth-links a:focus-visible {
	color: var(--hpn-brand, #3dae2b);
	text-decoration: underline;
}

.hpn-auth-links span {
	color: #7d8590;
}

.hpn-auth-links__register {
	font-weight: 700;
}

.hpn-auth-links__dashboard {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.2rem 0.65rem;
	border-radius: 999px;
	background: var(--hpn-brand-dark, #1f7a1a);
	font-weight: 600;
}

.hpn-auth-links a.hpn-auth-links__dashboard:hover,
.hpn-auth-links a.hpn-auth-links__dashboard:focus-visible {
	background: var(--hpn-brand, #3dae2b);
	color: #fff;
	text-decoration: none;
}

/* Article and magazine gate
   ========================================================================== */

.hpn-auth-teaser {
	position: relative;
	max-height: 22em;
	overflow: hidden;
}

.hpn-auth-teaser::after {
	content: "";
	position: absolute;
	inset: auto 0 0;
	height: 6em;
	background: linear-gradient(rgb(255 255 255 / 0), var(--hpn-white, #fff));
	pointer-events: none;
}

.hpn-auth-gate {
	margin: 1rem 0 2rem;
	padding: clamp(24px, 4vw, 36px);
	border: 1px solid var(--hpn-line, #e3e6ea);
	border-top: 4px solid var(--hpn-brand, #3dae2b);
	border-radius: var(--hpn-radius, 6px);
	background: var(--hpn-surface, #f5f7f8);
	font-family: var(--hpn-font-sans, system-ui, sans-serif);
	font-size: 1rem;
	line-height: 1.5;
	text-align: center;
}

.hpn-auth-gate__icon {
	display: inline-grid;
	place-items: center;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: var(--hpn-white, #fff);
	color: var(--hpn-brand-dark, #1f7a1a);
	box-shadow: 0 2px 8px rgb(22 25 29 / 0.08);
}

.entry-content .hpn-auth-gate__title,
.hpn-auth-gate__title {
	margin: 0.9rem 0 0.4rem;
	font-size: 1.375rem;
}

.hpn-auth-gate__text {
	max-width: 34rem;
	margin: 0 auto;
	color: var(--hpn-muted, #5b6470);
}

.hpn-auth-gate__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.75rem;
	margin: 1.25rem 0 0;
}

.hpn-auth-gate a.button {
	color: #fff;
}

.hpn-auth-gate a.button--outline {
	color: var(--hpn-brand-dark, #1f7a1a);
}

.hpn-auth-gate a.button--outline:hover {
	color: #fff;
}
