/**
 * TWI Quiz Modal — Accessible fullscreen quiz journey (T12).
 *
 * Desktop: centered modal overlay (no navigation).
 * Mobile (<=768px): full viewport takeover.
 * 320px: minimum supported width.
 * WCAG AA: focus indicators, contrast ratios, aria attributes.
 * Reduced motion: respects prefers-reduced-motion.
 *
 * @package TWI_Offers
 */

/* The ebook cover's typefaces, bundled under the SIL Open Font License
   (assets/fonts) so the form and the PDF set the same type. */
@font-face { font-family: "TWI Anton"; src: url("../fonts/Anton-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "TWI DM Serif Display"; src: url("../fonts/DMSerifDisplay-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "TWI Archivo Black"; src: url("../fonts/ArchivoBlack-Regular.ttf") format("truetype"); font-display: swap; }

/* =========================================================================
   1. CSS CUSTOM PROPERTIES
   ========================================================================= */
:root {
  --twi-modal-bg: #ffffff;
  --twi-modal-text: #1e293b;
  --twi-modal-muted: #64748b;
  --twi-modal-border: #e2e8f0;
  --twi-modal-accent: #0f766e;
  --twi-modal-accent-hover: #115e59;
  --twi-modal-focus-ring: #0f766e;
  --twi-modal-radius: 12px;
  --twi-modal-shadow: 0 8px 32px rgba(15,23,42,0.18), 0 2px 8px rgba(15,23,42,0.08);
  --twi-modal-z: 10001;
  --twi-modal-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* =========================================================================
   2. OVERLAY & CONTAINER
   ========================================================================= */
.twi-quiz-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--twi-modal-z);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  font-family: var(--twi-modal-font);
}

.twi-quiz-modal-overlay[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

.twi-quiz-modal {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  background: var(--twi-modal-bg);
  border-radius: var(--twi-modal-radius);
  box-shadow: var(--twi-modal-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* =========================================================================
   3. RESPONSIVE — MOBILE FULL VIEWPORT
   ========================================================================= */
@media (max-width: 768px) {
  .twi-quiz-modal-overlay {
    align-items: stretch;
    justify-content: stretch;
  }

  .twi-quiz-modal {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
  }
}

/* =========================================================================
   4. HEADER (progress + close)
   ========================================================================= */
.twi-quiz-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--twi-modal-border);
  flex-shrink: 0;
}

.twi-quiz-modal__progress {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--twi-modal-muted);
}

.twi-quiz-modal__progress-bar {
  width: 100%;
  height: 4px;
  background: var(--twi-modal-border);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.twi-quiz-modal__progress-fill {
  height: 100%;
  background: var(--twi-modal-accent);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

.twi-quiz-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--twi-modal-muted);
  font-size: 1.25rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
  margin-left: 8px;
}

.twi-quiz-modal__close:hover {
  color: var(--twi-modal-text);
}

.twi-quiz-modal__close:focus-visible {
  outline: 3px solid var(--twi-modal-focus-ring);
  outline-offset: 2px;
}

/* =========================================================================
   5. BODY (step content)
   ========================================================================= */
.twi-quiz-modal__body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  -webkit-overflow-scrolling: touch;
}

.twi-quiz-modal__step {
  animation: twi-fade-in 0.22s ease;
}

@keyframes twi-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================================
   6. QUESTION STEP
   ========================================================================= */
.twi-quiz-question__prompt {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--twi-modal-text);
  margin: 0 0 16px 0;
  line-height: 1.4;
}

