/* ── Bucket cards & Level 2 Collapse → Flowchart view ── */

.grid {
  transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.32s ease;
  transform-origin: center top;
}
.grid--collapsed {
  opacity: 0;
  transform: scale(0.94) translateY(-12px);
  pointer-events: none;
  position: absolute;
  inset: 0;
  height: 0;
  overflow: hidden;
}

/* ── Bucket Card (Level 1) ── */
.bucket-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  overflow: hidden;
  background: var(--color-surface-card-white);
  border: 1px solid var(--color-border-card);
  text-align: left;
  user-select: none;
}

.bucket-card--hero {
  padding: 20px 22px;
  background: var(--color-surface-card-dark);
  color: #ffffff;
}

/* Orange accent styling for Agentic Systems bucket card (like mchiu.co.uk AgenticDSCard) */
.bucket-card--agentic {
  background:
    radial-gradient(120% 95% at 88% 12%, rgba(244, 122, 58, 0.24) 0%, rgba(232, 84, 42, 0.05) 58%, transparent 100%),
    var(--color-surface-card-white);
  border-color: rgba(232, 84, 42, 0.28);
}
html[data-theme="dark"] .bucket-card--agentic {
  background:
    radial-gradient(120% 95% at 88% 12%, rgba(255, 122, 69, 0.28) 0%, rgba(232, 84, 42, 0.06) 60%, transparent 100%),
    var(--color-surface-card-white);
  border-color: rgba(255, 122, 69, 0.32);
}
.bucket-card--agentic .bucket-chip {
  background: rgba(232, 84, 42, 0.12);
  border-color: rgba(232, 84, 42, 0.28);
  color: var(--color-primary);
}

/* ── Subtle mchiu.co.uk-style ambient motion in top half of each bucket card ── */
.b-art {
  position: relative;
  z-index: 2;
  width: 100%;
  pointer-events: none;
}
.b-art--visual {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(14, 14, 24, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-width: 86%;
}
.b-tl-row {
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: center;
  gap: 10px;
}
.b-tl-tag {
  font-family: var(--font-family-mono);
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.78);
  letter-spacing: 0.04em;
}
.b-tl-track {
  position: relative;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.b-tl-bar {
  display: block;
  height: 100%;
  border-radius: 99px;
}
.b-tl-bar--1 {
  width: 68%;
  background: linear-gradient(90deg, #ff7a45, #ffb067);
  animation: b-tl-slide 4.2s ease-in-out infinite alternate;
}
.b-tl-bar--2 {
  width: 52%;
  margin-left: 16%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  animation: b-tl-slide 3.6s ease-in-out 0.6s infinite alternate;
}
.b-tl-bar--3 {
  width: 74%;
  margin-left: 8%;
  background: linear-gradient(90deg, #34d399, #10b981);
  animation: b-tl-slide 4.8s ease-in-out 1.1s infinite alternate;
}
.b-tl-playhead {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: #ffffff;
  box-shadow: 0 0 8px #ffffff;
  animation: b-playhead 3.8s linear infinite;
}
@keyframes b-tl-slide {
  0%   { transform: translateX(-6%); }
  100% { transform: translateX(10%); }
}
@keyframes b-playhead {
  0%   { left: 6%; }
  100% { left: 92%; }
}

.b-art--agentic {
  height: 46px;
  display: flex;
  align-items: center;
}
.b-ag-svg {
  width: 224px;
  height: 50px;
  overflow: visible;
}
.b-ag-edge {
  stroke: rgba(232, 84, 42, 0.45);
  stroke-width: 1.6;
  stroke-dasharray: 4 3;
}
.b-ag-node {
  fill: var(--color-surface-card);
  stroke: rgba(232, 84, 42, 0.35);
  stroke-width: 1.4;
}
.b-ag-node--core {
  fill: #e8542a;
  stroke: #e8542a;
}
.b-ag-txt {
  font-family: var(--font-family-mono);
  font-size: 9.5px;
  font-weight: 700;
  fill: var(--color-text-primary);
}
.b-ag-txt--core {
  fill: #ffffff;
}
.b-ag-pulse {
  fill: #e8542a;
  filter: drop-shadow(0 0 6px rgba(232, 84, 42, 0.8));
  animation: b-ag-travel 2.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes b-ag-travel {
  0%   { transform: translate(0, 0); opacity: 0; }
  15%  { opacity: 1; }
  50%  { transform: translate(83px, 0); opacity: 1; }
  85%  { transform: translate(186px, -19px); opacity: 1; }
  100% { transform: translate(186px, -19px); opacity: 0; }
}

.b-art--products {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
}
.b-pr-win {
  width: 126px;
  padding: 9px 11px;
  border-radius: 12px;
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-card);
  box-shadow: 0 8px 20px -8px var(--color-shadow-card-hover);
  animation: b-pr-float 3.6s ease-in-out infinite;
}
@keyframes b-pr-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}
.b-pr-dots {
  display: flex;
  gap: 4px;
  margin-bottom: 7px;
}
.b-pr-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-muted);
}
.b-pr-dots i:first-child { background: #ff5f56; }
.b-pr-dots i:nth-child(2) { background: #ffbd2e; }
.b-pr-dots i:nth-child(3) { background: #27c93f; }
.b-pr-lines {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.b-pr-l1, .b-pr-l2 {
  display: block;
  height: 5px;
  border-radius: 99px;
  background: var(--color-surface-skeleton-2);
}
.b-pr-l1 { width: 82%; }
.b-pr-l2 {
  width: 56%;
  background: var(--gradient-brand);
  animation: b-pr-type 2.6s ease-in-out infinite alternate;
}
@keyframes b-pr-type {
  0%   { width: 38%; }
  100% { width: 74%; }
}
.b-pr-pill {
  font-family: var(--font-family-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-card);
  color: var(--color-text-subtle);
}

.bucket-bg-vid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
  pointer-events: none;
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}
.bucket-card:hover .bucket-bg-vid {
  transform: scale(1.04);
  opacity: 0.56;
}
.bucket-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 10, 14, 0.25) 0%, rgba(10, 10, 14, 0.82) 100%);
  pointer-events: none;
}

