/* page-social.css: Design & Social. Loads after site.css and builds on its tokens and components.
   Three first screens share one markup:
     wide screen with a mouse   the headline on one line over a fan of three stills; with WebGL and motion allowed
                                the script turns the fan into the ring of clips (root class gl, set in the head)
     everything else            the headline holds two clip windows (from 821px in the lines, below that as bands under them)
   Everything below the first screen is the system: opener, media piece, loops, tags, the closing call. */

/* the Arabic face is asked for when a section with Arabic text comes near (the script adds .ar), not with the first screen */
.js:not(.ar) [lang="ar"] { font-family: "Archivo", "Geeza Pro", "Segoe UI", Tahoma, sans-serif; }

/* ---------- first screen ---------- */
.reel-run { position: relative; }
.first {
  position: relative; min-height: 100svh;
  display: flex; flex-direction: column; gap: 14px;
  padding: calc(var(--nav) + 4px) var(--m) 24px;
  --f: min(20.6vw, calc((100svh - 300px) / 1.7));
}
.first__kicker { margin: 0; animation: fade .9s ease .5s backwards; }
.first .hl { margin-block: auto; }
/* rest = where the letters sit, tight = the widest letters that still leave a window */
.s1 { --rest: 68; --tight: 80; animation: s-open-1 1.5s var(--ease) .15s backwards; }
.s2 { --rest: 76; --tight: 96; animation: s-open-2 1.5s var(--ease) .22s backwards; }
.s2 .w { --i: 1; }
@keyframes s-open-1 { from { --wdth: 78; } }
@keyframes s-open-2 { from { --wdth: 88; } }
.first__foot { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 4vw; animation: fade .9s ease .5s backwards; }
.first__foot .lede { max-width: 17em; margin: 0; font-size: clamp(20px, 2.15vw, 34px); line-height: 1.16; font-weight: 600; font-stretch: 88%; text-wrap: balance; }
.first__foot .go { align-items: center; }
.ring, .fan, .now, .count, .hint { display: none; }

@media (max-width: 820px) {
  .first { --f: 23.4vw; --r0: 0px; gap: 12px; padding-bottom: 18px; }
  .first .hl { flex: 1; gap: 8px; margin-block: 0; }
  /* each text line is set to the measure with the width axis (site.js); its window runs edge to edge under it and takes the height that is left */
  .first .ln { flex: 1; display: grid; grid-template-rows: auto minmax(84px, 1fr); align-items: stretch; gap: 8px; animation: none; }
  .first .m { grid-row: 1; justify-self: start; }
  .first .slot { grid-row: 2; margin-inline: calc(-1 * var(--m)); height: auto; min-width: 0; }
  .first .win { animation: open .95s var(--ease) .25s backwards; }
  .s2 .win { animation-delay: .34s; }
  .first__foot { grid-template-columns: 1fr; gap: 10px; margin-top: auto; }
  .first__foot .lede { font-size: 19px; }
}

/* a short window wider than a phone: size by width alone, the first screen flows taller than the window */
@media (max-height: 520px) and (min-width: 821px) { .first { --f: 20.6vw; } }

