/*
Theme Name: Origin Canvas
Theme URI: https://origin-blocks.github.io/origin-canvas/
Author: Origin
Author URI: https://github.com/origin-blocks
Description: A Full Site Editing WordPress block theme for sites that look designed, not assembled. Templates, patterns, typography, and color - one coherent system.
Requires at least: 7.0
Tested up to: 7.0
Requires PHP: 7.4
Version: 1.2.0
License: GNU General Public License v3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Text Domain: origin-canvas
Tags: blog, block-patterns, block-styles, custom-colors, custom-logo, custom-menu, editor-style, featured-images, full-site-editing, full-width-template, grid-layout, style-variations, threaded-comments, three-columns, translation-ready
*/

/* Baseline reset keeps browser defaults predictable until block styles take over. */
*, *::before, *::after {
	box-sizing: border-box;
}

* {
	margin: 0;
	padding: 0;
}

html {
	-moz-text-size-adjust: 100%;
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	-moz-osx-font-smoothing: grayscale;
	-webkit-font-smoothing: antialiased;
	line-height: 1.5;
	min-height: 100vh;
}

ul,
ol {
	list-style: none;
}

/* Block list defaults override the global reset. */
ul.wp-block-list,
ol.wp-block-list,
.wp-block-list ul,
.wp-block-list ol {
	list-style-position: outside;
	padding-inline-start: var(--wp--preset--spacing--medium);
}

ul.wp-block-list,
.wp-block-list ul {
	list-style-type: disc;
}

ol.wp-block-list,
.wp-block-list ol {
	list-style-type: decimal;
}

/* Comment bodies are freeform HTML with no layout container, so the global
   margin + list-style resets above are not otherwise restored here. */
.wp-block-comment-content > * + * {
	margin-block-start: var(--wp--preset--spacing--medium);
}

.wp-block-comment-content ul,
.wp-block-comment-content ol {
	list-style-position: outside;
	padding-inline-start: var(--wp--preset--spacing--medium);
}

.wp-block-comment-content ul {
	list-style-type: disc;
}

.wp-block-comment-content ol {
	list-style-type: decimal;
}

/* Contain long unbreakable strings so they wrap inside the card. */
.wp-block-comment-content {
	overflow-wrap: break-word;
	word-break: break-word;
}

/* Preformatted/code wraps inside the card instead of overflowing. */
.wp-block-comment-content pre {
	overflow-wrap: break-word;
	white-space: pre-wrap;
}

a {
	text-decoration: none;
}

.origin-canvas-links-plain a {
	text-decoration: none;
}

mark.has-inline-color:not([style*="background" i]):not(.has-background):not([class*="-background-color"]) {
	background-color: transparent;
}

img,
picture,
video,
canvas,
svg {
	display: block;
	max-width: 100%;
}

button,
input,
select,
textarea {
	color: inherit;
	font: inherit;
	margin: 0;
}

button,
input,
optgroup,
select,
textarea {
	font-family: inherit;
	font-size: inherit;
	line-height: inherit;
}

