/* Мемы ФАЯНСа (mm-) */
.mm { padding-bottom: 120px; }
.mm [hidden], .mm-ed [hidden], .mm-lb [hidden] { display: none !important; }

/* ----- шапка ----- */
.mm-head { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: 40px; align-items: center; padding: 24px 0 40px; border-bottom: 1px solid var(--rule); }
.mm-title { font-size: clamp(54px, 9vw, 128px); line-height: .92; letter-spacing: -.025em; }
.mm-title span { display: inline-block; }
.mm-head__cta { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 32px; }
.mm-head__note { font-size: 12px; letter-spacing: .08em; color: var(--mute); }
.mm-in { opacity: 0; transform: translateY(24px); animation: mmUp .9s var(--ease) forwards; }
.mm-in:nth-child(2) { animation-delay: .08s; } .mm-in:nth-child(3) { animation-delay: .16s; } .mm-in:nth-child(4) { animation-delay: .24s; }
@keyframes mmUp { to { opacity: 1; transform: none; } }

.mm-head__art { position: relative; aspect-ratio: 1; max-width: 360px; justify-self: end; width: 100%; }
.mm-tile { position: absolute; width: 58%; aspect-ratio: 1; border: 1px solid var(--rule); background:
  linear-gradient(var(--rule) 1px, transparent 1px) 0 0 / 25% 25%, linear-gradient(90deg, var(--rule) 1px, transparent 1px) 0 0 / 25% 25%, var(--paper);
  box-shadow: 0 30px 60px -30px rgba(0,0,0,.35); animation: mmTile 7s ease-in-out infinite; }
.mm-tile--a { left: 0; top: 10%; transform: rotate(-8deg); }
.mm-tile--b { right: 0; top: 0; transform: rotate(6deg); animation-delay: -2.3s; background-color: var(--porcelain-2); }
.mm-tile--c { left: 21%; bottom: 0; transform: rotate(-2deg); animation-delay: -4.6s; background: var(--night); border-color: rgba(226,200,143,.3); }
@keyframes mmTile { 50% { translate: 0 -10px; } }
.mm-head__crown { position: absolute; left: 34%; bottom: 17%; width: 32%; fill: var(--brass-hi); filter: drop-shadow(0 6px 14px rgba(176,141,87,.45)); animation: crown 3.2s ease-in-out infinite; }

/* ----- мем недели ----- */
.mm-hero { margin: 48px 0 8px; }
.mm-hero__in { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: center; padding: 36px;
  background: var(--night); color: var(--night-fg); border-radius: 4px; overflow: hidden; isolation: isolate; animation: fadeUp .8s var(--ease); }
.mm-hero__in::before { content: ""; position: absolute; left: 50%; top: 50%; width: 300%; aspect-ratio: 1; translate: -50% -50%; z-index: -1; background: conic-gradient(from 0deg, transparent, rgba(226,200,143,.12), transparent 30%); animation: mmSpin 14s linear infinite; }
@keyframes mmSpin { to { transform: rotate(1turn); } }
.mm-hero__img { padding: 0; border: 1px solid rgba(226,200,143,.4); background: none; display: block; box-shadow: 0 40px 80px -30px rgba(0,0,0,.6); transform: rotate(-1.5deg); transition: transform .6s var(--ease); }
.mm-hero__img:hover { transform: rotate(0) scale(1.01); }
.mm-hero__img img { display: block; width: 100%; height: auto; }
.mm-hero__t { font-size: clamp(36px, 4.4vw, 64px); line-height: 1; color: var(--night-fg); }
.mm-hero__cap { font: italic 400 21px/1.4 var(--serif); color: rgba(244,241,234,.75); margin: 18px 0 22px; max-width: 46ch; overflow-wrap: anywhere; }
.mm-hero__score { display: flex; align-items: baseline; gap: 14px; margin: 22px 0 18px; }
.mm-hero__score b { font: 500 84px/1 var(--serif); color: var(--brass-hi); }
.mm-hero__score span { font-size: 12px; letter-spacing: .08em; color: rgba(244,241,234,.6); }
.mm-hero .mm-card__who { color: var(--night-fg); }
.mm-hero .mm-card__who small { color: rgba(244,241,234,.55); }
.mm-hero .mm-vote, .mm-hero .mm-ico { color: var(--night-fg); border-color: rgba(244,241,234,.2); }
.mm-hero__laurel { position: absolute; right: -40px; bottom: -50px; width: 260px; fill: rgba(226,200,143,.12); z-index: -1; animation: mmSpin 60s linear infinite; }

