/* Coach — chat surface on the site's paper system (tokens come from poolsuite.css) */

.coach-page {
  --column: 720px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.coach-page [hidden] { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ---------- masthead tools ---------- */
.coach-page .topbar-inner { justify-content: space-between; }
.coach-tools { display: flex; align-items: center; gap: 10px; }
/* buttons: ink outline reads clearly on paper; the primary adds weight, not a black slab */
.btn {
  min-height: 40px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  border: 1.5px solid rgba(17, 17, 17, 0.28);
  border-radius: 999px;
  background: var(--paper-hi);
  color: var(--ink);
  cursor: pointer;
  font: 600 0.9rem/1 "Avenir Next", Avenir, "Helvetica Neue", Arial, sans-serif;
  white-space: nowrap;
  transition: border-color 160ms ease-out, background 160ms ease-out, transform 220ms var(--ease);
}
@media (hover: hover) {
  .btn:hover { border-color: var(--ink); background: #fff; }
  .btn-primary:hover { background: #fff; box-shadow: inset 0 0 0 1px var(--ink), 0 8px 18px -10px rgba(17, 17, 17, 0.5); }
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn-primary { border-color: var(--ink); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 6px 14px -10px rgba(17, 17, 17, 0.5); }
.btn-small { min-height: 32px; padding: 0 13px; font-size: 0.82rem; }
.btn-link {
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--graphite);
  cursor: pointer;
  font: 0.82rem "Avenir Next", Avenir, "Helvetica Neue", Arial, sans-serif;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.btn-link:hover { color: var(--ink); }
.btn-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* the coach wordmark: same Didot treatment as the site's, set in lowercase */
.coach-mark { letter-spacing: -0.035em; }

/* ---------- column ---------- */
.coach-shell {
  position: relative;
  z-index: 1;
  flex: 1;
  width: min(100%, var(--column));
  margin: 0 auto;
  padding: clamp(28px, 5vw, 64px) 24px 24px;
}

/* ---------- empty state ---------- */
.coach-intro { padding-top: clamp(8px, 4vh, 48px); }
.coach-intro h1 {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}
.coach-intro p {
  max-width: 52ch;
  margin-top: 16px;
  color: var(--graphite);
  font-size: 1.06rem;
  line-height: 1.6;
  text-wrap: pretty;
}
.starters {
  margin-top: clamp(28px, 4vw, 40px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.starter {
  padding: 14px 16px;
  border: 1px solid rgba(17, 17, 17, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  color: var(--ink);
  cursor: pointer;
  font: 500 0.92rem/1.4 "Avenir Next", Avenir, "Helvetica Neue", Arial, sans-serif;
  text-align: left;
  transition: transform 260ms var(--ease), background 160ms ease-out, border-color 160ms ease-out;
}
.starter:hover { border-color: rgba(17, 17, 17, 0.22); background: rgba(255, 255, 255, 0.55); transform: translateY(-2px); }
.starter:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- thread ---------- */
.thread { list-style: none; display: flex; flex-direction: column; gap: 26px; }
.thread:empty { display: none; }
.msg { animation: msg-in 320ms var(--ease) both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }

.msg-user { align-self: flex-end; max-width: min(86%, 560px); }
.msg-user .bubble {
  padding: 11px 16px;
  border-radius: 18px 18px 5px 18px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.98rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 18px -12px rgba(17, 17, 17, 0.7);
}

.msg-coach { position: relative; padding-top: 22px; }
.msg-coach::before {
  content: "Coach";
  position: absolute;
  top: 0;
  left: 0;
  color: var(--graphite);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.msg-coach .prose { color: var(--ink); font-size: 1.02rem; line-height: 1.68; overflow-wrap: anywhere; }

.prose > * + * { margin-top: 0.85em; }
.prose h1, .prose h2, .prose h3, .prose h4 {
  margin-top: 1.4em;
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.prose h1 { font-size: 1.7rem; }
.prose h2 { font-size: 1.45rem; }
.prose h3 { font-size: 1.22rem; }
.prose h4 { font-size: 1.06rem; }
/* each advisor's take starts with a ruled name */
.msg-coach .prose h3 {
  margin-top: 1.6em;
  padding-top: 0.75em;
  border-top: 1px solid var(--line);
  font-size: 1.18rem;
}
.msg-coach .prose > h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.msg-coach .prose h3 + p { margin-top: 0.4em; }
.prose > :first-child { margin-top: 0; }
.prose strong { font-weight: 650; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.3em; }
.prose li::marker { color: var(--graphite); }
.prose a { text-decoration-color: var(--accent); text-underline-offset: 0.16em; }
.prose blockquote { padding-left: 14px; border-left: 2px solid var(--line); color: var(--graphite); }
.prose code {
  padding: 0.1em 0.35em;
  border-radius: 5px;
  background: rgba(17, 17, 17, 0.06);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.86em;
}
.prose pre { padding: 14px 16px; border-radius: 12px; background: rgba(17, 17, 17, 0.06); overflow-x: auto; }
.prose pre code { padding: 0; background: none; }
.prose hr { height: 1px; border: 0; background: var(--fade-rule); }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; font-size: 0.92rem; }
.prose th, .prose td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; }

/* thinking indicator: three ink dots */
.pending { display: inline-flex; gap: 6px; padding: 8px 0 4px; }
.pending i { width: 6px; height: 6px; border-radius: 50%; background: var(--graphite); animation: dot 1.2s ease-in-out infinite; }
.pending i:nth-child(2) { animation-delay: 0.15s; }
.pending i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.msg-error {
  padding: 14px 16px;
  border: 1px solid rgba(150, 60, 40, 0.28);
  border-radius: 12px;
  background: rgba(190, 90, 60, 0.07);
  color: #6b2c1c;
  font-size: 0.94rem;
  line-height: 1.5;
}
.error-actions { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.msg-meta { margin-top: 8px; color: var(--graphite); font-family: "Courier New", Courier, monospace; font-size: 0.66rem; }

/* ---------- composer ---------- */
.composer {
  position: sticky;
  z-index: var(--z-header);
  bottom: 0;
  padding: 14px 24px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(242, 240, 234, 0) 0%, rgba(242, 240, 234, 0.92) 34%, var(--paper) 100%);
}
.composer-inner {
  width: min(100%, calc(var(--column) - 48px));
  margin: 0 auto;
  padding: 8px 8px 8px 20px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  border: 1px solid rgba(17, 17, 17, 0.14);
  border-radius: 26px;
  background: var(--paper-hi);
  box-shadow: var(--lift-rest);
  transition: box-shadow 260ms var(--ease), border-color 160ms ease-out;
}
.composer-inner:focus-within { border-color: rgba(17, 17, 17, 0.3); box-shadow: var(--lift-hover); }
#composer-input {
  flex: 1;
  min-height: 38px;
  max-height: 40vh;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 1rem/1.4 "Avenir Next", Avenir, "Helvetica Neue", Arial, sans-serif;
  resize: none;
  outline: none;
}
#composer-input::placeholder { color: #8c8a84; }
.send-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--paper-hi);
  color: var(--ink);
  cursor: pointer;
  transition: transform 200ms var(--ease), opacity 160ms ease-out, background 160ms ease-out;
}
.send-btn:not(:disabled):hover { background: #fff; }
.send-btn svg { width: 18px; height: 18px; }
.send-btn:hover { transform: translateY(-1px); }
.send-btn:disabled { opacity: 0.3; cursor: default; transform: none; }
.send-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.composer-note {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 14px;
  color: var(--graphite);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.62rem;
  text-align: center;
}

/* ---------- key dialog ---------- */
.access-dialog {
  width: min(92vw, 440px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--paper-hi);
  box-shadow: var(--lift-hover);
  color: var(--ink);
}
/* padding lives on the form so a click on the dialog element itself means the backdrop */
.access-dialog form { position: relative; padding: 26px 26px 24px; }
.access-dialog::backdrop { background: rgba(30, 28, 24, 0.32); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.access-dialog h2:focus { outline: none; }
.access-dialog h2 { padding-right: 32px; font-family: var(--serif); font-size: 1.7rem; font-weight: 400; letter-spacing: -0.01em; line-height: 1.1; }
.access-dialog p { margin-top: 10px; color: var(--graphite); font-size: 0.9rem; line-height: 1.55; }
.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--graphite);
  cursor: pointer;
}
.dialog-close svg { width: 18px; height: 18px; }
.dialog-close:hover { background: var(--accent-soft); color: var(--ink); }
.dialog-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.key-row { margin-top: 8px; display: flex; gap: 8px; }
.access-dialog input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(17, 17, 17, 0.18);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: 0.88rem ui-monospace, "SF Mono", Menlo, monospace;
}
.access-dialog input:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.access-dialog .key-hint { margin-top: 8px; font-size: 0.8rem; }
.beta-mark { color: #8a3420; }
.beta-note { color: var(--graphite); font-weight: 400; }

/* ---------- small screens ---------- */
@media (max-width: 620px) {
  .coach-shell { padding: 24px 20px 16px; }
  .starters { grid-template-columns: 1fr; }
  .sample { padding: 18px 16px 20px; }
  .composer { padding-inline: 12px; }
  .composer-inner { width: 100%; }
  .keys-hint { display: none; }
  .msg-user { max-width: 92%; }
}

/* ---------- landing ---------- */
.landing { padding-top: clamp(8px, 3vh, 40px); }
.eyebrow {
  color: var(--graphite);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.landing h1 {
  margin-top: 10px;
  font-family: var(--serif);
  font-size: clamp(2.7rem, 7vw, 4.4rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
  text-wrap: balance;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}
.landing .lede {
  max-width: 54ch;
  margin-top: 18px;
  color: var(--graphite);
  font-size: 1.08rem;
  line-height: 1.6;
  text-wrap: pretty;
}
.google-slot { min-height: 44px; display: flex; align-items: center; justify-content: center; }
.google-slot:empty { display: none; }
.advisor-note { margin-top: 6px; color: var(--graphite); font-size: 0.78rem !important; }
.cta-note { margin-top: 18px; color: var(--ink); font-size: 0.95rem; font-weight: 500; }
.ephemeral {
  max-width: 60ch;
  margin-top: 10px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
  color: var(--graphite);
  font-size: 0.84rem !important;
  line-height: 1.5 !important;
}

.sample {
  position: relative;
  margin-top: clamp(40px, 6vw, 64px);
  padding: 30px 26px 26px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  border: 1px solid rgba(17, 17, 17, 0.1);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 30px 60px -44px rgba(17, 17, 17, 0.45);
}
.sample figcaption {
  position: absolute;
  top: -9px;
  left: 22px;
  padding: 0 8px;
  background: var(--paper);
  color: var(--graphite);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.sample .msg { animation: none; }
.sample .prose { font-size: 0.96rem; }

/* ---------- account ---------- */
.account { position: relative; }
.avatar-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--paper-hi), 0 4px 10px -6px rgba(17, 17, 17, 0.6);
  color: var(--paper);
  cursor: pointer;
  font: 600 0.8rem/1 "Avenir Next", Avenir, "Helvetica Neue", Arial, sans-serif;
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.avatar-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 230px;
  padding: 8px;
  border: 1px solid rgba(17, 17, 17, 0.1);
  border-radius: 14px;
  background: var(--paper-hi);
  box-shadow: var(--lift-hover);
}
.account-name, .account-credits { padding: 6px 10px 0; }
.account-name { font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
.account-credits { padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--soft); color: var(--graphite); font-size: 0.8rem; }
.account-menu button {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  cursor: pointer;
  font: 0.9rem "Avenir Next", Avenir, "Helvetica Neue", Arial, sans-serif;
  text-align: left;
}
.account-menu button:hover, .account-menu button:focus-visible { background: var(--accent-soft); outline: none; }

/* ---------- access dialog ---------- */
.access-google { margin-top: 18px; }
.access-or {
  margin: 18px 0 4px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--graphite);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
}
.access-or::before, .access-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.access-key label { display: block; margin-top: 12px; font-size: 0.86rem; font-weight: 600; }
.access-key input { margin-top: 8px; }
.access-error { color: #8a3420 !important; font-size: 0.84rem !important; }
.access-dialog.key-only .access-google, .access-dialog.key-only .access-or { display: none; }
#credits-note:empty { display: none; }

/* ---------- legal ---------- */
.legal-links { margin-top: 28px; text-align: center; font-size: 0.82rem; }
.legal-links a, .coach-footer a { color: var(--graphite); text-underline-offset: 0.18em; }
.legal-links a:hover, .coach-footer a:hover { color: var(--ink); }
.legal { max-width: 680px; padding-bottom: 40px; }
.legal h1 {
  margin-top: 10px;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}
.legal h2 { margin-top: 34px; font-family: var(--serif); font-size: 1.45rem; font-weight: 400; letter-spacing: -0.01em; }
.legal p, .legal li { color: var(--ink); font-size: 1rem; line-height: 1.65; text-wrap: pretty; }
.legal p { margin-top: 12px; }
.legal ul { margin-top: 10px; padding-left: 1.3em; }
.legal li + li { margin-top: 6px; }
.legal a { text-decoration-color: var(--accent); text-underline-offset: 0.16em; }
.legal-date { color: var(--graphite) !important; font-size: 0.86rem !important; }
.coach-footer { gap: 8px; font-size: 0.82rem; }

/* ---------- verdict scale ---------- */
.verdict {
  margin-top: 1.4em !important;
  padding-top: 1em;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.verdict-label {
  margin-right: 2px;
  color: var(--graphite);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.verdict-chip {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--graphite);
  font-size: 0.84rem;
  line-height: 1.3;
}
.verdict-chip.is-chosen {
  border: 1.5px solid var(--ink);
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 650;
}
