/* Marcel — Van Melkebeke LLC. Design system per MARCEL_HANDOFF_BRIEF.md Appendix A.
   Governing rule: modern stained glass. Every field of color is flat, saturated,
   and bounded. The lead is Van Melkebeke Green — all rules, frames, borders, and
   dividers are 1px solid #056839. No gradients, no shadows, no tints, no radii.
   Hierarchy through size and italic only — never weight, never color.

   Two layout states, driven by body.conversing:
   - Empty state: hero wordmark + intro, the input centered as the hero, chips below.
   - Conversation state: hero and chips collapse, transcript fills the viewport,
     the input docks at the bottom. Header and footer persist in both. */

:root {
  --green: #056839;   /* Van Melkebeke Green — the lead line, links, send action, Marcel's label */
  --orange: #f1592a;  /* Maxime Orange — one deliberate accent moment per view */
  --sun: #f7941d;     /* warning */
  --red: #ef4036;     /* error; chips; monogram */
  --mint: #2bb673;    /* success; chips; monogram */
  --aqua: #13a89e;    /* chips; monogram */
  --white: #ffffff;
  --dark: #0a0a0a;
  --muted: #6b6b66;   /* metadata, timestamps, placeholders only */

  --lead: 1px solid var(--green);
  --serif: "GT Alpina Fine", "Baskervville", Baskerville, Georgia, serif;

  /* The landing page sets one shared content column: intro, input frame,
     FREQUENTLY ASKED label, and chips all share this width and its edges.
     No landing element gets a private width; only the wordmark is centered. */
  --landing-col: 540px;
}

* {
  box-sizing: border-box;
  border-radius: 0;
  box-shadow: none;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--white);
  color: var(--dark);
  font-family: var(--serif);
  font-weight: normal;
  font-size: 17px;
  line-height: 1.65;
}

/* ── Header (persists in all states) ──────────────────────────────────── */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  border-bottom: var(--lead);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.wordmark-monogram {
  height: 20px;
  width: auto;
  display: block;
}

.wordmark-name {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dark);
}

/* Owner mode / demo: a small bordered label in the header, so Maxime always
   knows the gates are off in this browser. */
.mode-label {
  margin-left: auto;
  padding: 0.15em 0.6em;
  border: var(--lead);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
}

.mode-label[hidden] {
  display: none;
}

/* Private-beta notice: one quiet line under the header, all states. */
.beta-notice {
  margin: 0;
  padding: 0.5rem 1.5rem;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: center;
}

/* ── Page column ──────────────────────────────────────────────────────── */

.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Empty state: center the hero block vertically in the available space. */
body:not(.conversing) .page {
  justify-content: center;
  padding-bottom: 3rem;
}

/* ── Hero (empty state only) ──────────────────────────────────────────── */

.hero {
  text-align: center;
  padding: 2.5rem 0 0;
}

.hero-title {
  margin: 0;
  font-size: 3rem;
  font-weight: normal;
  letter-spacing: 0.04em;
}

/* Italic rule, sitewide: italic marks the visitor's voice only (transcript
   questions, suggested-question chips, follow-up chips). Everything else,
   including Marcel's output, is roman. */

/* The intro block sits on the shared landing column, its lines running edge
   to edge with the input frame below. Text set left, ragged right. */
.hero-intro {
  max-width: var(--landing-col);
  margin: 1rem auto 0;
  font-size: 0.95rem;
  text-align: left;
}

body.conversing .hero {
  display: none;
}

/* ── Transcript — editorial, not chat bubbles ─────────────────────────── */

body:not(.conversing) .transcript {
  display: none;
}

.exchange {
  padding: 1.75rem 0;
  border-bottom: var(--lead);
}

.exchange-question {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-style: italic;
}

.speaker {
  margin: 0 0 0.4rem;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--green);
}

.exchange-answer {
  margin: 0;
}

.exchange-answer p {
  margin: 0 0 1em;
}

.exchange-answer p:last-child {
  margin-bottom: 0;
}

/* Marcel's markdown emphasis is stripped of its markers but stays roman:
   italic belongs to the visitor's voice alone. */
.exchange-answer em {
  font-style: normal;
}

/* ── Typing indicator ─────────────────────────────────────────────────── */

