/*
 * components.css — buttons, cards, forms, badges, breadcrumbs,
 * pagination, accordion, theme toggle, tables. Reusable UI pieces
 * referenced from many templates.
 */

/* ---------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------- */
.btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.6em;
	padding: 0.9em 1.6em;
	/* Body face, not display. Controls are UI, not voice — and with a
	   serif display face a serif button label reads as a mistake. */
	font-family: var(--font-body);
	font-size: var(--text-s);
	font-weight: 600;
	border-radius: var(--radius-full);
	transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
	will-change: transform;
}
.btn__icon { width: 18px; height: 18px; transition: transform var(--dur-fast) var(--ease-out); }
.btn:hover .btn__icon { transform: translateX(3px); }
.btn:active { transform: scale(.97); }

/* Filled with --brand-text, not --brand: white on the identity blue is
   4.30:1, under AA. On --brand-text it is 6.12:1. --on-brand flips to
   navy in dark mode, where the lighter brand cannot carry white. */
.btn--primary { background: var(--brand-text); color: var(--on-brand); box-shadow: var(--shadow-brand); }
.btn--primary:hover { background: var(--brand-deep); box-shadow: 0 18px 36px rgba(var(--brand-text-rgb), .34); transform: translateY(-2px); }

.btn--ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--border); }
.btn--ghost:hover { border-color: var(--brand-text); color: var(--brand-text); background: var(--brand-light); }

.btn--dark { background: #fff; color: var(--navy); }
.btn--dark:hover { background: var(--brand-text); color: var(--on-brand); transform: translateY(-2px); }

.btn--outline-light { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.35); }
.btn--outline-light:hover { border-color: #fff; background: rgba(255,255,255,.08); }

.btn--text { padding: 0.2em 0; background: none; color: var(--brand-text); font-weight: 600; }
.btn--text .btn__icon { width: 16px; height: 16px; }
.btn--text:hover { color: var(--brand-deep); }
.btn--text::after {
	content: "";
	position: absolute;
	left: 0; right: 100%; bottom: -2px;
	height: 2px;
	background: currentColor;
	transition: right var(--dur-base) var(--ease-out);
}
.btn--text:hover::after { right: 0; }

.btn--lg { padding: 1.1em 2em; font-size: var(--text-m); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------------------------------------------------------------
 * Badges / pills / tags
 * ------------------------------------------------------------- */
.badge {
	display: inline-flex;
	align-items: center;
	gap: .4em;
	padding: .35em .85em;
	font-size: var(--text-xs);
	font-weight: 600;
	border-radius: var(--radius-full);
	background: var(--brand-light);
	color: var(--brand-deep);
}
.badge--outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.badge--sample { background: rgba(230, 160, 40, .14); color: #9a6a12; }
[data-theme="dark"] .badge--sample, :root:not([data-theme="light"]) .badge--sample { color: #e8b45a; }

.tag-list { display: flex; flex-wrap: wrap; gap: .5em; }
.tag {
	font-size: var(--text-xs);
	font-weight: 600;
	padding: .4em .8em;
	border-radius: var(--radius-full);
	background: var(--surface-alt);
	border: 1px solid var(--border);
	color: var(--muted);
}

/* ---------------------------------------------------------------
 * Cards
 * ------------------------------------------------------------- */
.card {
	position: relative;
	/* --surface-raised matches --surface in light mode but lifts a step
	   above the page in dark mode, so cards keep an edge without
	   relying on the border alone. */
	background: var(--surface-raised);
	border: 1px solid var(--border);
	border-radius: var(--radius-l);
	transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-m); transform: translateY(-4px); border-color: transparent; }

.service-card {
	padding: var(--space-l) var(--space-m);
	display: flex;
	flex-direction: column;
	height: 100%;
	perspective: 900px;
}
.service-card__top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--space-s);
	margin-bottom: var(--space-m);
}
.service-card__icon {
	width: 52px; height: 52px;
	display: inline-flex; align-items: center; justify-content: center;
	border-radius: var(--radius-m);
	background: var(--brand-light);
	color: var(--brand-text);
	flex-shrink: 0;
	transition: transform var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}
.service-card__icon .icon { width: 26px; height: 26px; }
.service-card:hover .service-card__icon { background: var(--brand-text); color: var(--on-brand); transform: rotate(-6deg) scale(1.05); }

/* Carries the affordance the removed text link used to. Hidden from
   assistive tech — the title anchor is the real control. */
.service-card__arrow { color: var(--muted-soft); transition: transform var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out); }
.service-card__arrow .icon { width: 20px; height: 20px; }
.service-card:hover .service-card__arrow { color: var(--brand-text); transform: translate(4px, -4px); }

