/* ==========================================================================
   SaaS NG — components
   Layout primitives, header, navigation, buttons, cards, CTA band, footer.
   ========================================================================== */

/* --- Layout primitives ---------------------------------------------------- */

.container {
	width: 100%;
	max-width: var(--container);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.container--narrow {
	max-width: var(--container-narrow);
}

main {
	flex: 1 0 auto;
}

.section {
	padding-block: var(--section-y);
}

.section--sunk {
	background-color: var(--surface-sunk);
}

.section--dark {
	background-color: var(--panel);
	color: var(--panel-ink);
}

.section--dark h2,
.section--dark h3,
.section--dark h4 {
	color: var(--panel-ink);
}

.section--dark a {
	color: var(--sand);
}

.section--dark a:hover {
	color: var(--panel-ink);
}

/* Section heading block: eyebrow, title, lead. */

.section-head {
	max-width: 46rem;
	margin-bottom: var(--space-8);
}

.section-head--centered {
	margin-inline: auto;
	text-align: center;
}

.section-head--centered p {
	margin-inline: auto;
}

.eyebrow {
	display: block;
	font-size: var(--text-sm);
	font-weight: var(--weight-semibold);
	letter-spacing: var(--tracking-wide);
	text-transform: uppercase;
	color: var(--accent-ink);
	margin-bottom: var(--space-3);
}

.section--dark .eyebrow {
	color: var(--sand);
}

.lead {
	font-size: var(--text-lg);
	color: var(--text-muted);
	line-height: var(--leading-relaxed);
	margin-top: var(--space-4);
}

.section--dark .lead {
	color: var(--sand);
}

/* --- Buttons -------------------------------------------------------------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	/* 44px minimum tap target, everywhere. */
	min-height: 2.75rem;
	padding: var(--space-3) var(--space-5);
	border: 2px solid transparent;
	border-radius: var(--radius-pill);
	font-size: var(--text-base);
	font-weight: var(--weight-semibold);
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition:
		background-color var(--duration-base) var(--ease-out),
		border-color var(--duration-base) var(--ease-out),
		color var(--duration-base) var(--ease-out),
		transform var(--duration-fast) var(--ease-out);
}

.btn:hover {
	transform: translateY(-1px);
}

.btn:active {
	transform: translateY(0);
}

/* Espresso on amber is 4.57:1. White on amber is 3.19:1 and fails AA, so the
   text on this button is never light. See site_reference/palette.md. */
.btn--primary {
	background-color: var(--amber);
	border-color: var(--amber);
	color: var(--on-accent);
}

.btn--primary:hover {
	background-color: var(--accent-hover);
	border-color: var(--accent-hover);
	color: var(--on-accent);
}

.btn--ghost {
	background-color: transparent;
	border-color: var(--ink-strong);
	color: var(--ink-strong);
}

.btn--ghost:hover {
	background-color: var(--ink-strong);
	color: var(--page-bg);
}

.section--dark .btn--ghost,
.cta-band .btn--ghost {
	border-color: var(--sand);
	color: var(--sand);
}

.section--dark .btn--ghost:hover,
.cta-band .btn--ghost:hover {
	background-color: var(--sand);
	color: var(--on-accent);
}

/* Still 44px tall: "small" here means less horizontal weight and smaller
   type, never a tap target below the minimum. */
.btn--sm {
	min-height: 2.75rem;
	padding: var(--space-2) var(--space-4);
	font-size: var(--text-sm);
}

.btn--lg {
	min-height: 3.25rem;
	padding: var(--space-4) var(--space-7);
	font-size: var(--text-lg);
}

/* Text link with a trailing arrow, used at the end of cards. */

.link-arrow {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	font-weight: var(--weight-semibold);
	text-decoration: none;
}

.link-arrow::after {
	content: "→";
	transition: transform var(--duration-base) var(--ease-out);
}

.link-arrow:hover {
	text-decoration: underline;
}

.link-arrow:hover::after {
	transform: translateX(3px);
}

/* --- Header --------------------------------------------------------------- */

.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background-color: var(--header-bg);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--line);
}

.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
	min-height: 4.5rem;
	flex-wrap: wrap;
}

.site-header__logo {
	display: flex;
	align-items: center;
	/* The lockup is 40px tall; the link keeps a 44px target around it. */
	min-height: 2.75rem;
	flex-shrink: 0;
	line-height: 0;
	border-radius: var(--radius-sm);
}

.site-header__logo img {
	width: auto;
	height: 2.5rem;
}

