/**
 * Havenlytics V3 — Global UI Foundation
 * Reusable typography, links, tables, content, and WordPress defaults.
 * Homepage / header / footer are unchanged — content areas inherit this layer.
 *
 * @package Havenlytics_Theme
 */

/* ── Content scope ───────────────────────────────────────────── */
:is(.hvnly-single-content, .hvnly-prose, .entry-content) {
	color: var(--hvnly--ink-600);
	font-size: var(--hvnly--text-lg);
	line-height: 1.8;
	letter-spacing: -0.01em;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.hvnly-page-content,
.hvnly-default-page__body {
	overflow-wrap: anywhere;
	word-break: break-word;
}

.hvnly-single-content {
	font-size: 1.125rem;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) > * + * {
	margin-top: var(--hvnly-paragraph-spacing, var(--hvnly--space-8));
}

/* ── Headings in content ───────────────────────────────────────── */
:is(.hvnly-single-content, .hvnly-prose, .entry-content) h1,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) h2,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) h3,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) h4,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) h5,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) h6 {
	color: var(--hvnly--ink-900);
	font-family: var(--hvnly--font-display);
	font-weight: var(--hvnly--weight-bold);
	line-height: var(--hvnly--leading-tight);
	letter-spacing: var(--hvnly--tracking-snug);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) h1 {
	font-size: var(--hvnly--text-display-sm);
	margin-top: var(--hvnly--space-20);
	margin-bottom: var(--hvnly--space-8);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) h2 {
	font-size: var(--hvnly--text-3xl);
	margin-top: var(--hvnly--space-18);
	margin-bottom: var(--hvnly--space-7);
	letter-spacing: var(--hvnly--tracking-tight);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) h3 {
	font-size: var(--hvnly--text-2xl);
	margin-top: var(--hvnly--space-16);
	margin-bottom: var(--hvnly--space-6);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) h4 {
	font-size: var(--hvnly--text-xl);
	margin-top: var(--hvnly--space-14);
	margin-bottom: var(--hvnly--space-5);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) h5 {
	font-size: var(--hvnly--text-lg);
	margin-top: var(--hvnly--space-12);
	margin-bottom: var(--hvnly--space-4);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) h6 {
	font-size: var(--hvnly--text-md);
	margin-top: var(--hvnly--space-10);
	margin-bottom: var(--hvnly--space-4);
	text-transform: uppercase;
	letter-spacing: var(--hvnly--tracking-wide);
	color: var(--hvnly--ink-600);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) > :first-child {
	margin-top: 0;
}

/* ── Paragraphs & inline text ──────────────────────────────────── */
:is(.hvnly-single-content, .hvnly-prose, .entry-content) p {
	margin-bottom: 0;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) small,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) .small {
	font-size: var(--hvnly--text-sm);
	color: var(--hvnly--ink-400);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) strong,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) b {
	font-weight: var(--hvnly--weight-bold);
	color: var(--hvnly--ink-800);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) em,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) i:not([class*="fa-"]) {
	font-style: italic;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) mark {
	background: rgba(108, 96, 254, 0.14);
	color: var(--hvnly--ink-900);
	padding: 0 4px;
	border-radius: 4px;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) sup,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) sub {
	font-size: 0.75em;
	line-height: 0;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) kbd {
	display: inline-block;
	padding: 2px 7px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 0.85em;
	background: var(--hvnly--surface-100);
	border: 1px solid var(--hvnly--border);
	border-bottom-width: 2px;
	border-radius: var(--hvnly--radius-sm);
	color: var(--hvnly--ink-800);
}

/* ── Lists ─────────────────────────────────────────────────────── */
:is(.hvnly-single-content, .hvnly-prose, .entry-content) ul,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) ol {
	padding-left: var(--hvnly--space-11);
	margin-top: var(--hvnly--space-8);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) ul {
	list-style: disc;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) ol {
	list-style: decimal;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) li + li {
	margin-top: var(--hvnly--space-4);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) li::marker {
	color: var(--hvnly--core-primary);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) li > ul,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) li > ol {
	margin-top: var(--hvnly--space-4);
}

