/*
Theme Name:     Swix
Theme URI:
Description:    SWIX brand child theme, built on Twenty Twenty-Five.
Author:         Logical Solutions
Author URI:
Template:       twentytwentyfive
Version:        0.1.0
Text Domain:    swix
*/

/* ---------- Accessibility: visible focus states everywhere ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.wp-block-button__link:focus-visible {
	outline: 3px solid var(--wp--preset--color--mint-text);
	outline-offset: 2px;
}

/* ---------- Headings on dark sections: theme.json forces heading color to ink
   directly on the element, which beats inheritance from a container's
   textColor:white, so ink-background sections need it re-asserted here. ---------- */
.has-ink-background-color h1,
.has-ink-background-color h2,
.has-ink-background-color h3,
.has-ink-background-color h4,
.has-ink-background-color h5,
.has-ink-background-color h6 {
	color: var(--wp--preset--color--white);
}

/* ---------- Hexagon structural motif (list markers, step numbers) ---------- */
.swix-hex-list {
	list-style: none;
	margin-inline: 0;
	margin-block-end: 0;
	padding: 0;
}
.swix-hex-list li {
	position: relative;
	padding-left: 2.25rem;
	margin-bottom: 1rem;
}
.swix-hex-list li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.35em;
	width: 1.4rem;
	height: 1.4rem;
	background-color: var(--wp--preset--color--mint);
	clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