/* ----- модерация ----- */
.mm-mod { margin-top: 32px; padding: 20px; border: 1px dashed var(--rose); border-radius: 4px; }
.mm-mod__row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.mm-mod__it { flex: none; width: 150px; display: grid; gap: 6px; font-size: 12px; }
.mm-mod__it img { width: 150px; height: 150px; object-fit: cover; border: 1px solid var(--rule); }
.mm-mod__it div { display: flex; gap: 10px; }

/* ----- сортировка ----- */
.mm-tools { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 48px 0 24px; flex-wrap: wrap; }
.mm-sort { position: relative; display: flex; gap: 4px; border-bottom: 1px solid var(--rule); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.mm-sort button { background: none; border: 0; padding: 10px 14px 12px; font-size: 14px; color: var(--mute); white-space: nowrap; transition: color .3s; }
.mm-sort button.is-on { color: var(--ink); }
.mm-sort__ink { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--brass); transition: transform .5s var(--ease), width .5s var(--ease); }
.mm-count { font: italic 400 18px var(--serif); color: var(--mute); }

/* ----- сетка (масонри на колонках) ----- */
.mm-grid { columns: 3 300px; column-gap: 24px; }
.mm-card { break-inside: avoid; margin: 0 0 24px; background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; display: grid;
  opacity: 0; transform: translateY(28px) scale(.98); transition: opacity .7s var(--ease), transform .7s var(--ease), box-shadow .4s; transition-delay: calc(var(--i) * 45ms); }
