/*
 * Money & Why Site Layout v1.4
 * Purpose:
 * - Keep automatic ad placement flexible (no hard-coded ad slots).
 * - Desktop: article + narrower comments panel.
 * - Tablet/mobile: stack comments below the article.
 * - Do not alter Make-generated article HTML.
 */

:root {
	--mayw-layout-max: 1220px;
	--mayw-layout-gap: 38px;
	--mayw-comments-width: 330px;
	--mayw-border: #dbe2ea;
	--mayw-soft-bg: #f7f9fc;
	--mayw-ink: #0d2847;
	--mayw-muted: #5e6b7a;
}

/*
 * The theme's Post Content block may itself be narrower.
 * This centered breakout lets the article/comment pair use a controlled
 * desktop width while preserving generous outer whitespace for future
 * Google Auto ads / side rails.
 */
.mayw-article-layout {
	box-sizing: border-box;
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(280px, var(--mayw-comments-width));
	gap: var(--mayw-layout-gap);
	width: min(var(--mayw-layout-max), calc(100vw - 64px));
	max-width: var(--mayw-layout-max);
	margin: 0 0 0 50%;
	transform: translateX(-50%);
	align-items: start;
}

.mayw-article-main {
	min-width: 0;
}

.mayw-article-main > :first-child {
	margin-top: 0;
}

.mayw-comments-panel {
	min-width: 0;
	position: sticky;
	top: 24px;
	align-self: start;
	max-height: calc(100vh - 48px);
	overflow: auto;
	scrollbar-width: thin;
}

.mayw-comments-panel__inner {
	box-sizing: border-box;
	padding: 22px;
	border: 1px solid var(--mayw-border);
	border-radius: 14px;
	background: var(--mayw-soft-bg);
}

.mayw-comments-title {
	margin: 0 0 8px;
	font-size: 1.45rem;
	line-height: 1.25;
	color: var(--mayw-ink);
}

.mayw-comments-intro,
.mayw-no-comments,
.mayw-comment-notes {
	color: var(--mayw-muted);
	font-size: 0.92rem;
	line-height: 1.55;
}

.mayw-comments-intro {
	margin: 0 0 20px;
}

.mayw-comment-list {
	margin: 0 0 24px;
	padding-left: 20px;
}

.mayw-comment-list .comment {
	margin-bottom: 18px;
}

.mayw-comment-list .children {
	margin-top: 12px;
	padding-left: 18px;
}

.mayw-comment-list .comment-body {
	padding-bottom: 14px;
	border-bottom: 1px solid var(--mayw-border);
}

.mayw-comment-list .comment-meta {
	font-size: 0.84rem;
	color: var(--mayw-muted);
}

.mayw-comment-list .comment-content {
	font-size: 0.95rem;
	line-height: 1.6;
}

.mayw-comment-form-title {
	margin: 20px 0 10px;
	font-size: 1.15rem;
	color: var(--mayw-ink);
}

.mayw-comments-panel input[type="text"],
.mayw-comments-panel input[type="email"],
.mayw-comments-panel input[type="url"],
.mayw-comments-panel textarea {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	padding: 10px 12px;
	border: 1px solid #c9d3df;
	border-radius: 8px;
	background: #fff;
	font: inherit;
}

.mayw-comments-panel textarea {
	min-height: 130px;
	resize: vertical;
}

.mayw-comments-panel label {
	display: block;
	margin-bottom: 5px;
	font-size: 0.9rem;
	font-weight: 600;
}

.mayw-comments-panel .comment-form-cookies-consent {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	font-size: 0.85rem;
}

.mayw-comments-panel .comment-form-cookies-consent label {
	font-weight: 400;
}

.mayw-comment-submit,
.mayw-comments-panel input[type="submit"] {
	cursor: pointer;
	border: 0;
	border-radius: 999px;
	padding: 10px 18px;
	background: var(--mayw-ink);
	color: #fff;
	font-weight: 700;
}

.mayw-comment-submit:hover,
.mayw-comments-panel input[type="submit"]:hover {
	opacity: 0.9;
}

/* Avoid theme comment blocks being duplicated if one is added later. */
.mayw-article-layout + .wp-block-comments,
.mayw-article-layout + .wp-block-post-comments-form {
	display: none;
}

/* Tablet / narrower laptop */
@media (max-width: 1050px) {
	.mayw-article-layout {
		grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
		gap: 28px;
		width: min(960px, calc(100vw - 40px));
	}
}

/* Mobile and portrait tablet: comments move below the article. */
@media (max-width: 820px) {
	.mayw-article-layout {
		display: block;
		width: min(760px, calc(100vw - 32px));
		margin-left: 50%;
		transform: translateX(-50%);
	}

	.mayw-comments-panel {
		position: static;
		max-height: none;
		overflow: visible;
		margin-top: 42px;
	}

	.mayw-comments-panel__inner {
		padding: 18px;
	}
}

/* Very small screens */
@media (max-width: 480px) {
	.mayw-article-layout {
		width: calc(100vw - 24px);
	}

	.mayw-comments-panel__inner {
		border-radius: 10px;
		padding: 15px;
	}
}


/* v1.1 — masked IP display in public comments */
.mayw-comment-card {
	padding-bottom: 14px;
	border-bottom: 1px solid var(--mayw-border);
}

.mayw-comment-header {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	align-items: flex-start;
	margin-bottom: 10px;
}

.mayw-comment-author {
	display: flex;
	gap: 10px;
	align-items: center;
	min-width: 0;
}

.mayw-comment-author img.avatar {
	border-radius: 50%;
	flex: 0 0 auto;
}

.mayw-comment-author-name {
	display: block;
	color: var(--mayw-ink);
	font-size: 0.94rem;
	line-height: 1.25;
}

.mayw-comment-ip {
	display: block;
	margin-top: 2px;
	color: var(--mayw-muted);
	font-size: 0.78rem;
	letter-spacing: 0.01em;
}

.mayw-comment-date {
	flex: 0 0 auto;
	font-size: 0.75rem;
	color: var(--mayw-muted);
	white-space: nowrap;
}

.mayw-comment-date a {
	color: inherit;
	text-decoration: none;
}

.mayw-comment-awaiting {
	margin: 8px 0;
	font-size: 0.84rem;
	color: var(--mayw-muted);
}

.mayw-comment-reply {
	margin-top: 8px;
	font-size: 0.82rem;
}

@media (max-width: 480px) {
	.mayw-comment-header {
		display: block;
	}

	.mayw-comment-date {
		margin-top: 6px;
	}
}


/* v1.2 — cleaner identity row, nickname preference, country-flag support */
.mayw-comment-list {
	list-style: none;
	padding-left: 0;
}

.mayw-comment-header {
	display: block;
	margin-bottom: 10px;
}

.mayw-comment-identity {
	min-width: 0;
}

.mayw-comment-name-row {
	display: flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
}

.mayw-comment-flag {
	flex: 0 0 auto;
	font-size: 1rem;
	line-height: 1;
}

.mayw-comment-author-name {
	overflow-wrap: anywhere;
	word-break: break-word;
}

.mayw-comment-date {
	margin-top: 4px;
	font-size: 0.75rem;
	color: var(--mayw-muted);
	white-space: normal;
}

@media (max-width: 480px) {
	.mayw-comment-date {
		margin-top: 4px;
	}
}


/* v1.3 — make pending-own-comment state visually clear */
.mayw-comment-awaiting {
	padding: 8px 10px;
	border-radius: 8px;
	background: #fff7e6;
	border: 1px solid #f0d49a;
	color: #6b4d14;
}