/* --- Navigation ----------------------------------------------------------- */

.site-nav {
	display: flex;
	align-items: center;
	gap: var(--space-6);
}

.site-nav__list {
	display: flex;
	align-items: center;
	gap: var(--space-5);
	list-style: none;
	padding: 0;
	margin: 0;
}

.site-nav__list li + li {
	margin-top: 0;
}

.site-nav__list a {
	display: inline-block;
	padding: var(--space-2) 0;
	color: var(--ink);
	font-size: var(--text-sm);
	font-weight: var(--weight-medium);
	text-decoration: none;
	border-bottom: 2px solid transparent;
}

.site-nav__list a:hover {
	color: var(--accent-ink);
	border-bottom-color: var(--amber);
}

/* The current page is marked with aria-current in the markup, which is both
   the accessible signal and the styling hook — one source of truth. */
.site-nav__list a[aria-current="page"] {
	color: var(--accent-ink);
	font-weight: var(--weight-semibold);
	border-bottom-color: var(--amber);
}

.nav-toggle {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	min-height: 2.75rem;
	padding: var(--space-2) var(--space-4);
	background-color: transparent;
	border: 2px solid var(--line-strong);
	border-radius: var(--radius-pill);
	color: var(--ink);
	font-family: inherit;
	font-size: var(--text-sm);
	font-weight: var(--weight-semibold);
	cursor: pointer;
}

.nav-toggle[hidden] {
	display: none;
}

/* Three bars drawn in CSS: the icon is part of the control, not content. */
.nav-toggle__icon,
.nav-toggle__icon::before,
.nav-toggle__icon::after {
	display: block;
	width: 1.125rem;
	height: 2px;
	background-color: currentcolor;
	border-radius: 2px;
	transition: transform var(--duration-base) var(--ease-out);
}

.nav-toggle__icon {
	position: relative;
}

.nav-toggle__icon::before,
.nav-toggle__icon::after {
	content: "";
	position: absolute;
	left: 0;
}

.nav-toggle__icon::before {
	top: -6px;
}