.twi-quiz-question__options {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.twi-quiz-question__option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: 2px solid var(--twi-modal-border);
  border-radius: 8px;
  background: var(--twi-modal-bg);
  color: var(--twi-modal-text);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.twi-quiz-question__option:hover {
  border-color: var(--twi-modal-accent);
  background: #f0fdfa;
}

.twi-quiz-question__option:focus-visible {
  outline: 3px solid var(--twi-modal-focus-ring);
  outline-offset: 2px;
}

.twi-quiz-question__option[aria-checked="true"] {
  border-color: var(--twi-modal-accent);
  background: #ccfbf1;
  color: var(--twi-modal-accent-hover);
}

/* =========================================================================
   7. OPT-IN STEP
   ========================================================================= */
/* The gift ebook's cover (owner's revision R3). Its own styles are inline,
   shared with the PDF; this only places it. */
.twi-quiz-cover {
  display: flex;
  justify-content: center;
  margin: 0 0 16px;
}

.twi-quiz-cover .twi-ebook-cover {
  max-width: 100%;
}

/* The cover as a book: turned a little, with a spine shadow, the page
   edges showing on the right, and a shadow underneath. */
.twi-book {
  position: relative;
  display: inline-block;
  margin: 4px 14px 18px 4px;
  transform: perspective(900px) rotateY(-14deg);
  transform-style: preserve-3d;
}

.twi-book .twi-ebook-cover {
  position: relative;
  z-index: 1;
  border-radius: 2px 4px 4px 2px;
  box-shadow: inset 6px 0 8px -4px rgba(0, 0, 0, 0.45), 0 10px 24px rgba(0, 0, 0, 0.18);
}

.twi-book::before {
  content: "";
  position: absolute;
  top: 3%;
  bottom: 3%;
  right: -9px;
  width: 10px;
  background: repeating-linear-gradient(90deg, #f4f1ea 0 1px, #d8d3c8 1px 2px);
  border-radius: 0 2px 2px 0;
}

.twi-book::after {
  content: "";
  position: absolute;
  left: 6%;
  right: -4%;
  bottom: -16px;
  height: 22px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.35), transparent 70%);
  filter: blur(4px);
}

@media (prefers-reduced-motion: reduce) {
  .twi-book {
    transform: none;
  }
}

.twi-quiz-optin__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--twi-modal-text);
  margin: 0 0 8px 0;
}

.twi-quiz-optin__subtitle {
  font-size: 0.9375rem;
  color: var(--twi-modal-muted);
  margin: 0 0 20px 0;
}

.twi-quiz-optin__field {
  margin-bottom: 14px;
}

.twi-quiz-optin__label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--twi-modal-text);
  margin-bottom: 4px;
}

.twi-quiz-optin__input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--twi-modal-border);
  border-radius: 8px;
  font-size: 0.9375rem;
  color: var(--twi-modal-text);
  background: var(--twi-modal-bg);
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.twi-quiz-optin__input:focus {
  outline: none;
  border-color: var(--twi-modal-accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.twi-quiz-optin__input::placeholder {
  color: var(--twi-modal-muted);
}

.twi-quiz-optin__consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0;
  font-size: 0.8125rem;
  color: var(--twi-modal-muted);
  line-height: 1.5;
}

.twi-quiz-optin__consent input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
}

.twi-quiz-optin__consent input[type="checkbox"]:focus-visible {
  outline: 3px solid var(--twi-modal-focus-ring);
  outline-offset: 2px;
}

.twi-quiz-optin__privacy {
  font-size: 0.75rem;
  color: var(--twi-modal-muted);
  margin-top: 12px;
}

.twi-quiz-optin__privacy a {
  color: var(--twi-modal-accent);
  text-decoration: underline;
}

.twi-quiz-optin__privacy a:focus-visible {
  outline: 3px solid var(--twi-modal-focus-ring);
  outline-offset: 2px;
}

/* =========================================================================
   8. RESULT STEP
   ========================================================================= */
.twi-quiz-result {
  text-align: center;
  padding: 12px 0;
}

.twi-quiz-result__icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #ccfbf1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.twi-quiz-result__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--twi-modal-text);
  margin: 0 0 8px 0;
}

.twi-quiz-result__label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--twi-modal-accent);
  margin: 0 0 12px 0;
}

.twi-quiz-result__description {
  font-size: 0.9375rem;
  color: var(--twi-modal-muted);
  line-height: 1.6;
  margin: 0 0 16px 0;
}

/* Says where the recommendation actually arrives. The result screen stays
   product-blind and links nowhere, so without this the visitor is told they
   have a result and given no idea what happens next. */
.twi-quiz-result__next {
  font-size: 0.875rem;
  color: var(--twi-modal-muted);
  line-height: 1.55;
  margin: 0 0 24px 0;
}
.twi-quiz-result__next:empty {
  display: none;
  margin: 0;
}

/* =========================================================================
   9. FOOTER (navigation buttons)
   ========================================================================= */
.twi-quiz-modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--twi-modal-border);
  flex-shrink: 0;
}

