/*
Theme Name: Inkbridge Theme
Theme URI: https://inkbridge.my
Author: Inkbridge
Author URI: https://inkbridge.my
Description: AI-Agent-First Theme — fully operated by AI agents, not humans. No manual CSS/JS/PHP editing needed. Optimized for rendering AI-generated HTML content. Use as a parent theme with a child theme per site. See AGENTS.md for the AI agent guide.
Requires at least: 6.7
Tested up to: 6.9
Requires PHP: 8.0
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: inkbridge-theme
Tags: one-column, custom-colors, custom-menu, custom-logo, full-site-editing, wide-blocks, block-styles
*/

/* === Empty Paragraph Cleanup === */
.wp-block-post-content p:empty,
.entry-content p:empty {
	display: none;
}

/* === Progressive Enhancement === */
h1, h2, h3, h4, h5, h6, blockquote, figcaption, p {
	text-wrap: pretty;
}

/* === Accessibility: Focus Styles === */
:where(.wp-site-blocks *:focus) {
	outline: 2px solid var(--wp--preset--color--accent-1);
	outline-offset: 2px;
}

/* === Link Consistency === */
a {
	text-decoration-thickness: 1px !important;
	text-underline-offset: 0.15em;
}

/* === Overflow Handling === */
:where(pre) {
	overflow-x: auto;
}

.wp-block-table {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* === Navigation Submenu === */
.wp-block-navigation .wp-block-navigation-submenu .wp-block-navigation-item:not(:last-child) {
	margin-bottom: 3px;
}

/*
 * === Raw HTML Content Styling ===
 * Classic Editor / AI-generated content is raw HTML (no block wrappers).
 * WordPress applies wpautop() for <p> tags, but elements like <table>,
 * <pre>, <code>, <blockquote>, <ul>, <ol> need direct selectors.
 * theme.json block styles only target .wp-block-* classes.
 * These rules ensure identical rendering for raw HTML.
 */

/* Headings */
.wp-block-post-content h1,
.wp-block-post-content h2,
.wp-block-post-content h3,
.wp-block-post-content h4,
.wp-block-post-content h5,
.wp-block-post-content h6 {
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: -0.02em;
	margin-top: 1.5em;
	margin-bottom: 0.5em;
}

.wp-block-post-content h1 { font-size: var(--wp--preset--font-size--xxx-large); }
.wp-block-post-content h2 { font-size: var(--wp--preset--font-size--xx-large); }
.wp-block-post-content h3 { font-size: var(--wp--preset--font-size--x-large); }
.wp-block-post-content h4 { font-size: var(--wp--preset--font-size--large); }
.wp-block-post-content h5 {
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}
.wp-block-post-content h6 {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
}

/* Strong weight normalization */
.wp-block-post-content strong {
	font-weight: 600;
}

/* Lists */
.wp-block-post-content ul,
.wp-block-post-content ol {
	line-height: 1.7;
	padding-left: 1.5em;
}

.wp-block-post-content li {
	margin-top: 0.5rem;
}

.wp-block-post-content li::marker {
	color: var(--wp--preset--color--accent-1);
}

/* Nested lists */
.wp-block-post-content ul ul,
.wp-block-post-content ol ol,
.wp-block-post-content ul ol,
.wp-block-post-content ol ul {
	margin-top: 0.25rem;
	margin-bottom: 0.25rem;
}

/* Blockquotes */
.wp-block-post-content blockquote {
	border-left: 4px solid var(--wp--preset--color--accent-1);
	background: var(--wp--preset--color--accent-3);
	padding: 1rem 1.5rem;
	margin: 1.5em 0;
	font-size: var(--wp--preset--font-size--large);
	font-style: normal;
}

/* Tables */
.wp-block-post-content table {
	border-collapse: collapse;
	width: 100%;
	font-size: var(--wp--preset--font-size--small);
}

.wp-block-post-content th {
	text-align: left;
	font-weight: 600;
	background: var(--wp--preset--color--accent-3);
}

.wp-block-post-content th,
.wp-block-post-content td {
	padding: 0.75rem 1rem;
	border-bottom: 1px solid var(--wp--preset--color--accent-6);
}

.wp-block-post-content tr:hover td {
	background: var(--wp--preset--color--accent-3);
}

/* Code: inline */
.wp-block-post-content code {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.875em;
	background: var(--wp--preset--color--accent-3);
	padding: 0.15em 0.4em;
	border-radius: 4px;
}

/* Code: blocks */
.wp-block-post-content pre {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.7;
	background: var(--wp--preset--color--accent-3);
	border: 1px solid var(--wp--preset--color--accent-6);
	border-radius: 8px;
	padding: 1.5rem;
	overflow-x: auto;
}

.wp-block-post-content pre code {
	background: none;
	padding: 0;
	border-radius: 0;
	font-size: inherit;
}

/* Images */
.wp-block-post-content img {
	max-width: 100%;
	height: auto;
	border-radius: 8px;
}

/* Horizontal rules */
.wp-block-post-content hr {
	border: none;
	border-top: 1px solid var(--wp--preset--color--accent-6);
	margin: 2em 0;
}