.nav-toggle__icon::after {
	top: 6px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon {
	background-color: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon::before {
	transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon::after {
	transform: translateY(-6px) rotate(-45deg);
}

@media (max-width: 56rem) {
	.site-nav {
		flex-basis: 100%;
		flex-direction: column;
		align-items: stretch;
		gap: var(--space-3);
		padding-bottom: var(--space-5);
	}

	/* Collapsed only once JavaScript has taken over. Without it the nav stays
	   in this stacked, fully usable state. */
	.nav-toggle[aria-expanded="false"] + .site-nav {
		display: none;
	}

	.site-nav__list {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}

	.site-nav__list a {
		padding: var(--space-3) 0;
		font-size: var(--text-base);
		border-bottom: 1px solid var(--line);
	}

	.site-nav__list a:hover,
	.site-nav__list a[aria-current="page"] {
		border-bottom-color: var(--amber);
	}

	.site-nav__cta {
		align-self: flex-start;
		margin-top: var(--space-3);
	}
}

/* --- Cards ---------------------------------------------------------------- */

.card {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	padding: var(--space-6);
	background-color: var(--page-bg);
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-sm);
	transition:
		box-shadow var(--duration-base) var(--ease-out),
		transform var(--duration-base) var(--ease-out),
		border-color var(--duration-base) var(--ease-out);
}

.card p {
	color: var(--text-muted);
	margin: 0;
}

.card__icon {
	width: 2.75rem;
	height: 2.75rem;
	color: var(--accent-ink);
	margin-bottom: var(--space-1);
}

.card__title {
	font-size: var(--text-xl);
	font-weight: var(--weight-semibold);
	letter-spacing: var(--tracking-tight);
}

.card__title a {
	color: inherit;
	text-decoration: none;
}

.card__title a:hover {
	color: var(--accent-ink);
}

.card__foot {
	margin-top: auto;
	padding-top: var(--space-3);
}

.card--link:hover {
	transform: translateY(-2px);
	border-color: var(--amber);
	box-shadow: var(--shadow-md);
}

.section--sunk .card {
	background-color: var(--page-bg);
}

/* --- Grids ---------------------------------------------------------------- */

.grid {
	display: grid;
	gap: var(--space-5);
}

.grid--2 {
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
}

.grid--3 {
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.grid--4 {
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
}

/* --- Numbered steps ------------------------------------------------------- */

.steps {
	display: grid;
	gap: var(--space-6);
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
	list-style: none;
	padding: 0;
	counter-reset: step;
}

.steps li {
	margin-top: 0;
	position: relative;
	padding-top: var(--space-6);
	border-top: 2px solid var(--line-strong);
}

.steps li::before {
	counter-increment: step;
	content: counter(step);
	position: absolute;
	top: calc(var(--space-6) * -0.5 - 0.1rem);
	left: 0;
	display: grid;
	place-items: center;
	width: 2rem;
	height: 2rem;
	background-color: var(--amber);
	color: var(--on-accent);
	border-radius: var(--radius-pill);
	font-size: var(--text-sm);
	font-weight: var(--weight-bold);
}

.steps h3 {
	font-size: var(--text-lg);
	font-weight: var(--weight-semibold);
	margin-bottom: var(--space-2);
}

.steps p {
	color: var(--text-muted);
	margin: 0;
}

.section--dark .steps li {
	border-top-color: rgb(245 217 168 / 30%);
}

.section--dark .steps p {
	color: var(--sand);
}

/* --- Feature list with check marks ---------------------------------------- */

.check-list {
	list-style: none;
	padding: 0;
	display: grid;
	gap: var(--space-3);
}

.check-list li {
	margin-top: 0;
	position: relative;
	padding-left: 2rem;
	color: var(--text-muted);
}

.check-list li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.35em;
	width: 1.125rem;
	height: 1.125rem;
	background-color: var(--accent-ink);
	/* A check mark drawn as a mask, so it inherits colour and needs no file. */
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='M4 12.5 9.5 18 20 6.5'/%3E%3C/svg%3E")
		center / contain no-repeat;
}

.section--dark .check-list li {
	color: var(--sand);
}

.section--dark .check-list li::before {
	background-color: var(--amber);
}

/* --- Prose (legal pages, long copy) --------------------------------------- */

.prose > * + * {
	margin-top: var(--space-5);
}

.prose h2 {
	font-size: var(--text-2xl);
	margin-top: var(--space-9);
}

.prose h3 {
	font-size: var(--text-xl);
	margin-top: var(--space-7);
}

.prose ul,
.prose ol {
	color: var(--text-muted);
	max-width: var(--measure);
}

.prose p {
	color: var(--text-muted);
}

.prose__meta {
	font-size: var(--text-sm);
	color: var(--text-muted);
	padding-bottom: var(--space-5);
	border-bottom: 1px solid var(--line);
}

/* --- Call-to-action band -------------------------------------------------- */

.cta-band {
	background-color: var(--panel);
	color: var(--panel-ink);
	padding-block: var(--section-y);
}

.cta-band__inner {
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-4);
}

.cta-band__title {
	color: var(--panel-ink);
	max-width: 22ch;
}

.cta-band__lead {
	color: var(--sand);
	font-size: var(--text-lg);
	max-width: 46ch;
	margin: 0;
}

.cta-band__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--space-4);
	margin-top: var(--space-2);
}

.cta-band__meta {
	font-size: var(--text-sm);
	color: var(--sand);
	margin: 0;
}

/* --- Footer --------------------------------------------------------------- */

.site-footer {
	background-color: var(--panel);
	color: var(--sand);
	padding-block: var(--space-9) var(--space-6);
	border-top: 1px solid rgb(245 217 168 / 15%);
}

.cta-band + .site-footer {
	border-top: 1px solid rgb(245 217 168 / 20%);
}

.site-footer__grid {
	display: grid;
	gap: var(--space-7);
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
}

