/* Work (mosaic) - an alternative layout for the Work page, same site language: dark hero with a lime-emphasis headline, then an edge-to-edge
   mosaic of project tiles in different sizes (project name + tags rise in on hover), then the shared CTA + footer. */
.work2-page { background: var(--c-ink); color: #fff; }

.m-hero { position: relative; padding: 180px 0 96px; text-align: center; background: var(--c-ink); overflow: hidden; }
.m-hero::before { content: ""; position: absolute; left: 50%; top: -136px; width: 70vw; height: calc(100% + 136px); transform: translateX(-50%); pointer-events: none;
  /* the glow ends exactly on the hero's edges (alpha 0 at the bottom), so there is never a hard cut above the tiles */
  background: radial-gradient(ellipse 50% 38% at 50% 62%, rgb(240 248 121 / .09), transparent 100%); }
.m-eyebrow { position: relative; font-size: 16px; line-height: 24px; text-transform: uppercase; letter-spacing: .12em; color: #b2b2b2; }
.m-title { position: relative; width: min(1034px, 92%); margin: -5px auto 0; font-family: var(--f-body); font-weight: 400; font-size: 56px; line-height: 92px; color: #fff; }
.m-title em { font-style: normal; font-family: var(--f-display); font-weight: 600; font-size: 64px; line-height: 1; color: var(--c-lime); display: inline-block; animation: m-focus 1.7s .25s var(--ease-out) both; }
@keyframes m-focus { from { filter: blur(14px); opacity: .15; transform: translateY(10px); } to { filter: blur(0); opacity: 1; transform: none; } }
.m-lead { position: relative; width: min(620px, 90%); margin: 16px auto 0; font-size: 18px; line-height: 28px; color: var(--c-paper-2); opacity: .9; }

/* mosaic: 12 columns, tiles placed by hand so the sizes mix like a collage; 10px gutters, edge to edge */
.m-mosaic { display: grid; grid-template-columns: 377.33fr 413.34fr 377.33fr; grid-auto-rows: calc((100vw - 120px) / 12 * .86); gap: 16px; padding: 0 16px 80px; background: var(--c-ink); }
.m-tile { position: relative; display: block; overflow: hidden; border-radius: 16px; background-color: #2a2626; background-size: cover; background-position: center; opacity: 0; transform: translateY(40px); transition: opacity .9s ease, transform 1.1s var(--ease-out); }
.m-tile.is-in { opacity: 1; transform: none; }
.m-tile::before { content: ""; position: absolute; inset: 0; background: inherit; transition: transform 1s var(--ease-out), filter .8s var(--ease-out); }
.m-tile:hover::before { transform: scale(1.06); filter: blur(25px); }
.m-tile::after { content: ""; position: absolute; inset: auto 0 0 0; height: 75%; background: linear-gradient(to bottom, rgb(33 29 29 / 0) 4%, rgb(33 29 29 / .35) 33%, rgb(33 29 29 / .88));  opacity: 0; transition: opacity .5s ease; pointer-events: none; }
.m-tile:hover::after, .m-tile:focus-visible::after { opacity: 1; }
.m-tile:focus-visible { outline: 2px solid var(--c-lime); outline-offset: -2px; }
.m-tile__info { position: absolute; z-index: 1; left: 32px; right: 32px; bottom: 32px; display: flex; flex-direction: column; gap: 8px; opacity: 0; transform: translateY(16px); transition: opacity .45s ease, transform .6s var(--ease-out); }
.m-tile:hover .m-tile__info, .m-tile:focus-visible .m-tile__info { opacity: 1; transform: none; }
.m-tile__info strong { font-family: var(--f-display); font-weight: 600; font-size: 32px; line-height: 32px; color: var(--c-lime); }
.m-tile__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.m-tile__tags span { display: inline-flex; align-items: center; height: 24px; padding: 0 12px; border: .5px solid rgb(239 239 235 / .6); border-radius: 12px; font-size: 12px; line-height: 16px; letter-spacing: .1em; text-transform: uppercase; color: var(--c-paper-2); }

/* placement: two (big + small), one, one, two (small + big), one, one, ... */
.m-tile--1  { grid-column: 1 / 3; grid-row: 1 / 6; }
.m-tile--2  { grid-column: 3 / 4; grid-row: 1 / 6; }
.m-tile--3  { grid-column: 1 / 4; grid-row: 6 / 10; }
.m-tile--4  { grid-column: 1 / 4; grid-row: 10 / 14; }
.m-tile--5  { grid-column: 1 / 2; grid-row: 14 / 19; }
.m-tile--6  { grid-column: 2 / 4; grid-row: 14 / 19; }
.m-tile--7  { grid-column: 1 / 4; grid-row: 19 / 23; }
.m-tile--8  { grid-column: 1 / 4; grid-row: 23 / 27; }
.m-tile--9  { grid-column: 1 / 3; grid-row: 27 / 32; }
.m-tile--10 { grid-column: 3 / 4; grid-row: 27 / 32; }
.m-tile--11 { grid-column: 1 / 4; grid-row: 32 / 36; }
.m-tile--12 { grid-column: 1 / 4; grid-row: 36 / 40; }
.m-tile--13 { grid-column: 1 / 2; grid-row: 40 / 45; }
.m-tile--14 { grid-column: 2 / 4; grid-row: 40 / 45; }

/* the mosaic sits right above the CTA: give it a little breathing room */
.work2-page .cta-section { margin-top: 0; }

@media (hover: none) { .m-tile:hover::before { filter: none; } .m-tile--video:hover .m-tile__video { filter: none; } }
@media (max-width: 991px) {
  .m-hero { padding: 150px 0 64px; }
  .m-title { font-size: 44px; line-height: 56px; margin-top: 12px; }
  .m-title em { font-size: 1.14em; }
  .m-mosaic, .m-mosaic.is-filtered { grid-template-columns: repeat(2, 1fr); grid-auto-rows: auto; gap: 8px; padding: 0 8px 8px; }
  .m-tile { border-radius: 10px; }
  .m-tile { grid-column: auto !important; grid-row: auto !important; aspect-ratio: 4 / 5; }
  .m-tile:nth-child(3n + 1) { grid-column: 1 / -1 !important; aspect-ratio: 16 / 10; }
  .m-tile__info { opacity: 1; transform: none; left: 14px; right: 14px; bottom: 12px; }
  .m-tile::after { opacity: 1; height: 50%; }
  .m-tile__info strong { font-size: 22px; line-height: 26px; }
}
@media (max-width: 640px) {
  .m-title { font-size: 36px; line-height: 46px; }
  .m-lead { font-size: 16px; line-height: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .m-title em { animation: none; }
  .m-tile { opacity: 1; transform: none; transition: none; }
}

/* filters: pills under the hero text; a filtered mosaic re-flows into an even grid of larger tiles */
.m-filters { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: min(760px, 92%); margin: 0 auto; }
.m-filter { position: relative; overflow: hidden; isolation: isolate; display: inline-flex; align-items: center; height: 37px; padding: 10px 12px; border: .5px solid rgb(239 239 235 / .5); border-radius: 33px; font-size: 14px; line-height: 16px; text-transform: uppercase; color: var(--c-paper-2); transition: color .45s var(--ease-out) .05s, border-color .3s ease, transform .4s var(--ease-out); }
.m-filter.is-active { border-color: var(--c-lime); color: var(--c-lime); }
/* same circular-fill hover as the site's outline buttons: a lime circle rises from below, the label turns dark */
.m-filter::before { content: ""; position: absolute; z-index: -1; left: 50%; top: 100%; width: 150%; aspect-ratio: 1; border-radius: 50%; background: var(--c-lime); transform: translate(-50%, -50%) scale(0); transition: transform .7s var(--ease-out); }
.m-filter:hover, .m-filter:focus-visible { border-color: var(--c-lime); color: var(--c-ink); }
.m-filter:hover::before, .m-filter:focus-visible::before { transform: translate(-50%, -50%) scale(1.15); }
.m-filter:active { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) { .m-filter, .m-filter::before { transition-duration: .01ms; } }
.m-filter:focus-visible { outline: 2px solid var(--c-lime); outline-offset: 3px; }
.m-tile[hidden] { display: none; }
.m-tile.is-out { opacity: 0 !important; transform: scale(.97) !important; }
.m-mosaic.is-filtered { grid-auto-flow: dense; align-content: start; min-height: 60vh; }
.m-mosaic.is-filtered { grid-template-columns: repeat(3, 1fr); grid-auto-rows: calc((80vw - 32px) / 3 * .87); }
.m-mosaic.is-filtered .m-tile { grid-column: span 1 !important; grid-row: span 1 !important; }
@media (max-width: 991px) { .m-mosaic.is-filtered .m-tile { grid-column: auto !important; grid-row: auto !important; } }

/* every row fills the screen (full width, full height); the next row rises in as you scroll */
@media (min-width: 992px) {
  .m-mosaic:not(.is-filtered) { grid-auto-rows: calc(80vw * .555); }   /* Figma: 666px rows on a 1200px mosaic */
  .m-mosaic:not(.is-filtered) .m-tile--1 { grid-row: 1; }
  .m-mosaic:not(.is-filtered) .m-tile--2 { grid-row: 1; }
  .m-mosaic:not(.is-filtered) .m-tile--3 { grid-row: 2; }
  .m-mosaic:not(.is-filtered) .m-tile--4 { grid-row: 3; }
  .m-mosaic:not(.is-filtered) .m-tile--5 { grid-row: 4; }
  .m-mosaic:not(.is-filtered) .m-tile--6 { grid-row: 4; }
  .m-mosaic:not(.is-filtered) .m-tile--7 { grid-row: 5; }
  .m-mosaic:not(.is-filtered) .m-tile--8 { grid-row: 6; }
  .m-mosaic:not(.is-filtered) .m-tile--9 { grid-row: 7; }
  .m-mosaic:not(.is-filtered) .m-tile--10 { grid-row: 7; }
  .m-mosaic:not(.is-filtered) .m-tile--11 { grid-row: 8; }
  .m-mosaic:not(.is-filtered) .m-tile--12 { grid-row: 9; }
  .m-mosaic:not(.is-filtered) .m-tile--13 { grid-row: 10; }
  .m-mosaic:not(.is-filtered) .m-tile--14 { grid-row: 10; }
  .m-mosaic:not(.is-filtered) .m-tile { transform: translateY(120px) scale(.96); transition: opacity 1s ease, transform 1.3s var(--ease-out); }
  .m-mosaic:not(.is-filtered) .m-tile.is-in { transform: none; }
}

@media (min-width: 992px) { .m-mosaic { width: 80%; margin: 0 auto; padding: 0 0 140px; } }  /* same width as the navbar */

/* hover teaser: one line of story + a call to open the case study */
.m-tile__teaser { max-width: 520px; font-size: 16px; line-height: 26px; color: var(--c-paper-2); }
.m-tile__go { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; letter-spacing: .02em; color: var(--c-lime); }
.m-tile__go i { font-style: normal; transition: transform .4s var(--ease-out); }
.m-tile:hover .m-tile__go i { transform: translateX(6px); }
.m-tile__info { gap: 12px; }
@media (max-width: 991px) { .m-tile__teaser { display: none; } .m-tile__go { display: none; } }

/* video tiles: the clip fills the tile exactly like the old background image */
.m-tile--video::before { display: none; }          /* no background image to zoom */
.m-tile__video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  border-radius: inherit;                          /* keeps the 6px corners */
  pointer-events: none;                            /* clicks still go to the link */
  transition: transform 1s var(--ease-out), filter .8s var(--ease-out);
}
.m-tile--video:hover .m-tile__video { transform: scale(1.06); filter: blur(25px); }   /* same zoom as the image tiles */
@media (prefers-reduced-motion: reduce) { .m-tile--video .m-tile__video { transition: none; } }

/* filter bar: a dark pill docked at the bottom of the screen the whole time; it slips away when the mosaic ends (js/results.js toggles .is-hidden) */
.m-filters.is-floating { position: fixed; z-index: 60; left: 50%; bottom: 38px; width: auto; max-width: calc(100vw - 24px); margin: 0; padding: 6px; flex-wrap: nowrap; gap: 4px; overflow-x: auto; scrollbar-width: none; border: .5px solid rgb(239 239 235 / .18); border-radius: 999px; background: rgb(33 29 29 / .82); -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2); box-shadow: 0 18px 48px rgb(0 0 0 / .45); transform: translateX(-50%); transition: opacity .35s ease, transform .5s var(--ease-out); animation: m-dock .5s var(--ease-out); }
.m-filters.is-floating.is-hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(24px); }
.m-filters.is-floating::-webkit-scrollbar { display: none; }
.m-filters.is-floating .m-filter { flex: none; height: 40px; padding: 10px 18px; border-color: transparent; }
.m-filters.is-floating .m-filter.is-active { background: var(--c-lime); border-color: var(--c-lime); color: var(--c-ink); }
@keyframes m-dock { from { opacity: 0; transform: translateX(-50%) translateY(24px); } to { opacity: 1; transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .m-filters.is-floating { animation: none; } }
/* phones: the docked pill always fits the screen (three equal-ish segments, nothing cut or scrolling), clears the home indicator, and keeps a comfortable 42px tap height */
@media (max-width: 575px) {
  .m-filters.is-floating { width: calc(100vw - 24px); max-width: 380px; padding: 5px; gap: 3px; justify-content: stretch; overflow: hidden; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .m-filters.is-floating .m-filter { flex: 1 1 auto; justify-content: center; height: 42px; padding: 0 clamp(8px, 3vw, 16px); font-size: clamp(11.5px, 3.5vw, 13.5px); letter-spacing: .03em; white-space: nowrap; }
}


/* desktop hover: the name, teaser and tags sit vertically in the middle of the tile, on the left (scrim covers the whole tile so the text stays readable) */
@media (min-width: 992px) {
  .m-tile::after { inset: 0; height: auto; background: linear-gradient(to bottom, rgb(33 29 29 / .5), rgb(33 29 29 / .72)); }
  .m-tile__info { left: 32px; right: 32px; top: 50%; bottom: auto; align-items: flex-start; text-align: left; transform: translateY(calc(-50% + 16px)); }
  .m-tile:hover .m-tile__info, .m-tile:focus-visible .m-tile__info { transform: translateY(-50%); }
}

/* slideshow tile: three images cross-fade one after the other (12s loop); the hover zoom + blur applies to the whole stack */
.m-tile--slides::before { display: none; }
.m-tile__slides { position: absolute; inset: 0; transition: transform 1s var(--ease-out), filter .8s var(--ease-out); }
.m-tile--slides:hover .m-tile__slides { transform: scale(1.06); filter: blur(25px); }
.m-tile__slide { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; animation: m-slide 12s infinite; }
.m-tile__slide:nth-child(2) { animation-delay: 4s; }
.m-tile__slide:nth-child(3) { animation-delay: 8s; }
@keyframes m-slide { 0% { opacity: 0; } 6% { opacity: 1; } 33% { opacity: 1; } 39%, 100% { opacity: 0; } }
/* five-image variant (Caravel): same 4s per image, so a 20s loop */
.m-tile__slides--5 .m-tile__slide { animation: m-slide-5 20s infinite; }
.m-tile__slides--5 .m-tile__slide:nth-child(2) { animation-delay: 4s; }
.m-tile__slides--5 .m-tile__slide:nth-child(3) { animation-delay: 8s; }
.m-tile__slides--5 .m-tile__slide:nth-child(4) { animation-delay: 12s; }
.m-tile__slides--5 .m-tile__slide:nth-child(5) { animation-delay: 16s; }
@keyframes m-slide-5 { 0% { opacity: 0; } 3.6% { opacity: 1; } 20% { opacity: 1; } 23.6%, 100% { opacity: 0; } }
@media (hover: none) { .m-tile--slides:hover .m-tile__slides { filter: none; } }
@media (prefers-reduced-motion: reduce) { .m-tile__slide { animation: none; } .m-tile__slide:first-child { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .m-tile__slides--5 .m-tile__slide { animation: none; } }
/* six-image variant (Caravel): same 4s per image, so a 24s loop */
.m-tile__slides--6 .m-tile__slide { animation: m-slide-6 24s infinite; }
.m-tile__slides--6 .m-tile__slide:nth-child(2) { animation-delay: 4s; }
.m-tile__slides--6 .m-tile__slide:nth-child(3) { animation-delay: 8s; }
.m-tile__slides--6 .m-tile__slide:nth-child(4) { animation-delay: 12s; }
.m-tile__slides--6 .m-tile__slide:nth-child(5) { animation-delay: 16s; }
.m-tile__slides--6 .m-tile__slide:nth-child(6) { animation-delay: 20s; }
@keyframes m-slide-6 { 0% { opacity: 0; } 3% { opacity: 1; } 16.7% { opacity: 1; } 19.7%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .m-tile__slides--6 .m-tile__slide { animation: none; } }

/* project facts (Industry / Country / Services offered / Engagement) under the teaser, desktop only like the teaser */
.m-tile__facts { display: grid; grid-template-columns: max-content 1fr; column-gap: 16px; row-gap: 6px; max-width: 520px; margin: 4px 0 2px; }
.m-tile__fact { display: contents; }
.m-tile__fact-k { padding-top: 2px; font-size: 11px; line-height: 18px; letter-spacing: .1em; text-transform: uppercase; color: rgb(239 239 235 / .55); }
.m-tile__fact-v { font-size: 14px; line-height: 20px; color: var(--c-paper-2); }
@media (max-width: 991px) { .m-tile__facts { display: none; } }
/* desktop: on tiles with facts, the panel spans the tile; name, teaser and tags sit together in the middle and the facts
   drop to the bottom under a thin rule, with clear air between them */
@media (min-width: 992px) {
  .m-tile__info:has(.m-tile__facts) { top: 32px; bottom: 32px; transform: translateY(16px); }
  .m-tile:hover .m-tile__info:has(.m-tile__facts), .m-tile:focus-visible .m-tile__info:has(.m-tile__facts) { transform: none; }
  .m-tile__info:has(.m-tile__facts) > strong { margin-top: auto; }
  .m-tile__info .m-tile__facts { width: 100%; max-width: 560px; margin: auto 0 0; padding-top: 20px; border-top: .5px solid rgb(239 239 235 / .25); }
}
/* narrow tiles on small desktops (the 1-column tiles at 992-1199px): tighter type and the fact labels stacked over their values,
   so the name, teaser, tags and facts all fit inside the tile */
@media (min-width: 992px) {
  .m-tile:has(.m-tile__facts) { container-type: inline-size; }
  @container (max-width: 300px) {
    .m-tile__info:has(.m-tile__facts) { left: 20px; right: 20px; top: 22px; bottom: 22px; gap: 10px; }
    .m-tile__info:has(.m-tile__facts) > strong { font-size: 22px; line-height: 26px; }
    .m-tile__info:has(.m-tile__facts) .m-tile__teaser { font-size: 13px; line-height: 19px; }
    .m-tile__info .m-tile__facts { grid-template-columns: 1fr; row-gap: 0; padding-top: 12px; }
    .m-tile__info .m-tile__fact-k { padding-top: 0; font-size: 10px; line-height: 14px; }
    .m-tile__info .m-tile__fact + .m-tile__fact .m-tile__fact-k { padding-top: 8px; }
    .m-tile__info .m-tile__fact-v { font-size: 12.5px; line-height: 17px; }
  }
}