.typing {
  margin: 0;
  padding: 0.75rem 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.typing-dots span {
  animation: typing-fade 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-fade {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

/* ── The input dock ───────────────────────────────────────────────────── */

/* Empty state: the input is the hero, on the shared landing column. */
.dock {
  width: 100%;
  max-width: var(--landing-col);
  margin: 2rem auto 0;
}

/* Conversation state: full column width, docked at the bottom of the
   viewport on a white ground so the transcript scrolls beneath the rule. */
body.conversing .dock {
  position: sticky;
  bottom: 0;
  max-width: none;
  margin: auto 0 0;
  padding: 1rem 0 1.25rem;
  background: var(--white);
}

/* The email gate and the request form are read after the answer: they flow
   below it in the page instead of docking over it, which on a phone would
   cover the answer the visitor has not read yet. */
body.conversing.gate-open .dock {
  position: static;
}

/* Scrolled-to answers keep a little air above their first line. */
.exchange .speaker {
  scroll-margin-top: 1rem;
}

/* ── The double frame: standard for ALL text-entry inputs ─────────────────
   Every field a visitor types into, current and future (chat textarea, email
   gate, Phase 8 upload text areas), is set in a double frame: outer 1px green
   frame, ~5px white gap, inner 1px green border around the field itself.
   Single borders remain the rule for non-entry elements: chips, banners,
   buttons, transcript rules. Reuse .entry-frame for any new input. */

.entry-frame {
  border: var(--lead);
  padding: 5px;
  background: var(--white);
}

/* ── Composer: a double frame whose outer frame also docks the Send block ── */

/* Hidden behind the invite form and the request gate (after A13). */
.composer[hidden] {
  display: none;
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 5px;
  border: var(--lead);
  padding: 5px;
  background: var(--white);
}

.composer-input {
  display: block;
  width: 100%;
  min-height: 104px; /* 4 rows on the landing empty state */
  max-height: 260px;
  padding: 0.7em 0.85em;
  background: var(--white);
  border: var(--lead); /* inner border of the double frame */
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.5;
  color: var(--dark);
  caret-color: var(--green);
  cursor: text;
  resize: none;
  overflow-y: auto;
  appearance: none;
  /* Feedback through line weight only: the inner border thickens on
     hover/focus; padding compensates so the text doesn't shift. */
  transition: border-width 150ms ease, padding 150ms ease;
}

.composer-input:hover,
.composer-input:focus {
  border-width: 2px;
  padding: calc(0.7em - 1px) calc(0.85em - 1px);
}

.composer-input:focus {
  outline: none;
}

.composer-input::placeholder {
  font-size: 16px; /* the field's body size, never larger */
  color: var(--muted);
  opacity: 1;
}

.composer-input:disabled {
  color: var(--muted);
}

/* Conversation state: the docked input rests at 2 rows and grows from there. */
body.conversing .composer-input {
  min-height: 60px;
}

/* The send row docks inside the outer frame, below the inner-bordered
   field: keyboard hint bottom-left, Send bottom-right. */
.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.composer-hint {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

/* Send is an outline while the field is empty and fills solid green the
   moment there is content. Feedback through fill, no scaling, no shadows. */
.send {
  padding: 0.5em 1.6em;
  background: var(--white);
  border: var(--lead);
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--green);
  cursor: pointer;
  appearance: none;
  transition: background-color 150ms ease, color 150ms ease;
}

.composer.has-content .send:not(:disabled) {
  background: var(--green);
  color: var(--white);
}

.send:disabled {
  color: var(--muted);
  cursor: default;
}

/* ── Suggested-prompt chips (empty state, below the input) ────────────── */

.chips {
  max-width: var(--landing-col);
  width: 100%;
  margin: 1.75rem auto 0;
}

body.conversing .chips,
.chips[hidden] {
  display: none;
}

.chips-caption {
  margin: 0 0 0.85rem;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-style: normal;
  color: var(--muted);
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.5em 0.85em;
  background: var(--white);
  border: var(--lead);
  font-family: var(--serif);
  font-size: 0.9rem;
  font-style: italic;
  color: var(--dark);
  text-align: left;
  cursor: pointer;
}

/* Each chip carries one small stained-glass pane: a flat, saturated field
   bounded by its own lead line. */
.chip::before {
  content: "";
  flex: none;
  width: 0.55em;
  height: 0.55em;
  border: var(--lead);
}

.chip[data-hue="mint"]::before { background: var(--mint); }
.chip[data-hue="aqua"]::before { background: var(--aqua); }
.chip[data-hue="red"]::before  { background: var(--red); }

/* ── Follow-up chips: the visitor's possible next questions, so italic ── */

.followups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 0 0.75rem;
}

.followups[hidden] {
  display: none;
}

.followup {
  padding: 0.35em 0.75em;
  background: var(--white);
  border: var(--lead);
  font-family: var(--serif);
  font-size: 0.85rem;
  font-style: italic;
  color: var(--dark);
  text-align: left;
  cursor: pointer;
  appearance: none;
}

.followup:focus-visible {
  outline: var(--lead);
  outline-offset: 2px;
}

/* ── Gates ────────────────────────────────────────────────────────────── */

.gate {
  margin: 0 0 1rem;
  padding: 1.5rem;
  border: var(--lead);
  background: var(--white);
}

/* Request a conversation: email, optional name, one message, stacked. Each
   entry field keeps the double frame; Send request stays a single border. */
.request-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.request-form[hidden] {
  display: none;
}

.request-label {
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
}

.request-message {
  min-height: 5.5rem;
  resize: none;
  line-height: 1.5;
}

.request-actions[hidden] {
  display: none;
}

.request-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1.25rem;
}

.gate-title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.gate-prompt {
  margin: 0 0 1.1rem;
  font-size: 0.95rem;
}

.gate-form {
  display: flex;
  gap: 0.6rem;
}

/* The email field sits in the standard double frame; the Continue button is
   a non-entry element and keeps its single border outside the frame. */
.gate-entry {
  flex: 1;
  display: flex;
}

.gate-input {
  width: 100%;
  padding: 0.6em 0.85em;
  background: var(--white);
  border: var(--lead); /* inner border of the double frame */
  font-family: var(--serif);
  font-size: 16px;
  color: var(--dark);
  caret-color: var(--green);
  cursor: text;
  appearance: none;
  transition: border-width 150ms ease, padding 150ms ease;
}

.gate-input:hover,
.gate-input:focus {
  border-width: 2px;
  padding: calc(0.6em - 1px) calc(0.85em - 1px);
}

.gate-input:focus {
  outline: none;
}

.gate-input::placeholder {
  font-size: 16px;
  color: var(--muted);
  opacity: 1;
}

.gate-aside {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.action {
  padding: 0.6em 1.4em;
  background: var(--white);
  border: var(--lead);
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--green);
  cursor: pointer;
  appearance: none;
}

.action:disabled {
  color: var(--muted);
  cursor: default;
}


/* ── Semantic notes: error → Red, success → Mint, warning → Sun ───────── */

.note {
  margin: 0.9rem 0 0;
  padding: 0.6em 0.85em;
  font-size: 0.9rem;
  background: var(--white);
}

.note-error   { border: 1px solid var(--red); }
.note-success { border: 1px solid var(--mint); margin: 0 0 1rem; }
.note-warning { border: 1px solid var(--sun); }

/* ── Links, focus, footer ─────────────────────────────────────────────── */

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

.link-button {
  padding: 0;
  background: none;
  border: none;
  font-family: var(--serif);
  font-size: 0.85rem;
  color: var(--green);
  text-decoration: underline;
  cursor: pointer;
}

:is(.chip, .action, .link-button, .wordmark, .colophon-link):focus-visible {
  outline: var(--lead);
  outline-offset: 2px;
}

.colophon {
  padding: 1.1rem 1.5rem;
  border-top: var(--lead);
  text-align: center;
}

.colophon-link {
  font-size: 0.8rem;
  color: var(--green);
  text-decoration: none;
}

.colophon-link:hover {
  text-decoration: underline;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── Mobile ───────────────────────────────────────────────────────────── */

@media (max-width: 560px) {
  body {
    font-size: 16px;
  }

  .site-header {
    padding: 0.75rem 1.25rem;
  }

  .page {
    padding: 0 1.25rem;
  }

  .hero-title {
    font-size: 2.25rem;
  }

  .gate-form {
    flex-direction: column;
  }

  .action {
    align-self: flex-end;
  }

}
