:root {
  --color-page-bg: #f6f3eb;
  /* Cream background matching screenshot */
  --color-outer-bg: #ebdcc9;
  /* Soft tan for desktop mock frame background */
  --color-card-bg: #e6d5c3;
  /* Tan color for buttons */
  --color-card-hover: #7b573c;
  /* Rich chocolate brown matching portrait shirt on hover */
  --color-text-main: #121212;
  /* Solid black/charcoal for text */
  --color-text-card: #2c2620;
  /* Dark brown/charcoal for card text */
  --color-glass-bg: rgba(0, 0, 0, 0.25);
  --color-glass-border: rgba(255, 255, 255, 0.2);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ease-spring: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html,
body {
  width: 100%;
  height: 100%;
  font-family: var(--font-family);
  background-color: var(--color-outer-bg);
  color: var(--color-text-main);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Flex layout to center the mobile profile container on desktop */
body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
}

/* The central link page container */
.profile-shell {
  position: relative;
  width: 100%;
  max-width: 430px;
  min-height: calc(100vh - 48px);
  max-height: 90vh;
  border-radius: 32px;
  background-color: var(--color-page-bg);
  box-shadow:
    0 24px 74px rgba(44, 38, 32, 0.16),
    0 0 0 1px rgba(44, 38, 32, 0.04);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: none;
  /* Hide scrollbar for Firefox */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.profile-shell::-webkit-scrollbar {
  display: none;
}

/* --- Hero Banner Section --- */
.hero {
  position: relative;
  width: 100%;
  height: clamp(290px, 68vw, 360px);
  flex-shrink: 0;
}

.hero-art {
  position: absolute;
  inset: 0;
  background:
    url("assets/hero-portrait.png") center top / cover no-repeat;
}

/* Soft blend from cat image to cream background */
.hero-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 70%, var(--color-page-bg) 100%);
  pointer-events: none;
}

.top-bar {
  position: absolute;
  top: calc(20px + env(safe-area-inset-top, 0px));
  left: calc(20px + env(safe-area-inset-left, 0px));
  right: calc(20px + env(safe-area-inset-right, 0px));
  display: flex;
  justify-content: flex-end; /* Top left Linktree logo is removed, per request */
  z-index: 10;
}

/* Glass share button top right */
.top-action-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--color-glass-border);
  background-color: var(--color-glass-bg);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.2s var(--ease-spring), background-color 0.2s ease;
}

.top-action-btn:hover {
  transform: scale(1.06);
  background-color: rgba(0, 0, 0, 0.35);
}

.top-action-btn:active {
  transform: scale(0.96);
}

.top-action-btn i {
  font-size: 18px;
  line-height: 1;
}

/* --- Profile Info & Text Section --- */
.profile-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 24px;
  margin-top: 6px;
  text-align: center;
  z-index: 5;
  flex-shrink: 0;
}

.handle {
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text-main);
  margin-bottom: 12px;
}

.description {
  font-size: 1.02rem;
  line-height: 1.48;
  font-weight: 500;
  color: var(--color-text-main);
  margin-bottom: 24px;
}

/* --- Social Icons Grid --- */
.social-grid {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}

.social-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.social-row a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: var(--color-text-main);
  text-decoration: none;
  font-size: 30px;
  line-height: 1;
  transition: transform 0.2s var(--ease-spring), opacity 0.2s ease;
}

.social-row a:hover {
  transform: translateY(-3px) scale(1.08);
}

.social-row a:active {
  transform: scale(0.95);
}

/* --- Featured Link Cards --- */
.links-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 16px 36px 16px;
  flex-grow: 1;
}

/* Custom wrapper for links to isolate click bounds between main link and options button */
.link-card-wrapper {
  position: relative;
  width: 100%;
  border-radius: 18px;
  background-color: var(--color-card-bg);
  box-shadow:
    0 4px 14px rgba(44, 38, 32, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  min-height: 72px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.02);
  transition:
    transform 0.25s var(--ease-spring),
    box-shadow 0.25s ease,
    background-color 0.25s ease;
}

.link-card-wrapper:hover {
  transform: translateY(-3px);
  background-color: var(--color-card-hover);
  box-shadow:
    0 8px 20px rgba(44, 38, 32, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.link-card-wrapper:active {
  transform: translateY(-1px);
}

/* The diagonal shine overlay */
.link-card-wrapper::after {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  width: 80%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.35) 30%,
      rgba(255, 255, 255, 0.6) 50%,
      rgba(255, 255, 255, 0.35) 70%,
      transparent);
  transform: skewX(-25deg);
  pointer-events: none;
}

/* Custom looping animation delay for shine effects */
.link-card-wrapper.animate-shine::after {
  animation: shine-sweep 5.5s infinite ease-in-out;
}

.link-card-wrapper:nth-child(2).animate-shine::after {
  animation-delay: 1.8s;
}

/* Trigger a sweeping shine on hover immediately */
.link-card-wrapper:hover::after {
  animation: shine-sweep-once 0.9s ease-out;
}

@keyframes shine-sweep {
  0% {
    left: -150%;
  }

  18% {
    left: 150%;
  }

  100% {
    left: 150%;
  }
}

@keyframes shine-sweep-once {
  0% {
    left: -150%;
  }

  100% {
    left: 150%;
  }
}

/* Main anchor spanning the card */
.link-card {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Center text within card boundaries */
  text-decoration: none;
  padding: 10px 14px;
  position: relative;
  z-index: 2;
  cursor: pointer;
}

.link-thumb {
  position: absolute;
  left: 10px;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.link-title {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--color-text-card);
  text-align: center;
  padding-left: 56px;
  padding-right: 36px;
  /* Avoid collision with options button on the right */
  line-height: 1.25;
  transition: color 0.2s ease;
}

