/* AI Engagement Tool — chat page styles, following greenstarter.ch:
   Montserrat, sage green header, square corners, dark text on white.
   Montserrat is served from /fonts (SIL Open Font License, see fonts/OFL.txt),
   so no request goes to Google. */

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/montserrat-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/montserrat-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/montserrat-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/montserrat-latin-ext-500-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/montserrat-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/montserrat-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/montserrat-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/montserrat-latin-ext-700-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* greenstarter.ch palette */
  --green: #597a59;        /* main brand green: header, headings, buttons */
  --green-dark: #243b24;   /* hover and emphasis */
  --green-tint: #f4f7f4;   /* light background tint */
  --ink: #212529;          /* body text */
  --ink-soft: #5c6660;
  --white: #ffffff;
  --line: #dde3dd;
  --error: #9b2c2c;
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --measure: 760px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
}

/* ---- header: the green bar from greenstarter.ch ---- */
.topbar {
  background: var(--green);
  color: var(--white);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 14px 16px;
}

.brand { display: flex; flex-direction: column; line-height: 1.3; }
.wordmark { font-weight: 700; font-size: 1.5rem; letter-spacing: -0.01em; }
.brand-sub { font-weight: 500; font-size: 0.85rem; opacity: 0.92; }

.lang select {
  font: inherit;
  font-weight: 500;
  font-size: 0.85rem;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 0;
  background: transparent;
  color: var(--white);
  cursor: pointer;
}
.lang select option { color: var(--ink); }

/* ---- page ---- */
.app {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 16px;
}

.dev-notice {
  margin: 16px 0 0;
  padding: 8px 12px;
  border-left: 3px solid var(--green);
  background: var(--green-tint);
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.msg {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 0;
}

.msg p { margin: 0 0 0.75em; }
.msg p:last-child { margin-bottom: 0; }

/* Assistant replies: no frame, only the green line on the left. */
.msg.assistant {
  align-self: flex-start;
  padding: 2px 4px 2px 18px;
  background: none;
  border: 0;
  border-left: 3px solid var(--green);
}

/* Formatting inside replies (built from light Markdown in app.js) */
.msg h3,
.msg h4 {
  margin: 1.1em 0 0.4em;
  color: var(--green);
  font-weight: 700;
  line-height: 1.35;
}
.msg h3 { font-size: 1.05rem; }
.msg h4 { font-size: 0.95rem; }
.msg > :first-child { margin-top: 0; }
.msg ul,
.msg ol {
  margin: 0 0 0.75em;
  padding-left: 1.25em;
}
.msg li { margin: 0 0 0.3em; padding-left: 0.2em; }
.msg li::marker { color: var(--green); font-weight: 600; }
.msg li > ul,
.msg li > ol { margin: 0.3em 0 0; }
.msg > :last-child { margin-bottom: 0; }
.msg strong { font-weight: 600; color: var(--green-dark); }
.msg code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 1px 5px;
  background: var(--green-tint);
}
.msg a { color: var(--green); text-underline-offset: 3px; }
.msg a:hover { color: var(--green-dark); }
.msg hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }

.msg.user {
  align-self: flex-end;
  background: var(--green-tint);
  border: 1px solid var(--green-tint);
}

.msg.pending { color: var(--ink-soft); font-style: italic; }
.msg.user p { white-space: pre-line; }

/* ---- composer ---- */
/* Seamless input: no dividing line, a see-through field and a small button. */
.composer {
  padding: 8px 0 4px;
}

.composer-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.composer textarea {
  flex: 1;
  font: inherit;
  resize: none;
  min-height: 44px;
  max-height: 180px;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
}

.composer textarea::placeholder { color: var(--ink-soft); opacity: 0.8; }

#send {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  min-height: 34px;
  padding: 0 14px;
  margin-bottom: 5px;
  border: 0;
  border-radius: 0;
  background: var(--green);
  color: var(--white);
  cursor: pointer;
}

#send:hover:not(:disabled) { background: var(--green-dark); }
#send:disabled { opacity: 0.55; cursor: default; }

/* Paperclip and microphone: quiet icon buttons beside the text field */
.icon-button {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-bottom: 5px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
}
.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-button:hover:not(:disabled) { color: var(--green); }
.icon-button:disabled { opacity: 0.45; cursor: default; }
.icon-button[hidden] { display: none; }

#mic .icon-stop { display: none; }
#mic.is-recording { background: var(--green); color: var(--white); }
#mic.is-recording .icon-mic { display: none; }
#mic.is-recording .icon-stop { display: block; fill: currentColor; stroke: none; }

