/* Upperfloor Consulting · case study pages
   Layout idea: each case climbs like the building. Cover opens like lift doors, then
   G (where they were), 01 (what we built), 02 (the work), 03 (the result), then the next door. */

.case-hero { display: grid; gap: 20px; padding-bottom: 40px; }
.case-hero .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.case-hero .meta .when { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-left: 6px; }
.case-hero .back { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); text-decoration: none; justify-self: start; }
.case-hero .back:hover { color: var(--blue); }

/* Cover: the lift doors part to show the work */
.cover { position: relative; overflow: hidden; border-radius: var(--radius); aspect-ratio: 16 / 9; background: var(--surface); }
.cover > img, .cover > video, .cover > .stage { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover > img, .cover > .stage { transform: scale(1.06); transition: transform 1.6s cubic-bezier(.2, .8, .2, 1) .35s; }
.cover::before, .cover::after { content: ""; position: absolute; top: 0; bottom: 0; width: 50.5%; z-index: 2; background: var(--blue);
  transition: transform 1.1s cubic-bezier(.7, 0, .2, 1) .25s; }
.cover::before { left: 0; box-shadow: inset -1px 0 0 rgba(255, 255, 255, .25); }
.cover::after { right: 0; }
.cover.open::before { transform: translateX(-101%); }
.cover.open::after { transform: translateX(101%); }
.cover.open > img, .cover.open > .stage { transform: none; }
.cover .floor-tag { position: absolute; z-index: 3; left: 18px; bottom: 16px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: #fff; background: rgba(4, 50, 92, .55); backdrop-filter: blur(6px); padding: 6px 10px; border-radius: 999px; opacity: 0; transition: opacity .6s 1.2s; }
.cover.open .floor-tag { opacity: 1; }

/* Floors of the story */
.storey { display: grid; gap: 28px; padding: var(--section-sm) 0; border-top: 1px solid var(--hair); }
.storey:first-of-type { border-top: 0; }
.storey .split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-cols); align-items: start; }
.storey .split p { color: var(--muted); font-size: 17px; max-width: 56ch; }
.storey .split p + p { margin-top: 14px; }

/* What we built: one row per service line */
.built { list-style: none; display: grid; }
.built li { display: grid; grid-template-columns: 220px 1fr; gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--hair); }
.built li:first-child { border-top: 1px solid var(--hair); }
.built a { font-family: var(--font-display); font-weight: 500; font-size: 18px; color: var(--blue); text-decoration: none; }
.built a:hover { text-decoration: underline; text-decoration-color: var(--gold-ink); text-underline-offset: 5px; }
.built .k { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; color: var(--gold-ink); margin-bottom: 4px; }
.built p { color: var(--muted); max-width: 62ch; }

