/**
 * Magazine article body styles.
 * Scope: singular post content + optional .ai-article-container HTML.
 * Works with core blocks (quote, table, list, code, group styles) and custom utility classes.
 */

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) {
	--haam-article-ink: #1a1532;
	--haam-article-muted: #4b5563;
	--haam-article-accent: #ebd11a;
	--haam-article-accent-dark: #c4b016;
	--haam-article-accent-soft: #fbf6d0;
	--haam-article-surface: #f3f4f6;
	--haam-article-line: #d1d5db;
	line-height: 2.05;
	color: var(--haam-article-ink);
	font-size: 1.05rem;
	text-align: right;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) > *:first-child {
	margin-top: 0 !important;
}

/* Headings */
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) h1,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) h2,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) h3,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) h4 {
	color: var(--haam-article-ink);
	line-height: 1.45;
	text-align: right;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) h2 {
	font-size: clamp(1.35rem, 2.2vw, 1.6rem);
	font-weight: 800;
	margin: 2.2em 0 0.75em;
	padding-bottom: 0.4em;
	border-bottom: 3px solid var(--haam-article-accent);
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) h3 {
	font-size: clamp(1.15rem, 1.8vw, 1.28rem);
	font-weight: 700;
	margin: 1.7em 0 0.55em;
	color: #1f2937;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) h4 {
	font-size: 1.05rem;
	font-weight: 700;
	margin: 1.4em 0 0.45em;
}

/* Paragraphs + emphasis */
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) p {
	margin: 0 0 1.15em;
	font-size: 1.02em;
	line-height: 2.05;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) strong,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) b {
	font-weight: 800;
	color: var(--haam-article-ink);
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) em,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) i {
	font-style: italic;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) mark {
	background: #fef3c7;
	color: var(--haam-article-ink);
	padding: 0.05em 0.2em;
}

/* Links */
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) a:not(.haam-mag-tag):not(.ai-pdf-download-btn) {
	color: var(--haam-article-accent) !important;
	font-weight: 700;
	text-decoration: none;
	transition: color 0.2s ease;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) a:not(.haam-mag-tag):not(.ai-pdf-download-btn):hover {
	color: var(--haam-article-accent-dark) !important;
	text-decoration: underline;
}

/* Lists (core/list + raw ul/ol) */
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) ul,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) ol,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-list {
	margin: 1em 0 1.4em;
	padding: 0 1.35em 0 0;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) ul {
	list-style: none;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) ul > li {
	position: relative;
	padding-right: 0.15em;
	margin-bottom: 0.65em;
	line-height: 2;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) ul > li::before {
	content: "";
	position: absolute;
	right: -1.05em;
	top: 0.85em;
	width: 0.42em;
	height: 0.42em;
	border-radius: 50%;
	background: var(--haam-article-accent);
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) ol {
	list-style: none;
	counter-reset: haam-ol;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) ol > li {
	position: relative;
	counter-increment: haam-ol;
	padding-right: 0.2em;
	margin-bottom: 0.65em;
	line-height: 2;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) ol > li::before {
	content: counter(haam-ol);
	position: absolute;
	right: -1.55em;
	top: 0.35em;
	width: 1.35em;
	height: 1.35em;
	border-radius: 999px;
	background: var(--haam-article-accent);
	color: #1a1532;
	font-size: 0.78em;
	font-weight: 700;
	line-height: 1.35em;
	text-align: center;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) li > ul,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) li > ol {
	margin-top: 0.45em;
	margin-bottom: 0.35em;
}