.bucket-top,
.bucket-body {
  position: relative;
  z-index: 2;
}

.bucket-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bucket-num {
  font-family: var(--font-family-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-ultra);
  text-transform: uppercase;
  color: var(--color-primary);
}
.bucket-card--hero .bucket-num {
  color: #ff8c5a;
}

.bucket-arrow {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 16px;
  background: var(--color-surface-action-icon);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-card);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), background 0.25s ease, color 0.25s ease;
}
.bucket-card--hero .bucket-arrow {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
}
.bucket-card:hover .bucket-arrow {
  transform: translate(2px, -2px);
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}

.bucket-title {
  margin: 2px 0 0;
  font-family: var(--font-family-primary);
  font-size: clamp(1.12rem, 1.5vw, 1.38rem);
  font-weight: var(--weight-bold);
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.bucket-card--hero .bucket-title {
  font-size: clamp(1.5rem, 2.35vw, 2.05rem);
  color: #ffffff;
}

.bucket-sub {
  margin: 5px 0 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--color-text-subtle);
  max-width: 40ch;
}
.bucket-card--hero .bucket-sub {
  margin-top: 8px;
  font-size: var(--text-base);
  color: rgba(255, 255, 255, 0.78);
}

.bucket-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}
.bucket-chip {
  font-size: 10.5px;
  font-weight: var(--weight-semibold);
  padding: 3px 8.5px;
  border-radius: 999px;
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-card);
  color: var(--color-text-primary);
  white-space: nowrap;
}
.bucket-card--hero .bucket-chip {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  backdrop-filter: blur(6px);
}

/* ── Social Strip (Gmail · LinkedIn · Instagram · GitHub full animated cards in Row 1) ── */
.social-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  height: 100%;
}
.social-strip > .bento-card {
  width: 100%;
  height: 100%;
}
.social-strip .gm-svg { width: 58px; height: 46px; }
.social-strip .li-svg { width: 62px; height: 62px; }
.social-strip .ig-svg { width: 62px; height: 62px; }
.social-strip .gh-svg { width: 62px; height: 62px; }