/* wide screen with a mouse: one line of type, the fan under it */
@media (min-width: 1100px) and (min-height: 521px) and (hover: hover) and (pointer: fine) {
  .first {
    height: 100svh; min-height: 0; overflow: clip;
    --f: calc((100vw - 2 * var(--m)) / 6.78);
    --t: calc(var(--nav) + 39px + var(--f) * .8);                           /* where the headline ends */
    --ph: min(27vw, calc((100svh - var(--t) - 62px) / 1.4));                /* the near plane of the ring: the far planes rise .4 of it, to just behind the letters */
    --pw: calc(var(--ph) * .5625);
    --pcx: 63vw; --pcy: calc(var(--t) + var(--ph) * .9);
  }
  .first .hl { position: relative; z-index: 1; flex-direction: row; gap: .2em; margin: 0; pointer-events: none; }
  .first .ln { --rest: 66; animation: none; }
  .first .slot { display: none; }
  .fan { display: block; }
  .fan img {
    position: absolute; z-index: 1; left: calc(var(--pcx) - var(--pw) / 2); top: calc(var(--pcy) - var(--ph) / 2);
    width: var(--pw); height: var(--ph); max-width: none; object-fit: cover;
    border-radius: calc(var(--pw) * .028); background: var(--panel);
  }
  .fan__l { transform: translateX(-80%) rotate(-7deg) scale(.84); filter: brightness(.5); }
  .fan__r { transform: translateX(80%) rotate(7deg) scale(.84); filter: brightness(.5); }
  .first__foot { position: absolute; z-index: 3; left: var(--m); bottom: 24px; display: block; }
  .first__foot .lede { max-width: 9.4em; margin-bottom: .75em; text-wrap: wrap; }
  .clips__toggle { display: none; }
  /* no ring (reduced motion or no WebGL): the fan is the picture, so it stands larger */
  html:not(.gl) .first { --ph: min(33vw, calc((100svh - var(--t) - 44px) / 1.06)); --pcx: 60vw; --pcy: calc(var(--t) + var(--ph) * .56); }

  /* the script is here, motion is allowed and WebGL exists: the first screen is held while the camera flies through the ring */
  .gl .reel-run { height: 260svh; }
  .gl .reel { position: sticky; top: 0; height: 100svh; overflow: clip; cursor: grab; user-select: none; -webkit-user-select: none; }
  .gl .reel.is-dragging { cursor: grabbing; }
  .gl .ring { display: block; position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; pointer-events: none; visibility: hidden; }
  .gl .ring--front { z-index: 2; }
  .gl.ring-ready .ring { visibility: visible; }
  .gl.ring-ready .fan { opacity: 0; visibility: hidden; transition: opacity .5s ease, visibility 0s .5s; }
  .gl .first .hl { will-change: transform, opacity; }
  .gl .clips__toggle { display: inline-block; }
  .gl .now {
    display: block; position: absolute; z-index: 3; margin: 0; width: 25em;
    left: calc(var(--pcx) - var(--pw) / 2); top: calc(var(--pcy) + var(--ph) / 2 + 10px);
    font-size: 14px; line-height: 1.4;
  }
  .now__lang { margin-inline-end: .7em; color: var(--dim); }
  .gl .count, .gl .hint { display: block; position: absolute; z-index: 3; top: calc(var(--nav) + 4px); margin: 0; font-size: 14px; line-height: 1.4; color: var(--dim); font-variant-numeric: tabular-nums; }
  .gl .count { right: var(--m); }
  .gl .hint { right: calc(var(--m) + 5.2em); }
  .gl .hint[hidden] { display: none; }
  .count__i { color: var(--ink); }
  .vtex { position: absolute; left: 0; top: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; }

  /* the index lands inside the held screen: eight lines, each set to the full measure (site.js .fit), opened by the scroll (--k) */
  .gl .index { position: absolute; z-index: 5; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: var(--nav) var(--m) 20px; opacity: 0; pointer-events: none; }
  .gl .index.is-landed { pointer-events: auto; }
  .gl .index ol { --if: min(calc((100svh - 104px) / 7.3), 8.6vw); max-width: calc(var(--if) * 12.9); opacity: 1; transform: none; transition: none; }
  .gl .reel .index .fit > span { --wdth: var(--fitw, 62); transition: none; }
  /* each line is its own layer and is only moved: redrawing eight lines of type on every frame of the scroll costs a third of the frame rate */
  .gl .index li { will-change: transform; transform: translateY(calc((1 - var(--k, 0)) * var(--d, 40px))); }
  .gl .index li:nth-child(2) { --d: 70px; } .gl .index li:nth-child(3) { --d: 100px; } .gl .index li:nth-child(4) { --d: 130px; }
  .gl .index li:nth-child(5) { --d: 160px; } .gl .index li:nth-child(6) { --d: 190px; } .gl .index li:nth-child(7) { --d: 220px; } .gl .index li:nth-child(8) { --d: 250px; }
}