/* Form fields */
input:not([type="button"]):not([type="reset"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
select,
textarea {
	background-color: var(--wp--preset--color--surface-base);
	border: 1px solid var(--wp--preset--color--input-border);
	border-radius: var(--wp--custom--radius--medium);
	color: var(--wp--preset--color--text-body);
	font-size: var(--wp--preset--font-size--regular);
	padding: var(--wp--preset--spacing--compact) var(--wp--preset--spacing--medium);
	transition: box-shadow 120ms ease, border-color 120ms ease;
	width: 100%;
}

input:not([type="button"]):not([type="reset"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"])::placeholder,
textarea::placeholder {
	color: var(--wp--preset--color--text-muted);
}

input:not([type="button"]):not([type="reset"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):hover:not(:disabled):not(:focus),
select:hover:not(:disabled):not(:focus),
textarea:hover:not(:disabled):not(:focus) {
	border-color: var(--wp--preset--color--input-border);
}

input:not([type="button"]):not([type="reset"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):focus,
select:focus,
textarea:focus {
	border-color: var(--wp--preset--color--text-heading);
	box-shadow: 0 0 0 var(--wp--preset--spacing--extra-small) var(--wp--custom--ring--ink);
	outline: none;
}

input:not([type="button"]):not([type="reset"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):disabled,
select:disabled,
textarea:disabled {
	background-color: var(--wp--preset--color--surface-muted);
	border-color: var(--wp--preset--color--input-border);
	color: var(--wp--preset--color--text-body);
	cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
	* {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
}

/* Dynamic post and archive support */
.origin-canvas-post-excerpt .wp-block-post-excerpt__more-link {
	align-items: center;
	display: inline-flex;
	font-weight: 600;
	gap: 0.25rem;
	text-decoration: none;
}

.origin-canvas-post-excerpt .wp-block-post-excerpt__more-link::after {
	content: "\2192";
}

/* Featured image fallback */
.origin-canvas-featured-fallback {
	display: block;
	overflow: hidden;
}

.origin-canvas-featured-fallback--list {
	height: 100%;
	width: 100%;
}

.origin-canvas-featured-fallback--list .origin-canvas-featured-fallback__media {
	background-color: var(--wp--preset--color--surface-base);
	background-image:
		linear-gradient(to left, var(--wp--preset--color--surface-muted) 0%, color-mix(in srgb, var(--wp--preset--color--primary) 28%, var(--wp--preset--color--surface-base) 72%) 100%);
}

.origin-canvas-featured-fallback--list img {
	display: block;
	height: 100%;
	object-fit: cover;
	width: 100%;
}

.origin-canvas-featured-fallback__link {
	display: block;
	height: 100%;
	width: 100%;
}

.origin-canvas-featured-fallback__media {
	--origin-canvas-featured-fallback-edge: linear-gradient(180deg, transparent 0%, var(--wp--preset--color--surface-muted) 100%);
	background-color: var(--wp--preset--color--surface-base);
	background-image:
		radial-gradient(circle at 18% 22%, color-mix(in srgb, var(--wp--preset--color--primary) 42%, transparent) 0%, transparent 55%),
		radial-gradient(circle at 72% 30%, color-mix(in srgb, var(--wp--preset--color--primary) 32%, transparent) 0%, transparent 62%),
		radial-gradient(circle at 48% 78%, color-mix(in srgb, var(--wp--preset--color--surface-muted) 82%, transparent) 0%, transparent 64%),
		var(--origin-canvas-featured-fallback-edge),
		linear-gradient(140deg, color-mix(in srgb, var(--wp--preset--color--surface-base) 92%, transparent) 0%, color-mix(in srgb, var(--wp--preset--color--surface-muted) 72%, transparent) 100%);
	display: block;
	height: 100%;
	width: 100%;
}

/* Equal-height post grid cards */
.origin-canvas-posts--stretch .wp-block-post {
	align-items: stretch;
	display: flex;
	flex-direction: column;
	height: 100%;
}

.origin-canvas-posts--stretch .wp-block-post > .wp-block-group {
	flex: 1;
}

.origin-canvas-posts--stretch .wp-block-post-template.is-layout-grid {
	align-items: stretch;
}

.origin-canvas-post-list-card {
	align-items: stretch;
	overflow: hidden;
}

.origin-canvas-post-list-card .is-vertically-aligned-center {
	align-self: stretch;
}

.origin-canvas-post-list-card .wp-block-post-featured-image {
	height: 100%;
	width: 100%;
}

.origin-canvas-post-list-card .wp-block-post-featured-image img {
	display: block;
	height: 100%;
	object-fit: cover;
	width: 100%;
}

/* Sidebar.
   Widget-to-widget spacing is owned by the group's blockGap (the pattern /
   theme.json), which WordPress emits as constrained-layout `> * + *
   margin-block-start`. No flex/gap is set on the wrapper here: a hard flex `gap`
   would STACK with that constrained margin (they are additive), doubling the gap.
   The rules below target inner block sub-elements that have no theme.json/blockGap
   hook, so they legitimately stay CSS. */
.origin-canvas-sidebar .wp-block-latest-posts__list,
.origin-canvas-sidebar .wp-block-categories-list,
.origin-canvas-sidebar .wp-block-archives-list,
.origin-canvas-sidebar .wp-block-latest-comments {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--small);
	list-style: none;
	margin: 0;
	padding: 0;
}

.origin-canvas-sidebar .wp-block-latest-posts__featured-image {
	margin-bottom: var(--wp--preset--spacing--extra-small);
}

.origin-canvas-sidebar .wp-block-latest-posts__post-date,
.origin-canvas-sidebar .wp-block-latest-comments__comment-date {
	color: var(--wp--preset--color--text-muted);
	font-size: var(--wp--preset--font-size--extra-small);
	font-weight: 500;
}

@media (max-width: 781px) {
	.origin-canvas-sidebar {
		border-top: 1px solid var(--wp--preset--color--border);
		margin-top: var(--wp--preset--spacing--huge);
		padding-top: var(--wp--preset--spacing--huge);
	}
}

/* Pagination */
.wp-block-query-pagination,
.wp-block-comments-pagination {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--small);
	justify-content: center;
}

.wp-block-query-pagination-numbers,
.wp-block-comments-pagination-numbers {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--small);
}

.wp-block-query-pagination .page-numbers,
.wp-block-comments-pagination .page-numbers {
	min-inline-size: var(--wp--preset--spacing--extra-large);
}

.wp-block-query-pagination .page-numbers.current,
.wp-block-comments-pagination .page-numbers.current {
	align-items: center;
	background: var(--wp--preset--color--text-heading);
	border-radius: var(--wp--custom--radius--medium);
	color: var(--wp--preset--color--surface-base);
	cursor: default;
	display: inline-flex;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	justify-content: center;
	min-inline-size: var(--wp--preset--spacing--extra-large);
	padding: 0.875rem 1.25rem;
}

.wp-block-query-pagination .page-numbers.dots,
.wp-block-comments-pagination .page-numbers.dots {
	align-items: center;
	background: transparent;
	color: var(--wp--preset--color--text-body);
	cursor: default;
	display: inline-flex;
	min-inline-size: auto;
	padding: 0.875rem 0.5rem;
}

/* Table default font size - must be in CSS because core/table block.json
   rewrites theme.json selectors to target inner <table>, making wrapper
   defaults impossible via theme.json. */
.wp-block-table > table {
	font-size: var(--wp--preset--font-size--small);
}

.wp-block-table[class*="-font-size"] > table {
	font-size: inherit;
}

/* Sticky header: when the header contains a sticky child, make the header
   wrapper itself the sticky element (its containing block is the page flow, so
   it can travel), admin-bar-aware, above page content. Front end only. */
body:not(.wp-admin) header:has(> .is-position-sticky) {
	position: sticky;
	top: calc(0px + var(--wp-admin--admin-bar--height, 0px));
	z-index: 100;
}

@media (max-width: 600px) {
	header:has(> .is-position-sticky) {
		top: 0;
	}
}