.swix-hex-step {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	background-color: var(--wp--preset--color--mint);
	color: var(--wp--preset--color--ink);
	font-weight: 600;
	clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

/* ---------- Semantic status colour: mint = healthy/monitored, amber = attention ---------- */
.swix-status-ok {
	color: var(--wp--preset--color--mint-text);
}
.swix-status-alert {
	color: var(--wp--preset--color--amber);
}

/* ---------- Honeycomb background clusters ----------
   Corner clusters from assets/patterns (regenerate with generate.py there).
   Dark set on ink sections; light set on white/paper sections, alternating
   corners down the page so consecutive sections don't repeat. ---------- */
.swix-pattern-bg {
	background-image: url("assets/patterns/hex-dark-tr.svg"), url("assets/patterns/hex-dark-bl.svg");
	background-repeat: no-repeat;
	background-position: right -40px top -60px, left -60px bottom -80px;
	background-size: 520px 520px, 380px 380px;
}
.wp-block-post-content > .alignfull.has-white-background-color,
.wp-block-post-content > .alignfull.has-paper-background-color {
	background-image: url("assets/patterns/hex-light-tr.svg"), url("assets/patterns/hex-light-bl.svg");
	background-repeat: no-repeat;
	background-position: right -60px top -80px, left -80px bottom -100px;
	background-size: 460px 460px, 320px 320px;
}
.wp-block-post-content > .alignfull.has-white-background-color:nth-child(even),
.wp-block-post-content > .alignfull.has-paper-background-color:nth-child(even) {
	background-image: url("assets/patterns/hex-light-tl.svg"), url("assets/patterns/hex-light-br.svg");
	background-position: left -60px top -80px, right -80px bottom -100px;
}
/* Top-level sections that sit on the page's own white get the light clusters
   too, drawn full-bleed behind the 1200px wide column. */
.wp-block-post-content > .alignwide:not(.has-background) {
	position: relative;
	isolation: isolate;
}
.wp-block-post-content > .alignwide:not(.has-background)::before {
	content: "";
	position: absolute;
	z-index: -1;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 100vw;
	transform: translateX(-50%);
	pointer-events: none;
	background-image: url("assets/patterns/hex-light-tl.svg"), url("assets/patterns/hex-light-br.svg");
	background-repeat: no-repeat;
	background-position: left -60px top -80px, right -80px bottom -100px;
	background-size: 400px 400px, 300px 300px;
}
.wp-block-post-content > .alignwide:not(.has-background):nth-child(even)::before {
	background-image: url("assets/patterns/hex-light-tr.svg"), url("assets/patterns/hex-light-bl.svg");
	background-position: right -60px top -80px, left -80px bottom -100px;
}
.wp-site-blocks {
	overflow-x: clip;
}
@media (max-width: 781px) {
	.swix-pattern-bg {
		background-size: 340px 340px, 240px 240px;
	}
	.wp-block-post-content > .alignfull.has-white-background-color,
	.wp-block-post-content > .alignfull.has-paper-background-color,
	.wp-block-post-content > .alignwide:not(.has-background)::before {
		background-size: 280px 280px, 200px 200px;
	}
}

/* ---------- Cards: flat, thin border, subtle tint on hover ---------- */
.wp-block-column.has-border-color {
	border-radius: 2px;
	transition: background-color 0.15s ease;
}
.wp-block-column.has-border-color:hover {
	background-color: rgba(134, 222, 217, 0.08);
}
@media (prefers-reduced-motion: reduce) {
	.wp-block-column.has-border-color {
		transition: none;
	}
}

/* ---------- Product screenshots: flat, thin border, never a shadow ---------- */
.wp-block-image.swix-shot img {
	display: block;
}
.wp-block-image.swix-shot figcaption {
	margin-top: 12px;
	color: var(--wp--preset--color--text-dim);
	font-size: 0.85rem;
	text-align: center;
}

/* ---------- Panels on dark: surface fill + hairline border, never a shadow ---------- */
.swix-panel {
	background-color: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 2px;
}
.swix-panel > .swix-panel-header {
	background-color: var(--wp--preset--color--surface-2);
	border-bottom: 1px solid var(--wp--preset--color--line);
	padding: 12px 20px;
}
.swix-panel > .swix-panel-body {
	padding: 24px;
}

/* ---------- Timeline (hero night-shift direction, 6.7) ---------- */
.swix-timeline {
	display: flex;
	flex-wrap: wrap;
	gap: 28px 8px;
	list-style: none;
	margin-inline: 0;
	margin-block-end: 0;
	padding: 0;
	counter-reset: none;
}
.swix-timeline li {
	flex: 1 1 120px;
	position: relative;
	padding-top: 28px;
	border-top: 2px solid var(--wp--preset--color--mint);
}
.swix-timeline li.is-anomaly {
	border-top-color: var(--wp--preset--color--amber);
}
.swix-timeline li::before {
	content: "";
	position: absolute;
	top: -7px;
	left: 0;
	width: 12px;
	height: 12px;
	background-color: var(--wp--preset--color--mint);
	clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}
.swix-timeline li.is-anomaly::before {
	background-color: var(--wp--preset--color--amber);
}
.swix-timeline time {
	display: block;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.95rem;
	color: var(--wp--preset--color--mint);
	margin-bottom: 6px;
}
.swix-timeline li.is-anomaly time {
	color: var(--wp--preset--color--amber);
}
.swix-timeline p {
	margin: 0;
	font-size: 0.9rem;
	color: rgba(255, 255, 255, 0.75);
}

/* ---------- Homepage carousel (js/swix-carousel.js) ----------
   A scroll-snap track, so it still swipes without JS. The script adds the
   controls row and .is-enhanced / .is-playing state classes. ---------- */
.swix-carousel {
	position: relative;
}
.swix-carousel-track {
	position: relative;
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
}
.swix-carousel.is-enhanced .swix-carousel-track {
	scrollbar-width: none;
}
.swix-carousel.is-enhanced .swix-carousel-track::-webkit-scrollbar {
	display: none;
}
:root .swix-carousel-track > .swix-slide {
	display: flex;
	flex-direction: column;
	justify-content: center;
	flex: 0 0 100%;
	min-width: 0;
	margin: 0;
	scroll-snap-align: start;
}
:root .swix-slide > .wp-block-columns {
	gap: 4rem;
	margin: 0;
}
.swix-slide .wp-block-image.swix-shot img {
	width: 100%;
	height: auto;
}
:root .swix-slide-panel > * + * {
	margin-block-start: 2rem;
}
.swix-slide-panel .swix-hex-list li:last-child {
	margin-bottom: 0;
}
.swix-slide-logo img {
	display: block;
	width: 100%;
	max-width: 300px;
	height: auto;
}

.swix-carousel-controls {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 2.5rem;
	padding-top: 20px;
	border-top: 1px solid rgba(17, 17, 17, 0.15);
}
.swix-carousel-dots {
	display: flex;
	flex: 1 1 auto;
	gap: 28px;
	min-width: 0;
}
.swix-carousel-dot,
.swix-carousel-arrow,
.swix-carousel-pause {
	font: inherit;
	cursor: pointer;
	background: none;
	border: 0;
	color: var(--wp--preset--color--ink);
}
.swix-carousel-dot {
	position: relative;
	padding: 10px 0;
	font-family: var(--wp--preset--font-family--display);
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgba(17, 17, 17, 0.5);
	transition: color 0.15s ease;
}
.swix-carousel-dot::before,
.swix-carousel-dot::after {
	content: "";
	position: absolute;
	left: 0;
	top: -21px;
	height: 3px;
}
.swix-carousel-dot::before {
	right: 0;
}
.swix-carousel-dot:hover,
.swix-carousel-dot[aria-current="true"] {
	color: var(--wp--preset--color--ink);
}
.swix-carousel-dot[aria-current="true"]::before {
	background-color: rgba(11, 91, 87, 0.25);
}
.swix-carousel-dot[aria-current="true"]::after {
	width: 100%;
	background-color: var(--wp--preset--color--mint-text);
}
.swix-carousel.is-playing .swix-carousel-dot[aria-current="true"]::after {
	animation: swix-carousel-progress 7s linear forwards;
}
@keyframes swix-carousel-progress {
	from { width: 0; }
	to { width: 100%; }
}
.swix-carousel-arrow,
.swix-carousel-pause {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 44px;
	height: 44px;
	border: 1px solid var(--wp--preset--color--ink);
	border-radius: 2px;
	font-size: 1.1rem;
	transition: background-color 0.15s ease, color 0.15s ease;
}
.swix-carousel-arrow:hover,
.swix-carousel-pause:hover {
	background-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--white);
}
@media (max-width: 781px) {
	:root .swix-slide > .wp-block-columns {
		gap: 2rem;
	}
	.swix-carousel-dots {
		gap: 8px;
	}
	.swix-carousel-dot {
		flex: 1 1 0;
		height: 44px;
	}
	.swix-carousel-dot-label {
		position: absolute !important;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(1px, 1px, 1px, 1px);
		white-space: nowrap;
	}
	.swix-carousel-dot::before {
		background-color: rgba(17, 17, 17, 0.15);
	}
}

