/* ============================================================
   QRT.ro — design tokens + @username page components
   Single source of truth for the public profile page.
   Landing + dashboard migrate here in later phases.
   Theme via [data-theme]; per-page brand accent via inline --accent.
   ============================================================ */

:root,
[data-theme="light"] {
  --font-display: 'Clash Display', 'General Sans', system-ui, sans-serif;
  --font-sans: 'General Sans', system-ui, -apple-system, sans-serif;
  --bg: #FFFFFF;
  --surface: #F8F9FA;
  --surface-raised: #F1F3F5;
  --cover: linear-gradient(135deg, #1A56DB 0%, #6B3FD4 100%);
  --text: #0D1117;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border: #E9ECEF;
  --card-bg: #FFFFFF;
  --qr-bg: #F8F9FA;
  --accent: #1A56DB;
  --shadow: rgba(13, 17, 23, 0.06);
  --shadow-strong: rgba(13, 17, 23, 0.10);
}

[data-theme="dark"] {
  --bg: #0A0A0B;
  --surface: #111113;
  --surface-raised: #1A1A1C;
  --cover: linear-gradient(135deg, #1A2340 0%, #2D1B69 100%);
  --text: #F9FAFB;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;
  --border: #2D2D30;
  --card-bg: #111113;
  --qr-bg: #111113;
  --accent: #4F7FFF;
  --shadow: rgba(0, 0, 0, 0.4);
  --shadow-strong: rgba(0, 0, 0, 0.55);
}

[data-theme="warm"] {
  --bg: #FDFAF6;
  --surface: #F5F0E8;
  --surface-raised: #EDE6D8;
  --cover: linear-gradient(135deg, #D97706 0%, #DC2626 100%);
  --text: #1C1917;
  --text-secondary: #78716C;
  --text-muted: #A8A29E;
  --border: #E7DFD0;
  --card-bg: #FFFFFF;
  --qr-bg: #F5F0E8;
  --accent: #D97706;
  --shadow: rgba(28, 25, 23, 0.07);
  --shadow-strong: rgba(28, 25, 23, 0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Page shell ── */
.page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
}

/* ── Cover ── */
.cover {
  height: 116px;
  background: var(--accent);
  background: linear-gradient(160deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 76%, #0b1020) 100%);
  border-radius: 0 0 28px 28px;
}

/* ── Avatar (overlaps cover) ── */
.avatar-wrap {
  margin-top: -56px;
  display: flex;
  justify-content: center;
}
.avatar,
.avatar-ring {
  width: 108px; height: 108px; border-radius: 50%;
  border: 4px solid var(--bg);
  box-shadow: 0 6px 20px var(--shadow-strong);
}
.avatar { object-fit: cover; background: var(--surface); }
.avatar-ring {
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
}
.avatar-ring span {
  font-size: 2.4rem; font-weight: 800; color: #fff;
  letter-spacing: -0.02em; line-height: 1;
}

/* ── QR hero (overlaps cover, focal point of the card) ── */
.qr-hero { margin: -72px auto 0; display: flex; flex-direction: column; align-items: center; position: relative; z-index: 3; }
.qr-hero-card { background: var(--qr-bg); border: 1px solid var(--border); border-radius: 24px; padding: 16px; box-shadow: 0 14px 38px var(--shadow-strong); width: 208px; max-width: 72%; }
.qr-hero-card img { width: 100%; height: auto; display: block; border-radius: 8px; }
.qr-hero-actions { display: flex; gap: 0.5rem; justify-content: center; margin-top: 0.85rem; }
.avatar-after-qr { margin-top: 0.9rem; }
.avatar-after-qr .avatar, .avatar-after-qr .avatar-ring { width: 60px; height: 60px; border-width: 3px; }
.avatar-after-qr .avatar-ring span { font-size: 1.4rem; }

/* ── Content ── */
.content { padding: 0.9rem 1.25rem 2rem; }

/* ── Profile ── */
.profile { text-align: center; margin-bottom: 1.6rem; }
.profile-name {
  font-family: var(--font-display);
  font-size: 1.65rem; font-weight: 700; letter-spacing: -0.01em;
  margin-top: 0.6rem;
}
.profile-company {
  font-size: 0.82rem; font-weight: 600; color: var(--text-secondary);
  margin-top: 0.2rem;
}
.profile-bio {
  color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6;
  max-width: 360px; margin: 0.5rem auto 0;
}
.profile-handle {
  font-size: 0.78rem; color: var(--text-muted); margin-top: 0.5rem;
}
.views-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.68rem; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 0.2rem 0.6rem; border-radius: 999px; margin-top: 0.6rem;
}

/* ── Contact pills ── */
.contact-pills {
  display: flex; gap: 0.5rem; justify-content: center;
  flex-wrap: wrap; margin-top: 0.9rem;
}
.pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.78rem; font-weight: 600; text-decoration: none;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  padding: 0.4rem 0.85rem; border-radius: 999px;
  transition: background 0.15s;
}
.pill:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* ── Save contact (hero CTA) ── */
.save-contact {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; margin-top: 1.1rem;
  height: 52px; border-radius: 14px;
  background: var(--accent); color: #fff;
  font-size: 0.92rem; font-weight: 700; text-decoration: none;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 38%, transparent);
  transition: transform 0.12s, box-shadow 0.15s;
}
.save-contact:hover { transform: translateY(-1px); box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 45%, transparent); }
.save-contact:active { transform: translateY(0); }

/* ── Link list ── */
.links { display: flex; flex-direction: column; gap: 0.6rem; }

.link-card {
  display: flex; align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 0.85rem 1rem; min-height: 56px;
  text-decoration: none; color: var(--text);
  transition: transform 0.15s cubic-bezier(0.4,0,0.2,1), box-shadow 0.15s, border-color 0.15s;
  box-shadow: 0 1px 2px var(--shadow);
}
.link-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: 0 8px 22px var(--shadow-strong);
}
.link-card:active { transform: translateY(0); }