/* The work: a gallery that climbs */
.gallery { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.tile { position: relative; grid-column: span 6; margin: 0; display: grid; gap: 10px; align-content: start; }
.tile.w12 { grid-column: span 12; } .tile.w8 { grid-column: span 8; } .tile.w7 { grid-column: span 7; } .tile.w5 { grid-column: span 5; }
.tile.w4 { grid-column: span 4; } .tile.w3 { grid-column: span 3; }
.tile .frame { position: relative; overflow: hidden; border-radius: var(--radius-sm); background: var(--surface); }
.tile .frame > img, .tile .frame > video { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile .frame.contain > img { object-fit: contain; padding: 6%; }
.tile figcaption { font-size: 13px; color: var(--muted); }
.tile figcaption b { font-weight: 500; color: var(--ink); }
.r-1 { aspect-ratio: 1; } .r-43 { aspect-ratio: 4 / 3; } .r-34 { aspect-ratio: 3 / 4; } .r-169 { aspect-ratio: 16 / 9; } .r-45 { aspect-ratio: 4 / 5; } .r-32 { aspect-ratio: 3 / 2; }

/* Device frames */
.browser { border-radius: var(--radius-sm); overflow: hidden; background: #fff; box-shadow: var(--soft); }
.browser .bar { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--hair); }
.browser .bar i { width: 8px; height: 8px; border-radius: 50%; background: #D3DAE2; }
.browser .bar span { margin-left: 10px; font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); letter-spacing: .04em; }
.browser img { display: block; width: 100%; }
.phone { width: 100%; max-width: 300px; justify-self: center; border-radius: 34px; padding: 10px; background: #0B1B2B; box-shadow: 0 18px 40px -18px rgba(4, 50, 92, .5); }
.phone > img, .phone > video { display: block; width: 100%; border-radius: 26px; aspect-ratio: 9 / 19.5; object-fit: cover; object-position: top; background: #000; }
.phone.reel > video { aspect-ratio: 9 / 16; }
.duo { display: grid; grid-template-columns: 1fr 260px; gap: 24px; align-items: end; }

/* Brand swatches, built in the browser */
.swatches { display: grid; grid-template-columns: repeat(var(--n, 6), 1fr); gap: 10px; }
.swatch { border-radius: var(--radius-sm); min-height: 180px; padding: 14px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; transform-origin: bottom; }
.swatch b { font-family: var(--font-body); font-weight: 500; font-size: 14px; letter-spacing: 0; }
.swatches.grow .swatch { transform: scaleY(.15); opacity: 0; transition: transform .8s cubic-bezier(.2, .8, .2, 1), opacity .5s; transition-delay: calc(var(--i) * 90ms); }
.swatches.grow.in .swatch { transform: none; opacity: 1; }
.gradients { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gradients div { height: 88px; border-radius: var(--radius-sm); padding: 12px; color: #fff; font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; display: flex; align-items: flex-end; }

/* Flipbook: drafts turn over as you scroll, landing on the final mark */
.flipbook { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); background: #fff; box-shadow: var(--soft); overflow: hidden; }
.flipbook img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 10%; opacity: 0; transition: opacity .25s; }
.flipbook img.on { opacity: 1; }
.flipbook .count { position: absolute; left: 14px; bottom: 12px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; color: var(--muted); }
.flip-track { height: 190vh; position: relative; }
.flip-track .sticky { position: sticky; top: 96px; display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-cols); align-items: center; }
.flip-track .sticky p { color: var(--muted); max-width: 44ch; }
.flip-steps { list-style: none; display: grid; gap: 10px; margin-top: 18px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #9AA7B4; }
.flip-steps li.on { color: var(--gold-ink); }

/* Platform to product: a line that draws itself */
.lineage { border-radius: var(--radius); background: var(--blue); color: #fff; padding: 40px; display: grid; gap: 18px; }
.lineage .slab { color: var(--gold); }
.lineage svg { width: 100%; height: auto; display: block; overflow: visible; }
.lineage .path { fill: none; stroke: var(--gold); stroke-width: 2; stroke-dasharray: var(--len, 900); stroke-dashoffset: var(--len, 900); transition: stroke-dashoffset 2.2s cubic-bezier(.6, 0, .2, 1); }
.lineage .node { opacity: 0; transform: translateY(8px); transition: opacity .6s, transform .6s; transform-box: fill-box; }
.lineage.in .path { stroke-dashoffset: 0; }
.lineage.in .node { opacity: 1; transform: none; }
.lineage.in .n1 { transition-delay: .1s; } .lineage.in .n2 { transition-delay: 1.1s; } .lineage.in .n3 { transition-delay: 2s; }
.lineage p { color: #D4E2F0; max-width: 60ch; }

/* Result: the top floor of each story */
.result { display: grid; gap: 22px; }
.result .statement { font-family: var(--font-display); font-weight: 500; font-size: clamp(26px, 3vw, 40px); line-height: 1.2; letter-spacing: -.02em; color: var(--blue); max-width: 30ch; text-wrap: balance; }
.result .statement em { font-style: normal; background: linear-gradient(transparent 62%, rgba(246, 220, 148, .8) 62%); background-size: 0 100%; background-repeat: no-repeat; transition: background-size 1.2s cubic-bezier(.2, .8, .2, 1) .3s; }
.result.in .statement em, .result.static .statement em { background-size: 100% 100%; }
.result .credit { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.result .live { justify-self: start; }

/* Next door */
.next-door { display: grid; grid-template-columns: 1fr 340px; gap: var(--gap-cols); align-items: center; padding: 40px 0 0; border-top: 1px solid var(--hair); text-decoration: none; }
.next-door .slab { margin-bottom: 14px; }
.next-door h2 { transition: color .3s; }
.next-door p { color: var(--muted); margin-top: 8px; }
.next-door .thumb { border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 3 / 2; position: relative; }
.next-door .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.2, .8, .2, 1); }
.next-door .thumb::before, .next-door .thumb::after { content: ""; position: absolute; top: 0; bottom: 0; width: 50%; background: var(--blue); z-index: 1; transition: transform .7s cubic-bezier(.7, 0, .2, 1); }
.next-door .thumb::before { left: 0; transform: translateX(-100%); } .next-door .thumb::after { right: 0; transform: translateX(100%); }
.next-door:hover .thumb::before, .next-door:focus-visible .thumb::before { transform: translateX(-12%); }
.next-door:hover .thumb::after, .next-door:focus-visible .thumb::after { transform: translateX(12%); }
.next-door:hover .thumb img { transform: scale(1.04); }
.next-door .go { font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-ink); margin-top: 18px; display: inline-block; }

.pending { display: grid; gap: 6px; padding: 18px 20px; border-radius: var(--radius-sm); border: 1px dashed var(--line); color: var(--muted); font-size: 14px; }
.pending b { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 400; color: #8D9AA8; }

@media (max-width: 900px) {
  .cover { aspect-ratio: 4 / 3; }
  .storey .split, .flip-track .sticky, .next-door, .duo { grid-template-columns: 1fr; }
  .built li { grid-template-columns: 1fr; gap: 6px; }
  .gallery { grid-template-columns: 1fr 1fr; gap: 12px; }
  .tile, .tile.w8, .tile.w7, .tile.w5, .tile.w4, .tile.w12 { grid-column: span 2; }
  .tile.w3, .tile.half { grid-column: span 1; }
  .swatches { grid-template-columns: repeat(3, 1fr); }
  .swatch { min-height: 110px; }
  .gradients { grid-template-columns: 1fr; }
  .flip-track { height: auto; }
  .flip-track .sticky { position: static; }
  .lineage { padding: 26px 22px; }
  .phone { max-width: 260px; }
}
@media (prefers-reduced-motion: reduce) {
  .cover::before, .cover::after { display: none; }
  .cover > img, .cover > .stage { transform: none; transition: none; }
  .cover .floor-tag { opacity: 1; transition: none; }
  .swatches.grow .swatch { transform: none; opacity: 1; transition: none; }
  .lineage .path { stroke-dashoffset: 0; transition: none; }
  .lineage .node { opacity: 1; transform: none; transition: none; }
  .result .statement em { background-size: 100% 100%; transition: none; }
  .flip-track { height: auto; }
  .flip-track .sticky { position: static; }
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
