/*
Theme Name: Dallin Jones
Theme URI: https://dallinjones.com
Author: Dallin Jones
Description: The block theme for dallinjones.com, built on the design system in design/: cream paper, moss ink, one rationed clay accent, Newsreader headings and every number in IBM Plex Mono.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.1
Version: 1.0.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: dallinjones
*/

/*
 * What theme.json can't express. The --moss-*, --paper-*, --s-*, --r-*, --shadow-* … variables come from
 * assets/css/tokens.css (a copy of design/tokens/); the rules here follow design/readme.md. Class names mirror the
 * design system's .jf-* components with a .dj- prefix.
 */

body {
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
}

:where(.wp-site-blocks) p,
:where(.wp-site-blocks) li {
	text-wrap: pretty;
}

:where(.wp-site-blocks) :is(h1, h2, h3, h4) {
	text-wrap: balance;
}

/* The brand signature: one italic moss phrase per heading. */
:is(h1, h2, h3, h4, .wp-block-site-title) em {
	font-style: italic;
	color: var(--text-brand);
}

a {
	text-decoration-color: var(--moss-200);
	text-underline-offset: 4px;
	transition: text-decoration-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}

a:hover {
	text-decoration-color: var(--moss-500);
}

:focus-visible {
	outline: 1px solid var(--focus-ring-color);
	box-shadow: 0 0 0 3px var(--focus-ring);
	border-radius: var(--r-xs);
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---- Layout -------------------------------------------------------------------------------------------------- */

.dj-wrap {
	max-width: var(--container-max);
	margin-inline: auto;
	padding-inline: var(--s-7);
	box-sizing: border-box;
}

@media (max-width: 720px) {
	.dj-wrap { padding-inline: var(--s-4); }
}

/* A section: a 1px rule, the mono section number in a 180px gutter, then the content. */
.dj-section {
	display: grid;
	grid-template-columns: 180px minmax(0, 1fr);
	gap: var(--s-7);
	align-items: baseline;
	padding-block: var(--s-9) 0;
	margin-block: 0;
}

.dj-section + .dj-section,
.dj-section.has-rule {
	border-top: 1px solid var(--border-subtle);
	margin-top: var(--s-9);
	padding-top: var(--s-7);
}

.dj-section > .dj-section__body > :first-child { margin-top: 0; }

@media (max-width: 800px) {
	.dj-section { grid-template-columns: 1fr; gap: var(--s-4); }
}

.dj-measure { max-width: var(--content-measure); }

/* ---- Type roles ---------------------------------------------------------------------------------------------- */

.dj-eyebrow,
.is-style-eyebrow {
	font-family: var(--font-mono);
	font-weight: var(--w-medium);
	font-size: var(--t-xs);
	line-height: 1.2;
	letter-spacing: var(--tr-eyebrow);
	text-transform: uppercase;
	color: var(--text-muted);
}

.dj-eyebrow.is-accent { color: var(--text-accent); }

.dj-lede,
.is-style-lede {
	font: var(--type-lede);
	color: var(--text-subhead);
	max-width: 42ch;
}

.dj-display {
	font-weight: var(--w-light);
	font-size: clamp(var(--t-3xl), 6vw, var(--t-4xl));
	line-height: 0.98;
	letter-spacing: var(--tr-display);
}

.dj-mono,
.dj-mono a {
	font-family: var(--font-mono);
	font-size: var(--t-sm);
	letter-spacing: var(--tr-mono);
	font-variant-numeric: tabular-nums;
}

.dj-small {
	font: var(--type-small);
	color: var(--text-muted);
}

/* ---- Header -------------------------------------------------------------------------------------------------- */

.dj-header {
	background: var(--surface-page);
	border-bottom: 1px solid var(--border-subtle);
}

.dj-header__bar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: var(--s-5);
	padding-block: var(--s-4);
}

.dj-brand {
	display: flex;
	align-items: center;
	gap: var(--s-3);
	margin: 0;
}

