/*
Theme Name: Charkonex FSE
Theme URI: https://charkonex.com
Author: Charkonex, Inc.
Description: Charkonex child theme of ZCorp FSE. Dark twilight palette, self-hosted Inter, front page with a once-per-visit intro, destination and legal page layouts.
Template: zcorp-fse
Version: 0.4.3
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
Text Domain: charkonex-fse
*/

/* ---------- Base ---------- */
html { scroll-padding-top: 90px; }
body { -webkit-font-smoothing: antialiased; }
:where(a, button, input, select, textarea, summary, .wp-element-button):focus-visible {
	outline: 3px solid var(--wp--preset--color--warning-gold);
	outline-offset: 3px;
	border-radius: 4px;
}
.wp-site-blocks > main { margin-block-start: 0; }

/* ---------- Header ---------- */
.cx-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--wp--preset--color--border); }
.admin-bar .cx-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .cx-header { top: 46px; } }
.cx-header .wp-block-site-title a { text-decoration: none; }
.cx-header .wp-block-navigation a { text-decoration: none; color: var(--wp--preset--color--on-inverse); }
.cx-header .wp-block-navigation a:hover,
.cx-header .wp-block-navigation .current-menu-item > a { color: var(--wp--preset--color--warning-gold); }
.cx-header .wp-block-navigation__responsive-container.is-menu-open { padding: 2rem 1.5rem; }
.cx-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container { font-size: 1.25rem; gap: 1.25rem; }
@media (max-width: 480px) { .cx-header .wp-block-buttons.cx-header-cta { display: none; } }
/* Tablets: core switches to the overlay menu only below 600px; the five links wrap before 1024px. */
@media (min-width: 600px) and (max-width: 1024px) {
	.cx-header .wp-block-navigation__responsive-container-open:not(.always-shown) { display: flex; }
	.cx-header .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) { display: none; }
	.cx-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close { display: flex; }
}

/* ---------- Shared components ---------- */
.cx-eyebrow {
	color: var(--wp--preset--color--success);
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	margin-bottom: 0.5rem;
}
.cx-lead { font-size: clamp(1.1rem, 2vw, 1.3rem); line-height: 1.6; }
.cx-card {
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 18px;
	padding: 1.75rem;
}
.cx-card > :first-child { margin-top: 0; }
.cx-card--link { position: relative; transition: border-color 0.2s ease, transform 0.2s ease; }
.cx-card--link:hover { border-color: var(--wp--preset--color--accent); transform: translateY(-2px); }
.cx-card--link h3 a { color: var(--wp--preset--color--foreground); text-decoration: none; }
.cx-card--link h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.cx-card--link h3 a::before { content: "→ "; color: var(--wp--preset--color--accent); }
.cx-status {
	display: inline-block;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	padding: 0.3rem 0.8rem;
	border-radius: 999px;
	margin-bottom: 0.75rem;
}
.cx-status--today { background: var(--wp--preset--color--success-soft); color: var(--wp--preset--color--success); }
.cx-status--dev { background: var(--wp--preset--color--warning-soft); color: var(--wp--preset--color--warning-gold); }
.cx-disclaimer { color: var(--wp--preset--color--muted); font-size: 0.85rem; line-height: 1.55; }
.cx-page-hero {
	padding: clamp(3rem, 8vw, 5.5rem) 1.5rem clamp(2.5rem, 6vw, 4rem);
	background-image: var(--wp--preset--gradient--dawn-glow);
}
.cx-page-hero h1 { margin-top: 0.25rem; }
.cx-page > .wp-block-post-content > .alignfull:not(.cx-page-hero) { padding-left: 1.5rem; padding-right: 1.5rem; }
.cx-page > .wp-block-post-content > .wp-block-group.alignfull { padding-top: clamp(2.5rem, 6vw, 4rem); padding-bottom: clamp(2.5rem, 6vw, 4rem); margin-top: 0; }
.cx-page > .wp-block-post-content > :last-child:not(.alignfull) { margin-bottom: 4rem; }
.cx-cta-band { text-align: center; }
.cx-cta-band .wp-block-buttons { justify-content: center; }
.cx-legal { padding-top: 2.5rem; padding-bottom: 4rem; }
.cx-legal h2 { font-size: 1.35rem; margin-top: 2.25rem; }
.cx-legal p, .cx-legal li { color: var(--wp--preset--color--deep-slate); }
.wp-block-details {
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 12px;
	padding: 1rem 1.25rem;
	background: var(--wp--preset--color--white);
}
.wp-block-details summary { font-weight: 600; cursor: pointer; }
.wp-block-details + .wp-block-details { margin-top: 0.75rem; }
.wp-block-button.is-style-outline > .wp-block-button__link { border-color: var(--wp--preset--color--accent); color: var(--wp--preset--color--accent); }

