:root {
  --case-ink: #302b44;
  --case-muted: #685f80;
  --case-line: rgba(110, 94, 248, 0.14);
  --case-line-strong: rgba(110, 94, 248, 0.22);
  --case-accent: #3c2a4c;
  --case-accent-2: #7b79f6;
  --case-accent-3: #a9caff;
  --case-pink: #efd9ef;
  --case-shadow: 0 30px 80px rgba(70, 52, 114, 0.08);
  --case-shadow-soft: 0 16px 34px rgba(70, 52, 114, 0.07);
}

html { scroll-behavior: smooth; }

body[data-page="case"] {
  color: var(--case-ink);
  background:
    radial-gradient(circle at 0% 0%, rgba(169, 202, 255, 0.38), transparent 28%),
    radial-gradient(circle at 100% 10%, rgba(239, 217, 239, 0.44), transparent 22%),
    linear-gradient(180deg, #fbfbff 0%, #f5f6ff 46%, #fcfbff 100%);
  overflow-x: hidden;
}

body[data-page="case"]::before,
body[data-page="case"]::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(78px);
  opacity: .45;
  pointer-events: none;
}
body[data-page="case"]::before {
  width: 300px;
  height: 300px;
  left: -80px;
  top: 26vh;
  background: rgba(123, 121, 246, 0.18);
}
body[data-page="case"]::after {
  width: 260px;
  height: 260px;
  right: -60px;
  top: 58vh;
  background: rgba(169, 202, 255, 0.22);
}

body[data-page="case"] .section-shell {
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(255,255,255,.82));
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: var(--case-shadow);
  backdrop-filter: blur(18px);
}
body[data-page="case"] .eyebrow,
body[data-page="case"] .text-link { color: var(--case-accent-2); }
body[data-page="case"] p,
body[data-page="case"] li,
body[data-page="case"] .case-footer p,
body[data-page="case"] .section-heading__aside { color: var(--case-muted); }

body[data-page="case"] .button--primary {
  color: #fff;
  background: var(--case-accent);
  border-color: var(--case-accent);
}
body[data-page="case"] .button--primary:hover {
  background: #2e203a;
  border-color: #2e203a;
}
body[data-page="case"] .button--secondary {
  color: var(--case-accent);
  border-color: rgba(60, 42, 76, 0.18);
  background: rgba(255,255,255,.78);
}
body[data-page="case"] .button--secondary:hover {
  background: rgba(123, 121, 246, 0.06);
}

