/**
 * CSC base component system.
 * Every value references a token custom property emitted by theme.json
 * (--wp--preset--* / --wp--custom--*). No hardcoded design values.
 */

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
body {
	margin: 0;
	-webkit-font-smoothing: antialiased;
	background: var(--wp--preset--color--paper);
	color: var(--wp--preset--color--body);
	font-family: var(--wp--preset--font-family--lato);
}
a { color: var(--wp--preset--color--blue); }
a:hover { color: var(--wp--preset--color--blue-dark); }
[hidden] { display: none !important; }
img { max-width: 100%; height: auto; }
button { font-family: inherit; cursor: pointer; }

/* Counters never jitter */
.csc-num { font-variant-numeric: tabular-nums; }

/* ---------- Focus (token sheet: 2px white offset + blue ring, keyboard and pointer alike) ---------- */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
	outline: none;
	box-shadow: var(--wp--custom--focus--ring);
	border-radius: var(--wp--custom--radius--chip);
}

/* ---------- Type helpers ---------- */
.csc-display { font: 900 var(--wp--preset--font-size--display)/1.04 var(--wp--preset--font-family--lato); letter-spacing: -0.8px; color: var(--wp--preset--color--blue-dark); }
.csc-h1 { font: 900 var(--wp--preset--font-size--h1)/1.1 var(--wp--preset--font-family--lato); letter-spacing: -0.5px; color: var(--wp--preset--color--blue-dark); }
.csc-h2 { font: 900 var(--wp--preset--font-size--h2)/1.15 var(--wp--preset--font-family--lato); color: var(--wp--preset--color--blue-dark); }
.csc-h3 { font: 700 var(--wp--preset--font-size--h3)/1.3 var(--wp--preset--font-family--lato); color: var(--wp--preset--color--blue-dark); }
.csc-overline {
	font: 700 12px/16px var(--wp--preset--font-family--lato);
	letter-spacing: 1.6px;
	text-transform: uppercase;
}
.csc-small { font: 400 var(--wp--preset--font-size--small)/1.38 var(--wp--preset--font-family--lato); color: var(--wp--preset--color--muted); }

/* ---------- Buttons (flat, no shadows — brand rule enforced here) ---------- */
.csc-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	height: 48px; padding: 0 28px;
	font: 700 16px/1 var(--wp--preset--font-family--lato);
	border-radius: var(--wp--custom--radius--button);
	border: none; text-decoration: none;
	box-shadow: none !important; /* buttons never carry shadows */
	transition: background var(--wp--custom--motion--fast) var(--wp--custom--motion--ease),
		border-color var(--wp--custom--motion--fast) var(--wp--custom--motion--ease),
		color var(--wp--custom--motion--fast) var(--wp--custom--motion--ease);
}
.csc-btn--primary { color: var(--wp--preset--color--white); background: var(--wp--preset--color--blue); }
.csc-btn--primary:hover { background: var(--wp--preset--color--blue-hover); color: var(--wp--preset--color--white); }
.csc-btn--secondary {
	color: var(--wp--preset--color--blue); background: var(--wp--preset--color--white);
	border: 1.5px solid var(--wp--preset--color--blue-40);
}
.csc-btn--secondary:hover { background: var(--wp--preset--color--blue-10); border-color: var(--wp--preset--color--blue); }
.csc-btn--ghost { color: var(--wp--preset--color--blue); background: transparent; padding: 0 14px; }
.csc-btn--ghost:hover { background: var(--wp--preset--color--blue-10); }
.csc-btn--on-dark { height: 44px; font-size: 15px; color: var(--wp--preset--color--blue-dark); background: var(--wp--preset--color--white); }
.csc-btn--on-dark:hover { background: var(--wp--preset--color--blue-10); }
.csc-btn:disabled, .csc-btn--disabled {
	color: var(--wp--preset--color--disabled); background: var(--wp--preset--color--hairline);
	border: none; cursor: not-allowed;
}
.csc-btn--block { display: flex; width: 100%; }

