
/* Theme tokens. config.json -> theme.* overrides these at runtime (script.js). */
:root {
  --accent: #ffffff;
  --overlay: 0.3;
  --glass-blur: 28px;
  --card-radius: 32px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #05060a;
  color: #fff;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* Safari refuses to type into fields when an ancestor has user-select: none. */
input,
textarea {
  -webkit-user-select: text;
  user-select: text;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

img {
  -webkit-user-drag: none;
}


#wallpapers img,
#reveal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

#wallpapers img,
#reveal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  will-change: clip-path;
  transform: translateZ(0);
}

#vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  background: rgba(0, 0, 0, var(--overlay));
  pointer-events: none;
}


#mute-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 30;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 9999px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease, background 0.2s ease;
}

body.entered #mute-btn {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#mute-btn img {
  width: 20px;
  height: 20px;
  filter: invert(1);
}


#intro {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(32px);
  cursor: wait;
  transition: opacity 0.5s ease;
}

#intro.is-ready {
  cursor: pointer;
}

#intro.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.intro-label {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.intro-pulse {
  animation: intro-pulse 1.8s ease-in-out infinite;
}

@keyframes intro-pulse {
  0%,
  100% {
    opacity: 0.85;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}


#content {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100vh;
  display: block;
  padding: 0;
  opacity: 0;
  transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

body.entered #content {
  opacity: 1;
}

#cards-container {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: visible;
}

.card-section {
  position: fixed;
  left: 50%;
  top: 50%;
  /* One transform keeps centering and section travel in the same coordinate system. */
  transform: translate3d(-50%, calc(-50% + var(--card-y, 0px)), 0) perspective(1200px) scale(var(--scale, 1)) rotateX(var(--rot-x, 0deg)) rotateY(var(--rot-y, 0deg));
  width: 100%;
  max-width: 28rem;
  padding: 32px;
  border-radius: var(--card-radius);
  text-align: center;
  will-change: transform, opacity;
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  /* entrance variables */
  --enter-offset: 18px;
  --scale: 0.98;
  opacity: 0;
  pointer-events: auto;
}

.card-section.active {
  --card-y: var(--enter-offset, 0px);
  --scale: 1;
  --rot-x: 0deg;
  --rot-y: 0deg;
  opacity: 1;
  z-index: 20;
  pointer-events: auto;
}

.card-section.prev {
  --card-y: calc(-100vh - 24px);
  --scale: 0.98;
  --rot-x: 0deg;
  --rot-y: 0deg;
  opacity: 0.12;
  z-index: 10;
  pointer-events: none;
}

.card-section.next {
  --card-y: calc(100vh + 24px);
  --scale: 0.98;
  --rot-x: 0deg;
  --rot-y: 0deg;
  opacity: 0.12;
  z-index: 10;
  pointer-events: none;
}

/* when the page is entered, animate the active card into place */
body.entered .card-section.active {
  --enter-offset: 0px;
  --scale: 1;
}

/* About / inbox card tweaks */
.about-header h2,
.inbox-header h2 {
  margin: 0 0 6px 0;
  font-size: 1.3rem;
  font-weight: 700;
}
.about-text {
  margin: 0;
  color: rgba(255,255,255,0.86);
  font-size: 0.95rem;
  line-height: 1.45;
}
.inbox-button {
  margin-top: 10px;
  padding: 10px 14px;
  font-weight: 700;
}

/* Hide the scroll hint once you are on the last card (toggled from script.js). */
#bottom-note.is-hidden {
  opacity: 0;
}

/* Navigation dots (right side) */
#nav-dots {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}
.nav-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.12);
  transition: transform 0.28s cubic-bezier(0.16,1,0.3,1), background 0.28s ease;
  cursor: pointer;
}
.nav-dot.is-active {
  background: var(--accent);
  transform: scale(1.25);
}

/* Bottom subtle note */
#bottom-note {
  transition: opacity 0.4s ease;
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.36);
  font-size: 0.85rem;
  z-index: 40;
  pointer-events: auto;
}