.dj-brand a {
	display: flex;
	align-items: center;
	gap: var(--s-3);
	color: var(--text-heading);
	text-decoration: none;
	font-family: var(--font-serif);
	font-size: var(--t-md);
	letter-spacing: var(--tr-snug);
	white-space: nowrap;
}

.dj-header .wp-block-navigation a {
	text-decoration: none;
	padding: 6px 0;
	border-bottom: 1.5px solid transparent;
	transition: color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard);
}

.dj-header .wp-block-navigation .current-menu-item > a,
.dj-header .wp-block-navigation a[aria-current="page"] {
	color: var(--moss-700);
	border-bottom-color: var(--moss-600);
}

/* ---- Stamp: the circular letter mark (design/components/core/Stamp) ------------------------------------------ */

.dj-stamp {
	width: 32px;
	height: 32px;
	flex: none;
	display: grid;
	place-items: center;
	border-radius: 50%;
	border: 1.5px solid var(--border-strong);
	color: var(--moss-700);
	font-family: var(--font-serif);
	font-style: italic;
	font-size: 14px;
	line-height: 1;
}

.dj-stamp.is-large {
	width: 88px;
	height: 88px;
	font-size: var(--t-md);
	background: var(--paper-100);
	line-height: 1.1;
	text-align: center;
}

.dj-stamp.on-inverse {
	border-color: var(--moss-200);
	color: var(--moss-100);
	width: 40px;
	height: 40px;
}

/* ---- Buttons (block styles registered in functions.php) ------------------------------------------------------ */

.wp-element-button,
.wp-block-button__link {
	min-height: var(--control-h-md);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--s-2);
	transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard),
		border-color var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
}

.wp-element-button:active,
.wp-block-button__link:active {
	transform: translateY(1px);
}

.wp-element-button:focus-visible,
.wp-block-button__link:focus-visible {
	outline: none;
	border-color: var(--focus-ring-color);
	box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Large: the hero's one highlighted action. */
.wp-block-button.is-size-lg > .wp-block-button__link {
	font-size: var(--t-base);
	padding: 14px 24px;
	min-height: var(--control-h-lg);
}

/* Accent: clay, at most one per screen. */
.wp-block-button.is-style-accent > .wp-block-button__link {
	background: var(--action-accent);
	color: var(--action-accent-text);
}

.wp-block-button.is-style-accent > .wp-block-button__link:hover {
	background: var(--action-accent-hover);
}

/* Secondary: core's "outline" style. */
.wp-block-button.is-style-outline > .wp-block-button__link {
	background: transparent;
	color: var(--action-quiet);
	border: 1px solid var(--action-quiet);
	padding: 10px 18px;
}

.wp-block-button.is-style-outline > .wp-block-button__link:hover {
	background: var(--moss-50);
}

/* Tertiary: an underlined text action, usually ending in a plain → */
.wp-block-button.is-style-tertiary > .wp-block-button__link {
	background: transparent;
	color: var(--action-quiet);
	padding-inline: 6px;
	text-decoration: underline;
	text-decoration-color: var(--moss-200);
	text-underline-offset: 4px;
}

.wp-block-button.is-style-tertiary > .wp-block-button__link:hover {
	text-decoration-color: var(--moss-500);
}

/* On inverse surfaces. */
.wp-block-button.is-style-on-inverse > .wp-block-button__link {
	background: var(--clay-400);
	color: var(--ink-900);
}

.wp-block-button.is-style-on-inverse > .wp-block-button__link:hover {
	background: var(--clay-300);
}

/* ---- Hero ------------------------------------------------------------------------------------------------------ */

/* The system's single gradient: a barely-there wash behind the web hero. */
.dj-hero {
	background: linear-gradient(180deg, var(--paper-100), var(--paper-50));
	padding-block: var(--s-8) var(--s-7);
	margin-block: 0;
}

.dj-hero__grid {
	display: grid !important;
	grid-template-columns: 1.25fr 1fr;
	gap: var(--s-7) !important;
	align-items: center;
	margin: 0;
}

.dj-hero__grid > .wp-block-column { margin: 0; }

.dj-hero h1 { margin-block: var(--s-4) var(--s-5); }

.dj-hero .dj-lede { margin-block: 0 var(--s-6); }

@media (max-width: 800px) {
	.dj-hero__grid { grid-template-columns: 1fr; }
}

/* Key facts under the hero: mono label, italic serif value. */
.dj-facts {
	display: grid !important;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: var(--s-5);
	margin-top: var(--s-7);
	padding-top: var(--s-5);
	border-top: 1px solid var(--border-subtle);
}

.dj-facts > * { margin: 0 !important; }

.dj-fact__k {
	font: var(--type-mono);
	font-size: var(--t-xs);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--text-muted);
	margin: 0 0 2px;
}