.twi-quiz-modal__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  min-height: 44px;
  min-width: 44px;
}

.twi-quiz-modal__btn:focus-visible {
  outline: 3px solid var(--twi-modal-focus-ring);
  outline-offset: 2px;
}

.twi-quiz-modal__btn--primary {
  background: var(--twi-modal-accent);
  color: #ffffff;
}

.twi-quiz-modal__btn--primary:hover {
  background: var(--twi-modal-accent-hover);
}

.twi-quiz-modal__btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.twi-quiz-modal__btn--secondary {
  background: none;
  color: var(--twi-modal-muted);
  border-color: var(--twi-modal-border);
}

.twi-quiz-modal__btn--secondary:hover {
  color: var(--twi-modal-text);
  border-color: var(--twi-modal-text);
}

.twi-quiz-modal__btn--ghost {
  background: none;
  color: var(--twi-modal-muted);
}

.twi-quiz-modal__btn--ghost:hover {
  color: var(--twi-modal-text);
}

.twi-quiz-modal__footer-spacer {
  flex: 1;
}

/* =========================================================================
   10. LOADING STATE
   ========================================================================= */
.twi-quiz-modal__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  color: var(--twi-modal-muted);
  font-size: 0.9375rem;
}

.twi-quiz-modal__spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--twi-modal-border);
  border-top-color: var(--twi-modal-accent);
  border-radius: 50%;
  animation: twi-spin 0.8s linear infinite;
  margin-right: 12px;
}

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

/* =========================================================================
   11. ERROR STATE
   ========================================================================= */
.twi-quiz-modal__error {
  text-align: center;
  padding: 32px 20px;
}

.twi-quiz-modal__error-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--twi-modal-text);
  margin: 0 0 8px 0;
}

.twi-quiz-modal__error-message {
  font-size: 0.9375rem;
  color: var(--twi-modal-muted);
  margin: 0 0 20px 0;
}

/* =========================================================================
   12. CLOSE CONFIRMATION DIALOG
   ========================================================================= */
.twi-quiz-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: calc(var(--twi-modal-z) + 1);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.4);
}

.twi-quiz-confirm {
  background: var(--twi-modal-bg);
  border-radius: var(--twi-modal-radius);
  box-shadow: var(--twi-modal-shadow);
  padding: 24px;
  max-width: 360px;
  width: 90%;
  text-align: center;
}

.twi-quiz-confirm__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--twi-modal-text);
  margin: 0 0 8px 0;
}

.twi-quiz-confirm__message {
  font-size: 0.9375rem;
  color: var(--twi-modal-muted);
  margin: 0 0 20px 0;
}

.twi-quiz-confirm__actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* =========================================================================
   13. HONEYPOT (hidden from users, visible to bots)
   ========================================================================= */
.twi-quiz-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* =========================================================================
   14. REDUCED MOTION
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  .twi-quiz-modal-overlay {
    transition: none;
  }

  .twi-quiz-modal__step {
    animation: none;
  }

  .twi-quiz-modal__progress-fill {
    transition: none;
  }

  .twi-quiz-modal__spinner {
    animation: none;
    border-top-color: transparent;
  }
}

/* =========================================================================
   15. 320px MINIMUM WIDTH
   ========================================================================= */
@media (max-width: 360px) {
  .twi-quiz-modal__body {
    padding: 16px 12px;
  }

  .twi-quiz-question__prompt {
    font-size: 1rem;
  }

  .twi-quiz-question__option {
    padding: 12px 14px;
    font-size: 0.875rem;
  }

  .twi-quiz-modal__btn {
    padding: 8px 16px;
    font-size: 0.875rem;
    min-height: 40px;
  }

  .twi-quiz-optin__input {
    padding: 10px 12px;
  }
}

/* =========================================================================
   16. DISCOVER PAGE (fallback)
   ========================================================================= */
.twi-discover {
  font-family: var(--twi-modal-font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
  color: var(--twi-modal-text);
  background: #f8fafc;
}

.twi-discover__artwork {
  position: relative;
  width: 200px;
  height: 200px;
  margin-bottom: 24px;
}

.twi-discover__artwork img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
}

.twi-discover__badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 40px;
  height: 40px;
  background: var(--twi-modal-accent);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
}

