/* ==========================================================================
   D3 Nova — reusable blocks
   Styles for the portfolio / case-study / related-blog blocks. Loaded on every
   page because these render both on the homepage and via shortcode anywhere.
   ========================================================================== */

/* ----------------------------------------------------------- PORTFOLIO --- */
.work-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: var(--sp-4);
	--shot-h: 300px;
}

.work-card {
	position: relative;
	border-radius: var(--r-lg);
	padding: .55rem .55rem .2rem;
	background: rgba(255, 255, 255, .055);
	border: 1px solid var(--night-border);
	backdrop-filter: blur(12px);
	box-shadow: 0 24px 50px -30px rgba(0, 0, 0, .95);
	transition: transform var(--t-mid) var(--e-out), box-shadow var(--t-mid) var(--e-out), border-color var(--t-mid) var(--e-out);
}

.work-card:hover {
	transform: translateY(-8px);
	border-color: rgba(147, 197, 253, .5);
	box-shadow: 0 40px 70px -34px rgba(37, 99, 235, .85);
}

/* On a light section the card needs a light shell. */
.section:not(.section--night) .work-card {
	background: var(--surface);
	border-color: var(--border);
	box-shadow: var(--sh-1);
}

.section:not(.section--night) .work-card:hover {
	border-color: rgba(37, 99, 235, .35);
	box-shadow: var(--sh-3);
}

.section:not(.section--night) .work-card__meta h3 a { color: var(--fg); }

.section:not(.section--night) .work-card__meta h3 a:hover { color: var(--blue-700); }

.section:not(.section--night) .work-card__cat { color: var(--muted-fg); }

.section:not(.section--night) .work-card__go {
	background: var(--blue-50);
	border-color: var(--border);
	color: var(--blue-700);
}

/* Browser chrome around each screenshot */
.browser {
	border-radius: 14px;
	overflow: hidden;
	background: #0F172A;
	border: 1px solid rgba(255, 255, 255, .1);
}

