/* Giveth Recap — Spotify-Wrapped-style donation summary
   Visual language: warm beige-purplish backdrop, Giveth purple/green/coral,
   per-tier pastel cards (mostly opaque, slight transparency). */

:root {
  /* Background — warm peach-cream → lavender, deeper and more saturated than v1 light */
  --bg-cream:    #f0dcc4;
  --bg-warm:     #ebcfb6;
  --bg-lavender: #dcc4ec;

  /* Foreground — deep violet for warmth + readability on warm backdrops */
  --fg:          #1b0e3f;
  --fg-muted:    #564270;
  --fg-dim:      #847599;

  /* Giveth brand */
  --giveth-purple:       #5326ec;
  --giveth-purple-light: #a571ff;
  --giveth-green:        #00a26b;
  --giveth-green-soft:   #00c887;
  --pg-coral:            #d6356c;
  --pg-amber:            #d99633;

  /* Accent gradients — Giveth's actual brand poles, with strong contrast on cream/light tiers */
  --grad-accent:    linear-gradient(135deg, var(--giveth-purple) 0%, var(--giveth-green) 100%);
  --grad-archetype: linear-gradient(135deg, #ff5c8a 0%, var(--giveth-purple-light) 50%, var(--giveth-green-soft) 100%);

  /* Card surface — warm cream with mild see-through */
  --card-bg:           rgba(255, 246, 232, 0.82);
  --card-bg-hover:     rgba(255, 246, 232, 0.96);
  --card-border:       rgba(40, 20, 80, 0.16);
  --card-border-strong: rgba(40, 20, 80, 0.28);

  /* Tier section washes — darker, deeper tier hue applied to the framing container */
  --section-portrait-bg:    rgba(83, 38, 236, 0.10);
  --section-portrait-border: rgba(83, 38, 236, 0.32);
  --section-portrait-text:   rgba(83, 38, 236, 0.55);

  --section-offering-bg:    rgba(0, 162, 107, 0.10);
  --section-offering-border: rgba(0, 132, 88, 0.36);
  --section-offering-text:   rgba(0, 132, 88, 0.65);

  --section-pulse-bg:       rgba(214, 92, 50, 0.10);
  --section-pulse-border:   rgba(196, 78, 38, 0.36);
  --section-pulse-text:     rgba(178, 64, 28, 0.65);

  --section-posture-bg:      rgba(60, 100, 190, 0.10);
  --section-posture-border:  rgba(50, 86, 168, 0.36);
  --section-posture-text:    rgba(50, 86, 168, 0.65);

  /* Per-tier card surfaces — translucent so the section wash shows through */
  --tier-portrait-bg:      rgba(232, 218, 250, 0.62);
  --tier-portrait-border:  rgba(83, 38, 236, 0.32);
  --tier-portrait-hover:   rgba(232, 218, 250, 0.85);

  --tier-offering-bg:     rgba(190, 234, 208, 0.62);
  --tier-offering-border: rgba(0, 162, 107, 0.36);
  --tier-offering-hover:  rgba(190, 234, 208, 0.85);

  --tier-pulse-bg:        rgba(252, 212, 188, 0.62);
  --tier-pulse-border:    rgba(214, 92, 50, 0.34);
  --tier-pulse-hover:     rgba(252, 212, 188, 0.85);

  --tier-posture-bg:       rgba(204, 222, 244, 0.62);
  --tier-posture-border:   rgba(60, 100, 190, 0.34);
  --tier-posture-hover:    rgba(204, 222, 244, 0.85);

  --radius-sm:   10px;
  --radius-md:   14px;
  --radius-lg:   24px;
  --radius-pill: 999px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-cream);
  color: var(--fg);
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(900px 600px at 12% 0%,   rgba(83, 38, 236, 0.28), transparent 55%),
    radial-gradient(700px 500px at 88% 18%,  rgba(255, 92, 138, 0.24), transparent 55%),
    radial-gradient(800px 600px at 50% 100%, rgba(0, 162, 107, 0.24), transparent 55%),
    linear-gradient(180deg, var(--bg-cream) 0%, var(--bg-warm) 55%, var(--bg-lavender) 100%);
  background-attachment: fixed;
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

/* ───── Brand header ───── */
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 3rem;
}
.brand-mark {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
}
.brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
}

/* ───── Form (initial state) ───── */
header h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin: 0 0 2.5rem;
  color: var(--fg-muted);
  font-size: 1.05rem;
  max-width: 32rem;
}

#addr-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 32rem;
  margin-bottom: 2rem;
}

#addr-form label {
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

#addr-form input {
  padding: 0.85rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--card-border-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  color: var(--fg);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  transition: border-color 0.15s, background 0.15s;
}
#addr-form input::placeholder { color: var(--fg-dim); }
#addr-form input:focus {
  outline: none;
  border-color: var(--giveth-purple-light);
  background: #fff;
}

