/* --- Variables --- */
:root {
  --color-bg: #FBFCFE;
  --color-surface: #fff;
  --color-text: #414662;
  --color-text-muted: rgba(65, 70, 98, 0.72);
  --color-link: #3C1AE5;
  --color-accent: #3C1AE5;
  --color-accent-hover: #2e15b8;
  --color-border: #e8ecf4;
  /* Accent tints @ 15% for backgrounds / highlights */
  --color-accent-1: rgba(235, 0, 255, 0.15);
  --color-accent-2: rgba(0, 41, 255, 0.15);
  --color-accent-3: rgba(0, 133, 255, 0.15);
  --color-accent-4: rgba(0, 255, 255, 0.15);
  /* Solid accent colors for progress bar gradient (accent 1 → 2) */
  --color-accent-1-solid: #EB00FF;
  --color-accent-2-solid: #0029FF;
  --color-accent-3-solid: #0085FF;
  --color-accent-4-solid: #00ffff;
  --font-title: "DM Serif Text", Georgia, serif;
  --font-subtitle: "DM Mono", ui-monospace, monospace;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 2rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;
  --radius: 8px;
  --radius-lg: 16px;
  --bento-gap: 1.5rem; /* 24px at 16px root, scales with font size */
  --max-width: 72rem;
  /* Typography scale */
  --text-h1: 5em;
  --text-h2: 4.4em;
  --text-h3: 3.5em;
  --text-h4: 2.4em;
  --text-h5: 1.6em;
  --text-h6: 1.2em;
  --text-p: 1em;
}

/* --- Base --- */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  overflow-x: clip;
  margin: 0;
  padding: 0;
}
body {
  margin: 0;
  padding: 0;
  overflow-x: clip;
  max-width: 100%;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}
@supports not (overflow: clip) {
  html,
  body {
    overflow-x: hidden;
  }
}

/* Reading progress bar — fixed at top, gradient accent 1 → 2 */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  z-index: 9999;
  background: var(--color-border);
}
.reading-progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-accent-1-solid), var(--color-accent-2-solid));
  transition: width 0.8s ease-out;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-link); text-decoration: none; }

h1 { font-family: var(--font-title); font-size: var(--text-h1); font-weight: 400; line-height: 0.9em; }
h2 { font-family: var(--font-title); font-size: var(--text-h2); font-weight: 400; line-height: 1em; }
h3 { font-family: var(--font-title); font-size: var(--text-h3); font-weight: 400; line-height: 1em; }
h4 { font-family: var(--font-title); font-size: var(--text-h4); font-weight: 400; line-height: 1.1em; }
h5 { font-family: var(--font-title); font-size: var(--text-h5); font-weight: 400; line-height: 1.1em; }
h6 { font-family: var(--font-title); font-size: var(--text-h6); font-weight: 400; line-height: 1.2em; }
p { font-family: var(--font-sans); font-size: 1em; }

/* --- Section shared --- */
section {
  padding: var(--space-3xl) var(--space-lg);
  max-width: var(--max-width);
  margin: 0 auto;
}

/* Home page: section content animates into view on scroll */
body:not(.page-case-study) main > section:not(.hero) {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
body:not(.page-case-study) main > section:not(.hero).section--in-view {
  opacity: 1;
  transform: translateY(0);
}

.section-title {
  margin: 0 0 var(--space-xl);
}

/* --- Section header (reusable: eyebrow + title) --- */
.section-header {
  width: 90%;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-2xl);
}
.section-header__eyebrow {
  font-family: var(--font-subtitle);
  font-size: 16px;
  font-weight: 400;
  color: var(--color-text-muted);
  margin: 0 0 8px;
  text-align: center;
}
.section-header__title {
  font-family: var(--font-title);
  font-size: var(--text-h3);
  font-weight: 400;
  margin: 0 0 4px;
  text-align: center;
  color: var(--color-text);
}
.section-header__title-line {
  display: block;
}
.section-header__subtitle {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text);
  margin: 0;
  text-align: center;
}
.about__inner .section-header,
.contact__inner .section-header {
  width: 100%;
  max-width: none;
}

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 80px var(--space-lg);
  margin: 0;
  max-width: none;
  background: var(--color-bg);
  overflow: hidden;
}
.hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.hero__content {
  position: relative;
  z-index: 1;
  width: 90%;
  max-width: 1600px;
  margin: 0 auto;
  vertical-align: bottom;
}