/* ---------- Inputs ---------- */
.csc-label { display: block; font: 700 13px/18px var(--wp--preset--font-family--lato); color: var(--wp--preset--color--body); margin-bottom: 6px; }
.csc-input {
	width: 100%; height: 48px; padding: 0 16px;
	font: 400 15px/1 var(--wp--preset--font-family--lato);
	color: var(--wp--preset--color--blue-dark);
	background: var(--wp--preset--color--white);
	border: 1.5px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--button);
	outline: none;
	transition: all var(--wp--custom--motion--fast) var(--wp--custom--motion--ease);
}
.csc-input:hover { border-color: var(--wp--preset--color--disabled); }
.csc-input:focus { border-color: var(--wp--preset--color--blue); box-shadow: var(--wp--custom--focus--input); }
.csc-input::placeholder { color: var(--wp--preset--color--disabled); }
.csc-field-help { font: 400 13px/18px var(--wp--preset--font-family--lato); color: var(--wp--preset--color--muted); margin: 6px 0 18px; }
.csc-field-error {
	font: 400 13px/18px var(--wp--preset--font-family--lato);
	color: var(--wp--preset--color--error);
	background: var(--wp--preset--color--error-wash);
	border-radius: var(--wp--custom--radius--chip);
	padding: 10px 14px; margin: 0 0 18px;
}

/* ---------- Cards ---------- */
.csc-card {
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--card);
}
.csc-card--lg { border-radius: var(--wp--custom--radius--card-lg); }

/* ---------- Brand elements ---------- */
/* Leaf: one squared corner (bottom-left), radius ≈ 30% of box. Set --leaf-r per size. */
.csc-leaf { border-radius: var(--leaf-r, 8px) var(--leaf-r, 8px) var(--leaf-r, 8px) 0; display: inline-flex; align-items: center; justify-content: center; }

/* PIN map marker: circle with squared corner, rotated so the point faces down */
.csc-pin {
	display: inline-flex; align-items: center; justify-content: center;
	border-radius: 50% 50% 50% 0;
	transform: rotate(-45deg);
	background: var(--wp--preset--color--blue);
}
.csc-pin > * { transform: rotate(45deg); }
.csc-pin--green { background: var(--wp--preset--color--green); }
.csc-pin__dot { background: var(--wp--preset--color--white); border-radius: var(--wp--custom--radius--pill); }

/* Plan-grid backgrounds (repeating hairlines, both axes) */
.csc-plan-grid {
	background-image:
		repeating-linear-gradient(0deg, var(--grid-line, var(--wp--custom--grid--line)) 0 1px, transparent 1px var(--grid-pitch, 48px)),
		repeating-linear-gradient(90deg, var(--grid-line, var(--wp--custom--grid--line)) 0 1px, transparent 1px var(--grid-pitch, 48px));
}
.csc-plan-grid--major {
	background-image:
		repeating-linear-gradient(0deg, var(--grid-line, var(--wp--custom--grid--line)) 0 1px, transparent 1px var(--grid-pitch, 48px)),
		repeating-linear-gradient(90deg, var(--grid-line, var(--wp--custom--grid--line)) 0 1px, transparent 1px var(--grid-pitch, 48px)),
		repeating-linear-gradient(0deg, var(--wp--custom--grid--line-major) 0 1.5px, transparent 1.5px 240px),
		repeating-linear-gradient(90deg, var(--wp--custom--grid--line-major) 0 1.5px, transparent 1.5px 240px);
}

/* Pills / chips */
.csc-pill {
	display: inline-flex; align-items: center; gap: 6px;
	border-radius: var(--wp--custom--radius--pill);
	font: 700 13px/1 var(--wp--preset--font-family--lato);
	padding: 10px 15px;
}