.case-header {
  position: sticky;
  top: 12px;
  z-index: 90;
  width: min(calc(100% - var(--page-gutter) * 2), var(--container));
  margin: 16px auto 0;
  padding: 12px 18px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 18px;
  border: 1px solid rgba(255,255,255,.74);
  border-radius: 26px;
  background: rgba(255,255,255,.78);
  box-shadow: var(--case-shadow-soft);
  backdrop-filter: blur(18px);
  transition: background-color .18s ease, box-shadow .18s ease;
}
.case-header.is-scrolled {
  background: rgba(255,255,255,.9);
  box-shadow: 0 18px 34px rgba(70, 52, 114, 0.1);
}
.case-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}
.case-brand__logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  flex: 0 0 auto;
}
.case-brand__copy { display: grid; gap: 2px; }
.case-brand__copy strong { font-size: 15px; line-height: 1.1; color: var(--case-ink); }
.case-brand__copy span { font-size: 12px; color: var(--case-muted); }
.case-nav {
  justify-self: center;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.case-nav a,
.case-mobile-menu a {
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--case-ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color .18s ease, color .18s ease;
}
.case-nav a:hover,
.case-mobile-menu a:hover { color: var(--case-accent-2); background: rgba(123, 121, 246, 0.07); }
.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(60, 42, 76, 0.14);
  border-radius: 14px;
  background: rgba(255,255,255,.82);
  cursor: pointer;
  place-items: center;
}
.menu-toggle span,
.menu-toggle span::before,
.menu-toggle span::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--case-accent);
  content: "";
  transition: transform .18s ease;
}
.menu-toggle span::before { transform: translateY(-6px); }
.menu-toggle span::after { transform: translateY(4px); }
.case-mobile-menu {
  position: fixed;
  z-index: 120;
  top: 14px;
  right: 14px;
  width: min(360px, calc(100vw - 28px));
  display: grid;
  gap: 6px;
  padding: 22px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 24px;
  background: rgba(255,255,255,.9);
  box-shadow: var(--case-shadow);
  backdrop-filter: blur(18px);
  transform: translateY(-18px) scale(.98);
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
}
.case-mobile-menu.is-open { opacity: 1; visibility: visible; transform: none; }
.case-mobile-menu__close {
  justify-self: end;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(123, 121, 246, 0.08);
  color: var(--case-ink);
  font-size: 28px;
  cursor: pointer;
}

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .72s cubic-bezier(.2,.7,.2,1), transform .72s cubic-bezier(.2,.7,.2,1);
}
.reveal.is-visible { opacity: 1; transform: none; }
.float-card { animation: caseFloat 7s ease-in-out infinite; }
@keyframes caseFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.case-hero {
  position: relative;
  min-height: 740px;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(420px, .98fr);
  gap: 54px;
  align-items: center;
  overflow: hidden;
}
.case-hero::before,
.case-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.case-hero::before {
  width: 430px;
  height: 430px;
  right: -120px;
  top: -120px;
  background: radial-gradient(circle, rgba(169, 202, 255, 0.28), transparent 68%);
}
.case-hero::after {
  width: 280px;
  height: 280px;
  left: -80px;
  bottom: -90px;
  background: radial-gradient(circle, rgba(239, 217, 239, 0.34), transparent 68%);
}
.case-hero__copy,
.case-hero__visual { position: relative; z-index: 1; }
.case-hero h1 {
  max-width: 720px;
  margin-bottom: 18px;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.04em;
  text-transform: none;
}
.case-hero p {
  max-width: 640px;
  margin: 0 0 28px;
  font-size: 21px;
  line-height: 1.6;
}

.overview-strip__items,
.problem-list,
.research-timeline,
.method-steps,
.module-grid,
.tech-stack,
.impact-metrics,
.before-after-columns,
.roadmap,
.stage-grid,
.author-socials {
  display: grid;
  gap: 14px;
}

.overview-strip__items article,
.problem-list article,
.research-timeline article,
.method-steps article,
.module-grid article,
.tech-stack article,
.impact-metrics article,
.before-after-columns article,
.roadmap article,
.stage-card {
  position: relative;
  padding: 20px;
  border: 1px solid var(--case-line);
  border-radius: 22px;
  background: rgba(255,255,255,.78);
  box-shadow: var(--case-shadow-soft);
  backdrop-filter: blur(10px);
}
.impact-metrics strong {
  display: block;
  font-family: var(--font-heading);
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}
.impact-metrics span,
.overview-strip__items span,
.problem-list p,
.research-timeline p,
.method-steps p,
.module-grid p,
.tech-stack p,
.before-after-columns li,
.roadmap p { display: block; margin-top: 8px; color: var(--case-muted); }

.case-hero__visual { min-height: 540px; }
.laptop-mockup {
  position: absolute;
  inset: 20px 6px auto 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: perspective(1300px) rotate(-6deg) rotateY(-18deg);
  transform-origin: center;
}
.laptop-mockup__screen {
  width: min(100%, 560px);
  padding: 18px 18px 20px;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 26px 26px 18px 18px;
  background: linear-gradient(180deg, #55506b 0%, #2b2234 100%);
  box-shadow: 0 34px 90px rgba(70, 52, 114, 0.2);
}
.laptop-mockup__screen img {
  width: 100%;
  height: 332px;
  object-fit: cover;
  object-position: top center;
  border-radius: 12px;
  display: block;
}
.laptop-mockup__base {
  width: min(110%, 610px);
  height: 16px;
  margin-top: -4px;
  border-radius: 0 0 24px 24px;
  background: linear-gradient(180deg, #ece8f2 0%, #cfc7d8 100%);
  box-shadow: 0 18px 30px rgba(70, 52, 114, 0.18);
}
.laptop-mockup__base::after {
  content: "";
  display: block;
  width: 112px;
  height: 6px;
  margin: 0 auto;
  border-radius: 999px;
  background: rgba(63, 52, 73, 0.16);
}
.insight-card {
  position: absolute;
  z-index: 2;
  max-width: 240px;
  padding: 16px 18px;
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 22px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--case-shadow-soft);
  backdrop-filter: blur(16px);
}
.insight-card span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--case-accent-2);
}
.insight-card strong { font-size: 14px; line-height: 1.35; }
.insight-card--top { left: 0; top: 0; }