@keyframes hero-reveal {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* CTA: opacity only so hover translateY still works */
@keyframes hero-cta-reveal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.hero__title {
  margin: 0 0 40px;
  max-width: 840px;
  width: 100%;
  color: var(--color-text);
  animation: hero-reveal 0.8s ease both;
  animation-delay: 0.15s;
}

@media (max-width: 47.9375rem) {
  .hero__title,
  body.page-case-study .cs-hero__title {
    font-size: clamp(1.85rem, 6.2vw + 0.5rem, 2.65rem);
    line-height: 1.1;
  }
}

.hero__subtitle {
  font-family: var(--font-subtitle);
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-xl);
  letter-spacing: 0.02em;
}
.hero__subtitle-line {
  display: block;
  animation: hero-reveal 0.8s ease both;
}
.hero__subtitle-line:nth-child(1) { animation-delay: 0.45s; }
.hero__subtitle-line:nth-child(2) { animation-delay: 0.6s; }
.hero__subtitle-line:nth-child(3) { animation-delay: 0.75s; }
.hero__cta,
.hero__cta:visited {
  display: inline-block;
  font-weight: 600;
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-link) 20%, transparent);
  padding: 12px 20px;
  border-radius: var(--radius);
  animation: none;
  transition:
    opacity 0.8s ease,
    background-color 0.3s,
    color 0.3s,
    box-shadow 0.3s ease,
    transform 0.3s ease;
}
body:not(.page-case-study) .hero .hero__cta,
body:not(.page-case-study) .hero .hero__cta:visited {
  animation: hero-cta-reveal 0.8s ease both;
  animation-delay: 0.95s;
}
.hero__cta:hover,
.hero__cta:focus-visible {
  background: var(--color-link);
  color: #fff;
  box-shadow: 0 8px 24px rgba(60, 26, 229, 0.12);
  transform: translateY(-4px);
}

@media (prefers-reduced-motion: reduce) {
  .hero__title,
  .hero__subtitle-line,
  body:not(.page-case-study) .hero .hero__cta,
  body:not(.page-case-study) .hero .hero__cta:visited {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
  }
  body:not(.page-case-study) .hero .hero__cta,
  body:not(.page-case-study) .hero .hero__cta:visited {
    opacity: 1;
  }
  .page-case-study .site-footer-actions .hero__cta,
  .page-case-study .site-footer-actions .hero__cta:visited {
    opacity: 1;
    transition-duration: 0.01ms;
  }
}

