/* memes.goldenmonkey.life — the Meme Factory.
   The palette, the masthead and the type come from /blog/blog.css, so this is
   the same house as the rest of the site. What is here is the factory: a
   laboratory wall, a hopper that drips lead into the line, and a conveyor
   belt the memes ride out on.

   IT IS ALL DRAWN, NOT PHOTOGRAPHED. Every part of the room is CSS and inline
   SVG rather than a backdrop image. That is the whole reason it survives a
   phone: a painted factory would have to be cropped to fit, and then the
   memes would either be shrunk to land on a belt that was drawn at some other
   size, or they would float in front of a room they are plainly not standing
   in. The lobby was broken that way once already. Here the belt is drawn
   underneath whatever the grid decided, at whatever width it decided, so the
   memes are never asked to fit the picture — the picture fits them. */

.vh{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;
  clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}

/* ---------- the room ----------
   A fixed wall behind everything, so the memes travel and the laboratory
   stays put. Four layers: the furnace glow low and warm, a cool shaft from
   somewhere above, the courses of stone, and the stone's own colour. */
.mm-room{
  position:fixed;inset:0;z-index:-2;pointer-events:none;
  background:
    /* the furnace, somewhere below the floor */
    radial-gradient(130% 62% at 50% 110%, rgba(218,142,72,.30), rgba(218,142,72,0) 60%),
    /* a cold shaft from a window that is not in the picture */
    radial-gradient(74% 46% at 78% -8%, rgba(231,184,100,.13), rgba(231,184,100,0) 70%),
    /* piers: broad soft columns of lighter stone, every 300px */
    repeating-linear-gradient(to right,
      rgba(255,228,186,.045) 0 54px,
      rgba(0,0,0,0) 54px 110px,
      rgba(0,0,0,.26) 110px 118px,
      rgba(0,0,0,0) 118px 300px),
    /* courses of stone */
    repeating-linear-gradient(to bottom,
      rgba(255,236,206,.045) 0 1px,
      rgba(0,0,0,0) 1px 76px,
      rgba(0,0,0,.30) 76px 79px),
    /* the joints between blocks, offset enough to read as masonry */
    repeating-linear-gradient(to right,
      rgba(0,0,0,.22) 0 2px,
      rgba(0,0,0,0) 2px 150px),
    linear-gradient(#17100a, #0c0806 56%, #171009);
}
/* A vignette so the corners fall away and the belt is the lit thing. */
.mm-room::after{
  content:"";position:absolute;inset:0;
  background:radial-gradient(118% 78% at 50% 44%, rgba(0,0,0,0) 36%, rgba(8,6,4,.82) 100%);
}

/* Motes in the furnace light. Twelve spans, no JS, and they stop dead for
   anyone who asked for less motion. */
.mm-motes{position:fixed;inset:0;z-index:-1;pointer-events:none;overflow:hidden}
.mm-mote{
  position:absolute;bottom:-12px;width:3px;height:3px;border-radius:50%;
  background:rgba(255,196,110,.85);box-shadow:0 0 8px 2px rgba(231,184,100,.45);
  opacity:0;animation:mm-rise linear infinite;
}
@keyframes mm-rise{
  0%{transform:translate3d(0,0,0) scale(.6);opacity:0}
  12%{opacity:.75}
  70%{opacity:.5}
  100%{transform:translate3d(var(--dx,14px),-104vh,0) scale(1);opacity:0}
}

/* ---------- the head of the line ---------- */
.mm-head{position:relative;padding:clamp(40px,8vh,88px) 0 clamp(18px,3vh,30px)}
.mm-head > *{max-width:40rem}
.mm-head h1{margin:0 0 18px}
.mm-head .lede{
  font-family:'Fraunces',Georgia,serif;
  font-variation-settings:'opsz' 60,'wght' 340,'ital' 1;font-style:italic;
  font-size:clamp(1.12rem,2.1vw,1.46rem);line-height:1.46;
  color:color-mix(in srgb,var(--fg) 88%,transparent);margin:0 0 20px;
}
.mm-count{font-size:12px;letter-spacing:.22em;text-transform:uppercase;color:var(--stone);margin:0}


/* ---------- the line ----------
   Each row is a belt, and the memes ride it. The strip inside slides by
   exactly one run's width and starts again, which is invisible because the
   run is repeated across the strip; memes.js measures the laid-out row and
   sets both the distance and the duration, so the pace stays the same
   whether there are three memes or thirty.

   Hover and keyboard focus stop the line. A share button on a moving target
   is not a share button, and reading a punchline that is walking away is not
   reading. Stopping the belt at the same moment keeps the two in step. */
.mm-lines{display:grid;gap:clamp(40px,7vh,80px);padding:clamp(26px,5vh,56px) 0 clamp(96px,13vh,160px)}

.mm-row{
  position:relative;
  /* Room above for a card to lift on hover and below for the belt, its
     rollers and its legs, all of which are painted by this element. */
  padding:14px 0 108px;
  overflow:hidden;
}
.mm-track{
  display:flex;align-items:stretch;
  column-gap:clamp(14px,2.2vw,30px);
  width:max-content;margin:0;padding:0 clamp(14px,2.2vw,30px) 0 0;list-style:none;
}
@media (prefers-reduced-motion:no-preference){
  .mm-track{animation:mm-run var(--dur,40s) linear infinite}
  .mm-row.is-back .mm-track{animation-direction:reverse}
  .mm-row:hover .mm-track,
  .mm-row:focus-within .mm-track,
  .mm-row.is-held .mm-track{animation-play-state:paused}
}
@keyframes mm-run{to{transform:translate3d(calc(-1 * var(--shift,0px)),0,0)}}

/* With motion turned down the belt holds still and the row becomes something
   you push by hand, so every meme is still reachable. */
@media (prefers-reduced-motion:reduce){
  .mm-row{overflow-x:auto;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch}
  .mm-card{scroll-snap-align:center}
}

.mm-card{
  position:relative;
  flex:0 0 clamp(248px,27vw,330px);
  display:flex;flex-direction:column;
  background:linear-gradient(#1a130c,#120d08);
  border:1px solid color-mix(in srgb,var(--gold) 22%,transparent);
  border-radius:3px;
  box-shadow:0 18px 30px -18px rgba(0,0,0,.95), inset 0 1px 0 rgba(255,214,150,.08);
  transition:transform .5s cubic-bezier(.16,.7,.3,1),border-color .4s,box-shadow .5s;
}
.mm-card:hover{
  transform:translateY(-4px);
  border-color:color-mix(in srgb,var(--gold) 55%,transparent);
  box-shadow:0 26px 40px -20px rgba(0,0,0,.95), 0 0 34px -10px rgba(231,184,100,.35), inset 0 1px 0 rgba(255,214,150,.14);
}

/* THE BELT, and the frame it runs on. Both belong to the row rather than to
   a card: the row is the full width of the room, and the belt should be too,
   whether one meme is on it or twenty. The tread moves at the same rate as
   the strip above it — 34px of pattern in the time the memes cross 34px —
   so the memes read as carried rather than as sliding over the top. */
.mm-row::after{
  content:"";position:absolute;z-index:-1;left:0;right:0;bottom:78px;height:30px;
  background:
    repeating-linear-gradient(100deg,
      rgba(0,0,0,.52) 0 7px,
      rgba(255,214,150,.10) 7px 9px,
      rgba(0,0,0,.52) 9px 22px),
    linear-gradient(rgba(74,60,45,.95), rgba(28,21,15,.98) 55%, rgba(12,9,6,1));
  border-top:1px solid rgba(255,214,150,.22);
  border-bottom:1px solid rgba(0,0,0,.9);
  box-shadow:0 14px 26px -12px rgba(0,0,0,.9), inset 0 2px 6px rgba(0,0,0,.6);
}
/* Rollers that turn, and legs that do not. Two background layers, and the
   keyframe moves only the first — which is the whole difference between a
   machine and a drawing of one. */
.mm-row::before{
  content:"";position:absolute;z-index:-1;left:0;right:0;bottom:0;height:78px;
  background-image:
    repeating-linear-gradient(to right,
      rgba(0,0,0,0) 0 10px,
      rgba(150,128,100,.44) 10px 13px,
      rgba(0,0,0,.58) 13px 17px,
      rgba(0,0,0,0) 17px 34px),
    repeating-linear-gradient(to right,
      rgba(0,0,0,0) 0 136px,
      rgba(0,0,0,.55) 136px 140px,
      rgba(126,108,86,.34) 140px 147px,
      rgba(0,0,0,.55) 147px 151px,
      rgba(0,0,0,0) 151px 300px);
  background-size:auto 14px, auto 64px;
  background-position:0 0, 0 14px;
  background-repeat:repeat-x, repeat-x;
  -webkit-mask-image:linear-gradient(rgba(0,0,0,1) 18%, rgba(0,0,0,.3) 62%, rgba(0,0,0,0));
  mask-image:linear-gradient(rgba(0,0,0,1) 18%, rgba(0,0,0,.3) 62%, rgba(0,0,0,0));
}
@media (prefers-reduced-motion:no-preference){
  .mm-row::after{animation:mm-belt 1.06s linear infinite}
  .mm-row::before{animation:mm-rollers 1.06s linear infinite}
  .mm-row.is-back::after,
  .mm-row.is-back::before{animation-direction:reverse}
  .mm-row:hover::after,.mm-row:hover::before,
  .mm-row:focus-within::after,.mm-row:focus-within::before,
  .mm-row.is-held::after,.mm-row.is-held::before{animation-play-state:paused}
}
/* 38px of tread in 1.06s is 36px a second, the speed memes.js runs the strip
   at. Keep the two in step if either is ever changed. */
@keyframes mm-belt{to{background-position:-38px 0, 0 0}}
@keyframes mm-rollers{to{background-position:-34px 0, 0 14px}}

/* Light falling on the line, which also seats the cards: without it they
   read as cut out and laid on top of a picture. */
.mm-row .mm-glow{
  position:absolute;z-index:-1;left:-40%;right:-40%;bottom:-70px;height:150px;
  background:radial-gradient(58% 100% at 50% 0%, rgba(231,184,100,.17), rgba(231,184,100,0) 72%);
  pointer-events:none;
}

/* The brass clamps that hold a plate to the belt. */
.mm-clamp{
  position:absolute;bottom:-11px;width:16px;height:20px;border-radius:2px;
  background:linear-gradient(rgba(231,184,100,.85), rgba(122,92,46,.9));
  box-shadow:0 2px 5px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,236,190,.6);
  z-index:1;
}
.mm-clamp.l{left:16px}
.mm-clamp.r{right:16px}

/* The meme. Never cropped — a punchline cut off at the edge stops being a
   meme — so a plate that is not square sits on a dark bed rather than being
   trimmed to fit a tidy rectangle. */
.mm-card-art{display:block;background:#0a0806;border-bottom:1px solid var(--rule)}
.mm-card-art img{width:100%;height:auto}
.mm-card-body{padding:16px clamp(14px,1.6vw,20px) 14px;display:flex;flex-direction:column;flex:1;gap:9px}
/* The number, stamped rather than written: small, spaced and metallic, the
   way a part number sits on a plate. It never goes in the line or the title,
   so nothing a search engine or a social card reads is an inventory number. */
.mm-no{
  margin:0;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:11px;letter-spacing:.14em;
  color:color-mix(in srgb,var(--gold) 72%,transparent);
}

.mm-line{margin:0;font-family:'Fraunces',Georgia,serif;
  font-variation-settings:'opsz' 40,'wght' 470,'WONK' 1;
  font-size:.98rem;line-height:1.32;color:var(--fg)}
.mm-line a{color:inherit}
.mm-line a:hover{color:var(--gold)}
.mm-caption{margin:0;font-size:.88rem;line-height:1.55;
  color:color-mix(in srgb,var(--fg) 72%,transparent)}

/* ---------- what a card carries ----------
   The meme and the two buttons, and nothing else. The line and the caption
   are already written across the picture on most of these, so on the card
   they were the same joke twice; and a belt of memes reads better as a belt
   of memes than as a belt of paragraphs. Clicking one opens it full screen,
   where the words have room.

   The number moves onto the picture as a small plate, since there is no
   longer a body for it to sit in. */
.mm-card-body{padding:12px}
.mm-card .mm-line,
.mm-card .mm-caption{display:none}
.mm-card .mm-share{margin-top:0;padding-top:0;border-top:0}
.mm-card .mm-no{position:absolute;top:10px;left:10px;z-index:2;
  padding:3px 7px;border-radius:999px;
  background:rgba(10,8,6,.72);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);
  color:color-mix(in srgb,var(--gold) 86%,transparent)}

/* ---------- full screen ----------
   Opened by tapping a meme on a phone. It is a layer over the page rather
   than a new page on purpose: the line keeps its place, so closing puts the
   reader back exactly where they were on the belt instead of at the start of
   a restarted conveyor. The meme's own /m/<id>/ page is still the real,
   shareable address, and is what the share buttons point at. */
.mm-full{
  position:fixed;inset:0;z-index:60;
  display:flex;flex-direction:column;
  background:rgba(8,6,4,.96);
  -webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);
  overscroll-behavior:contain;
}
.mm-full[hidden]{display:none}
.mm-full-bar{display:flex;justify-content:flex-end;padding:10px 12px;flex:0 0 auto}
.mm-full-x{
  width:42px;height:42px;display:inline-flex;align-items:center;justify-content:center;
  border:1px solid var(--rule);border-radius:999px;background:transparent;
  color:var(--fg);cursor:pointer;font-size:20px;line-height:1;padding:0;
}
.mm-full-x:focus-visible{outline:2px solid var(--gold);outline-offset:2px}
/* A column, not a stretch: on a wide screen a 1200px meme blown across a
   1920px window is worse than the card it came from. */
