/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --yellow: #ffe578;
  --yellow-hover: #ffd633;
  --dark: #252525;
  --dark-mid: #333333;
  --cream: #fbf7f1;
  --red: #d4174a;
  --orange: #e87c1e;
  --green: #2eac4a;
  --text: #333333;
  --text-light: #666666;
  --text-muted: #999999;
  --border: #e0dcd6;
  --radius: 6px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  font-family: 'Merriweather', Georgia, serif;
  line-height: 1.3;
}

a {
  color: var(--dark);
  text-decoration: underline;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--yellow);
  color: var(--dark);
  padding: 14px 28px;
}

.btn-primary:hover {
  background: var(--yellow-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
  background: transparent;
  color: var(--dark);
  padding: 14px 28px;
  border: 2px solid var(--dark);
}

.btn-secondary:hover {
  background: var(--dark);
  color: white;
}

.btn-large {
  padding: 16px 32px;
  font-size: 17px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

[hidden] { display: none !important; }
.btn-loading { display: inline-flex; align-items: center; gap: 8px; }

/* ===== Spinner ===== */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--dark);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-large {
  width: 40px;
  height: 40px;
  border: 3px solid var(--yellow);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Hero ===== */
.hero {
  background: var(--yellow);
  color: var(--dark);
  padding: 60px 0 50px;
  text-align: center;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-eyebrow {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--dark);
  opacity: 0.7;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 900;
  margin-bottom: 16px;
  color: var(--dark);
}

.hero-sub {
  font-size: 17px;
  color: var(--dark-mid);
  max-width: 560px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

.hero-sub strong {
  color: var(--dark);
}

/* ===== Headline Form ===== */
.headline-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 520px;
  margin: 0 auto;
}

.headline-form input[type="text"] {
  width: 100%;
  padding: 16px 20px;
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  border: 2px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius);
  background: white;
  color: var(--dark);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.headline-form input[type="text"]:focus {
  border-color: var(--dark);
  box-shadow: 0 0 0 3px rgba(37, 37, 37, 0.15);
}

.headline-form input[type="text"]::placeholder {
  color: var(--text-muted);
}

.headline-form .btn-primary {
  background: var(--dark);
  color: white;
  font-size: 17px;
  font-weight: 700;
  padding: 16px 28px;
  letter-spacing: 0.3px;
  border: 2px solid var(--dark);
}

.headline-form .btn-primary:hover {
  background: #111;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.hero-note {
  font-size: 13px;
  color: var(--dark-mid);
  opacity: 0.6;
  margin-top: 12px;
}

/* ===== Compact hero (applied once results are shown) ===== */
.hero.compact {
  padding: 18px 0;
  flex: none;
}

.hero.compact .hero-eyebrow,
.hero.compact .hero-sub,
.hero.compact .hero-note {
  display: none;
}

.hero.compact h1 {
  font-size: clamp(20px, 3.5vw, 26px);
  margin-bottom: 0;
}

/* The input form is dropped once results show — the entered headline is
   shown above the score instead. */
.hero.compact .headline-form {
  display: none;
}

/* ===== Loading Section ===== */
.loading-section {
  padding: 60px 0;
  text-align: center;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loading-tip {
  font-size: 15px;
  color: var(--text-light);
  font-style: italic;
  max-width: 400px;
  min-height: 48px;
}

/* ===== Results Section ===== */
.results-section {
  padding: 50px 0 20px;
}

/* Score Card */
.score-card {
  text-align: center;
  padding: 40px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  margin-bottom: 40px;
}

/* The headline the user entered, shown above the score gauge */
.analyzed-headline {
  font-size: 15px;
  font-style: italic;
  color: var(--text-light);
  max-width: 460px;
  margin: 0 auto 24px;
  line-height: 1.5;
}

.analyzed-headline::before { content: '\201C'; }
.analyzed-headline::after { content: '\201D'; }

.score-gauge {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 20px;
}

.score-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-ring-bg {
  fill: none;
  stroke: #eee;
  stroke-width: 8;
}

.score-ring-fill {
  fill: none;
  stroke: var(--red);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 1.5s ease-out, stroke 0.5s ease;
}

.score-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  font-family: 'Merriweather', serif;
  font-size: 42px;
  font-weight: 900;
  color: var(--dark);
}

.score-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, 50%);
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.verdict {
  font-size: 18px;
  font-weight: 600;
  color: var(--dark);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ===== Dimensions ===== */
.dimensions {
  margin-bottom: 40px;
}

.dimensions h2 {
  font-size: 24px;
  margin-bottom: 24px;
}

.dimension {
  background: white;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.dimension-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.dimension-name {
  font-weight: 600;
  font-size: 15px;
}

.dimension-score {
  font-family: 'Merriweather', serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--dark);
  min-width: 40px;
  text-align: right;
}

.dimension-bar {
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.dimension-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  transition: width 1s ease-out, background-color 0.5s ease;
  background: var(--red);
}

.dimension-feedback {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-light);
  margin: 0;
}

.dimension-feedback.locked {
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
}

.lock-icon {
  font-size: 12px;
}

.dimension-feedback.unlocked {
  color: var(--text);
  font-style: normal;
}

/* ===== Profile Inferences ===== */
.inferences-section {
  margin-bottom: 40px;
}

.inferences-section h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.inferences-intro {
  color: var(--text-light);
  margin-bottom: 20px;
  font-size: 15px;
}

.inferences-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inference-item {
  background: white;
  border-left: 3px solid var(--yellow);
  border-radius: 0 10px 10px 0;
  padding: 16px 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.inference-item p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--dark);
  margin: 0;
  font-weight: 500;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== Positioning Gap ===== */
.positioning-gap-section {
  margin-bottom: 16px;
}

.positioning-gap-card {
  background: var(--dark);
  color: white;
  border-radius: 12px;
  padding: 28px 32px;
}

.positioning-gap-card h3 {
  font-size: 18px;
  color: var(--yellow);
  margin-bottom: 12px;
}

.positioning-gap-card p {
  font-size: 15px;
  line-height: 1.7;
  color: #ddd;
  margin: 0;
}

/* ===== Email Gate ===== */
.email-gate {
  background: var(--dark);
  color: white;
  border-radius: 12px;
  padding: 40px 32px;
  text-align: center;
  margin-bottom: 40px;
}

.email-gate h2 {
  font-size: clamp(20px, 4vw, 26px);
  margin-bottom: 10px;
  color: white;
}

.email-gate > p {
  color: #bbb;
  margin-bottom: 24px;
  font-size: 15px;
}

.email-gate-offer {
  line-height: 1.7;
}

.email-gate-offer strong {
  color: var(--yellow);
  font-weight: 600;
}

.email-confirmation {
  background: #fff8d6;
  border: 2px solid var(--yellow);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 40px;
  text-align: center;
}

.email-confirmation-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  color: var(--dark);
}