.liquid-glass {
  position: relative;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.22) 0%,
    rgba(255, 255, 255, 0.08) 55%,
    rgba(255, 255, 255, 0.14) 100%
  );
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow:
    0 20px 60px -20px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}

.liquid-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.7),
    rgba(255, 255, 255, 0) 40%,
    rgba(255, 255, 255, 0) 60%,
    rgba(255, 255, 255, 0.35)
  );
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

/* Keep navigated cards anchored to the viewport, not the glass component flow. */
.liquid-glass.card-section {
  position: fixed;
}

.glass-chip {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(14px) saturate(160%);
  color: #fff;
}

.glass-chip:hover {
  background: rgba(255, 255, 255, 0.22);
}


.profile-card {
  width: 100%;
  max-width: 28rem;
  padding: 32px;
  border-radius: var(--card-radius);
  text-align: center;
}

.profile-card > * {
  position: relative;
  z-index: 1;
}

.profile-card h1 {
  margin: 20px 0 0;
  font-size: 1.875rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
}

.avatar-ring {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  margin: 0 auto;
  padding: 3px;
  border-radius: 9999px;
  background: conic-gradient(
    from 180deg,
    rgba(255, 255, 255, 0.95),
    rgba(255, 255, 255, 0.15),
    rgba(255, 255, 255, 0.75),
    rgba(255, 255, 255, 0.15),
    rgba(255, 255, 255, 0.95)
  );
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.35);
}

.avatar-ring img {
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  object-fit: cover;
}


#links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.link-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  color: #fff;
  transition: background 0.2s ease, transform 0.35s ease;
}

.link-item img {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 6px;
  object-fit: contain;
}


.profile-card,
.link-item {
  isolation: isolate;

  --pointer-x: 50%;
  --pointer-y: 50%;
  --rot-x: 0deg;
  --rot-y: 0deg;
  --scale: 1;

  transform-style: preserve-3d;
}

/* link items should use the perspective/tilt but without translate centering */
.link-item {
  transform: perspective(1200px) scale(var(--scale)) rotateX(var(--rot-x)) rotateY(var(--rot-y));
}

.profile-card.is-glowing,
.link-item.is-glowing {
  box-shadow:
    0 30px 80px -20px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.15);
}

.profile-card::after,
.link-item::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    320px circle at var(--pointer-x) var(--pointer-y),
    rgba(255, 255, 255, 0.35),
    transparent 65%
  );
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  mix-blend-mode: overlay;
  z-index: 0;
}

.profile-card.is-glowing::after,
.link-item.is-glowing::after {
  opacity: 1;
}


body.entered .music-island {
  opacity: 1;
  pointer-events: auto;
  translate: -50% 0;
}

@keyframes island-float {
  0%,
  100% {
    translate: -50% 0;
  }
  50% {
    translate: -50% -6px;
  }
}

.music-island {
  position: fixed;
  z-index: 30;

  left: 50%;
  bottom: 5vh;

  translate: -50% 0;
  scale: 1;

  display: flex;
  align-items: center;
  gap: 12px;

  width: min(340px, calc(100vw - 32px));
  padding: 12px;
  border-radius: 24px;

  opacity: 0;
  pointer-events: none;

  animation: island-float 6s ease-in-out infinite;

  transition:
    opacity 1.2s ease,
    scale 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.music-island:hover {
  scale: 1.04;
  filter: brightness(1.08);
}

.music-cover-tile {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 16px;
  font-size: 1.125rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.music-cover-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.music-cover-tile.is-spinning {
  animation: none 
}

.island-meta {
  flex: 1;
  min-width: 0;
}

.track-title,
.track-artist,
.track-next {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-title {
  font-size: 0.875rem;
  font-weight: 700;
}

.track-artist {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
}

.track-next {
  margin-top: 2px;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.4);
}

.island-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.island-controls button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 9999px;
  font-size: 0.875rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.island-controls button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.island-controls button:active {
  transform: scale(0.9);
}

.island-controls button.is-active {
  background: var(--accent);
  color: #000;
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent);
}


/* ------------------------------------------------------------------
   Inbox card: Whispr link button, or a native form that delivers through /api/message
   ------------------------------------------------------------------ */
.inbox-subtitle {
  margin: 0 0 14px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
}

.inbox-form[hidden],
.inbox-link-mode[hidden] {
  display: none;
}

.inbox-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.inbox-field {
  position: relative;
}

#inbox-input {
  display: block;
  width: 100%;
  min-height: 112px;
  padding: 14px 14px 28px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.45;
  resize: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

#inbox-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

#inbox-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.inbox-count {
  position: absolute;
  right: 14px;
  bottom: 9px;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.45);
  pointer-events: none;
}

