/* ===================================================================
   CASE 2026 — brings every case study (and About) onto the homepage's
   design system. Loaded last. Chapters alternate between:
     .cs-dark  → warm black, periwinkle halo + instrument grid
     .cs-light → sketchbook paper, dotted grid, grain
   The existing pages carry hundreds of inline colours written for a dark
   background; inside .cs-light every one of them is remapped here to an
   ink that passes WCAG AA on paper.
   =================================================================== */

:root {
	--cs-black: #111210;
	--cs-charcoal: #1B1D1A;
	--cs-paper: #F5F4EF;
	--cs-ink: #111210;
	--cs-ink-soft: #2A2C28;
	--cs-ink-muted: #5E615A;
	--cs-peri: #8B9CFF;
	--cs-peri-ink: #3F4FC8;
	--cs-red-ink: #B3261E;
	--cs-green-ink: #1F7A55;
	--cs-amber-ink: #8A5A00;
}

/* ---------- Shared section rhythm ---------- */
section.cs-dark, section.cs-light {
	position: relative;
	isolation: isolate;
	padding-top: clamp(88px, 10vw, 150px) !important;
	padding-bottom: clamp(88px, 10vw, 150px) !important;
}
/* merged sub-chapters sit tight under their chapter */
section.cs-dark + section.cs-dark:not(:has(h2, h3)),
section.cs-light + section.cs-light:not(:has(h2, h3)) { padding-top: 0 !important; }
section.cs-dark:has(+ section.cs-dark:not(:has(h2, h3))),
section.cs-light:has(+ section.cs-light:not(:has(h2, h3))) { padding-bottom: 48px !important; }

section.single-work.cs-dark { padding-top: clamp(48px, 6vw, 96px) !important; }
section.project-pager.cs-dark { padding-top: 72px !important; padding-bottom: 72px !important; }

/* ---------- DARK: halo + grid (same as the homepage) ---------- */
section.cs-dark { background-color: var(--cs-black) !important; overflow: hidden; }
section.cs-dark::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background-image:
		radial-gradient(ellipse 45% 55% at 78% 30%, rgba(139, 156, 255, 0.16), transparent 70%),
		linear-gradient(rgba(139, 156, 255, 0.05) 1px, transparent 1px),
		linear-gradient(90deg, rgba(139, 156, 255, 0.05) 1px, transparent 1px);
	background-size: auto, 64px 64px, 64px 64px;
	-webkit-mask-image: radial-gradient(ellipse 80% 80% at 60% 40%, #000 20%, transparent 85%);
	mask-image: radial-gradient(ellipse 80% 80% at 60% 40%, #000 20%, transparent 85%);
	pointer-events: none;
}
section.cs-dark img:not([class*="icon"]) {
	box-shadow: 0 30px 80px -40px rgba(139, 156, 255, 0.45);
}

/* ---------- LIGHT: sketchbook paper ---------- */
section.cs-light {
	background-color: var(--cs-paper) !important;
	background-image:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.07 0 0 0 0 0.07 0 0 0 0 0.06 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
		radial-gradient(rgba(17, 18, 16, 0.12) 1px, transparent 1.3px) !important;
	background-size: 180px 180px, 24px 24px !important;
	background-position: 0 0, 12px 12px !important;
}
section.cs-light::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background: radial-gradient(ellipse 120% 90% at 50% 50%, transparent 60%, rgba(120, 110, 90, 0.10) 100%);
}

/* Text: everything defaults to ink… */
section.cs-light,
section.cs-light *:not(svg):not(path):not(iframe) {
	color: var(--cs-ink) !important;
}
/* …secondary text written as translucent white becomes soft or muted ink */
section.cs-light [style*="rgba(255,255,255,0.7"], section.cs-light [style*="rgba(255, 255, 255, 0.7"],
section.cs-light [style*="rgba(255,255,255,0.8"], section.cs-light [style*="rgba(255, 255, 255, 0.8"],
section.cs-light [style*="rgba(255,255,255,0.9"], section.cs-light [style*="rgba(255, 255, 255, 0.9"],
section.cs-light [style*="opacity: 0.9"], section.cs-light [style*="opacity:0.9"],
section.cs-light [style*="opacity: 0.8"], section.cs-light [style*="opacity:0.8"] {
	color: var(--cs-ink-soft) !important;
}
section.cs-light [style*="rgba(255,255,255,0.5"], section.cs-light [style*="rgba(255, 255, 255, 0.5"],
section.cs-light [style*="rgba(255,255,255,0.6"], section.cs-light [style*="rgba(255, 255, 255, 0.6"],
section.cs-light [style*="opacity: 0.7"], section.cs-light [style*="opacity:0.7"],
section.cs-light [style*="opacity: 0.6"], section.cs-light [style*="opacity:0.6"],
section.cs-light figcaption, section.cs-light [class*="caption"],
section.cs-light [style*="font-style: italic"] {
	color: var(--cs-ink-muted) !important;
}
section.cs-light [style*="opacity"] { opacity: 1 !important; }

