/* ============================================================
   gitbento — base styles
   Theme tokens live in :root (Aurora default) and are overridden
   per [data-theme] in themes/*.css
   ============================================================ */

:root {
  /* --- Aurora theme (default) --- */
  --bg: #0a0a0f;
  --bg-glow-1: rgba(124, 58, 237, 0.18);
  --bg-glow-2: rgba(6, 182, 212, 0.14);

  --card-base: #0b0b12;
  --card-bg: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-border-strong: rgba(255, 255, 255, 0.14);

  --aurora-1: #7c3aed; /* violet */
  --aurora-2: #06b6d4; /* cyan   */
  --aurora-3: #10b981; /* emerald */

  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --accent: #7c3aed;
  --accent-soft: rgba(124, 58, 237, 0.18);
  --accent-contrast: #ffffff;

  /* --- Scale --- */
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --gap: 0.75rem;

  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-8: 3rem;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-card: 0 30px 80px -30px rgba(0, 0, 0, 0.8);
}

/* ----------------------------- reset ----------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--accent);
  color: var(--accent-contrast);
}

/* --------------------- page atmosphere --------------------- */
.bg-atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 15% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(50rem 40rem at 110% 10%, var(--bg-glow-2), transparent 55%),
    var(--bg);
}

.bg-atmosphere::after {
  /* subtle grain for texture */
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* --------------------------- layout --------------------------- */
.app {
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
  padding: clamp(1.5rem, 5vw, 4rem) 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------------------------- hero ---------------------------- */
.hero {
  width: 100%;
  text-align: center;
  margin-bottom: var(--sp-6);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 1.05rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  margin-bottom: var(--sp-6);
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.brand:hover {
  border-color: var(--card-border-strong);
  transform: translateY(-1px);
}
.brand__mark {
  font-size: 1rem;
  filter: drop-shadow(0 0 8px var(--accent));
}

.hero__title {
  font-size: clamp(2rem, 7vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.02;
  margin-bottom: var(--sp-4);
}
.hero__title em {
  font-style: normal;
  background: linear-gradient(110deg, var(--aurora-1), var(--aurora-2) 50%, var(--aurora-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__tagline {
  max-width: 38ch;
  margin: 0 auto var(--sp-6);
  color: var(--text-muted);
  font-size: clamp(0.95rem, 2.4vw, 1.05rem);
}

/* --------------------------- search --------------------------- */
.search {
  position: relative;
  display: flex;
  align-items: center;
  width: min(100%, 460px);
  margin: 0 auto var(--sp-5);
  padding: 0.4rem 0.4rem 0.4rem 1rem;
  border-radius: 999px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.search__at {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-weight: 700;
  margin-right: 0.25rem;
}
.search__input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.search__input::placeholder {
  color: var(--text-faint);
}
.search__btn {
  flex-shrink: 0;
  padding: 0.65rem 1.3rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent-contrast);
  background: linear-gradient(135deg, var(--aurora-1), var(--accent));
  box-shadow: 0 8px 24px -8px var(--accent);
  transition: transform 0.2s var(--ease), filter 0.2s var(--ease), opacity 0.2s var(--ease);
}
.search__btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}
.search__btn:active {
  transform: translateY(0);
}
.search__btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

/* --------------------------- themes --------------------------- */
.themes {
  display: inline-flex;
  gap: 0.55rem;
  padding: 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
}
.theme-dot {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  position: relative;
  border: 2px solid transparent;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease);
}
.theme-dot::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
}
.theme-dot[data-theme="aurora"]::after {
  background: linear-gradient(135deg, #7c3aed, #06b6d4 55%, #10b981);
}
.theme-dot[data-theme="midnight"]::after {
  background: linear-gradient(135deg, #1e3a8a, #3b82f6 55%, #38bdf8);
}
.theme-dot[data-theme="sunset"]::after {
  background: linear-gradient(135deg, #f97316, #ec4899 55%, #fb7185);
}
.theme-dot:hover {
  transform: scale(1.12);
}
.theme-dot.is-active {
  border-color: var(--text-primary);
}

/* --------------------------- status --------------------------- */
.status {
  min-height: 1.4rem;
  margin-bottom: var(--sp-4);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  transition: opacity 0.3s var(--ease);
}
.status.is-error {
  color: #fca5a5;
}

/* ---------------------------- stage ---------------------------- */
.stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-5);
}

/* ===================== THE CARD ===================== */
.card {
  position: relative;
  width: 100%;
  max-width: 680px;
  padding: clamp(1rem, 2.5vw, 1.4rem);
  border-radius: var(--radius-lg);
  background: var(--card-base);
  border: 1px solid var(--card-border-strong);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  isolation: isolate;
}

/* animated aurora behind the bento (soft radial blobs, no blur filter
   so it survives html2canvas export) */
.card__aurora {
  position: absolute;
  inset: -55%;
  z-index: 0;
  background:
    radial-gradient(28% 32% at 22% 28%, var(--aurora-1), transparent 60%),
    radial-gradient(30% 30% at 78% 22%, var(--aurora-2), transparent 62%),
    radial-gradient(34% 36% at 60% 82%, var(--aurora-3), transparent 60%),
    radial-gradient(26% 28% at 18% 80%, var(--aurora-2), transparent 60%);
  opacity: 0.55;
  animation: aurora-spin 22s linear infinite;
  will-change: transform;
}

@keyframes aurora-spin {
  to {
    transform: rotate(360deg) scale(1.05);
  }
}

.bento {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(0, auto);
  gap: var(--gap);
  grid-template-areas:
    "profile profile stars     repos"
    "profile profile forks     followers"
    "langs   langs   langs     since";
}

/* glass cell */
.cell {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: var(--sp-4);
  overflow: hidden;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.cell::before {
  /* faint top-edge sheen */
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
}

.cell--profile   { grid-area: profile; }
.cell--stars     { grid-area: stars; }
.cell--forks     { grid-area: forks; }
.cell--repos     { grid-area: repos; }
.cell--followers { grid-area: followers; }
.cell--langs     { grid-area: langs; }
.cell--since     { grid-area: since; }

/* -------- profile cell -------- */
.cell--profile {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-5);
}
.profile__top {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}
.profile__avatar {
  width: 74px;
  height: 74px;
  border-radius: 20px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--card-border-strong);
  background: var(--card-base);
}
.profile__id {
  min-width: 0;
}
.profile__name {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile__login {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
}
.profile__bio {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.profile__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin-top: auto;
  font-size: 0.82rem;
  color: var(--text-faint);
}
.profile__meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.profile__meta svg {
  opacity: 0.7;
  flex-shrink: 0;
}

/* -------- stat cells -------- */
.cell--stat {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: 92px;
}
.stat__icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--text-primary);
}
.stat__icon svg { width: 17px; height: 17px; }
.stat__value {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text-primary);
}
.stat__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* -------- languages cell -------- */
.cell--langs {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.langs__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.langs__list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.lang {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
.lang__name {
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.lang__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.lang__pct {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}
.lang__track {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.lang__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  width: var(--pct, 0%);
  min-width: 6px; /* keep tiny percentages visible */
  animation: lang-grow 0.9s var(--ease) both;
}
@keyframes lang-grow {
  from { width: 0; }
  to   { width: var(--pct, 0%); }
}

/* -------- since cell -------- */
.cell--since {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
  text-align: left;
}
.since__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.since__year {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}
.since__sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* -------- watermark -------- */
.card__watermark {
  position: relative;
  z-index: 1;
  margin-top: var(--sp-3);
  text-align: right;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  padding-right: 0.3rem;
}
.card__watermark-mark {
  color: var(--accent);
}

/* ----- empty/placeholder state ----- */
.card.is-empty .card__aurora { opacity: 0.4; }
.bento--placeholder {
  grid-template-areas: "profile profile profile profile";
}
.placeholder {
  grid-area: profile;
  min-height: 200px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: var(--sp-6);
}
.placeholder strong {
  display: block;
  color: var(--text-primary);
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
  font-weight: 700;
}

/* --------------------------- actions --------------------------- */
.actions {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  justify-content: center;
}
.action {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 1.3rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid var(--card-border-strong);
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.action:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}
.action--primary {
  border-color: transparent;
  color: var(--accent-contrast);
  background: linear-gradient(135deg, var(--aurora-1), var(--accent));
  box-shadow: 0 10px 28px -10px var(--accent);
}
.action--primary:hover {
  border-color: transparent;
  filter: brightness(1.08);
}
.action.is-success {
  border-color: var(--aurora-3);
  color: var(--aurora-3);
}

/* --------------------------- footer --------------------------- */
.foot {
  margin-top: var(--sp-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-faint);
  text-align: center;
}
.foot__link {
  color: var(--text-muted);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease);
}
.foot__link:hover {
  border-bottom-color: currentColor;
}

/* --------------------- skeleton loading --------------------- */
.cell--skeleton {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
}
.cell--skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.08),
    transparent
  );
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  to { transform: translateX(100%); }
}

/* ----------------- entrance animation ----------------- */
.card.is-ready .cell {
  animation: cell-in 0.6s var(--ease) both;
}
.card.is-ready .cell--profile   { animation-delay: 0.02s; }
.card.is-ready .cell--stars     { animation-delay: 0.08s; }
.card.is-ready .cell--forks     { animation-delay: 0.12s; }
.card.is-ready .cell--repos     { animation-delay: 0.16s; }
.card.is-ready .cell--followers { animation-delay: 0.20s; }
.card.is-ready .cell--langs     { animation-delay: 0.24s; }
.card.is-ready .cell--since     { animation-delay: 0.28s; }

@keyframes cell-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --------------------- confetti layer --------------------- */
.confetti-layer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* ============================================================
   Responsive — mobile single column
   ============================================================ */
@media (max-width: 560px) {
  .bento {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "profile  profile"
      "stars    forks"
      "repos    followers"
      "langs    langs"
      "since    since";
  }
  .cell--profile { padding: var(--sp-4); }
  .profile__avatar { width: 60px; height: 60px; border-radius: 16px; }
  .stat__value, .since__year { font-size: 1.45rem; }
  .actions { width: 100%; }
  .action { flex: 1; justify-content: center; }
}

@media (max-width: 360px) {
  .bento {
    grid-template-columns: 1fr;
    grid-template-areas:
      "profile"
      "stars"
      "forks"
      "repos"
      "followers"
      "langs"
      "since";
  }
}

/* ----------------- reduced motion ----------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .card__aurora { animation: none; }
}