/* ---------- Forms (WPForms, dark surface) ---------- */
.cx-form .wpforms-container {
	--wpforms-field-background-color: var(--wp--preset--color--white);
	--wpforms-field-border-color: var(--wp--preset--color--border);
	--wpforms-field-text-color: var(--wp--preset--color--foreground);
	--wpforms-field-menu-color: var(--wp--preset--color--white);
	--wpforms-label-color: var(--wp--preset--color--foreground);
	--wpforms-label-sublabel-color: var(--wp--preset--color--muted);
	--wpforms-label-error-color: var(--wp--preset--color--danger);
	--wpforms-button-background-color: var(--wp--preset--color--accent);
	--wpforms-button-text-color: var(--wp--preset--color--background);
	--wpforms-button-border-radius: 999px;
	--wpforms-field-border-radius: 10px;
}
.cx-form .wpforms-form input[type="text"],
.cx-form .wpforms-form input[type="email"],
.cx-form .wpforms-form select,
.cx-form .wpforms-form textarea {
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--foreground);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 10px;
}
.cx-form .wpforms-form label,
.cx-form .wpforms-form legend,
.cx-form .wpforms-form .wpforms-field-label { color: var(--wp--preset--color--foreground); }
.cx-form .wpforms-form .wpforms-field-description,
.cx-form .wpforms-form .wpforms-field-sublabel { color: var(--wp--preset--color--muted); }
.cx-form .wpforms-form button[type="submit"] {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--background);
	border: 0;
	border-radius: 999px;
	font-weight: 700;
	padding: 0.8rem 1.8rem;
}
.cx-form .wpforms-form button[type="submit"]:hover { background: var(--wp--preset--color--warning-gold); }

/* ---------- Footer ---------- */
.cx-footer a { color: var(--wp--preset--color--on-inverse); text-decoration: none; }
.cx-footer a:hover { color: var(--wp--preset--color--warning-gold); text-decoration: underline; }
.cx-footer-heading { font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--wp--preset--color--success); }
.cx-footer-links { list-style: none; padding-left: 0; }
.cx-footer-links li + li { margin-top: 0.4rem; }
.cx-footer .wp-block-separator { border-color: var(--wp--preset--color--border); opacity: 1; margin: 2rem 0 1.25rem; }

/* ---------- Home ---------- */
/* Hero: the proposition fills the first screen (below the sticky header); the three panels follow.
   overflow-x: clip hides the side panels while they are still outside the screen. */
.cx-home-hero { --cx-header-h: 74px; overflow-x: clip; }
.cx-home-hero .cx-intro-head {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: calc(100svh - var(--cx-header-h) - var(--cx-bar-h, 0px));
	padding: 2rem 0 2.5rem;
}
.admin-bar .cx-home-hero .cx-intro-head { min-height: calc(100svh - var(--cx-header-h) - var(--cx-bar-h, 0px) - 32px); }
.cx-home-hero .cx-intro-head h1 {
	max-width: 17ch;
	margin: 0 auto;
	font-size: clamp(2.6rem, 7.4vw, 6.5rem);
	line-height: 1.04;
	letter-spacing: -0.025em;
	text-wrap: balance;
}
.cx-home-hero .cx-intro-head .cx-lead {
	max-width: 40ch;
	margin: clamp(1.25rem, 3vh, 2rem) auto 0;
	font-size: clamp(1.15rem, 2.2vw, 1.7rem);
	text-wrap: balance;
}
/* Scroll cue under the proposition (decorative). */
.cx-home-hero .cx-intro-head::after {
	content: "";
	width: 14px;
	height: 14px;
	margin: clamp(2rem, 6vh, 3.5rem) auto 0;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	opacity: 0.55;
	transform: rotate(45deg);
	animation: cx-cue 2.2s ease-in-out infinite;
}
@keyframes cx-cue { 0%, 100% { translate: 0 0; } 50% { translate: 0 8px; } }
@media (max-width: 600px) { .cx-home-hero { --cx-header-h: 65px; } }
.cx-nowrap { white-space: nowrap; }
@media (max-width: 782px) { .admin-bar .cx-home-hero .cx-intro-head { min-height: calc(100svh - var(--cx-header-h) - var(--cx-bar-h, 0px) - 46px); } }

