/* club-create.html — the founding ceremony. Only this page loads it. */

:root {
  --fc-bg: #0B0E14;
  --fc-surface: rgba(255, 255, 255, 0.025);
  --fc-surface-2: rgba(255, 255, 255, 0.045);
  --fc-line: rgba(255, 255, 255, 0.075);
  --fc-line-hi: rgba(58, 190, 255, 0.22);
  --fc-purple: #a68af9;
  --fc-blue: #3ABEFF;
  --fc-gold: #FBBF24;
  --fc-teal: #2DD4BF;
  --fc-text: #E5E7EB;
  --fc-text-hi: #F7F9FF;
  --fc-muted: #9CA3AF;
  --fc-dim: #6B7280;
  --fc-grad: linear-gradient(135deg, #a68af9, #3ABEFF);
  --fc-radius: 20px;
}

.founding {
  position: relative;
  min-height: 100vh;
  padding: 136px 22px 96px;
  background:
    radial-gradient(900px 560px at 12% -6%, rgba(166, 138, 249, 0.14), transparent 68%),
    radial-gradient(820px 520px at 96% 8%, rgba(58, 190, 255, 0.12), transparent 66%),
    radial-gradient(700px 500px at 50% 108%, rgba(251, 191, 36, 0.06), transparent 70%),
    var(--fc-bg);
  overflow: hidden;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--fc-text);
}

.founding::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.035) 1px, transparent 0);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 72%);
  pointer-events: none;
}

.founding-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
}

.founding-head {
  text-align: center;
  max-width: 620px;
  margin: 0 auto 40px;
}

.founding-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(166, 138, 249, 0.28);
  background: rgba(166, 138, 249, 0.09);
  color: var(--fc-purple);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.founding-eyebrow i {
  font-size: 11px;
}

.founding-head h1 {
  margin: 22px 0 14px;
  font-family: "Unbounded", "Montserrat", sans-serif;
  font-size: clamp(2rem, 5.2vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 700;
  color: var(--fc-text-hi);
}

.founding-lede {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--fc-muted);
}

.founding-loading {
  padding: 80px 0;
  text-align: center;
  color: var(--fc-muted);
  font-size: 13.5px;
}

.founding-loading i {
  color: var(--fc-blue);
  margin-right: 8px;
}

/* ── Gate (signed out / already founded) ── */

.founding-gate {
  max-width: 520px;
  margin: 0 auto;
  padding: 40px 34px 36px;
  text-align: center;
  border-radius: var(--fc-radius);
  border: 1px solid var(--fc-line);
  background:
    radial-gradient(420px 220px at 50% -20%, rgba(166, 138, 249, 0.12), transparent 70%),
    linear-gradient(160deg, rgba(20, 26, 36, 0.96), rgba(13, 17, 24, 0.96));
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.45);
}

.founding-gate-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: var(--fc-grad);
  color: #0B0E14;
  font-size: 22px;
  box-shadow: 0 10px 30px rgba(166, 138, 249, 0.3);
}

.founding-gate h2 {
  margin: 0 0 10px;
  font-family: "Unbounded", "Montserrat", sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--fc-text-hi);
  letter-spacing: -0.02em;
}

.founding-gate p {
  margin: 0 0 22px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--fc-muted);
}

.founding-gate-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Rite rail ── */

.rite {
  max-width: 1040px;
  margin: 0 auto;
}

.rite-rail {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  list-style: none;
  margin: 0 0 30px;
  padding: 0;
  counter-reset: rite;
}

.rite-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--fc-line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--fc-dim);
  transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.rite-step::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: -1px;
  height: 1px;
  background: var(--fc-grad);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.rite-step.is-active {
  border-color: rgba(166, 138, 249, 0.4);
  background: linear-gradient(135deg, rgba(166, 138, 249, 0.12), rgba(58, 190, 255, 0.05));
  color: var(--fc-text-hi);
  transform: translateY(-1px);
}