.site-footer__brand {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.site-footer__logo {
	width: 2.5rem;
	height: 2.5rem;
}

.site-footer__wordmark {
	color: var(--panel-ink);
	font-size: var(--text-lg);
	font-weight: var(--weight-bold);
	letter-spacing: var(--tracking-tight);
	margin: 0;
}

.site-footer__tagline {
	font-size: var(--text-sm);
	margin: 0;
}

.site-footer__heading {
	font-size: var(--text-sm);
	font-weight: var(--weight-semibold);
	letter-spacing: var(--tracking-wide);
	text-transform: uppercase;
	color: var(--panel-ink);
	margin-bottom: var(--space-4);
}

.site-footer ul {
	list-style: none;
	padding: 0;
	margin: 0;
	display: grid;
	gap: var(--space-2);
	font-size: var(--text-sm);
}

.site-footer li {
	margin-top: 0;
}

.site-footer a {
	color: var(--sand);
	text-decoration: none;
}

.site-footer a:hover {
	color: var(--panel-ink);
	text-decoration: underline;
}

.site-footer__base {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: var(--space-3);
	margin-top: var(--space-8);
	padding-top: var(--space-5);
	border-top: 1px solid rgb(245 217 168 / 15%);
	font-size: var(--text-xs);
}

.site-footer__base p {
	margin: 0;
	max-width: none;
}

/* --- Scroll reveal -------------------------------------------------------- */

/* The hidden state is applied only once JavaScript has confirmed it can
   reveal again. No script, no risk of permanently invisible content. */
.has-reveal [data-reveal] {
	opacity: 0;
	transform: translateY(12px);
	transition:
		opacity var(--duration-slow) var(--ease-out),
		transform var(--duration-slow) var(--ease-out);
}

.has-reveal [data-reveal].is-revealed {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	.has-reveal [data-reveal] {
		opacity: 1;
		transform: none;
	}
}

/* ==========================================================================
   REVIEW TOOLS — tag inspector and spotlight

   Styling only; the behaviour is in nav.js. Both are inert on an ordinary
   visit: nothing here applies until the script adds .tags-on to the body or
   .is-spotlit to an element, which only happens on ?tags, Ctrl+`, or ?focus.
   ========================================================================== */

/* --- Tag inspector [?tags] --------------------------------------------- */

body.tags-on [data-eid] {
	position: relative;
	outline: 1px dashed var(--amber);
	outline-offset: 2px;
}

body.tags-on [data-eid]:hover {
	outline-color: var(--ink-strong);
}

body.tags-on [data-eid]::after {
	content: attr(data-eid);
	position: absolute;
	top: 0;
	left: 0;
	z-index: 9999;
	padding: 1px 4px;
	background: var(--amber);
	/* Espresso on amber, not white: 4.57:1 against 3.19:1. The same rule that
	   governs the primary button governs this label. */
	color: var(--on-accent);
	font: var(--weight-semibold) 10px/1.4 var(--font-mono);
	letter-spacing: 0.04em;
	/* Tags are lowercase. Without this a label on a .btn inherits the
	   button's uppercase transform and reads as a different tag than the one
	   printed in TAGS.md. */
	text-transform: none;
	pointer-events: none;
}

.tagbar {
	position: fixed;
	bottom: var(--space-5);
	left: 50%;
	transform: translateX(-50%);
	z-index: 10000;
	max-width: min(90vw, 60ch);
	padding: var(--space-3) var(--space-5);
	border: 1px solid var(--amber);
	border-radius: var(--radius-md);
	background: var(--surface);
	color: var(--text);
	font-size: var(--text-sm);
	text-align: center;
	box-shadow: var(--shadow-lg);
}

/* --- Spotlight [?focus=<eid>] ------------------------------------------ */

.spotlight-backdrop {
	position: fixed;
	inset: 0;
	z-index: 9990;
	background: rgb(66 32 6 / 78%);
	/* Clicks pass straight through. A backdrop that dismissed itself on click
	   meant one stray click while reading killed the spotlight with no way
	   back short of a reload. Escape is the way out, and it toggles. */
	pointer-events: none;
}

.is-spotlit {
	position: relative;
	z-index: 9991;
	/* The backdrop sits behind this, so the target needs its own ground or
	   the dimming shows through the gaps between lines of text. */
	background: var(--page-bg);
	border-radius: var(--radius-lg);
	outline: 2px solid var(--amber);
	outline-offset: 10px;
	box-shadow: var(--shadow-lg);
}

/* A sunk band already carries its own ground; keep it rather than flattening
   the section to cream and changing the very thing being reviewed. Scoped to
   the band itself — as a descendant selector this also repainted every card
   inside a sunk section, which is not what the rule is for. */
.section--sunk.is-spotlit {
	background: var(--surface-sunk);
}

/* Cards and panels likewise keep their own surface. */
.card.is-spotlit,
.feature.is-spotlit,
.engagement__card.is-spotlit,
.contact__card.is-spotlit {
	background: var(--surface);
}

.spotlight-label {
	position: fixed;
	left: 50%;
	bottom: var(--space-6);
	transform: translateX(-50%);
	z-index: 9992;
	max-width: min(90vw, 60ch);
	padding: var(--space-4) var(--space-5);
	border: 1px solid var(--amber);
	border-radius: var(--radius-md);
	background: var(--surface);
	color: var(--text);
	font-size: var(--text-sm);
	text-align: center;
	box-shadow: var(--shadow-lg);
}