.cx-panels { position: relative; }
.cx-panel {
	background: rgba(22, 33, 62, 0.72);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 18px;
	padding: 1.75rem;
	backdrop-filter: blur(6px);
}
.cx-panel h2 { font-size: 1.35rem; margin-top: 0.25rem; }
.cx-panel p:last-child { color: var(--wp--preset--color--on-inverse-muted); margin-bottom: 0; }
.cx-home-ctas .wp-block-button { flex: 1 1 0; min-width: 220px; max-width: 300px; }
.cx-home-ctas .wp-block-button__link { width: 100%; text-align: center; }
.cx-stories:not(:has(.wp-block-post)) { display: none; }

/* Panels: the middle one stays put; the left and right ones travel in from outside the screen,
   bottom-up, as the row scrolls into view. Scroll-linked where the browser supports scroll-driven
   animations; elsewhere functions.php adds .cx-reveal and plays the same move once on arrival. */
@keyframes cx-from-left { from { opacity: 0; transform: translate(calc(-100% - 10vw), 35vh) rotate(-5deg); } to { opacity: 1; transform: none; } }
@keyframes cx-from-right { from { opacity: 0; transform: translate(calc(100% + 10vw), 35vh) rotate(5deg); } to { opacity: 1; transform: none; } }
@supports (animation-timeline: view()) {
	.cx-panel:nth-child(1),
	.cx-panel:nth-child(3) { animation: linear both; animation-timeline: view(); animation-range: entry 0% cover 45%; }
	.cx-panel:nth-child(1) { animation-name: cx-from-left; }
	.cx-panel:nth-child(3) { animation-name: cx-from-right; }
}
.cx-reveal .cx-panel:nth-child(1),
.cx-reveal .cx-panel:nth-child(3) { transition: transform 1.1s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 1.1s ease-out; }
.cx-reveal .cx-panels:not(.is-in) .cx-panel:nth-child(1) { opacity: 0; transform: translate(calc(-100% - 10vw), 35vh) rotate(-5deg); }
.cx-reveal .cx-panels:not(.is-in) .cx-panel:nth-child(3) { opacity: 0; transform: translate(calc(100% + 10vw), 35vh) rotate(5deg); }

/* ---------- Intro (front page, once per visit; class set by functions.php) ---------- */
@keyframes cx-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.cx-intro .cx-intro-head h1 { animation: cx-rise 1.1s cubic-bezier(0.22, 0.8, 0.3, 1) both; }
.cx-intro .cx-intro-head .cx-lead { animation: cx-rise 0.9s ease-out 0.7s both; }

@media (prefers-reduced-motion: reduce) {
	.cx-home-hero .cx-intro-head::after,
	.cx-panel:nth-child(1), .cx-panel:nth-child(3),
	.cx-intro .cx-intro-head h1, .cx-intro .cx-intro-head .cx-lead { animation: none; }
	.cx-card--link, .cx-card--link:hover { transition: none; transform: none; }
}

/* ---------- Home: stacking journey cards ----------
   Each card is position: sticky with a slightly larger top offset than the one before, so the
   next card rolls up over it and earlier cards stay as a layered edge. Works the same in Safari,
   Chrome and Firefox. Where scroll-driven CSS animations exist, a covered card also eases to a
   slightly smaller, dimmer state; elsewhere the stack is simply static. No JavaScript. */