.browser__bar {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: .5rem .7rem;
	background: linear-gradient(180deg, #1E293B, #172033);
	border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.browser__dot { width: 8px; height: 8px; border-radius: 50%; background: #475569; flex: none; }

.browser__dot:nth-child(1) { background: #F87171; }

.browser__dot:nth-child(2) { background: #FBBF24; }

.browser__dot:nth-child(3) { background: #34D399; }

.browser__url {
	flex: 1;
	margin-left: .5rem;
	padding: .18rem .6rem;
	border-radius: var(--r-pill);
	background: rgba(255, 255, 255, .07);
	color: #94A3B8;
	font-size: .66rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* The screenshot is a full-page capture: scroll it on hover. */
.browser__screen {
	position: relative;
	height: var(--shot-h);
	overflow: hidden;
	background: #fff;
}

.browser__screen img {
	position: absolute;
	top: 0; left: 0;
	width: 100%;
	height: auto;
	display: block;
	transition: transform 6s cubic-bezier(.25, .5, .35, 1);
}

.work-card:hover .browser__screen img,
.work-card:focus-within .browser__screen img {
	transform: translateY(calc(-100% + var(--shot-h)));
}

.work-card__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--sp-3);
	padding: .85rem .6rem .75rem;
}

.work-card__meta h3 { font-size: .98rem; margin: 0 0 .1rem; color: #fff; }

.work-card__meta h3 a { color: inherit; }

.work-card__meta h3 a:hover { color: var(--blue-200); }

.work-card__cat { font-size: var(--fs-xs); color: var(--night-muted); }

.work-card__go {
	display: grid; place-items: center;
	width: 34px; height: 34px;
	flex: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, .08);
	border: 1px solid var(--night-border);
	color: #BFDBFE;
	transition: background var(--t-mid) var(--e-out), transform var(--t-mid) var(--e-spring), color var(--t-mid) var(--e-out);
}

.work-card:hover .work-card__go { background: var(--blue-600); color: #fff; transform: rotate(45deg); border-color: transparent; }

/* Whole card is the click target. */
.work-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
}

/* ---------------------------------------------------------- SCROLL RAIL --- */
.rail-wrap { position: relative; }

.rail {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(260px, 1fr);
	gap: var(--sp-4);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	padding-bottom: .75rem;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}

.rail::-webkit-scrollbar { height: 6px; }

.rail::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, .4); border-radius: 99px; }

.rail__item { scroll-snap-align: start; min-width: 0; }

.rail:focus-visible { outline: 3px solid var(--blue-600); outline-offset: 6px; border-radius: var(--r-md); }

.work-rail { --shot-h: 300px; grid-auto-columns: minmax(270px, 1fr); }

.rail-nav {
	display: flex;
	justify-content: center;
	gap: .6rem;
	margin-top: var(--sp-4);
}

.rail-btn {
	display: grid; place-items: center;
	width: 46px; height: 46px;
	border-radius: 50%;
	border: 1.5px solid var(--border-strong);
	background: var(--surface);
	color: var(--fg);
	transition: background var(--t-fast) var(--e-out), color var(--t-fast) var(--e-out), border-color var(--t-fast) var(--e-out), transform var(--t-fast) var(--e-spring);
}

.rail-btn:hover { background: var(--blue-600); border-color: var(--blue-600); color: #fff; transform: translateY(-2px); }

.rail-btn[disabled] { opacity: .35; cursor: not-allowed; transform: none; }

.section--night .rail-btn {
	background: rgba(255, 255, 255, .07);
	border-color: var(--night-border);
	color: var(--night-fg);
}

.section--night .rail-btn:hover { background: var(--blue-600); border-color: transparent; color: #fff; }

.rail-dots { display: flex; align-items: center; gap: .45rem; padding-inline: .35rem; }

.rail-dot {
	position: relative;
	width: 9px; height: 9px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--border-strong);
	cursor: pointer;
	transition: background var(--t-fast) var(--e-out), width var(--t-fast) var(--e-out);
}

/* The dot is deliberately small; the tap target is not. */
.rail-dot::before { content: ''; position: absolute; inset: -16px -8px; }

.rail-dot.is-active { width: 26px; border-radius: 99px; background: var(--blue-600); }

.section--night .rail-dot { background: rgba(255, 255, 255, .28); }
.section--night .rail-dot.is-active { background: var(--cyan); }

/* --------------------------------------------------------- CASE STUDIES --- */
.case-card { display: flex; flex-direction: column; align-items: flex-start; }

.case-card h3 { font-size: 1.12rem; margin-bottom: .5rem; }

.case-card p { font-size: var(--fs-sm); color: var(--muted-fg); margin-bottom: var(--sp-4); }

.case-card .link-more { margin-top: auto; }

.section--night .case-card p { color: var(--night-muted); }

/* --------------------------------------------------- POST CARDS ON NIGHT -- */
.section--night .post-card__title a { color: #fff; }

.section--night .post-card__title a:hover { color: var(--blue-200); }

.section--night .post-card__excerpt,
.section--night .post-card__meta { color: var(--night-muted); }

/* ---------------------------------------------------------- RESPONSIVE --- */
@media (max-width: 1080px) {
	.work-grid { grid-template-columns: repeat(2, 1fr); --shot-h: 340px; }
}

/* ==========================================================================
   Shared page components — moved out of home.css so the section library
   and shortcodes render correctly on inner pages too, not just the front
   page. home.css keeps only genuinely homepage-only styles.
   ========================================================================== */

.stat-row {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: var(--sp-4);
	padding-block: var(--sp-5);
	text-align: center;
}

.stat-row li { position: relative; }

.stat-row li + li::before {
	content: "";
	position: absolute;
	left: 0; top: 15%;
	width: 1px; height: 70%;
	background: var(--night-border);
}

.stat-num {
	display: block;
	font-family: var(--font-display);
	font-size: clamp(1.9rem, 1.3rem + 2vw, 2.9rem);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -.04em;
	background: var(--grad-text);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	font-variant-numeric: tabular-nums;
}

.stat-label {
	display: block;
	margin-top: .4rem;
	font-size: var(--fs-xs);
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--night-muted);
}

.client-strip__label {
	margin: 0 0 var(--sp-4);
	text-align: center;
	font-size: var(--fs-xs);
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--night-muted);
}

.client-logo {
	display: grid;
	place-items: center;
	flex: none;
	min-width: 150px;
	height: 62px;
	padding: 0 1.5rem;
}

.client-logo img {
	max-height: 40px;
	width: auto;
	object-fit: contain;
	filter: brightness(0) invert(1);
	opacity: .58;
	transition: opacity var(--t-mid) var(--e-out), filter var(--t-mid) var(--e-out), transform var(--t-mid) var(--e-out);
}

.client-logo:hover img { opacity: 1; filter: none; transform: scale(1.06); }

.svc-card {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	color: inherit;
	padding-top: var(--sp-6);
}

.svc-card h3 { font-size: 1.12rem; margin-bottom: .5rem; }

.svc-card p { font-size: var(--fs-sm); color: var(--muted-fg); margin-bottom: var(--sp-4); }

.svc-card .link-more { margin-top: auto; }

.svc-card__num {
	position: absolute;
	top: 1rem; right: 1.2rem;
	font-family: var(--font-display);
	font-size: 2.4rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: -.05em;
	color: rgba(15, 23, 42, .06);
	transition: color var(--t-mid) var(--e-out);
}

.svc-card:hover .svc-card__num { color: rgba(37, 99, 235, .16); }

.cap-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }

.cap-card { padding: var(--sp-4); }

.cap-card h4 { font-size: .98rem; margin-bottom: .25rem; }

.cap-card p { font-size: var(--fs-xs); color: var(--muted-fg); margin: 0; }

.cap-dot {
	display: inline-grid;
	place-items: center;
	width: 26px; height: 26px;
	border-radius: 50%;
	background: var(--blue-600);
	color: #fff;
	margin-bottom: .6rem;
}

.geo-row { display: flex; flex-wrap: wrap; gap: .5rem; }

.faq__item {
	border-radius: var(--r-md);
	background: var(--surface);
	border: 1px solid var(--border);
	box-shadow: var(--sh-1);
	overflow: hidden;
	transition: border-color var(--t-mid) var(--e-out), box-shadow var(--t-mid) var(--e-out);
}

.faq__item.is-open { border-color: rgba(37, 99, 235, .4); box-shadow: var(--sh-2); }

.faq__q { margin: 0; font-size: 1rem; }

.faq__btn {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--sp-4);
	width: 100%;
	padding: 1.15rem 1.35rem;
	text-align: left;
	font-family: var(--font-display);
	font-size: 1.02rem;
	font-weight: 600;
	color: var(--fg);
	letter-spacing: -.01em;
}

.faq__btn:hover { color: var(--blue-700); }

.faq__sign {
	display: grid; place-items: center;
	width: 32px; height: 32px;
	flex: none;
	border-radius: 50%;
	background: var(--blue-50);
	color: var(--blue-700);
	transition: transform var(--t-mid) var(--e-spring), background var(--t-mid) var(--e-out), color var(--t-mid) var(--e-out);
}

.faq__item.is-open .faq__sign { transform: rotate(45deg); background: var(--blue-600); color: #fff; }

.faq__panel {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows var(--t-mid) var(--e-out);
}

.faq__item.is-open .faq__panel { grid-template-rows: 1fr; }

.faq__panel-inner { overflow: hidden; }

.faq__panel-inner p {
	padding: 0 1.35rem 1.35rem;
	margin: 0;
	color: var(--muted-fg);
	font-size: var(--fs-sm);
	line-height: 1.75;
}

/* Base rules for the shared components (comment-prefixed, missed in the first pass). */
.client-strip {
	background: var(--night-2);
	padding-block: var(--sp-5);
	overflow: hidden;
}

.svc-grid { gap: var(--sp-4); }

.about-grid {
	display: grid;
	grid-template-columns: 1.05fr .95fr;
	gap: clamp(2rem, 1rem + 3vw, 4rem);
	align-items: center;
}

.faq { display: grid; gap: .7rem; }

/* Tech stack marquee — shared with the [tech] section on inner pages. */
.tech-section { overflow: hidden; }

.tech-marquees { display: grid; gap: var(--sp-3); margin-top: var(--sp-5); }

.tech-pill {
	display: inline-flex;
	align-items: center;
	gap: .6rem;
	padding: .6rem 1.15rem;
	border-radius: var(--r-pill);
	background: var(--surface);
	border: 1px solid var(--border);
	box-shadow: var(--sh-1);
	font-family: var(--font-display);
	font-size: var(--fs-sm);
	font-weight: 600;
	color: var(--fg-soft);
	white-space: nowrap;
	transition: border-color var(--t-fast) var(--e-out), transform var(--t-fast) var(--e-out);
}

.tech-pill:hover { border-color: rgba(37, 99, 235, .4); transform: translateY(-2px); }

.tech-pill img {
	width: 26px; height: 26px;
	object-fit: contain;
	flex: none;
}

/* --- media queries last so they override the base rules above --- */

@media (max-width: 640px) {
	.rail { grid-auto-columns: minmax(84%, 1fr); }
}

@media (max-width: 767px) {
	.work-grid { grid-template-columns: 1fr; --shot-h: 320px; }
}

@media (prefers-reduced-motion: reduce) {
	.work-card:hover .browser__screen img,
	.work-card:focus-within .browser__screen img { transform: none !important; }
	.rail { scroll-behavior: auto; }
}

@media (max-width: 991px) {
.about-grid { grid-template-columns: 1fr; }
.stat-row { grid-template-columns: repeat(2, 1fr); gap: var(--sp-5); }
.stat-row li:nth-child(3)::before { display: none; }
}

@media (max-width: 767px) {
.svc-grid, .cap-grid { grid-template-columns: 1fr; }
.client-logo { min-width: 120px; padding-inline: 1rem; }
}

/* ------------------------------------------------------------- OFFICES --- */
.office-card { display: flex; flex-direction: column; align-items: flex-start; gap: .55rem; }
.office-card__label {
	font-family: var(--font-display);
	font-size: var(--fs-xs);
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--blue-600);
}
.office-card h3 { font-size: var(--fs-lg); margin: 0; }
.office-card__country { color: var(--muted-fg); font-weight: 400; }
.office-card p { color: var(--muted-fg); font-size: var(--fs-sm); line-height: 1.65; margin: 0; flex: 1; }
.section--night .office-card__label { color: var(--blue-200); }
.section--night .office-card__country,
.section--night .office-card p { color: var(--night-muted); }

/* --------------------------------------------------- PORTFOLIO FILTER --- */
.pf-filter {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: .55rem;
	margin-bottom: var(--sp-5);
}

.pf-chip {
	display: inline-flex;
	align-items: center;
	gap: .45rem;
	min-height: 44px;
	padding: .5rem 1.05rem;
	border-radius: 99px;
	border: 1.5px solid var(--border-strong);
	background: var(--surface);
	color: var(--fg);
	font-family: var(--font-display);
	font-size: var(--fs-sm);
	font-weight: 600;
	cursor: pointer;
	transition: background var(--t-fast) var(--e-out), color var(--t-fast) var(--e-out), border-color var(--t-fast) var(--e-out), transform var(--t-fast) var(--e-spring);
}

.pf-chip:hover { border-color: var(--blue-600); transform: translateY(-2px); }

.pf-chip.is-active { background: var(--grad-brand); border-color: transparent; color: #fff; }

.pf-chip__n {
	font-size: var(--fs-xs);
	font-weight: 700;
	padding: .1rem .42rem;
	border-radius: 99px;
	background: var(--bg-alt);
	color: var(--muted-fg);
}

.pf-chip.is-active .pf-chip__n { background: rgba(255, 255, 255, .22); color: #fff; }

.section--night .pf-chip { background: rgba(255, 255, 255, .07); border-color: var(--night-border); color: var(--night-fg); }
.section--night .pf-chip__n { background: rgba(255, 255, 255, .12); color: var(--night-muted); }

.pf-empty { text-align: center; color: var(--muted-fg); padding-block: var(--sp-6); }

/* CPT thumbnails are wide single shots, not tall full-page captures, so they
   must not inherit the hover page-scroll height of the curated screenshots. */
.work-card--flat .browser__screen { height: auto; aspect-ratio: 16 / 10; }
.work-card--flat .browser__screen img { height: 100%; object-fit: cover; object-position: top center; transform: none; }
.work-card--flat:hover .browser__screen img { transform: none; }

/* --------------------------------------------------- BLOG POST SIDEBAR --- */
.post-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 340px;
	gap: clamp(1.75rem, 1rem + 3vw, 3.25rem);
	align-items: start;
}

.post-main { min-width: 0; }

/* The article column keeps a comfortable measure even in the wider container. */
.post-main .prose { max-width: 72ch; }

/* The grid uses align-items:start, which shrinks this column to its content -
   leaving a sticky child no room to travel, so it never sticks. Stretching the
   column to the full row height is what makes the sticky work at all. */
.post-side { min-width: 0; align-self: stretch; }

/* Sticky, with no inner scrollbar. When the sidebar is taller than the
   viewport, --side-top is set negative by initStickySide() so the column
   scrolls with the page and then pins with its BOTTOM against the viewport
   bottom - the "scroll then stick" behaviour. When it fits, it simply pins
   below the header. */
.post-side__inner {
	position: sticky;
	top: var(--side-top, calc(var(--header-h, 76px) + 1rem));
	display: grid;
	gap: var(--sp-4);
}

.side-card {
	padding: var(--sp-4);
	border-radius: var(--r-lg);
	background: var(--surface);
	border: 1px solid var(--border);
}

.side-card--brand { background: var(--bg-alt); }

.side-card--cta {
	background: var(--grad-brand);
	border-color: transparent;
	color: #fff;
}
.side-card--cta .side-title,
.side-card--cta .side-lead { color: #fff; }
.side-card--cta .side-lead { opacity: .9; }
.side-card--cta .btn--primary { background: #fff; color: var(--blue-700); border-color: transparent; }

.side-title {
	font-family: var(--font-display);
	font-size: 1.05rem;
	font-weight: 700;
	letter-spacing: -.01em;
	margin: 0 0 .55rem;
	color: var(--fg);
}

.side-lead { font-size: var(--fs-sm); color: var(--muted-fg); line-height: 1.6; margin: 0 0 var(--sp-3); }

.side-way {
	display: flex;
	align-items: center;
	gap: .7rem;
	padding: .6rem .7rem;
	border-radius: var(--r-md);
	border: 1px solid var(--border);
	background: var(--surface);
	margin-bottom: .55rem;
	transition: border-color var(--t-fast) var(--e-out), transform var(--t-fast) var(--e-out);
}
.side-way:last-child { margin-bottom: 0; }
.side-way:hover { border-color: var(--blue-600); transform: translateX(2px); }
.side-way__ico {
	display: grid; place-items: center;
	width: 36px; height: 36px; flex: none;
	border-radius: 10px;
	background: rgba(37, 99, 235, .1);
	color: var(--blue-600);
}
.side-way--wa .side-way__ico { background: rgba(16, 185, 129, .12); color: #059669; }
.side-way b { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--fg); line-height: 1.3; }
.side-way i { font-style: normal; font-size: var(--fs-xs); color: var(--muted-fg); }

.side-cats { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.side-cat {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .5rem;
	min-height: 40px;
	padding: .45rem .65rem;
	border-radius: var(--r-sm, 10px);
	font-size: var(--fs-sm);
	color: var(--fg);
	transition: background var(--t-fast) var(--e-out), color var(--t-fast) var(--e-out);
}
.side-cat:hover { background: var(--bg-alt); color: var(--blue-700); }
.side-cat.is-current { background: var(--grad-brand); color: #fff; }
.side-cat__n { font-size: var(--fs-xs); color: var(--muted-fg); }
.side-cat.is-current .side-cat__n { color: rgba(255, 255, 255, .85); }

.side-posts { list-style: none; margin: 0; padding: 0; display: grid; gap: .85rem; }
.side-posts a { display: flex; gap: .7rem; align-items: flex-start; }
.side-post__img { flex: none; width: 60px; height: 60px; border-radius: 10px; overflow: hidden; }
.side-post__img img { width: 100%; height: 100%; object-fit: cover; }
.side-posts b { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--fg); line-height: 1.35; }
.side-posts a:hover b { color: var(--blue-700); }
.side-posts i { font-style: normal; font-size: var(--fs-xs); color: var(--muted-fg); }

/* Contact Form 7 inside a 340px column. */
.side-form input[type="text"],
.side-form input[type="email"],
.side-form input[type="tel"],
.side-form textarea { width: 100%; }
.side-form textarea { min-height: 90px; max-height: 110px; }
.side-form .wpcf7-form > p { margin-bottom: .6rem; }

@media (max-width: 1080px) {
	.post-layout { grid-template-columns: 1fr; }
	.post-side__inner { position: static; top: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.side-card--cta { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
	.post-side__inner { grid-template-columns: 1fr; }
}

/* ------------------------------------------ MOBILE CAROUSELS -------------- */
/* Below 860px a 3-up grid becomes a very tall stack. Swipeable rails read
   better and keep the section height sane; edge bleed hints there is more. */
@media (max-width: 860px) {
	.work-grid,
	.blog-grid,
	.case-grid,
	.review-grid,
	.ind-grid {
		display: grid;
		grid-auto-flow: column;
		/* A percentage MINIMUM is what forces the overflow; minmax(0, 82%) lets
		   the tracks shrink to fit and the rail never scrolls. */
		grid-auto-columns: minmax(82%, 1fr);
		grid-template-columns: none !important;
		gap: var(--sp-4);
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		margin-inline: calc(var(--gutter, 1.25rem) * -1);
		padding-inline: var(--gutter, 1.25rem);
		padding-bottom: .5rem;
	}

	.work-grid::-webkit-scrollbar,
	.blog-grid::-webkit-scrollbar,
	.case-grid::-webkit-scrollbar,
	.review-grid::-webkit-scrollbar,
	.ind-grid::-webkit-scrollbar { display: none; }

	.work-grid > *,
	.blog-grid > *,
	.case-grid > *,
	.review-grid > *,
	.ind-grid > * { scroll-snap-align: center; min-width: 0; }

	/* Industry chips are small, so they fit several per swipe. */
	.ind-grid { grid-auto-columns: minmax(42%, 1fr); }

	/* wpautop can drop empty paragraphs into these tracks; they would eat a slide. */
	.work-grid > p:empty,
	.blog-grid > p:empty,
	.case-grid > p:empty,
	.review-grid > p:empty,
	.ind-grid > p:empty { display: none; }
}