.twi-discover__category {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--twi-modal-accent);
  margin-bottom: 8px;
}

.twi-discover__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 12px 0;
  max-width: 480px;
}

.twi-discover__body {
  font-size: 1rem;
  color: var(--twi-modal-muted);
  max-width: 420px;
  margin: 0 0 24px 0;
  line-height: 1.6;
}

.twi-discover__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--twi-modal-accent);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  transition: background 0.15s ease;
}

.twi-discover__cta:hover {
  background: var(--twi-modal-accent-hover);
}

.twi-discover__cta:focus-visible {
  outline: 3px solid var(--twi-modal-focus-ring);
  outline-offset: 2px;
}

/* A reader who followed a link from their own nurture email sees the result
   they were sent, not the quiz they already finished. */
.twi-discover__result {
  max-width: 420px;
}

.twi-discover__result-label {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 12px 0;
}

.twi-discover__result-body {
  font-size: 1rem;
  color: var(--twi-modal-muted);
  line-height: 1.6;
}

.twi-discover__result-body p {
  margin: 0 0 12px 0;
}

.twi-discover__hint {
  font-size: 0.8125rem;
  color: var(--twi-modal-muted);
  margin-top: 16px;
}
/* =========================================================================
   17. THE READING PAGE
   -------------------------------------------------------------------------
   The stranger's view above is a single centred card, which is right for a
   teaser and wrong for several thousand words. A reader who followed a link
   from their own email is here to read, so this state becomes a piece rather
   than a page: full-bleed hero, a result set apart from the prose, and
   chapters as numbered sections with their own artwork.

   It was a stack of paragraphs in a narrow column before, which read as a
   blog post nobody had designed -- and this is the surface the whole funnel
   now turns on, because how far someone gets through it is the signal.
   ========================================================================= */
.twi-discover--reading {
  display: block;
  min-height: 0;
  text-align: left;
  padding: 0 0 80px 0;
  background: #ffffff;
}

/* How far down the article they are. Fixed rather than sticky so it survives
   the hero scrolling away under it. */
.twi-read__rail {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(15, 23, 42, 0.08);
  z-index: 40;
}

.twi-read__rail span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--twi-modal-accent);
  transition: width 0.15s linear;
}

/* ── Hero ───────────────────────────────────────────────────────────── */
.twi-read__hero {
  position: relative;
  min-height: clamp(320px, 52vh, 560px);
  display: flex;
  align-items: flex-end;
  padding: 48px 20px 44px;
  margin-bottom: 56px;
  background-color: #0f172a;
  background-size: cover;
  background-position: center;
  color: #ffffff;
}

.twi-read__hero-inner {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.twi-read__eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(4px);
  margin-bottom: 18px;
}

