/* ── Reset & Tokens ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-page-bg:        #f7f5ff;
  --color-surface:        #ffffff;
  --color-surface-subtle: #faf8ff;
  --color-surface-inset:  #f0ecfd;
  --color-border:         #e2dcf8;
  --color-border-subtle:  #eee9fc;
  --color-border-input:   #ddd6f8;
  --color-brand:          #6c4fc4;
  --color-brand-light:    #ede9fc;
  --color-brand-muted:    #c4b5f7;
  --color-text-heading:   #2d1f6e;
  --color-text-body:      #3d3060;
  --color-text-secondary: #8b82b8;
  --color-text-muted:     #a099c8;
  --color-text-faint:     #c4bde8;
  --color-rank-1:         #c4a84f;
  --color-rank-2:         #b0b8c4;
  --color-rank-3:         #c49a6c;
  --color-rank-default:   #ddd6f8;
  --topbar-h: 52px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--color-page-bg);
  color: var(--color-text-body);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-brand); text-decoration: none; }

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--color-surface);
  border-bottom: 0.5px solid var(--color-border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-mark {
  width: 28px; height: 28px;
  background: var(--color-brand-light);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-brand);
  flex-shrink: 0;
}

.logo-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-heading);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.topbar-nav a {
  color: var(--color-text-secondary);
  font-size: 13px;
  text-decoration: none;
  transition: color 0.1s;
}

.topbar-nav a:hover { color: var(--color-brand); }

.btn-topbar-register {
  padding: 7px 16px;
  background: var(--color-brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}

.btn-topbar-register:hover { opacity: 0.88; }

/* ── Hero — full viewport ────────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  padding-top: var(--topbar-h);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  /* shift content above true centre for better visual balance */
  justify-content: flex-start;
  padding-top: calc(var(--topbar-h) + 7vh);
  text-align: center;
  position: relative;
  border-bottom: 0.5px solid var(--color-border);
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1.5rem 2rem;
  width: 100%;
  max-width: 860px;
}

.hero-h1 {
  font-size: clamp(40px, 6vw, 76px);
  white-space: nowrap;
  font-weight: 500;
  color: var(--color-text-heading);
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: 0.4rem;
}

.hero-sub {
  font-size: clamp(28px, 4.5vw, 52px);
  font-weight: 500;
  color: var(--color-brand);
  font-style: italic;
  line-height: 1.2;
  margin-bottom: 1.5rem;
}

.hero-desc {
  max-width: 520px;
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

/* ── Hero CTA buttons ────────────────────────────────────────────────────── */
.hero-ctas {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-hero-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--color-brand);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s, background 0.15s;
}

.btn-hero-primary:hover { opacity: 0.9; }
.btn-hero-primary.active { background: var(--color-text-heading); }

.btn-hero-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: transparent;
  color: var(--color-brand);
  border: 1.5px solid var(--color-brand-muted);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
}

.btn-hero-secondary:hover {
  background: var(--color-brand-light);
  border-color: var(--color-brand);
  color: var(--color-brand);
}

/* ── Expandable registration form ────────────────────────────────────────── */
.hero-form-wrap {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.35s ease,
              margin-top 0.35s ease;
  width: 100%;
  max-width: 420px;
  opacity: 0;
  margin-top: 0;
}

.hero-form-wrap.open {
  max-height: 700px;
  opacity: 1;
  margin-top: 1.75rem;
}

.reg-card {
  background: var(--color-page-bg);
  border: 0.5px solid var(--color-border-input);
  border-radius: 14px;
  padding: 1.25rem;
  text-align: left;
}

.form-group-mb { margin-bottom: 10px; }

