/*
 * Creator + confirmation page styles.
 * Card visual lives in card.css — this file styles the surrounding form.
 */

:root {
  --base: #FAF6EE;
  --base-soft: #F4EDDF;
  --base-paper: #FFFCF6;
  --sage: #8FA68C;
  --sage-deep: #4F6B4D;          /* darkened from #6B8068 for AA contrast */
  --taupe: #C8B59E;
  --rose: #D4A5A0;
  --rose-deep: #B47D78;          /* darkened rose for label use */
  --ink: #2D2925;                /* darkened from #3A352F */
  --ink-soft: #4A4239;           /* darkened from #5A5247 */
  --ink-faint: #6E6256;          /* darkened from #8a7d6b */
  --line: #C9BDA6;               /* darkened from #E5DDCC for visible borders */
  --line-soft: #DDD2BB;
  --shadow-sm: 0 1px 2px rgba(45, 41, 37, 0.06);
  --shadow-md: 0 4px 16px rgba(45, 41, 37, 0.10);

  /* Type system */
  --font-display: 'Castoro', Georgia, serif;
  --font-ui: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-eyebrow: 'Tenor Sans', 'Helvetica Neue', sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--base);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Page layout */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page__header {
  padding: 28px 24px 12px;
  text-align: center;
}

.page__mark {
  font-family: var(--font-eyebrow);
  font-size: 0.75rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0;
  font-weight: 400;
}

.page__logo {
  display: inline-block;
  text-decoration: none;
  margin: 0;
  line-height: 0;
}

.page__logo img {
  height: 36px;
  width: auto;
  display: block;
}

@media (min-width: 600px) {
  .page__logo img {
    height: 44px;
  }
}

.page__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.55rem, 6vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.005em;
  margin: 28px auto 14px;
  max-width: 18ch;
  color: var(--ink);
}

/* Allow title to wrap on mobile (otherwise it overflows horizontally) and
   stretch to a single line on desktop where it fits comfortably. */
@media (min-width: 760px) {
  .page__title {
    max-width: none;
    white-space: nowrap;
  }
}

.page__title em {
  font-style: italic;
  color: var(--sage-deep);
}

.page__sub {
  font-family: var(--font-ui);
  font-size: clamp(0.92rem, 1.9vw, 1.1rem);
  color: var(--ink-faint);
  margin: 0 auto 8px;
  max-width: 36ch;
  line-height: 1.55;
}

@media (min-width: 700px) {
  .page__sub {
    max-width: 50ch;
  }
}

.page__main {
  flex: 1;
  padding: 24px 24px 80px;
  max-width: 1240px;
  margin: 0 auto;
  width: 100%;
}

/* Two-column layout: form + preview */
.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
  align-items: start;
}

@media (min-width: 920px) {
  .layout {
    grid-template-columns: minmax(380px, 1fr) minmax(420px, 1fr);
    gap: 64px;
  }
}

/* Form column */
.form {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

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

.field__label {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin: 0;
}

.field__hint {
  font-family: var(--font-ui);
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: -4px 0 4px;
  line-height: 1.5;
}

/* Audience picker — single column on mobile, two-col on desktop with last item full width */
.audience-picker {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 540px) {
  .audience-picker {
    grid-template-columns: 1fr 1fr;
  }
}

.audience-option {
  display: block;
  position: relative;
  cursor: pointer;
  user-select: none;
}

.audience-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.audience-option__inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  padding: 18px 18px;
  background: var(--base-paper);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  transition: all 180ms ease;
  height: 100%;
  min-height: 76px;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
}

.audience-option:hover .audience-option__inner {
  border-color: var(--ink-faint);
  background: #fff;
}

.audience-option input:checked + .audience-option__inner {
  border-color: var(--sage-deep);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 0 0 3px rgba(79, 107, 77, 0.18);
  font-weight: 600;
}

.audience-option input:checked + .audience-option__inner::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--sage-deep);
  color: #fff;
  border-radius: 50%;
  margin-right: 12px;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.audience-option input:focus-visible + .audience-option__inner {
  outline: 2px solid var(--sage-deep);
  outline-offset: 2px;
}

/* Text input */
.input {
  width: 100%;
  padding: 14px 16px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: 1.1rem;
  color: var(--ink);
  transition: all 180ms ease;
  -webkit-appearance: none;
  appearance: none;
}

.input:hover { border-color: var(--ink-faint); }
.input:focus {
  outline: none;
  border-color: var(--sage-deep);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 107, 77, 0.18);
}