/* ---------- Contact form ([swix_contact_form] in functions.php) ---------- */
.swix-form-card {
	background-color: var(--wp--preset--color--white);
	border: 1px solid rgba(17, 17, 17, 0.14);
	border-top: 3px solid var(--wp--preset--color--mint);
	border-radius: 2px;
	padding: clamp(24px, 4vw, 44px);
}
.swix-form-title {
	font-size: var(--wp--preset--font-size--large);
	margin: 0;
}
.swix-form-intro {
	margin: 8px 0 0;
	font-size: 0.9rem;
	color: rgba(17, 17, 17, 0.65);
}
.swix-req {
	color: var(--wp--preset--color--mint-text);
	font-weight: 600;
}
.swix-form-alert {
	margin-top: 24px;
	padding: 14px 18px;
	border-left: 4px solid var(--wp--preset--color--amber);
	background-color: rgba(233, 161, 60, 0.1);
}
.swix-form-alert p {
	margin: 0;
}
.swix-form {
	margin-top: 32px;
}
.swix-form-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 22px 20px;
}
.swix-field-full {
	grid-column: 1 / -1;
}
.swix-field label {
	display: block;
	margin-bottom: 8px;
	font-size: 0.9rem;
	font-weight: 500;
}
.swix-field input,
.swix-field select,
.swix-field textarea {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 12px 14px;
	font: inherit;
	font-size: 1rem;
	line-height: 1.4;
	color: var(--wp--preset--color--ink);
	background-color: var(--wp--preset--color--white);
	border: 1px solid #b9c4c2;
	border-radius: 2px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.swix-field textarea {
	min-height: 150px;
	resize: vertical;
}
.swix-field select {
	appearance: none;
	padding-right: 40px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23111111' stroke-width='1.6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	background-size: 12px 8px;
	cursor: pointer;
}
.swix-field input:hover,
.swix-field select:hover,
.swix-field textarea:hover {
	border-color: var(--wp--preset--color--ink);
}
.swix-field input:focus,
.swix-field select:focus,
.swix-field textarea:focus {
	outline: none;
	border-color: var(--wp--preset--color--mint-text);
	box-shadow: 0 0 0 3px rgba(134, 222, 217, 0.55);
}
.swix-field input:user-invalid,
.swix-field textarea:user-invalid {
	border-color: var(--wp--preset--color--amber);
}
.swix-form-footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px 24px;
	margin-top: 28px;
}
.swix-form-submit {
	padding: 14px 30px;
	border: 0;
	border-radius: 2px;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}
