/* "Our work": each site as a 3D screen with its phone version in front. Loaded after brochure.css,
   which supplies the colours, typefaces and the shared pieces (cover, sections, contact block). */

/* ---- The dark stage the work sits on ---- */
.work { position: relative; overflow: hidden; border-radius: 26px; color: #fff; background: radial-gradient(760px 460px at 88% 0%, #16306b 0%, transparent 62%), radial-gradient(620px 420px at 0% 100%, #0f2254 0%, transparent 60%), linear-gradient(165deg, #0d1730 0%, var(--navy) 65%); padding: clamp(22px, 4vw, 52px); }
.work::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(168,199,250,.055) 1px, transparent 1px), linear-gradient(90deg, rgba(168,199,250,.055) 1px, transparent 1px); background-size: 34px 34px; mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 78%); -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 78%); pointer-events: none; }
.work > * { position: relative; }
.work .kick { color: var(--sky); }
.work .head .lead { color: #b9c7e2; }
.work .head h2 em { color: var(--sky); }

/* ---- The row of phones ---- */
.phones { display: flex; justify-content: center; align-items: flex-end; gap: clamp(10px, 2.2vw, 30px); perspective: 1600px; margin: clamp(8px, 2vw, 20px) 0 clamp(34px, 6vw, 70px); }
.ph { margin: 0; flex: 0 1 178px; min-width: 0; transform-style: preserve-3d; }
.ph-body { border-radius: 26px; padding: 6px; background: linear-gradient(160deg, #1c2a50, #070c18); border: 1px solid #33487c; box-shadow: 0 40px 50px -28px rgba(0,0,0,.9), 0 0 0 1px rgba(168,199,250,.08), inset 0 0 0 1px rgba(255,255,255,.05); transform: rotateY(calc(var(--turn) * -11deg)) translateZ(calc((2 - max(var(--turn), -1 * var(--turn))) * 22px)); transition: transform .6s var(--ease); }
.ph-view { border-radius: 20px; overflow: hidden; aspect-ratio: 390 / 844; background: #0b1324; }
.ph-view img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.ph figcaption { margin-top: 12px; text-align: center; font-family: var(--mono); font-size: .58rem; letter-spacing: .14em; text-transform: uppercase; color: #8fa3cc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- One piece of work ---- */
.work-list { display: grid; gap: clamp(46px, 8vw, 110px); }
.work-item { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: clamp(20px, 5vw, 70px); align-items: center; }
.work-item.flip { grid-template-columns: minmax(0, 1.18fr) minmax(0, .82fr); }
.work-item.flip .w-stage { order: -1; }
.w-kind { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .62rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: #b9c7e2; border: 1px solid var(--navy-line); border-radius: 99px; padding: 5px 12px; }
.w-kind::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #8fa3cc; }
.w-kind.live { color: #fff; border-color: #2f6bff; }
.w-kind.live::before { background: #4ade80; box-shadow: 0 0 0 4px rgba(74,222,128,.18); }
.w-kind.built::before { background: var(--sky); }
.w-copy h3 { font-size: clamp(1.8rem, 3.4vw, 2.7rem); margin-top: 14px; }
.w-line { margin-top: 6px; font-family: var(--mono); font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: #8fa3cc; }
.w-what { margin-top: 14px; color: #c5d1e8; font-size: 1.02rem; max-width: 30em; }
.w-facts { margin: 20px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--navy-line); }
.w-facts div { padding: 12px 14px 0 0; }
.w-facts div + div { padding-left: 14px; border-left: 1px solid var(--navy-line); }
.w-facts dt { font-size: clamp(1.3rem, 2.4vw, 1.9rem); font-weight: 500; letter-spacing: -.03em; line-height: 1; color: #fff; white-space: nowrap; }
.w-facts dd { margin: 5px 0 0; font-size: .8rem; line-height: 1.35; color: #a9b9d8; }
.w-link { display: inline-block; margin-top: 18px; color: var(--sky); font-weight: 500; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 1px; }

/* ---- The 3D rig: a slab of screen, a phone in front, a figure floating nearest ---- */
.w-stage { perspective: 1500px; padding: 5% 9% 13% 6%; }
.flip .w-stage { padding: 5% 6% 13% 9%; }
.w-rig { position: relative; transform-style: preserve-3d; transform: rotateX(var(--rx, 9deg)) rotateY(var(--ry, -20deg)); transition: transform .5s var(--ease); }
.flip .w-rig { transform: rotateX(var(--rx, 9deg)) rotateY(var(--ry, 20deg)); }
.w-screen { position: relative; transform-style: preserve-3d; border-radius: 14px; background: #101b36; border: 1px solid #33487c; box-shadow: 0 0 0 7px rgba(168,199,250,.06); }
/* the back of the slab, so the screen has thickness when it turns */
.w-screen::before { content: ""; position: absolute; inset: -1px; border-radius: 15px; background: linear-gradient(160deg, #1a2b58, #050912); transform: translateZ(-18px); box-shadow: 0 60px 80px -30px rgba(0,0,0,.9); }
.w-bar { position: relative; display: flex; align-items: center; gap: 6px; padding: 9px 13px; background: #101b36; border-radius: 13px 13px 0 0; font-family: var(--mono); font-size: .58rem; letter-spacing: .12em; text-transform: uppercase; color: #8fa3cc; }
.w-bar i { width: 8px; height: 8px; border-radius: 50%; background: #2a3f73; flex: none; }
.w-bar i:first-child { background: var(--accent); }
.w-bar span { margin-left: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-view { position: relative; overflow: hidden; background: #0b1324; container-type: size; }
.w-screen .w-view { aspect-ratio: 16 / 10; border-radius: 0 0 13px 13px; }
.w-view img { width: 100%; height: auto; }
.w-phone { position: absolute; right: -7%; bottom: -15%; width: 24%; border-radius: 22px; padding: 5px; background: linear-gradient(160deg, #1c2a50, #070c18); border: 1px solid #3b5391; transform: translateZ(120px); box-shadow: -34px 44px 50px -22px rgba(0,0,0,.85), 0 0 0 1px rgba(168,199,250,.1); }
.flip .w-phone { right: auto; left: -7%; box-shadow: 34px 44px 50px -22px rgba(0,0,0,.85), 0 0 0 1px rgba(168,199,250,.1); }
.w-phone .w-view { aspect-ratio: 390 / 844; border-radius: 17px; }
.w-phone .w-view img { height: 100%; object-fit: cover; object-position: top; }
.w-chip { position: absolute; left: -3%; top: -7%; transform: translateZ(170px); display: flex; align-items: center; gap: 10px; background: #fff; color: var(--ink); border-radius: 14px; padding: 9px 14px 9px 12px; box-shadow: 0 24px 40px -18px rgba(0,0,0,.8); max-width: 62%; }
.flip .w-chip { left: auto; right: 4%; top: -7%; }
.w-chip b { font-size: 1.5rem; font-weight: 500; letter-spacing: -.03em; line-height: 1; color: var(--accent); white-space: nowrap; }
.w-chip span { font-size: .72rem; line-height: 1.25; color: var(--ink-2); }
.w-shadow { position: absolute; left: 4%; right: 4%; bottom: -20%; height: 36%; background: radial-gradient(closest-side, rgba(0,68,238,.5), transparent); transform: translateZ(-90px); filter: blur(10px); }

@media screen and (prefers-reduced-motion: no-preference) {
  /* the screen scrolls slowly through the whole home page while it is in view */
  .is-on .w-long { animation: w-scroll 22s ease-in-out 1s infinite alternate; }
  @keyframes w-scroll { to { transform: translateY(calc(-100% + 100cqh)); } }
  .is-on .w-phone { animation: w-float 6s ease-in-out infinite; }
  @keyframes w-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
  .is-on .w-chip { animation: w-float 6s ease-in-out -3s infinite; }
}
@media screen and (hover: hover) {
  .phones:hover .ph-body { transform: rotateY(calc(var(--turn) * -5deg)); }
  .phones .ph:hover .ph-body { transform: rotateY(0deg) translateZ(70px); }
}

@media screen and (max-width: 860px) {
  .work { border-radius: 20px; padding: 22px 16px 28px; }
  .work-item, .work-item.flip { grid-template-columns: 1fr; gap: 26px; }
  .work-item .w-stage, .work-item.flip .w-stage { order: -1; padding: 3% 13% 17% 5%; }
  .w-rig, .flip .w-rig { transform: rotateX(6deg) rotateY(-15deg); }
  .flip .w-phone { left: auto; right: -9%; }
  .w-phone { right: -9%; width: 30%; border-radius: 16px; padding: 3px; }
  .w-phone .w-view { border-radius: 13px; }
  .flip .w-chip, .w-chip { left: 9%; right: auto; top: auto; bottom: -12%; max-width: 58%; }
  .w-chip b { font-size: 1.15rem; }
  .w-facts dt { font-size: 1.25rem; white-space: normal; }
  /* phones: a row you swipe along */
  .phones { justify-content: flex-start; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 4px 14px; margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; perspective: none; scrollbar-width: none; }
  .phones::-webkit-scrollbar { display: none; }
  .ph { flex: 0 0 44%; scroll-snap-align: center; }
  .ph-body { transform: none; border-radius: 22px; padding: 5px; }
  .ph-view { border-radius: 17px; }
}

@media print {
  .work { border-radius: 5mm; padding: 6mm 7mm; }
  .phones { margin: 2mm 0 6mm; gap: 4mm; perspective: none; }
  .ph { flex-basis: 26mm; } .ph-body { transform: none; border-radius: 3.6mm; padding: .8mm; box-shadow: none; } .ph-view { border-radius: 3mm; }
  .ph figcaption { margin-top: 1.5mm; }
  .work-list { gap: 7mm; }
  .work-item { gap: 8mm; grid-template-columns: 1fr 1fr; break-inside: avoid; }
  .w-copy h3 { font-size: 15pt; margin-top: 2mm; } .w-what { margin-top: 2mm; } .w-facts { margin-top: 3mm; } .w-facts dt { font-size: 12pt; }
  .w-stage, .flip .w-stage { padding: 0 8% 8% 0; perspective: none; }
  .w-rig, .flip .w-rig { transform: none; }
  .w-screen::before, .w-shadow { display: none; }
  .w-phone, .flip .w-phone { transform: none; left: auto; right: -8%; bottom: -12%; box-shadow: none; border-radius: 3mm; padding: .7mm; }
  .w-phone .w-view { border-radius: 2.4mm; }
  .w-chip { display: none; }
}

/* ---- Inside a brochure: a short version with a link to the full page ---- */
.work-more { margin-top: clamp(30px, 5vw, 60px); text-align: center; }
.work-more .btn { display: inline-flex; align-items: center; min-height: 52px; padding: 0 26px; border-radius: 14px; font-weight: 500; text-decoration: none; background: var(--accent); color: #fff; box-shadow: 0 16px 30px -14px rgba(0,68,238,.95), inset 0 1px 0 rgba(255,255,255,.2); }
@media print { .screen-only { display: none; } }
