/*
Theme Name: Art Bible Editorial
Theme URI: https://artbible.co/
Description: Swiss / International Typographic Style block theme for Art Bible, built from the Editorial DS design system (paper, ink, signal red, signal yellow; Space Grotesk, Inter, JetBrains Mono).
Author: Art Bible
Version: 0.1.4
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: artbible-editorial
Update URI: false
*/

/*
 * Tokens live in theme.json (synced from src/styles.css). This file only
 * holds what theme.json cannot express. Use preset variables, never raw hex.
 */

body {
	font-feature-settings: "ss01", "cv11";
	-webkit-font-smoothing: antialiased;
}

/* ---------- Links ---------- */

a {
	text-underline-offset: 0.2em;
	text-decoration-thickness: 1px;
}

:where(.wp-site-blocks) :focus-visible {
	outline: 2px solid var(--wp--preset--color--signal-red);
	outline-offset: 2px;
}

::selection {
	background: var(--wp--preset--color--signal-yellow);
	color: var(--wp--preset--color--ink);
}

/* ---------- Meta label (DS `text-meta`) ---------- */

.is-style-meta,
.is-style-meta a {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--small) !important;
	font-weight: 400;
	letter-spacing: 0.14em;
	line-height: 1.4;
	text-transform: uppercase;
}

.is-style-meta a {
	text-decoration: none;
}

.has-signal-red-color.is-style-meta a {
	color: inherit;
}

/* ---------- Lead paragraph (DS `Lead`) ---------- */

.is-style-lead {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.4;
	max-width: 52ch;
}

/* ---------- Rules ---------- */

.rule-t {
	border-top: 1px solid var(--wp--custom--color--rule);
}

.rule-b {
	border-bottom: 1px solid var(--wp--custom--color--rule);
}

/* ---------- Separator (DS `Separator`) ---------- */

.wp-block-separator {
	border: 0;
	border-top: 1px solid var(--wp--custom--color--rule);
	margin-block: var(--wp--preset--spacing--40);
}

.wp-block-separator.is-style-dots {
	border: 0;
	background: none;
	height: auto;
	font-size: 1.5rem;
	letter-spacing: 0.5em;
	text-align: center;
}

.wp-block-separator.is-style-dots::before {
	content: "· · ·";
	color: var(--wp--preset--color--ink);
	padding-left: 0.5em;
}

.wp-block-separator.is-style-block {
	border: 0;
	height: 0.5rem;
	background: var(--wp--preset--color--ink);
	opacity: 1;
}

/* ---------- Text ---------- */

.has-drop-cap:not(:focus)::first-letter {
	font-family: var(--wp--preset--font-family--display);
	font-size: 4.5em;
	font-weight: 700;
	line-height: 0.8;
	margin: 0.08em 0.12em 0 0;
}

.wp-block-post-content :is(ul, ol) {
	padding-left: 1.5rem;
}

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

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

.wp-block-quote cite,
.wp-block-pullquote cite {
	display: block;
	margin-top: 0.75rem;
}

.wp-block-quote cite::before,
.wp-block-pullquote cite::before {
	content: "— ";
}

.wp-block-pullquote {
	text-align: left;
	border-top: 0;
	border-bottom: 0;
	margin-block: var(--wp--preset--spacing--50);
}

.wp-block-pullquote blockquote p::before {
	content: "\201C";
}

.wp-block-pullquote blockquote p:last-of-type::after {
	content: "\201D";
}

.wp-block-verse {
	white-space: pre-wrap;
}

.wp-block-details {
	border-block: 1px solid var(--wp--custom--color--rule);
	padding-block: 1rem;
}

.wp-block-details summary {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 700;
	letter-spacing: -0.02em;
	cursor: pointer;
	list-style: none;
	display: flex;
	justify-content: space-between;
}

.wp-block-details summary::-webkit-details-marker {
	display: none;
}

