@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&display=swap');

:root {
  --bg: #F7F3E8;
  --black: #000000;
  --green: #319d43;
  --green-dark: #267a34;
  --red: #cb0a33;
  --white: #FFFFFF;
  --grey: #888888;
  --grey-light: #AAAAAA;
  --bar-bg: #E8E3D6;
  --border: 3px solid #000000;
}

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

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg);
  color: var(--black);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */

.container {
  max-width: 620px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* ── Header ── */

.brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--black);
  opacity: 0.5;
  margin-bottom: 3rem;
}

.brand span {
  color: var(--red);
}

/* ── Hero ── */

.hero {
  margin-bottom: 2.5rem;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

.hero p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #333;
}

.hero p + p {
  margin-top: 0.75rem;
}

/* ── Compteur ── */

.counter {
  border: var(--border);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2.5rem;
  background: var(--white);
}

.counter-label {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.counter-label .count {
  color: var(--green);
}

.progress-bar {
  height: 28px;
  background: var(--bar-bg);
  border: 2px solid var(--black);
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--green);
  transition: width 0.6s ease;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--grey);
  margin-top: 0.5rem;
  text-align: right;
}

/* ── Paliers ── */

.tiers-section {
  margin-bottom: 1.5rem;
}

.tiers-label {
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--grey);
  margin-bottom: 0.75rem;
}

.tiers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}

.tier {
  border: var(--border);
  padding: 1.25rem 0.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--white);
  transition: background 0.15s, color 0.15s;
  user-select: none;
  margin-left: -3px;
}

.tier:first-child {
  margin-left: 0;
}

.tier:hover {
  background: var(--bar-bg);
}

.tier.selected {
  background: var(--green);
  color: var(--white);
}

.tier-amount {
  font-weight: 700;
  font-size: 1.5rem;
  display: block;
  line-height: 1.2;
}

.tier-period {
  font-size: 0.8rem;
  opacity: 0.7;
}

.tier.selected .tier-period {
  opacity: 0.9;
}

/* ── Montant libre ── */

.custom-amount {
  margin-top: -3px;
  border: var(--border);
  padding: 1rem 1.25rem;
  background: var(--white);
  display: none;
  align-items: center;
  gap: 0.75rem;
}

.custom-amount.visible {
  display: flex;
}

.custom-amount label {
  font-weight: 500;
  font-size: 0.95rem;
  white-space: nowrap;
}

.custom-amount input {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  width: 100px;
  padding: 0.4rem 0.6rem;
  border: 2px solid var(--black);
  background: var(--bg);
  text-align: center;
  outline: none;
}

.custom-amount input:focus {
  border-color: var(--green);
}

.custom-amount .unit {
  font-weight: 700;
  font-size: 1.1rem;
}

/* ── CTA ── */

.cta-wrapper {
  margin-bottom: 2.5rem;
}

.cta {
  display: block;
  width: 100%;
  padding: 1.1rem 2rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--green);
  border: var(--border);
  cursor: pointer;
  transition: background 0.15s;
  text-align: center;
}

.cta:hover {
  background: var(--green-dark);
}

.cta:disabled {
  opacity: 0.6;
  cursor: wait;
}

.cta-sub {
  text-align: center;
  margin-top: 0.75rem;
}

.cta-sub a {
  font-size: 0.85rem;
  color: var(--grey);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cta-sub a:hover {
  color: var(--black);
}

/* ── Pourquoi ── */

.why {
  border-top: var(--border);
  padding-top: 2rem;
  margin-bottom: 2.5rem;
}

.why h2 {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.why ul {
  list-style: none;
}

.why li {
  padding: 0.4rem 0;
  font-size: 1rem;
  line-height: 1.5;
}

.why li::before {
  content: "—";
  font-weight: 700;
  margin-right: 0.5rem;
  color: var(--green);
}

/* ── Footer ── */

.footer {
  border-top: var(--border);
  padding-top: 1.5rem;
  text-align: center;
}

.footer-tagline {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.footer-links {
  font-size: 0.8rem;
  color: var(--grey);
}

.footer-links a {
  color: var(--grey);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-links a:hover {
  color: var(--black);
}

/* ── Erreur ── */

.error-msg {
  color: var(--red);
  font-weight: 500;
  font-size: 0.9rem;
  text-align: center;
  margin-top: 0.5rem;
  min-height: 1.4em;
}

/* ── Responsive ── */

@media (max-width: 520px) {
  .container {
    padding: 2rem 1rem;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

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

  .tier {
    margin-left: 0;
    margin-top: -3px;
  }

  .tier:nth-child(-n+2) {
    margin-top: 0;
  }

  .tier:nth-child(even) {
    margin-left: -3px;
  }

  .tier-amount {
    font-size: 1.3rem;
  }

  .custom-amount {
    flex-wrap: wrap;
  }
}

/* ── Page merci ── */

.merci {
  text-align: center;
  padding-top: 4rem;
}

.merci h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--green);
}

.merci p {
  font-size: 1.1rem;
  line-height: 1.7;
  color: #333;
  max-width: 480px;
  margin: 0 auto;
}

.merci p + p {
  margin-top: 1rem;
}

.share-links {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  gap: 0;
}

.share-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: var(--border);
  text-decoration: none;
  color: var(--black);
  background: var(--white);
  transition: background 0.15s, color 0.15s;
  margin-left: -3px;
}

.share-link:first-child {
  margin-left: 0;
}

.share-link:hover {
  background: var(--black);
  color: var(--white);
}

.share-link svg {
  width: 20px;
  height: 20px;
}

.back-link {
  display: inline-block;
  margin-top: 2.5rem;
  font-size: 0.9rem;
  color: var(--grey);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.back-link:hover {
  color: var(--black);
}
