:root {
  --cream: #f7f1e6;
  --paper: #fffcf6;
  --ink: #1f2a2e;
  --ink-soft: #5a6468;
  --line: #e0d7c6;
  --amber: #e2a44f;
  --river: #17303a;
  --river-mid: #2d5f73;
  --river-light: #9fc4cf;
  --huckleberry: #6d2c5f;
  --error: #a4321f;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

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

body {
  background: var(--cream);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; }
h2 { font-size: clamp(27px, 4vw, 38px); margin: 0 0 14px; }

a { color: var(--huckleberry); }

img { max-width: 100%; }

:focus-visible { outline: 2px solid var(--huckleberry); outline-offset: 2px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.button {
  background: var(--river);
  border: 0;
  border-radius: 8px;
  color: var(--cream);
  cursor: pointer;
  display: inline-block;
  font: 600 15px var(--sans);
  padding: 11px 18px;
  text-decoration: none;
}
.button:hover { background: var(--river-mid); }
.button:disabled { cursor: default; opacity: .5; }
.button.ghost { background: none; border: 1px solid var(--river); color: var(--river); }
.button.ghost:hover { background: var(--river); color: var(--cream); }

.link-button {
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}

.form-error { color: var(--error); font-size: 14px; margin: 8px 0 0; }

.eyebrow {
  color: var(--amber);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .1em;
  margin: 0 0 10px;
  text-transform: uppercase;
}
.eyebrow.dark { color: var(--river-mid); }

.river { display: block; height: 70px; width: 100%; }
.river.flip { transform: scaleY(-1); }

/* Top bar */
.topbar {
  align-items: center;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  padding: 10px 20px;
}
.brand {
  align-items: center;
  color: var(--ink);
  display: flex;
  font: 600 20px var(--serif);
  gap: 8px;
  text-decoration: none;
}
.tabs { display: flex; gap: 4px; }
.tabs a {
  border-radius: 6px;
  color: var(--ink-soft);
  font-size: 15px;
  padding: 5px 10px;
  text-decoration: none;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: #dfeaec; color: var(--ink); font-weight: 600; }

/* Hero */
.hero { background: var(--river); color: var(--cream); position: relative; }
.hero-photo {
  display: block;
  height: min(74vh, 620px);
  min-height: 420px;
  object-fit: cover;
  object-position: center 58%;
  width: 100%;
}
.hero::before {
  background: linear-gradient(180deg, rgba(23, 48, 58, .1) 0%, rgba(23, 48, 58, .78) 92%);
  content: "";
  height: min(74vh, 620px);
  left: 0;
  min-height: 420px;
  position: absolute;
  right: 0;
  top: 0;
}
.hero-text {
  bottom: 96px;
  left: max(20px, calc((100% - 1040px) / 2));
  max-width: 660px;
  padding-right: 20px;
  position: absolute;
}
.hero-text .eyebrow { color: #f3c583; }
.hero h1 { font-size: clamp(42px, 8vw, 76px); margin: 0 0 14px; }
.hero-copy { font-size: 19px; margin: 0; }
.hero > .river { bottom: -1px; left: 0; position: absolute; transform: scaleY(1); }

/* About sections */
.about { overflow: hidden; }
.about section { padding-left: 20px; padding-right: 20px; }
.band {
  align-items: center;
  display: grid;
  gap: 52px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin: 0 auto;
  max-width: 1080px;
  padding-bottom: 44px;
  padding-top: 64px;
}
.band figure { margin: 0; }
.band img { border-radius: 10px; display: block; width: 100%; }
figcaption { color: var(--ink-soft); font: italic 15px var(--serif); margin-top: 8px; }

.captain {
  font: 21px/1.55 var(--serif);
  margin: 0 auto;
  max-width: 760px;
  padding-bottom: 56px;
  padding-top: 32px;
  text-align: center;
}

.cafes-wrap, .people-wrap, .timeline-wrap {
  margin: 0 auto;
  max-width: 1120px;
  padding-bottom: 60px;
  padding-top: 40px;
}
.cafes { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 20px; }
.cafe {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
}
.cafe h3 { font-size: 22px; margin: 8px 0 0; }
.cafe p { font-size: 15px; margin: 6px 0 0; }
.cafe .where { color: var(--river-mid); font-weight: 600; margin-top: 0; }
.cafe .manager { color: var(--ink-soft); font-size: 13px; margin-top: 10px; }
.moon { height: 26px; width: 26px; }
.moon-disc { fill: #e7e0d0; stroke: var(--river); stroke-width: 1; }
.moon-lit { fill: var(--amber); stroke: var(--river); stroke-width: 1; }

.river-band { background: var(--river); color: var(--cream); padding: 0 !important; }
.river-band .river { background: var(--cream); }
.river-copy { margin: 0 auto; max-width: 760px; padding: 44px 20px; text-align: center; }

.people { display: grid; gap: 20px 40px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin: 20px 0 0; }
.people dt { font: 600 20px var(--serif); }
.people dd { color: var(--ink-soft); font-size: 15px; margin: 2px 0 0; }

.timeline { border-left: 2px solid var(--river-light); list-style: none; margin: 18px 0 0; max-width: 680px; padding: 0 0 0 20px; }
.timeline li { margin-bottom: 12px; position: relative; }
.timeline li::before {
  background: var(--amber);
  border-radius: 50%;
  content: "";
  height: 10px;
  left: -26px;
  position: absolute;
  top: 9px;
  width: 10px;
}
.timeline b { color: var(--river-mid); display: inline-block; font-family: var(--serif); margin-right: 8px; }

.handbook-cta { margin: 0 auto; max-width: 620px; padding-bottom: 60px; padding-top: 30px; text-align: center; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }

.fine-print {
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
  margin: 0 auto;
  max-width: 720px;
  padding-bottom: 36px;
  padding-top: 26px;
}
.fine-print h2 { font-size: 16px; margin-bottom: 8px; }
.fine-print p { margin: 0 0 10px; }
.credits { font-size: 12px; }

.site-footer .river { background: var(--cream); }
.footer-body {
  background: var(--river);
  color: #c9d7da;
  font-size: 14px;
  padding: 8px 16px 26px;
  text-align: center;
}
.footer-body p { margin: 6px 0 0; }
.footer-motto { color: var(--cream); font: italic 20px var(--serif); }
.fine { font-size: 12px; }
.fine a { color: #c9d7da; }

/* Handbook */
.handbook {
  display: grid;
  gap: 48px;
  grid-template-columns: 240px minmax(0, 680px);
  justify-content: center;
  padding: 36px 20px 60px;
}
.toc { align-self: start; max-height: calc(100vh - 40px); overflow-y: auto; position: sticky; top: 20px; }
.toc h2 { color: var(--river-mid); font-size: 19px; margin: 0 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a {
  border-radius: 4px;
  color: var(--ink);
  display: block;
  font-size: 14px;
  padding: 3px 6px;
  text-decoration: none;
}
.toc a:hover { background: #e3edef; }
.prose h1 {
  border-top: 1px solid var(--line);
  font-size: 28px;
  margin: 38px 0 12px;
  padding-top: 30px;
}
.prose h1:first-child { border-top: 0; font-size: 38px; margin-top: 0; padding-top: 0; }
.prose h1:target { color: var(--huckleberry); }
.prose p { margin: 0 0 14px; }

/* Ask */
.ask-page { display: flex; flex-direction: column; height: 100dvh; }
.ask { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.gate {
  align-items: center;
  background: var(--river);
  color: var(--cream);
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px 96px;
  position: relative;
  text-align: center;
}
.gate h1 { font-size: 38px; margin: 0 0 6px; }
.gate-copy { color: #c9d7da; margin: 0 0 22px; max-width: 420px; }
.gate-card {
  background: var(--paper);
  border-radius: 12px;
  color: var(--ink);
  max-width: 380px;
  padding: 24px;
  position: relative;
  text-align: left;
  width: 100%;
  z-index: 1;
}
.gate-card label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.gate-card input {
  background: #fff;
  border: 1px solid #a9b4b6;
  border-radius: 8px;
  color: var(--ink);
  font: 16px var(--sans);
  padding: 10px 12px;
  width: 100%;
}
.gate-card .button { margin-top: 16px; width: 100%; }
.gate-help { color: #c9d7da; font-size: 14px; margin: 18px 0 0; position: relative; z-index: 1; }
.gate-help a { color: #f3c583; }
.gate-river { bottom: 0; left: 0; opacity: .55; pointer-events: none; position: absolute; }

.chat { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.thread { flex: 1; overflow-y: auto; padding: 28px 16px 12px; }
.welcome { margin: 4vh auto 0; max-width: 620px; text-align: center; }
.welcome h1 { font-size: 34px; margin: 14px 0 8px; }
.welcome > p { color: var(--ink-soft); margin: 0 auto 24px; max-width: 460px; }
.suggestions { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; text-align: left; }
.suggestions button {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  font: 15px/1.35 var(--sans);
  padding: 13px 14px;
  text-align: left;
}
.suggestions button:hover { border-color: var(--river-mid); }

.message { margin: 0 auto 22px; max-width: 720px; }
.message.user {
  background: #dfeaec;
  border-radius: 14px 14px 4px 14px;
  margin-left: auto;
  margin-right: max(0px, calc((100% - 720px) / 2));
  max-width: min(80%, 560px);
  overflow-wrap: anywhere;
  padding: 9px 14px;
  white-space: pre-wrap;
  width: fit-content;
}
.answer p { margin: 0 0 10px; }
.answer ul { margin: 0 0 10px; padding-left: 22px; }
.answer li { margin-bottom: 4px; }
.answer li ul { margin: 4px 0 0; }
.answer > :last-child { margin-bottom: 0; }
.thinking { color: var(--ink-soft); font-style: italic; }
.thinking::after { animation: dots 1.4s steps(4) infinite; content: ""; }
@keyframes dots {
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}
@media (prefers-reduced-motion: reduce) {
  .thinking::after { animation: none; content: "..."; }
}

.sources {
  align-items: center;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 6px;
  margin-top: 12px;
}
.sources a {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  text-decoration: none;
}
.sources a:hover { border-color: var(--huckleberry); }

.composer { background: var(--cream); padding: 6px 16px 10px; }
.composer-box {
  align-items: flex-end;
  background: var(--paper);
  border: 1px solid #c3ccce;
  border-radius: 12px;
  display: flex;
  gap: 8px;
  margin: 0 auto;
  max-width: 720px;
  padding: 7px 7px 7px 14px;
}
.composer-box:focus-within { border-color: var(--river-mid); }
.composer textarea {
  background: none;
  border: 0;
  color: var(--ink);
  flex: 1;
  font: 16px/1.5 var(--sans);
  max-height: 160px;
  outline: 0;
  padding: 6px 0;
  resize: none;
}
.send { padding: 8px 16px; }
.fine-line { color: var(--ink-soft); font-size: 12px; margin: 7px 0 0; text-align: center; }

@media (max-width: 820px) {
  .band { gap: 24px; grid-template-columns: 1fr; padding-top: 44px; }
  .band.reverse figure { order: 2; }
  .handbook { display: block; padding-top: 20px; }
  .toc { margin-bottom: 28px; max-height: none; position: static; }
  .toc ol { columns: 2; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .topbar { gap: 10px; padding: 8px 12px; }
  .suggestions { grid-template-columns: 1fr; }
  .welcome { margin-top: 2vh; }
  .welcome h1 { font-size: 28px; }
  .hero-text { bottom: 76px; }
  .river { height: 46px; }
  .gate { padding-bottom: 70px; }
}