.reg-card input[type="text"],
.reg-card input[type="email"] {
  width: 100%;
  background: var(--color-surface);
  border: 0.5px solid var(--color-border-input);
  border-radius: 7px;
  padding: 9px 12px;
  color: var(--color-text-heading);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.reg-card input::placeholder {
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 500;
}
.reg-card input:focus { border-color: var(--color-brand-muted); }

.btn-whatsapp {
  width: 100%;
  margin-top: 4px;
  padding: 11px;
  background: #25D366;
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn-whatsapp:hover { opacity: 0.9; color: #ffffff; }
.btn-whatsapp:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-whatsapp i { font-size: 16px; }

.reg-alert {
  font-size: 12px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  display: none;
}

.reg-alert.visible { display: block; }
.reg-alert-success { background: #ecfdf5; color: #065f46; border: 0.5px solid #a7f3d0; }
.reg-alert-error   { background: #fef2f2; color: #991b1b; border: 0.5px solid #fecaca; }
.reg-alert-info    { background: var(--color-brand-light); color: var(--color-brand); border: 0.5px solid var(--color-border-input); }

.spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 1.5px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scroll hint ─────────────────────────────────────────────────────────── */
.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--color-text-faint);
  font-size: 24px;
  text-decoration: none;
  animation: bounce 2.2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(7px); }
}

/* ── Community section ───────────────────────────────────────────────────── */
.page-body {
  padding: 3rem 2rem 4rem;
  text-align: center;
}

.section-title {
  font-size: 30px;
  font-weight: 700;
  color: var(--color-text-heading);
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  text-transform: none;
}

/* ── Certificate Card Grid ───────────────────────────────────────────────── */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 300px));
  gap: 16px;
  justify-content: center;
}

.cert-card {
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: 12px;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
  text-decoration: none;
  display: block;
  color: inherit;
}

.cert-card:hover {
  box-shadow: 0 4px 16px rgba(108, 79, 196, 0.10);
  transform: translateY(-2px);
}

.cert-card-rank-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.cert-card-emblem {
  font-size: 10px;
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 10px;
  margin-top: 4px;
}

.cert-card-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--color-text-heading);
  margin-bottom: 10px;
  line-height: 1.3;
}

.cert-card-count {
  font-size: 28px;
  font-weight: 500;
  color: var(--color-brand);
  line-height: 1;
}

.cert-card-count-label {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
  margin-bottom: 10px;
}

.cert-card-since {
  font-size: 11px;
  color: var(--color-text-faint);
  margin-bottom: 10px;
}

.cert-card-progress-track {
  background: var(--color-surface-inset);
  border-radius: 99px;
  height: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

.cert-card-progress-fill {
  background: var(--color-brand-muted);
  border-radius: 99px;
  height: 100%;
}

.cert-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.cert-card-actions button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-faint);
  font-size: 18px;
  padding: 4px;
  border-radius: 5px;
  transition: color 0.1s, background 0.1s;
  line-height: 1;
}

.cert-card-actions button:hover {
  color: var(--color-brand);
  background: var(--color-surface-inset);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .cert-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }
}

@media (max-width: 600px) {
  .topbar { padding: 0 1rem; }
  .topbar-nav a { display: none; }
  .btn-topbar-register { display: none; }

  /* Tighter vertical offset on mobile — sit higher, use space well */
  .hero {
    justify-content: flex-start;
    padding-top: calc(var(--topbar-h) + 5vw);
  }

  .hero-inner { padding: 0 1.25rem 1.5rem; }

  /* Big, bold, attention-grabbing on mobile */
  .hero-h1 {
    font-size: clamp(42px, 12vw, 58px);
    white-space: normal;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.0;
    margin-bottom: 0.3rem;
  }

  .hero-sub {
    font-size: clamp(30px, 9vw, 42px);
    font-weight: 700;
    margin-bottom: 1rem;
  }

  .hero-desc {
    font-size: 14px;
    margin-bottom: 1.5rem;
  }

  .btn-hero-primary {
    width: 100%;
    justify-content: center;
    font-size: 16px;
    padding: 16px 24px;
  }

  .hero-form-wrap { max-width: 100%; }

  .cert-grid { grid-template-columns: 1fr; justify-content: stretch; }
  .page-body { padding: 2rem 1rem 3rem; }
  .section-title { font-size: 24px; font-weight: 700; }
}