.mm-full-body{flex:1 1 auto;overflow-y:auto;padding:0 16px 32px;display:grid;gap:14px;
  align-content:start;width:100%;max-width:min(680px,92vw);margin:0 auto}
.mm-full-body img{width:100%;height:auto;border-radius:3px;
  border:1px solid color-mix(in srgb,var(--gold) 22%,transparent)}
.mm-full .mm-no{margin:0}
.mm-full .mm-line{font-size:1.08rem}
.mm-full .mm-share{margin-top:4px;padding-top:0;border-top:0;position:relative}
.mm-full .mm-pop{position:static;margin-top:10px}
body.mm-locked{overflow:hidden}

.mm-empty{max-width:1180px;margin:0 auto;background:var(--panel);border:1px solid var(--rule);
  border-radius:3px;padding:clamp(28px,5vw,48px);text-align:center;display:grid;gap:8px}
.mm-empty b{font-family:'Fraunces',Georgia,serif;font-size:1.2rem;font-weight:400}
.mm-empty span{color:var(--stone);font-size:.95rem}

/* ---------- the two buttons, and what they open ---------- */
.mm-share{margin-top:auto;padding-top:12px;border-top:1px solid var(--rule);position:static}
.mm-acts{display:flex;gap:8px}
.mm-btn{
  flex:1 1 0;min-width:0;
  display:inline-flex;align-items:center;justify-content:center;gap:7px;
  min-height:38px;padding:0 12px;
  font:inherit;font-size:12px;font-weight:600;letter-spacing:.16em;text-transform:uppercase;
  color:color-mix(in srgb,var(--fg) 82%,transparent);
  background:transparent;border:1px solid var(--rule);border-radius:999px;cursor:pointer;
  transition:color .25s,border-color .25s,background .25s;
}
.mm-btn svg{flex:0 0 auto;opacity:.85}
.mm-btn:hover{color:#17130F;background:var(--gold);border-color:var(--gold)}
.mm-btn[aria-expanded="true"]{color:#17130F;background:var(--gold);border-color:var(--gold)}
.mm-btn:focus-visible{outline:2px solid var(--gold);outline-offset:2px}

/* The panel sits OVER the card, never inside it. Every card in a row has to
   stay the same height or the belt stops lining up under them, and a panel
   that pushed the card taller would take the conveyor with it. */
.mm-pop{
  position:absolute;left:8px;right:8px;bottom:8px;z-index:6;
  background:linear-gradient(#1d1610,#140e09);
  border:1px solid color-mix(in srgb,var(--gold) 42%,transparent);
  border-radius:3px;padding:14px;
  box-shadow:0 20px 40px -14px rgba(0,0,0,.95), 0 0 30px -12px rgba(231,184,100,.3);
  display:grid;gap:10px;
}
/* `display:grid` above and the browser's own `[hidden]{display:none}` have
   the same specificity, and this stylesheet comes last, so without this line
   every panel on the page is visible while the DOM correctly reports it
   closed — which is exactly how it first shipped. Any `display` on an
   element that also uses `hidden` needs this. */
.mm-pop[hidden]{display:none}
.mm-pop-head{margin:0;font-size:11px;letter-spacing:.2em;text-transform:uppercase;color:var(--gold)}
.mm-pop-note{margin:0;font-size:.82rem;color:var(--stone)}

.mm-s-row{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.mm-s{
  display:inline-flex;align-items:center;justify-content:center;
  width:34px;height:34px;flex:0 0 auto;
  border:1px solid var(--rule);border-radius:999px;background:transparent;
  color:color-mix(in srgb,var(--fg) 70%,transparent);cursor:pointer;padding:0;
  transition:color .25s,border-color .25s,background .25s,transform .35s cubic-bezier(.16,.7,.3,1);
}
.mm-s:hover{color:#17130F;background:var(--gold);border-color:var(--gold);transform:translateY(-2px)}
.mm-s:focus-visible{outline:2px solid var(--gold);outline-offset:2px}
.mm-s-say{min-height:0;font-size:.78rem;color:var(--gold)}
.mm-s-say:empty{display:none}

/* The traits, as a collectible would list them. No counts and no rarity:
   how many memes share a trait is not a statement about what one is worth,
   and a table that implied otherwise would be making that claim for us. */
.mm-traits{margin:0;display:grid;gap:4px}
.mm-traits > div{display:flex;justify-content:space-between;gap:12px;
  padding:5px 8px;border:1px solid var(--rule);border-radius:2px;
  background:color-mix(in srgb,var(--gold) 5%,transparent)}
.mm-traits dt{margin:0;font-size:10.5px;letter-spacing:.14em;text-transform:uppercase;color:var(--stone)}
.mm-traits dd{margin:0;font-size:.84rem;color:var(--fg);text-align:right}

/* ---------- one meme, on its own page ---------- */
.mm-one{padding-top:clamp(28px,5vh,52px);padding-bottom:clamp(56px,9vh,100px);max-width:860px}
.mm-back{margin:0 0 20px;font-size:.9rem}
/* No overflow:hidden here. The belt is painted by this element and reaches
   well outside it, and clipping the box to round the picture's corners took
   the belt with it. The picture rounds its own top corners instead. */
.mm-figure{margin:0;background:linear-gradient(#1a130c,#120d08);
  border:1px solid color-mix(in srgb,var(--gold) 22%,transparent);border-radius:3px;
  box-shadow:0 22px 40px -22px rgba(0,0,0,.95), inset 0 1px 0 rgba(255,214,150,.08)}
.mm-figure img{width:100%;height:auto;border-radius:2px 2px 0 0}
.mm-figure figcaption{padding:20px clamp(18px,3vw,28px);display:grid;gap:10px}
.mm-one .mm-line{font-size:clamp(1.1rem,2.4vw,1.4rem)}
.mm-one .mm-share{margin-top:0;border-top:0;padding-top:0;position:relative}
/* On its own page there is no card to lie over and no row to keep level, so
   the panel simply sits under the buttons. */
.mm-one .mm-pop{position:static;left:auto;right:auto;bottom:auto;margin-top:10px}
.mm-one .mm-acts{max-width:360px}
.mm-origin{margin:16px 0 0;font-size:.9rem;color:var(--stone)}
.mm-tail{color:var(--stone);font-size:.95rem}

/* The same belt under the one-meme plate, so a meme opened from the line is
   still standing on the line. It runs past the page on both sides and the
   page clips it, which is why .mm-one clips horizontally. */
.mm-figure{position:relative;margin-bottom:84px}
.mm-figure::after{
  content:"";position:absolute;z-index:-1;
  left:-100vw;right:-100vw;bottom:-30px;height:30px;
  background:
    repeating-linear-gradient(100deg,
      rgba(0,0,0,.52) 0 7px,
      rgba(255,214,150,.10) 7px 9px,
      rgba(0,0,0,.52) 9px 22px),
    linear-gradient(rgba(74,60,45,.95), rgba(28,21,15,.98) 55%, rgba(12,9,6,1));
  border-top:1px solid rgba(255,214,150,.22);
  border-bottom:1px solid rgba(0,0,0,.9);
  box-shadow:0 14px 26px -12px rgba(0,0,0,.9), inset 0 2px 6px rgba(0,0,0,.6);
}
.mm-figure::before{
  content:"";position:absolute;z-index:-1;
  left:-100vw;right:-100vw;bottom:-78px;height:48px;
  background-image:
    repeating-linear-gradient(to right,
      rgba(0,0,0,0) 0 10px,
      rgba(150,128,100,.44) 10px 13px,
      rgba(0,0,0,.58) 13px 17px,
      rgba(0,0,0,0) 17px 34px),
    repeating-linear-gradient(to right,
      rgba(0,0,0,0) 0 136px,
      rgba(0,0,0,.55) 136px 140px,
      rgba(126,108,86,.34) 140px 147px,
      rgba(0,0,0,.55) 147px 151px,
      rgba(0,0,0,0) 151px 300px);
  background-size:auto 14px, auto 34px;
  background-position:0 0, 0 14px;
  background-repeat:repeat-x, repeat-x;
  -webkit-mask-image:linear-gradient(rgba(0,0,0,1) 18%, rgba(0,0,0,.3) 62%, rgba(0,0,0,0));
  mask-image:linear-gradient(rgba(0,0,0,1) 18%, rgba(0,0,0,.3) 62%, rgba(0,0,0,0));
}
@media (prefers-reduced-motion:no-preference){
  .mm-figure::after{animation:mm-belt 1.06s linear infinite}
  .mm-figure::before{animation:mm-rollers 1.06s linear infinite}
  .mm-figure:hover::after,.mm-figure:hover::before{animation-play-state:paused}
}
.mm-one{overflow-x:clip}

@media (prefers-reduced-motion:reduce){
  .mm-mote{display:none}
}