.service-card__title { font-size: var(--text-l); margin-bottom: .45em; line-height: 1.22; }
.service-card__desc { font-size: var(--text-s); flex-grow: 1; line-height: 1.6; }

/* Stretches the title link over the whole card so the entire surface
   is clickable while only one anchor exists in the tab order. */
.service-card__cover::after { content: ""; position: absolute; inset: 0; z-index: 2; }

.case-card {
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
.case-card__media {
	aspect-ratio: 16/10;
	background: linear-gradient(135deg, var(--navy), var(--brand-deep));
	position: relative;
	display: flex;
	align-items: flex-end;
	padding: var(--space-s);
}
.case-card__sector { color: #fff; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: rgba(255,255,255,.14); padding: .4em .8em; border-radius: var(--radius-full); backdrop-filter: blur(6px); }
.case-card__body { padding: var(--space-m); display: flex; flex-direction: column; gap: var(--space-2xs); flex-grow: 1; }
.case-card__title { font-size: var(--text-l); }
.case-card__meta { font-size: var(--text-xs); color: var(--muted-soft); text-transform: uppercase; letter-spacing: .04em; }

/* The card is a flex column so the body always gets its own track and
   can never be squeezed out by the media block above it. */
.post-card {
	position: relative;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
/* display:block matters: this element is an <a>, and aspect-ratio has no
   effect on an inline box — leaving it inline let the image size itself
   from its intrinsic dimensions, fill the whole card, and push the title
   and excerpt out through overflow:hidden. */
.post-card__media {
	display: block;
	flex: none;
	aspect-ratio: 16/10;
	background: var(--surface-alt);
	overflow: hidden;
}
.post-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-slow) var(--ease-out); }
.post-card:hover .post-card__media img { transform: scale(1.06); }
.post-card__body { padding: var(--space-m); flex: 1 1 auto; }
.post-card__meta { display: flex; gap: var(--space-xs); font-size: var(--text-xs); color: var(--muted-soft); margin-bottom: var(--space-2xs); text-transform: uppercase; letter-spacing: .04em; }
.post-card__title { font-size: var(--text-l); margin-bottom: .5em; }
.post-card__title a::after { content: ""; position: absolute; inset: 0; }

.job-card { padding: var(--space-m); display: flex; align-items: center; justify-content: space-between; gap: var(--space-m); flex-wrap: wrap; }
.job-card__title { font-size: var(--text-l); margin-bottom: .3em; }
.job-card__meta { display: flex; gap: var(--space-xs); font-size: var(--text-s); color: var(--muted); flex-wrap: wrap; }
.job-card__meta span { display: inline-flex; align-items: center; gap: .35em; }
.job-card__meta .icon { width: 15px; height: 15px; }

.testimonial-card { padding: var(--space-l); display: flex; flex-direction: column; gap: var(--space-s); }
.testimonial-card__stars { display: flex; gap: .2em; color: #F5A623; }
.testimonial-card__stars .icon { width: 16px; height: 16px; }
.testimonial-card__quote { font-size: var(--text-l); font-family: var(--font-display); font-weight: 500; color: var(--ink); }
.testimonial-card__author { display: flex; align-items: center; gap: var(--space-2xs); margin-top: auto; }
.testimonial-card__avatar { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--brand-light); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--brand-text); }
.testimonial-card__name { font-weight: 600; color: var(--ink); font-size: var(--text-s); }
.testimonial-card__role { font-size: var(--text-xs); color: var(--muted-soft); }