/* --- Case Studies (dark section, tilted mocks, pill tags) --- */
.case-studies {
  min-height: 100vh;
  max-width: none;
  margin: 0;
  width: 100%;
  background: var(--color-bg);
  padding: var(--space-3xl) var(--space-lg);
}
.case-studies__grid {
  width: 90%;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
  /* Tall viewports: cap row height so cards don’t stretch past ~960px */
  height: min(90vh, 960px);
  display: grid;
  gap: 1.5rem; /* 24px at 16px root, scales with font size */
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
}
@media (min-width: 48rem) {
  .case-studies__grid { grid-template-columns: repeat(3, 1fr); }
}
.case-card {
  display: flex;
  width: 100%;
  min-height: 0; /* allow card to respect grid row height */
}
.case-card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: background-color 0.3s, color 0.3s, box-shadow 0.3s ease, transform 0.3s ease;
}
/* Card 1: accent 1 | Card 2: accent 2 | Card 3: accent 3 */
.case-studies__grid .case-card:nth-child(1) .case-card__link {
  background: var(--color-accent-1);
}
.case-studies__grid .case-card:nth-child(2) .case-card__link {
  background: var(--color-accent-2);
}
.case-studies__grid .case-card:nth-child(3) .case-card__link {
  background: var(--color-accent-3);
}
.case-studies__grid .case-card:nth-child(1) .case-card__link:hover {
  background: rgba(235, 0, 255, 0.8);
  box-shadow: 0 8px 24px rgba(235, 0, 255, 0.12);
  transform: translateY(-4px);
}
.case-studies__grid .case-card:nth-child(2) .case-card__link:hover {
  background: rgba(0, 41, 255, 0.8);
  box-shadow: 0 8px 24px rgba(0, 41, 255, 0.12);
  transform: translateY(-4px);
}
.case-studies__grid .case-card:nth-child(3) .case-card__link:hover {
  background: rgba(0, 133, 255, 0.8);
  box-shadow: 0 8px 24px rgba(0, 133, 255, 0.12);
  transform: translateY(-4px);
}
.case-card__link .case-card__title {
  color: var(--color-text);
  transition: color 0.3s;
}
.case-card__link:hover .case-card__title {
  color: #fff;
}
/* Media area: room for tilted mock */
.case-card__media {
  position: relative;
  width: 100%;
  height: 30%;
  min-height: 0;
  padding: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  flex-shrink: 0;
  overflow: visible;
  vertical-align: bottom;
}
.case-card__mock {
  position: relative;
  width: 100%;
  max-width: 100%;
  /* Card 1: 4:3 (default). Card 2 overridden below to 4:3.34. Card 3 uses .case-card__mock--mobile */
  aspect-ratio: 4 / 3;
  background: var(--color-border);
  border-radius: 8px;
  transform: rotate(-8deg) translateX(15%) translateY(4%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  transition: transform 0.3s ease;
}
/* Card 2 only: 4:3.34 ratio */
.case-studies__grid .case-card:nth-of-type(2) .case-card__mock {
  aspect-ratio: 4 / 3.34;
}
.case-card__link:hover .case-card__mock {
  transform: rotate(-4deg) translateX(15%) translateY(4%);
}
.case-card__mock img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.case-card__mock .placeholder {
  font-family: var(--font-subtitle);
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.case-card__media:has(.case-card__mock img) .case-card__mock .placeholder { display: none; }

/* Project 3: two mobile mocks side by side */
.case-card__mocks {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  height: 100%;
  padding: 0;
}
.case-card__mocks--mobile {
  padding-top: 3.5rem;
}
.case-card__mock--mobile {
  height: 20rem;
  width: auto;
  aspect-ratio: 414 / 896; /* match project-3a / project-3b image ratio */
  flex-shrink: 0;
  transform: rotate(-8deg) translateX(8%) translateY(24%);
}
.case-card__mock--mobile:last-child {
  transform: rotate(4deg) translateX(-5%) translateY(24%);
}
.case-card__link:hover .case-card__mock--mobile {
  transform: rotate(-4deg) translateX(8%) translateY(24%);
}
.case-card__link:hover .case-card__mock--mobile:last-child {
  transform: rotate(2deg) translateX(-5%) translateY(24%);
}

/* Content: title then pill signals */
.case-card__content {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--space-lg);
  padding: var(--space-lg);
  height: 70%;
  min-height: 0;
  box-sizing: content-box;
}

/* Tablet & mobile: hide media, content fills the card */
@media (max-width: 48rem) {
  .case-studies .section-header,
  .case-studies__grid {
    width: 100%;
  }
  .case-studies .section-header__title {
    font-size: clamp(1.65rem, 5vw + 0.85rem, 2.75rem);
  }
  .case-studies .case-card__title {
    font-size: clamp(1.2rem, 3.8vw + 0.65rem, 1.85rem);
  }
  .case-studies__grid {
    height: auto;
    grid-auto-rows: auto;
  }
  .case-studies__grid .case-card {
    min-height: auto;
  }
  .case-studies__grid .case-card__link {
    height: auto;
  }
  .case-studies__grid .case-card__media {
    display: none;
  }
  .case-studies__grid .case-card__content {
    height: auto;
    flex: none;
    min-height: auto;
    justify-content: flex-start;
    overflow: visible;
  }
}

.case-card__title {
  font-family: var(--font-title);
  font-size: 2.5em;
  font-weight: 400;
  line-height: 1.25;
  margin: 0;
  color: var(--color-text);
}
.case-card__signals {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}
.case-card__signal {
  display: inline-block;
  font-family: var(--font-subtitle); /* DM Mono */
  font-size: 16px; /* match section-header__eyebrow */
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.35rem 0.65rem;
  background: rgba(65, 70, 98, 0.1); /* 10% of primary text color */
  color: var(--color-text);
  border-radius: 999px;
  transition: color 0.8s, background-color 0.8s;
}
.case-card__link:hover .case-card__signal {
  color: #fff;
  background: rgba(255, 255, 255, 0.1); /* 10% white */
}
.case-card__signal + .case-card__signal::before { display: none; }

/* --- About (full-width section, content 90% / 1600px) --- */
.about {
  max-width: none;
  width: 100%;
  margin: 0;
  background: var(--color-bg);
}
.about__inner {
  width: 90%;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}
.about__content {
  width: 100%;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}
.about__specialties {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-lg);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-md);
  text-align: center;
}
.about__specialty {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.about__specialty-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 24px;
  position: relative;
  overflow: hidden;
}
/* --- Specialty box decorative patterns (5–10s loops, aria-hidden parents) --- */
.about__specialty-box--accent-1 {
  background: color-mix(in srgb, var(--color-accent-1-solid) 20%, transparent);
}
/* Organised grid: mini squares linked by shared edges */
@property --about-reveal {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}
.about__specialty-box--accent-1::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  --line-1: color-mix(in srgb, var(--color-accent-1-solid) 50%, transparent);
  --line-2: color-mix(in srgb, var(--color-accent-1-solid) 50%, transparent);
  --line-3: color-mix(in srgb, var(--color-accent-1-solid) 50%, transparent);
  background-image:
    linear-gradient(var(--line-1) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-1) 1px, transparent 1px),
    linear-gradient(var(--line-2) 5px, transparent 5px),
    linear-gradient(90deg, var(--line-2) 5px, transparent 5px),
    linear-gradient(var(--line-3) 5px, transparent 5px),
    linear-gradient(90deg, var(--line-3) 5px, transparent 5px);
  background-size:
    28px 28px, 28px 28px,
    56px 56px, 56px 56px,
    84px 84px, 84px 84px;
  background-position: center;
  opacity: 0.95;
  -webkit-mask-image: radial-gradient(
    circle at center,
    #000 0 var(--about-reveal),
    transparent calc(var(--about-reveal) + 1%)
  );
  mask-image: radial-gradient(
    circle at center,
    #000 0 var(--about-reveal),
    transparent calc(var(--about-reveal) + 1%)
  );
  animation: about-pattern-squares-center-out 7.5s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
}
@keyframes about-pattern-squares-center-out {
  0% {
    --about-reveal: 0%;
    opacity: 0.95;
  }
  58% {
    --about-reveal: 115%;
  }
  76% {
    --about-reveal: 140%;
  }
  82% {
    --about-reveal: 140%;
  }
  100% {
    --about-reveal: 0%;
    opacity: 0.95;
  }
}
.about__specialty-box--accent-2 {
  background: color-mix(in srgb, var(--color-accent-2-solid) 20%, transparent);
}
.about__specialty-box--accent-2 {
  isolation: isolate;
}
.about__specialty-box--accent-2::before {
  content: none;
}
.about__burst-particle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--size, 4px);
  height: var(--size, 4px);
  margin-left: calc(var(--size, 4px) * -0.5);
  margin-top: calc(var(--size, 4px) * -0.5);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  background: color-mix(in srgb, var(--color-accent-2-solid) var(--tone, 82%), transparent);
  transform: translate(0, 0) scale(0.24);
  will-change: transform, opacity;
  animation: about-particle-burst var(--dur, 3s) ease-out var(--delay, 0s) infinite;
}
@keyframes about-particle-burst {
  0% {
    transform: translate(0, 0) scale(0.24);
    opacity: 0;
  }
  10% {
    opacity: 0.98;
  }
  100% {
    transform: translate(var(--dx, 0px), var(--dy, 0px)) scale(var(--scale-end, 1));
    opacity: 0;
  }
}
.about__specialty-box--accent-3 {
  background: color-mix(in srgb, var(--color-accent-3-solid) 20%, transparent);
  overflow: hidden;
  z-index: 1;
}
/* Generative AI: symmetric tree drawn branch-by-branch */
.about__tree {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.about__tree-branch {
  stroke: color-mix(in srgb, var(--color-accent-3-solid) 70%, transparent);
  stroke-width: 5;
  stroke-linecap: square;
  stroke-linejoin: miter;
  vector-effect: non-scaling-stroke;
  pathLength: 100;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: about-tree-draw 5.2s cubic-bezier(0.44, 0.04, 0.2, 1) infinite;
}
.about__tree-branch--tier-1 { animation-delay: 0s; }
.about__tree-branch--tier-2 { animation-delay: 0.42s; }
.about__tree-branch--tier-3 { animation-delay: 0.64s; }
.about__tree-branch--tier-4 { animation-delay: 0.86s; }
.about__tree-branch--tier-5 { animation-delay: 1.08s; }
.about__tree-branch--tier-6 { animation-delay: 1.3s; }
.about__tree-branch--tier-7 { animation-delay: 1.52s; }
.about__tree-branch--tier-8 { animation-delay: 1.74s; }
.about__tree-branch--tier-9 { animation-delay: 1.94s; }
.about__tree-branch--twig-left,
.about__tree-branch--twig-right,
.about__tree-branch--twig-center { animation-delay: 2.1s; }
@keyframes about-tree-draw {
  0% {
    stroke-dashoffset: 100;
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  28%,
  82% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 0.12;
  }
}
@media (prefers-reduced-motion: reduce) {
  .about__specialty-box--accent-1::before,
  .about__specialty-box--accent-2::before {
    animation: none;
    opacity: 0.65;
  }
  .about__specialty-box--accent-1::before {
    --about-reveal: 140%;
  }
  .about__specialty-box--accent-2::before {
    opacity: 0;
  }
  .about__burst-particle {
    animation: none;
    opacity: 0;
  }
  .about__tree-branch {
    animation: none !important;
    stroke-dashoffset: 0;
    opacity: 0.85;
  }
}
.about__specialty-title {
  font-family: var(--font-sans);
  font-size: 1.3rem;
  font-weight: 300;
  line-height: 1.35;
  color: var(--color-text);
  margin: 0;
}
/* Tablet & mobile: one column; each specialty is image left, title right */
@media (max-width: 48rem) {
  .about__specialties {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    text-align: left;
  }
  .about__specialty {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: var(--space-md);
  }
  .about__specialty-box {
    flex: 0 0 clamp(4.25rem, 20vw, 6.25rem);
    width: clamp(4.25rem, 20vw, 6.25rem);
  }
  .about__specialty-title {
    flex: 1;
    min-width: 0;
    text-align: left;
  }
}
.about__body { color: var(--color-text); }
.about__body p { font-family: var(--font-sans); font-size: 1.2rem; margin: 0 0 var(--space-sm); }
.about__body p:last-child { margin-bottom: 0; }

/* --- Bento (full-width section, content 90% / 1600px) --- */
.bento {
  max-width: none;
  width: 100%;
  margin: 0;
}
.bento .section-header,
.bento__grid {
  width: 90%;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
}
.bento__grid {
  display: grid;
  gap: var(--bento-gap);
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(8, 1fr);
}
/* Scroll-in: cells start hidden and animate in when grid enters viewport */
.bento__grid .bento__item {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out, background 0.3s ease;
}
/* Delay only for scroll-in (opacity, transform); background always 0 for instant hover */
.bento__grid--in-view .bento__item:nth-child(1) { opacity: 1; transform: translateY(0); transition-delay: 0ms 0ms 0ms; }
.bento__grid--in-view .bento__item:nth-child(2) { opacity: 1; transform: translateY(0); transition-delay: 70ms 70ms 0ms; }
.bento__grid--in-view .bento__item:nth-child(3) { opacity: 1; transform: translateY(0); transition-delay: 140ms 140ms 0ms; }
.bento__grid--in-view .bento__item:nth-child(4) { opacity: 1; transform: translateY(0); transition-delay: 210ms 210ms 0ms; }
.bento__grid--in-view .bento__item:nth-child(5) { opacity: 1; transform: translateY(0); transition-delay: 280ms 280ms 0ms; }
.bento__grid--in-view .bento__item:nth-child(6) { opacity: 1; transform: translateY(0); transition-delay: 350ms 350ms 0ms; }
.bento__grid--in-view .bento__item:nth-child(7) { opacity: 1; transform: translateY(0); transition-delay: 420ms 420ms 0ms; }
.bento__grid--in-view .bento__item:nth-child(8) { opacity: 1; transform: translateY(0); transition-delay: 490ms 490ms 0ms; }
/* Tablet/mobile: 2–4 = tall left, two stacked right; 5–6 = small left stacked, 7 = tall right */
@media (max-width: 47.9375rem) {
  .bento__grid {
    /* 8 rows in 4 pairs: cell 1, group 2-4, group 5-7, cell 8 — each pair min 320px */
    grid-template-rows: repeat(8, minmax(160px, auto));
  }
  .bento__grid .bento__item:nth-child(1) { grid-column: 1 / span 2; grid-row: 1 / span 2; }
  .bento__grid .bento__item:nth-child(2) { grid-column: 1; grid-row: 3 / span 2; }
  .bento__grid .bento__item:nth-child(3) { grid-column: 2; grid-row: 3; }
  .bento__grid .bento__item:nth-child(4) { grid-column: 2; grid-row: 4; }
  .bento__grid .bento__item:nth-child(5) { grid-column: 1; grid-row: 5; }
  .bento__grid .bento__item:nth-child(6) { grid-column: 1; grid-row: 6; }
  .bento__grid .bento__item:nth-child(7) { grid-column: 2; grid-row: 5 / span 2; }
  .bento__grid .bento__item:nth-child(8) { grid-column: 1 / span 2; grid-row: 7 / span 2; }
}
@media (min-width: 48rem) {
  .bento__grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    height: 90vh;
    gap: var(--bento-gap);
  }
  /* Desktop: 6 below 5, 7 next to 5&6, 8 below 2&4 */
  .bento__grid .bento__item:nth-child(1) { grid-column: 1 / span 2; grid-row: 1 / span 2; }
  .bento__grid .bento__item:nth-child(2) { grid-column: 3; grid-row: 1 / span 2; }
  .bento__grid .bento__item:nth-child(3) { grid-column: 4; grid-row: 1; }
  .bento__grid .bento__item:nth-child(4) { grid-column: 4; grid-row: 2; }
  .bento__grid .bento__item:nth-child(5) { grid-column: 1; grid-row: 3; }
  .bento__grid .bento__item:nth-child(6) { grid-column: 1; grid-row: 4; }
  .bento__grid .bento__item:nth-child(7) { grid-column: 2; grid-row: 3 / span 2; }
  .bento__grid .bento__item:nth-child(8) { grid-column: 3 / span 2; grid-row: 3 / span 2; }
}
.bento__item {
  border-radius: var(--radius-lg);
  background: var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.bento__item:nth-child(6n + 1) { background: var(--color-accent-1); }
.bento__item:nth-child(6n + 2) { background: var(--color-accent-2); }
.bento__item:nth-child(6n + 3) { background: var(--color-accent-3); }
.bento__item:nth-child(6n + 4) { background: var(--color-accent-4); }
.bento__item:nth-child(6n + 5) { background: var(--color-accent-1); }
.bento__item:nth-child(6n + 6) { background: var(--color-accent-2); }
/* Bento cells 1–8: explicit accent overrides */
.bento__item:nth-child(1) { background: var(--color-accent-1); }
.bento__item:nth-child(2) { background: var(--color-accent-2); }
.bento__item:nth-child(3) { background: var(--color-accent-4); }
.bento__item:nth-child(4) { background: var(--color-accent-3); }
.bento__item:nth-child(5) { background: var(--color-accent-2); }
.bento__item:nth-child(6) { background: var(--color-accent-1); }
.bento__item:nth-child(7) { background: var(--color-accent-4); }
.bento__item:nth-child(8) { background: var(--color-accent-4); }
/* Hover: pump background to 0.8 opacity, rotate image 2deg — both 0.3s, no delay */
.bento__item:hover {
  cursor: pointer;
  transition: opacity 0.8s ease-out, transform 0.8s ease-out, background 0.3s ease;
  transition-delay: 0;
}
.bento__item:nth-child(1):hover { background: rgba(235, 0, 255, 0.8); }
.bento__item:nth-child(2):hover { background: rgba(0, 41, 255, 0.8); }
.bento__item:nth-child(3):hover { background: rgba(0, 255, 255, 0.8); }
.bento__item:nth-child(4):hover { background: rgba(0, 133, 255, 0.8); }
.bento__item:nth-child(5):hover { background: rgba(0, 41, 255, 0.8); }
.bento__item:nth-child(6):hover { background: rgba(235, 0, 255, 0.8); }
.bento__item:nth-child(7):hover { background: rgba(0, 255, 255, 0.8); }
.bento__item:nth-child(8):hover { background: rgba(0, 133, 255, 0.8); }
.bento__item .placeholder {
  font-size: 0.85rem;
  color: var(--color-text);
}
/* Image inside cell: add <img src="..." alt="..."> and it fills the cell */
.bento__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  box-shadow: 0 8px 24px 0 rgba(77, 74, 236, 0.10);
  display: block;
  transition: transform 0.3s ease;
}
.bento__item:hover img {
  transform: rotate(2deg);
}
.bento__item:has(img) .placeholder { display: none; }