#addr-form button {
  align-self: flex-start;
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  background: var(--grad-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s, box-shadow 0.15s;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 16px rgba(83, 38, 236, 0.25);
}
#addr-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(83, 38, 236, 0.35);
}
#addr-form button:disabled { opacity: 0.5; cursor: wait; transform: none; }

/* ───── Status bar ───── */
#status {
  padding: 1rem 1.25rem;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.6);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  color: var(--fg-muted);
}
#status.error {
  border-color: rgba(220, 80, 100, 0.35);
  color: #a83253;
  background: rgba(255, 215, 220, 0.55);
}

/* ───── Donor identity (lives inside the portrait tier) ───── */
.portrait-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 0.1rem 0 0.5rem;
}
.portrait-header-text {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-start;
  min-width: 0;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 250, 240, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 2px 8px rgba(50, 30, 90, 0.12);
  display: block;
}
.avatar--placeholder {
  background: var(--grad-archetype);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.archetype-badge {
  position: relative;
  display: inline-block;
  padding: 0.32rem 0.8rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  color: #fff;
  text-shadow: 0 1px 2px rgba(50, 30, 90, 0.22);
  box-shadow: 0 2px 6px rgba(50, 30, 90, 0.14);
  white-space: nowrap;
  cursor: help;
}

/* Hover tooltip — CSS-only, no JS. The native title attribute is also set
   for screen readers and as a fallback. */
.archetype-badge[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--fg);
  color: #fff;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  text-shadow: none;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(20, 8, 50, 0.25);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease 0.05s;
  z-index: 10;
}
.archetype-badge[data-tip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 0.1rem);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--fg);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease 0.05s;
  z-index: 10;
}
.archetype-badge[data-tip]:hover::after,
.archetype-badge[data-tip]:hover::before,
.archetype-badge[data-tip]:focus::after,
.archetype-badge[data-tip]:focus::before { opacity: 1; }

/* Headline (scale): the "how big" — full archetype gradient, most prominent */
.archetype-badge--scale {
  background: var(--grad-archetype);
  box-shadow: 0 2px 10px rgba(83, 38, 236, 0.28);
}

/* Secondary (pattern): the "how they give" — Giveth purple→green */
.archetype-badge--pattern {
  background: var(--grad-accent);
}

/* Tertiary (vibe): the "who they are" — softer outlined treatment */
.archetype-badge--vibe {
  background: transparent;
  color: var(--giveth-purple);
  border: 1.5px solid var(--giveth-purple);
  text-shadow: none;
  box-shadow: none;
}

.addr {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  color: var(--fg-muted);
  background: rgba(255, 250, 240, 0.55);
  border: 1px solid var(--card-border);
  padding: 0.32rem 0.65rem;
  border-radius: var(--radius-pill);
  word-break: break-all;
  max-width: 100%;
}
.addr-label {
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.65rem;
  font-family: "Space Grotesk", sans-serif;
}

.archetype-note {
  margin: 0 0 0.85rem;
  color: var(--fg-muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

/* ───── Stats — tier sections ───── */
#stats {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.tier {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 1rem 1rem 1rem 2.75rem;
  border: 1px solid;
}

.tier-label {
  position: absolute;
  left: 0.7rem;
  top: 0.85rem;
  bottom: 0.85rem;
  width: 1.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-transform: uppercase;
  letter-spacing: 0.42em;
  font-size: 0.82rem;
  font-weight: 700;
  user-select: none;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tier--portrait .tier-label {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  /* Subtle text-stroke trick to read heavier than the abstract category labels at the same weight. */
  -webkit-text-stroke: 0.4px currentColor;
}

.tier-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.tier--portrait  { background: var(--section-portrait-bg);  border-color: var(--section-portrait-border); }
.tier--offering { background: var(--section-offering-bg); border-color: var(--section-offering-border); }
.tier--pulse    { background: var(--section-pulse-bg);    border-color: var(--section-pulse-border); }
.tier--posture   { background: var(--section-posture-bg);   border-color: var(--section-posture-border); }

.tier--portrait  .tier-label { color: var(--section-portrait-text); }
.tier--offering .tier-label { color: var(--section-offering-text); }
.tier--pulse    .tier-label { color: var(--section-pulse-text); }
.tier--posture   .tier-label { color: var(--section-posture-text); }

/* ───── Stat cards ───── */
.stat {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  padding: 0.9rem 1rem 0.95rem;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: background 0.18s, transform 0.18s, box-shadow 0.18s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.stat:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(40, 20, 80, 0.07);
}

.stat-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--ic) 22%, transparent);
  color: var(--ic);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.55rem;
  flex-shrink: 0;
}
.stat-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.stat .label {
  font-size: 0.65rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  margin-bottom: 0.35rem;
  line-height: 1.2;
}
.stat .value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  word-break: break-word;
  color: var(--fg);
}
.stat .sub {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: var(--fg-muted);
  line-height: 1.35;
}
.stat a { color: var(--pg-coral); text-decoration: none; font-weight: 600; }
.stat a:hover { text-decoration: underline; }