.overview-strip__items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.overview-strip__items span {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--case-accent-2);
}
.overview-strip__items p { margin: 8px 0 0; }
.section-heading--stack {
  align-items: flex-start;
  flex-direction: column;
  margin-bottom: 34px;
}
.section-heading__aside {
  max-width: 880px;
  margin: 0;
  font-size: 18px;
  line-height: 1.6;
}
.problem-layout,
.method-layout,
.company-card,
.impact-layout,
.universal-section,
.author-layout { display: grid; gap: 24px; }
.problem-layout { grid-template-columns: minmax(260px, 360px) 1fr; align-items: start; }
.chaos-panel {
  min-height: 320px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 12px;
  padding: 22px;
  border: 1px dashed var(--case-line-strong);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.48));
}
.chaos-panel span {
  position: static;
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.8);
  background: rgba(255,255,255,.86);
  box-shadow: var(--case-shadow-soft);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}
.problem-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.problem-list strong,
.module-grid strong { display: block; }
.method-layout { grid-template-columns: 360px 1fr; }
.method-layout__copy { position: sticky; top: 120px; align-self: start; }
.method-layout__copy p,
.company-card__copy p,
.tech-copy p,
.universal-copy p,
.author-copy p,
.final-section p { font-size: 18px; line-height: 1.6; }
.method-formula {
  margin-top: 24px;
  padding: 18px 20px;
  border: 1px solid rgba(123, 121, 246, 0.12);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(123, 121, 246, 0.07), rgba(169, 202, 255, 0.08));
  color: var(--case-ink);
  font-weight: 800;
}
.method-steps article { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; }
.research-timeline { grid-template-columns: repeat(5, 1fr); }
.research-timeline article::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 18px;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(123,121,246,.24), rgba(169,202,255,.26));
}
.research-timeline span,
.method-steps span,
.roadmap span {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--case-accent-2), #94a8ff);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(123, 121, 246, 0.22);
}
.stage-trigger { margin-top: 14px; display: inline-flex; }
.company-card { grid-template-columns: 1.15fr .85fr; align-items: center; }
.company-card__media { display: grid; place-items: center; }
.company-card__media--logo {
  min-height: 360px;
  padding: 24px;
  border-radius: 30px;
  border: 1px solid var(--case-line);
  background: linear-gradient(135deg, rgba(123, 121, 246, 0.04), rgba(169, 202, 255, 0.16));
  box-shadow: var(--case-shadow-soft);
}
.company-card__media img { width: min(100%, 340px); max-height: 280px; object-fit: contain; }
.company-note,
.tech-note,
.stage-inline-note {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(123,121,246,.06), rgba(169,202,255,.12));
  color: var(--case-ink);
  font-weight: 700;
}
.module-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.module-grid--five article:last-child { grid-column: 2 / 3; }
.tech-section { display: grid; gap: 24px; }
.tech-stack { grid-template-columns: repeat(5, 1fr); }
.tech-stack span {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--case-accent-2);
  background: rgba(123, 121, 246, 0.08);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.impact-layout { grid-template-columns: .92fr 1.08fr; }
