/* =========================================================
   EchoMind — design system
   A premium family heirloom feel: warm cream paper,
   deep midnight ink, antique gold accents.
   ========================================================= */

:root {
  --c-midnight: #1a1a2e;
  --c-cream: #f5f0e8;
  --c-gold: #8b6914;
  --c-mahogany: #4a3728;
  --c-white: #ffffff;
  --c-rule: #d8cdb1;
  --c-muted: #8a7d6b;
  --c-shadow: rgba(26, 26, 46, 0.08);
  --c-shadow-strong: rgba(26, 26, 46, 0.18);

  --f-display: Georgia, "Times New Roman", serif;
  --f-body: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --f-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--c-cream);
  color: var(--c-midnight);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--c-gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* -------- header & footer -------- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2rem;
  border-bottom: 1px solid var(--c-rule);
  background: var(--c-cream);
}
.brand-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--c-midnight);
}
.brand-link:hover { text-decoration: none; }
.wordmark {
  font-family: var(--f-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--c-midnight);
}
.candle { width: 22px; height: 22px; }
.candle .flame {
  transform-origin: center 24px;
  animation: flicker 3.6s ease-in-out infinite;
}
.tagline {
  margin: 0.1rem 0 0 1.85rem;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--c-mahogany);
}
.site-nav a {
  font-family: var(--f-ui);
  font-size: 0.95rem;
  margin-left: 1.4rem;
  color: var(--c-mahogany);
}
.site-nav a:hover { color: var(--c-gold); }

.site-footer {
  margin-top: 4rem;
  padding: 1.5rem 2rem;
  text-align: center;
  border-top: 1px solid var(--c-rule);
  color: var(--c-muted);
  font-size: 0.9rem;
}
.site-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* -------- buttons -------- */
.btn {
  display: inline-block;
  font-family: var(--f-ui);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
  text-decoration: none;
}
.btn-primary {
  background: var(--c-midnight);
  color: var(--c-cream);
  border-color: var(--c-midnight);
}
.btn-primary:hover {
  background: var(--c-gold);
  border-color: var(--c-gold);
  color: var(--c-white);
  text-decoration: none;
}
.btn-ghost {
  background: transparent;
  color: var(--c-mahogany);
  border-color: var(--c-mahogany);
}
.btn-ghost:hover {
  background: var(--c-mahogany);
  color: var(--c-cream);
  text-decoration: none;
}
.btn-large { padding: 0.95rem 2rem; font-size: 1.1rem; }

/* -------- hero -------- */
.hero {
  padding: 4rem 0 2.5rem;
  text-align: center;
}
.hero-title {
  font-family: var(--f-display);
  font-size: 3rem;
  line-height: 1.15;
  margin: 0 auto 1.2rem;
  max-width: 820px;
  color: var(--c-midnight);
}
.hero-sub {
  max-width: 720px;
  margin: 0 auto 2rem;
  font-size: 1.2rem;
  color: var(--c-mahogany);
  line-height: 1.7;
}
.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* -------- "how it works" -------- */
.section-title {
  font-family: var(--f-display);
  font-size: 2rem;
  text-align: center;
  color: var(--c-midnight);
  margin-bottom: 2rem;
  position: relative;
}
.section-title::after {
  content: "";
  display: block;
  width: 60px;
  height: 2px;
  background: var(--c-gold);
  margin: 0.6rem auto 0;
}
.how { padding: 3rem 0; }
.how-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}
.how-step {
  background: var(--c-white);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-lg);
  padding: 1.6rem 1.4rem;
  text-align: center;
  box-shadow: 0 6px 20px var(--c-shadow);
}
.how-step h3 {
  font-family: var(--f-display);
  color: var(--c-gold);
  margin: 0.6rem 0 0.4rem;
}
.step-num {
  display: inline-block;
  font-family: var(--f-display);
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  line-height: 44px;
  border-radius: 50%;
  background: var(--c-gold);
  color: var(--c-white);
}

/* -------- start form -------- */
.start { padding: 3rem 0 1rem; }
.start-sub {
  text-align: center;
  color: var(--c-mahogany);
  margin-bottom: 2rem;
}
.start-form {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--c-white);
  padding: 1.8rem;
  border: 1px solid var(--c-rule);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 24px var(--c-shadow);
}
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field-label {
  font-family: var(--f-ui);
  font-size: 0.95rem;
  color: var(--c-mahogany);
}
.field-label em { color: var(--c-muted); font-style: italic; }
.field input, .field textarea {
  font-family: var(--f-body);
  font-size: 1.05rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  background: var(--c-cream);
  color: var(--c-midnight);
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--c-gold);
  box-shadow: 0 0 0 3px rgba(139, 105, 20, 0.18);
}
.start-form .btn { align-self: flex-start; }

/* -------- session -------- */
.session-wrap { padding: 1.5rem 0; }
.session-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 2rem;
}
@media (max-width: 880px) {
  .session-grid { grid-template-columns: 1fr; }
}
.agent-intro {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-family: var(--f-ui);
  color: var(--c-mahogany);
}
.quill { color: var(--c-gold); font-size: 1.3rem; }
.agent-name { font-weight: 600; }

.transcript {
  max-height: 480px;
  overflow-y: auto;
  padding: 1rem;
  background: var(--c-white);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-lg);
  box-shadow: 0 4px 16px var(--c-shadow);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-bottom: 1.2rem;
}
.bubble {
  max-width: 80%;
  padding: 0.9rem 1.1rem;
  border-radius: var(--r-md);
  animation: fadeIn 0.45s ease;
}
.bubble-label {
  font-family: var(--f-ui);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-muted);
  margin-bottom: 0.3rem;
}
.bubble-body { font-family: var(--f-body); line-height: 1.6; }
.bubble-assistant {
  align-self: flex-start;
  background: var(--c-cream);
  border-left: 4px solid var(--c-gold);
  color: var(--c-midnight);
  font-family: var(--f-body);
}
.bubble-user {
  align-self: flex-end;
  background: var(--c-midnight);
  color: var(--c-cream);
}