/* ── Definition lists ────────────────────────────────────────────── */
:is(.hvnly-single-content, .hvnly-prose, .entry-content) dl {
	margin-top: var(--hvnly--space-8);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) dt {
	font-weight: var(--hvnly--weight-bold);
	color: var(--hvnly--ink-900);
	margin-top: var(--hvnly--space-7);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) dd {
	margin-left: var(--hvnly--space-11);
	color: var(--hvnly--ink-600);
}

/* ── Content links ───────────────────────────────────────────────── */
:is(.hvnly-single-content, .hvnly-prose, .entry-content) a:not(.hvnly-btn):not(.wp-block-button__link) {
	color: var(--hvnly-link-color, var(--hvnly--core-primary));
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
	transition: var(--hvnly--transition-color);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) a:not(.hvnly-btn):not(.wp-block-button__link):hover {
	color: var(--hvnly-link-hover-color, var(--hvnly--core-secondary));
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) a:not(.hvnly-btn):not(.wp-block-button__link):visited {
	color: #5a4fe8;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) a:not(.hvnly-btn):not(.wp-block-button__link):focus-visible {
	outline: 2px solid var(--hvnly--core-primary);
	outline-offset: 3px;
	border-radius: var(--hvnly--space-1);
}

/* ── Blockquote & cite ───────────────────────────────────────────── */
:is(.hvnly-single-content, .hvnly-prose, .entry-content) blockquote {
	margin: var(--hvnly--space-12) 0;
	padding: var(--hvnly--space-10) var(--hvnly--space-12);
	border-left: 3px solid var(--hvnly--core-primary);
	border-radius: 0 var(--hvnly--radius-md) var(--hvnly--radius-md) 0;
	background: var(--hvnly--surface-50);
	color: var(--hvnly--ink-600);
	font-style: italic;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) blockquote p {
	font-size: 1.05em;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) blockquote cite {
	display: block;
	margin-top: var(--hvnly--space-6);
	font-size: var(--hvnly--text-sm);
	font-style: normal;
	font-weight: var(--hvnly--weight-semibold);
	color: var(--hvnly--ink-400);
}

/* ── Code & pre ──────────────────────────────────────────────────── */
:is(.hvnly-single-content, .hvnly-prose, .entry-content) pre,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 0.9em;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) :not(pre) > code {
	padding: 2px 7px;
	border-radius: var(--hvnly--radius-sm);
	background: var(--hvnly--surface-50);
	border: 1px solid var(--hvnly--border);
	color: var(--hvnly--ink-800);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) pre {
	background: var(--hvnly--surface-dark-2);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: var(--hvnly--radius-md);
	padding: var(--hvnly--space-11);
	overflow-x: auto;
	color: #E7E5F3;
	line-height: 1.6;
	box-shadow: var(--hvnly--shadow-sm);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) pre code {
	background: none;
	border: 0;
	padding: 0;
	color: inherit;
	font-size: inherit;
}

/* ── Horizontal rule ─────────────────────────────────────────────── */
:is(.hvnly-single-content, .hvnly-prose, .entry-content) hr {
	border: 0;
	border-top: 1px solid var(--hvnly--border);
	margin: var(--hvnly--space-16) 0;
}

/* ── Images & figures ────────────────────────────────────────────── */
:is(.hvnly-single-content, .hvnly-prose, .entry-content) img,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) figure {
	border-radius: var(--hvnly--radius-lg);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) img {
	max-width: 100%;
	height: auto;
	box-shadow: var(--hvnly--shadow-sm);
	border: 1px solid var(--hvnly--border);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) figure {
	margin: var(--hvnly--space-12) 0;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) figcaption {
	margin-top: var(--hvnly--space-5);
	font-size: var(--hvnly--text-sm);
	color: var(--hvnly--ink-400);
	text-align: center;
	line-height: 1.5;
}