.dj-fact__v {
	font-family: var(--font-serif);
	font-style: italic;
	font-size: var(--t-lg);
	color: var(--moss-700);
	margin: 0;
}

/* ---- Image slot: the hatch placeholder (design/components/commerce/ImagePlaceholder) ------------------------- */

.dj-imgslot {
	position: relative;
	display: grid !important;
	place-items: center;
	overflow: hidden;
	border-radius: var(--r-md);
	background: repeating-linear-gradient(135deg, var(--paper-100) 0 10px, var(--paper-200) 10px 11px);
	aspect-ratio: 4 / 3;
	margin: 0;
}

.dj-imgslot.is-portrait { aspect-ratio: 4 / 5; }

.dj-imgslot > p {
	font-family: var(--font-mono);
	font-size: var(--t-xs);
	color: var(--text-muted);
	background: var(--paper-50);
	padding: 4px 10px;
	border-radius: var(--r-pill);
	max-width: 80%;
	text-align: center;
	margin: 0;
}

/* A real image dropped into a slot replaces the hatch. */
.dj-imgslot:has(img) { background: none; }
.dj-imgslot img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Cards --------------------------------------------------------------------------------------------------- */

.dj-card {
	background: var(--surface-card);
	border-radius: var(--r-md);
	box-shadow: var(--shadow-1);
	overflow: hidden;
	margin: 0;
	transition: box-shadow var(--dur-base) var(--ease-standard);
}

.dj-card:has(a):hover { box-shadow: var(--shadow-2); }

.dj-card.is-sunken {
	background: var(--surface-sunken);
	box-shadow: none;
}

.dj-card__pad { padding: var(--s-5); }

/* Project card (from ProductCard): media, mono category, serif name, muted description, dashed foot. */
.dj-project {
	display: flex !important;
	flex-direction: column;
	height: 100%;
}

.dj-project .dj-imgslot { border-radius: 0; }

.dj-project__body {
	padding: var(--s-4);
	display: flex !important;
	flex-direction: column;
	gap: var(--s-2);
	flex: 1;
}

.dj-project__body > * { margin: 0 !important; }

.dj-project__cat {
	font-family: var(--font-mono);
	font-size: 10px;
	letter-spacing: var(--tr-eyebrow);
	text-transform: uppercase;
	color: var(--text-muted);
}

.dj-project__name {
	font-family: var(--font-serif);
	font-size: var(--t-lg);
	font-weight: var(--w-regular);
	line-height: 1.15;
	letter-spacing: var(--tr-snug);
}

.dj-project__desc {
	font: var(--type-small);
	color: var(--text-muted);
}

/* The receipt tear-line: the only dashed rule in the system. */
.dj-project__foot {
	display: flex !important;
	justify-content: space-between;
	align-items: center;
	gap: var(--s-3);
	margin-top: auto !important;
	padding-top: var(--s-3);
	border-top: 1px dashed var(--border-subtle);
}

.dj-project__foot > * { margin: 0; }

