/* Vintage Cigar #18262 — владелец @goddessvirt
   The card is Telegram's own gift card (420×280, laid out in container units so it scales exactly),
   with Telegram's info table on the back. Page palette comes from the gift: backdrop #8c8c85 → #6c6c66,
   symbol ink #2b2a20, text #cfcec4, and the Rose Wrapper's wrapper gradient as foil. */

@font-face { font-family: "Prata"; src: url("fonts/prata-latin.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Prata"; src: url("fonts/prata-cyrillic.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1; }
@font-face { font-family: "Prata"; src: url("fonts/prata-rub.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; unicode-range: U+20BD; }
@font-face { font-family: "Jost"; src: url("fonts/jost-latin.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Jost"; src: url("fonts/jost-cyrillic.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1; }
/* ₽ lives in a separate tiny file; it must declare the same weight range as the other Jost faces,
   or the browser treats it as the best match for regular text and drops Jost for everything else. */
@font-face { font-family: "Jost"; src: url("fonts/jost-rub-400.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; unicode-range: U+20BD; }
@font-face { font-family: "Roboto"; src: url("fonts/roboto-latin.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Roboto"; src: url("fonts/roboto-cyrillic.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }

:root {
  color-scheme: dark;
  --humidor: #1a1913;
  --parchment: #cfcec4;
  --parchment-hi: #ece8dc;
  --parchment-lo: #a3a296;
  --copper: #e2ae8b;
  --peach: #ffd8be;
  /* a light cut of the Rose Wrapper's wrapper gradient, used as foil */
  --foil-text: linear-gradient(90deg, #d39470 0%, #f0c09c 14%, #ffe3cf 26%, #e9b597 40%, #c98a66 52%, #e7a5a0 66%, #f8d2bd 80%, #e2ae8b 90%, #d39470 100%);
  --serif: "Prata", "Bodoni 72", Didot, "Times New Roman", serif;
  --sans: "Jost", Futura, "Century Gothic", "Avenir Next", system-ui, sans-serif;
  --tg: Roboto, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --gutter: clamp(16px, 5vw, 64px);
  /* the card keeps Telegram's 3:2 proportions */
  --cw: min(92vw, 640px, calc((100vh - 230px) * 1.5));
}
@supports (height: 1svh) {
  :root { --cw: min(92vw, 640px, calc((100svh - 230px) * 1.5)); }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--humidor);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--humidor);
  color: var(--parchment);
  font-family: var(--sans);
  font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  line-height: 1.6;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; }
[hidden] { display: none !important; }
p { margin: 0 0 1em; }

a {
  color: var(--copper);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: rgba(226, 174, 139, 0.45);
  transition: color 0.2s, text-decoration-color 0.2s;
}
a:hover { color: var(--peach); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--peach); outline-offset: 3px; border-radius: 3px; }

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

/* ───────────────────────── Stage ───────────────────────── */

.stage { position: relative; }

.stage__pin {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 3.4vh, 36px);
  padding-block: max(28px, env(safe-area-inset-top, 0px)) 44px;
  overflow: hidden;
  overflow: clip;
  isolation: isolate;
}

.scene {
  position: relative;
  flex: none;
  width: var(--cw);
  height: calc(var(--cw) / 1.5);
  perspective: 1600px;
  container-type: inline-size; /* 1cqw = 1% of the card: 4.2px on Telegram's 420px card */
  --r: 3.8095cqw;               /* t.me's 16px corner at 420px */
}

/* Lamp glow: the backdrop's own colours thrown wide behind the card. */
.scene::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: -1;
  width: 250%;
  height: 300%;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(140, 140, 133, 0.48), rgba(108, 108, 102, 0.28) 42%, rgba(43, 42, 32, 0.1) 72%, rgba(43, 42, 32, 0) 100%);
  transform:
    translate(-50%, -50%)
    translate(calc(var(--dx, 0px) * var(--e, 0)), calc(var(--dy, 0px) * var(--e, 0)))
    scale(calc(1 - var(--e, 0) * 0.25), calc(1 - var(--e, 0) * 0.5));
}

.card {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  cursor: grab;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
.card.is-dragging { cursor: grabbing; }

.card__flip {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.face {
  position: absolute;
  inset: 0;
  border-radius: var(--r);
}
.face--front { transform-style: preserve-3d; }
.face--back {
  overflow: hidden;
  transform: rotateY(180deg);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  background: #212429;
  box-shadow: 0 2.2em 4em -1.6em rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.plate {
  position: absolute;
  inset: 0;
  border-radius: var(--r);
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.layer {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.plate--backdrop {
  box-shadow: 0 2.2em 4em -1.6em rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* The paws are dark ink at 10–26% opacity, invisible on dark glass.
   While the card is taken apart, a lit copy of the same pattern fades in. */
.plate--symbol .lit { opacity: var(--e, 0); }

/* In the exploded view the transparent layers read as glass plates. */
.plate--symbol::after,
.plate--model::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 216, 190, 0.6);
  background: linear-gradient(135deg, rgba(236, 232, 220, 0.13), rgba(236, 232, 220, 0.04) 60%);
  opacity: var(--e, 0);
  pointer-events: none;
}

/* Model: where t.me puts it — 30.71% in from each side, 7.14% of the width from the top. */
.model {
  position: absolute;
  left: 30.7143cqw;
  top: 7.1429cqw;
  width: 38.5714cqw;
  height: 38.5714cqw;
}
.model__poster,
.model .lottie,
.model .lottie > svg {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}
.model__poster { transition: opacity 0.4s ease; }
.is-live .model__poster { opacity: 0; }

.plate--text { pointer-events: none; }
.plate--text text { font-family: var(--tg); }
.pill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 3.8095cqw;
  width: fit-content;
  margin: 0 auto;
  padding: 0.476cqw 1.4286cqw;
  border-radius: 1000px;
  font: 400 3.5714cqw/4.2857cqw var(--tg);
  white-space: nowrap;
  color: #cfcec4;
  background: #2b2a2039;
}

.glare {
  position: absolute;
  inset: 0;
  border-radius: var(--r);
  pointer-events: none;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  background:
    radial-gradient(circle at var(--gx, 50%) var(--gy, 30%), rgba(255, 248, 238, 0.3), rgba(255, 248, 238, 0) 46%),
    linear-gradient(115deg, rgba(255, 216, 190, 0) 28%, rgba(255, 216, 190, 0.12) 44%, rgba(218, 119, 119, 0.1) 56%, rgba(218, 119, 119, 0) 72%) var(--gx, 50%) 0 / 220% 100% no-repeat;
  opacity: var(--glare, 0);
}
.face--front > .glare { transform: translateZ(2px); }

/* The back: Telegram's info table, at Telegram's sizes on a 420px card. */
.back {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2.857cqw;
  padding: 4.286cqw 4.762cqw;
  color: #fff;
  font-family: var(--tg);
  -webkit-font-smoothing: antialiased;
}
.back__head {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.476cqw;
  text-align: center;
}
.back__title { font: 500 4.048cqw/1.2 var(--tg); }
.back__sub { font: 400 3.095cqw/1.3 var(--tg); color: #84888c; }
.back__table-wrap { border: 1px solid #33373d; border-radius: 1.905cqw; overflow: hidden; }
.back__table { width: 100%; border-collapse: collapse; border-spacing: 0; }
.back__table th,
.back__table td {
  padding: 1.905cqw 2.857cqw;
  font-size: 3.5714cqw;
  line-height: 4.2857cqw;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid #33373d;
}
.back__table tr:first-child > * { border-top: 0; }
.back__table th { font-weight: 500; white-space: nowrap; background: #262a2e; }
.back__table td { font-weight: 400; border-left: 1px solid #33373d; }
.back__table mark {
  display: inline-block;
  vertical-align: top;
  margin-left: 0.238cqw;
  padding: 0.476cqw 1.19cqw 0.476cqw 1.4286cqw;
  border-radius: 2.143cqw;
  font-size: 2.857cqw;
  line-height: 3.333cqw;
  color: #30aafd;
  background: #23313e;
}
.avatar {
  position: relative;
  display: inline-block;
  vertical-align: top;
  width: 5.714cqw;
  height: 5.714cqw;
  margin: -0.714cqw 1.667cqw -0.714cqw 0;
  overflow: hidden;
  border-radius: 50%;
  font-style: normal;
  font-size: 2.381cqw;
  line-height: 5.952cqw;
  text-align: center;
  color: #fff;
  background: #ee7aae;
}
.avatar::before { content: attr(data-content); font-weight: 500; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.mk { position: absolute; width: 0; height: 0; }
.mk:nth-of-type(1) { left: 2.5%; top: 3.75%; }
.mk:nth-of-type(2) { right: 2.5%; top: 3.75%; }
.mk:nth-of-type(3) { right: 2.5%; bottom: 3.75%; }
.mk:nth-of-type(4) { left: 2.5%; bottom: 3.75%; }

/* ── Controls under the card ── */

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.ctl {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.68em 1.1em 0.68em 0.95em;
  border: 1px solid rgba(207, 206, 196, 0.2);
  border-radius: 99px;
  background: rgba(207, 206, 196, 0.05);
  color: var(--parchment);
  font: 500 0.875rem/1 var(--sans);
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.ctl:hover { color: var(--peach); border-color: rgba(226, 174, 139, 0.6); background: rgba(226, 174, 139, 0.07); }
.ctl::before {
  content: "";
  width: 1.05em;
  height: 1.05em;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.ctl--flip { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 0 1 15.5-6.2L21 8'/%3E%3Cpath d='M21 3v5h-5'/%3E%3Cpath d='M21 12a9 9 0 0 1-15.5 6.2L3 16'/%3E%3Cpath d='M3 21v-5h5'/%3E%3C/svg%3E"); }
.ctl--pause { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='6' y='5' width='4' height='14' rx='1'/%3E%3Crect x='14' y='5' width='4' height='14' rx='1'/%3E%3C/svg%3E"); }
.ctl--pause.is-paused { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4.5v15a1 1 0 0 0 1.5.86l12-7.5a1 1 0 0 0 0-1.72l-12-7.5A1 1 0 0 0 7 4.5z'/%3E%3C/svg%3E"); }
.ctl--flip[aria-pressed="true"] { color: var(--peach); border-color: rgba(226, 174, 139, 0.6); }

.cue {
  display: none;
  margin: 0;
  font: 400 0.875rem/1.4 var(--sans);
  letter-spacing: 0.02em;
  color: var(--parchment-lo);
}

/* ── Traits: a plain list by default; placed around the exploded card when motion is on ── */

.traits {
  list-style: none;
  width: 100%;
  max-width: 960px;
  margin: 8px 0 0;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px 32px;
  text-align: left;
}
.trait {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
  border-top: 1px solid rgba(207, 206, 196, 0.18);
}
.trait__kind { font: 400 0.8125rem/1.3 var(--sans); letter-spacing: 0.02em; color: var(--parchment-lo); }
.trait__name { font: 400 clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem)/1.15 var(--serif); color: var(--parchment-hi); }
.trait__rarity { font: 400 0.875rem/1.4 var(--sans); color: var(--copper); }
.swatches { display: flex; gap: 6px; margin-top: 6px; }
.swatches i { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }

.leaders { display: none; }

.odds {
  max-width: 30em;
  margin: 8px auto 0;
  padding-inline: var(--gutter);
  text-align: center;
  font-family: var(--serif);
  font-size: clamp(1.125rem, 1rem + 0.55vw, 1.5rem);
  line-height: 1.45;
  color: var(--parchment-hi);
  text-wrap: balance;
}

@media (max-width: 700px) {
  .traits { grid-template-columns: 1fr; max-width: 30rem; }
}

/* Without JavaScript the card can't turn over, so its back is shown underneath. */
html:not(.js) .scene { height: auto; }
html:not(.js) .card,
html:not(.js) .card__flip,
html:not(.js) .face { position: relative; }
html:not(.js) .card { cursor: auto; }
html:not(.js) .face { aspect-ratio: 3 / 2; }
html:not(.js) .face--back { transform: none; margin-top: 16px; }
html:not(.js) .controls { display: none; }

/* ── Motion on: pin the stage and let the scroll take the card apart ── */

.motion .stage { height: 250vh; height: 250svh; }
.motion .stage__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  min-height: 0;
  padding-block: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-bottom, 0px));
}
.motion .cue { display: block; }

.motion .traits {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  max-width: none;
  margin: 0;
  padding: 0;
  pointer-events: none;
}
.motion .trait {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--lw, 15rem);
  padding: 0;
  border: 0;
  opacity: 0;
  will-change: transform, opacity;
}
.motion .traits.is-caption .trait { align-items: center; text-align: center; }
.motion .traits.is-caption .swatches { justify-content: center; }

.motion .leaders {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.leaders path { fill: none; stroke: rgba(226, 174, 139, 0.7); stroke-width: 1; }

@media (max-width: 899px) {
  .motion .trait__kind { font-size: 0.75rem; }
  .motion .trait__name { font-size: 1.125rem; line-height: 1.15; }
  .motion .trait__rarity { font-size: 0.8125rem; }
  .motion .swatches i { width: 12px; height: 12px; }
}

.motion .odds {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(5vh, 28px, env(safe-area-inset-bottom, 0px));
  margin: 0 auto;
  opacity: 0;
}

/* One orchestrated entrance, the way Telegram opens a gift:
   the lamp comes up, the card rises, the paws burst out from the centre, the model pops in. */
.motion .scene::before { animation: lamp 1.6s ease-out 0.1s backwards; }
.motion .card { animation: rise 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s backwards; }
.motion .plate--symbol .layer { transform-origin: 50% 38%; animation: burst 1.15s cubic-bezier(0.16, 0.84, 0.24, 1) 0.55s backwards; }
.motion .model { animation: pop 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.45s backwards; }
.motion .controls, .motion .cue { animation: fade 0.9s ease-out 1.3s backwards; }

@keyframes lamp { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; translate: 0 18px; scale: 0.97; } }
@keyframes burst { from { opacity: 0; transform: scale(0.45) rotate(-8deg); } }
@keyframes pop { from { opacity: 0; transform: scale(0.82); } }
@keyframes fade { from { opacity: 0; translate: 0 8px; } }

.foot {
  padding: 44px var(--gutter) max(44px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(207, 206, 196, 0.1);
  text-align: center;
  font: 400 0.875rem/1.6 var(--sans);
  color: var(--parchment-lo);
}
.foot p { max-width: 40em; margin: 0 auto; text-wrap: balance; }

@media (prefers-reduced-motion: reduce) {
  .model__poster { transition: none; }
}