.twi-read__hero-title {
  font-size: clamp(2rem, 5.5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 16px 0;
  text-wrap: balance;
}

.twi-read__hero-meta {
  font-size: 0.9375rem;
  font-weight: 500;
  margin: 0;
  opacity: 0.85;
}

/* ── Measure ────────────────────────────────────────────────────────── */
.twi-read__body {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── The reader's own result ────────────────────────────────────────── */
.twi-read__result {
  background: #f8fafc;
  border: 1px solid var(--twi-modal-border, #e2e8f0);
  border-left: 4px solid var(--twi-modal-accent);
  border-radius: 12px;
  padding: 28px;
  margin: 0 0 56px 0;
}

.twi-read__result-eyebrow {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--twi-modal-accent);
  margin: 0 0 10px 0;
}

.twi-read__profile {
  font-size: clamp(1.25rem, 3vw, 1.625rem);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 12px 0;
}

.twi-read__profile-body {
  color: var(--twi-modal-muted);
  line-height: 1.65;
}

.twi-read__profile-body p { margin: 0 0 12px 0; }

.twi-read__statements {
  list-style: none;
  margin: 20px 0 0 0;
  padding: 20px 0 0 0;
  border-top: 1px solid var(--twi-modal-border, #e2e8f0);
}

.twi-read__statements li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.twi-read__statements li:last-child { margin-bottom: 0; }

.twi-read__statements li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  top: -1px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--twi-modal-accent);
  color: #ffffff;
  font-size: 0.6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Chapters ───────────────────────────────────────────────────────── */
.twi-read__chapter {
  margin: 0 0 64px 0;
}

.twi-read__chapter-head {
  margin-bottom: 24px;
}

.twi-read__chapter-num {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--twi-modal-muted);
  margin-bottom: 10px;
}

.twi-read__chapter-heading {
  font-size: clamp(1.5rem, 3.6vw, 2.125rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}

/* Breaks the measure on wide screens so the picture reads as an illustration
   rather than as another paragraph. */
.twi-read__figure {
  margin: 0 0 28px 0;
}

.twi-read__figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
}

@media (min-width: 900px) {
  .twi-read__figure {
    margin-left: -60px;
    margin-right: -60px;
  }
}

/* Long-form measure: this is text someone is expected to stay with, and
   staying with it is the entire signal. */
.twi-read__chapter-body p {
  font-size: 1.0625rem;
  line-height: 1.75;
  margin: 0 0 22px 0;
}

.twi-read__chapter-body p:last-child { margin-bottom: 0; }

.twi-read__lead {
  font-size: 1.1875rem !important;
  line-height: 1.65 !important;
  color: #1e293b;
}

/* ── The one action ─────────────────────────────────────────────────── */
.twi-read__end,
.twi-read__offer {
  background: #f8fafc;
  border: 1px solid var(--twi-modal-border, #e2e8f0);
  border-radius: 14px;
  padding: 36px 28px;
  text-align: center;
}

.twi-read__end-title,
.twi-read__offer-title {
  font-size: 1.375rem;
  font-weight: 700;
  margin: 0 0 10px 0;
}

.twi-read__end-body {
  color: var(--twi-modal-muted);
  line-height: 1.6;
  margin: 0 0 22px 0;
}

.twi-read__result-line {
  margin: 18px 0 0 0;
  font-weight: 600;
  color: var(--twi-modal-accent);
}

/* Once the product has been revealed there is nothing left to withhold, and
   the page stops being a teaser. */
.twi-read__offer-image {
  max-width: 240px;
  height: auto;
  margin: 8px auto 20px auto;
  display: block;
}

.twi-read__offer-cta {
  display: inline-block;
  padding: 15px 34px;
  background: var(--twi-modal-accent);
  color: #ffffff;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
}

.twi-read__offer-cta:hover { background: var(--twi-modal-accent-hover); }

.twi-read__disclosure {
  font-size: 0.8125rem;
  color: var(--twi-modal-muted);
  margin: 16px 0 0 0;
}

@media (max-width: 600px) {
  .twi-read__hero { padding: 32px 18px 30px; margin-bottom: 40px; }
  .twi-read__body { padding: 0 18px; }
  .twi-read__result { padding: 22px; margin-bottom: 40px; }
  .twi-read__chapter { margin-bottom: 48px; }
  .twi-read__end,
  .twi-read__offer { padding: 28px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .twi-read__rail span { transition: none; }
}
/* =========================================================================
   18. THE READING PAGE IN THE DARK
   -------------------------------------------------------------------------
   Phone browsers force dark mode on pages that do not say they support it,
   and the automatic inversion turned a white page into flat grey with the
   card backgrounds and the accent border washed out with it.

   Declaring color-scheme (see the template head) hands control back. These
   are chosen values rather than an algorithm's guess: a near-black ground,
   raised surfaces for the cards so they still read as panels, and an accent
   lifted a couple of steps because the original teal goes muddy on dark.
   ========================================================================= */
@media (prefers-color-scheme: dark) {
  .twi-discover-page {
    background: #0b1120;
  }

  .twi-discover,
  .twi-discover--reading {
    background: #0b1120;
    color: #e2e8f0;
  }

  .twi-discover__title,
  .twi-read__hero-title,
  .twi-read__profile,
  .twi-read__chapter-heading,
  .twi-read__end-title,
  .twi-read__offer-title {
    color: #f1f5f9;
  }

  .twi-discover__body,
  .twi-read__profile-body,
  .twi-read__end-body,
  .twi-read__chapter-body p,
  .twi-discover__hint,
  .twi-read__disclosure {
    color: #94a3b8;
  }

  /* The lead sits brighter than the body it opens, same as in the light
     palette -- it is doing the work of holding a new arrival. */
  .twi-read__lead {
    color: #e2e8f0;
  }

  .twi-read__statements li {
    color: #cbd5e1;
  }

  /* Panels have to stay panels. Inversion flattened these into the page and
     the result card stopped reading as a result. */
  .twi-read__result,
  .twi-read__end,
  .twi-read__offer {
    background: #111c30;
    border-color: #1e293b;
  }

  .twi-read__statements {
    border-top-color: #1e293b;
  }

  .twi-read__rail {
    background: rgba(226, 232, 240, 0.12);
  }

  /* Teal at the light-mode value reads as muddy green on near-black. */
  .twi-read__result {
    border-left-color: #2dd4bf;
  }

  .twi-read__result-eyebrow,
  .twi-read__result-line {
    color: #2dd4bf;
  }

  .twi-read__statements li::before,
  .twi-read__rail span {
    background: #2dd4bf;
  }

  .twi-read__chapter-num {
    color: #64748b;
  }

  .twi-discover__cta,
  .twi-read__offer-cta {
    background: #0d9488;
    color: #f0fdfa;
  }

  .twi-discover__cta:hover,
  .twi-read__offer-cta:hover {
    background: #14b8a6;
  }

  /* The hero gradient is tuned for a light page underneath; on dark it has to
     go further or the headline sits on a muddy middle grey. */
  .twi-read__hero {
    background-color: #020617;
  }
}
/* =========================================================================
   19. RHYTHM INSIDE THE PROSE
   -------------------------------------------------------------------------
   The page the owner pointed at as the model is not a designed page of cards
   and grids -- it is a long sales letter. What stops it reading as a blog
   post happens inside the text: single lines standing alone, bold phrases
   mid-paragraph, a quote set apart, a short list dropped into the flow.

   These are the devices for that. The generator writes them; without them a
   chapter is an even column of paragraphs, which is what an article looks
   like.
   ========================================================================= */
.twi-read__chapter-body strong {
  font-weight: 700;
  color: #0f172a;
}

/* A sentence lifted out of the chapter. Not indented and not italic: it reads
   as the writer raising their voice, not as a citation. */
.twi-read__quote {
  margin: 0 0 28px 0;
  padding: 0 0 0 20px;
  border-left: 3px solid var(--twi-modal-accent);
  font-size: clamp(1.1875rem, 2.6vw, 1.4375rem);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: #0f172a;
  text-wrap: balance;
}

/* Short lines a skimming reader stops on, set as a block so the eye catches
   them against the paragraphs above and below. */
.twi-read__points {
  list-style: none;
  margin: 28px 0 0 0;
  padding: 22px 24px;
  background: #f8fafc;
  border-radius: 12px;
}

.twi-read__points li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.twi-read__points li:last-child { margin-bottom: 0; }

.twi-read__points li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--twi-modal-accent);
  font-weight: 700;
}

@media (prefers-color-scheme: dark) {
  .twi-read__chapter-body strong,
  .twi-read__quote {
    color: #f1f5f9;
  }

  .twi-read__quote {
    border-left-color: #2dd4bf;
  }

  .twi-read__points {
    background: #111c30;
  }

  .twi-read__points li {
    color: #e2e8f0;
  }

  .twi-read__points li::before {
    color: #2dd4bf;
  }
}

/* =========================================================================
   17. GIFT CONFIRMATION PAGE (owner's revision R2)
   Where a reader lands after tapping their confirmation link, or a link
   that has expired or broken. The guide's cover beside the message on
   wide screens; stacked on phones.
   ========================================================================= */
.twi-confirmed {
  font-family: var(--twi-modal-font);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  background: #f8fafc;
  color: var(--twi-modal-text);
  box-sizing: border-box;
}

.twi-confirmed__card {
  width: 100%;
  max-width: 560px;
  display: grid;
  gap: 32px;
  background: var(--twi-modal-bg);
  border: 1px solid var(--twi-modal-border);
  border-radius: 20px;
  padding: 36px 28px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.06), 0 12px 40px rgba(15,23,42,0.08);
  box-sizing: border-box;
}