.input::placeholder {
  color: var(--ink-faint);
  opacity: 0.85;
}

textarea.input {
  resize: vertical;
  min-height: 110px;
  line-height: 1.5;
  font-family: var(--font-ui);
  font-size: 1rem;
}

.input--message {
  font-size: 1rem;
  line-height: 1.5;
}

.char-count {
  text-align: right;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-top: 2px;
}

.char-count--warn { color: var(--rose-deep); font-weight: 600; }

/* Scripture picker */
.scripture-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scripture-option {
  display: block;
  position: relative;
  cursor: pointer;
}

.scripture-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.scripture-option__inner {
  display: block;
  padding: 16px 18px;
  background: var(--base-paper);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  transition: all 180ms ease;
}

.scripture-option__ref,
.scripture-option__text {
  display: block;
}

.scripture-option:hover .scripture-option__inner {
  border-color: var(--ink-faint);
  background: #fff;
}

.scripture-option input:checked + .scripture-option__inner {
  border-color: var(--sage-deep);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 107, 77, 0.18);
}

.scripture-option input:focus-visible + .scripture-option__inner {
  outline: 2px solid var(--sage-deep);
  outline-offset: 2px;
}

.scripture-option__ref {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sage-deep);
  margin: 0 0 8px 0;
}

.scripture-option__text {
  font-family: var(--font-ui);
  font-style: normal;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
}

.scripture-option--none .scripture-option__inner {
  text-align: center;
  font-family: var(--font-ui);
  font-weight: 500;
  color: var(--ink-soft);
  padding: 18px;
}

/* Preview column */
.preview {
  position: sticky;
  top: 24px;
}

.preview__label {
  font-family: var(--font-eyebrow);
  font-size: 0.75rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 14px 0;
  text-align: center;
}

.preview__card-wrap {
  display: block;
  max-width: 600px;
  margin: 0 auto;
}

.preview__card-wrap > div {
  width: 100%;
}

/* Submit button */
.submit-row {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}

.btn {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 16px 32px;
  background: var(--ink);
  color: var(--base);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 180ms ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
}

.btn:hover {
  background: var(--sage-deep);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(58, 53, 47, 0.15);
}

.btn:active {
  transform: translateY(0);
  background: var(--sage-deep);   /* immediate tactile change on tap */
}

.btn:disabled {
  cursor: not-allowed;
  transform: none !important;
}

/* Loading state — preserves button dimensions so the text swap doesn't shift
   the layout. Text is hidden via color: transparent; spinner is overlayed. */
.btn--loading {
  color: transparent !important;
  pointer-events: none;
  position: relative;
}
.btn--loading .btn__arrow { color: transparent !important; }
.btn--loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(250, 246, 238, 0.45);
  border-top-color: var(--base);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn--secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn--secondary:hover {
  background: var(--base-paper);
  border-color: var(--taupe);
  color: var(--ink);
}

.btn--full { width: 100%; }

.btn__arrow { transition: transform 200ms ease; }
.btn:hover .btn__arrow { transform: translateX(3px); }

/* Confirmation / share state */
.confirmation {
  display: none;
}

.confirmation.is-active {
  display: block;
}

.form-flow.is-hidden { display: none; }

/* Hide page title + subtitle when confirmation is active — keep logo */
.page:has(.confirmation.is-active) .page__title,
.page:has(.confirmation.is-active) .page__sub {
  display: none;
}
.page:has(.confirmation.is-active) .page__header {
  padding-bottom: 0;
}

.confirmation__intro {
  text-align: center;
  margin-bottom: 32px;
}

.confirmation__intro h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(1.7rem, 3.5vw, 2.2rem);
  color: var(--sage-deep);
  margin: 0 0 12px 0;
}

.confirmation__intro p {
  font-family: var(--font-ui);
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin: 0;
  max-width: 40ch;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.55;
}

.confirmation__free {
  display: inline-flex !important;
  align-items: center;
  gap: 0.5em;
  background: rgba(79, 107, 77, 0.08);
  color: var(--sage-deep) !important;
  padding: 6px 14px;
  border-radius: 99px;
  font-family: var(--font-ui) !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em;
  margin-top: 16px !important;
  max-width: none !important;
}

.confirmation__free::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: var(--sage-deep);
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
}

.share-hint {
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin: 16px auto 0;
  max-width: 460px;
  line-height: 1.5;
}