.dj-grid {
	display: grid !important;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: var(--s-4);
	margin-top: var(--s-6);
}

.dj-grid > * { margin: 0 !important; }

/* ---- Inverse feature (from SubscriptionCard) with the ring motif --------------------------------------------- */

.dj-feature {
	position: relative;
	overflow: hidden;
	background: var(--surface-inverse);
	color: var(--text-on-inverse);
	border-radius: var(--r-lg);
	padding: var(--s-7);
	display: grid !important;
	grid-template-columns: 1.2fr 1fr;
	gap: var(--s-7);
	margin-top: var(--s-9);
}

/* Thin concentric circles bleeding off the top-right: only here. */
.dj-feature::before,
.dj-feature::after {
	content: "";
	position: absolute;
	pointer-events: none;
	border-radius: 50%;
	border: 1.5px solid var(--moss-400);
}

.dj-feature::before {
	top: -40px;
	right: -40px;
	width: 200px;
	height: 200px;
	opacity: 0.4;
}

.dj-feature::after {
	top: -20px;
	right: -20px;
	width: 160px;
	height: 160px;
	border-style: dashed;
	opacity: 0.3;
}

.dj-feature > * { position: relative; z-index: 1; margin: 0 !important; }

.dj-feature .dj-eyebrow { color: var(--text-accent-on-inverse); }

.dj-feature h2 {
	color: var(--paper-50);
	font-weight: var(--w-light);
	font-size: var(--t-3xl);
	line-height: var(--lh-heading);
	max-width: 16ch;
	margin: var(--s-3) 0 var(--s-4);
}

.dj-feature h2 em { color: var(--text-accent-on-inverse); }

.dj-feature .dj-lede { color: var(--text-on-inverse-muted); margin-bottom: var(--s-5); }

.dj-feature a:not(.wp-element-button) { color: var(--paper-50); text-decoration-color: var(--moss-400); }

.dj-feature__panel {
	background: var(--surface-inverse-deep);
	border-radius: var(--r-md);
	padding: var(--s-5);
	display: flex !important;
	flex-direction: column;
	gap: var(--s-4);
}

.dj-feature__panel > * { margin: 0 !important; }

.dj-spec {
	padding-bottom: var(--s-3);
	border-bottom: 1px solid var(--border-on-inverse);
}

.dj-spec:last-of-type { border-bottom: 0; padding-bottom: 0; }

.dj-spec__k {
	font-family: var(--font-mono);
	font-size: var(--t-xs);
	letter-spacing: var(--tr-label);
	text-transform: uppercase;
	color: var(--moss-200);
	margin: 0 0 4px;
}

.dj-spec__v {
	font-family: var(--font-serif);
	font-size: var(--t-md);
	color: var(--paper-50);
	margin: 0;
}

@media (max-width: 800px) {
	.dj-feature { grid-template-columns: 1fr; padding: var(--s-5); }
	.dj-feature h2 { font-size: var(--t-2xl); }
}

/* ---- Notes (post lists) -------------------------------------------------------------------------------------- */

.dj-note {
	height: 100%;
	padding: var(--s-5);
	display: flex !important;
	flex-direction: column;
	gap: var(--s-2);
	box-sizing: border-box;
}

.dj-note > * { margin: 0 !important; }

.dj-note .wp-block-post-title {
	font-size: var(--t-lg);
	font-weight: var(--w-regular);
	line-height: 1.2;
	letter-spacing: var(--tr-snug);
}

.dj-note .wp-block-post-title a { text-decoration: none; }

.dj-note .wp-block-post-featured-image { margin: calc(-1 * var(--s-5)) calc(-1 * var(--s-5)) var(--s-3) !important; }
.dj-note .wp-block-post-featured-image img { border-radius: 0; aspect-ratio: 4 / 3; object-fit: cover; }

/* The notes archive: a plain list with hairline rules, date in the gutter. */
.dj-list .wp-block-post-template { margin: 0; padding: 0; }