.mm-card.is-in, .mm-card.is-stay { opacity: 1; transform: none; }
.mm-card.is-stay { transition-delay: 0s; }
.mm-card:hover { box-shadow: 0 24px 48px -28px rgba(0,0,0,.4); }
.mm-card.is-fresh { animation: mmFresh 1.6s var(--ease); }
@keyframes mmFresh { 0% { box-shadow: 0 0 0 0 var(--brass); } 40% { box-shadow: 0 0 0 6px var(--brass-hi); } 100% { box-shadow: 0 0 0 0 transparent; } }
.mm-card.is-gone { opacity: 0; transform: scale(.9) rotate(-2deg); }
.mm-card.is-hidden img { filter: grayscale(1) blur(2px); opacity: .5; }
.mm-card__flag { margin: 0; padding: 8px 14px; font-size: 12px; background: color-mix(in srgb, var(--rose) 14%, transparent); color: var(--rose); }
.mm-card__img { display: block; padding: 0; border: 0; background: var(--porcelain-2); overflow: hidden; cursor: zoom-in; }
.mm-card__img img { display: block; width: 100%; height: auto; transition: transform .8s var(--ease); }
.mm-card__img:hover img { transform: scale(1.035); }
.mm-card__meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 0; font-size: 12px; color: var(--mute); }
.mm-card__who { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-size: 13px; font-weight: 600; color: var(--ink); min-width: 0; }
.mm-card__who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-card__who small { display: block; font-weight: 400; font-size: 11px; color: var(--mute); }
.mm-chip { justify-self: start; margin: 10px 16px 0; padding: 3px 10px; border: 1px solid var(--brass); border-radius: 999px; font-size: 11px; letter-spacing: .04em; color: var(--brass); text-decoration: none; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: background .3s, color .3s; }
.mm-chip:hover { background: var(--brass); color: #14161A; }
.mm-card__bar { display: flex; align-items: center; gap: 6px; padding: 12px 12px 14px; }
.mm-card__bar .mm-menu { margin-left: auto; }

/* голосование */
.mm-vote { display: inline-flex; align-items: center; border: 1px solid var(--rule); border-radius: 999px; height: 36px; padding: 0 2px; }
.mm-vote__b { width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; display: grid; place-items: center; color: inherit; transition: color .25s, background .25s, transform .25s var(--ease); }
.mm-vote__b svg { width: 18px; height: 18px; }
.mm-vote__b:hover { background: color-mix(in srgb, var(--brass) 14%, transparent); }
.mm-vote__b:active { transform: scale(.85); }
.mm-vote__up.is-on { color: var(--brass); }
.mm-vote__up.is-on svg { fill: currentColor; }
.mm-vote__down.is-on { color: var(--water); }
.mm-vote__down.is-on svg { fill: currentColor; }
.is-pop { animation: mmPop .4s var(--ease); }
@keyframes mmPop { 40% { transform: scale(1.35) translateY(-3px); } }
.mm-num { position: relative; display: inline-block; min-width: 30px; height: 20px; overflow: hidden; text-align: center; font: 700 14px/20px var(--sans); font-variant-numeric: tabular-nums; }
.mm-num i { position: absolute; inset: 0; font-style: normal; }
.mm-num .is-up-in { animation: mmInUp .4s var(--ease); } .mm-num .is-up-out { animation: mmOutUp .4s var(--ease) forwards; }
.mm-num .is-down-in { animation: mmInDown .4s var(--ease); } .mm-num .is-down-out { animation: mmOutDown .4s var(--ease) forwards; }
@keyframes mmInUp { from { transform: translateY(100%); opacity: 0; } }
@keyframes mmOutUp { to { transform: translateY(-100%); opacity: 0; } }
@keyframes mmInDown { from { transform: translateY(-100%); opacity: 0; } }
@keyframes mmOutDown { to { transform: translateY(100%); opacity: 0; } }
.mm-spark { position: fixed; z-index: 200; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: var(--brass-hi); pointer-events: none; animation: mmSpark .7s var(--ease) forwards; }
@keyframes mmSpark { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }

.mm-ico { height: 36px; min-width: 36px; padding: 0 9px; border: 1px solid var(--rule); border-radius: 999px; background: none; display: inline-flex; align-items: center; justify-content: center; gap: 5px; font-size: 13px; color: inherit; transition: border-color .3s, color .3s; }
.mm-ico svg { width: 17px; height: 17px; }
.mm-ico:hover { border-color: var(--brass); color: var(--brass); }
.mm-ico span:empty { display: none; }

/* меню «…» */
.mm-menu { position: relative; }
.mm-menu summary { list-style: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; color: var(--mute); }
.mm-menu summary::-webkit-details-marker { display: none; }
.mm-menu summary svg { width: 18px; height: 18px; }
.mm-menu summary:hover { color: var(--ink); background: var(--porcelain-2); }
.mm-menu__box { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 20; min-width: 200px; display: grid; padding: 6px; background: var(--paper); border: 1px solid var(--rule); box-shadow: 0 20px 40px -12px rgba(0,0,0,.3); animation: fadeUp .25s var(--ease); }
.mm-menu__box button, .mm-menu__done { text-align: left; background: none; border: 0; padding: 9px 12px; font-size: 13px; border-radius: 3px; color: var(--ink); }
.mm-menu__box button:hover { background: var(--porcelain-2); }
.mm-menu__box .is-rose { color: var(--rose); }
.mm-menu__done { color: var(--mute); }

/* пусто */
.mm-empty { text-align: center; padding: 72px 16px; border: 1px dashed var(--rule); border-radius: 4px; animation: fadeUp .8s var(--ease); }
.mm-empty__t { font: 500 clamp(36px, 5vw, 56px)/1 var(--serif); margin: 0 0 12px; }
.mm-empty p { color: var(--mute); }

.mm-link { background: none; border: 0; padding: 0; color: var(--brass); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: none; }
.mm-link:hover { text-decoration: underline; }
.mm-link--rose { color: var(--rose); }
.mm-muted { color: var(--mute); font-size: 13px; margin: 0; }

/* ----- редактор ----- */
.mm-ed, .mm-lb { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; padding: 16px; }
.mm-ed__veil, .mm-lb__veil { position: absolute; inset: 0; background: rgba(10,10,12,.62); backdrop-filter: blur(6px); animation: mmFade .35s ease; }
@keyframes mmFade { from { opacity: 0; } }
.mm-ed.is-out .mm-ed__veil, .mm-lb.is-out .mm-lb__veil { opacity: 0; transition: opacity .35s; }
.mm-ed.is-out .mm-ed__sheet, .mm-lb.is-out .mm-lb__box { transform: translateY(30px) scale(.98); opacity: 0; transition: .35s var(--ease); }
.mm-ed__sheet { position: relative; width: min(1180px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--porcelain); border: 1px solid var(--rule); border-radius: 4px; padding: 28px; animation: mmSheet .55s var(--ease); }
@keyframes mmSheet { from { opacity: 0; transform: translateY(40px) scale(.97); } }
.mm-ed__head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.mm-ed__head .eyebrow { margin-bottom: 10px; }
.mm-ed__t { font-size: clamp(32px, 4vw, 48px); line-height: 1; }
.mm-ed__x { position: absolute; right: 14px; top: 10px; width: 40px; height: 40px; border: 0; background: none; font-size: 30px; line-height: 1; color: var(--ink); z-index: 3; }
.mm-ed__body { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.mm-ed__stage { position: sticky; top: 0; }
.mm-ed__frame { background: repeating-conic-gradient(var(--porcelain-2) 0 25%, var(--paper) 0 50%) 0 0 / 24px 24px; border: 1px solid var(--rule); box-shadow: 0 30px 60px -30px rgba(0,0,0,.4); }
.mm-ed__frame canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: grab; }
.mm-ed__frame canvas.is-drag { cursor: grabbing; }
.mm-ed__hint { font-size: 12px; color: var(--mute); margin: 10px 0 0; }
.mm-ed__panel { display: grid; gap: 22px; min-width: 0; }
.mm-ed__h { display: flex; justify-content: space-between; align-items: baseline; font: 600 11px/1 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--mute); margin: 0 0 12px; }
.mm-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.mm-tpl { padding: 0; border: 1px solid var(--rule); background: var(--paper); border-radius: 3px; overflow: hidden; display: grid; text-align: left; transition: border-color .3s, transform .3s var(--ease); }
.mm-tpl canvas { width: 100%; height: auto; display: block; }
.mm-tpl span { font-size: 11px; line-height: 1.25; padding: 6px 7px 7px; color: var(--ink-2); }
.mm-tpl:hover { transform: translateY(-2px); }
.mm-tpl.is-on { border-color: var(--brass); box-shadow: 0 0 0 2px var(--brass); }
.mm-ed__photo { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.mm-texts { display: grid; gap: 8px; }
.mm-trow { display: grid; grid-template-columns: 22px minmax(0, 1fr) 32px; align-items: center; gap: 6px; padding: 4px 4px 4px 8px; border: 1px solid var(--rule); border-radius: 3px; background: var(--paper); transition: border-color .3s; animation: fadeUp .35s var(--ease); }
.mm-trow.is-on { border-color: var(--brass); }
.mm-trow__n { font: italic 500 18px var(--serif); color: var(--brass); }
.mm-trow textarea { width: 100%; resize: vertical; border: 0; background: none; font: 500 15px/1.4 var(--sans); color: var(--ink); padding: 6px 0; min-height: 34px; }
.mm-trow textarea:focus { outline: none; }
.mm-trow__x { width: 32px; height: 32px; border: 0; background: none; font-size: 20px; color: var(--mute); }
.mm-trow__x:hover { color: var(--rose); }
.mm-sel { padding: 16px; border: 1px solid var(--rule); background: var(--paper); border-radius: 3px; display: grid; gap: 14px; animation: fadeUp .3s var(--ease); }
.mm-sel .mm-ed__h { margin: 0; }
.mm-range { display: grid; grid-template-columns: auto minmax(0, 1fr) 40px; align-items: center; gap: 12px; font-size: 13px; }
.mm-range input { width: 100%; accent-color: var(--brass); }
.mm-range output { font: 600 13px var(--sans); text-align: right; font-variant-numeric: tabular-nums; }
.mm-styles { display: flex; flex-wrap: wrap; gap: 6px; }
.mm-style { padding: 6px 12px; border: 1px solid var(--rule); border-radius: 999px; background: none; font-size: 13px; transition: border-color .25s, background .25s; }
.mm-style.is-on { border-color: var(--brass); background: color-mix(in srgb, var(--brass) 16%, transparent); }
.mm-style--impact { font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }
.mm-style--serif, .mm-style--gold { font: italic 600 16px var(--serif); }
.mm-style--gold { color: var(--brass); }
.mm-sel .mm-link { justify-self: start; }
.mm-stk { display: flex; flex-wrap: wrap; gap: 8px; }
.mm-stk button { width: 48px; height: 48px; border: 1px solid var(--rule); border-radius: 50%; background: var(--paper); display: grid; place-items: center; color: var(--brass); transition: transform .3s var(--ease), border-color .3s; }
.mm-stk button:hover { transform: translateY(-3px) rotate(-8deg); border-color: var(--brass); }
.mm-stk svg { width: 22px; height: 22px; }
.mm-venue { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--rule); border-radius: 3px; background: var(--paper); color: var(--ink); font: 500 14px var(--sans); }
.mm-ed__go { display: flex; gap: 10px; flex-wrap: wrap; }
.mm-ed__go .btn { flex: 1 1 160px; }
.mm-btn-line { background: transparent; border: 1px solid var(--ink); color: var(--ink); }
.mm-btn-line::after { background: color-mix(in srgb, var(--brass) 18%, transparent); }
.mm-ed__err { margin: 0; color: var(--rose); font-size: 13px; min-height: 18px; }

