/* =========================================================
   QR Code Modal Styles
   ========================================================= */
.qr-scan-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 20px #1c33500d;
  transition: transform .2s ease, background .2s ease, color .2s ease;
}
.qr-scan-button:hover,
.qr-scan-button:focus-visible {
  transform: translateY(-1px);
  background: var(--accent-soft);
  color: var(--accent);
}
.qr-scan-button::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--tooltip-bg);
  border: 1px solid var(--tooltip-border);
  color: var(--tooltip-text);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  box-shadow: 0 8px 18px var(--tooltip-shadow);
  z-index: 4;
}
.qr-scan-button:hover::after,
.qr-scan-button:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal.is-open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.15);
  transform: scale(0.97) translateY(16px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}
.modal.is-open .modal-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, color 0.2s;
}
.modal-close:hover {
  background: var(--line);
  color: var(--ink);
}
.modal-header {
  margin-bottom: 24px;
}
.modal-header h2 {
  font-size: 20px;
  margin: 0 0 4px;
}
.modal-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}
.qr-options {
  display: flex;
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
}
.qr-tab {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}
.qr-tab.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.qr-display-area {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 240px;
  margin-bottom: 24px;
  background: #fff; /* QR codes often need white bg for scanning reliability */
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  position: relative;
}
.qr-code-container {
  position: relative;
  display: inline-block;
}
.qr-code-container canvas {
  display: block;
  max-width: 100%;
  height: auto;
}
.qr-center-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 22%;
  height: 22%;
  object-fit: cover;
  object-position: center;
  background: #fff;
  border-radius: 50%;
  overflow: hidden;
  padding: 3px;
  box-sizing: border-box;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  border: 2px solid rgba(255,255,255,0.9);
}
.qr-loader {
  position: absolute;
  font-size: 14px;
  color: var(--muted);
}
.qr-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.qr-actions .secondary-btn {
  padding: 10px 8px;
  font-size: 12px;
  flex-direction: column;
  gap: 4px;
}
.qr-actions .secondary-btn i {
  font-size: 16px;
}

/* =========================================================
   Link Card Rich Thumbnails
   ========================================================= */
.site-link.has-image {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
}
.site-link.has-image .site-image {
  height: 140px;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--line);
  background-color: var(--surface-soft);
  transition: opacity 0.3s ease;
}
.site-link.has-image:hover .site-image {
  opacity: 0.9;
}
.site-link.has-image .site-content-wrapper {
  display: flex;
  align-items: center;
  padding: 16px;
  gap: 12px;
  width: 100%;
}


/* =========================================================
   Subtle Animations
   ========================================================= */

/* 1. Profile Entrance */
@keyframes fadeInUpSubtle {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
  .hero > * {
    animation: fadeInUpSubtle 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }
  .hero > :nth-child(1) { animation-delay: 0.1s; }
  .hero > :nth-child(2) { animation-delay: 0.15s; }
  .hero > :nth-child(3) { animation-delay: 0.2s; }
  .hero > :nth-child(4) { animation-delay: 0.25s; }
  .hero > :nth-child(5) { animation-delay: 0.3s; }
  .hero > :nth-child(6) { animation-delay: 0.35s; }
  .hero > :nth-child(7) { animation-delay: 0.4s; }

  /* 2. Card Hover */
  .site-link {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
  }
  @media(hover:hover) {
    .site-link:hover {
      transform: translateY(-4px) scale(1.01);
      box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
    }
    html[data-theme="dark"] .site-link:hover, html[data-theme="system"] .site-link:hover {
      box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.2);
    }
  }

  /* 3. Button Hover Enhancements */
  .primary-btn, .secondary-btn, .social-btn, .save-contact-button {
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
  }
  .primary-btn:hover, .secondary-btn:hover, .social-btn:hover, .save-contact-button:hover {
    transform: translateY(-3px) scale(1.02);
  }

  /* 5. Theme Transition */
  body, .hub, .site-link, .modal-content, .search-box, .footer, .contact-copy-wrap, .secondary-btn {
    transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease !important;
  }
}

/* =========================================================
   Accessibility Enhancements
   ========================================================= */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 0;
  padding: 12px 24px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  z-index: 10000;
  transition: top 0.2s ease;
  border-bottom-right-radius: 12px;
}
.skip-to-content:focus {
  top: 0;
  outline: 3px solid #ffffff;
}

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

