/* ==========================================================
   Small interactions: ruler, pixel 8, focus frame, ribbed
   glass, service fan, automation switch and site-wide touches.
   ========================================================== */

/* section */
.mi { max-width: 1440px; margin: 0 auto; padding: 0 var(--gutter) clamp(80px, 9vw, 130px); }
.mi__head { display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: end; margin-top: clamp(26px, 3vw, 40px); }
.mi__head p { max-width: 320px; color: var(--mute); font-size: 15px; line-height: 1.45; }
.mi__grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; margin-top: clamp(26px, 3vw, 44px); }
.mi-card { position: relative; display: flex; flex-direction: column; min-height: 440px; padding: clamp(18px, 2vw, 26px); border-radius: 20px; overflow: hidden; background: #fff; }
.mi-card--4 { grid-column: span 4; }
.mi-card--5 { grid-column: span 5; }
.mi-card--7 { grid-column: span 7; }
.mi-card h3 { font-size: clamp(22px, 2vw, 28px); font-weight: 500; line-height: 1.1; letter-spacing: -0.03em; }
.mi-card p { margin-top: 8px; font-size: 14.5px; line-height: 1.45; color: var(--mute); }
.mi-link { display: inline-flex; align-items: center; align-self: flex-start; min-height: 44px; margin-top: 4px; font-size: 14.5px; font-weight: 500; color: var(--red); }
.mi-link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ruler: ticks swell around the cursor, or follow the scroll */
.mi-ruler { display: flex; justify-content: space-between; align-items: flex-end; height: 56px; touch-action: pan-y; }
.mi-ruler i { flex: 0 0 1px; height: 12px; background: var(--ink); transform-origin: 50% 100%; }
.mi-ruler i:nth-child(10n + 1) { background: var(--red); }

/* pixel 8: paint it */
.mi-px { display: flex; gap: 14px; flex: 1; }
.mi-px__copy { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mi-px__state { margin-top: auto; font-size: 14px; font-weight: 500; line-height: 1.35; }
.mi-px__again { display: none; align-self: flex-start; min-height: 44px; padding: 0; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 500; color: var(--red); cursor: pointer; }
.mi-px.done .mi-px__again { display: block; }
.mi-px__grid { flex: 0 0 min(56%, 250px); align-self: center; display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; touch-action: pan-y; cursor: crosshair; user-select: none; }
.mi-px__grid i { aspect-ratio: 1; border-radius: 22%; background: #efefec; transition: background .8s ease, transform .5s var(--ease); }
.mi-px__grid i.s { background: #d9d9d4; }
.mi-px__grid i.on { background: var(--red); transition-duration: 0s, .15s; transform: scale(.86); }
.mi-px__grid i.lit { background: var(--red); transition-duration: .1s, .5s; }

/* focus frame: the sharp photo only shows inside the frame */
.mi-focus { background: var(--red); color: #fff; --f: 74px; --x: 50%; --y: 40%; touch-action: pan-y; cursor: none; }
.mi-focus img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; pointer-events: none; }
.mi-focus__base { filter: grayscale(1) contrast(1.2) blur(7px); transform: scale(1.06); mix-blend-mode: multiply; }
.mi-focus__sharp { clip-path: inset(calc(var(--y) - var(--f)) calc(100% - var(--x) - var(--f)) calc(100% - var(--y) - var(--f)) calc(var(--x) - var(--f)) round 12px); }
.mi-focus__frame { position: absolute; left: var(--x); top: var(--y); width: calc(var(--f) * 2); height: calc(var(--f) * 2); translate: -50% -50%; border-radius: 12px; box-shadow: inset 0 0 0 1.5px #fff, 0 18px 50px rgba(0,0,0,.35); pointer-events: none; }
.mi-focus__frame::after { content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: #fff; }
.mi-focus__copy { position: relative; margin-top: auto; pointer-events: none; text-shadow: 0 1px 14px rgba(90,6,4,.7); }
.mi-focus__copy p { color: rgba(255,255,255,.88); }
.mi-focus .mi-link { color: #fff; pointer-events: auto; cursor: pointer; }

/* ribbed glass: clears around the cursor */
.mi-glass__view { position: relative; flex: 1; min-height: 250px; margin-bottom: 16px; border-radius: 12px; overflow: hidden; background: #111; touch-action: pan-y; }
.mi-glass__view > span { position: absolute; top: 0; bottom: 0; overflow: hidden; }
.mi-glass__view > span::after { content: ""; position: absolute; inset: 0; opacity: var(--s, 1); background: linear-gradient(90deg, rgba(0,0,0,.26), rgba(255,255,255,.2) 45%, rgba(0,0,0,.08)); }
.mi-glass__view img { position: absolute; top: -8%; height: 116%; max-width: none; object-fit: cover; }

/* service fan */
.mi-fan__area { position: relative; flex: 1; min-height: 300px; margin-top: 14px; --spread: 40%; }
.mi-tile { position: absolute; left: 50%; top: 50%; width: 23%; aspect-ratio: 4 / 5; border-radius: 12px; overflow: hidden; background: #111; box-shadow: 0 16px 34px -14px rgba(0,0,0,.5); translate: -50% -50%; transform: rotate(calc(var(--i) * 3deg)); transition: transform .9s cubic-bezier(.25,1.25,.4,1), translate .35s var(--ease), scale .35s var(--ease); transition-delay: calc((var(--a)) * 45ms), 0s, 0s; }
.mi-fan__area.open .mi-tile { transform: translate(calc(var(--i) * var(--spread)), calc(var(--a) * var(--a) * 3.5%)) rotate(calc(var(--i) * 5deg)); }
.mi-tile:hover, .mi-tile:focus-visible { z-index: 9 !important; translate: -50% calc(-50% - 16px); scale: 1.05; }
.mi-tile:active { scale: 1; }
.mi-tile img { width: 100%; height: 100%; object-fit: cover; }
.mi-tile b { position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 7px 9px; border-radius: 8px; font-size: 12.5px; font-weight: 500; line-height: 1.15; color: #fff; background: rgba(20,20,22,.5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

/* automation switch */
.mi-auto { background: #0b0b0c; color: #fff; }
.mi-auto p { color: rgba(255,255,255,.62); }
.mi-auto__row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 20px; font-size: 15px; font-weight: 500; }
.mi-switch { position: relative; flex: 0 0 auto; width: 70px; height: 44px; border: 0; border-radius: 99px; background: #3a3a3e; cursor: pointer; transition: background .3s; }
.mi-switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 38px; height: 38px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4); transition: translate .45s cubic-bezier(.3,1.5,.5,1), width .2s; }
.mi-switch:active::after { width: 44px; }
.mi-switch[aria-checked="true"] { background: var(--red); }
.mi-switch[aria-checked="true"]::after { translate: 26px 0; }
.mi-switch[aria-checked="true"]:active::after { translate: 20px 0; }
.mi-tasks { list-style: none; margin: auto 0 0; padding: 22px 0 0; }
.mi-tasks li { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px dashed rgba(255,255,255,.2); font-size: 15px; }
.mi-tasks em { position: relative; flex: 0 0 auto; min-width: 74px; font-size: 13px; font-style: normal; text-align: right; color: rgba(255,255,255,.5); }
.mi-tasks em::before { content: "Your team"; transition: opacity .25s; transition-delay: calc(var(--i) * 170ms); }
.mi-tasks em::after { content: "✓ Done"; position: absolute; right: 0; top: 0; white-space: nowrap; color: #ff8a84; opacity: 0; translate: 0 6px; transition: opacity .25s, translate .4s cubic-bezier(.3,1.6,.5,1); transition-delay: calc(var(--i) * 170ms); }
.mi-auto.on .mi-tasks em::before { opacity: 0; }
.mi-auto.on .mi-tasks em::after { opacity: 1; translate: 0 0; }

/* rolling nav links */
.roll { position: relative; display: inline-block; overflow: hidden; vertical-align: top; }
.roll > span { display: block; transition: transform .45s var(--ease); }
.roll::after { content: attr(data-t) / ""; position: absolute; left: 0; top: 100%; white-space: nowrap; transition: transform .45s var(--ease); }
a:hover > .roll > span, a:hover > .roll::after { transform: translateY(-100%); }

/* "View" badge that follows the cursor over project cards */
.mi-view { position: fixed; left: 0; top: 0; z-index: 40; display: grid; place-items: center; width: 92px; height: 92px; margin: -46px; border-radius: 50%; color: #fff; font-size: 15px; font-weight: 500; background: rgba(20,20,22,.72); backdrop-filter: blur(12px) saturate(170%); -webkit-backdrop-filter: blur(12px) saturate(170%); pointer-events: none; opacity: 0; scale: .4; transition: opacity .2s, scale .4s cubic-bezier(.3,1.5,.5,1); }
.mi-view.on { opacity: 1; scale: 1; }
.has-view .scard { cursor: none; }

@media (max-width: 1000px) {
  .mi-card--4, .mi-card--5, .mi-card--7 { grid-column: span 12; }
  .mi-card { min-height: 0; }
  .mi-focus { min-height: 430px; }
  .mi-fan__area { --spread: 34%; min-height: 240px; }
  .mi-tile { width: 27%; }
  .mi-tile b { font-size: 11.5px; padding: 5px 7px; }
  .mi-auto .mi-tasks { margin-top: 0; }
}
@media (max-width: 640px) {
  .mi__head { grid-template-columns: 1fr; }
  .mi-px__copy p { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .mi-tile, .mi-switch::after, .mi-tasks em::before, .mi-tasks em::after, .roll > span, .roll::after, .mi-px__grid i { transition: none; }
  .mi-focus { cursor: auto; }
}
@media (prefers-reduced-transparency: reduce) {
  .mi-tile b, .mi-view { background: #18181a; backdrop-filter: none; -webkit-backdrop-filter: none; }
}