/* Blockquote — native Quote block + HTML blockquote */
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) blockquote,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-quote,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-pullquote {
	position: relative;
	margin: 1.5em 0;
	padding: 1.15em 3.2em 1.15em 1.35em;
	background: var(--haam-article-surface);
	border: 0;
	border-right: 5px solid var(--haam-article-accent);
	border-radius: 0;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
	color: #374151;
	font-style: italic;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) blockquote::before,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-quote::before {
	content: "«";
	position: absolute;
	top: 0.1em;
	right: 0.35em;
	font-size: 2.4em;
	line-height: 1;
	color: color-mix(in srgb, var(--haam-article-accent) 18%, transparent);
	font-family: Georgia, "Times New Roman", serif;
	pointer-events: none;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) blockquote p,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-quote p {
	margin: 0 0 0.6em;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) blockquote p:last-child,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-quote p:last-child {
	margin-bottom: 0;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) blockquote cite,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-quote cite {
	display: block;
	margin-top: 0.65em;
	font-size: 0.9em;
	font-style: normal;
	font-weight: 600;
	color: #6b7280;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-pullquote blockquote {
	border: 0;
	box-shadow: none;
	background: transparent;
	padding: 0;
	margin: 0;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-pullquote blockquote::before {
	display: none;
}

/* Tables — core/table + .ai-styled-table */
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-table,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .ai-styled-table-wrap {
	margin: 1.5em 0;
	overflow-x: auto;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-table table,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) table.ai-styled-table,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .ai-styled-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	direction: rtl;
	font-size: 0.95em;
	border-radius: 0;
	overflow: hidden;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
	margin: 0;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-table thead th,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .ai-styled-table thead th {
	background: #1f2937;
	color: #fff;
	padding: 14px 18px;
	text-align: right;
	font-weight: 700;
	border-bottom: 3px solid var(--haam-article-accent);
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-table tbody td,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .ai-styled-table tbody td {
	padding: 12px 18px;
	border-bottom: 1px solid var(--haam-article-line);
	text-align: right;
	background: #fff;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-table tbody tr:nth-child(even) td,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .ai-styled-table tbody tr:nth-child(even) td {
	background: var(--haam-article-surface);
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-table tbody tr:hover td,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .ai-styled-table tbody tr:hover td {
	background: #e5e7eb;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .ai-styled-table .total-row td {
	background: var(--haam-article-accent) !important;
	color: #fff !important;
	font-weight: 700;
}

/* Code — core/code + custom wrappers */
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-code,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-preformatted {
	background: #111827;
	color: #e5e7eb;
	padding: 1em 1.15em;
	border-radius: 0;
	overflow-x: auto;
	direction: ltr;
	text-align: left;
	font-family: Consolas, "Courier New", monospace;
	font-size: 0.9em;
	line-height: 1.7;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-code code {
	background: transparent;
	color: inherit;
	font-family: inherit;
	font-size: inherit;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) :not(pre) > code {
	background: var(--haam-article-accent-soft);
	color: var(--haam-article-accent-dark);
	padding: 0.1em 0.35em;
	border-radius: 4px;
	font-size: 0.92em;
	direction: ltr;
	unicode-bidi: isolate;
}

.code-block-wrapper {
	position: relative;
	margin: 1.5em 0;
	border-radius: 0;
	overflow: hidden;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.code-block-header {
	background: #1f2937;
	color: #e5e7eb;
	padding: 10px 16px;
	font-size: 0.82em;
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-bottom: 1px solid #374151;
	direction: ltr;
}

.code-copy-btn {
	background: var(--haam-article-accent, #ebd11a);
	color: #1a1532;
	border: none;
	padding: 6px 16px;
	border-radius: 4px;
	cursor: pointer;
	font-family: Tahoma, sans-serif;
	font-size: 0.85em;
	transition: background 0.2s ease;
}

.code-copy-btn:hover {
	background: var(--haam-article-accent-dark, #c4b016);
}

.code-copy-btn.copied {
	background: #10b981;
}

.code-block-body {
	background: #111827;
	color: #e5e7eb;
	padding: 18px 20px;
	overflow-x: auto;
	font-family: Consolas, "Courier New", monospace;
	font-size: 0.9em;
	direction: ltr;
	text-align: left;
	white-space: pre;
	line-height: 1.7;
	margin: 0;
}

/* Highlight box — Group style `is-style-haam-highlight` or class `highlight-box` */
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .highlight-box,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-group.is-style-haam-highlight {
	background: linear-gradient(135deg, #1f1d36 0%, #5c5210 100%);
	color: #fff;
	padding: 1.4em 1.75em;
	border-radius: 0;
	margin: 1.5em 0;
	font-size: 1.05em;
	line-height: 2;
	box-shadow: 0 4px 20px rgba(235, 209, 26, 0.18);
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .highlight-box h3,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-group.is-style-haam-highlight h3 {
	color: #f5e878;
	margin-top: 0;
	border-bottom: none;
	padding-bottom: 0;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .highlight-box strong,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-group.is-style-haam-highlight strong {
	color: #ebd11a;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .highlight-box a,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-group.is-style-haam-highlight a {
	color: #f5e878 !important;
	text-decoration: underline;
}

/* Stack item — Group style `is-style-haam-stack` or class `ai-stack-item` */
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .ai-stack-item,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-group.is-style-haam-stack {
	background: var(--haam-article-surface);
	border-right: 4px solid var(--haam-article-accent);
	padding: 12px 18px;
	margin: 0.6em 0;
	border-radius: 0;
	font-size: 0.97em;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .ai-stack-item strong,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-group.is-style-haam-stack strong {
	color: var(--haam-article-accent);
}

/* Soft callout — Group style `is-style-haam-callout` */
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-group.is-style-haam-callout {
	background: var(--haam-article-accent-soft);
	border-right: 4px solid var(--haam-article-accent);
	padding: 1.1em 1.35em;
	margin: 1.35em 0;
}

/* PDF download box (custom HTML) */
.ai-pdf-download-box {
	display: flex;
	align-items: flex-start;
	gap: 1.5em;
	background: #fff;
	border: 2px solid var(--haam-article-accent, #ebd11a);
	border-right: 6px solid var(--haam-article-accent, #ebd11a);
	padding: 1.5em 2em;
	margin: 1.5em 0;
	border-radius: 0;
	box-shadow: 0 4px 20px rgba(235, 209, 26, 0.12);
}

.ai-pdf-download-badge {
	flex-shrink: 0;
	background: var(--haam-article-accent, #ebd11a);
	color: #1a1532;
	font-weight: 800;
	font-size: 0.85em;
	letter-spacing: 0.05em;
	padding: 10px 14px;
	line-height: 1;
	margin-top: 4px;
}

.ai-pdf-download-body {
	flex: 1;
	min-width: 0;
}

.ai-pdf-download-body h3 {
	margin: 0 0 0.4em !important;
	font-size: 1.2em !important;
	font-weight: 800 !important;
	color: var(--haam-article-ink, #1a1532) !important;
	border-bottom: none !important;
	padding-bottom: 0 !important;
}

.ai-pdf-download-meta {
	margin: 0 0 0.6em;
	font-size: 0.88em;
	color: #6b7280;
	font-style: italic;
}

.ai-pdf-download-desc {
	margin: 0 0 1em;
	font-size: 0.97em;
	color: #374151;
	line-height: 2;
}

a.ai-pdf-download-btn,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) a.ai-pdf-download-btn {
	display: inline-block !important;
	background: var(--haam-article-accent, #ebd11a) !important;
	color: #1a1532 !important;
	-webkit-text-fill-color: #1a1532 !important;
	font-weight: 700 !important;
	font-size: 0.95em !important;
	padding: 10px 24px !important;
	border-radius: 0 !important;
	text-decoration: none !important;
	border: 2px solid var(--haam-article-accent, #ebd11a) !important;
	line-height: 1.6;
}

a.ai-pdf-download-btn:hover,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) a.ai-pdf-download-btn:hover {
	background: var(--haam-article-accent-dark, #c4b016) !important;
	border-color: var(--haam-article-accent-dark, #c4b016) !important;
	box-shadow: 0 4px 12px rgba(74, 58, 212, 0.28);
	text-decoration: none !important;
}

/* Section number + verdict helpers */
.ai-section-number {
	display: inline-block;
	background: var(--haam-article-accent, #ebd11a);
	color: #1a1532;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	text-align: center;
	line-height: 32px;
	font-weight: 700;
	margin-left: 8px;
	font-size: 0.95em;
}

.verdict-buy {
	color: #10b981;
	font-weight: 700;
}

.verdict-skip {
	color: #ef4444;
	font-weight: 700;
}

.verdict-hybrid {
	color: #f59e0b;
	font-weight: 700;
}

/* Separators / images in content */
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) hr,
:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-separator {
	border: 0;
	border-top: 1px solid #e5e7eb;
	margin: 2em 0;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) .wp-block-image img {
	border-radius: 12px;
}

:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) figcaption {
	color: #6b7280;
	font-size: 0.88em;
	text-align: center;
	margin-top: 0.55em;
}

@media (max-width: 600px) {
	.ai-pdf-download-box {
		flex-direction: column;
		gap: 1em;
		padding: 1.15em 1.25em;
	}

	:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) ul,
	:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) ol {
		padding-right: 1.15em;
	}

	:is(.haam-article, .haam-mag-single__content, .ai-article-container, .editor-styles-wrapper .is-root-container) ol > li::before {
		right: -1.35em;
	}
}