.cx-stack { --cx-stack-top: 88px; --cx-stack-step: 22px; }
.cx-stack-head { margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.cx-stack-list { padding-bottom: 20vh; }
.cx-stack-card {
	position: -webkit-sticky;
	position: sticky;
	top: calc(var(--cx-stack-top) + var(--cx-i, 0) * var(--cx-stack-step));
	min-height: min(68vh, 520px);
	margin: 0 0 12vh;
	padding: clamp(2rem, 5vw, 3.5rem);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 28px;
	box-shadow: 0 -18px 40px rgba(6, 11, 26, 0.55);
	transform-origin: 50% 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
.cx-stack-card:last-child { margin-bottom: 0; }
.cx-stack-card:nth-child(1) { --cx-i: 0; z-index: 1; }
.cx-stack-card:nth-child(2) { --cx-i: 1; z-index: 2; }
.cx-stack-card:nth-child(3) { --cx-i: 2; z-index: 3; }
.cx-stack-card h3 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); margin-top: 0.25rem; }
.cx-stack-card p:not(.cx-eyebrow):not(.cx-status):not(.cx-stack-num) { color: var(--wp--preset--color--deep-slate); font-size: 1.1rem; }
.cx-stack-num {
	margin: 0 0 0.25rem;
	font-size: clamp(2.25rem, 5vw, 3.25rem);
	font-weight: 800;
	line-height: 1;
	color: var(--wp--preset--color--on-inverse);
	opacity: 0.14;
}
/* Card with illustration: text left, visual right; visual first and smaller on narrow screens. */
.cx-stack-cols { margin: 0; width: 100%; }
.cx-stack-visual { margin: 0; }
.cx-stack-visual img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; }
.cx-stack-head .cx-status { display: table; margin-left: auto; margin-right: auto; }
.cx-stack + .cx-stack .cx-stack-head { margin-top: 0; }
@media (max-width: 781px) {
	.cx-stack-cols { gap: 0.75rem; }
	.cx-stack-visual-col { order: -1; }
	.cx-stack-visual img { max-height: 170px; width: auto; margin: 0 auto; }
}
@keyframes cx-stack-recede { to { transform: scale(0.93); filter: brightness(0.6); } }
/* A card recedes while the next card scrolls into view (the next card's own view timeline). */
@supports (animation-timeline: view()) and (timeline-scope: none) {
	.cx-stack-list { timeline-scope: --cx-c2, --cx-c3; }
	.cx-stack-card:nth-child(2) { view-timeline-name: --cx-c2; }
	.cx-stack-card:nth-child(3) { view-timeline-name: --cx-c3; }
	.cx-stack-card:nth-child(1),
	.cx-stack-card:nth-child(2) { animation: cx-stack-recede linear both; animation-range: entry 0% entry 100%; }
	.cx-stack-card:nth-child(1) { animation-timeline: --cx-c2; }
	.cx-stack-card:nth-child(2) { animation-timeline: --cx-c3; }
}
@media (max-width: 600px) {
	.cx-stack { --cx-stack-top: 76px; --cx-stack-step: 14px; }
	.cx-stack-card { min-height: 0; border-radius: 22px; margin-bottom: 8vh; }
	.cx-stack-card p:not(.cx-eyebrow):not(.cx-status):not(.cx-stack-num) { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
	.cx-stack-card:nth-child(1), .cx-stack-card:nth-child(2) { animation: none; }
}

/* ---------- Outside channels (inc/channels.php; nothing renders until set) ---------- */
/* Social icons: footer and "Follow along" sections. Plain links, one colour. */
.wp-block-social-links.cx-social { gap: 1rem; margin: 1.25rem 0 0; }
.wp-block-social-links.cx-social.is-style-logos-only .wp-social-link { color: var(--wp--preset--color--on-inverse); }
.wp-block-social-links.cx-social.is-style-logos-only .wp-social-link a { color: inherit; padding: 0; }
.wp-block-social-links.cx-social.is-style-logos-only .wp-social-link:hover { color: var(--wp--preset--color--warning-gold); transform: none; }
.wp-block-social-links.cx-social .wp-social-link svg { width: 24px; height: 24px; }
.cx-follow .wp-block-social-links.cx-social { margin-top: 0.5rem; gap: 1.25rem; }
.cx-follow .wp-block-social-links.cx-social .wp-social-link svg { width: 30px; height: 30px; }
/* Funding campaign: bar above the header (prelaunch, live) and the campaign section on pages. */
body.cx-has-bar { --cx-bar-h: 40px; }
.cx-campaign-bar {
	display: flex;
	align-items: center;
	justify-content: center;
	height: var(--cx-bar-h);
	padding: 0 1rem;
	background: var(--wp--preset--color--accent);
	font-size: 0.9rem;
	font-weight: 600;
}
.cx-campaign-bar a { overflow: hidden; color: var(--wp--preset--color--background); text-decoration: none; white-space: nowrap; text-overflow: ellipsis; }
.cx-campaign-bar a:hover, .cx-campaign-bar a:focus-visible { text-decoration: underline; }
.cx-campaign { background: var(--wp--preset--gradient--stack-gold); border-block: 1px solid var(--wp--preset--color--border); }
