/* ============================================================
   Link-in-bio page — pixel-matched to link.me profile layout
   ============================================================ */

:root {
  --card-w: 566px;
  --radius: 30px;
  --tile-radius: 12px;
  --gap: 14px;
  --text: #fff;
  --muted: rgba(255, 255, 255, .72);
  --verified: #1d9bf0;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  overflow-y: scroll;
  scrollbar-width: none;
  -webkit-text-size-adjust: 100%;
}
html::-webkit-scrollbar { display: none; }

body {
  margin: 0;
  min-height: 100svh;
  background: #000;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding: 24px 0 40px;
}

/* ---------- размытый фон из аватарки ---------- */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: #0a0a0a;
}
.page-bg__img {
  position: absolute;
  inset: -12%;
  background-position: center;
  background-size: cover;
  filter: blur(46px) saturate(1.25) brightness(.62);
  transform: scale(1.12);
}
.page-bg__shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(0, 0, 0, .12) 0%, rgba(0, 0, 0, .55) 55%, #000 100%),
    linear-gradient(180deg, rgba(0, 0, 0, .35) 0%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, .5) 78%, #000 100%);
}

/* ---------- карточка ---------- */
.card {
  position: relative;
  width: min(var(--card-w), 100%);
  margin: 0 auto;
  border-radius: var(--radius);
  background: #000;
  box-shadow: 0 1px 10px 2px rgba(0, 0, 0, .5);
  overflow: hidden;
  isolation: isolate;
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  aspect-ratio: 566 / 546;
  background: #111;
  overflow: hidden;
}
.hero__img {
  position: absolute;
  inset: 0;
  background-position: center top;
  background-size: cover;
  background-repeat: no-repeat;
  transition: transform .6s cubic-bezier(.22, .61, .36, 1);
}
.hero__img.is-placeholder {
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 90% at 20% 0%, #2b2b36 0%, #14141a 55%, #0a0a0d 100%);
}
.hero__img.is-placeholder::after {
  content: attr(data-initials);
  font-size: clamp(72px, 18vw, 132px);
  font-weight: 800;
  letter-spacing: -.03em;
  color: rgba(255, 255, 255, .10);
}
.hero__shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .34) 0%, rgba(0, 0, 0, 0) 24%),
    linear-gradient(180deg, rgba(0, 0, 0, 0) 38%, rgba(0, 0, 0, .62) 72%, rgba(0, 0, 0, .95) 100%);
  pointer-events: none;
}
.hero__meta {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  text-align: center;
}
.name {
  margin: 0;
  font-size: 32px;
  line-height: 1.18;
  font-weight: 750;
  letter-spacing: .25px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .45);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}
.name__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.verified {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  color: var(--verified);
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, .4));
}
.handle {
  margin-top: 2px;
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .5);
}

/* ---------- тело карточки ---------- */
.body { padding: 14px 0 18px; }

.socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}
.social {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #1b1b1f;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
  -webkit-tap-highlight-color: transparent;
}
.social svg { width: 23px; height: 23px; display: block; }
.social:hover { transform: translateY(-2px) scale(1.06); filter: brightness(1.08); }
.social:active { transform: scale(.96); }