.rite-step.is-active::after {
  opacity: 1;
}

.rite-step.is-done {
  color: var(--fc-muted);
  border-color: rgba(45, 212, 191, 0.22);
}

.rite-step.is-done .rite-num {
  background: rgba(45, 212, 191, 0.14);
  color: var(--fc-teal);
  border-color: rgba(45, 212, 191, 0.3);
}

.rite-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 9px;
  border: 1px solid var(--fc-line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.rite-step.is-active .rite-num {
  border-color: transparent;
  background: var(--fc-grad);
  color: #0B0E14;
}

.rite-label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Stage ── */

.rite-stage {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.rite-preview {
  position: sticky;
  top: 124px;
  padding: 30px 24px 26px;
  border-radius: var(--fc-radius);
  border: 1px solid var(--fc-line);
  background:
    radial-gradient(360px 260px at 50% 0%, rgba(166, 138, 249, 0.14), transparent 72%),
    linear-gradient(170deg, rgba(22, 28, 39, 0.95), rgba(12, 16, 23, 0.96));
  text-align: center;
  overflow: hidden;
}

.rite-preview::after {
  content: "";
  position: absolute;
  inset: auto -40% -60% -40%;
  height: 180px;
  background: radial-gradient(ellipse, rgba(58, 190, 255, 0.14), transparent 70%);
  pointer-events: none;
}

.rite-crest {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.55));
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rite-crest.is-turning {
  transform: rotate(-4deg) scale(0.96);
}

.club-crest-svg {
  display: block;
  height: auto;
}

.rite-preview-name {
  font-family: "Unbounded", "Montserrat", sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--fc-text-hi);
  overflow-wrap: anywhere;
}

.rite-preview-meta {
  margin-top: 7px;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--fc-dim);
}

.rite-preview-rule {
  height: 1px;
  margin: 20px auto;
  width: 72%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
}

.rite-preview-facts {
  display: flex;
  flex-direction: column;
  gap: 9px;
  text-align: left;
  font-size: 12px;
  color: var(--fc-muted);
}

.rite-preview-facts span {
  display: flex;
  align-items: center;
  gap: 9px;
}

.rite-preview-facts i {
  width: 16px;
  color: var(--fc-purple);
  font-size: 11px;
}

/* ── Panels ── */

.rite-body {
  min-width: 0;
}

.rite-panel {
  display: none;
  padding: 30px 30px 28px;
  border-radius: var(--fc-radius);
  border: 1px solid var(--fc-line);
  background: linear-gradient(165deg, rgba(21, 27, 37, 0.92), rgba(12, 16, 23, 0.94));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.rite-panel.is-active {
  display: block;
  animation: rite-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes rite-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.rite-panel h2 {
  margin: 0 0 8px;
  font-family: "Unbounded", "Montserrat", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fc-text-hi);
}

.rite-panel > p {
  margin: 0 0 22px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--fc-muted);
}

.rite-field {
  display: block;
  margin-bottom: 16px;
}

.rite-field > span {
  display: block;
  margin-bottom: 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fc-dim);
}

.rite-field input {
  width: 100%;
  padding: 13px 15px;
  border-radius: 12px;
  border: 1px solid var(--fc-line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--fc-text-hi);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.rite-field input::placeholder {
  color: #4B5563;
}

.rite-field input:focus {
  border-color: var(--fc-line-hi);
  background: rgba(58, 190, 255, 0.045);
}

.rite-field input:disabled {
  opacity: 0.6;
}

.rite-hint {
  min-height: 18px;
  margin: -6px 0 18px;
  font-size: 11.5px;
  color: var(--fc-dim);
}

.rite-hint.is-error {
  color: #f87171;
}

.rite-hint.is-good {
  color: var(--fc-teal);
}

.rite-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 24px;
}

.rite-actions--end {
  justify-content: flex-end;
}