/* ----- лайтбокс ----- */
.mm-lb__box { position: relative; width: min(1080px, 100%); max-height: calc(100dvh - 32px); display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); background: var(--porcelain); border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; animation: mmSheet .5s var(--ease); }
.mm-lb__fig { margin: 0; background: #0A0A0B; display: grid; place-items: center; min-height: 0; }
.mm-lb__fig img { display: block; max-width: 100%; max-height: calc(100dvh - 34px); object-fit: contain; }
.mm-lb__side { display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; gap: 14px; padding: 28px 22px 20px; min-height: 0; max-height: calc(100dvh - 34px); }
.mm-lb__side .mm-card__bar { padding: 0; }
.mm-lb__side .mm-ed__h { margin: 6px 0 0; }
.mm-lb__list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; align-content: start; gap: 14px; min-height: 80px; }
.mm-lb__list li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; font-size: 14px; }
.mm-lb__list li.is-new { animation: fadeUp .4s var(--ease); }
.mm-lb__list li.mm-muted { display: block; }
.mm-lb__list small { color: var(--mute); font-size: 11px; }
.mm-lb__list p { margin: 2px 0 0; overflow-wrap: anywhere; }
.mm-lb .mm-ed__x { background: var(--porcelain); border-radius: 50%; right: 10px; top: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.mm-lb__del { border: 0; background: none; color: var(--mute); font-size: 18px; align-self: start; }
.mm-lb__form { display: flex; gap: 8px; }
.mm-lb__form input { flex: 1; min-width: 0; height: 44px; border: 0; border-bottom: 1px solid var(--rule); background: none; font: 400 18px var(--serif); color: var(--ink); }
.mm-lb__form input:focus { outline: none; border-color: var(--brass); }
.mm-lb__form .btn { height: 44px; padding: 0 18px; }

/* ----- конфетти ----- */
.mm-confetti { position: fixed; inset: 0; z-index: 210; pointer-events: none; overflow: hidden; }
.mm-confetti i { position: absolute; top: -20px; width: 9px; height: 14px; animation: mmFall var(--d) cubic-bezier(.2,.6,.4,1) var(--dl) forwards; }
@keyframes mmFall { to { transform: translate(var(--x), 110vh) rotate(var(--r)); } }

/* ----- адаптив ----- */
@media (max-width: 900px) {
  .mm-head { grid-template-columns: 1fr; }
  .mm-head__art { display: none; }
  .mm-hero__in { grid-template-columns: 1fr; gap: 28px; padding: 22px; }
  .mm-ed__body { grid-template-columns: 1fr; }
  .mm-ed__stage { position: static; }
  .mm-lb__box { display: block; overflow-y: auto; }
  .mm-lb__fig img { max-height: 60vh; }
  .mm-lb__side { max-height: none; display: flex; flex-direction: column; }
  .mm-lb__list { overflow: visible; }
  .mm-lb__side > * { flex: none; }
}
@media (max-width: 600px) {
  .mm-grid { columns: 1; }
  .mm-ed, .mm-lb { padding: 0; }
  .mm-ed__sheet, .mm-lb__box { max-height: 100dvh; height: 100dvh; border-radius: 0; border: 0; padding-bottom: 96px; }
  .mm-ed__sheet { padding: 20px 16px 96px; }
  .mm-hero__score b { font-size: 64px; }
  .mm-tools { margin-top: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .mm-in, .mm-card, .mm-tile, .mm-head__crown, .mm-hero__in::before, .mm-hero__laurel { animation: none !important; opacity: 1; transform: none; transition: none; }
}