.wp-block-details summary::after {
	content: "+";
	color: var(--wp--preset--color--signal-red);
}

.wp-block-details[open] summary::after {
	content: "−";
}

/* ---------- Table (DS `EditorialTable`) ---------- */

.wp-block-table table {
	border-collapse: collapse;
	width: 100%;
}

.wp-block-table :is(th, td) {
	border: 0;
	border-bottom: 1px solid var(--wp--custom--color--rule);
	padding: 0.75rem 1rem 0.75rem 0;
	text-align: left;
	vertical-align: top;
}

.wp-block-table thead {
	border-bottom: 2px solid var(--wp--preset--color--ink);
}

.wp-block-table th {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 400;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	vertical-align: bottom;
}

/* ---------- Media ---------- */

.wp-block-image img,
.wp-block-post-featured-image img {
	display: block;
}

.wp-block-image figcaption,
.wp-block-embed figcaption,
.wp-element-caption {
	margin-top: 0.75rem;
	text-align: left;
}

/* ---------- Buttons (DS `Button`) ---------- */

.wp-block-button.is-style-outline > .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--ink);
	border: 1px solid var(--wp--preset--color--ink);
	padding: calc(0.75rem - 1px) calc(1.25rem - 1px);
}

.wp-block-button.is-style-outline > .wp-block-button__link:hover {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--paper);
}

.wp-block-button.is-style-signal > .wp-block-button__link {
	background: var(--wp--preset--color--signal-red);
}

.wp-block-button.is-style-signal > .wp-block-button__link:hover {
	background: var(--wp--preset--color--ink);
}

/* ---------- Callouts (DS `Callout`) ---------- */

.wp-block-group[class*="is-style-callout-"] {
	padding: var(--wp--preset--spacing--40);
}

.wp-block-group.is-style-callout-yellow {
	background: var(--wp--preset--color--signal-yellow);
	color: var(--wp--preset--color--ink);
}

.wp-block-group.is-style-callout-red {
	background: var(--wp--preset--color--signal-red);
	color: var(--wp--preset--color--paper);
}

.wp-block-group.is-style-callout-ink {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--paper);
}

.wp-block-group.is-style-callout-outline {
	border: 2px solid var(--wp--preset--color--ink);
}

.wp-block-group:is(.is-style-callout-red, .is-style-callout-ink) a {
	color: inherit;
}

/* ---------- Site chrome ---------- */

.wp-block-navigation a:hover,
.wp-block-site-title a:hover,
.wp-block-post-title a:hover {
	color: var(--wp--preset--color--signal-red);
}

.wp-block-post-terms a {
	text-decoration: none;
}

.wp-block-post-terms.has-text-color a {
	color: inherit;
}

.wp-block-post-terms a:hover {
	text-decoration: underline;
}

.wp-block-post-terms__separator {
	opacity: 0.5;
}

/* Post index rows */
.post-row {
	border-top: 1px solid var(--wp--custom--color--rule);
	padding-block: var(--wp--preset--spacing--40);
}

.post-row > .wp-block-column:empty {
	display: none;
}

.post-row .wp-block-post-featured-image {
	margin: 0;
}

.post-row .wp-block-post-featured-image img {
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.wp-block-query-pagination {
	border-top: 1px solid var(--wp--custom--color--rule);
	padding-top: var(--wp--preset--spacing--30);
}

.wp-block-query-pagination a {
	text-decoration: none;
}

.wp-block-query-pagination-numbers .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2rem;
	height: 2rem;
}

.wp-block-query-pagination-numbers .page-numbers.current {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--paper);
}

/* Comments */
.wp-block-comments input:not([type="submit"]),
.wp-block-comments textarea,
.wp-block-search__input {
	background: var(--wp--preset--color--paper-pure);
	border: 1px solid var(--wp--preset--color--ink);
	border-radius: 0;
	font: inherit;
	padding: 0.75rem;
}