/* Accent and semantic colours → inks that pass on paper */
section.cs-light [style*="#A3B0FF"], section.cs-light [style*="#a3b0ff"],
section.cs-light [style*="rgba(139,156,255"], section.cs-light .chapter-num,
section.cs-light a, section.cs-light a * {
	color: var(--cs-peri-ink) !important;
}
section.cs-light [style*="#FF9B8F"], section.cs-light [style*="#ff9b8f"] { color: var(--cs-red-ink) !important; }
section.cs-light [style*="#A8E6CF"], section.cs-light [style*="#a8e6cf"] { color: var(--cs-green-ink) !important; }
section.cs-light [style*="#F2CC7A"], section.cs-light [style*="#f2cc7a"] { color: var(--cs-amber-ink) !important; }

/* Cards and panels drawn as white glass become paper cards */
section.cs-light [style*="background: rgba(255,255,255"], section.cs-light [style*="background:rgba(255,255,255"],
section.cs-light [style*="background: rgba(255, 255, 255"], section.cs-light [style*="background-color: rgba(255,255,255"] {
	background: rgba(255, 255, 255, 0.62) !important;
	border-color: rgba(17, 18, 16, 0.10) !important;
	box-shadow: 0 1px 0 rgba(17, 18, 16, 0.04), 0 18px 40px -30px rgba(60, 50, 30, 0.35);
}
section.cs-light [style*="background: rgba(0,0,0"], section.cs-light [style*="background:rgba(0,0,0"],
section.cs-light [style*="background: rgba(0, 0, 0"], section.cs-light [style*="background: #1"],
section.cs-light [style*="background: #0"], section.cs-light [style*="background-color: #1"] {
	background: #EAE9E2 !important;
	border-color: rgba(17, 18, 16, 0.10) !important;
}
section.cs-light [style*="background: rgba(139,156,255"], section.cs-light [style*="background:rgba(139,156,255"],
section.cs-light .snapshot {
	background: rgba(63, 79, 200, 0.06) !important;
	border-color: rgba(63, 79, 200, 0.28) !important;
}
section.cs-light [style*="border-left"] { border-left-color: var(--cs-peri-ink) !important; }
section.cs-light [style*="border: 1px solid rgba(255"], section.cs-light [style*="border:1px solid rgba(255"],
section.cs-light [style*="border-top: 1px solid rgba(255"], section.cs-light [style*="border-bottom: 1px solid rgba(255"] {
	border-color: rgba(17, 18, 16, 0.12) !important;
}
section.cs-light hr { border-color: rgba(17, 18, 16, 0.14) !important; }

/* Images read as prints pasted into the book */
section.cs-light img {
	box-shadow: 0 1px 0 rgba(17, 18, 16, 0.06), 0 26px 50px -30px rgba(60, 50, 30, 0.40);
	border-radius: 12px;
}