.recording {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0 42px;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.recording[hidden] { display: none; }
.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: rec-pulse 1.2s ease-in-out infinite;
}
.recording.is-transcribing .rec-dot { animation-duration: 0.6s; }
@keyframes rec-pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }

/* Attachments waiting to be sent, and those shown in sent messages */
.attachment-tray,
.msg-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
}
.attachment-tray { padding-left: 42px; }
.attachment-tray[hidden] { display: none; }
.msg-files { margin: 8px 0 0; }
.msg-files:first-child { margin-top: 0; }

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  padding: 4px 6px 4px 4px;
  border: 1px solid var(--line);
  background: var(--white);
  font-size: 0.8rem;
  line-height: 1.3;
}
.msg.user .file-chip { border-color: transparent; }
.file-chip img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  display: block;
}
.file-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 4px;
  background: var(--green-tint);
  color: var(--green);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}
.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-remove {
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.file-remove:hover { color: var(--green-dark); }

.drop-hint {
  position: fixed;
  inset: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--green);
  background: rgba(244, 247, 244, 0.92);
  color: var(--green);
  font-weight: 600;
  pointer-events: none;
}
.drop-hint[hidden] { display: none; }

.composer textarea:focus {
  outline: none;
  border-bottom-color: var(--green);
}
.composer button:focus-visible,
.file-remove:focus-visible {
  outline: 2px solid var(--green-dark);
  outline-offset: 2px;
}
.lang select:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

/* ---- small buttons and links ---- */
.chat-actions { display: flex; justify-content: flex-end; align-items: center; gap: 18px; min-height: 24px; }

.link-button {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-button:hover { color: var(--green-dark); }

.small-button {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: var(--green);
  color: var(--white);
  cursor: pointer;
}
.small-button:hover:not(:disabled) { background: var(--green-dark); }
.small-button:disabled { opacity: 0.55; cursor: default; }

.link-button:focus-visible,
.small-button:focus-visible,
.review select:focus-visible,
.review input:focus,
.review textarea:focus {
  outline: 2px solid var(--green-dark);
  outline-offset: 2px;
}

/* ---- end-of-chat review ---- */
.app.reviewing .chat,
.app.reviewing .composer,
.app.reviewing .chat-actions { display: none; }

.review {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
}

.review h2 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green);
}

.review h2:focus { outline: none; }

.review-intro, .review-empty { margin: 0 0 18px; color: var(--ink-soft); font-size: 0.9rem; }

.review-list { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.note {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
}
.note.hypothesis { border-left-style: dashed; }

.note-meta {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--green);
}
.note-text { margin: 0; }
.note-actions { display: flex; gap: 16px; margin-top: 6px; }

.note textarea {
  width: 100%;
  font: inherit;
  min-height: 64px;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid var(--green);
  background: transparent;
  color: var(--ink);
  resize: vertical;
}

.add-note { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 24px; }
.add-note select,
.add-note input {
  font: inherit;
  font-size: 0.9rem;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
}
.add-note input { flex: 1; min-width: 0; }

.review-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.review-done {
  margin: 18px 0 0;
  padding: 10px 14px;
  border-left: 3px solid var(--green);
  background: var(--green-tint);
  font-size: 0.9rem;
}

@media (max-width: 520px) {
  .add-note { flex-wrap: wrap; }
  .add-note input { flex-basis: 100%; order: 2; }
  .add-note button { order: 3; }
}

.status {
  min-height: 1.4em;
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--error);
}

.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;
}

@media (max-width: 520px) {
  .wordmark { font-size: 1.3rem; }
  .brand-sub { font-size: 0.75rem; }
  .msg { max-width: 92%; }
}

/* ---- contact request and privacy link ---- */
.contact-form {
  margin: 22px 0 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.contact-form h3 { margin: 0 0 8px; font-size: 1rem; color: var(--green-dark); }
.contact-form h3:focus { outline: none; }
.contact-intro { margin: 0 0 14px; font-size: 0.9rem; line-height: 1.5; }
.contact-fields {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 10px;
}
.contact-fields label { font-size: 0.85rem; color: var(--ink-soft); }
.contact-fields input {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.contact-privacy { margin: 0 0 12px; font-size: 0.8rem; }
.contact-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.contact-actions .small-button:disabled { opacity: 0.5; cursor: not-allowed; }
.privacy-line { margin: 0 0 12px; font-size: 0.8rem; text-align: center; }
.privacy-link { color: var(--ink-soft); }
.privacy-link:hover { color: var(--green-dark); }
@media (max-width: 520px) {
  .contact-fields { grid-template-columns: 1fr; }
}
.contact-form ~ .review-footer, .contact-result + .review-footer { margin-top: 16px; }