/* ---------- the index of pieces ---------- */
.index { padding: var(--s6) var(--m) 0; }
.index ol { margin: 0; padding: 0; list-style: none; --if: clamp(30px, 8.6vw, 120px); }
.index a { display: block; padding: .02em 0; font-size: var(--if); line-height: .9; font-weight: 900; font-variation-settings: "wght" 900, "wdth" 62; text-transform: uppercase; }
.index b { margin-inline-end: .2em; font-weight: inherit; color: var(--dim); transition: color .2s; }
.index a:hover b, .index a:focus-visible b { color: var(--y); }

/* ---------- pieces ---------- */
.sec .piece + .piece, .sec .piece + .subhead { margin-top: var(--s5); }
.piece figcaption a { font-weight: 550; white-space: nowrap; }
.piece figcaption a[download]::after { content: "\2193"; display: inline-block; margin-left: .3em; }
.say { max-width: 15em; margin-block: var(--s5); font-size: clamp(34px, 5.6vw, 96px); line-height: .88; font-weight: 900; font-variation-settings: "wght" 900, "wdth" 62; text-transform: uppercase; text-wrap: balance; }
/* a row of objects of different shapes at one height: each takes width in proportion to its aspect ratio (--r) */
.eq { display: flex; align-items: flex-start; gap: var(--s3) calc(var(--m) * 1.4); }
.eq > * { flex: var(--r, 1) 1 0; min-width: 0; }

/* social kit */
html:not(.js) .kit__controls { display: none; }
.kit__controls { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2) var(--s5); margin-bottom: var(--s4); }
.kit__group { display: flex; flex-wrap: wrap; gap: 0 .32em; font-size: clamp(34px, 5.6vw, 96px); }
.kit__btn {
  padding: 0; border: 0; background: none; cursor: pointer; color: #6f6f6f;
  font: inherit; line-height: .9; font-weight: 900; font-variation-settings: "wght" 900, "wdth" 62; text-transform: uppercase;
  transition: color .2s, font-variation-settings .6s var(--ease);
}
.kit__btn:hover { color: var(--ink); }
.kit__btn[aria-pressed="true"] { color: var(--ink); font-variation-settings: "wght" 900, "wdth" 92; }
.kit__panel + .kit__panel { margin-top: var(--s5); }
.kit__strip { display: flex; gap: 12px; margin: 0; padding: 0; list-style: none; }
.kit__slide { flex: 1 1 0; min-width: 0; border-radius: var(--r); overflow: hidden; background: var(--panel); }
.kit__slide img, .kit__fmt img, .dkey__tz img { display: block; width: 100%; height: auto; }
.kit__cap, .kit__fmt figcaption { margin-top: 12px; font-size: 15px; line-height: 1.3; }
.kit__formats { display: flex; align-items: flex-start; gap: 12px; margin-top: var(--s4); }
.kit__fmt { flex: var(--r) 1 0; min-width: 0; }
.kit__fmt img { border-radius: var(--r); background: var(--panel); }

/* motion */
.loops__wide { display: grid; grid-template-columns: 2fr 1fr; gap: var(--s3) calc(var(--m) * 1.4); align-items: start; margin-top: var(--s5); }
.loops__lead { grid-row: span 2; }

/* Deadbolt key art */
.dkey { display: grid; grid-template-columns: 4fr 7fr; gap: var(--s4) calc(var(--m) * 1.4); align-items: start; }
.dkey .piece { margin: 0; }
.dkey__poster { grid-row: span 2; }
.dkey__tzrow { gap: 12px; }
.dkey__tz { border-radius: var(--r); overflow: hidden; background: var(--panel); }