.link-box-wrap {
  position: relative;
  margin: 0 auto 16px;
  max-width: 540px;
}

.link-box {
  width: 100%;
  padding: 12px 50px 12px 14px;
  background: var(--base-paper);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  font-family: 'SF Mono', Menlo, 'Roboto Mono', Consolas, monospace;
  font-size: 0.78rem;
  color: var(--ink-soft);
  -webkit-appearance: none;
  appearance: none;
  text-overflow: ellipsis;
  cursor: text;
}
.link-box:focus {
  outline: none;
  border-color: var(--sage-deep);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 0 0 3px rgba(79, 107, 77, 0.15);
}

.link-box-copy {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 150ms ease;
}
.link-box-copy:hover {
  background: rgba(79, 107, 77, 0.08);
  color: var(--sage-deep);
}
.link-box-copy:focus-visible {
  outline: 2px solid var(--sage-deep);
  outline-offset: 1px;
}
.link-box-copy svg { width: 18px; height: 18px; }
.share-hint strong {
  color: var(--ink);
  font-weight: 600;
}

/* Visual divider before the Plus offer — makes it clear it's a separate, optional thing */
.plus-divider {
  text-align: center;
  position: relative;
  margin: 64px auto 32px;
  max-width: 540px;
}
.plus-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
  z-index: 0;
}
.plus-divider span {
  position: relative;
  display: inline-block;
  background: var(--base);
  padding: 0 24px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.15rem, 2.5vw, 1.4rem);
  color: var(--ink-soft);
  z-index: 1;
}

.confirmation__card-wrap {
  display: block;
  margin: 32px auto;
  max-width: 600px;
}

.confirmation__card-wrap > div {
  width: 100%;
}

.tip-banner {
  background: var(--base-paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px 20px;
  margin: 24px auto;
  max-width: 540px;
  text-align: center;
  font-family: 'Castoro', Georgia, serif;
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.tip-banner strong {
  font-style: normal;
  font-family: 'Tenor Sans', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sage-deep);
  display: block;
  margin-bottom: 8px;
}

/* Share buttons grid */
.share-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-width: 540px;
  margin: 24px auto;
}

@media (min-width: 600px) {
  .share-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 12px;
  background: var(--base-paper);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all 180ms ease;
  text-decoration: none;
  min-height: 84px;
}

.share-btn:hover {
  border-color: var(--sage-deep);
  background: #fff;
  color: var(--ink);
  transform: translateY(-1px);
}

.share-btn__icon {
  width: 22px;
  height: 22px;
  color: var(--sage-deep);
}

.share-btn__icon svg {
  width: 100%;
  height: 100%;
}

/* Plus offer block */
.plus-offer {
  margin: 56px auto 0;
  max-width: 540px;
  padding: 32px 28px;
  background: var(--base-paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: center;
  position: relative;
}

.plus-offer__eyebrow {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rose-deep);
  margin: 0 0 12px 0;
}

.plus-offer__title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  color: var(--ink);
  margin: 0 0 10px 0;
  line-height: 1.25;
}

.plus-offer__sub {
  font-family: var(--font-ui);
  font-size: 1.02rem;
  color: var(--ink-soft);
  margin: 0 0 22px 0;
  line-height: 1.55;
}

.plus-offer__cta-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 480px) {
  .plus-offer__cta-row {
    flex-direction: row;
    justify-content: center;
  }
  .plus-offer__cta-row .btn { flex: 1; max-width: 220px; }
}

.plus-offer__btn-price {
  font-family: var(--font-ui);
  font-weight: 500;
  letter-spacing: 0.02em;
  font-size: 0.95rem;
  margin-left: 8px;
  opacity: 0.95;
}

.plus-offer__strike {
  text-decoration: line-through;
  opacity: 0.5;
  margin-right: 4px;
}

/* Footer */
.page__footer {
  text-align: center;
  padding: 28px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--line-soft);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 80px);
  background: var(--ink);
  color: var(--base);
  padding: 13px 22px;
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  transition: all 240ms ease;
  z-index: 200;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(45, 41, 37, 0.25);
}

.toast.is-shown {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* Loading state */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(250, 246, 238, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.loading-overlay.is-active { display: flex; }

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--taupe);
  border-top-color: var(--sage-deep);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

/* Hidden export node — used for high-res image rendering */
.export-stage {
  position: fixed;
  top: -10000px;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  pointer-events: none;
}
