/*
 * Clara Codex theme: the rules theme.json cannot express.
 * Colours, sizes and spacing come only from theme.json presets (CSS custom properties).
 */

/* Focus: a clear outline for keyboard users on everything that can be focused. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--primary);
	outline-offset: var(--wp--custom--focus--offset);
}

.wp-element-button:focus-visible,
.wp-block-button__link:focus-visible {
	outline-color: var(--wp--preset--color--contrast);
}

/* Tap targets: at least 44 px for buttons and menu links. */
.wp-element-button,
.wp-block-button__link {
	min-height: var(--wp--custom--tap-target);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-align: center;
}

.wp-block-navigation .wp-block-navigation-item__content,
.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close {
	min-height: var(--wp--custom--tap-target);
	min-width: var(--wp--custom--tap-target);
	display: inline-flex;
	align-items: center;
}

.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close {
	justify-content: center;
}

/* Smooth scrolling only for people who have not asked for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

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

/* No horizontal scrolling at any width. */
html,
body {
	overflow-x: clip;
}

img,
svg,
video {
	max-width: 100%;
	height: auto;
}

/* Header */
.claracodex-header {
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.claracodex-brand .wp-block-site-logo img {
	display: block;
	height: auto;
}

.claracodex-header .wp-block-site-title a:hover {
	text-decoration: underline;
}

/* Show "Sign in" beside the button on wider screens and inside the menu on phones. */
@media (max-width: 599px) {
	.claracodex-hide-mobile {
		display: none !important;
	}
}

@media (min-width: 600px) {
	.claracodex-show-mobile {
		display: none !important;
	}
}

/* Eyebrow: the small label above a heading. */
.is-style-eyebrow {
	color: var(--wp--preset--color--primary-strong);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

/* Checklist: list items with a tick. */
.is-style-checklist {
	list-style: none;
	padding-left: 0;
}

.is-style-checklist li {
	position: relative;
	padding-left: 1.75em;
}

.is-style-checklist li + li {
	margin-top: 0.5em;
}

.is-style-checklist li::before {
	content: "";
	position: absolute;
	left: 0.15em;
	top: 0.35em;
	width: 0.45em;
	height: 0.8em;
	border: solid var(--wp--preset--color--primary);
	border-width: 0 0.16em 0.16em 0;
	transform: rotate(45deg);
}

/* Step numbers in "How it works". */
.claracodex-step-number {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 999px;
	background: var(--wp--preset--color--primary-soft);
	color: var(--wp--preset--color--primary-strong);
	font-weight: 700;
}

/* Feature cards: a small accent mark above the heading. */
.claracodex-feature::before {
	content: "";
	display: block;
	width: 2.25rem;
	height: 0.3rem;
	margin-bottom: var(--wp--preset--spacing--30);
	border-radius: 999px;
	background: var(--wp--preset--color--primary);
}

/* Highlighted pricing card. */
.claracodex-highlight {
	border-color: var(--wp--preset--color--primary) !important;
	border-width: 2px !important;
	box-shadow: var(--wp--preset--shadow--raised);
}

/* Product pictures. */
.claracodex-shot img {
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--large);
	box-shadow: var(--wp--preset--shadow--raised);
}

/* Footer links: one per line, tall enough to tap. */
.claracodex-footer-links {
	list-style: none;
	padding-left: 0;
	margin-top: var(--wp--preset--spacing--20);
}

.claracodex-footer-links a {
	display: inline-flex;
	align-items: center;
	min-height: var(--wp--custom--tap-target);
	color: var(--wp--preset--color--contrast-2);
	text-decoration: none;
}

.claracodex-footer-links a:hover {
	color: var(--wp--preset--color--contrast);
	text-decoration: underline;
}

/* Footer bottom line: copyright and version, theme credit. */
.claracodex-footer-bottom {
	color: var(--wp--preset--color--contrast-3);
	row-gap: 0.25rem;
}

.claracodex-footer-bottom p {
	margin: 0;
}

.claracodex-footer-bottom a {
	color: var(--wp--preset--color--contrast-2);
}

/* Logo row: names set as text so they work in every style variation. */
.claracodex-logos p {
	color: var(--wp--preset--color--contrast-3);
	font-weight: 700;
	letter-spacing: -0.01em;
}

/* Initials avatars for the team pattern. */
.claracodex-initials {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 4rem;
	height: 4rem;
	border-radius: 999px;
	background: var(--wp--preset--color--primary-soft);
	color: var(--wp--preset--color--primary-strong);
	font-weight: 700;
	font-size: var(--wp--preset--font-size--large);
}

/* FAQ (details block). */
.wp-block-details summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--wp--preset--color--contrast);
	min-height: var(--wp--custom--tap-target);
	display: flex;
	align-items: center;
	gap: 0.75rem;
	list-style: none;
}

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

.wp-block-details summary::after {
	content: "+";
	margin-left: auto;
	font-size: 1.5em;
	line-height: 1;
	color: var(--wp--preset--color--primary-strong);
}

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

.wp-block-details > :not(summary) {
	margin-top: var(--wp--preset--spacing--20);
}

/* Tables: keep wide tables inside their box. */
.wp-block-table {
	overflow-x: auto;
}

.wp-block-table th {
	color: var(--wp--preset--color--contrast);
	text-align: left;
}

.wp-block-table td,
.wp-block-table th {
	border-color: var(--wp--preset--color--border);
	padding: 0.75em;
}

.wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
	background-color: var(--wp--preset--color--base-2);
}

/* Placeholder text the owner must replace, easy to spot. */
.claracodex-placeholder {
	background: var(--wp--preset--color--primary-soft);
	border-left: 4px solid var(--wp--preset--color--primary);
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
}

/* Forms in search and comments. */
input[type="text"],
input[type="email"],
input[type="search"],
input[type="url"],
input[type="tel"],
textarea,
select {
	min-height: var(--wp--custom--tap-target);
	border: 1px solid var(--wp--preset--color--contrast-3);
	border-radius: var(--wp--custom--radius--small);
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	font: inherit;
	padding: 0.5rem 0.75rem;
}

/* Official profile icons in the footer (W50), shown only when set in Clara Codex > Search & sharing. */
.claracodex-social.wp-block-social-links {
	margin-top: var(--wp--preset--spacing--40);
	gap: 0.75rem;
}

.claracodex-social .wp-social-link {
	color: var(--wp--preset--color--contrast-2);
}

.claracodex-social .wp-social-link:hover {
	color: var(--wp--preset--color--primary);
}

/* Tables (W52): a line between rows, a bold header, and sideways scrolling on narrow screens. */
.wp-block-table {
	overflow-x: auto;
}

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

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

.wp-block-table thead th {
	border-bottom: 2px solid var(--wp--preset--color--contrast);
	font-weight: 600;
}
