/* ───────────────────────────────────────────────────────────
   Public page — neumorphism
   ─────────────────────────────────────────────────────────── */
html, body {
  height: 100%;
  min-height: 100%;
  overflow: hidden; /* Ban page scroll / bounce */
  touch-action: pan-y;
}
body { background-color: var(--bg); background-image: linear-gradient(145deg, var(--bg) 0%, var(--bg-end) 100%); }

.theme-btn.float {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: 18px;
  z-index: 5;
}

.stage {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  height: 100%;
  min-height: 100svh;
  height: 100dvh;
  padding: max(3vh, env(safe-area-inset-top)) 22px max(3vh, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto; /* Allow internal scroll only if it overflows ("без фанатізму") */
  scrollbar-width: none;
}
.stage::before, .stage::after {
  content: "";
  margin: auto;
}
.stage::-webkit-scrollbar { display: none; }

.announcement {
  display: flex;
  align-items: center;
  height: 36px;
  width: min(100%, 470px);
  margin: 0 0 18px;
  overflow: hidden;
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--inset-sm);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.announcement-track {
  display: flex;
  align-items: center;
  height: 100%;
  width: max-content;
  gap: 64px;
  padding: 0;
  animation: marquee 18s linear infinite;
}
.announcement-track span {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

/* ── Profile ───────────────────────────────────────────── */
.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: min(36px, 4vh);
  flex: none;
}

.avatar {
  width: 132px;
  height: 132px;
  margin-bottom: min(28px, 3vh);
  padding: 6px;
  border: 2px solid var(--edge);
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 6px 6px 15px var(--sh-d), -6px -6px 15px color-mix(in srgb, var(--sh-l) 30%, transparent);
  animation: pop-in 0.45s var(--ease) both;
}
.avatar .well {
  width: 100%;
  height: 100%;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
}
.avatar picture {
  display: block;
  width: 100%;
  height: 100%;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  background: var(--bg);
  -webkit-user-drag: none;
  user-select: none;
}

.name {
  margin: 0;
  display: flex;
  justify-content: center;
  font-family: "League Gothic", var(--font);
  font-weight: 400;
  font-size: clamp(3.5rem, 15vw, 4.6rem);
  line-height: 1;
  letter-spacing: 0.02em;
}
.name span {
  display: inline-block;
  animation: letter-in 0.5s var(--ease) backwards;
  animation-delay: calc(0.12s + var(--d) * 0.028s);
}
.profile-sub { margin: 7px 0 0; color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }


/* ── Link cards ────────────────────────────────────────── */
.links {
  width: calc(100% + 16px);
  margin: -8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  --mx: 50%;
  --my: 50%;
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 16px 20px 16px 16px;
  border: 1px solid var(--edge);
  border-radius: 24px;
  background: var(--bg);
  box-shadow: 6px 6px 15px var(--sh-d), -6px -6px 15px color-mix(in srgb, var(--sh-l) 55%, transparent);
  overflow: visible;
  isolation: isolate;
  animation: card-in 0.5s var(--ease) backwards;
  animation-delay: calc(0.3s + var(--i) * 0.06s);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.card.card-hero {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--edge));
  background: color-mix(in srgb, var(--accent) 7%, var(--bg));
  box-shadow: 6px 6px 15px var(--sh-d), -6px -6px 15px color-mix(in srgb, var(--sh-l) 30%, transparent), 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}
.card.card-hero .card-icon,
.card.card-hero .card-arrow { color: var(--accent); }

/* cursor spotlight (neutral) */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  opacity: 0;
  background: radial-gradient(260px circle at var(--mx) var(--my), color-mix(in srgb, var(--text) 8%, transparent), transparent 65%);
  transition: opacity 0.25s var(--ease);
}

.card-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  color: var(--text);
  box-shadow: inset 2px 2px 6px var(--sh-d), inset -2px -2px 6px color-mix(in srgb, var(--sh-l) 30%, transparent);
  transition: color 0.2s var(--ease);
}
.card-icon svg { width: 26px; height: 26px; }