.swix-form-submit[disabled] {
	opacity: 0.7;
	cursor: progress;
}
.swix-form-legal {
	flex: 1 1 240px;
	margin: 0;
	font-size: 0.78rem;
	line-height: 1.5;
	color: rgba(17, 17, 17, 0.6);
}
.swix-form-legal a {
	color: inherit;
}
/* Honeypot: off-screen, not display:none, so naive bots still fill it. */
.swix-form-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
/* The disclosure text above satisfies Google's terms for hiding the badge. */
.grecaptcha-badge {
	visibility: hidden;
}
.swix-form-sent h2 {
	margin: 20px 0 0;
	font-size: var(--wp--preset--font-size--large);
}
.swix-form-sent p {
	margin: 12px 0 0;
}
@media (max-width: 600px) {
	.swix-form-grid {
		grid-template-columns: minmax(0, 1fr);
	}
	.swix-form-submit {
		width: 100%;
	}
}

/* Contact page sidebar */
.swix-contact-aside {
	align-self: flex-start;
	padding: clamp(24px, 3vw, 36px);
	background-color: var(--wp--preset--color--paper);
	border-left: 3px solid var(--wp--preset--color--mint-text);
}
.swix-contact-aside h3 {
	font-size: var(--wp--preset--font-size--medium);
}
:root .swix-contact-aside > * + h3 {
	margin-block-start: 1.75rem;
	padding-top: 1.75rem;
	border-top: 1px solid rgba(17, 17, 17, 0.12);
}
:root .swix-contact-aside > h3 + p {
	margin-block-start: 0.5rem;
}

/* ---------- Measure cap for long-form body copy ---------- */
.swix-measure {
	max-width: 65ch;
}

/* ---------- Monospace utility: machine output only (timestamps, device names) ---------- */
.swix-mono {
	font-family: var(--wp--preset--font-family--mono);
}

