.mgb-guestbook {
	--mgb-card-bg: #fff;
	--mgb-text: #202124;
	--mgb-muted: #6f747b;
	--mgb-border: rgba(32, 33, 36, 0.1);
	--mgb-shadow: 0 12px 30px rgba(20, 24, 32, 0.08);
	--mgb-radius: 16px;
	--mgb-gap: clamp(1rem, 2vw, 1.5rem);
	color: var(--mgb-text);
}

.mgb-actions {
	display: flex;
	justify-content: flex-end;
	margin: 0 0 1.25rem;
}

.mgb-guestbook *, .mgb-guestbook *::before, .mgb-guestbook *::after {
	box-sizing: border-box;
}

.mgb-dialog {
	width: min(560px, calc(100% - 2rem));
	max-height: calc(100dvh - 2rem);
	margin: auto;
	padding: 1.1rem;
	border: 0;
	border-radius: 8px;
	background: #fff;
	color: var(--mgb-text);
	overflow-y: auto;
	box-shadow: 0 20px 70px rgba(0, 0, 0, 0.22);
}

.mgb-dialog[open] { animation: mgb-fade-in 180ms ease-out; }
.mgb-dialog::backdrop {
	background: rgba(0, 0, 0, 0.48);
	animation: mgb-fade-in 180ms ease-out;
}
.mgb-dialog__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}
.mgb-dialog__header h2 { margin: 0; font-size: 1.4rem; line-height: 1.3; }
.mgb-dialog__close {
	display: grid;
	place-items: center;
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font-size: 2rem;
	line-height: 1;
	cursor: pointer;
}
.mgb-dialog .mgb-form {
	margin: 0.65rem 0 0;
	gap: 0.65rem;
	font-size: 16px;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}
.mgb-form__privacy { margin: 0; font-size: 0.9rem; line-height: 1.5; }
.mgb-form__privacy a { text-decoration: underline; overflow-wrap: anywhere; }
.mgb-compose__toggle:focus-visible,
.mgb-dialog button:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
html:has(.mgb-dialog[open]) { overflow: hidden; }
@keyframes mgb-fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
	.mgb-dialog[open], .mgb-dialog::backdrop { animation: none; }
}

.mgb-form {
	display: grid;
	gap: 1rem;
	margin: 1rem 0 clamp(1rem, 3vw, 1.5rem);
	padding: clamp(1rem, 3vw, 1.5rem);
	background: var(--mgb-card-bg);
	border: 1px solid var(--mgb-border);
	border-radius: var(--mgb-radius);
	box-shadow: var(--mgb-shadow);
	text-align: left;
}

.mgb-form__field {
	display: grid;
	gap: 0.25rem;
}

.mgb-form label {
	font-weight: 700;
	line-height: 1.3;
}

.mgb-form label span,
.mgb-form__help {
	color: var(--mgb-muted);
	font-size: 0.9rem;
	font-weight: 400;
}

.mgb-form input[type="text"],
.mgb-form input[type="email"],
.mgb-form input[type="file"],
.mgb-form textarea {
	width: 100%;
	max-width: 100%;
	border: 1px solid var(--mgb-border);
	border-radius: 10px;
	background: #fff;
	color: var(--mgb-text);
	font: inherit;
}

.mgb-form input[type="text"],
.mgb-form input[type="email"],
.mgb-form textarea {
	padding: 0.5rem 0.75rem;
	line-height: 1.4;
}

.mgb-form input[type="text"],
.mgb-form input[type="email"] {
	height: 40px;
	min-height: 40px;
}

.mgb-form textarea {
	height: 100px;
	min-height: 100px;
	resize: vertical;
}

.mgb-form input[type="file"] {
	padding: 0.35rem 0.5rem;
	min-height: 38px;
}

.mgb-form__help {
	margin: 0;
}

.mgb-form label .mgb-form__required {
	font-size: 0.75em;
	color: inherit;
	vertical-align: super;
}

.mgb-form__required-note {
	justify-self: end;
	margin: 0;
	font-size: 12px;
	line-height: 1.4;
	color: var(--mgb-muted);
	text-align: right;
}

.mgb-form__submit {
	justify-self: start;
	border: 0;
	border-radius: 999px;
	padding: 0.85rem 1.25rem;
	background: var(--mgb-text);
	color: #fff;
	cursor: pointer;
	font: inherit;
	font-weight: 700;
	line-height: 1.1;
}