/* Cell 1 (large featured, shot-1): inset, image top-right */
.bento__grid .bento__item:nth-child(1) {
  padding: 5%;
  box-sizing: border-box;
  align-items: flex-start;
  justify-content: flex-end;
}
.bento__grid .bento__item:nth-child(1) img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top right;
  border-radius: 8px;
}

/* Cell 2 (tall, shot-2): image width 90% */
.bento__grid .bento__item:nth-child(2) img {
  width: 90%;
}

/* Cell 3 (shot-3): top & left padding 10% */
.bento__grid .bento__item:nth-child(3) {
  padding: 10% 0 0 10%;
  box-sizing: border-box;
  align-items: flex-start;
  justify-content: flex-start;
}
.bento__grid .bento__item:nth-child(3) img {
  object-fit: cover;
  object-position: top left;
}

/* Cell 4 (shot-4): top & right padding 10%, fill + top-right anchor */
.bento__grid .bento__item:nth-child(4) {
  padding: 10% 10% 0 0;
  box-sizing: border-box;
  align-items: flex-start;
  justify-content: flex-end;
}
.bento__grid .bento__item:nth-child(4) img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top right;
  border-radius: 8px;
}

/* Cell 5 (shot-5): 90% width, top-aligned, 10% inset padding */
.bento__grid .bento__item:nth-child(5) {
  padding: 0;
  box-sizing: border-box;
  align-items: stretch;
  justify-content: center;
}
.bento__grid .bento__item:nth-child(5) img {
  width: 90%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  flex-shrink: 0;
}