.dj-list .wp-block-post {
	display: grid;
	grid-template-columns: 180px minmax(0, 1fr);
	gap: var(--s-2) var(--s-7);
	padding-block: var(--s-5);
	border-bottom: 1px solid var(--border-subtle);
}

.dj-list .wp-block-post > * { margin: 0; }
.dj-list .wp-block-post-title { font-size: var(--t-xl); font-weight: var(--w-regular); }
.dj-list .wp-block-post-title a { text-decoration: none; }
.dj-list .wp-block-post-excerpt { grid-column: 2; }
.dj-list .wp-block-post-date { padding-top: 0.6em; }

@media (max-width: 800px) {
	.dj-list .wp-block-post { grid-template-columns: 1fr; }
	.dj-list .wp-block-post-excerpt { grid-column: 1; }
}

.wp-block-query-pagination {
	font-family: var(--font-mono);
	font-size: var(--t-sm);
	margin-top: var(--s-6);
}

/* ---- Single posts and pages ---------------------------------------------------------------------------------- */

.dj-article-head {
	padding-block: var(--s-8) var(--s-6);
	border-bottom: 1px solid var(--border-subtle);
	margin-bottom: var(--s-7);
}

.dj-article-head .wp-block-post-title {
	font-weight: var(--w-light);
	font-size: var(--t-3xl);
	line-height: var(--lh-heading);
	letter-spacing: var(--tr-display);
	margin-block: var(--s-3) 0;
}

.wp-block-post-content > p:first-of-type.has-lede,
.wp-block-post-content > .is-style-lede {
	font: var(--type-lede);
	color: var(--text-subhead);
}

.wp-block-post-content :where(ul, ol) li::marker { color: var(--moss-400); }

.wp-block-post-content :not(pre) > code {
	font-family: var(--font-mono);
	font-size: 0.9em;
	background: var(--surface-sunken);
	padding: 1px 5px;
	border-radius: var(--r-xs);
}

.wp-block-post-navigation-link {
	font-family: var(--font-serif);
	font-size: var(--t-md);
}

/* ---- Forms (comments, search, WooCommerce) ------------------------------------------------------------------- */

:where(.wp-site-blocks) :is(input[type="text"], input[type="email"], input[type="search"], input[type="tel"],
	input[type="url"], input[type="password"], input[type="number"], textarea, select) {
	font-family: var(--font-sans);
	font-size: var(--t-base);
	padding: 11px 14px;
	min-height: var(--control-h-md);
	background: var(--surface-card);
	border: 1px solid var(--border-default);
	border-radius: var(--r-sm);
	color: var(--text-heading);
	box-sizing: border-box;
	transition: border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}

:where(.wp-site-blocks) :is(input, textarea, select):focus {
	outline: none;
	border-color: var(--focus-ring-color);
	box-shadow: 0 0 0 3px var(--focus-ring);
}

:where(.wp-site-blocks) label {
	font-family: var(--font-mono);
	font-weight: var(--w-medium);
	font-size: var(--t-xs);
	letter-spacing: var(--tr-label);
	text-transform: uppercase;
	color: var(--text-muted);
}

/* ---- WooCommerce: prices and counts in mono, statuses as low-chroma badges ----------------------------------- */

.woocommerce-Price-amount,
.wc-block-components-product-price,
.wc-block-formatted-money-amount,
.wc-block-components-totals-item__value {
	font-family: var(--font-mono);
	font-variant-numeric: tabular-nums;
	font-weight: var(--w-medium);
	color: var(--text-heading);
}

del .woocommerce-Price-amount,
.wc-block-components-product-price del {
	color: var(--text-faint);
	font-weight: var(--w-regular);
}

.wc-block-components-product-name,
.wc-block-grid__product-title,
.wp-block-post-title.wc-block-components-product-title,
.woocommerce-loop-product__title {
	font-family: var(--font-serif);
	letter-spacing: var(--tr-snug);
}

