.fred-companion[data-reference-overlap] { visibility: hidden; }
.card-variation #how { padding-block: clamp(54px, 7vw, 108px); }
.studio-work {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(24px, 4vw, 64px);
}
.studio-work > section { min-width: 0; color: #fbf9ff; }
.studio-work .reference-header, .studio-work .section-heading { margin-bottom: 14px; }
.studio-work .section-heading { display: block; }
.studio-work h2 {
  margin: 0;
  max-width: 20ch;
  font-size: clamp(34px, 3.5vw, 54px);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -.045em;
  text-wrap: balance;
}
.studio-work .section-heading > p {
  margin: 8px 0 0;
  padding: 0;
  border-radius: 0;
  background: none;
  font-size: 15px;
}
.card-variation #how .studio-work .scene-board {
  --studio-panel-inset: clamp(18px, 2vw, 30px);
  --studio-mark-space: 56px;
  padding-block-start: var(--studio-mark-space) !important;
  backdrop-filter: none;
}
.studio-work .scene-board::after {
  content: '';
  position: absolute;
  inset-block-start: 12px;
  inset-inline-start: calc(var(--studio-panel-inset) - 6px);
  width: 52px;
  height: 39px;
  pointer-events: none;
  background: linear-gradient(148deg, #50446770 15%, #6d557b41 62%, #fff9);
  -webkit-mask: url('assets/flywheel-f-mark.svg') center / contain no-repeat;
  mask: url('assets/flywheel-f-mark.svg') center / contain no-repeat;
}
.reference-journey :is(button, a):focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.reference-portal {
  display: grid;
  max-width: 650px;
  grid-template: 'projects projects' auto 'stages art' auto 'stages note' auto /
    minmax(122px, .31fr) minmax(0, 1fr);
  align-items: start;
  gap: 14px clamp(14px, 2vw, 28px);
}
.reference-projects {
  grid-area: projects;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.reference-journey button, .reference-visit { color: inherit; font: inherit; }
.reference-projects button, .reference-stages button {
  min-height: 44px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.reference-projects button {
  border-radius: 0;
  font-size: 17px;
}
.reference-projects button[aria-pressed='true'] { border-bottom-color: #f6efff; }
.reference-stages {
  grid-area: stages;
  display: grid;
  gap: 3px;
  padding: 5px;
  border: 1px solid #e8ddff42;
  border-left-color: #ebe3ff9c;
  border-radius: 9px;
  background: linear-gradient(135deg, #65548840, #1b1e484d);
  backdrop-filter: blur(9px);
}
.reference-stages button {
  font-size: 14px;
  line-height: 1.2;
  text-align: start;
}
.reference-projects button:hover, .reference-stages button:hover { background: #f0e6ff18; }
.reference-stages button[aria-pressed='true'] { background: #e9e2ff24; border-color: #f0e9ff48; }
.reference-art { grid-area: art; min-width: 0; margin: 0; }
.reference-zoom {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 1202 / 678;
  place-items: center;
  padding: 0;
  overflow: hidden;
  border: 1px solid #e6dcff66;
  border-radius: 12px;
  background: #14153694;
  box-shadow: 0 14px 34px #100e353d;
  cursor: zoom-in;
}
.reference-zoom img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}
.reference-zoom .reference-zoom-mark {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid #fff8;
  border-radius: 50%;
  background: #171631e6;
  color: #fff;
  font-size: 17px;
}
.reference-note {
  grid-area: note;
  min-width: 0;
  padding-top: 11px;
  border-top: 1px solid #f4edff70;
}
.reference-note h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.25;
}
.reference-note p {
  max-width: 34ch;
  margin: 0;
  color: #f6f1ff;
  font-size: 15px;
  line-height: 1.5;
}
.reference-visit:not([hidden]) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 14px;
  text-underline-offset: 4px;
  overflow-wrap: anywhere;
}
.reference-dialog {
  max-width: min(94vw, 1100px);
  max-height: 92vh;
  padding: 8px;
  border: 1px solid #e6dfff80;
  border-radius: 14px;
  background: #22214d;
  color: #fff;
}
.reference-dialog::backdrop { background: #0b0a25c9; backdrop-filter: blur(10px); }
.reference-dialog form { display: flex; justify-content: flex-end; }
.reference-dialog button { min-height: 44px; border: 0; border-radius: 8px; background: #4b407b; cursor: pointer; padding-inline: 14px; }
.reference-dialog img { display: block; max-width: 100%; max-height: 78vh; margin: 8px auto 0; object-fit: contain; }

.reference-board-image { position: relative; display: block; min-width: 0; min-height: 0; }
.reference-zoom .reference-board-image { width: 100%; height: 100%; }
.reference-zoom .reference-board-image[data-board^="mumu-"],
.reference-zoom .reference-board-image[data-board^="mumu-"] img { height: auto; }
.reference-zoom .reference-board-image[data-board="mumu-direction"] {
  /* The direction board is narrower than the fixed preview frame. */
  width: 84.68%;
}
.reference-dialog .reference-board-image { width: fit-content; max-width: 100%; margin: 8px auto 0; }
.reference-dialog .reference-board-image img { margin: 0; }
.reference-board-image[data-board^="mumu-"]::after {
  content: '';
  position: absolute;
  pointer-events: none;
  background: #b69a86 url('assets/muriel-singing-bowl.webp') center top / 100% auto no-repeat;
}
.reference-board-image[data-board="mumu-grid"]::after {
  inset: 33.628% 25.125% 33.628% 50.25%;
}
.reference-board-image[data-board="mumu-direction"]::after {
  inset: 14.77% 2.903% 59.927% 68.387%;
  background-position: center 20%;
}

@media (min-width: 1061px) {
  .studio-work h2 { min-height: 2.08em; }
  .card-variation #how .studio-work .scene-board { padding: var(--studio-mark-space) var(--studio-panel-inset) var(--studio-panel-inset) !important; }
  .card-variation #how .studio-work .fred-side {
    grid-template-areas: 'phone description' 'phone tasks' 'phone portrait';
    grid-template-columns: minmax(105px, .72fr) minmax(0, 1.28fr) !important;
    grid-template-rows: auto auto minmax(0, 1fr);
    align-items: start;
    gap: 10px 18px !important;
  }
  .card-variation #how .studio-work .phone { width: min(100%, 154px) !important; align-self: center; }
  .card-variation #how .studio-work .fred-description h3 { font-size: clamp(24px, 2.15vw, 33px); }
  .card-variation #how .studio-work .fred-description > p { font-size: 14px; }
  .card-variation #how .studio-work .fred-service-portrait {
    width: min(100%, 132px);
    aspect-ratio: 1;
    justify-self: end;
    margin-block-start: -8px;
  }
  .card-variation #how .studio-work #task-detail { font-size: 15px; }
  .card-variation #how .studio-work .recording-note { margin-top: 10px; }
  .studio-work .scene-bottom { justify-content: flex-start; padding-inline-end: 0; gap: 10px; flex-wrap: wrap; }
}
@media (min-width: 1330px) {
  .studio-work h2 { min-height: 0; }
}
@media (max-width: 1060px) {
  .studio-work {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(42px, 8vw, 76px);
  }
  .studio-work .section-heading { margin-bottom: 18px; }
}
@media (max-width: 760px) {
  .card-variation #how .studio-work .fred-service-portrait {
    width: min(100%, 150px);
    margin-block-start: -8px;
  }
}
@media (max-width: 700px) {
  .reference-portal {
    max-width: 510px;
    grid-template: 'projects' 'stages' 'art' 'note' / minmax(0, 1fr);
    gap: 10px;
  }
  .reference-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reference-note { margin-top: 6px; }
}

/* Keep the lens contour in the CSS fallback as its palette and position change. */
.card-variation .world-media .hero-media {
  --pink-tint: calc(var(--pink-progress, 0) * 100%);
  --lens-travel: var(--contour-progress, 0);
}
@supports (color: color-mix(in srgb, blue, pink)) {
  .card-variation .world-media .hero-media {
    --liquid-reflection: radial-gradient(ellipse 58% 46% at 80% 11%, color-mix(in srgb, #8272cc, #bd4b96 var(--pink-tint)), #8272cc33 65%, transparent 96%);
    --liquid-blue: radial-gradient(ellipse 51% 39% at 53% 71%, color-mix(in srgb, #2139a8, #831961 var(--pink-tint)) 16%, color-mix(in srgb, #2139a8d9, #831961d9 var(--pink-tint)) 48%, transparent 100%);
    --liquid-rose: radial-gradient(ellipse 54% 53% at 13% 66%, color-mix(in srgb, #be67a4, #d0328a var(--pink-tint)) 6%, #9f5ba7cf 46%, transparent 100%);
  }
  .card-variation .world-media .hero-media::before {
    background:
      radial-gradient(circle calc(61vw + 9vw * var(--lens-travel)) at calc(102% - 22% * var(--lens-travel)) calc(22% + 19% * var(--lens-travel)), transparent 91%, #af86cd4d 94%, #23256499 97%, #c4a7dfcc 100%, #9c78c94d 101.5%, transparent 103%),
      var(--liquid-reflection), var(--liquid-blue), var(--liquid-rose),
      linear-gradient(136deg, color-mix(in srgb, #2139a8, #a41c6a var(--pink-tint)) 7%, color-mix(in srgb, #8272cc, #ba357f var(--pink-tint)) 39%, color-mix(in srgb, #232564, #511245 var(--pink-tint)) 73%, color-mix(in srgb, #2139a8, #902171 var(--pink-tint)) 100%);
  }
}
.card-variation .world-media .hero-media canvas.hero-atmosphere {
  filter: saturate(calc(2 - var(--pink-progress, 0) * .55)) contrast(calc(1.28 - var(--pink-progress, 0) * .12));
}
.card-variation .world-media .hero-media::after { opacity: calc(1 - var(--pink-progress, 0) * .3); }

@media (prefers-reduced-motion: reduce) {
  .opening-world .world-media { position: sticky; inset: auto; top: 0; height: 100svh; margin-bottom: -100svh; }
  .card-variation .world-media .hero-media { --lens-travel: 0; }
}