.team-card { text-align: center; padding: var(--space-m); }
.team-card__avatar { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto var(--space-s); overflow: hidden; background: var(--brand-light); }
.team-card__name { font-size: var(--text-l); }
.team-card__role { font-size: var(--text-s); color: var(--brand-text); font-weight: 600; margin-bottom: var(--space-2xs); }
.team-card__links { display: flex; justify-content: center; gap: var(--space-2xs); margin-top: var(--space-s); }

/* ---------------------------------------------------------------
 * Forms
 * ------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: .5em; margin-bottom: var(--space-s); }
.field label { font-size: var(--text-s); font-weight: 600; color: var(--ink); }
/* #E0554A was 3.77:1 on white; this is 5.06:1. */
.field .required { color: #C93B2E; }
.field input, .field select, .field textarea {
	padding: 0.9em 1.1em;
	border: 1.5px solid var(--border);
	border-radius: var(--radius-s);
	background: var(--surface);
	color: var(--ink);
	font-size: var(--text-s);
	transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
	width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
	outline: none;
	border-color: var(--brand);
	box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .14);
}
.field textarea { resize: vertical; min-height: 130px; }
.field--error input, .field--error select, .field--error textarea { border-color: #E0554A; }
.field__error { font-size: var(--text-xs); color: #E0554A; }
.field__hint { font-size: var(--text-xs); color: var(--muted-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-s); }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

.checkbox-field { display: flex; align-items: flex-start; gap: .7em; }
.checkbox-field input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--brand); margin-top: .15em; }
.checkbox-field label { font-weight: 400; font-size: var(--text-s); color: var(--muted); }

.honeypot-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-status { padding: var(--space-s) var(--space-m); border-radius: var(--radius-m); font-size: var(--text-s); margin-bottom: var(--space-s); display: none; }
.form-status.is-visible { display: block; }
.form-status--success { background: rgba(46, 160, 90, .12); color: #1E7A44; }
.form-status--error { background: rgba(224, 85, 74, .12); color: #B5372D; }

/* ---------------------------------------------------------------
 * Breadcrumbs, pagination, accordion, theme toggle, tables
 * ------------------------------------------------------------- */
.breadcrumbs { padding-block: var(--space-s); }
.breadcrumbs__list { display: flex; flex-wrap: wrap; align-items: center; gap: .4em; font-size: var(--text-xs); color: var(--muted-soft); }
.breadcrumbs__item { display: flex; align-items: center; gap: .4em; }
.breadcrumbs a:hover { color: var(--brand-text); }
.breadcrumbs [aria-current="page"] { color: var(--ink); font-weight: 600; }

.pagination { display: flex; justify-content: center; gap: .5em; margin-top: var(--space-xl); }
.pagination a, .pagination span { min-width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-s); font-size: var(--text-s); font-weight: 600; border: 1px solid var(--border); }
.pagination a:hover { border-color: var(--brand); color: var(--brand-text); }
.pagination .current { background: var(--brand-text); border-color: var(--brand-text); color: var(--on-brand); }

.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-item__trigger {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-s);
	padding: var(--space-s) 0.2em;
	text-align: left;
	font-family: var(--font-display);
	font-size: var(--text-l);
	font-weight: 600;
	color: var(--ink);
}
.accordion-item__icon { width: 22px; height: 22px; flex-shrink: 0; color: var(--brand-text); transition: transform var(--dur-base) var(--ease-out); }
.accordion-item.is-open .accordion-item__icon { transform: rotate(45deg); }
.accordion-item__panel {
	max-height: 0;
	overflow: hidden;
	transition: max-height var(--dur-base) var(--ease-out);
}
.accordion-item__panel-inner { padding-bottom: var(--space-s); font-size: var(--text-m); color: var(--muted); }