/* icons, the making of a post, channels */
.icon-set { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s4) var(--m); margin: 0; padding: 0; list-style: none; }
.icon-set li { display: grid; gap: 8px; align-content: start; }
.icon-set svg { width: clamp(48px, 5.4vw, 84px); height: auto; margin-bottom: 6px; fill: none; stroke: var(--ink); stroke-width: 1.3; transition: stroke .2s; }
.icon-set li:hover svg { stroke: var(--y); }
.icon-set__num { font-size: 18px; line-height: 1; font-weight: 900; font-variation-settings: "wght" 900, "wdth" 62; color: var(--dim); }
.icon-set__label { font-size: clamp(16px, 1.5vw, 22px); line-height: 1.2; font-weight: 600; font-stretch: 88%; }
.made__head { margin-top: var(--s6); }
.process-flow {
  display: flex; flex-wrap: wrap; gap: .06em 0; margin: 0; padding: 0; list-style: none;
  font-size: clamp(34px, 5.6vw, 96px); line-height: .9; font-weight: 900; font-variation-settings: "wght" 900, "wdth" 62; text-transform: uppercase;
}
.process-flow li + li::before { content: "\2192"; margin: 0 .22em; color: var(--y); }
/* where the browser can tie an animation to the scroll, the seven steps are one line that the scroll pulls across the screen */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    /* clip, not hidden: a hidden box would become the scroller the view timeline watches, and the line would never move */
    .made__run { margin-inline: calc(-1 * var(--m)); overflow: clip; }
    .process-flow li { white-space: nowrap; }
    .process-flow { flex-wrap: nowrap; width: max-content; padding: .04em var(--m); font-size: min(84px, calc((100vw - 2 * var(--m)) / 11.3)); animation: drift linear both; animation-timeline: view(block 80px 20px); animation-range: contain 0% contain 100%; }
  }
}
.matrix__eq { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s3) clamp(14px, 2.6vw, 44px); margin: 0 0 var(--s5); }
.matrix__eq > span { display: flex; flex-direction: column; font-size: clamp(16px, 1.5vw, 22px); line-height: 1.2; font-weight: 600; font-stretch: 88%; }
.matrix__eq b, .matrix__eq i { font-size: clamp(88px, 13vw, 200px); line-height: .8; font-weight: 900; font-style: normal; font-variation-settings: "wght" 900, "wdth" 62; }
.matrix__eq b { margin-bottom: .1em; }
.matrix__eq i { color: var(--dim); }
.matrix__sum b { color: var(--y); }
.matrix__table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; line-height: 1.4; }
.matrix__table th { padding: 0 0 10px; font-weight: 400; text-align: left; color: var(--dim); }
.matrix__table th[scope="row"] { width: 22%; padding: 0; vertical-align: baseline; font-size: clamp(16px, 1.5vw, 22px); font-weight: 600; font-stretch: 88%; color: var(--ink); }
.matrix__table td { padding: 0 0 .5em; }
.matrix__n { font-size: clamp(40px, 6.2vw, 96px); line-height: .9; font-weight: 900; font-variation-settings: "wght" 900, "wdth" 62; }
.channels { margin-top: var(--s5); }
.channels h3 { margin-bottom: .5em; }
.channels a { display: inline-block; padding: .28em 0; transition: color .2s; }
.channels a::after { content: "\2197"; display: inline-block; margin-left: .35em; color: var(--dim); }
.channels a:hover { color: var(--y); }

/* publication design */
.pubs__dl { margin-top: var(--s5); }
.pubs__dl a { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr) auto; align-items: baseline; gap: 4px var(--s4); padding: .55em 0; }
.pubs__name { font-size: clamp(20px, 2.15vw, 34px); line-height: 1.16; font-weight: 650; font-stretch: 88%; }
.pubs__file { font-size: 14px; color: var(--dim); overflow-wrap: anywhere; }
.pubs__act { font-weight: 550; white-space: nowrap; }
.pubs__dl a:hover .pubs__name { color: var(--y); }
.pubs__dl a:hover .arrow { transform: translateX(.3em); }
.pubs__act .arrow { display: inline-block; transition: transform .35s var(--ease); }

