/* Perennial Media: the four pillars.
   Motion lives in js/pillars.js; this file holds the layout and the resting states. */
:root {
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --hair: rgba(107, 120, 134, .28);
  --spring: cubic-bezier(.34, 1.36, .5, 1);
}

/* ---------- the four pillars: one full screen each ---------- */
.pillars { position: relative; background: var(--darkroom); color: var(--paper); padding-top: clamp(88px, 14vh, 160px); }
.pillars-head { margin-bottom: clamp(16px, 3vh, 40px); }
.pillar {
  position: relative; overflow: hidden;
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center;
  padding-block: clamp(80px, 12vh, 140px);
  border-top: 1px solid var(--hair);
}
.p-grid { position: relative; z-index: 2; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(40px, 6vw, 110px); align-items: center; }
.p-num { font: 500 13px/1 var(--mono); letter-spacing: .06em; color: var(--safelight); }
.p-num span { color: var(--fog); }
.p-name { margin-top: 20px; font: 900 clamp(76px, 9.4vw, 164px)/.84 var(--display); letter-spacing: -.01em; }
.p-sub { margin-top: 24px; font: 600 clamp(18px, 1.3vw, 22px)/1.3 var(--text); }
.p-body { margin-top: 12px; max-width: 32em; font: 400 17px/1.6 var(--text); color: var(--fog); }
.p-tags { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.p-tags li { font: 500 14px/1 var(--text); border: 1px solid var(--line); padding: 10px 13px; }

/* copy rises in as each pillar arrives (js adds .is-in) */
.js .pillar .p-copy > * { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .pillar.is-in .p-copy > * { opacity: 1; transform: none; }
.pillar.is-in .p-copy > :nth-child(2) { transition-delay: .06s; }
.pillar.is-in .p-copy > :nth-child(3) { transition-delay: .14s; }
.pillar.is-in .p-copy > :nth-child(4) { transition-delay: .2s; }
.pillar.is-in .p-copy > :nth-child(5) { transition-delay: .26s; }

/* the index on the right edge (wide screens) */
.p-rail { display: none; }
@media (min-width: 1100px) {
  .p-rail {
    display: block; position: sticky; top: 50vh; z-index: 6; height: 0; margin: 0; padding: 0; list-style: none;
    opacity: 0; transition: opacity .5s var(--ease);
  }
  .p-rail.is-on { opacity: 1; }
  /* numbers only, in the margin right of the content; the current one is orange with a short rule */
  .p-rail li {
    position: absolute; right: 22px; transform: translateY(calc((var(--i) - 1.5) * 28px - 50%));
    font: 500 11px/1 var(--mono); letter-spacing: .04em; color: var(--line);
    transition: color .35s var(--ease);
  }
  .p-rail li:nth-child(1) { --i: 0; } .p-rail li:nth-child(2) { --i: 1; } .p-rail li:nth-child(3) { --i: 2; } .p-rail li:nth-child(4) { --i: 3; }
  .p-rail li::before { content: ""; position: absolute; right: calc(100% + 6px); top: 50%; width: 0; height: 1.5px; background: var(--safelight); transition: width .35s var(--ease); }
  .p-rail li.is-on { color: var(--safelight); }
  .p-rail li.is-on::before { width: 10px; }
}

/* ---------- 01 Shoot: the shot reel, a row of 9:16 stills that bends at its ends, and a focus box ---------- */
.p-shoot { flex-direction: column; align-items: stretch; justify-content: center; gap: clamp(28px, 5vh, 56px); }
.p-copy-wide { position: relative; z-index: 3; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(24px, 5vw, 110px); align-items: end; }
.p-copy-b .p-sub { margin-top: 0; }
.p-copy-b .p-tags { margin-top: 20px; }
.fc { position: relative; z-index: 1; width: 100%; height: clamp(440px, 64vh, 700px); cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; outline: none; }
.fc[data-drag] { cursor: grabbing; }
.fc:focus-visible { box-shadow: inset 0 0 0 2px rgba(212, 95, 58, .6); }
/* the picture runs above and below the reel's box (js sets top and height), fading out at every edge */
.fc canvas {
  position: absolute; left: 0; right: 0; z-index: 0; display: block; width: 100%; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 24%, #000 76%, transparent), linear-gradient(to right, transparent, #000 7%, #000 93%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to bottom, transparent, #000 24%, #000 76%, transparent), linear-gradient(to right, transparent, #000 7%, #000 93%, transparent);
  mask-composite: intersect;
}
.fc-hit { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
.fc-items { display: none; list-style: none; margin: 0; padding: 0; }
.fc-focus { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
.fc-caption { position: absolute; z-index: 2; left: 0; right: 0; bottom: 6px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; text-align: center; }
.fc-title { font: 600 15px/1.3 var(--text); color: var(--paper); }
.fc-title.is-new { animation: fc-title .52s cubic-bezier(.22, 1, .36, 1); }
@keyframes fc-title { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fc-count { display: inline-flex; align-items: center; gap: 4px; font: 500 12px/1 var(--mono); color: var(--fog); font-variant-numeric: tabular-nums; }
.fc-count i { font-style: normal; opacity: .6; }
.fc-digits { display: inline-flex; color: var(--safelight); }
.fc-digits > span { display: inline-block; height: 1em; overflow: hidden; }
.fc-digits b { display: flex; flex-direction: column; font-weight: 500; transition: transform .6s cubic-bezier(.22, 1, .36, 1); }
.fc-digits b span { height: 1em; }
.fc-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* without WebGL: the same shots as a row you can swipe */
.fc.no-gl { cursor: auto; }
.fc.no-gl .fc-items { display: flex; gap: 12px; height: calc(100% - 64px); overflow-x: auto; scroll-snap-type: x mandatory; padding-inline: var(--gutter); }
.fc.no-gl .fc-items li { flex: 0 0 auto; height: 100%; aspect-ratio: 9 / 16; scroll-snap-align: center; }
.fc.no-gl .fc-items img { display: block; width: 100%; height: 100%; object-fit: cover; }

.af { position: absolute; left: 0; top: 0; z-index: 7; pointer-events: none; opacity: 0; }
.af i { position: absolute; left: 0; top: 0; width: 14px; height: 14px; border: 2px solid var(--safelight); border-width: 2px 0 0 2px; transform-origin: 0 0; will-change: transform; }
.af b { position: absolute; left: 0; top: 0; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; background: var(--safelight); will-change: transform; }
.af em { position: absolute; left: 0; top: 0; font: 500 11px/1 var(--mono); font-style: normal; letter-spacing: .05em; text-transform: uppercase; color: var(--darkroom); background: var(--safelight); padding: 5px 7px; white-space: nowrap; opacity: 0; will-change: transform, opacity; }
.p-shoot.af-mouse, .p-shoot.af-mouse * { cursor: none; }
.p-tags [data-af] { position: relative; }

/* ---------- 02 Post: the drift wall, a tilted wall of posts drifting in columns ---------- */
.p-post .p-grid { pointer-events: none; }   /* the empty right column lets the pointer reach the wall */
.p-post .p-copy { position: relative; z-index: 3; pointer-events: auto; }
.dw {
  position: absolute; z-index: 1; top: 0; bottom: 0; right: 0; width: 64%; overflow: hidden;
  perspective: 1200px; perspective-origin: 50% 50%;
  -webkit-mask-image: radial-gradient(ellipse 78% 82% at 50% 48%, #000 42%, transparent 100%), linear-gradient(to right, transparent, #000 22%);
  -webkit-mask-composite: source-in;
  mask-image: radial-gradient(ellipse 78% 82% at 50% 48%, #000 42%, transparent 100%), linear-gradient(to right, transparent, #000 22%);
  mask-composite: intersect;
  --dw-w: 172px; --dw-h: 215px; --dw-gap: 16px;
}
.dw-plane { position: absolute; top: 50%; left: 50%; display: flex; transform-style: preserve-3d; transform-origin: 50% 50%; will-change: transform; }
.dw-col { width: calc(var(--dw-w) + var(--dw-gap)); transform-style: preserve-3d; }
.dw-track { display: flex; flex-direction: column; will-change: transform; transform-style: preserve-3d; }
.dw-tile { position: relative; display: block; height: calc(var(--dw-h) + var(--dw-gap)); flex: 0 0 auto; transform-style: preserve-3d; cursor: pointer; }
.dw-in {
  position: absolute; inset: calc(var(--dw-gap) / 2); overflow: hidden; border-radius: 10px; background: var(--panel);
  opacity: .58; transform: translateZ(0); pointer-events: none;
  transition: transform .42s cubic-bezier(.22, 1, .36, 1), opacity .42s cubic-bezier(.22, 1, .36, 1), box-shadow .42s cubic-bezier(.22, 1, .36, 1);
}
.dw-in img { display: block; width: 100%; height: 100%; object-fit: cover; filter: saturate(.85); transition: filter .42s var(--ease); }
.dw-in::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(20, 23, 27, .75), rgba(20, 23, 27, .18) 45%); opacity: .9; transition: opacity .42s var(--ease); }
/* the like, comment and share row */
.dw-bar { position: absolute; left: 10px; bottom: 9px; z-index: 1; display: flex; }
.dw-ic { display: flex; gap: 9px; }
.dw-ic svg { width: 16px; height: 16px; fill: none; stroke: var(--paper); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transition: fill .3s var(--ease), stroke .3s var(--ease); }
.dw-tile.is-on .dw-heart { fill: var(--safelight); stroke: var(--safelight); animation: dw-like .5s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes dw-like { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.dw-tile.is-on .dw-in { opacity: 1; transform: translateZ(64px); box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .75), 0 0 0 1.5px var(--safelight); }
.dw-tile.is-on .dw-in img { filter: none; }
.dw-tile.is-on .dw-in::after { opacity: .5; }
/* without JavaScript: the posts as a plain grid */
.dw-items { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.dw-items img { display: block; width: 100%; height: auto; }
.dw.is-live .dw-items { display: none; }

/* ---------- 03 Amplify: a results chart the crosshair reads; two creatives paused, the budget moved to the winner ---------- */
.xh { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; pointer-events: none; }
.chart { justify-self: end; width: min(100%, 600px); }
.chart-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px 20px; margin-bottom: 18px; }
.chart-title { font: 600 15px/1.2 var(--text); color: var(--paper); }
.chart-key { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font: 500 11px/1 var(--mono); letter-spacing: .03em; color: var(--fog); }
.chart-key li { display: flex; align-items: center; gap: 7px; transition: opacity .5s var(--ease); }
.chart-key i { width: 14px; height: 2.5px; border-radius: 2px; background: var(--c); }
[data-k="A"] { --c: var(--paper); } [data-k="B"] { --c: var(--safelight); } [data-k="C"] { --c: var(--line); }
.chart-plot { position: relative; aspect-ratio: 600 / 320; border-left: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.chart-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-plot .grid { stroke: var(--hair); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-plot .ln { fill: none; stroke: var(--c); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.6s var(--ease), opacity .5s var(--ease); }
.chart-plot .ln[data-k="B"] { stroke-width: 3; }
.chart-plot .area { fill: url(#chart-fill); opacity: 0; transition: opacity 1s var(--ease) 1.2s; }
.chart-plot .dot { fill: var(--c); opacity: 0; transition: opacity .4s var(--ease) 1.5s; }
.chart.is-in .ln { stroke-dashoffset: 0; }
.chart.is-in .ln[data-k="B"] { transition-delay: .15s, 0s; } .chart.is-in .ln[data-k="C"] { transition-delay: .3s, 0s; }
.chart.is-in .area, .chart.is-in .dot { opacity: 1; }
.chart-hit { position: absolute; pointer-events: auto; }
.chart-x { display: flex; justify-content: space-between; padding-top: 9px; font: 500 11px/1 var(--mono); letter-spacing: .03em; color: var(--fog); }
.budget { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; margin-top: 26px; }
.budget p { font: 500 11px/1 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--fog); }
.budget-bar { display: flex; gap: 3px; height: 26px; }
.budget-bar b { display: flex; align-items: center; padding-left: 8px; overflow: hidden; width: 33.3%; background: rgba(107, 120, 134, .35); font: 600 11px/1 var(--mono); color: var(--paper); transition: width 1.4s var(--ease), background-color .6s var(--ease); }
.budget-bar b[data-k="B"] { background: rgba(212, 95, 58, .55); }
/* the test's verdicts */
.chart.off-A .ln[data-k="A"], .chart.off-C .ln[data-k="C"], .chart.off-A .dot[data-k="A"], .chart.off-C .dot[data-k="C"] { opacity: .22; }
.chart.off-A .chart-key [data-k="A"], .chart.off-C .chart-key [data-k="C"] { opacity: .4; text-decoration: line-through; }
.chart.win-B .budget-bar b { width: 12%; }
.chart.win-B .budget-bar b[data-k="B"] { width: 76%; background: var(--safelight); color: var(--darkroom); }

/* ---------- 04 Convert: the light lands on the enquiry, a landing page built in HTML ---------- */
.beam { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }
.lp-wrap { justify-self: end; width: min(100%, 560px); padding-top: clamp(90px, 18vh, 210px); }
.lp { position: relative; z-index: 2; overflow: hidden; background: #0c0e11; border: 1px solid rgba(236, 231, 224, .14); border-radius: 12px; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .7); }
.lp-bar { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; background: #15181c; border-bottom: 1px solid rgba(236, 231, 224, .08); }
.lp-bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--slate); }
.lp-bar span { flex: 1; margin-left: 8px; padding: 5px 10px; border-radius: 6px; background: #0c0e11; font: 500 11px/1 var(--mono); color: var(--fog); }
/* the mini site: a recording of our own 3D hero, scaled down and looping */
.mini { aspect-ratio: 16 / 10; background: var(--paper); }
.mini-vid { display: block; width: 100%; height: 100%; object-fit: cover; }
/* without WebGL: a still beam */
.p-conv.no-gl .lp-wrap { position: relative; }
.p-conv.no-gl .lp-wrap::before { content: ""; position: absolute; left: 60%; top: 0; width: 3px; height: calc(clamp(90px, 18vh, 210px) + 1px); background: linear-gradient(rgba(212, 95, 58, 0), var(--safelight)); box-shadow: 0 0 18px 4px rgba(212, 95, 58, .5); }

/* ---------- narrower screens ---------- */
@media (max-width: 900px) {
  .pillar { min-height: 0; padding-block: 72px 80px; }
  .p-grid { grid-template-columns: 1fr; gap: 40px; }
  .p-name { margin-top: 14px; font-size: clamp(64px, 19vw, 104px); }
  .chart, .lp-wrap { justify-self: stretch; width: 100%; }
  /* phones: the wall fills the whole screen and runs under the copy; a fade behind the copy keeps it readable */
  .p-post { min-height: 122svh; align-items: flex-start; }
  .p-post::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 74%; z-index: 2; pointer-events: none;
    background: linear-gradient(to bottom, var(--darkroom) 0%, rgba(20, 23, 27, .9) 38%, rgba(20, 23, 27, .55) 62%, transparent 100%); }
  .dw-bar { left: 7px; bottom: 7px; }
  .dw-ic { gap: 8px; }
  .dw-ic svg { width: 13px; height: 13px; }
  .dw { inset: 0; width: auto; --dw-w: 120px; --dw-h: 150px; --dw-gap: 10px;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 14%, #000 84%, transparent 100%), linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(to bottom, transparent 0%, #000 14%, #000 84%, transparent 100%), linear-gradient(to right, transparent, #000 8%, #000 92%, transparent); }
  .p-copy-wide { grid-template-columns: 1fr; gap: 0; }
  .p-copy-b { margin-top: 24px; }
  .fc { height: min(78svh, 600px); }
  .lp-wrap { padding-top: 96px; max-width: 560px; }
}
@media (max-width: 640px) {
  .p-body { font-size: 16px; }
  .p-tags li { font-size: 13px; padding: 8px 10px; }
  .chart-key { font-size: 10px; gap: 6px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .js .pillar .p-copy > * { opacity: 1; transform: none; transition: none; }
  .budget-bar b, .chart-plot .ln, .chart-plot .area, .chart-plot .dot, .dw-in, .dw-in img { transition: none; }
  .dw-tile.is-on .dw-heart { animation: none; }
  .fc-title.is-new { animation: none; }
  .fc-digits b { transition: none; }
}