.twi-confirmed__card--cover {
  max-width: 880px;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: start;
}

.twi-confirmed__cover {
  display: flex;
  justify-content: center;
}


.twi-confirmed__content {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.twi-confirmed__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--twi-modal-accent);
}

.twi-confirmed__mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--twi-modal-accent);
  color: #ffffff;
  font-size: 0.95rem;
  letter-spacing: 0;
}

.twi-confirmed--expired .twi-confirmed__eyebrow,
.twi-confirmed--retry .twi-confirmed__eyebrow,
.twi-confirmed--invalid .twi-confirmed__eyebrow {
  color: #b45309;
}

.twi-confirmed--expired .twi-confirmed__mark,
.twi-confirmed--retry .twi-confirmed__mark,
.twi-confirmed--invalid .twi-confirmed__mark {
  background: #b45309;
}

.twi-confirmed__title {
  margin: 0;
  font-size: clamp(1.6rem, 4.5vw, 2.125rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: var(--twi-modal-text);
}

.twi-confirmed__lead {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--twi-modal-muted);
  max-width: 60ch;
}

.twi-confirmed__lead strong {
  color: var(--twi-modal-text);
}

.twi-confirmed__subhead {
  margin: 8px 0 0;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--twi-modal-muted);
}

.twi-confirmed__steps {
  list-style: none;
  counter-reset: twi-step;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.twi-confirmed__steps li {
  counter-increment: twi-step;
  position: relative;
  padding-left: 44px;
  display: grid;
  gap: 2px;
  line-height: 1.5;
}

.twi-confirmed__steps li::before {
  content: counter(twi-step);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--twi-modal-accent);
  color: var(--twi-modal-accent);
  font-weight: 700;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.twi-confirmed__steps strong {
  color: var(--twi-modal-text);
  font-weight: 700;
}

.twi-confirmed__steps span {
  color: var(--twi-modal-muted);
  font-size: 0.9375rem;
}

/* R6.2: sits under the steps, so it reads as their footnote. */
.twi-confirmed__products {
  margin: 0;
  padding-left: 44px;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--twi-modal-muted);
}