/* Cell 6 (shot-6): top & right padding 15% */
.bento__grid .bento__item:nth-child(6) {
  padding: 10% 10% 0 0;
  box-sizing: border-box;
  align-items: flex-start;
  justify-content: center;
}
.bento__grid .bento__item:nth-child(6) img {
  border-radius: 8px;
  object-fit: cover;
  object-position: top center;
}

/* Cell 7 (tall, shot-7): padding top/right/bottom 5%, image center-right */
.bento__grid .bento__item:nth-child(7) {
  padding: 10% 10% 10% 0;
  box-sizing: border-box;
  align-items: center;
  justify-content: flex-end;
}
.bento__grid .bento__item:nth-child(7) img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right center;
}

/* Rotated tile: same as other cells — no tilt, centered, fill cell */
.bento__item--rotated img {
  width: 90%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  transform: none;
}
.bento__item--large.bento__item--rotated {
  background: var(--color-accent-3);
}
.bento__item--large {
  grid-column: span 2;
  grid-row: span 2;
}
/* Featured image placeholder (replace or add more cells later) */
.bento__item--featured {
  background-image: url('https://cdn.dribbble.com/userupload/16603108/file/original-d56d9d29a11f658b1da015356d19f254.jpg?resize=3200x2400&vertical=center');
  background-size: cover;
  background-position: center;
}
.bento__item--featured:has(img) {
  background-image: none;
}
.bento__item--featured .placeholder {
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.bento__item--wide { grid-column: span 2; }
.bento__item--tall { grid-row: span 2; }
@media (min-width: 48rem) {
  .bento__item--large { grid-column: span 2; grid-row: span 2; }
  .bento__item--wide { grid-column: span 2; }
  .bento__item--tall { grid-row: span 2; }
}

/* --- Contact (full-width section, content 90% / 1600px) --- */
.contact {
  max-width: none;
  width: 100%;
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  padding: var(--space-2xl) var(--space-lg);
}
.contact .section-title { color: var(--color-text); }
.contact__text {
  font-family: var(--font-sans);
  font-size: 1em;
  margin: 0 0 var(--space-lg);
  max-width: 32ch;
  color: var(--color-text);
}
.contact__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}
.contact__inner {
  width: 90%;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}