.email-confirmation-detail {
  margin: 0;
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.5;
}

.email-confirmation-check {
  color: #2b7a3e;
  font-weight: 700;
  margin-right: 6px;
}

.email-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  margin: 0 auto;
}

.email-form input[type="email"] {
  flex: 1;
  padding: 14px 18px;
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
}

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

.email-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
}

/* ===== Generated Headlines ===== */
.headlines-section {
  margin-bottom: 40px;
}

.headlines-section h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.headlines-intro {
  color: var(--text-light);
  margin-bottom: 24px;
  font-size: 15px;
}

.headlines-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.headline-card {
  background: white;
  border-radius: 10px;
  padding: 20px 24px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.headline-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.headline-text {
  font-weight: 600;
  font-size: 15px;
  color: var(--dark);
  flex: 1;
  line-height: 1.5;
}

.copy-btn {
  flex-shrink: 0;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
}

.copy-btn:hover {
  background: var(--yellow);
  border-color: var(--yellow);
}

.copy-btn.copied {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.headline-why {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.5;
}

/* ===== CTA Section ===== */
.cta-section {
  background: var(--dark);
  color: white;
  padding: 60px 0;
  text-align: center;
}

.cta-section h2 {
  font-size: clamp(22px, 4vw, 30px);
  margin-bottom: 14px;
  color: white;
}

.cta-body {
  font-size: 17px;
  color: #ccc;
  max-width: 520px;
  margin: 0 auto 36px;
  line-height: 1.7;
}

.cta-body strong {
  color: var(--yellow);
}

.cta-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-number {
  font-family: 'Merriweather', serif;
  font-size: 32px;
  font-weight: 900;
  color: var(--yellow);
}

.stat-label {
  font-size: 13px;
  color: #aaa;
  margin-top: 4px;
}

.cta-logos {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 32px;
}

.cta-logos strong {
  color: white;
}

.cta-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.cta-sub-link {
  margin-top: 16px;
  font-size: 14px;
}

.cta-sub-link a {
  color: #aaa;
  text-decoration: underline;
  transition: color 0.2s;
}

.cta-sub-link a:hover {
  color: white;
}

/* ===== Footer ===== */
.footer {
  padding: 32px 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-light);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.footer strong {
  color: var(--text);
}

.footer-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ===== Error Toast ===== */
.error-toast,
.success-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  animation: slideUp 0.3s ease;
  max-width: 90vw;
  text-align: center;
}

.error-toast { background: var(--red); }
.success-toast { background: var(--green); }

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .hero { padding: 40px 0 36px; }

  .headline-form {
    padding: 0 4px;
  }

  .email-gate {
    padding: 32px 20px;
  }

  .cta-stats {
    gap: 24px;
  }

  .stat-number {
    font-size: 26px;
  }

  .dimension {
    padding: 16px 18px;
  }

  .headline-card-top {
    flex-direction: column;
  }

  .copy-btn {
    align-self: flex-start;
  }

  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }

  .cta-buttons .btn {
    width: 100%;
    max-width: 320px;
  }

  .inference-item {
    padding: 14px 16px;
  }

  .inference-item p {
    font-size: 14px;
  }

  .positioning-gap-card {
    padding: 24px 20px;
  }

  .inferences-section h2,
  .headlines-section h2 {
    font-size: 20px;
  }
}