/* Vertical ellipsis actions button */
.options-btn {
  position: absolute;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background-color: transparent;
  color: var(--color-text-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: background-color 0.2s ease, transform 0.2s var(--ease-spring), color 0.2s ease;
}

.options-btn:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

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

.link-card-wrapper:hover .link-title {
  color: var(--color-page-bg);
}

.link-card-wrapper:hover .options-btn {
  color: var(--color-page-bg);
}

.options-btn i {
  font-size: 20px;
  line-height: 1;
}

/* --- Footer --- */
.profile-footer {
  text-align: center;
  padding: 12px 24px 24px 24px;
  font-size: 0.76rem;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.4);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

/* --- Skeleton Loading States --- */
.skeleton-container {
  position: absolute;
  inset: 0;
  background-color: var(--color-page-bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  border-radius: 32px;
  overflow: hidden;
  pointer-events: all;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.skeleton-container.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.skeleton-banner {
  width: 100%;
  height: clamp(290px, 68vw, 360px);
  background-color: #ebdcc9;
}

.skeleton-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-grow: 1;
}

.skeleton-username {
  width: 130px;
  height: 30px;
  background-color: var(--color-card-bg);
  border-radius: 8px;
  margin-top: -12px;
  margin-bottom: 16px;
}

.skeleton-line {
  height: 14px;
  background-color: var(--color-card-bg);
  border-radius: 6px;
  margin-bottom: 8px;
}

.skeleton-line-lg {
  width: 85%;
}

.skeleton-line-sm {
  width: 60%;
  margin-bottom: 24px;
}

.skeleton-socials {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.skeleton-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--color-card-bg);
}

.skeleton-card {
  width: 100%;
  height: 72px;
  border-radius: 18px;
  background-color: var(--color-card-bg);
  margin-bottom: 14px;
}

@keyframes skeleton-pulse {
  0% {
    opacity: 0.5;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.5;
  }
}

.skeleton-banner,
.skeleton-username,
.skeleton-line,
.skeleton-circle,
.skeleton-card {
  animation: skeleton-pulse 1.4s infinite ease-in-out;
}

/* --- Reveal/Float-in Animations --- */
.motion-item {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.65s var(--ease-smooth),
    transform 0.65s var(--ease-smooth);
}

.is-loaded .motion-item {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger transition delay list */
.is-loaded .profile-info .motion-item:nth-child(1) {
  transition-delay: 50ms;
}

.is-loaded .profile-info .motion-item:nth-child(2) {
  transition-delay: 150ms;
}

.is-loaded .social-grid.motion-item {
  transition-delay: 250ms;
}

.is-loaded .links-list .motion-item:nth-child(1) {
  transition-delay: 380ms;
}

.is-loaded .links-list .motion-item:nth-child(2) {
  transition-delay: 480ms;
}

.is-loaded .profile-footer.motion-item {
  transition-delay: 580ms;
}

/* --- Options Dialog / Bottom Drawer Modal --- */
.options-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.options-modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(44, 38, 32, 0.4);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 430px;
  background-color: var(--color-page-bg);
  border-radius: 24px 24px 0 0;
  padding: 24px 20px 32px 20px;
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.12);
  transform: translateY(100%);
  transition: transform 0.3s var(--ease-spring);
}

.options-modal.active .modal-content {
  transform: translateY(0);
}

.modal-content h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--color-text-main);
  text-align: center;
  margin-bottom: 20px;
}

.modal-item {
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  border: none;
  background-color: rgba(0, 0, 0, 0.04);
  color: var(--color-text-main);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.modal-item:hover {
  background-color: rgba(0, 0, 0, 0.08);
}

.modal-item:active {
  transform: scale(0.99);
}

.modal-item.cancel {
  background-color: var(--color-card-bg);
  color: var(--color-text-card);
  margin-bottom: 0;
}

.modal-item.cancel:hover {
  background-color: var(--color-card-hover);
  color: var(--color-page-bg);
}

/* --- Toast Notification Banner --- */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background-color: rgba(18, 18, 18, 0.95);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.35s var(--ease-spring),
    opacity 0.25s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* --- Responsiveness & Screen Adapters --- */

/* Desktop layout centering frame */
@media (min-width: 481px) {
  body {
    align-items: center;
  }
}

/* Mobile fullscreen layout override */
@media (max-width: 480px) {
  body {
    padding: 0;
    background-color: var(--color-page-bg);
  }

  .profile-shell {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
    padding-top: env(safe-area-inset-top, 44px);
  }

  .skeleton-container {
    border-radius: 0;
    padding-top: env(safe-area-inset-top, 44px);
  }

  .modal-content {
    border-radius: 20px 20px 0 0;
    max-width: 100%;
  }

  /* Responsive social icon sizing to prevent edge crowding on mobile */
  .social-row {
    gap: 14px;
  }

  .social-row a {
    width: 26px;
    height: 26px;
    font-size: 26px;
  }
}

/* Desktop drawer as centered popup dialog */
@media (min-width: 481px) {
  .options-modal {
    align-items: center;
  }

  .modal-content {
    border-radius: 20px;
    width: 320px;
    transform: scale(0.9) translateY(20px);
    padding-bottom: 24px;
  }

  .options-modal.active .modal-content {
    transform: scale(1) translateY(0);
  }
}

/* Accessibility reduction on query request */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .motion-item {
    opacity: 1;
    transform: none;
  }

  .skeleton-banner,
  .skeleton-username,
  .skeleton-line,
  .skeleton-circle,
  .skeleton-card {
    animation: none !important;
  }
}