/* MHN Reviews — frontend styles. Themeable via CSS variables set from the settings page. */

.mhnr-wrap {
	--mhnr-accent: #2271b1;
	--mhnr-star: #f5a623;
	--mhnr-text: inherit;
	--mhnr-heading: inherit;
	--mhnr-card-bg: #ffffff;
	--mhnr-card-border: #e2e2e2;
	--mhnr-radius: 10px;
	--mhnr-font: inherit;
	--mhnr-font-size: inherit;

	font-family: var(--mhnr-font);
	font-size: var(--mhnr-font-size);
	color: var(--mhnr-text);
	box-sizing: border-box;
}

.mhnr-wrap *,
.mhnr-wrap *::before,
.mhnr-wrap *::after {
	box-sizing: inherit;
}

/* ---------- Stars (display) ---------- */

.mhnr-stars {
	display: inline-flex;
	gap: 2px;
	font-size: 1.15em;
	line-height: 1;
}

.mhnr-star.is-filled { color: var(--mhnr-star); }
.mhnr-star.is-empty  { color: color-mix(in srgb, var(--mhnr-star) 25%, transparent); }

@supports not (color: color-mix(in srgb, red, blue)) {
	.mhnr-star.is-empty { color: #d8d8d8; }
}

/* ---------- Stars (fractional average) ---------- */

.mhnr-stars-frac {
	position: relative;
	display: inline-block;
	font-size: 1.15em;
	line-height: 1;
	letter-spacing: 2px;
}

.mhnr-stars-frac .mhnr-stars-base {
	color: color-mix(in srgb, var(--mhnr-star) 25%, transparent);
}

@supports not (color: color-mix(in srgb, red, blue)) {
	.mhnr-stars-frac .mhnr-stars-base { color: #d8d8d8; }
}

.mhnr-stars-frac .mhnr-stars-fill {
	position: absolute;
	top: 0;
	left: 0;
	overflow: hidden;
	white-space: nowrap;
	color: var(--mhnr-star);
}

/* ---------- Rating badge ---------- */

.mhnr-badge,
.mhnr-badge:hover,
.mhnr-badge:focus {
	text-decoration: none;
}

.mhnr-badge {
	display: inline-flex;
	flex-direction: column;
	gap: 0.45em;
	max-width: 24em;
	padding: 0.9em 1.2em;
	background: var(--mhnr-card-bg);
	border: 1px solid var(--mhnr-card-border);
	border-radius: var(--mhnr-radius);
	color: var(--mhnr-text);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mhnr-badge:hover,
.mhnr-badge:focus-visible {
	border-color: var(--mhnr-accent);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mhnr-badge-rating {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
}

.mhnr-badge-avg {
	font-weight: 700;
	color: var(--mhnr-heading);
}

.mhnr-badge-count {
	font-size: 0.9em;
	opacity: 0.65;
}

.mhnr-badge-quotes {
	display: grid;
	font-size: 0.92em;
	line-height: 1.45;
}

.mhnr-badge-quote {
	grid-area: 1 / 1;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.5s ease, visibility 0.5s ease;
}

.mhnr-badge-quote.is-active {
	opacity: 1;
	visibility: visible;
}

.mhnr-badge-quote-text { font-style: italic; }

.mhnr-badge-quote-author {
	opacity: 0.7;
	white-space: nowrap;
	font-size: 0.9em;
}

/* ---------- Cards ---------- */

.mhnr-card {
	background: var(--mhnr-card-bg);
	border: 1px solid var(--mhnr-card-border);
	border-radius: var(--mhnr-radius);
	padding: 1.5em;
	display: flex;
	flex-direction: column;
	gap: 0.75em;
	height: 100%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.mhnr-card-title {
	margin: 0;
	font-size: 1.1em;
	color: var(--mhnr-heading);
	line-height: 1.35;
}

.mhnr-card-body {
	flex: 1;
	line-height: 1.6;
}

.mhnr-card-body p:first-child { margin-top: 0; }
.mhnr-card-body p:last-child  { margin-bottom: 0; }

.mhnr-card-footer {
	display: flex;
	align-items: center;
	gap: 0.6em;
	padding-top: 0.75em;
	border-top: 1px solid var(--mhnr-card-border);
	font-size: 0.9em;
}

.mhnr-avatar {
	width: 2.2em;
	height: 2.2em;
	border-radius: 50%;
	background: var(--mhnr-accent);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	flex-shrink: 0;
}

.mhnr-avatar-img {
	background: transparent;
	overflow: hidden;
}

.mhnr-avatar-img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	display: block;
}

.mhnr-author-block {
	display: flex;
	flex-direction: column;
	line-height: 1.3;
	min-width: 0;
}

.mhnr-card-author { font-weight: 600; }

.mhnr-card-role {
	font-size: 0.85em;
	opacity: 0.7;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mhnr-card-date {
	margin-left: auto;
	opacity: 0.65;
	flex-shrink: 0;
}

/* ---------- Grid / list layouts ---------- */

.mhnr-grid {
	display: grid;
	gap: 1.25em;
	grid-template-columns: repeat(1, 1fr);
}

@media (min-width: 600px) {
	.mhnr-cols-2, .mhnr-cols-3, .mhnr-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
	.mhnr-cols-3 { grid-template-columns: repeat(3, 1fr); }
	.mhnr-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

.mhnr-list {
	display: flex;
	flex-direction: column;
	gap: 1.25em;
}

.mhnr-single { max-width: 640px; }

.mhnr-empty { opacity: 0.7; font-style: italic; }

/* ---------- Carousel ---------- */

.mhnr-carousel {
	position: relative;
	padding: 0 2.5em;
}

.mhnr-carousel-viewport { overflow: hidden; }

.mhnr-carousel-track {
	display: flex;
	transition: transform 0.45s ease;
	align-items: stretch;
}

.mhnr-carousel-slide {
	flex: 0 0 100%;
	padding: 0.25em 0.6em;
	min-width: 0;
}

.mhnr-carousel-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 2em;
	height: 2em;
	border-radius: 50%;
	border: 1px solid var(--mhnr-card-border);
	background: var(--mhnr-card-bg);
	color: var(--mhnr-accent);
	cursor: pointer;
	font-size: 1em;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.2s ease, color 0.2s ease;
}

.mhnr-carousel-btn:hover {
	background: var(--mhnr-accent);
	color: #fff;
}

.mhnr-prev { left: 0; }
.mhnr-next { right: 0; }

.mhnr-carousel-dots {
	display: flex;
	justify-content: center;
	gap: 0.5em;
	margin-top: 1em;
}

.mhnr-dot {
	width: 0.6em;
	height: 0.6em;
	border-radius: 50%;
	border: none;
	padding: 0;
	background: color-mix(in srgb, var(--mhnr-accent) 30%, transparent);
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
}

@supports not (color: color-mix(in srgb, red, blue)) {
	.mhnr-dot { background: #ccc; }
}

.mhnr-dot.is-active {
	background: var(--mhnr-accent);
	transform: scale(1.25);
}

/* ---------- Form ---------- */

.mhnr-form-wrap { max-width: 640px; }

.mhnr-form {
	background: var(--mhnr-card-bg);
	border: 1px solid var(--mhnr-card-border);
	border-radius: var(--mhnr-radius);
	padding: 1.75em;
	display: flex;
	flex-direction: column;
	gap: 1.1em;
}

.mhnr-greeting {
	margin: 0;
	font-weight: 600;
	color: var(--mhnr-heading);
}

.mhnr-field { display: flex; flex-direction: column; gap: 0.35em; }

.mhnr-field label { font-weight: 600; }

.mhnr-req { color: #c0392b; }

.mhnr-field input[type="text"],
.mhnr-field input[type="email"],
.mhnr-field textarea {
	width: 100%;
	padding: 0.65em 0.8em;
	border: 1px solid var(--mhnr-card-border);
	border-radius: calc(var(--mhnr-radius) * 0.6);
	font: inherit;
	color: inherit;
	background: transparent;
}

.mhnr-field input:focus,
.mhnr-field textarea:focus {
	outline: 2px solid var(--mhnr-accent);
	outline-offset: 1px;
	border-color: var(--mhnr-accent);
}

.mhnr-code-input {
	text-transform: uppercase;
	letter-spacing: 2px;
	font-family: monospace;
}

.mhnr-hint {
	margin: 0;
	font-size: 0.85em;
	opacity: 0.7;
}

/* Star rating input */

.mhnr-star-input {
	display: inline-flex;
	flex-direction: row;
	gap: 0.15em;
	font-size: 2em;
	line-height: 1;
}

.mhnr-star-option { cursor: pointer; position: relative; }

.mhnr-star-option input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.mhnr-star-option .mhnr-star {
	color: #d0d0d0;
	transition: color 0.15s ease, transform 0.15s ease;
	display: inline-block;
}

.mhnr-star-option.is-active .mhnr-star,
.mhnr-star-option.is-hover .mhnr-star {
	color: var(--mhnr-star);
	transform: scale(1.08);
}

.mhnr-star-option input:focus-visible + .mhnr-star {
	outline: 2px solid var(--mhnr-accent);
	outline-offset: 2px;
	border-radius: 4px;
}

.mhnr-sr,
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

.mhnr-field-pair {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.1em;
}

@media (max-width: 540px) {
	.mhnr-field-pair { grid-template-columns: 1fr; }
}

/* Photo upload */

.mhnr-photo-row {
	display: flex;
	align-items: center;
	gap: 0.75em;
}

.mhnr-photo-preview {
	width: 3em;
	height: 3em;
	border-radius: 50%;
	overflow: hidden;
	flex-shrink: 0;
	border: 1px solid var(--mhnr-card-border);
}

.mhnr-photo-preview img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.mhnr-photo-btn {
	display: inline-flex;
	align-items: center;
	padding: 0.55em 1em;
	border: 1px dashed var(--mhnr-card-border);
	border-radius: calc(var(--mhnr-radius) * 0.6);
	cursor: pointer;
	max-width: 100%;
	transition: border-color 0.2s ease;
}

.mhnr-photo-btn:hover { border-color: var(--mhnr-accent); }

.mhnr-photo-btn input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.mhnr-photo-btn input:focus-visible + .mhnr-photo-btn-label {
	outline: 2px solid var(--mhnr-accent);
	outline-offset: 4px;
}

.mhnr-photo-btn-label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 0.95em;
}

.mhnr-photo-remove {
	background: none;
	border: none;
	color: var(--mhnr-accent);
	cursor: pointer;
	font: inherit;
	font-size: 0.9em;
	text-decoration: underline;
	padding: 0;
}

/* Honeypot */
.mhnr-hp {
	position: absolute !important;
	left: -9999px !important;
	opacity: 0;
	height: 0;
	overflow: hidden;
}

/* Button */

.mhnr-btn {
	align-self: flex-start;
	background: var(--mhnr-accent);
	color: #fff;
	border: none;
	border-radius: calc(var(--mhnr-radius) * 0.6);
	padding: 0.75em 1.75em;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: filter 0.2s ease;
}

.mhnr-btn:hover:not(:disabled) { filter: brightness(1.1); }

.mhnr-btn:disabled { opacity: 0.6; cursor: wait; }

/* Alerts */

.mhnr-alert {
	padding: 0.9em 1.1em;
	border-radius: calc(var(--mhnr-radius) * 0.6);
	margin-bottom: 1em;
}

.mhnr-alert-error {
	background: #fdecea;
	border: 1px solid #f5c6cb;
	color: #7a1f28;
}

.mhnr-alert-success {
	background: #e8f6ee;
	border: 1px solid #b7e4c7;
	color: #1e5631;
}
