/* Previous pixel font is kept at assets/fonts/userfont-pixel-backup.ttf.
   To bring it back, delete the @font-face below and use this instead:

@font-face {
  font-family: "UserFont";
  src: url("assets/fonts/userfont-pixel-backup.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
*/

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/fonts/space-grotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --fg: #c2b8b8;
  --bg: #080808;
  --font: "Space Grotesk", "Satoshi", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html,
body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- background ---------- */

.bg-image {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: url("assets/bg.webp") center center / cover no-repeat;
}

.bg-image .site-bg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

.bg-shade {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(0, 0, 0, 0.55);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- preloader ---------- */

.loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: #050505;
  cursor: pointer;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader:focus-visible {
  outline: 2px solid rgba(194, 184, 184, 0.45);
  outline-offset: -10px;
}

.enter-hint {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: rgba(194, 184, 184, 0.6);
  animation: hintPulse 2.4s ease-in-out infinite;
}

@keyframes hintPulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.9;
  }
}

.loader.is-done {
  opacity: 0;
  visibility: hidden;
}

.caret {
  width: 4px;
  height: 26px;
  background: #f2efef;
  border-radius: 1px;
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  0%,
  45% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

/* ---------- audio button ---------- */

.audio-btn {
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 15px;
  border: 2px solid rgba(6, 7, 6, 0.235);
  background: rgba(6, 7, 6, 0.26);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
  padding: 0;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.audio-btn:hover {
  background: rgba(20, 20, 20, 0.45);
  border-color: rgba(120, 120, 120, 0.25);
}

.audio-btn:active {
  transform: scale(0.95);
}

.audio-btn:focus-visible {
  outline: 2px solid rgba(194, 184, 184, 0.5);
  outline-offset: 3px;
}

.audio-btn .icon {
  width: 30px;
  height: 30px;
  grid-area: 1 / 1;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.audio-btn .icon-pause {
  width: 26px;
  height: 26px;
  opacity: 0;
  transform: scale(0.7);
}

.audio-btn.is-playing .icon-volume {
  opacity: 0;
  transform: scale(0.7);
}

.audio-btn.is-playing .icon-pause {
  opacity: 1;
  transform: scale(1);
}

.audio-btn .icon-volume {
  animation: speaker 2.6s ease-in-out infinite;
}

.audio-btn.is-playing .icon-volume {
  animation: none;
}

@keyframes speaker {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* ---------- page links ---------- */

.page-actions {
  position: fixed;
  right: 15px;
  bottom: 15px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.page-btn {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 15px;
  border: 2px solid rgba(6, 7, 6, 0.235);
  background: rgba(6, 7, 6, 0.26);
  color: var(--fg);
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.page-btn svg {
  width: 27px;
  height: 27px;
  display: block;
}

.page-btn:hover {
  background: rgba(20, 20, 20, 0.45);
  border-color: rgba(120, 120, 120, 0.25);
  transform: translateY(-1px);
}

.page-btn:active {
  transform: scale(0.95);
}

.page-btn:focus-visible {
  outline: 2px solid rgba(194, 184, 184, 0.5);
  outline-offset: 3px;
}

/* ---------- profile ---------- */

.profile {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 42px 16px;
  perspective: 1100px;
  perspective-origin: 50% 45%;
}

.tilt-box {
  padding: 26px 32px;
  transform-style: preserve-3d;
}

.card {
  position: relative;
  display: grid;
  grid-template-columns: 172px 170px;
  align-items: center;
  gap: 30px;
  padding: 10px 18px;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.card.is-tilting {
  transition: transform 0.12s linear;
}

.avatar-wrap,
.info {
  transform-style: preserve-3d;
}

.avatar,
.info {
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.card.is-tilting .avatar {
  transform: translateZ(58px);
}

.card.is-tilting .info {
  transform: translateZ(34px);
}

.avatar-wrap {
  width: 172px;
  height: 172px;
}

.avatar {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  user-select: none;
  -webkit-user-drag: none;
}

.info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.name {
  flex: none;
  font-size: 36px;
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: 0;
  color: var(--fg);
  text-shadow: 0 0 16.5px currentColor;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.name.is-typing::after {
  content: "";
  display: inline-block;
  width: 3px;
  height: 0.78em;
  margin-left: 5px;
  vertical-align: -0.02em;
  background: currentColor;
  animation: blink 1s steps(2, start) infinite;
}

.badges {
  flex: none;
  display: flex;
  align-items: center;
  gap: 5.5px;
  padding: 6px 10px;
  border-radius: 25px;
  border: 2px solid rgba(6, 7, 6, 0.04);
  background: rgba(6, 7, 6, 0.2);
}

.badge {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--fg);
  cursor: default;
  transform-origin: 50% 80%;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), color 0.25s ease,
    filter 0.25s ease;
}

.badge:hover {
  color: #f7f3f3;
  transform: translateY(-2px) scale(1.16);
  filter: drop-shadow(0 0 7px rgba(255, 255, 255, 0.28));
}

.badge svg {
  width: 20px;
  height: 20px;
  display: block;
}

.handle {
  display: inline-flex;
  align-items: center;
  height: 27px;
  font-size: 12px;
  font-weight: 550;
  line-height: 1;
  letter-spacing: 0.015em;
  color: rgba(194, 184, 184, 0.62);
  white-space: nowrap;
  overflow-wrap: anywhere;
}

.bio {
  font-size: 17px;
  font-weight: 570;
  line-height: 1.55;
  color: var(--fg);
  overflow-wrap: anywhere;
}

/* ---------- discord presence ---------- */

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.discord {
  display: inline-flex;
  align-items: center;
  height: 27px;
  gap: 6px;
  padding: 0 10px 0 8px;
  border-radius: 25px;
  border: 2px solid rgba(6, 7, 6, 0.04);
  background: rgba(6, 7, 6, 0.2);
  color: var(--fg);
  font-size: 12px;
  line-height: 1;
  cursor: default;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.discord:hover {
  background: rgba(20, 20, 20, 0.32);
  border-color: rgba(120, 120, 120, 0.2);
}

.icon-discord {
  width: 13px;
  height: 13px;
  display: block;
  flex: none;
  opacity: 0.85;
}

.discord-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #747f8d;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.discord-label {
  font-weight: 550;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.discord[data-status="online"] .discord-dot {
  background: #3ba55d;
  box-shadow: 0 0 7px rgba(59, 165, 93, 0.75);
}

.discord[data-status="idle"] .discord-dot {
  background: #f0b232;
  box-shadow: 0 0 7px rgba(240, 178, 50, 0.7);
}

.discord[data-status="dnd"] .discord-dot {
  background: #f23f43;
  box-shadow: 0 0 7px rgba(242, 63, 67, 0.7);
}

.discord[data-status="offline"] .discord-dot {
  background: #747f8d;
  box-shadow: none;
}

/* ---------- footer stats ---------- */

.meta {
  position: fixed;
  left: 20px;
  bottom: 22px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
  font-size: 13px;
  line-height: 1;
}

.stat {
  display: flex;
  align-items: center;
  gap: 5px;
}

.views {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  cursor: default;
}

.views .count {
  font-size: 14px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}

.icon-eye {
  width: 19px;
  height: 19px;
  display: block;
}

.icon-pin {
  width: 13px;
  height: 13px;
  display: block;
  flex: none;
}

.sep {
  opacity: 0.75;
}

/* ---------- hidden admin ---------- */

.admin {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.admin[hidden] {
  display: none;
}

.admin-panel {
  width: min(320px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: 18px;
  border: 1px solid rgba(194, 184, 184, 0.14);
  background: rgba(10, 10, 10, 0.94);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
}

.admin-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(194, 184, 184, 0.5);
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: rgba(194, 184, 184, 0.7);
}

.admin-field[hidden] {
  display: none;
}

.admin-field input,
.admin-field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(194, 184, 184, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
  font: inherit;
  font-size: 15px;
  outline: none;
}

.admin-field select {
  cursor: pointer;
}

.admin-field select option {
  background: #0a0a0a;
  color: var(--fg);
}

.admin-field input:focus,
.admin-field select:focus {
  border-color: rgba(194, 184, 184, 0.45);
}

.admin-field input[type="file"] {
  padding: 8px;
  font-size: 12px;
  color: rgba(194, 184, 184, 0.7);
  cursor: pointer;
}

.admin-field input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 6px 9px;
  border: 1px solid rgba(194, 184, 184, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.admin-submit {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(194, 184, 184, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.admin-submit:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(194, 184, 184, 0.32);
}

.admin-submit:active {
  transform: scale(0.99);
}

.admin-reset {
  background: transparent;
  color: rgba(194, 184, 184, 0.62);
  border-color: rgba(194, 184, 184, 0.12);
}

.admin-reset:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(228, 121, 111, 0.4);
  color: #e4796f;
}

.admin-hint {
  font-size: 11px;
  color: rgba(194, 184, 184, 0.45);
}

.admin-hint.is-error {
  color: #e4796f;
}

/* ---------- entrance ---------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  filter: blur(7px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--delay, 0) * 110ms);
}

body.is-ready .reveal {
  opacity: 1;
  transform: none;
  filter: blur(0);
}

.reveal[data-delay="0"] {
  --delay: 0;
}
.reveal[data-delay="1"] {
  --delay: 1;
}
.reveal[data-delay="2"] {
  --delay: 2;
}
.reveal[data-delay="3"] {
  --delay: 3;
}

/* ---------- responsive ---------- */

/* phones and other touch screens get a flat black backdrop instead of the
   photo, which crops to a green field in portrait */
@media (max-width: 640px), (hover: none) and (pointer: coarse) {
  .bg-image {
    background: var(--bg);
  }

  .bg-shade {
    background: rgba(0, 0, 0, 0.2);
  }
}

@media (max-width: 640px) {
  .profile {
    padding: calc(28px + env(safe-area-inset-top))
      calc(18px + env(safe-area-inset-right))
      calc(28px + env(safe-area-inset-bottom))
      calc(18px + env(safe-area-inset-left));
  }

  .tilt-box {
    padding: 16px 12px;
  }

  .card {
    width: 100%;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 22px;
    padding: 0;
    text-align: center;
  }

  .avatar-wrap {
    width: clamp(126px, 36vw, 150px);
    height: clamp(126px, 36vw, 150px);
  }

  .avatar {
    border-radius: 50%;
    -webkit-touch-callout: none;
  }

  .info {
    width: 100%;
    align-items: center;
  }

  .name-row {
    justify-content: center;
    gap: 9px;
  }

  .name {
    font-size: clamp(28px, 9vw, 32px);
  }

  .handle {
    font-size: 12px;
  }

  .bio {
    font-size: 15px;
  }

  .status-row {
    justify-content: center;
  }

  .meta {
    left: calc(16px + env(safe-area-inset-left));
    right: calc(88px + env(safe-area-inset-right));
    bottom: calc(16px + env(safe-area-inset-bottom));
    gap: 7px;
    font-size: 12px;
    flex-wrap: wrap;
  }

  .page-actions {
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom));
    gap: 8px;
  }

  .page-btn {
    width: 52px;
    height: 52px;
    border-radius: 13px;
  }

  .page-btn svg {
    width: 23px;
    height: 23px;
  }

  .views .count {
    font-size: 13px;
  }

  .audio-btn {
    top: calc(12px + env(safe-area-inset-top));
    left: calc(12px + env(safe-area-inset-left));
    width: 52px;
    height: 52px;
    border-radius: 13px;
  }

  .audio-btn .icon {
    width: 26px;
    height: 26px;
  }
}

/* short screens: phones in landscape */
@media (max-width: 640px) and (max-height: 560px) {
  .profile {
    padding: calc(10px + env(safe-area-inset-top))
      calc(12px + env(safe-area-inset-right))
      calc(10px + env(safe-area-inset-bottom))
      calc(12px + env(safe-area-inset-left));
  }

  .tilt-box {
    padding: 0;
  }

  .card {
    gap: 12px;
  }

  .avatar-wrap {
    width: 104px;
    height: 104px;
  }

  .name {
    font-size: 26px;
  }

  .handle {
    font-size: 11px;
  }

  .bio {
    font-size: 14px;
  }

  .discord {
    margin-top: 2px;
    padding: 4px 8px 4px 7px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }

  .caret,
  .audio-btn .icon-volume,
  .enter-hint {
    animation: none;
  }

  .card,
  .avatar,
  .info {
    transform: none !important;
    transition: none;
  }

  .card::before {
    display: none;
  }}