.rite-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid var(--fc-line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--fc-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.rite-btn:hover:not(:disabled) {
  border-color: var(--fc-line-hi);
  background: rgba(58, 190, 255, 0.07);
  color: var(--fc-text-hi);
  transform: translateY(-1px);
}

.rite-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.rite-btn--primary {
  border-color: transparent;
  background: var(--fc-grad);
  color: #0B0E14;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(166, 138, 249, 0.25);
}

.rite-btn--primary:hover:not(:disabled) {
  color: #0B0E14;
  filter: brightness(1.06);
}

.rite-btn--gold {
  border-color: transparent;
  background: linear-gradient(135deg, #FBBF24, #fb923c);
  color: #201302;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(251, 191, 36, 0.28);
}

.rite-btn--gold:hover:not(:disabled) {
  color: #201302;
  filter: brightness(1.05);
}

.rite-btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--fc-muted);
  font-weight: 500;
}

.rite-btn--ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.04);
  color: var(--fc-text);
}

/* ── Emblem picker ── */

.emblem-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 6px;
}

.emblem-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 8px 13px;
  border-radius: 16px;
  border: 1px solid var(--fc-line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--fc-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.emblem-option:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--fc-text);
}

.emblem-option.is-selected {
  border-color: rgba(166, 138, 249, 0.55);
  background: linear-gradient(160deg, rgba(166, 138, 249, 0.12), rgba(58, 190, 255, 0.05));
  color: var(--fc-text-hi);
  box-shadow: 0 0 0 1px rgba(166, 138, 249, 0.22), 0 14px 30px rgba(0, 0, 0, 0.35);
}

.emblem-option.is-selected::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fc-gold);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.9);
}

.emblem-swatch {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: block;
}

/* ── Review ── */

.rite-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px 18px;
  margin: 0 0 22px;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--fc-line);
  background: rgba(255, 255, 255, 0.02);
}

.rite-summary dt {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fc-dim);
  align-self: center;
}

.rite-summary dd {
  margin: 0;
  font-size: 13.5px;
  color: var(--fc-text-hi);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.rite-oath {
  margin: 0;
  padding: 14px 16px;
  border-left: 2px solid rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.045);
  border-radius: 0 10px 10px 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: rgba(251, 191, 36, 0.86);
}

.rite-error {
  min-height: 18px;
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #f87171;
}

.rite-error:empty {
  display: none;
}

/* ── Sealed / success ── */

.sealed {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}

.sealed[hidden] {
  display: none;
}

.seal {
  position: relative;
  width: 190px;
  height: 210px;
  margin: 0 auto 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}

.seal.is-stamping,
.seal.is-stamped {
  opacity: 1;
}