/* ── Instagram animated card (matches LinkedIn hover tile bloom) ── */
.instagram-card {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ig-tile {
  transform-origin: 18px 18px;
  transform: scale(0);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}
.ig-frame,
.ig-lens {
  stroke: url(#ig-grad);
  transition: stroke 0.25s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: 18px 18px;
}
.ig-dot {
  fill: url(#ig-grad);
  transition: fill 0.25s ease;
  animation: ig-pulse 2.6s ease-in-out infinite;
}
@keyframes ig-pulse {
  0%, 70%, 100% { opacity: 1; }
  85% { opacity: 0.35; }
}
.ig-ring {
  fill: none;
  stroke: url(#ig-grad);
  stroke-width: 1.2;
  opacity: 0;
  transform-origin: 18px 18px;
  animation: ig-ping 3.2s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}
@keyframes ig-ping {
  0%   { transform: scale(0.7); opacity: 0; }
  20%  { opacity: 0.55; }
  65%  { transform: scale(1.45); opacity: 0; }
  100% { transform: scale(1.45); opacity: 0; }
}
.instagram-card.is-hovered .ig-ring { animation: none; opacity: 0; }
.instagram-card.is-hovered .ig-tile {
  transform: scale(1);
  opacity: 1;
}
.instagram-card.is-hovered .ig-frame,
.instagram-card.is-hovered .ig-lens {
  stroke: #ffffff;
}
.instagram-card.is-hovered .ig-lens {
  transform: scale(1.08);
}
.instagram-card.is-hovered .ig-dot {
  fill: #ffffff;
  animation: none;
}

/* ── Level 2: Flowchart Stage (fits cleanly in 1 viewport!) ── */
.flow-stage {
  width: 100%;
  max-width: 1020px;
  margin: 0 auto;
  padding: 0 0 16px;
  animation: flowIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes flowIn {
  from { opacity: 0; transform: scale(0.96) translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.flow-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.flow-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--color-border-card);
  background: var(--color-surface-card-white);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, background 0.2s ease;
}
.flow-back:hover {
  border-color: var(--color-primary);
  transform: translateX(-2px);
}

.flow-switchers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.flow-sw {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-border-card);
  background: transparent;
  color: var(--color-text-subtle);
  font-family: var(--font-family-system);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.flow-sw:hover {
  color: var(--color-text-primary);
  border-color: var(--color-text-subtle);
}
.flow-sw--active {
  background: var(--color-text-primary);
  color: var(--color-surface-card-white);
  border-color: var(--color-text-primary);
}

.flow-intro {
  text-align: center;
  margin-bottom: 14px;
}
.flow-kicker {
  font-family: var(--font-family-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-primary);
}
.flow-title {
  margin: 4px 0 4px;
  font-family: var(--font-family-primary);
  font-size: clamp(1.55rem, 2.8vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
  color: var(--color-text-primary);
}
.flow-desc {
  margin: 0 auto;
  font-size: 14px;
  color: var(--color-text-subtle);
  max-width: 54ch;
}

.flow-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.flow-io {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--color-surface-card-white);
  border: 1px solid var(--color-border-card);
  box-shadow: 0 6px 20px -10px var(--color-shadow-card-hover);
}
.flow-io--out {
  background: var(--color-text-primary);
  color: var(--color-surface-card-white);
  border-color: var(--color-text-primary);
}
.flow-io-lbl {
  font-family: var(--font-family-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--color-primary);
}
.flow-io--out .flow-io-lbl {
  color: #ff9a5a;
}
.flow-io-val {
  font-size: 13px;
  font-weight: 600;
}

.flow-svg {
  width: 100%;
  height: 44px;
  display: block;
  overflow: visible;
}
.flow-path {
  stroke: var(--color-text-muted);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  transition: stroke 0.25s ease, stroke-width 0.25s ease;
}
.flow-path--hot {
  stroke: var(--color-primary);
  stroke-width: 3;
}
.flow-arrow-head {
  fill: var(--color-text-muted);
  transition: fill 0.25s ease;
}
.flow-arrow-head--hot {
  fill: var(--color-primary);
}

.flow-nodes {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.flow-nodes--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.flow-stage--agentic .flow-kicker,
.flow-stage--agentic .flow-node-idx,
.flow-stage--agentic .flow-node-cta {
  color: #e8542a;
}
.flow-stage--agentic .flow-node:hover,
.flow-stage--agentic .flow-node--hot {
  border-color: #e8542a;
}

.flow-node {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 18px 18px 16px;
  border-radius: 22px;
  background: var(--color-surface-card-white);
  border: 1.5px solid var(--color-border-card);
  color: var(--color-text-primary);
  cursor: pointer;
  box-shadow: 0 2px 10px var(--color-shadow-card-rest);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s ease, box-shadow 0.35s ease;
}
.flow-node:hover,
.flow-node--hot {
  transform: translateY(-4px);
  border-color: var(--color-primary);
  box-shadow: 0 18px 36px -16px var(--color-shadow-card-expanded);
}
.flow-node:active {
  transform: scale(0.98);
}

.flow-node-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.flow-node-idx {
  font-family: var(--font-family-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary);
}
.flow-node-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--color-surface-card);
  color: var(--color-text-subtle);
}

.flow-node-name {
  margin: 0;
  font-family: var(--font-family-primary);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.flow-node-desc {
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--color-text-subtle);
}

.flow-node-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}
.flow-node-chip {
  font-size: 10.5px;
  font-weight: 500;
  padding: 3px 7px;
  border-radius: 7px;
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-card);
  color: var(--color-text-primary);
}

.flow-node-cta {
  margin-top: auto;
  padding-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary);
}

/* ── Single-color, center-aligned Case Study Flow (matches mchiu.co.uk) ── */
.cs-single-flow {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--color-bg-body);
  color: var(--color-text-primary);
}
.cs-band {
  width: 100%;
  padding: 44px 24px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: transparent;
  color: var(--color-text-primary);
}
.cs-band + .cs-band {
  border-top: 1px solid var(--color-border-card);
}
.cs-band--hero {
  border-top: none;
  padding-top: 76px;
  padding-bottom: 36px;
}