.contact__link,
.contact__link:visited {
  display: inline-block;
  font-weight: 600;
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-link) 20%, transparent);
  padding: 12px 20px;
  border-radius: var(--radius);
  transition:
    background-color 0.3s,
    color 0.3s,
    box-shadow 0.3s ease,
    transform 0.3s ease;
}
.contact__link:hover,
.contact__link:focus-visible {
  background: var(--color-link);
  color: #fff;
  box-shadow: 0 8px 24px rgba(60, 26, 229, 0.12);
  transform: translateY(-4px);
}

/* --- Footer --- */
.site-footer {
  position: relative;
  overflow: visible;
  padding: 60px var(--space-lg);
  margin-block-end: 0;
  color: var(--color-text);
  text-align: center;
  isolation: isolate;
}

/* Layer clips sphere geometry at footer bottom (fixes extra scroll) while
   extending above/sides so the same bleed as before stays visible. */
.site-footer__spheres {
  position: absolute;
  top: -12rem;
  left: 50%;
  right: auto;
  bottom: 0;
  width: min(100vw, calc(1600px + 10rem));
  transform: translateX(-50%);
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

@media (max-width: 64rem) {
  .site-footer__spheres {
    display: none;
  }
}

.site-footer__sphere {
  position: absolute;
  z-index: 0;
  width: var(--footer-sphere-size);
  height: var(--footer-sphere-size);
  background: color-mix(in srgb, var(--footer-sphere-color) 22%, transparent);
  -webkit-mask-image: var(--footer-blob-url);
  mask-image: var(--footer-blob-url);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  will-change: transform;
}

.site-footer__sphere:nth-child(1) {
  --footer-sphere-size: 280px;
  --footer-sphere-color: var(--color-accent-1-solid);
  --footer-blob-url: url("../images/blobs/blob-1.svg");
  top: 8%;
  left: 20%;
  animation: footer-sphere-float-a 11s ease-in-out infinite;
}

.site-footer__sphere:nth-child(2) {
  --footer-sphere-size: 540px;
  --footer-sphere-color: var(--color-accent-2-solid);
  --footer-blob-url: url("../images/blobs/blob-2.svg");
  top: 6%;
  right: -2%;
  animation: footer-sphere-float-b 9.5s ease-in-out infinite;
  animation-delay: -2s;
}

.site-footer__sphere:nth-child(3) {
  --footer-sphere-size: 240px;
  --footer-sphere-color: var(--color-accent-3-solid);
  --footer-blob-url: url("../images/blobs/blob-3.svg");
  bottom: -16%;
  right: 30%;
  z-index: 1;
  animation: footer-sphere-float-c 10s ease-in-out infinite;
  animation-delay: -4s;
}

.site-footer__sphere:nth-child(4) {
  --footer-sphere-size: 480px;
  --footer-sphere-color: var(--color-accent-4-solid);
  --footer-blob-url: url("../images/blobs/blob-4.svg");
  top: 16%;
  left: -4%;
  animation: footer-sphere-float-d 12s ease-in-out infinite;
  animation-delay: -1s;
}

@keyframes footer-sphere-float-a {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(14px, -20px, 0); }
}