.seal.is-stamping {
  animation: seal-drop 0.9s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

@keyframes seal-drop {
  0% { transform: scale(2.5) rotate(-7deg); opacity: 0; filter: blur(10px); }
  45% { opacity: 1; filter: blur(0); }
  68% { transform: scale(0.93) rotate(1.2deg); }
  84% { transform: scale(1.03) rotate(-0.5deg); }
  100% { transform: scale(1) rotate(0); }
}

.seal-ring {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 1px solid rgba(251, 191, 36, 0.5);
  opacity: 0;
}

.seal.is-stamped .seal-ring {
  animation: seal-ring 1.1s ease-out forwards;
}

@keyframes seal-ring {
  0% { transform: scale(0.55); opacity: 0.85; }
  100% { transform: scale(1.5); opacity: 0; }
}

.seal-crest {
  filter: drop-shadow(0 18px 38px rgba(0, 0, 0, 0.6));
}

.seal-caption {
  position: absolute;
  left: 50%;
  bottom: -4px;
  transform: translateX(-50%) rotate(-4deg);
  padding: 5px 14px;
  border-radius: 999px;
  border: 2px solid rgba(251, 191, 36, 0.55);
  background: rgba(11, 14, 20, 0.9);
  color: var(--fc-gold);
  font-family: "Unbounded", "Montserrat", sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
}

.seal.is-stamped .seal-caption {
  animation: caption-in 0.5s ease 0.35s forwards;
}

@keyframes caption-in {
  from { opacity: 0; transform: translateX(-50%) rotate(-4deg) scale(0.9); }
  to { opacity: 1; transform: translateX(-50%) rotate(-4deg) scale(1); }
}

.sealed-body {
  padding: 30px 28px 26px;
  border-radius: 22px;
  border: 1px solid rgba(251, 191, 36, 0.18);
  background:
    radial-gradient(420px 240px at 50% -10%, rgba(251, 191, 36, 0.08), transparent 70%),
    linear-gradient(165deg, rgba(22, 28, 39, 0.96), rgba(12, 16, 23, 0.97));
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(10px);
}

.sealed.is-done .sealed-body {
  animation: sealed-in 0.5s ease forwards;
}

@keyframes sealed-in {
  to { opacity: 1; transform: translateY(0); }
}

.sealed-body h2 {
  margin: 18px 0 10px;
  font-family: "Unbounded", "Montserrat", sans-serif;
  font-size: clamp(1.3rem, 3.6vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fc-text-hi);
}

.sealed-sub {
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--fc-muted);
}

.sealed-link {
  display: flex;
  align-items: center;
  border-radius: 12px;
  border: 1px solid var(--fc-line);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
  margin-bottom: 16px;
}

.sealed-link input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: none;
  background: transparent;
  color: var(--fc-blue);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  outline: none;
}

.sealed-link button {
  flex-shrink: 0;
  padding: 12px 16px;
  border: none;
  border-left: 1px solid var(--fc-line);
  background: rgba(58, 190, 255, 0.07);
  color: var(--fc-blue);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.sealed-link button:hover {
  background: rgba(58, 190, 255, 0.14);
  color: var(--fc-text-hi);
}

.sealed-qr {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.sealed-qr:empty {
  display: none;
}

.sealed-qr .qr-frame {
  padding: 10px;
  border-radius: 14px;
  background: #F7F9FF;
  line-height: 0;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.sealed-qr svg {
  width: 132px;
  height: 132px;
  display: block;
}

.sealed-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sealed-actions .rite-btn {
  width: 100%;
}

.sealed-note {
  margin: 16px 0 0;
  font-size: 11.5px;
  color: var(--fc-dim);
}

/* ── Responsive ── */

@media (max-width: 860px) {
  .rite-stage {
    grid-template-columns: 1fr;
  }

  .rite-preview {
    position: static;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    text-align: left;
    padding: 20px;
  }

  .rite-crest {
    margin: 0;
  }

  .rite-preview-rule,
  .rite-preview-facts {
    display: none;
  }

  .rite-preview-name,
  .rite-preview-meta {
    text-align: left;
    grid-column: 2;
  }
}

@media (max-width: 640px) {
  .founding {
    padding: 118px 16px 72px;
  }

  .rite-rail {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .rite-step {
    padding: 10px 13px;
  }

  .rite-panel {
    padding: 24px 20px;
  }

  .emblem-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rite-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .rite-actions .rite-btn {
    width: 100%;
  }

  .rite-summary {
    grid-template-columns: 1fr;
    gap: 4px 0;
  }

  .rite-summary dd {
    margin-bottom: 8px;
  }

  .sealed-body {
    padding: 26px 20px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rite-panel.is-active,
  .seal.is-stamping,
  .seal.is-stamped .seal-ring,
  .seal.is-stamped .seal-caption,
  .sealed.is-done .sealed-body {
    animation: none !important;
  }

  .seal,
  .sealed-body {
    opacity: 1;
    transform: none;
  }

  .rite-crest,
  .emblem-option,
  .rite-btn {
    transition: none !important;
  }
}