.inbox-count.is-near-limit {
  color: #ffb4a8;
}

.inbox-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inbox-open-link {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

.inbox-open-link:hover,
.inbox-open-link.is-emphasis {
  color: #fff;
}

.inbox-button {
  margin: 0;
  padding: 10px 22px;
  border-radius: 9999px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease, opacity 0.2s ease;
}

.inbox-button-wide {
  display: inline-block;
  padding: 13px 30px;
  text-decoration: none;
  font-size: 1rem;
}

.inbox-link-mode {
  margin-top: 6px;
}

.inbox-button:active {
  transform: scale(0.96);
}

.inbox-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.inbox-status {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.8rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
}

.inbox-status.is-ok {
  color: #9be9a8;
}

.inbox-status.is-error {
  color: #ffb4a8;
}

/* Honeypot: off-screen rather than display:none so naive bots still fill it. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Last.fm "now playing" chip under the tagline */
.now-playing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin-top: 10px;
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.now-playing[hidden] {
  display: none;
}

.now-playing span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.now-playing::before {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
}

.now-playing.is-live::before {
  background: #4ade80;
  animation: np-pulse 1.6s ease-in-out infinite;
}

@keyframes np-pulse {
  50% {
    opacity: 0.35;
  }
}

/* Short screens: tighten the profile card and lift the cards so the music island never covers a link. */
@media (max-height: 860px) {
  .card-section {
    top: calc(50% - 30px);
  }

  .profile-card {
    padding-block: 24px;
  }

  .profile-card h1 {
    margin-top: 14px;
  }

  .avatar-ring {
    width: 96px;
    height: 96px;
  }

  #links {
    gap: 8px;
    margin-top: 16px;
  }

  .link-item {
    padding: 9px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .music-island,
  .intro-pulse,
  .now-playing.is-live::before,
  .music-cover-tile.is-spinning {
    animation: none;
  }
}

@media (max-width: 600px) {
  .profile-card,
  .about-card,
  .inbox-card {
    max-width: 100%;
    padding: 24px;
  }

  /* 16px+ stops iOS from zooming the page when the textarea is focused */
  #inbox-input {
    font-size: 1rem;
  }

  .music-island {
    width: calc(100vw - 32px);
    bottom: 16px;
  }

  .music-island:hover {
    scale: 1.02;
  }

  .track-next {
    display: none;
  }

  /* Mobile: ensure cards are centered and scaled properly */
  .card-section {
    left: 50%;
    top: calc(50% - 36px);
    max-width: calc(100% - 32px);
    padding: 20px;
    border-radius: 20px;
    transform: translate3d(-50%, calc(-50% + var(--card-y, 0px)), 0) perspective(1200px) scale(var(--scale, 0.98)) rotateX(var(--rot-x, 0deg)) rotateY(var(--rot-y, 0deg));
    transition: transform 0.6s cubic-bezier(0.16,1,0.3,1), opacity 0.45s ease;
    max-height: calc(100vh - 140px);
    overflow: auto;
  }

  .card-section.prev {
    --card-y: calc(-100vh - 24px);
    --scale: 0.96;
  }

  .card-section.next {
    --card-y: calc(100vh + 24px);
    --scale: 0.96;
  }

  /* Move navigation dots slightly inward so they don't overlap edges */
  #nav-dots { right: 12px; }

  /* Keep bottom note above the music island */
  #bottom-note { bottom: 84px; }
}