/* ---------- Buttons: sharp corners, flat colour-shift hover ---------- */
.wp-block-button__link {
	border-radius: 2px !important;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
@media (prefers-reduced-motion: reduce) {
	.wp-block-button__link {
		transition: none;
	}
}

/* ---------- Sticky site header with thin border ---------- */
.swix-site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.swix-site-header .wp-block-navigation-item__content {
	border-radius: 3px;
	transition: color 0.15s ease, box-shadow 0.15s ease;
}
.swix-site-header .wp-block-navigation a:hover,
.swix-site-header .wp-block-navigation a:focus-visible {
	color: var(--wp--preset--color--mint);
	box-shadow: 0 0 12px 3px rgba(134, 222, 217, 0.55);
}
.swix-site-header .wp-block-navigation__container {
	gap: 0;
}
.swix-site-header .wp-block-navigation-item:not(:last-child)::after {
	content: "|";
	margin: 0 1rem;
	color: rgba(255, 255, 255, 0.35);
}

/* ---------- CTA button set apart from the main nav links ---------- */
.swix-header-cta {
	flex-shrink: 0;
	margin-left: 4px;
	padding-left: 28px;
	border-left: 1px solid rgba(255, 255, 255, 0.2);
}
.swix-header-cta .wp-block-button__link {
	white-space: nowrap;
}
@media (max-width: 600px) {
	.swix-site-header img {
		height: 52px !important;
	}
	.swix-header-cta {
		padding-left: 0;
		border-left: 0;
	}
	.swix-header-cta .wp-block-button__link {
		padding: 10px 16px;
		font-size: 0.9rem;
	}
}

/* ---------- Kicker label above section headings ---------- */
.swix-kicker {
	display: flex;
	align-items: center;
	gap: 14px;
	font-family: var(--wp--preset--font-family--display);
	font-size: clamp(1.15rem, 0.95rem + 0.7vw, 1.5rem);
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--mint-text);
	margin-bottom: 16px;
}
.swix-kicker::before {
	content: "";
	flex: none;
	width: 36px;
	height: 4px;
	background-color: currentColor;
}
.has-ink-background-color .swix-kicker {
	color: var(--wp--preset--color--mint);
}

/* ---------- Footer link list ---------- */
.swix-footer-list {
	list-style: none;
	margin-inline: 0;
	margin-block-end: 0;
	padding: 0;
}
.swix-footer-list li {
	margin-bottom: 10px;
}
.swix-footer-list a {
	color: rgba(255, 255, 255, 0.75);
	text-decoration: none;
}
.swix-footer-list a:hover {
	color: var(--wp--preset--color--mint);
	text-decoration: underline;
}
.swix-footer-rule {
	opacity: 0.15;
}

/* ---------- Vertical rhythm ----------
   theme.json sets a 1.5rem blockGap so text, headings and buttons get room
   everywhere. These rules pull stacked page sections back flush and tune the
   gap for specific pairings. `:root` lifts specificity above core's
   `:root :where(.is-layout-*) > *` rules without needing !important. ---------- */
:root .wp-site-blocks > *,
:root main.wp-block-group > *,
:root .wp-block-post-content > * {
	margin-block-start: 0;
}
:root .swix-kicker + * {
	margin-block-start: 0;
}
:root h1 + * {
	margin-block-start: 1.75rem;
}
:root :is(.is-layout-flow, .is-layout-constrained) > * + .wp-block-buttons {
	margin-block-start: 2.25rem;
}
:root .wp-block-buttons.is-layout-flex {
	gap: 1rem;
}
:root :is(h1, h2) + :is(.wp-block-columns, .swix-hex-list, .wp-block-list, .wp-block-image) {
	margin-block-start: 2.5rem;
}
:root :where(p, ul, ol, figure, .wp-block-columns, .wp-block-buttons) + :is(h2, h3) {
	margin-block-start: 2.75rem;
}
:root .wp-block-column > * + * {
	margin-block-start: 1rem;
}
:root .wp-block-column > :where(p, ul, ol, figure) + :is(h2, h3) {
	margin-block-start: 2rem;
}
:root .wp-block-column > * + .wp-block-buttons {
	margin-block-start: 2rem;
}
:root .wp-block-columns.is-layout-flex {
	gap: 2rem;
}
:root .wp-block-quote > * + * {
	margin-block-start: 1rem;
}

/* ---------- Tighter, bolder heading rhythm ---------- */
h1, .wp-block-heading h1 {
	line-height: 1.1;
	letter-spacing: -0.01em;
}
h2, .wp-block-heading h2 {
	line-height: 1.2;
	letter-spacing: -0.01em;
}
h4.has-small-font-size {
	text-transform: uppercase;
	letter-spacing: 0.06em;
	opacity: 0.8;
}

/* ---------- Product icon crops (source lockups include extra whitespace) ---------- */
.swix-product-icon {
	width: 56px;
	height: 56px;
	object-fit: cover;
	object-position: 0% 50%;
	display: block;
	margin-bottom: 12px;
}

/* ---------- Respect reduced-motion preference on anything animated ---------- */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