/* ---------- Headings: the homepage's display type ---------- */
section.cs-dark h2, section.cs-dark h3:has(.chapter-num),
section.cs-light h2, section.cs-light h3:has(.chapter-num) {
	font-family: "Clash Display", "Inter", system-ui, sans-serif !important;
	font-weight: 600 !important;
	letter-spacing: -0.01em !important;
	text-wrap: balance;
	max-width: 22ch;
}
.chapter-num {
	display: block !important;
	font-family: "Inter", system-ui, sans-serif !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	letter-spacing: 0.02em !important;
	margin: 0 0 14px !important;
}
section.cs-dark .chapter-num { color: #A3B0FF !important; }

/* ---------- Hero (dark) ---------- */
section.single-work.cs-dark .single-work_title {
	font-family: "Clash Display", "Inter", system-ui, sans-serif !important;
	font-weight: 600 !important;
	font-size: clamp(48px, 6.4vw, 92px) !important;
	line-height: 0.98 !important;
	letter-spacing: -0.02em !important;
	margin-bottom: 28px !important;
}

/* ---------- Links & focus ---------- */
section.cs-dark a:not(.theme-btn):not([class*="btn"]) { color: #A3B0FF; }
section.cs-light a:focus-visible, section.cs-dark a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* ---------- Video embeds sit like media on the homepage ---------- */
section.cs-light .video-container, section.cs-light .rb-video-embed {
	box-shadow: 0 30px 60px -34px rgba(60, 50, 30, 0.45);
	border-radius: 14px;
	overflow: hidden;
}
section.cs-dark .video-container, section.cs-dark .rb-video-embed {
	box-shadow: 0 0 0 1px rgba(245, 244, 239, 0.08), 0 40px 90px -40px rgba(139, 156, 255, 0.5);
	border-radius: 14px;
	overflow: hidden;
}

/* ---------- Footer matches the homepage ---------- */
.main-footer { background: #111210 !important; }
.main-footer, .main-footer * { color: #A8AAA4; }

/* ---------- Clear the fixed header on every page ----------
   The header is fixed (110px tall on phones, 116px on desktop); the first
   section now starts below it with breathing room. */
:root { --hdr: 110px; }
@media (min-width: 992px) { :root { --hdr: 116px; } }
section.single-work,
section.single-work.cs-dark {
	padding-top: calc(var(--hdr) + clamp(32px, 5vw, 64px)) !important;
}
html { scroll-padding-top: calc(var(--hdr) + 16px); }

/* On phones and tablets the story comes first, the project facts second */
@media (max-width: 991px) {
	section.single-work .row { display: flex; flex-wrap: wrap; }
	section.single-work .row > .col-lg-8 { order: 1; }
	section.single-work .row > .col-lg-4 { order: 2; margin-top: 40px; }
}

/* "See the solution first" — jump past process to the product */
.jump-solution {
	display: inline-flex; align-items: center; gap: 8px;
	margin: 8px 0 24px; padding: 11px 20px;
	border: 1px solid rgba(139, 156, 255, 0.55); border-radius: 999px;
	color: #F5F4EF !important; font-weight: 600; font-size: 15px; text-decoration: none !important;
	transition: background 0.2s, border-color 0.2s;
}
.jump-solution:hover { background: rgba(139, 156, 255, 0.14); border-color: #8B9CFF; }
.jump-solution span { color: #A3B0FF; }

/* ---------- "The system in motion": real-device videos in case studies ---------- */
.in-motion { margin: 72px 0 8px; }
.in-motion_title { font-family: "Clash Display", "Inter", system-ui, sans-serif !important; font-weight: 600 !important; font-size: clamp(24px, 2.4vw, 30px) !important; margin-bottom: 12px !important; }
.in-motion_text { max-width: 60ch; margin-bottom: 40px !important; }
.in-motion .phone-pair {
	display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px, 5vw, 64px);
	max-width: 620px; margin: 0 auto; align-items: center;
	transform-style: preserve-3d;
}
.in-motion figure { margin: 0; }
.in-motion figcaption { margin-top: 26px; text-align: center; font-size: 14px; }
.in-motion .media { position: relative; isolation: isolate; }
.in-motion .media--device {
	aspect-ratio: 378 / 790; border-radius: 17.4% / 8.4%; overflow: visible;
	box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.55);
}
.in-motion .media--device > img, .in-motion .media--device > video {
	display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit;
	box-shadow: none !important; margin: 0 !important;
}
.in-motion .media--device > video { position: absolute; inset: 0; opacity: 0; transition: opacity 0.6s ease; }
.in-motion .media--device.is-playing > video { opacity: 1; }
.in-motion .media--device.is-3d {
	--rx: 0deg; --ry: 0deg; --tz: 0px; --s: 1; --ty: 0px; --ex: 0px; --ey: 0.6px; --gx: 50%; --gy: 0%; --glare: 0;
	transform: perspective(1000px) translateY(var(--ty)) rotateX(var(--rx)) rotateY(var(--ry)) translateZ(var(--tz)) scale(var(--s));
	box-shadow:
		calc(var(--ex) * 0.5) calc(var(--ey) * 0.5) 0 0 #A3A6AB, calc(var(--ex) * 1) calc(var(--ey) * 1) 0 0 #93969B,
		calc(var(--ex) * 1.5) calc(var(--ey) * 1.5) 0 0 #83868B, calc(var(--ex) * 2) calc(var(--ey) * 2) 0 0 #73767B,
		calc(var(--ex) * 2.5) calc(var(--ey) * 2.5) 0 0 #63666A, calc(var(--ex) * 3) calc(var(--ey) * 3) 0 0 #535559,
		calc(var(--ex) * 3.5) calc(var(--ey) * 3.5) 0 0 #434548, calc(var(--ex) * 4) calc(var(--ey) * 4) 0 0 #353739,
		calc(var(--ex) * 5 + 8px) calc(var(--ey) * 5 + 34px) 60px -18px rgba(0, 0, 0, 0.55);
}
section.cs-dark .in-motion .media--device.is-3d { filter: drop-shadow(0 0 60px rgba(139, 156, 255, 0.25)); }
.in-motion .media--device.is-3d::after {
	content: ""; position: absolute; inset: 0; z-index: 4; border-radius: inherit; pointer-events: none;
	background: radial-gradient(120% 70% at var(--gx) var(--gy), rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 55%);
	mix-blend-mode: screen; opacity: var(--glare);
}

/* Product category tags under the case-study title */
.cs-tags { color: #A3B0FF !important; font-size: 15px !important; font-weight: 600 !important; letter-spacing: 0.01em; margin: -8px 0 28px !important; }