/* ---------- published videos: a cover, a play button, the player on a click ---------- */
.yt-rows { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5) calc(var(--m) * 2.4); }
.yt-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.yt-card__lang { display: block; margin-bottom: 8px; font-size: 14px; line-height: 1.4; color: var(--dim); }
.yt { position: relative; aspect-ratio: 9 / 16; border-radius: var(--r); overflow: hidden; background: var(--panel); }
.yt img, .yt iframe { display: block; width: 100%; height: 100%; border: 0; object-fit: cover; }
.yt img { transition: transform .7s var(--ease); }
.yt:hover img { transform: scale(1.035); }
.yt__play { position: absolute; inset: 0; width: 100%; padding: 0; border: 0; background: none; color: #000; cursor: pointer; }
.yt__play:focus-visible { outline-offset: -5px; border-radius: var(--r); }
.yt__play span { position: absolute; left: 10px; bottom: 10px; display: grid; place-items: center; width: 44px; height: 44px; background: #fff; transition: background .2s; }
.yt__play:hover span, .yt__play:focus-visible span { background: var(--y); }
.yt__play svg { width: 16px; height: 16px; }
.yt-card__caption { margin-top: 12px; font-size: 15px; line-height: 1.3; font-weight: 600; font-stretch: 88%; }
.yt-card__watch { display: inline-block; margin-top: 4px; padding: .3em 0; font-size: 14px; line-height: 1.4; color: var(--dim); transition: color .2s; }
.yt-card__watch:hover { color: var(--ink); }
.yt-card__caption .yt-card__watch { display: block; width: max-content; font-weight: 400; font-stretch: 100%; text-align: left; }
html:not(.js) .yt__play { display: none; }
.yt-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s4) 12px; align-items: end; }
.yt-grid .opener { align-self: start; margin: 0; }
.yt-grid .display { font-size: clamp(34px, 4.9vw, 84px); }

/* ---------- Tectovia, tools ---------- */
.tect { display: grid; grid-template-columns: 5fr 7fr; gap: var(--s4) calc(var(--m) * 2.4); align-items: start; }
.tect .piece { grid-column: 2; margin: 0; }
.tect__say { grid-row: span 2; position: sticky; top: calc(var(--nav) + var(--s3)); }
.tect__say .text { margin-bottom: var(--s3); font-size: clamp(17px, 1.6vw, 23px); line-height: 1.45; }
.tools .tags { gap: .1em 1.1em; }
.tools .tags li { padding: 0; background: none; font-size: clamp(20px, 2.15vw, 34px); line-height: 1.3; font-weight: 650; font-stretch: 88%; }
.tools__note { margin-top: var(--s4); color: var(--dim); }

/* ---------- below the desktop width ---------- */
@media (max-width: 1099.98px) {
  .yt-rows { grid-template-columns: 1fr; }
  .yt-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .yt-grid .opener { grid-column: 1 / -1; margin-bottom: var(--s2); }
  .icon-set { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 820px) {
  .index a { padding: .1em 0; }
  .matrix__table th[scope="row"] { width: 26%; font-size: 14px; }
  .matrix__table { font-size: 12px; }
}
/* phones: one column, strips swiped sideways */
@media (max-width: 600px) {
  .kit__group { font-size: 12.4vw; }
  .kit__group + .kit__group { font-size: 9vw; }
  /* carousels and story rows are swiped sideways, edge to edge */
  .kit__strip, .yt-row { display: flex; gap: 10px; margin-inline: calc(-1 * var(--m)); padding-inline: var(--m); overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--m); scrollbar-width: none; }
  .kit__slide { flex: 0 0 74vw; scroll-snap-align: start; }
  .yt-row .yt-card { flex: 0 0 62vw; scroll-snap-align: start; }
  .kit__formats { flex-wrap: wrap; }
  .kit__fmt:nth-child(3) { flex-basis: 100%; }
  .loops__tall { flex-wrap: wrap; }
  .loops__tall > :first-child { flex-basis: 100%; }
  .loops__wide, .dkey, .tect { grid-template-columns: 1fr; }
  .tect .piece { grid-column: auto; }
  .tect__say { position: static; }
  .icon-set { grid-template-columns: repeat(2, 1fr); }
  .pubs__row { flex-wrap: wrap; }
  .pubs__row > :nth-child(-n+2) { flex-basis: 100%; }
  .pubs__dl a { grid-template-columns: 1fr; }
  .yt-grid { gap: var(--s3) 8px; }
  /* a small tile opens to the full width when its video plays */
  .yt-grid .yt-card:has(.is-playing) { grid-column: 1 / -1; }
}