.theme-toggle {
	position: relative;
	width: 42px; height: 42px;
	display: inline-flex; align-items: center; justify-content: center;
	border-radius: 50%;
	color: var(--ink-soft);
}
.theme-toggle:hover { background: var(--surface-alt); }
.theme-toggle__icon { position: absolute; width: 20px; height: 20px; transition: transform var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out); }
.theme-toggle__icon--moon { opacity: 0; transform: rotate(-90deg) scale(.5); }
html[data-theme="dark"] .theme-toggle__icon--sun,
html:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle__icon--moon { opacity: 0; transform: rotate(90deg) scale(.5); }
html[data-theme="dark"] .theme-toggle__icon--moon { opacity: 1; transform: none; }

table.styled-table { border: 1px solid var(--border); border-radius: var(--radius-m); overflow: hidden; }
table.styled-table th, table.styled-table td { padding: var(--space-xs) var(--space-s); text-align: left; border-bottom: 1px solid var(--border); font-size: var(--text-s); }
table.styled-table th { background: var(--surface-alt); font-family: var(--font-display); color: var(--ink); }
table.styled-table tr:last-child td { border-bottom: 0; }

.scroll-progress {
	position: fixed;
	top: 0; left: 0;
	height: 3px;
	width: 0%;
	background: linear-gradient(90deg, var(--brand), var(--brand-deep));
	z-index: 300;
	transition: width 80ms linear;
}

/* ---------------------------------------------------------------
 * Post illustrations
 *
 * Stand-in for a featured image on seeded posts, drawn as inline SVG
 * so one asset works at card size and full width. Each topic carries
 * its own accent so an archive of five reads as five different
 * articles rather than five copies of one placeholder — the same
 * complaint the service illustrations were rebuilt to answer.
 *
 * The palette is fixed rather than themed: these are dark scenes in
 * both colour modes, exactly like the service visuals and the hero,
 * so they stay legible without a second set of tokens.
 * ------------------------------------------------------------- */
.pvis {
	--pvis-bg-a: #0B1B2E;
	--pvis-bg-b: #14324F;
	--pvis-accent: var(--brand);
	display: block;
	width: 100%;
	height: 100%;
	overflow: hidden;
}
.pvis__svg { display: block; width: 100%; height: 100%; }

.pvis--commerce-stack { --pvis-bg-b: #123F4A; --pvis-accent: #46C7A8; }
.pvis--checkout       { --pvis-bg-b: #2A2352; --pvis-accent: #9B8CF5; }
.pvis--workflow       { --pvis-bg-b: #3A2C16; --pvis-accent: #F0A947; }
.pvis--ai-brief       { --pvis-bg-b: #10395E; --pvis-accent: #4FA6E3; }
.pvis--debug          { --pvis-bg-b: #43202A; --pvis-accent: #F2705F; }

/* In a card the SVG has to fill a 16/10 box; .post-card__media already
   sets that ratio, so the wrapper just has to stop being an inline
   element and actually stretch. */
.post-card__media .pvis { position: absolute; inset: 0; }
.post-card__media { position: relative; }
.post-card:hover .pvis__svg { transform: scale(1.06); }
.pvis__svg { transition: transform var(--dur-slow) var(--ease-out); }

/* Lead image above a single post: pulled up into the dark page header
   so it overlaps the band, matching how a featured image behaved. */
.post-lead {
	margin-top: calc(var(--space-l) * -1);
	position: relative;
	z-index: 1;
}
/* 16/9 against 16/10 artwork: preserveAspectRatio="slice" then crops
   25 viewBox units off the top and bottom, and every composition keeps
   its content inside y 86-460, so nothing is cut. A wider frame (16/6
   was the first attempt) eats the baseline labels. */
.post-lead__frame {
	border-radius: var(--radius-l);
	overflow: hidden;
	box-shadow: var(--shadow-l);
	aspect-ratio: 16 / 9;
}
.post-lead__frame img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 700px) {
	/* Matches the artwork exactly, so phones get no crop at all. */
	.post-lead__frame { aspect-ratio: 16 / 10; }
}