.answer-form { display: flex; flex-direction: column; gap: 0.6rem; }
.answer-form textarea {
  min-height: 120px;
  font-family: var(--f-body);
  font-size: 1.05rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  background: var(--c-white);
  color: var(--c-midnight);
  resize: vertical;
}
.answer-form textarea:focus {
  outline: none;
  border-color: var(--c-gold);
  box-shadow: 0 0 0 3px rgba(139, 105, 20, 0.18);
}
.answer-form .btn { align-self: flex-end; }

.progress {
  background: var(--c-white);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-lg);
  padding: 1.4rem 1.2rem;
  box-shadow: 0 4px 16px var(--c-shadow);
  font-family: var(--f-ui);
  align-self: start;
  position: sticky;
  top: 1rem;
}
.progress h3 {
  font-family: var(--f-display);
  margin: 0 0 0.8rem;
  color: var(--c-gold);
  font-size: 1.2rem;
}
.progress-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.progress-list li {
  padding: 0.4rem 0;
  color: var(--c-mahogany);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.progress-list li.done { color: var(--c-gold); }
.progress-list li.done .dot { color: var(--c-gold); }
.dot { color: var(--c-muted); font-size: 1rem; width: 1em; display: inline-block; text-align: center; }
.session-counter {
  font-size: 0.9rem;
  color: var(--c-muted);
  margin: 0.4rem 0;
}
.building-note {
  font-style: italic;
  font-size: 0.95rem;
  color: var(--c-mahogany);
  margin: 0.4rem 0 0;
}

/* -------- waiting -------- */
.waiting {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.waiting-inner { max-width: 640px; margin: 0 auto; text-align: center; }
.waiting-title {
  font-family: var(--f-display);
  font-size: 2.4rem;
  margin: 0 0 0.6rem;
  color: var(--c-midnight);
}
.waiting-sub {
  color: var(--c-mahogany);
  margin-bottom: 2.4rem;
}
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: left;
}
.stage {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  background: var(--c-white);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  padding: 1rem 1.2rem;
  box-shadow: 0 2px 8px var(--c-shadow);
  opacity: 0.55;
  transition: opacity 0.4s ease;
}
.stage.active { opacity: 1; border-color: var(--c-gold); }
.stage.done { opacity: 1; }
.stage-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--c-gold);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--c-gold);
}
.stage.done .stage-mark { background: var(--c-gold); color: var(--c-white); }
.stage-body h3 {
  margin: 0 0 0.2rem;
  font-family: var(--f-display);
  color: var(--c-midnight);
  font-size: 1.05rem;
}
.stage-body p { margin: 0; color: var(--c-mahogany); font-size: 0.95rem; }
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid var(--c-rule);
  border-top-color: var(--c-gold);
  border-radius: 50%;
  animation: spin 1.1s linear infinite;
}

/* -------- memoir -------- */
.memoir {
  background: var(--c-cream);
}
.memoir-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--c-rule);
  margin-bottom: 2rem;
}
.memoir-name {
  font-family: var(--f-display);
  font-size: 3rem;
  margin: 0;
  color: var(--c-midnight);
}
.memoir-sub {
  font-style: italic;
  color: var(--c-gold);
  font-size: 1.4rem;
  margin: 0.2rem 0 0;
}
.memoir-born { color: var(--c-mahogany); margin: 0.2rem 0 0; }
.memoir-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; }

.memoir-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2.5rem;
}
@media (max-width: 880px) {
  .memoir-body { grid-template-columns: 1fr; }
}
.chapter-nav {
  position: sticky;
  top: 1rem;
  align-self: start;
  font-family: var(--f-ui);
}
.chapter-nav h3 {
  font-family: var(--f-display);
  color: var(--c-gold);
  margin: 0 0 0.6rem;
}
.chapter-nav ul { list-style: none; padding: 0; margin: 0; }
.chapter-nav li { margin: 0.3rem 0; }
.chapter-nav a { color: var(--c-mahogany); }
.chapter-nav a:hover { color: var(--c-gold); }

.chapter { margin-bottom: 3rem; }
.chapter-title {
  font-family: var(--f-display);
  font-size: 2.1rem;
  color: var(--c-gold);
  margin: 0 0 0.4rem;
}
.chapter-rule {
  border: 0;
  border-top: 1px solid var(--c-gold);
  width: 80px;
  margin: 0 0 1.4rem;
}
.chapter-prose p {
  font-family: var(--f-body);
  font-size: 1.15rem;
  line-height: 1.85;
  color: var(--c-midnight);
  margin: 0 0 1.1rem;
}

.memoir-footer {
  text-align: center;
  border-top: 1px solid var(--c-rule);
  padding-top: 1.5rem;
  color: var(--c-mahogany);
}
.memoir-dedication { font-style: italic; }
.qr-block { margin-top: 1.5rem; }
.qr-block img {
  width: 140px; height: 140px;
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  padding: 6px;
  background: var(--c-white);
}
.qr-label { font-size: 0.9rem; color: var(--c-muted); margin-top: 0.4rem; }

/* -------- animations -------- */
@keyframes flicker {
  0%, 100% { transform: scale(1) translateY(0); opacity: 0.95; }
  25% { transform: scale(1.05, 0.95) translateY(-1px); opacity: 0.85; }
  50% { transform: scale(0.97, 1.05) translateY(1px); opacity: 1; }
  75% { transform: scale(1.03, 0.97) translateY(-1px); opacity: 0.9; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