.mgb-form__submit:hover,
.mgb-form__submit:focus-visible {
	filter: brightness(1.08);
}

.mgb-form__trap {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.mgb-notice {
	margin: 0 0 1rem;
	padding: 0.9rem 1rem;
	border-radius: 12px;
	border: 1px solid var(--mgb-border);
	background: #fff;
	font-weight: 700;
}

.mgb-notice--success {
	border-color: rgba(46, 125, 50, 0.24);
	background: #f1faf2;
	color: #236b2c;
}

.mgb-notice--error {
	border-color: rgba(176, 42, 55, 0.22);
	background: #fff4f4;
	color: #9f1f2d;
}

.mgb-grid {
	--mgb-columns: 3;
	display: grid;
	grid-template-columns: repeat(var(--mgb-columns), minmax(0, 1fr));
	gap: var(--mgb-gap);
	align-items: start;
	position: relative;
}
.mgb-grid--masonry { display: block; }
.mgb-grid--masonry > .mgb-card { position: absolute; }
.mgb-guestbook { scroll-margin-top: 120px; }
.mgb-card { overflow-wrap: anywhere; }

.mgb-card {
	display: inline-block;
	width: 100%;
	margin: 0;
	padding: clamp(1rem, 2.5vw, 1.25rem);
	break-inside: avoid;
	background: var(--mgb-card-bg);
	border: 0px;
	border-radius: var(--mgb-radius);
	box-shadow: 0 12px 30px rgba(20, 24, 32, 0.12);
	overflow: hidden;
}

.mgb-card__media {
	margin: 0 0 1rem;
}

.mgb-card--reveal {
	opacity: 0;
	transform: translateY(24px);
	transition: opacity 550ms ease, transform 550ms cubic-bezier(0.22, 1, 0.36, 1);
	transition-delay: var(--mgb-reveal-delay, 0ms);
}
.mgb-card--revealed {
	opacity: 1;
	transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
	.mgb-card--reveal {
		opacity: 1;
		transform: none;
		transition: none;
	}
}

.mgb-card__image {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	max-height: none;
	aspect-ratio: 1 / 1;
	margin-inline: 0;
	border-radius: calc(var(--mgb-radius) - 6px);
	object-fit: cover;
	object-position: center;
}

.mgb-card__date {
	display: block;
	margin: 0 0 0.65rem;
	color: #C20819;
	font-family: "Archivo", Arial, sans-serif;
	font-weight: 400;
	font-size: 12px;
	line-height: 1.4;
}

.mgb-card:has(.mgb-card__title) .mgb-card__date {
	margin-bottom: 0.1625rem;
}

.mgb-guestbook .mgb-card .mgb-card__title {
	margin: 0 0 0.5rem;
	font-family: "Knockout", Arial, sans-serif;
	font-weight: 500;
	font-size: 32px;
	line-height: 1.2;
	text-transform: none;
	letter-spacing: 0;
	color: #000;
	overflow-wrap: anywhere;
}

@media (max-width: 768px) {
	.mgb-guestbook .mgb-card .mgb-card__title {
		font-size: 26px;
	}
}

.mgb-card__content {
	font-family: "Knockout", Arial, sans-serif;
	font-weight: 400;
	font-size: 20px;
	line-height: 1.4;
	color: #000;
}
.mgb-card__date-divider { display: inline-block; margin-inline: 0.55em; }

.mgb-card__content p {
	margin: 0 0 0.85rem;
}

.mgb-card__content p:last-child {
	margin-bottom: 0;
}

.mgb-card__author {
	margin: 1.5rem 0 0;
	font-family: "Knockout", Arial, sans-serif;
	font-size: 14px;
	font-weight: 300;
	color: #C20819;
	line-height: 1.35;
}

.mgb-empty {
	margin: 0;
	color: var(--mgb-muted);
}

@media (max-width: 900px) {
	.mgb-grid {
		--mgb-columns: 2;
	}
}

@media (max-width: 640px) {
	.mgb-grid {
		--mgb-columns: 1;
	}

	.mgb-actions {
		justify-content: flex-end;
	}

	.mgb-compose,
	.mgb-form__submit {
		width: 100%;
	}

	.mgb-actions > .mgb-compose__toggle {
		width: auto;
		flex: 0 0 auto;
		margin-left: auto;
	}
}