@keyframes footer-sphere-float-b {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(-18px, 12px, 0); }
}

@keyframes footer-sphere-float-c {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(10px, 16px, 0); }
}

@keyframes footer-sphere-float-d {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(-12px, -14px, 0); }
}

.site-footer__brand {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.site-footer__tagline {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 300;
  text-align: center;
}

.site-footer__tagline-detail {
  font-family: var(--font-subtitle);
  font-style: italic;
  color: var(--color-accent-1-solid);
  margin-left: 0.35em;
  display: inline-block;
  vertical-align: baseline;
}

.site-footer__tagline-bridge {
  display: inline;
  padding: 0 0.45em;
}

.site-footer__tagline-decision {
  font-family: var(--font-subtitle);
  font-style: italic;
  color: var(--color-accent-2-solid);
  display: inline-block;
  vertical-align: baseline;
}

.site-footer__tagline--animate-ready:not(.site-footer__tagline--in-view) .site-footer__tagline-detail,
.site-footer__tagline--animate-ready:not(.site-footer__tagline--in-view) .site-footer__tagline-decision {
  transform: translateY(10px);
  opacity: 0;
}

.site-footer__tagline--in-view .site-footer__tagline-detail {
  animation: site-footer__tagline-word-rise 1s ease 0s both;
}

.site-footer__tagline--in-view .site-footer__tagline-decision {
  animation: site-footer__tagline-word-rise 1s ease 0.5s both;
}

@keyframes site-footer__tagline-word-rise {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-footer__tagline--animate-ready:not(.site-footer__tagline--in-view) .site-footer__tagline-detail,
  .site-footer__tagline--animate-ready:not(.site-footer__tagline--in-view) .site-footer__tagline-decision {
    transform: none;
    opacity: 1;
  }

  .site-footer__tagline--in-view .site-footer__tagline-detail,
  .site-footer__tagline--in-view .site-footer__tagline-decision {
    animation: none;
  }
}

.site-footer__copyright {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  text-align: center;
}

/* Above footer: case-study “Back to work” CTA — outside <footer> */
.page-case-study .site-footer-actions {
  text-align: center;
  padding: 40px var(--space-lg);
}
.page-case-study .site-footer-actions .hero__cta,
.page-case-study .site-footer-actions .hero__cta:visited {
  opacity: 0;
}
.page-case-study .site-footer-actions.site-footer-actions--in-view .hero__cta,
.page-case-study .site-footer-actions.site-footer-actions--in-view .hero__cta:visited {
  opacity: 1;
}
