/*
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.1
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
*/

/* === 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;
}

/* === Language Toggle === */
.tkb-lang-toggle a {
	font-size: 0.75rem !important;
	font-weight: 700 !important;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 10px 24px;
	border: 1.5px solid var(--wp--preset--color--accent-1);
	border-radius: 4px;
}

.tkb-lang-toggle a:hover {
	background: var(--wp--preset--color--accent-1);
	color: #fff !important;
}

/* === Search Toggle Button === */
.tkb-search-toggle {
	background: none;
	border: none;
	cursor: pointer;
	padding: 6px;
	color: var(--wp--preset--color--contrast);
	display: flex;
	align-items: center;
}

.tkb-search-toggle:hover {
	color: var(--wp--preset--color--accent-1);
}

/* === Search Overlay Bar === */
.tkb-search-bar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 99999;
	background: var(--wp--preset--color--accent-5);
	box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.admin-bar .tkb-search-bar {
	top: 32px;
}

@media screen and (max-width: 782px) {
	.admin-bar .tkb-search-bar {
		top: 46px;
	}
}

.tkb-search-bar-inner {
	max-width: 600px;
	margin: 0 auto;
	padding: 20px var(--wp--preset--spacing--40);
}

.tkb-search-bar form {
	display: flex;
	gap: 0;
	max-width: 600px;
	margin: 0 auto;
}

.tkb-search-bar input[type="search"] {
	flex: 1;
	padding: 10px 16px;
	border: 1px solid rgba(255,255,255,0.2);
	border-right: none;
	border-radius: 6px 0 0 6px;
	background: rgba(255,255,255,0.1);
	color: #fff;
	font-size: 0.9375rem;
	font-family: inherit;
	outline: none;
}

.tkb-search-bar input[type="search"]::placeholder {
	color: rgba(255,255,255,0.5);
}

.tkb-search-bar input[type="search"]:focus {
	border-color: var(--wp--preset--color--accent-1);
	background: rgba(255,255,255,0.15);
}

.tkb-search-bar button[type="submit"] {
	padding: 10px 16px;
	border: 1px solid rgba(255,255,255,0.2);
	border-left: none;
	border-radius: 0 6px 6px 0;
	background: var(--wp--preset--color--accent-1);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
}

.tkb-search-bar button[type="submit"]:hover {
	background: #4338CA;
}

.tkb-search-close {
	background: transparent;
	border: none;
	color: rgba(255,255,255,0.6);
	cursor: pointer;
	padding: 8px;
	margin-left: 8px;
	display: flex;
	align-items: center;
}

.tkb-search-close:hover {
	color: #fff;
}

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