.link-icon-wrap {
  width: 40px; height: 40px; border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  display: flex; align-items: center; justify-content: center;
  margin-right: 0.9rem; flex-shrink: 0;
}
/* Squircle brand tile — white glyph over brand gradient */
.link-tile {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-right: 0.9rem; flex-shrink: 0;
  box-shadow: 0 2px 8px var(--shadow), inset 0 1px 0 rgba(255,255,255,.18);
}
.link-tile svg { filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.22)); }
.save-contact { font-family: var(--font-sans); }
.link-thumb {
  width: 44px; height: 44px; border-radius: 10px;
  object-fit: cover; flex-shrink: 0; margin-right: 0.9rem;
  background: var(--surface);
}
.link-text { flex: 1; min-width: 0; text-align: left; }
.link-text-title {
  font-weight: 600; font-size: 0.9rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.link-text-domain {
  font-size: 0.7rem; color: var(--text-muted); margin-top: 0.12rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.link-clicks {
  flex-shrink: 0; margin-left: 0.4rem;
  font-size: 0.66rem; font-weight: 700; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 0.18rem 0.5rem; border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.link-chevron {
  color: var(--text-muted); flex-shrink: 0; margin-left: 0.4rem;
  opacity: 0; transition: opacity 0.15s, transform 0.15s;
}
.link-card:hover .link-chevron { opacity: 1; transform: translateX(2px); }

/* Featured (pinned) link/embed — accent ring */
.link-card.featured,
.embed-block.featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1.5px var(--accent), 0 10px 26px var(--shadow-strong);
}
.link-card.featured { background: color-mix(in srgb, var(--accent) 5%, var(--card-bg)); }

/* Lead capture form */
.lead-form {
  margin-top: 1.6rem; padding: 1.3rem;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: 0 1px 2px var(--shadow);
}
.lead-form h3 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; margin-bottom: 0.2rem; }
.lead-form p { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.9rem; }
.lead-form input, .lead-form textarea {
  width: 100%; margin-bottom: 0.6rem; padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 0.88rem; font-family: var(--font-sans); background: var(--bg); color: var(--text);
  outline: none;
}
.lead-form input:focus, .lead-form textarea:focus { border-color: var(--accent); }
.lead-form button {
  width: 100%; height: 46px; border: 0; border-radius: 12px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 0.9rem;
  cursor: pointer; font-family: var(--font-sans);
}
.lead-form .lead-ok { text-align: center; color: var(--accent); font-weight: 600; font-size: 0.9rem; padding: 0.5rem 0; }

/* ── Embed block (live media: YouTube / Spotify) ── */
.embed-block {
  border-radius: 16px; overflow: hidden;
  background: var(--card-bg); border: 1px solid var(--border);
  box-shadow: 0 4px 20px var(--shadow);
}
.embed-block .media { width: 100%; line-height: 0; }
.embed-block.youtube .media { aspect-ratio: 16 / 9; }
.embed-block iframe { display: block; width: 100%; border: 0; }
.embed-block.youtube iframe { height: 100%; }
.embed-cap {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 0.85rem; border-top: 1px solid var(--border);
}
.embed-cap .t {
  flex: 1; min-width: 0; font-weight: 700; font-size: 0.85rem;
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.embed-cap .o {
  font-size: 0.74rem; font-weight: 700; color: var(--accent);
  text-decoration: none; white-space: nowrap; flex-shrink: 0;
}

/* ── QR section ── */
.qr-section {
  margin-top: 1.6rem; padding: 2rem 1.5rem;
  background: var(--qr-bg); border: 1px solid var(--border);
  border-radius: 20px; text-align: center;
}
.qr-section img { width: 168px; height: 168px; border-radius: 12px; }
.qr-label { font-size: 0.78rem; color: var(--text-secondary); margin: 1rem 0; }
.qr-actions { display: flex; gap: 0.5rem; justify-content: center; }
.qr-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.76rem; font-weight: 600; text-decoration: none;
  padding: 0.5rem 0.9rem; border-radius: 10px;
  border: 1.5px solid var(--border); color: var(--text-secondary);
  background: transparent; cursor: pointer; font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}
.qr-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Branding ── */
.branding { text-align: center; margin-top: 2rem; padding-bottom: 0.5rem; }
.branding a {
  display: inline-flex; align-items: center; gap: 0.3rem;
  color: var(--text-muted); text-decoration: none;
  font-size: 0.72rem; font-weight: 500; transition: color 0.15s;
}
.branding a:hover { color: var(--accent); }
.branding a strong { font-weight: 800; }

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.content > * { animation: fadeUp 0.4s ease both; }
.content > *:nth-child(1) { animation-delay: 0s; }
.content > *:nth-child(2) { animation-delay: 0.08s; }
.content > *:nth-child(3) { animation-delay: 0.16s; }
.content > *:nth-child(4) { animation-delay: 0.24s; }
@media (prefers-reduced-motion: reduce) {
  .content > * { animation: none; }
  html { scroll-behavior: auto; }
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .cover { border-radius: 0 0 24px 24px; }
  .profile-name { font-size: 1.35rem; }
}


/* ── Sticky "Save contact" CTA (mobile) — slides up when the inline hero scrolls away ── */
.save-sticky { display: none; }
@media (max-width: 600px) {
  .save-sticky {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    padding: 0.65rem 0.9rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--border);
    transform: translateY(135%); transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    pointer-events: none;
  }
  .save-sticky.show { transform: translateY(0); pointer-events: auto; }
  .save-sticky-btn {
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    width: 100%; height: 54px; border-radius: 14px;
    background: var(--accent); color: #fff; font-weight: 700; font-size: 0.95rem;
    font-family: var(--font-sans); text-decoration: none;
    box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 48%, transparent);
  }
  .save-sticky-btn:active { transform: scale(0.985); }
  .page { padding-bottom: 88px; }
}
