/* ==========================================================================
   Madagear — Custom overrides
   A polished, human-readable reading experience for posts & pages,
   beautifully styled tables, and a text logo (replaces the default theme logo).
   Loaded after the compiled theme CSS so these rules win.
   ========================================================================== */

/* CSS variables for easy theming */
:root {
	--mg-text: #2c2f36;
	--mg-text-strong: #14161a;
	--mg-muted: #6b7079;
	--mg-link: #1763d6;
	--mg-link-hover: #0d3f8f;
	--mg-accent: #ffdc11;
	--mg-rule: #e7e9ee;
	--mg-soft-bg: #f6f8fa;
	--mg-measure: 760px;
}

/* --------------------------------------------------------------------------
   1) Reading experience — single posts (.post__content) and pages (.entry-content)
   -------------------------------------------------------------------------- */
.post__content,
.entry-content {
	font-size: 1.0625rem;            /* ~17px */
	line-height: 1.8;
	color: var(--mg-text);
	word-break: break-word;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

@media (min-width: 992px) {
	.post__content,
	.entry-content {
		font-size: 1.125rem;         /* ~18px on larger screens */
		line-height: 1.85;
	}
}

/* Comfortable measure for text-like blocks; media stays full width */
.post__content > p,
.post__content > ul,
.post__content > ol,
.post__content > h2,
.post__content > h3,
.post__content > h4,
.post__content > h5,
.post__content > h6,
.post__content > blockquote,
.entry-content > p,
.entry-content > ul,
.entry-content > ol,
.entry-content > h2,
.entry-content > h3,
.entry-content > h4,
.entry-content > h5,
.entry-content > h6,
.entry-content > blockquote {
	max-width: var(--mg-measure);
}

/* Paragraph rhythm */
.post__content p,
.entry-content p {
	margin: 0 0 1.5em;
}

/* A gentle lead-in: first paragraph slightly larger */
.post__content > p:first-of-type,
.entry-content > p:first-of-type {
	font-size: 1.08em;
	color: #3a3d44;
}

/* Headings — clear hierarchy and breathing room */
.post__content h1, .entry-content h1,
.post__content h2, .entry-content h2,
.post__content h3, .entry-content h3,
.post__content h4, .entry-content h4,
.post__content h5, .entry-content h5,
.post__content h6, .entry-content h6 {
	line-height: 1.3;
	color: var(--mg-text-strong);
	margin: 1.9em 0 0.6em;
	font-weight: 700;
	letter-spacing: -0.01em;
}
.post__content h2, .entry-content h2 { font-size: 1.65rem; }
.post__content h3, .entry-content h3 { font-size: 1.35rem; }
.post__content h4, .entry-content h4 { font-size: 1.12rem; }
.post__content > *:first-child,
.entry-content > *:first-child { margin-top: 0; }

/* Links */
.post__content a,
.entry-content a {
	color: var(--mg-link);
	text-decoration: underline;
	text-underline-offset: 2px;
	text-decoration-thickness: 1px;
	transition: color .15s ease;
}
.post__content a:hover,
.entry-content a:hover { color: var(--mg-link-hover); }

/* Lists */
.post__content ul,
.post__content ol,
.entry-content ul,
.entry-content ol {
	margin: 0 0 1.5em;
	padding-left: 1.4em;
}
.post__content li,
.entry-content li { margin-bottom: 0.55em; }
.post__content li > ul,
.post__content li > ol,
.entry-content li > ul,
.entry-content li > ol { margin: 0.55em 0 0; }

/* Blockquotes */
.post__content blockquote,
.entry-content blockquote {
	margin: 1.9em 0;
	padding: 0.4em 1.5em;
	border-left: 4px solid var(--mg-accent);
	background: var(--mg-soft-bg);
	font-style: italic;
	color: #41454d;
	border-radius: 0 6px 6px 0;
}
.post__content blockquote p:last-child,
.entry-content blockquote p:last-child { margin-bottom: 0; }

/* Images & figures */
.post__content img,
.entry-content img {
	height: auto;
	max-width: 100%;
	border-radius: 6px;
}
.post__content figure,
.entry-content figure { margin: 1.9em 0; }
.post__content figcaption,
.entry-content figcaption {
	font-size: 0.85rem;
	color: var(--mg-muted);
	text-align: center;
	margin-top: 0.6em;
}

/* Horizontal rule */
.post__content hr,
.entry-content hr {
	border: 0;
	height: 1px;
	background: var(--mg-rule);
	margin: 2.4em auto;
	max-width: var(--mg-measure);
}

/* Inline code & code blocks */
.post__content code,
.entry-content code {
	background: #f1f3f5;
	padding: 0.15em 0.4em;
	border-radius: 3px;
	font-size: 0.92em;
}
.post__content pre,
.entry-content pre {
	background: #1e2127;
	color: #e6e6e6;
	padding: 1.1em 1.3em;
	border-radius: 8px;
	overflow: auto;
	margin: 1.9em 0;
	line-height: 1.6;
}
.post__content pre code,
.entry-content pre code { background: none; padding: 0; }

/* --------------------------------------------------------------------------
   2) Tables — polished, readable, responsive
   Targets classic editor tables and Gutenberg .wp-block-table.
   -------------------------------------------------------------------------- */
.post__content table,
.entry-content table,
.wp-block-table table {
	width: 100%;
	margin: 2em 0;
	border-collapse: separate;
	border-spacing: 0;
	font-size: 0.98em;
	line-height: 1.55;
	color: var(--mg-text);
	background: #fff;
	border: 1px solid var(--mg-rule);
	border-radius: 10px;
	overflow: hidden;                       /* keeps rounded corners over header bg */
	box-shadow: 0 1px 2px rgba(20, 22, 26, 0.05);
}

/* Cells */
.post__content th, .post__content td,
.entry-content th, .entry-content td,
.wp-block-table th, .wp-block-table td {
	padding: 0.85em 1.1em;
	text-align: left;
	vertical-align: top;
	border: 0;
	border-bottom: 1px solid var(--mg-rule);
}

/* Header row */
.post__content thead th,
.entry-content thead th,
.wp-block-table thead th {
	background: #1e2230;
	color: #fff;
	font-weight: 700;
	font-size: 0.82em;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	border-bottom: 0;
	white-space: nowrap;
}

/* If a table has no thead, treat the first row as a header */
.post__content table > tbody > tr:first-child > td,
.entry-content table > tbody > tr:first-child > td {
	/* no-op safeguard; real headers come from <th>/<thead> */
}

/* Zebra striping + hover */
.post__content tbody tr:nth-child(even),
.entry-content tbody tr:nth-child(even),
.wp-block-table tbody tr:nth-child(even) {
	background: var(--mg-soft-bg);
}
.post__content tbody tr:hover,
.entry-content tbody tr:hover,
.wp-block-table tbody tr:hover {
	background: #eef3fb;
}
.post__content tbody tr:last-child td,
.entry-content tbody tr:last-child td,
.wp-block-table tbody tr:last-child td {
	border-bottom: 0;
}

/* Numeric-feeling alignment helpers (optional, used if author adds the class) */
.post__content td.num,
.entry-content td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Caption */
.post__content table caption,
.entry-content table caption,
.wp-block-table figcaption {
	caption-side: top;
	text-align: left;
	font-size: 0.85rem;
	color: var(--mg-muted);
	padding: 0 0 0.6em;
}

/* Reset the theme/Gutenberg wrapper so our table styling shows fully */
.post__content .wp-block-table,
.entry-content .wp-block-table { margin: 2em 0; }
.post__content .wp-block-table table,
.entry-content .wp-block-table table { margin: 0; }

/* Responsive: let wide tables scroll horizontally on small screens */
@media (max-width: 782px) {
	.post__content table,
	.entry-content table,
	.wp-block-table table {
		display: block;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
	.post__content th, .post__content td,
	.entry-content th, .entry-content td {
		white-space: nowrap;
	}
}

/* --------------------------------------------------------------------------
   3) Post layout polish — header, meta, category, thumbnail, tags
   -------------------------------------------------------------------------- */

/* Content column: comfortable inner padding on cards */
.single .card__content,
.page .card__content {
	padding: 1.75rem 1.75rem 1.5rem;
}
@media (min-width: 768px) {
	.single .card__content,
	.page .card__content {
		padding: 2.5rem 2.75rem 2rem;
	}
}

/* Featured image: soften and space it */
.post__thumbnail {
	margin: 0 0 1.75rem;
	border-radius: 8px;
	overflow: hidden;
}
.post__thumbnail img { width: 100%; height: auto; display: block; }

/* Category labels above the title */
.post__category { margin-bottom: 0.85rem; }

/* Title */
.single .post__title,
.page .post__title {
	font-size: clamp(1.7rem, 1.2rem + 1.8vw, 2.5rem);
	line-height: 1.2;
	letter-spacing: -0.02em;
	color: var(--mg-text-strong);
	margin: 0 0 0.85rem;
}

/* Header + meta separated from the body with a subtle rule */
.single .post__header,
.page .post__header {
	margin-bottom: 1.6rem;
	padding-bottom: 1.25rem;
	border-bottom: 1px solid var(--mg-rule);
}
.post__meta.meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem 1.25rem;
	font-size: 0.875rem;
	color: var(--mg-muted);
}
.post__meta .meta__item { margin: 0; }
.post__meta a { color: var(--mg-muted); }
.post__meta a:hover { color: var(--mg-link); }

/* Footer / tags */
.post__footer {
	margin-top: 2rem;
	padding-top: 1.4rem;
	border-top: 1px solid var(--mg-rule);
}

/* Keep embeds tidy */
.post__content iframe,
.entry-content iframe { max-width: 100%; }

/* --------------------------------------------------------------------------
   4) Text logo — shown instead of the default theme logo image
   -------------------------------------------------------------------------- */
.header-logo__text {
	display: inline-block;
	font-weight: 800;
	font-size: 1.6rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	line-height: 1.1;
	color: #ffffff;
	white-space: nowrap;
}
.header-logo a:hover .header-logo__text { opacity: 0.85; }
.header--layout-2 .header-logo__text,
.header--layout-4 .header-logo__text { color: var(--mg-text-strong); }
.pushy-panel--light .pushy-panel__logo-text { color: var(--mg-text-strong); }
.header-mobile__logo-text { font-size: 1.3rem; }