/* ---------- Legacy content normalisation ----------
 * Many artbible.co posts were pasted from Gmail, Word, Google Docs or Medium
 * and carry inline font-family / font-size / colour styles (Times New Roman,
 * Calibri, Garamond, #0000ff …). Neutralise them inside post content so the
 * design system's typography holds. Remove a rule here if an author's
 * deliberate colour should survive.
 */

.wp-block-post-content [style*="font-family"] {
	font-family: inherit !important;
}

.wp-block-post-content [style*="font-size"]:not(.has-text-align-center, [class*="has-"][class*="-font-size"]) {
	font-size: inherit !important;
}

.wp-block-post-content [style*="color"]:not([class*="has-"][class*="-color"]) {
	color: inherit !important;
	background-color: transparent !important;
}

.wp-block-post-content [style*="line-height"] {
	line-height: inherit !important;
}

.wp-block-post-content font {
	font-family: inherit;
	font-size: inherit;
	color: inherit;
}

/* Classic editor images and captions ([caption] shortcode).
 * Cap height so a whole portrait painting fits on screen. */
.wp-block-post-content img,
.single .wp-block-post-featured-image img {
	max-width: 100%;
	max-height: 85vh;
	width: auto;
	height: auto;
}

.wp-block-post-content .wp-caption {
	max-width: 100% !important;
	margin-block: var(--wp--preset--spacing--40);
}

.wp-block-post-content .wp-caption-text {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	line-height: 1.4;
	color: var(--wp--preset--color--ink-soft);
	margin-top: 0.75rem;
}

.wp-block-post-content .aligncenter {
	display: block;
	margin-inline: auto;
}

.wp-block-post-content :is(img, .wp-caption).alignleft {
	float: left;
	margin: 0.5rem var(--wp--preset--spacing--30) 1rem 0;
	max-width: 50%;
}

.wp-block-post-content :is(img, .wp-caption).alignright {
	float: right;
	margin: 0.5rem 0 1rem var(--wp--preset--spacing--30);
	max-width: 50%;
}

.wp-block-post-content::after {
	content: "";
	display: table;
	clear: both;
}

/* Embeds from classic posts (YouTube via Jetpack, raw iframes). */
.wp-block-post-content .jetpack-video-wrapper,
.wp-block-post-content iframe {
	max-width: 100%;
}

.wp-block-post-content .jetpack-video-wrapper iframe,
.wp-block-post-content p > iframe[src*="youtube"] {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
}

/* Gmail-pasted quote blocks */
.wp-block-post-content .gmail_quote {
	border-left: 2px solid var(--wp--custom--color--rule);
	padding-left: var(--wp--preset--spacing--30);
	margin: 0;
}

/* Classic-editor blockquotes (no .wp-block-quote class). */
.wp-block-post-content blockquote:not([class]) {
	border-left: 2px solid var(--wp--preset--color--ink);
	padding-left: var(--wp--preset--spacing--30);
	margin-inline: 0;
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.3;
}

@media (max-width: 600px) {
	.wp-block-post-content :is(img, .wp-caption):is(.alignleft, .alignright) {
		float: none;
		max-width: 100%;
		margin-inline: 0;
	}
}

/* Footer category list */
.footer-categories {
	list-style: none;
	padding: 0;
	margin: 0;
}

.footer-categories li + li,
.footer-categories .children {
	margin-top: 0.5rem;
}

.footer-categories .children {
	list-style: none;
	padding-left: 1rem;
}

.footer-categories a {
	text-decoration: none;
}

.footer-categories a:hover {
	text-decoration: underline;
}

.wp-block-search__button-inside .wp-block-search__inside-wrapper {
	border: 1px solid var(--wp--preset--color--ink);
	background: var(--wp--preset--color--paper-pure);
	padding: 0;
}

.wp-block-search__button-inside .wp-block-search__input {
	border: 0;
}

.wp-block-search__button {
	margin: 0;
}
