/* Public profile page. Self-contained: it must not inherit the site chrome. */

:root {
  --accent: #1a5c9e;
  --bg-a: #17122e;
  --bg-b: #08060f;
  --fg: #ffffff;
  --fg-muted: rgba(255, 255, 255, 0.62);
  --tile: rgba(255, 255, 255, 0.08);
  --tile-hover: rgba(255, 255, 255, 0.14);
  --line: rgba(255, 255, 255, 0.14);
  --btn-radius: 14px;
  --drop: rgba(0, 0, 0, 0.3);
  --drop-hover: rgba(0, 0, 0, 0.22);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ---------- Themes ----------
   Twelve palettes. Each sets the page gradient and the text/tile colours;
   --accent stays whatever the owner picked. Keep in step with Theme in
   profiles/models.py and the .theme-swatch-* previews in site.css. */

/* Light */
.theme-daylight { --bg-a: #ffffff; --bg-b: #eef4fa; --fg: #0f2a43; --fg-muted: rgba(15, 42, 67, 0.62); --tile: #ffffff; --tile-hover: #f4f8fc; --line: rgba(15, 42, 67, 0.12); }
.theme-paper    { --bg-a: #fdfcfa; --bg-b: #f1ede5; --fg: #2b2724; --fg-muted: rgba(43, 39, 36, 0.62); --tile: #ffffff; --tile-hover: #faf8f4; --line: rgba(43, 39, 36, 0.14); }
.theme-sand     { --bg-a: #fdf4e7; --bg-b: #f4e2c8; --fg: #3d2f1f; --fg-muted: rgba(61, 47, 31, 0.62); --tile: rgba(255, 255, 255, 0.78); --tile-hover: #ffffff; --line: rgba(61, 47, 31, 0.14); }
.theme-mint     { --bg-a: #f0fbf6; --bg-b: #d9f0e6; --fg: #10362a; --fg-muted: rgba(16, 54, 42, 0.62); --tile: rgba(255, 255, 255, 0.82); --tile-hover: #ffffff; --line: rgba(16, 54, 42, 0.13); }
.theme-candy    { --bg-a: #ffe6f2; --bg-b: #e6ecff; --fg: #2a1030; --fg-muted: rgba(42, 16, 48, 0.6);  --tile: rgba(255, 255, 255, 0.7);  --tile-hover: #ffffff; --line: rgba(42, 16, 48, 0.12); }
.theme-slate    { --bg-a: #f6f8fb; --bg-b: #e2e8f0; --fg: #1f2a37; --fg-muted: rgba(31, 42, 55, 0.62); --tile: #ffffff; --tile-hover: #f8fafc; --line: rgba(31, 42, 55, 0.13); }

/* The light palettes share their shadow treatment: the dark drop shadows of the
   default palette would read as smudges on a pale background. */
.theme-daylight, .theme-paper, .theme-sand, .theme-mint, .theme-candy, .theme-slate {
  color-scheme: light;
  --drop: rgba(15, 42, 67, 0.14);
  --drop-hover: rgba(15, 42, 67, 0.12);
}
.theme-daylight .link-tile, .theme-paper .link-tile, .theme-sand .link-tile,
.theme-mint .link-tile, .theme-candy .link-tile, .theme-slate .link-tile {
  box-shadow: 0 1px 2px rgba(15, 42, 67, 0.07);
}

/* Dark */
.theme-midnight { --bg-a: #17122e; --bg-b: #08060f; }
.theme-ocean    { --bg-a: #0b2545; --bg-b: #04101f; }
.theme-forest   { --bg-a: #0d2b25; --bg-b: #05130f; }
.theme-sunset   { --bg-a: #3b1046; --bg-b: #170a1f; }
.theme-berry    { --bg-a: #3d0f2b; --bg-b: #180614; }
.theme-mono     { --bg-a: #111111; --bg-b: #000000; --tile: rgba(255, 255, 255, 0.06); --tile-hover: rgba(255, 255, 255, 0.12); }

/* ---------- Button shapes ---------- */
.btns-rounded { --btn-radius: 14px; }
.btns-pill { --btn-radius: 999px; }
.btns-square { --btn-radius: 4px; }
.btns-outline { --btn-radius: 14px; }
.btns-outline .link-tile { background: transparent; border-color: var(--accent); }
.btns-outline .link-tile:hover { background: var(--tile); }

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--fg);
  background: linear-gradient(170deg, var(--bg-a), var(--bg-b));
  background-attachment: fixed;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.card-page {
  max-width: 620px;
  margin: 0 auto;
  padding: 20px 20px 40px;
  text-align: center;
}

.glow {
  position: fixed; inset: -20% auto auto 50%;
  width: 640px; height: 440px; transform: translateX(-50%);
  background: radial-gradient(closest-side, var(--accent), transparent 70%);
  opacity: 0.28;
  pointer-events: none;
  z-index: -1;
}

/* Identity panel. The loose stack of centred lines read as raw text; a single
   framed block gives the page a head, and the avatar overlapping its edge ties
   the two together. */
.profile {
  margin: 62px 0 0;
  padding: 0 22px 24px;
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 10px 34px var(--drop-hover);
}
/* Only present when at least one of headline, bio, location or interests is
   filled in, so an empty profile shows no dangling rule. */
.profile-body {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.avatar {
  width: 118px; height: 118px; border-radius: 50%;
  margin: -60px auto 14px;
  /* Ringed with the panel colour so it reads as cut out of it. */
  border: 5px solid var(--tile);
  box-shadow: 0 14px 40px var(--drop);
}
/* contain, never cover: the stored file is a square that already holds the whole
   picture with the right amount of room around it, so it only has to be shown
   whole. See Profile._inscribe_in_square. */
/* --avatar-bg when the owner picked a colour, the panel colour otherwise. */
img.avatar { object-fit: contain; background: var(--avatar-bg, var(--tile)); }
.avatar-fallback {
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff; font-size: 2.4rem; font-weight: 700;
}

.name { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.handle { color: var(--fg-muted); font-size: 0.95rem; margin: 2px 0 0; }
.headline { font-size: 1.05rem; font-weight: 600; margin: 0; }
.bio {
  color: var(--fg-muted); margin: 10px auto 0;
  max-width: 46ch; font-size: 0.97rem; line-height: 1.6;
}
.location { color: var(--fg-muted); font-size: 0.87rem; margin: 10px 0 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 16px 0 0; padding: 0; }
.chips li {
  list-style: none;
  font-size: 0.82rem; padding: 5px 13px; border-radius: 999px;
  /* Inside the panel, tiles would vanish against it: outlined instead. */
  background: transparent; border: 1px solid var(--line); color: var(--fg-muted);
}

.section-label {
  margin: 26px 0 10px;
  font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fg-muted);
}
.section-label + .links { margin-top: 0; }

.links { margin: 26px 0 0; padding: 0; display: grid; gap: 12px; }
.links li { list-style: none; }
.link-tile {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px;
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: var(--btn-radius);
  font-weight: 600;
  transition: transform 0.14s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.link-tile:hover {
  background: var(--tile-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px var(--drop-hover);
}
/* No accent-coloured plate behind the icon: the platform glyphs carry their own
   colours, and a filled square fought with them. */
/* Favicons come from other people's sites: square, opaque, and drawn to their
   own rules. The circle gives them a common shape, and the radial mask softens
   the corners of the ones that bleed to the edge so nothing looks pasted on. */
.link-tile .icon {
  flex: none; width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--tile);
  border: 1px solid var(--line);
  font-size: 1.02rem; line-height: 1;
  overflow: hidden;
  transition: background 0.2s ease;
}
.link-tile:hover .icon { background: var(--tile-hover); }
.link-tile .icon img {
  width: 22px; height: 22px; object-fit: contain;
  -webkit-mask-image: radial-gradient(circle, #000 72%, transparent 100%);
  mask-image: radial-gradient(circle, #000 72%, transparent 100%);
}

.embed-icons img {
  display: inline-block; vertical-align: -3px;
  width: 15px; height: 15px; object-fit: contain;
  -webkit-mask-image: radial-gradient(circle, #000 72%, transparent 100%);
  mask-image: radial-gradient(circle, #000 72%, transparent 100%);
}
.embed-icons.is-icons span {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px; padding: 0; border-radius: 50%;
}
.link-tile .label { flex: 1; text-align: left; }
.link-tile .chevron { opacity: 0.4; font-size: 0.9rem; }

.share-row { display: flex; gap: 10px; justify-content: center; margin-top: 28px; }
.share-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px;
  background: var(--tile); border: 1px solid var(--line);
  color: inherit; font: inherit; font-size: 0.87rem; font-weight: 600;
  cursor: pointer;
}
.share-btn:hover { background: var(--tile-hover); }

.owner-bar {
  position: sticky; top: 12px; z-index: 5;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin: 0 auto 20px; max-width: 420px;
  padding: 8px 14px; border-radius: 999px;
  background: rgba(15, 42, 67, 0.82); border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff; font-size: 0.84rem;
  backdrop-filter: blur(10px);
}
.owner-bar a { text-decoration: underline; }

.card-footer { margin-top: 44px; font-size: 0.82rem; color: var(--fg-muted); }
.card-footer a { font-weight: 600; }
.card-footer a:hover { color: var(--fg); }

/* ---------- Report ---------- */
.report-modal {
  width: min(440px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-b);
  color: var(--fg);
}
.report-modal::backdrop { background: rgba(0, 0, 0, 0.55); }
.report-title { margin: 0 0 16px; font-size: 1.15rem; }

.report-form { text-align: left; }
.report-label {
  display: block; margin: 12px 0 5px;
  font-size: 0.8rem; font-weight: 600; color: var(--fg-muted);
}
.report-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--tile);
  color: var(--fg);
  font: inherit; font-size: 0.92rem;
  outline: none;
}
.report-input:focus { border-color: var(--accent); }
textarea.report-input { resize: vertical; }
.report-error { color: #ff6b6b; font-size: 0.83rem; margin: 6px 0 0; }
/* Off-screen rather than display:none: some bots skip hidden fields. */
.report-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.report-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.share-btn.is-primary { background: var(--accent); border-color: var(--accent); color: #fff; }

.report-sent {
  margin: 24px auto 0; max-width: 420px;
  padding: 10px 16px; border-radius: 12px;
  background: var(--tile); border: 1px solid var(--line);
  font-size: 0.88rem;
}

.qr-modal {
  border: none; border-radius: 20px; padding: 24px;
  background: #fff; color: #111; text-align: center;
}
.qr-modal::backdrop { background: rgba(0, 0, 0, 0.6); }
.qr-modal canvas, .qr-modal img { margin: 0 auto; }

@media (max-width: 480px) {
  .card-page { padding: 16px 16px 32px; }
  .profile { margin-top: 54px; padding: 0 16px 20px; }
  .avatar { width: 96px; height: 96px; margin-top: -50px; }
  .name { font-size: 1.45rem; }
}


/* ---------- Embed ----------
   Compact card served in an iframe on someone else's site. It reuses the theme
   variables above, so it follows whatever the owner picked. */
body.is-embed { min-height: 0; background: linear-gradient(120deg, var(--bg-a), var(--bg-b)); }

.embed {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; min-height: 84px;
  color: var(--fg); text-decoration: none;
}
.embed:hover .embed-go { text-decoration: underline; }

.embed-avatar {
  flex: none; width: 56px; height: 56px; border-radius: 50%;
  border: 2px solid var(--line);
}
img.embed-avatar { object-fit: contain; background: var(--avatar-bg, var(--tile)); }
.embed-initials {
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 1.1rem;
}

.embed-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.embed-name { font-size: 1rem; font-weight: 700; }
.embed-headline {
  font-size: 0.82rem; color: var(--fg-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.embed-icons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; font-size: 0.82rem; }
.embed-icons span {
  padding: 2px 7px; border-radius: 999px;
  background: var(--tile); border: 1px solid var(--line);
}

.embed-cta { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.embed-domain { font-size: 0.72rem; color: var(--fg-muted); }
.embed-go {
  font-size: 0.78rem; font-weight: 600;
  padding: 5px 11px; border-radius: var(--btn-radius);
  background: var(--tile); border: 1px solid var(--line);
}

@media (max-width: 420px) {
  .embed { gap: 10px; padding: 12px; }
  .embed-cta { display: none; }
}