.stat--wide        { grid-column: span 2; }
.stat--wide .value { font-size: 1.95rem; }

/* ───── Per-tier card colors (translucent, wash from section shows through) ───── */
.stat--portrait {
  background: var(--tier-portrait-bg);
  border-color: var(--tier-portrait-border);
}
.stat--portrait:hover { background: var(--tier-portrait-hover); }
.stat--portrait .value {
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat--small.stat--portrait .value { font-size: 1.7rem; }

.stat--offering {
  background: var(--tier-offering-bg);
  border-color: var(--tier-offering-border);
}
.stat--offering:hover { background: var(--tier-offering-hover); }

.stat--pulse {
  background: var(--tier-pulse-bg);
  border-color: var(--tier-pulse-border);
}
.stat--pulse:hover { background: var(--tier-pulse-hover); }

.stat--posture {
  background: var(--tier-posture-bg);
  border-color: var(--tier-posture-border);
}
.stat--posture:hover { background: var(--tier-posture-hover); }

/* ───── Project hero card ───── */
.stat--project { grid-column: span 2; padding: 0.7rem 0.85rem 0.85rem; }
.stat--project .label {
  margin: 0.15rem 0 0.5rem 0.4rem;
}

.project-hero {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 1rem;
  align-items: center;
  text-decoration: none;
  color: inherit;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.project-hero:hover { background: rgba(50, 30, 90, 0.04); }

.project-hero-img {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-md);
  background-color: rgba(50, 30, 90, 0.08);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--card-border);
  flex-shrink: 0;
}
.project-hero-img.placeholder {
  background-image: linear-gradient(135deg, var(--giveth-purple) 0%, var(--giveth-green-soft) 100%);
}

.project-hero-text {
  min-width: 0;
}
.project-hero-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
  word-break: break-word;
  line-height: 1.25;
}
.project-hero-sub {
  margin-top: 0.3rem;
  color: var(--fg-muted);
  font-size: 0.82rem;
}
.project-hero:hover .project-hero-title { color: var(--pg-coral); }

/* ───── Empty state (no Giveth profile) ───── */
.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 250, 240, 0.7);
  border: 1px solid var(--card-border);
  box-shadow: 0 2px 12px rgba(40, 20, 80, 0.06);
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1.25rem;
  border-radius: 16px;
  background: var(--grad-archetype);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(83, 38, 236, 0.22);
}
.empty-state-icon svg { width: 28px; height: 28px; }

.empty-state-title {
  margin: 0 0 0.85rem;
  font-size: clamp(1.25rem, 3.5vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.empty-state-title code {
  background: rgba(50, 30, 90, 0.08);
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-pill);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  word-break: break-all;
}

.empty-state p {
  margin: 0 auto 0.6rem;
  max-width: 32rem;
  color: var(--fg-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}
.empty-state-prompt {
  margin-top: 1rem !important;
  color: var(--fg) !important;
  font-weight: 500;
}

.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem;
  margin-top: 1.5rem;
}

.empty-cta {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
  letter-spacing: 0.01em;
}
.empty-cta:hover { transform: translateY(-1px); }

.empty-cta--primary {
  background: var(--grad-accent);
  color: #fff;
  box-shadow: 0 3px 14px rgba(83, 38, 236, 0.28);
}
.empty-cta--primary:hover {
  box-shadow: 0 5px 18px rgba(83, 38, 236, 0.38);
}

.empty-cta--secondary {
  background: rgba(255, 255, 255, 0.75);
  color: var(--giveth-purple);
  border: 1.5px solid var(--giveth-purple);
}
.empty-cta--secondary:hover {
  background: #fff;
}

/* ───── Footer ───── */
footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--card-border);
  font-size: 0.8rem;
  color: var(--fg-dim);
  text-align: center;
}
footer a { color: var(--fg-muted); }

/* ───── Responsive ───── */
@media (max-width: 600px) {
  .page { padding: 1.5rem 1rem 3rem; }
  header h1 { font-size: 2rem; }
  .tier { padding: 1.6rem 0.85rem 0.85rem; }
  .tier-label {
    writing-mode: horizontal-tb;
    position: static;
    width: auto;
    height: auto;
    margin-bottom: 0.6rem;
    justify-content: flex-start;
    letter-spacing: 0.3em;
  }
  .tier-grid { grid-template-columns: 1fr; gap: 0.6rem; }
  .stat--wide,
  .stat--project { grid-column: span 1; }
  .stat--wide .value { font-size: 1.7rem; }
  .stat--small.stat--portrait .value { font-size: 1.5rem; }
  .project-hero { grid-template-columns: 64px 1fr; gap: 0.85rem; }
  .project-hero-img { width: 64px; height: 64px; }
  #who { padding: 2rem 1rem 1.5rem; }
}
