/* ══════════════════════════════════════════════════════════════════════
   AI Survey Generator (/generate)
   Rendered inside the marketing layout, so it shares the home page's
   warm-paper light theme, Geologica/Atkinson type, forest-green accent,
   and dark-green nav/footer. The dark IDE look stays in the playground.
   Tokens (--bg, --text, --accent, --serif, --sans, --mono, …) come from
   the marketing layout.
   ══════════════════════════════════════════════════════════════════════ */

.aig-page {
  --paper: oklch(99% 0.006 80);
  background:
    radial-gradient(72% 55% at 50% 0%, oklch(95% 0.045 148 / 0.55), transparent 70%),
    var(--bg);
}

.aig-shell {
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) 1.5rem clamp(3.5rem, 8vw, 6rem);
}

/* ── Hero ── */
.aig-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  padding: 0.4em 0.85em;
  border-radius: 999px;
  margin-bottom: 1.5rem;
}

.aig-title {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 5vw, 3rem);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 1.1rem;
  color: var(--text);
}

.aig-title-accent { color: var(--accent); }

.aig-subtitle {
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 50ch;
  margin: 0 0 2.25rem;
}

/* ── Form ── */
.aig-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.aig-label {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.aig-input {
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem; /* >=16px avoids iOS zoom-on-focus */
  color: var(--text);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  box-shadow: 0 1px 2px oklch(30% 0.02 80 / 0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.aig-input::placeholder { color: oklch(64% 0.01 80); }
.aig-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px oklch(46% 0.115 148 / 0.14);
}

.aig-generate-btn {
  min-height: 52px;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 1px 2px oklch(20% 0.02 148 / 0.12);
  transition: background 0.15s, transform 0.12s cubic-bezier(0.22,1,0.36,1), box-shadow 0.15s, opacity 0.15s;
}

.aig-generate-btn:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px oklch(46% 0.115 148 / 0.22);
}
.aig-generate-btn:active { transform: translateY(0); }
.aig-generate-btn:disabled,
.aig-generate-btn.is-loading { opacity: 0.6; cursor: default; transform: none; box-shadow: none; }

.aig-generate-icon { font-size: 1.05em; line-height: 1; }

.aig-error {
  font-family: var(--sans);
  color: oklch(48% 0.15 27);
  font-size: 0.875rem;
  margin: 0;
  min-height: 1em;
}

/* ── Result ── */
.aig-result {
  margin-top: 3rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--border);
}

.aig-result-head {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}

.aig-result-heading {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.aig-stats {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
}

/* ── Preview ── */
.aig-preview-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-alt);
  box-shadow: 0 10px 30px oklch(30% 0.02 80 / 0.08);
}

.aig-preview-bar {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.6rem 1rem;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
}

.aig-preview-frame {
  display: block;
  width: 100%;
  height: 60vh;
  min-height: 380px;
  border: none;
  background: #fff;
}

/* ── Share ── */
.aig-share {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.aig-share-label {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.aig-share-row {
  display: flex;
  gap: 0.6rem;
}

.aig-share-url {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--text);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.6rem 0.8rem;
  outline: none;
  transition: border-color 0.15s;
}

.aig-share-url:focus { border-color: var(--accent); }

.aig-copy-btn {
  flex-shrink: 0;
  min-height: 40px;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 7px;
  padding: 0 1rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.aig-copy-btn:hover { background: var(--bg-alt); border-color: var(--accent); }

.aig-edit-link {
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  margin-top: 0.35rem;
  align-self: flex-start;
}

.aig-edit-link:hover { text-decoration: underline; }

/* ── Motion ── */
@media (prefers-reduced-motion: no-preference) {
  @keyframes aig-fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .aig-eyebrow  { animation: aig-fade-up 0.4s ease-out both; }
  .aig-title    { animation: aig-fade-up 0.5s 0.06s cubic-bezier(0.22,1,0.36,1) both; }
  .aig-subtitle { animation: aig-fade-up 0.45s 0.14s cubic-bezier(0.22,1,0.36,1) both; }
  .aig-form     { animation: aig-fade-up 0.45s 0.22s cubic-bezier(0.22,1,0.36,1) both; }
}