.impact-metrics { grid-template-columns: repeat(2, 1fr); }
.impact-metrics article { min-height: 170px; display: flex; flex-direction: column; justify-content: space-between; }
.before-after-columns { grid-template-columns: 1fr 1fr; }
.before-after-columns article:last-child {
  background: linear-gradient(180deg, rgba(123, 121, 246, 0.96), rgba(148, 168, 255, 0.92));
  border-color: rgba(123, 121, 246, 0.16);
}
.before-after-columns article:last-child h3,
.before-after-columns article:last-child li { color: #fff; }
.before-after-columns ul { display: grid; gap: 10px; margin: 16px 0 0; padding-left: 18px; }
.universal-section { grid-template-columns: 330px 1fr; align-items: center; }
.universal-chain,
.author-facts,
.stage-pills,
.stage-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.universal-chain span,
.author-facts span,
.stage-pills span {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid rgba(123, 121, 246, 0.12);
  border-radius: 16px;
  background: rgba(255,255,255,.78);
  box-shadow: var(--case-shadow-soft);
  font-weight: 700;
  color: var(--case-ink);
}
.author-layout { grid-template-columns: 230px 1fr; align-items: center; }
.author-photo img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  box-shadow: 0 18px 40px rgba(70, 52, 114, 0.16);
  border: 6px solid rgba(255,255,255,.84);
}
.author-quote {
  margin: 18px 0 0;
  padding: 18px 20px;
  border-left: 4px solid var(--case-accent-2);
  border-radius: 0 18px 18px 0;
  background: linear-gradient(135deg, rgba(123,121,246,.05), rgba(169,202,255,.1));
  color: var(--case-ink);
  font-weight: 700;
}
.author-facts { margin-top: 20px; }
.author-socials {
  grid-template-columns: repeat(4, auto);
  justify-content: start;
  margin-top: 22px;
}
.author-social {
  width: 54px;
  height: 54px;
  display: inline-grid;
  place-items: center;
  border-radius: 18px;
  border: 1px solid rgba(123, 121, 246, 0.14);
  background: rgba(255,255,255,.82);
  box-shadow: var(--case-shadow-soft);
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease;
}
.author-social:hover {
  transform: translateY(-2px);
  background: rgba(123, 121, 246, 0.08);
  border-color: rgba(123, 121, 246, 0.24);
}
.author-social svg { width: 24px; height: 24px; fill: var(--case-accent); }
.roadmap {
  position: relative;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.roadmap::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 18px;
  bottom: 18px;
  width: 2px;
  background: linear-gradient(180deg, rgba(123,121,246,.12), rgba(169,202,255,.18));
  transform: translateX(-50%);
}
.roadmap article { min-height: 220px; isolation: isolate; }
.roadmap article:nth-child(2),
.roadmap article:nth-child(5) { transform: translateY(28px); }
.roadmap article:nth-child(3),
.roadmap article:nth-child(6) { transform: translateY(56px); }
.roadmap article.is-done {
  background: linear-gradient(180deg, rgba(60,42,76,.96), rgba(123,121,246,.9));
  border-color: rgba(123, 121, 246, 0.12);
}
.roadmap article.is-done h3,
.roadmap article.is-done p { color: #fff; }
.roadmap article.is-done span { color: var(--case-accent); background: #fff; box-shadow: none; }
.roadmap--animated article { opacity: 0; animation: roadmapIn .7s ease forwards; }
.roadmap--animated article:nth-child(1){animation-delay:.05s}
.roadmap--animated article:nth-child(2){animation-delay:.15s}
.roadmap--animated article:nth-child(3){animation-delay:.25s}
.roadmap--animated article:nth-child(4){animation-delay:.35s}
.roadmap--animated article:nth-child(5){animation-delay:.45s}
.roadmap--animated article:nth-child(6){animation-delay:.55s}
@keyframes roadmapIn { from{opacity:0;transform:translateY(28px)} to{opacity:1} }
.final-section {
  position: relative;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 15px;
  color: #fff;
  background:
    radial-gradient(circle at 100% 0%, rgba(255,255,255,.18), transparent 35%),
    linear-gradient(135deg, #4b4286 0%, #7c82f2 52%, #a9caff 100%);
  overflow: hidden;
}
.final-section::after {
  content: "";
  position: absolute;
  width: 340px;
  height: 340px;
  right: -120px;
  bottom: -120px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.final-section .eyebrow,
.final-section h2,
.final-section p,
.final-section .final-note,
.final-section .button-row { position: relative; z-index: 1; }
.final-section h2 { 
    color: var(--case-ink); 
    font-size: clamp(28px, 3.3vw, 40px);

}
.final-section .eyebrow,
.final-section p,
.final-note { color: rgba(255,255,255,.92); }
.final-section .button--primary { color: var(--case-accent); background: #fff; border-color: #fff; }
.final-section .button--secondary { color: #fff; background: transparent; border-color: rgba(255,255,255,.78); }
.final-note { margin-top: 28px; font-size: 14px; }
.case-footer { display: flex; justify-content: space-between; gap: 28px; margin-bottom: 28px; }
.case-footer strong { display: block; color: var(--case-ink); }

.stage-modal {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.stage-modal.is-open { opacity: 1; visibility: visible; }
.stage-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(22, 17, 42, 0.54);
  backdrop-filter: blur(6px);
}
.stage-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(249,249,255,.98));
  box-shadow: 0 36px 90px rgba(22, 17, 42, 0.24);
}
.stage-modal__close {
  position: sticky;
  top: 0;
  float: right;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(123,121,246,.08);
  color: var(--case-ink);
  font-size: 30px;
  cursor: pointer;
}
.stage-modal__eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--case-accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.stage-modal__body h3 { margin-bottom: 14px; color: var(--case-ink); }
.stage-modal__body p { max-width: 860px; margin-bottom: 14px; font-size: 17px; }
.stage-modal__body ul { display: grid; gap: 8px; margin: 0; padding-left: 18px; }
.stage-grid { grid-template-columns: repeat(2, 1fr); margin-top: 18px; }
.stage-grid--triple { grid-template-columns: repeat(3, 1fr); }
.stage-card h4 { margin-bottom: 10px; font-size: 18px; color: var(--case-ink); }
.stage-card p,
.stage-card li { font-size: 15px; }
.stage-table {
  display: grid;
  margin-top: 18px;
  border: 1px solid rgba(123,121,246,.12);
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255,255,255,.75);
  box-shadow: var(--case-shadow-soft);
}
.stage-table__row {
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr;
  gap: 18px;
  padding: 16px 18px;
  border-top: 1px solid rgba(123,121,246,.1);
}
.stage-table__row:first-child { border-top: 0; }
.stage-table__row span:first-child { font-weight: 800; color: var(--case-ink); }
.stage-table__row span:last-child { color: var(--case-muted); }
.stage-table__head { background: linear-gradient(135deg, rgba(123,121,246,.07), rgba(169,202,255,.14)); }
.stage-table__head span { color: var(--case-accent); }
.stage-table--compact { margin-top: 18px; }

.stage-links { margin-top: 18px; }

.stage-slider {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid rgba(123,121,246,.12);
  border-radius: 24px;
  background: rgba(255,255,255,.8);
  box-shadow: var(--case-shadow-soft);
}
.stage-slider__viewport {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}
.stage-slider__slides {
  position: relative;
  min-height: 420px;
  overflow: hidden;
}
.stage-slider__slides--code { min-height: 500px; }
.stage-slide { display: none; margin: 0; }
.stage-slide.is-active { display: block; }
.stage-slide img {
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  display: block;
  border-radius: 16px;
  background: #f4f6ff;
  border: 1px solid rgba(123,121,246,.1);
}
.stage-slider__slides--code .stage-slide img {
  background: #11151b;
}
.stage-slide figcaption {
  margin-top: 12px;
  color: var(--case-ink);
  font-weight: 700;
}
.stage-slider__nav {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(123,121,246,.18);
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  color: var(--case-accent);
  font-size: 30px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--case-shadow-soft);
}
.stage-slider__nav:hover { background: rgba(123,121,246,.08); }
.stage-slider__meta {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.stage-slider__counter { color: var(--case-muted); font-weight: 700; }
.stage-slider__dots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.stage-slider__dots button {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(123,121,246,.18);
  cursor: pointer;
}
.stage-slider__dots button.is-active { background: var(--case-accent-2); }

.back-to-top {
  position: fixed;
  z-index: 100;
  right: 24px;
  bottom: 24px;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  background: linear-gradient(135deg, var(--case-accent), #6c63ff);
  box-shadow: 0 12px 30px rgba(70, 52, 114, 0.24);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  cursor: pointer;
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease, background-color .18s ease;
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.back-to-top:hover { background: #2e203a; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal,
  .float-card,
  .roadmap--animated article { opacity: 1; transform: none; transition: none; animation: none; }
}

@media (max-width: 1180px) {
  .case-header { grid-template-columns: auto 1fr auto; }
  .case-nav { display: none; }
  .menu-toggle { display: grid; }
  .case-hero,
  .problem-layout,
  .method-layout,
  .company-card,
  .impact-layout,
  .universal-section,
  .author-layout { grid-template-columns: 1fr; }
  .method-layout__copy { position: static; }
  .research-timeline,
  .module-grid,
  .tech-stack,
  .roadmap,
  .overview-strip__items,
  .problem-list,
  .impact-metrics,
  .before-after-columns,
  .stage-grid,
  .stage-grid--triple { grid-template-columns: repeat(2, 1fr); }
  .case-hero__visual { min-height: 520px; }
  .laptop-mockup { inset: 20px 10px auto 20px; }
  .roadmap::before { display: none; }
}

@media (max-width: 900px) {
  .case-header { grid-template-columns: auto 1fr auto; gap: 12px; padding: 12px 14px; }
  .case-header .header-actions { display: none; }
  .case-hero { min-height: auto; }
  .case-hero p,
  .section-heading__aside,
  .method-layout__copy p,
  .company-card__copy p,
  .tech-copy p,
  .universal-copy p,
  .author-copy p,
  .final-section p,
  .stage-modal__body p { font-size: 16px; }
  .research-timeline,
  .module-grid,
  .tech-stack,
  .roadmap,
  .overview-strip__items,
  .problem-list,
  .impact-metrics,
  .before-after-columns,
  .stage-grid,
  .stage-grid--triple,
  .author-socials { grid-template-columns: 1fr; }
  .laptop-mockup { position: relative; inset: auto; transform: perspective(1200px) rotate(-4deg) rotateY(-12deg); }
  .case-hero__visual { min-height: auto; }
  .insight-card { position: static; max-width: none; margin-top: 14px; }
  .module-grid--five article:last-child { grid-column: auto; }
  .author-photo { display: flex; justify-content: center; }
  .roadmap article:nth-child(n) { transform: none; }
  .case-footer { flex-direction: column; }
  .author-socials { display: flex; flex-wrap: wrap; gap: 12px; }
  .stage-table__row { grid-template-columns: 1fr; gap: 10px; }
  .stage-slider__viewport { grid-template-columns: 1fr; }
  .stage-slider__nav { width: 42px; height: 42px; }
  .stage-slider__viewport .is-prev { order: 2; justify-self: start; }
  .stage-slider__viewport .is-next { order: 3; justify-self: end; margin-top: -54px; }
  .stage-slider__slides { min-height: auto; }
}

@media (max-width: 620px) {
  .case-brand__copy span { display: none; }
  .overview-strip__items,
  .problem-list,
  .research-timeline,
  .method-steps,
  .module-grid,
  .tech-stack,
  .impact-metrics,
  .before-after-columns,
  .roadmap,
  .stage-grid,
  .stage-grid--triple { grid-template-columns: 1fr; }
  .case-hero h1 { font-size: clamp(32px, 8vw, 44px); }
  .laptop-mockup__screen img { height: 220px; }
  .stage-modal__dialog { padding: 22px 18px; }
  .chaos-panel { min-height: auto; }
}

/* === Final patch v5: hero, spacing, final heading, back-to-top === */

.case-brand__logo {
  width: 62px;
  height: 62px;
  object-fit: contain;
}

.hero-laptop-mockup {
  position: absolute;
  inset: 0 70px auto -50px;
  display: grid;
  place-items: center;
  transform: perspective(1500px) rotate(-4deg) rotateY(-9deg);
  transform-origin: center;
}

.hero-laptop-mockup img {
  width: min(160%, 920px);
  max-width: none;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 30px 64px rgba(42, 35, 74, 0.18));
}

.hero-laptop-mockup.float-card {
  animation: heroLaptopFloat 7s ease-in-out infinite;
}

@keyframes heroLaptopFloat {
  0%, 100% {
    transform: perspective(1500px) rotate(-4deg) rotateY(-9deg) translateY(0);
  }
  50% {
    transform: perspective(1500px) rotate(-4deg) rotateY(-9deg) translateY(-10px);
  }
}

.insight-card {
  max-width: 270px;
}

.insight-card--top {
  left: auto;
  top: auto;
  right: 6px;
  bottom: 20px;
}

.laptop-mockup,
.laptop-mockup__screen,
.laptop-mockup__base {
  all: unset;
}

.stage-trigger.button,
body[data-page="case"] .stage-trigger.button {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
}

.stage-modal {
  padding: 24px;
}

.stage-modal__dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: min(88vh, 900px);
  padding: 0;
}

.stage-modal__body {
  overflow: auto;
  max-height: min(88vh, 900px);
  padding: 32px;
  padding-right: 46px;
}

.stage-modal__close {
  position: absolute;
  z-index: 5;
  top: 18px;
  right: 18px;
  float: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  line-height: 1;
  text-align: center;
}

.company-card__media--logo {
  min-height: 420px;
  overflow: hidden;
}

.company-card__media--logo img {
  width: 100%;
  max-width: 620px;
  max-height: 420px;
  border-radius: 22px;
  object-fit: contain;
  display: block;
}

.roadmap-section {
  padding-bottom: calc(var(--section-padding, 46px) + 92px);
}

.roadmap {
  padding-bottom: 92px;
}

/* More breathing room between paragraphs */
.case-hero p,
.section-heading__aside,
.method-layout__copy p,
.company-card__copy p,
.tech-copy p,
.universal-copy p,
.author-copy p,
.final-section p,
.stage-modal__body p,
.overview-strip__items p,
.problem-list p,
.research-timeline p,
.method-steps p,
.module-grid p,
.tech-stack p {
  margin-top: 0;
  margin-bottom: 0;
}

.case-hero p + p,
.section-heading__aside + p,
.method-layout__copy p + p,
.company-card__copy p + p,
.tech-copy p + p,
.universal-copy p + p,
.author-copy p + p,
.final-section p + p,
.stage-modal__body p + p,
.overview-strip__items p + p,
.problem-list p + p,
.research-timeline p + p,
.method-steps p + p,
.module-grid p + p,
.tech-stack p + p {
  margin-top: 14px;
}

.back-to-top {
  width: auto;
  min-width: 58px;
  height: 58px;
  padding: 0 18px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  text-align: center;
}

.back-to-top span {
  display: inline-flex;
  align-items: center;
}

.back-to-top span[aria-hidden="true"] {
  font-size: 22px;
  line-height: 1;
}

@media (max-width: 900px) {
  .case-brand__logo {
    width: 52px;
    height: 52px;
  }

  .case-hero {
    grid-template-columns: 1fr;
  }

  .case-hero__visual {
    display: none;
  }

  .stage-modal {
    padding: 10px;
  }

  .stage-modal__body {
    padding: 24px 18px;
    padding-right: 34px;
  }

  .stage-modal__close {
    top: 12px;
    right: 12px;
  }

  .roadmap,
  .roadmap-section {
    padding-bottom: var(--section-padding, 32px);
  }

  .back-to-top {
    min-width: 52px;
    height: 52px;
    padding: 0 16px;
    font-size: 15px;
  }
}