.card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; }
.card-status { align-self: flex-start; margin-bottom: 3px; padding: 3px 7px; border-radius: 999px; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); font-family: var(--mono); font-size: 9px; font-style: normal; font-weight: 700; letter-spacing: 0.08em; line-height: 1; text-transform: uppercase; }
.card-status.status-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.card-status.status-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.card-status.status-danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.card-text b {
  font-weight: 650;
  font-size: 18.5px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-text small {
  font-size: 14.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-arrow {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--muted);
  box-shadow: 3px 3px 8px var(--sh-d), -3px -3px 8px color-mix(in srgb, var(--sh-l) 30%, transparent);
  transition: transform 0.25s var(--ease), color 0.2s var(--ease), box-shadow 0.25s var(--ease), background 0.2s var(--ease);
}
.card-arrow svg { width: 16px; height: 16px; }

@media (hover: hover) {
  .card:hover {
    transform: translateY(-2px);
    box-shadow: 5px 5px 14px var(--sh-d), -5px -5px 14px color-mix(in srgb, var(--sh-l) 30%, transparent);
  }
  .card:hover::before { opacity: 1; }
  .card:hover .card-icon { color: var(--accent); }
  .card:hover .card-arrow { color: var(--accent-ink); background: var(--accent); transform: translate(2px, -2px); }
  .card.card-hero:hover { box-shadow: 6px 6px 15px var(--sh-d), -6px -6px 15px color-mix(in srgb, var(--sh-l) 30%, transparent), 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
}

.card:active {
  transform: scale(0.985);
  box-shadow: var(--inset);
  transition-duration: 0.1s;
}
.card:active .card-arrow { box-shadow: var(--inset-sm); color: var(--accent); background: color-mix(in srgb, var(--accent) 15%, transparent); }

/* A native context menu can leave :active pressed until it closes. */
body.context-menu-open .card:active {
  transform: none;
  box-shadow: var(--raise);
  transition-duration: 0.25s;
}
body.context-menu-open .card:active .card-arrow {
  transform: none;
  box-shadow: var(--raise-sm);
  color: var(--muted);
  background: transparent;
}
body.context-menu-open .theme-btn:active {
  transform: none;
  box-shadow: var(--raise-sm);
}
.card:focus-visible { outline-offset: 4px; border-radius: 24px; }

.foot {
  margin-top: min(46px, 5vh);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
  animation: rise 0.5s var(--ease) 0.7s backwards;
  flex: none;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border-radius: 24px;
  box-shadow: var(--inset);
}

@media (max-width: 480px) {
  .theme-btn.float {
    top: auto;
    right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
    width: 38px;
    height: 38px;
  }
  .stage {
    padding: max(2vh, env(safe-area-inset-top)) 16px max(2vh, env(safe-area-inset-bottom));
  }
  .profile { margin-bottom: min(28px, 3vh); }
  .announcement { height: 32px; margin-bottom: 14px; font-size: 9.5px; }
  .announcement-track { padding: 0; }
  .avatar {
    width: 104px;
    height: 104px;
    margin-bottom: min(20px, 2.5vh);
    padding: 5px;
  }
  .name { font-size: clamp(3rem, 14vw, 4rem); }
  .links { width: calc(100% + 10px); margin: -5px; padding: 5px; gap: 12px; }
  .card {
    gap: 12px;
    padding: 12px 16px 12px 12px;
    border-radius: 20px;
  }
  .card-icon { width: 44px; height: 44px; }
  .card-icon svg { width: 23px; height: 23px; }
  .card-text b { font-size: 16px; }
  .card-text small { font-size: 12.5px; }
  .card-arrow { width: 32px; height: 32px; }
  .card-arrow svg { width: 14px; height: 14px; }
  .foot { margin-top: min(32px, 4vh); font-size: 10px; }
}

/* ── Keyframes (transform + opacity only → stays 60fps) ── */
@keyframes pop-in { from { opacity: 0; transform: scale(0.92); } }
@keyframes letter-in { from { opacity: 0; transform: translateY(0.45em); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(0.98); } }
@keyframes eq { 0%, 100% { transform: scaleY(0.25); } 50% { transform: scaleY(1); } }
@keyframes marquee { to { transform: translateX(calc(-50% - 32px)); } }

@media (prefers-reduced-motion: reduce) {
  .announcement-track { animation: none; }
}

/* Custom Cursor */
@media (hover: hover) and (pointer: fine) {
  body.cursor-init,
  body.cursor-init *,
  body.has-custom-cursor,
  body.has-custom-cursor * {
    cursor: none !important;
  }
  .custom-cursor {
    position: fixed;
    top: 0; left: 0;
    width: 20px;
    height: 20px;
    background: var(--text);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 500;
    color: var(--bg);
    opacity: 0;
    will-change: transform;
    transition: width 0.3s var(--ease), height 0.3s var(--ease), border-radius 0.3s var(--ease), opacity 0.3s var(--ease);
    overflow: hidden;
  }
  .custom-cursor.is-visible { opacity: 0.9; }
  .custom-cursor .cursor-text {
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
    letter-spacing: -0.01em;
    font-family: var(--font);
    font-style: normal;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    margin-top: 1px; /* Optical centering adjustment for lowercase */
  }
  .custom-cursor.hover {
    width: 72px;
    height: 36px;
    border-radius: 20px;
  }
  .custom-cursor.hover.change-mode {
    width: 86px;
  }
  .custom-cursor.hover .cursor-text {
    opacity: 1;
    transition-delay: 0.1s;
  }
}

/* Disable text selection */
body {
  -webkit-user-select: none;
  user-select: none;
}