.twi-confirmed__help {
  margin-top: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--twi-modal-text);
}

.twi-confirmed__help p {
  margin: 0;
}

.twi-confirmed__help-title {
  font-weight: 700;
  margin-bottom: 2px !important;
}

.twi-confirmed__cta {
  justify-self: start;
  text-decoration: none;
}

.twi-confirmed__note {
  margin: -4px 0 0;
  font-size: 0.875rem;
  color: var(--twi-modal-muted);
}

@media (max-width: 720px) {
  .twi-confirmed {
    align-items: flex-start;
    padding: 24px 16px 40px;
  }

  .twi-confirmed__card,
  .twi-confirmed__card--cover {
    grid-template-columns: minmax(0, 1fr);
    padding: 28px 20px;
    gap: 24px;
  }

  /* Small enough that the headline is on the first screen. */
  .twi-confirmed__cover .twi-book {
    zoom: 0.62;
  }

  .twi-confirmed__cta {
    justify-self: stretch;
    justify-content: center;
  }
}

@media (prefers-color-scheme: dark) {
  .twi-confirmed {
    background: #0b1120;
  }

  .twi-confirmed__card {
    background: #111a2e;
    border-color: #1e293b;
    box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  }

  .twi-confirmed__title,
  .twi-confirmed__lead strong,
  .twi-confirmed__steps strong {
    color: #f1f5f9;
  }

  .twi-confirmed__lead,
  .twi-confirmed__steps span,
  .twi-confirmed__products,
  .twi-confirmed__subhead,
  .twi-confirmed__note {
    color: #94a3b8;
  }

  .twi-confirmed__eyebrow {
    color: #2dd4bf;
  }

  .twi-confirmed__mark {
    background: #14b8a6;
    color: #04211d;
  }

  .twi-confirmed__steps li::before {
    border-color: #2dd4bf;
    color: #2dd4bf;
  }

  .twi-confirmed__help {
    background: #0f2a2a;
    border-color: #134e4a;
    color: #e2e8f0;
  }

  .twi-confirmed--expired .twi-confirmed__eyebrow,
  .twi-confirmed--retry .twi-confirmed__eyebrow,
  .twi-confirmed--invalid .twi-confirmed__eyebrow {
    color: #fbbf24;
  }

  .twi-confirmed--expired .twi-confirmed__mark,
  .twi-confirmed--retry .twi-confirmed__mark,
  .twi-confirmed--invalid .twi-confirmed__mark {
    background: #f59e0b;
    color: #1c1003;
  }
}