/* ── Global tables ───────────────────────────────────────────────── */
:is(.hvnly-single-content, .hvnly-prose, .entry-content) table,
table.hvnly-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95em;
	border: 1px solid var(--hvnly--border);
	border-radius: var(--hvnly--radius-md);
	overflow: hidden;
	box-shadow: var(--hvnly--shadow-sm);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) thead th,
table.hvnly-table thead th {
	background: var(--hvnly--surface-50);
	font-weight: var(--hvnly--weight-semibold);
	color: var(--hvnly--ink-800);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) th,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) td,
table.hvnly-table th,
table.hvnly-table td {
	border-bottom: 1px solid var(--hvnly--border);
	padding: 12px 16px;
	text-align: left;
	vertical-align: top;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) tbody tr:last-child td,
table.hvnly-table tbody tr:last-child td {
	border-bottom: 0;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) tbody tr:hover,
table.hvnly-table tbody tr:hover {
	background: var(--hvnly--surface-50);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) .wp-block-table {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* ── Media & embeds ──────────────────────────────────────────────── */
:is(.hvnly-single-content, .hvnly-prose, .entry-content) video,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) audio,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) iframe {
	max-width: 100%;
	border-radius: var(--hvnly--radius-md);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) .wp-block-embed,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) .wp-block-video,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) figure.wp-block-image,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) .wp-block-gallery {
	margin-top: var(--hvnly--space-12);
	margin-bottom: var(--hvnly--space-12);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) .wp-block-embed__wrapper {
	position: relative;
	width: 100%;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) .wp-block-embed.is-type-video .wp-block-embed__wrapper,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) .wp-block-embed.wp-embed-aspect-16-9 .wp-block-embed__wrapper {
	aspect-ratio: 16 / 9;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) .wp-block-embed.is-type-video iframe,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) .wp-block-embed.wp-embed-aspect-16-9 iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* ── Details / summary ───────────────────────────────────────────── */
:is(.hvnly-single-content, .hvnly-prose, .entry-content) details {
	border: 1px solid var(--hvnly--border);
	border-radius: var(--hvnly--radius-md);
	padding: var(--hvnly--space-7) var(--hvnly--space-9);
	background: var(--hvnly--surface-50);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) summary {
	font-weight: var(--hvnly--weight-semibold);
	color: var(--hvnly--ink-900);
	cursor: pointer;
	list-style: none;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) summary::-webkit-details-marker {
	display: none;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) details[open] summary {
	margin-bottom: var(--hvnly--space-6);
}

/* ── Gutenberg alignment & separator ─────────────────────────────── */
:is(.hvnly-single-content, .hvnly-prose, .entry-content) .alignwide {
	max-width: min(100%, calc(var(--hvnly--container-page) - 48px));
	margin-left: auto;
	margin-right: auto;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) .alignfull {
	width: 100%;
	max-width: 100%;
	margin-left: 0;
	margin-right: 0;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) .wp-block-separator,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) hr.is-style-wide {
	border: 0;
	border-top: 1px solid var(--hvnly--border);
	margin: var(--hvnly--space-14) 0;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) .wp-block-button__link,
:is(.hvnly-single-content, .hvnly-prose, .entry-content) .hvnly-btn {
	text-decoration: none;
}

