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

:root {
  --red:    #CE2939;
  --red-dk: #a81f2d;
  --green:  #2d5a27;
  --ink:    #1a1a1a;
  --rule:   #111;
  --cream:  #f9f6f0;
  --white:  #ffffff;
  --gray:   #666;
  --lgray:  #d8d3cb;
  --serif:  Georgia, 'Times New Roman', Times, serif;
  --sans:   -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--serif);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.65;
}

/* ── Masthead ── */
header {
  background: var(--white);
  border-top: 5px solid var(--red);
  padding: 1.75rem 2rem 1.25rem;
  text-align: center;
}

.header-logo {
  height: 110px;
  width: auto;
  display: inline-block;
}

.header-tagline {
  margin-top: 0.6rem;
  font-style: italic;
  color: var(--gray);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

/* ── Green stripe ── */
.green-stripe {
  height: 5px;
  background: var(--green);
}

/* ── Hero ── */
.hero {
  background: var(--cream);
  color: var(--ink);
  text-align: center;
  padding: 4rem 2rem 3.5rem;
  border-bottom: 1px solid var(--lgray);
}

.hero h1 {
  font-size: clamp(1.9rem, 5vw, 3.25rem);
  font-weight: bold;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 1rem;
  max-width: 700px;
  margin-inline: auto;
  color: var(--rule);
}

.hero h1 em {
  color: var(--red);
  font-style: italic;
}

.hero .subtitle {
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  color: var(--gray);
  max-width: 520px;
  margin: 0 auto 2.5rem;
  line-height: 1.75;
}

/* Signup — classified-ad box */
.signup-wrap {
  max-width: 480px;
  margin: 0 auto;
  border: 2px solid var(--rule);
  padding: 1.75rem 1.75rem 1.25rem;
  background: var(--white);
  position: relative;
}

.signup-wrap::before {
  content: 'FELIRATKOZÁS';
  position: absolute;
  top: -0.7em;
  left: 50%;
  transform: translateX(-50%);
  background: var(--white);
  padding: 0 0.75rem;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--gray);
  white-space: nowrap;
}

.signup-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.signup-form input[type="email"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--lgray);
  border-radius: 0;
  font-size: 0.95rem;
  font-family: var(--serif);
  outline: none;
  background: var(--cream);
  color: var(--ink);
  transition: border-color 0.2s, background 0.2s;
}

.signup-form input[type="email"]:focus {
  border-color: var(--red);
  background: var(--white);
}

.signup-form input[type="email"].error {
  border-color: var(--red);
}

.signup-form button {
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 0;
  font-size: 0.85rem;
  font-weight: bold;
  font-family: var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s;
}

.signup-form button:hover  { background: var(--red-dk); }
.signup-form button:active { opacity: 0.85; }

#loadingBtn { display: none; }

.captcha-container + .signup-form {
  margin-top: 0.75rem;
}

/* Captcha */
.captcha-container {
  margin-top: 0.75rem;
}

.captcha-row {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.captcha-image {
  flex: 1;
  border: 1px solid var(--lgray);
  border-right: none;
  background: var(--white);
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.captcha-image svg {
  display: block;
  width: 100%;
  height: auto;
}

.captcha-refresh {
  background: var(--white);
  border: 1px solid var(--lgray);
  color: var(--gray);
  cursor: pointer;
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
  transition: color 0.15s, border-color 0.15s;
}

.captcha-refresh:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.captcha-input {
  flex: 1;
  margin-left: 0.5rem;
  border: 1px solid var(--lgray);
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  font-family: var(--serif);
  background: var(--cream);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}

.captcha-input:focus {
  border-color: var(--red);
  background: var(--white);
}

/* Success state */
.signup-success {
  display: none;
  padding: 1.5rem;
  text-align: center;
}

.signup-success .check {
  color: var(--green);
  font-size: 1.75rem;
  margin-bottom: 0.4rem;
}

.signup-success p {
  font-size: 1.05rem;
  font-style: italic;
}

.signup-success .success-sub {
  font-size: 0.875rem;
  color: var(--gray);
  margin-top: 0.3rem;
}

/* Error message */
.signup-error {
  display: none;
  color: var(--red);
  font-style: italic;
  font-size: 0.85rem;
  text-align: center;
  margin-top: 0.5rem;
}

/* Back button */
.signup-back {
  display: none;
  margin: 0.75rem auto 0;
  background: transparent;
  border: 1px solid var(--lgray);
  color: var(--gray);
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  padding: 0.4rem 1.25rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.signup-back:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* ── Shared section styles ── */
section {
  padding: 4rem 2rem;
}

.container {
  max-width: 880px;
  margin: 0 auto;
}

/* Ruled section heading */
.section-title {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 2.5rem;
  border-top: 3px double var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 0.4rem 0;
  text-align: center;
  justify-content: center;
}

.section-title span {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
}

/* ── How it works ── */
.how-it-works {
  background: var(--white);
  border-top: 1px solid var(--lgray);
  border-bottom: 1px solid var(--lgray);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--lgray);
}

.step {
  text-align: center;
  padding: 2rem 1.5rem;
  border-right: 1px solid var(--lgray);
}

.step:last-child {
  border-right: none;
}

.step-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  display: block;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 2px solid var(--red);
  color: var(--red);
  border-radius: 50%;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.step h3 {
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 0.4rem;
  color: var(--rule);
}

.step p {
  font-size: 0.9rem;
  color: var(--gray);
  line-height: 1.6;
}

/* ── Sources ── */
.sources {
  background: var(--cream);
}

.sources-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.source-tag {
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  padding: 0.15rem 0;
  border-bottom: 2px solid var(--red);
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}

a.source-tag:hover {
  color: var(--red);
  border-color: var(--red-dk);
}

.ai-note {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--gray);
  border-top: 1px solid var(--lgray);
  padding-top: 1.25rem;
  line-height: 1.7;
}

.ai-note strong {
  font-style: normal;
  color: var(--ink);
}

/* ── Footer ── */
footer {
  background: var(--rule);
  color: rgba(255,255,255,0.5);
  text-align: center;
  padding: 1.5rem 2rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  border-top: 4px double rgba(255,255,255,0.15);
}

footer a {
  color: rgba(255,255,255,0.5);
  text-decoration: underline;
}

footer a:hover { color: var(--white); }

/* ── Responsive ── */
@media (max-width: 640px) {
  header {
    padding: 1.25rem 1rem 1rem;
  }

  .captcha-row {
    flex-wrap: wrap;
  }

  .captcha-image {
    flex: 1 0 calc(100% - 45px);
    border-right: 1px solid var(--lgray);
  }

  .captcha-refresh {
    flex: 0 0 auto;
  }

  .captcha-input {
    flex: 1 0 100%;
    margin-left: 0;
    margin-top: 0.5rem;
  }

  .header-logo {
    height: 80px;
    max-width: 90%;
  }

  .hero {
    padding: 2.75rem 1.25rem 2.5rem;
  }

  .signup-wrap {
    margin: 0 0.25rem;
  }

  .steps {
    grid-template-columns: 1fr;
  }

  .step {
    border-right: none;
    border-bottom: 1px solid var(--lgray);
  }

  .step:last-child {
    border-bottom: none;
  }

  section {
    padding: 3rem 1.25rem;
  }
}