/* ---------- Motion ---------- */
@keyframes hubIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes hubPop { 0% { transform: scale(0.4); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes hubDash { to { stroke-dashoffset: -24; } }
@keyframes hubFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes pinDrop { 0% { transform: translateY(-10px) scale(0.6); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes ringPulse { 0% { transform: scale(0.55); opacity: 0.85; } 100% { transform: scale(1.9); opacity: 0; } }
@keyframes ringOut { 0% { transform: scale(0.3); opacity: 0.9; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes confFall { 0% { transform: translateY(-30px) rotate(0); } 100% { transform: translateY(360px) rotate(540deg); } }
@keyframes floorUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes craneSlide { from { transform: translateX(0); } to { transform: translateX(-64px); } }
@keyframes cableLen { 0%, 100% { height: 48px; } 50% { height: 76px; } }
@keyframes cableLenSm { 0%, 100% { height: 34px; } 50% { height: 54px; } }
@keyframes blinkLight { 0%, 100% { opacity: 1; } 50% { opacity: 0.15; } }
@keyframes flagWave { 0%, 100% { transform: skewY(0deg); } 50% { transform: skewY(-6deg); } }
@keyframes barGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes drawIn { to { stroke-dashoffset: 0; } }

.anim-hub-in { animation: hubIn var(--wp--custom--motion--reveal) var(--wp--custom--motion--ease); }
.anim-hub-pop { animation: hubPop var(--wp--custom--motion--base) var(--wp--custom--motion--ease-celebrate); }

/* The mocks' own reduced-motion convention: [data-anim] is the opt-in hook */
@media (prefers-reduced-motion: reduce) {
	[data-anim] { animation: none !important; transition: none !important; }
}

/* ---------- Top bar (shared app shell) ---------- */
.csc-topbar {
	display: flex; align-items: center; gap: 16px;
	padding: 20px 48px;
	background: var(--wp--preset--color--white);
	border-bottom: 1px solid var(--wp--preset--color--hairline);
	position: relative; z-index: 2; flex: none;
}
.csc-topbar__logo { height: 26px; display: block; width: auto; }
.csc-topbar__sep { width: 1px; height: 22px; background: var(--wp--preset--color--border); }
.csc-topbar__name { font: 700 13.5px/1 var(--wp--preset--font-family--lato); color: var(--wp--preset--color--muted); }
.csc-topbar__user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.csc-topbar__email { font: 400 13px/1 var(--wp--preset--font-family--lato); color: var(--wp--preset--color--muted); }
.csc-topbar__avatar {
	width: 36px; height: 36px; border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--blue-10); border: 1px solid var(--wp--preset--color--blue-20);
	display: inline-flex; align-items: center; justify-content: center;
	font: 700 13px/1 var(--wp--preset--font-family--lato); color: var(--wp--preset--color--blue);
}
.csc-topbar__logout { font: 400 12px/1 var(--wp--preset--font-family--lato); }

/* ---------- Journey map (shared: playbook rail, dashboard hero) ---------- */
.csc-map {
	background-color: var(--wp--preset--color--paper);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--card);
	padding: 14px 14px 10px;
	background-image:
		repeating-linear-gradient(0deg, var(--wp--custom--grid--line) 0 1px, transparent 1px 24px),
		repeating-linear-gradient(90deg, var(--wp--custom--grid--line) 0 1px, transparent 1px 24px);
}
.csc-map svg { display: block; }
.csc-map__path { animation: hubDash 1.8s linear infinite; }
.csc-map__stop-done, .csc-map__stop-current, .csc-map__stop-future { display: none; }
.csc-map__stop-done.is-on { display: block; animation: pinDrop 450ms var(--wp--custom--motion--ease); }
.csc-map__stop-current.is-on, .csc-map__stop-future.is-on { display: block; }
.csc-map__ring { transform-box: fill-box; transform-origin: center; animation: ringPulse 2.4s var(--wp--custom--motion--ease) infinite; }
.csc-map__labels { display: flex; justify-content: space-between; font: 700 10.5px/14px var(--wp--preset--font-family--lato); color: var(--wp--preset--color--blue); letter-spacing: 0.8px; text-transform: uppercase; padding: 2px 4px 4px; }