/* ── Gutenberg buttons inherit global button system ────────────── */
:is(.hvnly-single-content, .hvnly-prose, .entry-content) .wp-block-button__link:not(.hvnly-btn) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--hvnly--space-4);
	font-family: var(--hvnly--font-display);
	font-weight: var(--hvnly--weight-bold);
	font-size: var(--hvnly--text-md);
	padding: 15px 28px;
	border-radius: var(--hvnly--radius-pill);
	background: var(--hvnly--core-gradient);
	color: var(--hvnly--on-primary);
	box-shadow: var(--hvnly--shadow-primary);
	transition: var(--hvnly--transition-lift);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) .wp-block-button.is-style-outline .wp-block-button__link:not(.hvnly-btn) {
	background: var(--hvnly--surface-100);
	color: var(--hvnly--ink-900);
	border: 1px solid var(--hvnly--border);
	box-shadow: none;
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) .wp-block-button__link:not(.hvnly-btn):hover {
	background: var(--hvnly--core-secondary);
	transform: translateY(-2px);
	box-shadow: var(--hvnly--shadow-primary-hover);
}

:is(.hvnly-single-content, .hvnly-prose, .entry-content) .wp-block-button.is-style-outline .wp-block-button__link:not(.hvnly-btn):hover {
	background: var(--hvnly--surface-0);
	border-color: var(--hvnly--core-primary);
	color: var(--hvnly--core-primary);
}

/* ── WordPress: galleries & captions ─────────────────────────────── */
.gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: var(--hvnly--space-7);
	margin: var(--hvnly--space-12) 0;
}

.gallery-item {
	margin: 0;
}

.gallery-icon img {
	border-radius: var(--hvnly--radius-md);
	border: 1px solid var(--hvnly--border);
}

.wp-caption,
.wp-block-image figcaption {
	max-width: 100%;
}

.wp-caption-text {
	font-size: var(--hvnly--text-sm);
	color: var(--hvnly--ink-400);
	margin-top: var(--hvnly--space-4);
	text-align: center;
}

/* ── WordPress: read more, password form, sticky ─────────────────── */
.more-link {
	display: inline-flex;
	align-items: center;
	gap: var(--hvnly--space-3);
	font-weight: var(--hvnly--weight-bold);
	color: var(--hvnly--core-primary);
	text-decoration: none;
	transition: var(--hvnly--transition-color), transform 0.2s var(--hvnly--ease);
}

.more-link:hover {
	color: var(--hvnly--core-secondary);
	transform: translateX(3px);
}

.post-password-form {
	max-width: 480px;
	padding: var(--hvnly--space-12);
	border: 1px solid var(--hvnly--border);
	border-radius: var(--hvnly--radius-lg);
	background: var(--hvnly--surface-50);
}

.post-password-form p {
	margin-bottom: var(--hvnly--space-7);
}

.post-password-form label {
	display: block;
	font-family: var(--hvnly--font-display);
	font-weight: var(--hvnly--weight-semibold);
	color: var(--hvnly--ink-900);
	margin-bottom: var(--hvnly--space-3);
}

.sticky .hvnly-blog-card::before,
.sticky .hvnly-featured-post::before {
	content: none;
}

/* ── WordPress: category / tag archives (lists) ──────────────────── */
.hvnly-archive-list a,
.widget a {
	transition: var(--hvnly--transition-color);
}

.hvnly-archive-list a:hover,
.widget a:hover {
	color: var(--hvnly-link-color, var(--hvnly--core-primary));
}

/* ── Responsive heading scale (Customizer) ───────────────────────── */
@media (max-width: 768px) {
	h1 { font-size: var(--hvnly-h1-size-mobile, var(--hvnly-h1-size, var(--hvnly--text-display-lg))); }
	h2 { font-size: var(--hvnly-h2-size-mobile, var(--hvnly-h2-size, var(--hvnly--text-display-md))); }
	h3 { font-size: var(--hvnly-h3-size-mobile, var(--hvnly-h3-size, var(--hvnly--text-xl))); }
	h4 { font-size: var(--hvnly-h4-size-mobile, var(--hvnly-h4-size, var(--hvnly--text-md))); }
	h5 { font-size: var(--hvnly-h5-size-mobile, var(--hvnly-h5-size, var(--hvnly--text-lg))); }
	h6 { font-size: var(--hvnly-h6-size-mobile, var(--hvnly-h6-size, var(--hvnly--text-base))); }
}