.wc-block-components-product-sale-badge,
.onsale,
.wc-block-components-product-badge,
.stock {
	font-family: var(--font-mono);
	font-weight: var(--w-medium);
	font-size: 11px;
	letter-spacing: var(--tr-label);
	text-transform: uppercase;
	border-radius: var(--r-pill);
	padding: 4px 10px;
	border: 0;
}

.wc-block-components-product-sale-badge,
.onsale {
	background: var(--clay-100);
	color: var(--clay-600);
}

.stock.in-stock { background: var(--leaf-tint); color: var(--leaf-500); }
.stock.out-of-stock { background: var(--berry-tint); color: var(--berry-500); }
.stock.available-on-backorder { background: var(--sky-tint); color: var(--sky-500); }

.wc-block-components-notice-banner {
	border-radius: var(--r-md);
	font: var(--type-small);
}

.wc-block-components-notice-banner.is-success { background: var(--leaf-tint); border-color: var(--leaf-500); }
.wc-block-components-notice-banner.is-error { background: var(--berry-tint); border-color: var(--berry-500); }
.wc-block-components-notice-banner.is-info { background: var(--sky-tint); border-color: var(--sky-500); }
.wc-block-components-notice-banner.is-warning { background: var(--honey-tint); border-color: var(--honey-500); }

.wc-block-components-sidebar-layout .wc-block-components-sidebar {
	background: var(--surface-sunken);
	border-radius: var(--r-md);
	padding: var(--s-5);
}

.wc-block-mini-cart__badge {
	background: var(--clay-400) !important;
	color: var(--paper-50) !important;
	font-family: var(--font-mono);
}

.wp-block-woocommerce-product-image-gallery img,
.wc-block-components-product-image img,
.wp-block-woocommerce-product-image img {
	border-radius: var(--r-md);
}

/* ---- Footer: the inverse moss surface ------------------------------------------------------------------------ */

.dj-footer {
	background: var(--surface-inverse);
	color: var(--moss-100);
	padding-block: 56px;
	margin-top: var(--s-9);
}

.dj-footer__grid {
	display: grid !important;
	grid-template-columns: 1.4fr 1fr 1fr 1fr;
	gap: var(--s-6);
}

.dj-footer__grid > * { margin: 0 !important; }

.dj-footer .dj-brand a { color: var(--paper-50); }
.dj-footer .dj-brand em { color: var(--clay-200); }

.dj-footer__about {
	font: var(--type-small);
	color: var(--moss-200);
	max-width: 34ch;
	margin-top: 14px !important;
}

.dj-footer h2 {
	font: var(--type-mono);
	font-size: var(--t-xs);
	letter-spacing: var(--tr-eyebrow);
	text-transform: uppercase;
	color: var(--clay-200);
	margin: 0 0 var(--s-3);
}

.dj-footer ul {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: var(--s-2);
	font: var(--type-small);
}

.dj-footer a { color: var(--moss-100); text-decoration: none; }
.dj-footer a:hover { color: var(--paper-50); text-decoration: underline; text-decoration-color: var(--moss-400); }

.dj-footer__base {
	display: flex !important;
	justify-content: space-between;
	gap: var(--s-4);
	margin-top: 40px !important;
	padding-top: 20px;
	border-top: 1px solid var(--border-on-inverse);
	font: var(--type-mono);
	font-size: var(--t-xs);
	color: var(--moss-200);
}

.dj-footer__base > * { margin: 0 !important; }

@media (max-width: 800px) {
	.dj-footer__grid { grid-template-columns: 1fr 1fr; }
	.dj-footer__grid > :first-child { grid-column: 1 / -1; }
	.dj-footer__base { flex-direction: column; }
}

/* ---- 404 ----------------------------------------------------------------------------------------------------- */

.dj-404 {
	padding-block: var(--s-9);
	display: flex !important;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--s-4);
}

.dj-404 > * { margin: 0 !important; }