/* брендовые заливки иконок */
.social[data-brand="telegram"] { background: linear-gradient(160deg, #37b1e4, #1f8fc4); }
.social[data-brand="instagram"] {
  background:
    radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285aeb 90%);
}
.social[data-brand="tiktok"] { background: #0b0b0d; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.social[data-brand="snapchat"] { background: #fffc00; color: #111; }
.social[data-brand="youtube"] { background: #ff0033; }
.social[data-brand="twitch"] { background: #9146ff; }
.social[data-brand="x"] { background: #000; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); }
.social[data-brand="wechat"] { background: linear-gradient(160deg, #2dd66f, #07c160); }
.social[data-brand="default"] { background: #26262b; }

/* ---------- пилюля подписчиков ---------- */
.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: calc(100% - 28px);
  margin: 14px auto 0;
  padding: 4px 14px;
  border: 0;
  border-radius: 9999px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  background-color: transparent;
  -webkit-tap-highlight-color: transparent;
  background-image: linear-gradient(rgba(255, 255, 255, .06), rgba(255, 255, 255, .09));
  backdrop-filter: blur(10px) saturate(1.3);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  box-shadow:
    0 8px 24px 0 rgba(0, 0, 0, .12),
    0 0 0 .5px rgba(255, 255, 255, .06),
    -1.25px 0 0 rgba(255, 255, 255, .06);
  transition: background-image .2s ease, transform .15s ease;
}
.pill:hover { background-image: linear-gradient(rgba(255, 255, 255, .1), rgba(255, 255, 255, .13)); }
.pill:active { transform: scale(.97); }
.pill b { font-weight: 700; margin-right: 2px; }
.pill svg { width: 16px; height: 16px; opacity: .85; transition: transform .25s ease; }
.pill[aria-expanded="true"] svg { transform: rotate(180deg); }

/* ---------- био-строка ---------- */
.bio {
  margin: 10px 16px 14px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, .9);
}
.bio:empty { display: none; }

/* ---------- сетка тайлов ---------- */
.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  padding: 0 14px;
}

.tile {
  position: relative;
  display: block;
  aspect-ratio: 262 / 151;
  border-radius: var(--tile-radius);
  overflow: hidden;
  text-decoration: none;
  color: #fff;
  background: #101014;
  transform: translateZ(0);
  transition: transform .22s cubic-bezier(.22, .61, .36, 1), box-shadow .22s ease;
  -webkit-tap-highlight-color: transparent;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, .45); }
.tile:active { transform: scale(.985); }

.tile__media {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  transition: transform .5s cubic-bezier(.22, .61, .36, 1);
}
.tile:hover .tile__media { transform: scale(1.05); }

/* тайл без картинки: фирменный градиент + водяной знак */
.tile__media.is-plain {
  background:
    radial-gradient(130% 130% at 15% 0%, var(--accent, #2a2a33) 0%, color-mix(in srgb, var(--accent, #2a2a33) 38%, #050507) 45%, #08080b 100%);
}
.tile__watermark {
  position: absolute;
  right: -18px;
  bottom: -22px;
  width: 132px;
  height: 132px;
  color: rgba(255, 255, 255, .18);
  pointer-events: none;
  display: none;
}
.tile__media.is-plain ~ .tile__watermark { display: block; }.tile__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 32%, rgba(0, 0, 0, .18) 55%, rgba(0, 0, 0, .72) 100%);
  pointer-events: none;
}
.tile__badge {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #fff;
  color: #111;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
  transition: transform .22s cubic-bezier(.22, .61, .36, 1);
}
.tile:hover .tile__badge { transform: scale(1.06) rotate(-3deg); }
.tile__badge svg { width: 22px; height: 22px; display: block; }
.tile__label {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 9px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .1px;
  line-height: 1.2;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .75), 0 0 2px rgba(0, 0, 0, .6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- футер ---------- */
.footer {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, .55);
}
.footer a, .footer button {
  color: inherit;
  text-decoration: none;
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.footer a:hover, .footer button:hover { color: rgba(255, 255, 255, .85); text-decoration: underline; }
.footer .sep { opacity: .5; }

/* карточка не должна перекрывать шторку */
.card { position: relative; z-index: 1; }

/* ---------- замок 18+ на плитке ---------- */
.tile.is-gated { cursor: default; }
.tile.is-gated .tile__media,
.tile.is-gated .tile__watermark {
  filter: blur(26px);
  transform: scale(1.12);
}
.tile.is-gated .tile__label { opacity: 0; }
.tile.is-gated .tile__shade {
  background: linear-gradient(180deg, rgba(0, 0, 0, .18) 0%, rgba(0, 0, 0, .42) 100%);
}

.tile__gate {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px;
  text-align: center;
  animation: gateIn .18s ease-out both;
}
@keyframes gateIn {
  from { opacity: 0; transform: scale(.97); }
  to { opacity: 1; transform: scale(1); }
}
.tile__gate svg {
  width: 25px;
  height: 19px;
  color: #fff;
  flex: 0 0 auto;
}
.tile__gate-text {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  color: #fff;
}
.tile__gate-btn {
  min-width: 96px;
  min-height: 32px;
  padding: 8px 24px;
  border: 0;
  border-radius: 25px;
  background: #fff;
  color: #000;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s ease, background .15s ease;
}
.tile__gate-btn:hover { background: #f2f2f2; }
.tile__gate-btn:active { transform: scale(.95); }

/* ---------- шторка Total Followers ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .25s ease;
}
.sheet-backdrop.is-open { opacity: 1; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 130;
  width: min(var(--card-w), 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border-radius: 24px 24px 0 0;
  background: rgba(28, 28, 30, .55);
  backdrop-filter: blur(28px) saturate(1.8);
  -webkit-backdrop-filter: blur(28px) saturate(1.8);
  box-shadow:
    0 -12px 40px 0 rgba(0, 0, 0, .16),
    0 -1px 3px 0 rgba(0, 0, 0, .08),
    inset 0 1px 0 0 rgba(255, 255, 255, .28),
    inset 0 0 0 .5px rgba(255, 255, 255, .1);
  color: #fff;
  transform: translate(-50%, 100%);
  will-change: transform;
  transition: transform .3s cubic-bezier(.22, .61, .36, 1);
}
.sheet.is-open { transform: translate(-50%, 0); }

/* hidden должен побеждать display:flex */
.sheet[hidden],
.sheet-backdrop[hidden] { display: none; }

.sheet__handle {
  width: 32px;
  height: 5px;
  margin: 16px auto;
  flex: 0 0 auto;
  border-radius: 16px;
  background: #e2e2e4;
  cursor: grab;
}
.sheet__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 16px 16px;
}
.sheet__title {
  margin: 0;
  padding: 0 25px 14px;
  text-align: center;
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  color: #fff;
}
.sheet__title b { font-weight: 600; margin-right: 4px; }

.sheet__rows {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .2) transparent;
}
.sheet__rows::-webkit-scrollbar { width: 6px; }
.sheet__rows::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .2);
  border-radius: 3px;
}

.frow {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 20px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.frow:last-child { margin-bottom: 4px; }
.frow:hover .frow__name { text-decoration: underline; }

.frow__avatar {
  position: relative;
  width: 45px;
  height: 45px;
  flex: 0 0 auto;
}
.frow__img {
  display: block;
  width: 45px;
  height: 45px;
  border-radius: 999px;
  background-color: #2c2c2e;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}
.frow__img.is-initials {
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
  color: rgba(255, 255, 255, .75);
}
.frow__badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px rgba(24, 24, 26, .92);
}
.frow__badge svg { width: 11px; height: 11px; display: block; }

.frow__text {
  display: flex;
  flex-direction: column;
  margin-left: 8px;
  margin-top: 4px;
  min-width: 0;
}
.frow__name {
  font-size: 15px;
  line-height: 21px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.frow__count {
  font-size: 15px;
  line-height: 21px;
  font-weight: 400;
  opacity: .5;
}
.frow__count span { margin-left: 4px; }

body.is-locked,
html.is-locked { overflow: hidden; }

/* ---------- мобильная раскладка ---------- */
@media (max-width: 600px) {
  body { padding: 0 0 env(safe-area-inset-bottom); }
  .card {
    width: 100%;
    border-radius: 0;
    box-shadow: none;
  }
  .hero { aspect-ratio: 1 / 1.03; }
  .name { font-size: 28px; }
  .handle { font-size: 15px; }
  .social { width: 36px; height: 36px; }
  .social svg { width: 21px; height: 21px; }
  .socials { gap: 8px; }
  .body { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