/* Center-align case study typography & readbar */
.cs-single-flow .cs-body {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.cs-single-flow .cs-readbar {
  margin: 0 auto 24px;
}
.cs-single-flow .cs-kicker,
.cs-single-flow .cs-section-kicker {
  margin-left: auto;
  margin-right: auto;
  margin-top: 0;
}
.cs-single-flow .cs-section-title {
  margin: 8px 0 14px;
}
.cs-single-flow .cs-body-text {
  max-width: 60ch;
  margin-left: auto;
  margin-right: auto;
}
.cs-single-flow .cs-cta-row {
  justify-content: center;
}
.cs-single-flow .cs-stat-row {
  width: 100%;
  text-align: center;
}
.cs-single-flow .cs-stat-item {
  padding-right: 16px;
  padding-left: 16px;
}
.cs-single-flow .cs-body-list,
.cs-single-flow .cs-stages {
  text-align: left;
  width: 100%;
}

/* OWNDAYS Brand Accent Theme for Kiasu (#c8102e crimson) */
.cs-theme--owndays {
  --color-primary: #c8102e;
  --gradient-brand: linear-gradient(135deg, #e11d48 0%, #c8102e 100%);
}
.cs-theme--owndays .fc .pk {
  fill: #c8102e;
}
.cs-theme--owndays .fc .n.hot:hover rect,
.cs-theme--owndays .fc .n.hot:hover polygon {
  stroke: #c8102e;
}

/* ── True-ratio showcase media layouts ── */
.cs-media--landscape-pair {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 20px !important;
  max-width: 1120px !important;
  width: 100%;
  padding: 0 24px;
}
.cs-media--landscape-pair .cs-media-item {
  width: 100% !important;
  max-width: none !important;
}
.cs-media--portrait-row {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 18px !important;
  max-width: 960px !important;
  width: 100%;
  padding: 0 24px;
}
.cs-media--portrait-row .cs-media-item {
  width: 100% !important;
  max-width: none !important;
}
@media (max-width: 820px) {
  .cs-media--landscape-pair,
  .cs-media--portrait-row { grid-template-columns: 1fr !important; }
}

/* ── Exact Presentation Interactive SVG Wiring (.fc) — Transparent / Gradient Container ── */
.cs-wide {
  width: 100%;
  max-width: 1140px;
  padding: 0 24px;
  margin-top: 20px;
}
.fc-hint {
  font-family: var(--font-family-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-bottom: 10px;
  text-align: center;
}
.fcw {
  border: 1px solid var(--color-border-card);
  border-radius: 24px;
  padding: 20px 22px;
  background: linear-gradient(180deg, rgba(232, 84, 42, 0.06) 0%, rgba(128, 128, 128, 0.03) 100%);
  box-shadow: inset 0 1px 0 var(--color-card-inset-top);
  overflow-x: auto;
}
.cs-theme--owndays .fcw {
  background: linear-gradient(180deg, rgba(200, 16, 46, 0.07) 0%, rgba(128, 128, 128, 0.03) 100%);
}
.fc { display: block; width: 100%; height: auto; max-height: 460px; min-width: 720px; }
.fc text { font-family: var(--font-family-system); }
.fc .n rect, .fc .n polygon { fill: var(--color-surface-card-white); stroke: var(--color-text-primary); stroke-width: 1.4; }
.fc .n .t { font-size: 14.5px; font-weight: 800; fill: var(--color-text-primary); }
.fc .n .s { font-size: 11.8px; font-weight: 500; fill: var(--color-text-subtle); }
.fc .n.dark rect { fill: #12131a; stroke: #2c2e3b; }
.fc .n.dark .t { fill: #ffffff; }
.fc .n.dark .s { fill: #bdbdbd; }
.fc .n.soft rect { fill: var(--color-surface-card); stroke: var(--color-border-card); }
.fc .n.next rect { fill: transparent; stroke: var(--color-text-subtle); stroke-dasharray: 6 5; }
.fc .n.next .t { fill: var(--color-text-subtle); }
.fc .n.dia polygon { fill: var(--color-surface-card-white); stroke-width: 1.8; }
.fc .n.dia .t { font-size: 13.5px; }
.fc .tagn { font-size: 9.5px; font-weight: 800; letter-spacing: 0.12em; fill: var(--color-text-subtle); }
.fc .e { fill: none; stroke: var(--color-text-primary); stroke-width: 1.3; opacity: 0.65; }
.fc .e.next { stroke: var(--color-text-subtle); stroke-dasharray: 5 5; opacity: 1; }
.fc .e.loop { stroke-dasharray: 2 4; opacity: 1; }
.fc .arh { fill: var(--color-text-primary); }
.fc .arhn { fill: var(--color-text-subtle); }
.fc .pk { fill: #e8542a; }
.fc .lb rect { fill: var(--color-surface-card-white); stroke: var(--color-border-card); }
.fc .lb text { font-size: 11px; font-weight: 700; fill: var(--color-text-primary); }
.fc .n.hot { cursor: help; outline: none; }
.fc .n.hot rect, .fc .n.hot polygon { transition: stroke-width 0.18s ease, stroke 0.18s ease, filter 0.18s ease; }
.fc .n.hot:hover rect, .fc .n.hot:hover polygon {
  stroke: #e8542a;
  stroke-width: 2.5;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.18));
}

.fc-tip {
  position: fixed;
  z-index: 950;
  max-width: 320px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #0d0e14;
  color: #ffffff;
  font-family: var(--font-family-system);
  font-size: 12.5px;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-shadow: 0 14px 36px -10px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.fc-tip--on { opacity: 1; transform: none; }
.fc-tip b {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ff8c5a;
  margin-bottom: 3px;
  background: none;
  -webkit-text-fill-color: #ff8c5a;
}

/* ── Video player controls on every case study video (Restart ↺ · Sound 🔇/🔊 · Fullscreen ⛶) ── */
.cs-vid-wrap {
  position: relative;
  width: 100%;
}
.cs-vid-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: 0.88;
  transition: opacity 0.2s ease;
}
.cs-vid-wrap:hover .cs-vid-controls {
  opacity: 1;
}
.cs-vid-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(10, 10, 14, 0.72);
  color: #ffffff;
  font-family: var(--font-family-system);
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, color 0.2s ease;
}
.cs-vid-btn:hover {
  background: #0a0a0e;
  transform: scale(1.08);
}
.cs-snd-btn--on {
  background: #ffffff;
  color: #0a0a0e;
  border-color: #ffffff;
}

/* ── CaseStudyEnd (exact mchiu.co.uk bottom navigation: Next case study + Back + Get in touch) ── */
.cse {
  width: 100%;
  max-width: var(--cs-column);
  padding: 0 24px;
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cse-next,
.cse-home,
.cse-contact {
  border-radius: 24px;
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-card);
  box-shadow:
    0 1px 3px var(--color-shadow-card-rest),
    inset 0 1px 0 var(--color-card-inset-top),
    inset 0 -1px 0 var(--color-card-inset-bottom);
  color: var(--color-text-primary);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.25s ease,
    background 0.5s ease,
    border-color 0.3s ease;
}
.cse-next:hover,
.cse-home:hover,
.cse-contact:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 32px var(--color-shadow-card-hover),
    inset 0 1px 0 var(--color-card-inset-top);
}
.cse-next:active,
.cse-home:active,
.cse-contact:active {
  transform: scale(0.985);
}
.cse-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px;
  text-align: left;
}
.cse-next__text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.cse-next__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-ultra);
  text-transform: uppercase;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  width: fit-content;
}
.cse-next__title {
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  color: var(--color-text-primary);
}
.cse-next__arrow {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 100px;
  background: var(--color-surface-card-white);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-primary);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease, color 0.2s ease;
}
.cse-next:hover .cse-next__arrow {
  transform: translateX(3px);
  color: var(--color-primary);
}
.cse-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
}
.cse-home,
.cse-contact {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  border-radius: 100px;
  font-size: var(--action-size);
  font-weight: var(--action-weight);
  line-height: 1;
}
.cse-home {
  width: 52px;
  height: 52px;
  padding: 0;
  justify-content: center;
}
.cse-home svg {
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cse-home:hover svg {
  transform: translateX(-3px);
}
.cse-contact {
  justify-content: space-between;
  min-width: 0;
}
.cse-contact__email {
  margin-left: auto;
  font-weight: var(--weight-regular);
  opacity: 0.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cse-contact__icon {
  flex-shrink: 0;
  display: inline-flex;
  opacity: 0.55;
  transition: opacity 0.2s ease, color 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cse-contact:hover .cse-contact__icon { opacity: 1; }
.cse-contact--copied .cse-contact__tick {
  opacity: 1;
  color: var(--color-primary);
  transform: scale(1.1);
}
@media (max-width: 560px) {
  .cse-next { padding: 20px 22px; }
  .cse-next__title { font-size: var(--text-3xl); }
  .cse-row { grid-template-columns: 1fr; }
  .cse-home { justify-content: center; }
}

/* Problem cards row inside case studies */
.cs-problems {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}
.cs-prob {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--color-border-card);
  background: var(--color-surface-card-white);
}
.cs-band--dark .cs-prob {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}
.cs-prob-num {
  display: block;
  font-family: var(--font-family-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 6px;
}
.cs-prob p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--color-text-subtle);
}
.cs-band--dark .cs-prob p {
  color: rgba(242, 242, 246, 0.78);
}

@media (max-width: 768px) {
  .cs-problems { grid-template-columns: 1fr; }
}
.flow-node:hover .flow-node-cta span {
  transform: translateX(3px);
}
.flow-node-cta span {
  transition: transform 0.25s ease;
}

/* ── Track record inside About panel ── */
.about-track {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.about-track-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--color-border-card);
  background: var(--color-surface-card);
  color: var(--color-text-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.about-track-row:hover {
  border-color: var(--color-primary);
  transform: translateX(2px);
}
.about-track-row strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
}
.about-track-row small {
  display: block;
  font-size: 12px;
  color: var(--color-text-subtle);
}
.about-track-stat {
  font-family: var(--font-family-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
}

/* ── Headless CaseStudyOverlay container (for flowchart zoom-ins) ── */
.cs-headless-portal {
  position: fixed;
  width: 0;
  height: 0;
  overflow: visible;
  z-index: 900;
}

@media (max-width: 768px) {
  .flow-nodes {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .flow-svg {
    height: 36px;
  }
  .bucket-card {
    padding: 20px;
  }
}

html.still .flow-stage { animation: none; }
html.still .grid { transition: none; }
html.still .cs-reveal { opacity: 1 !important; transform: none !important; }

@media (prefers-reduced-motion: reduce) {
  .flow-stage { animation: none; }
  .grid { transition: none; }
}
