@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/IBMPlexSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Serif";
  src: url("/fonts/IBMPlexSerif-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #eef1f3;
  --surface: #ffffff;
  --ink: #14181d;
  --steel: #47525c;
  --line: #d3dade;
  --temper-blue: #245e8c;
  --temper-blue-strong: #1a4666;
  --straw: #b8862b;
  --oxide: #8a3a2b;
  --shadow-soft: 0 1px 2px rgba(20, 24, 29, 0.06);
  --page-width: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

a {
  color: var(--temper-blue);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--temper-blue-strong);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--ink);
  font-family: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2.55rem, 5.8vw, 4.7rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 16px;
  font-size: 2rem;
  line-height: 1.08;
}

code,
pre,
.header-meta,
.snapshot-meta,
.markdown-file-path,
.version-line,
.contact-token {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.page-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

.site-header,
.site-footer,
.self-serve-main,
.chat-main,
.composer {
  width: min(var(--page-width), calc(100vw - 40px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 0 18px;
}

.wordmark {
  color: var(--ink);
  font-family: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
}

.header-meta {
  margin: 0;
  color: var(--steel);
  font-size: 0.86rem;
  line-height: 1.4;
  text-align: right;
}

#commitShort {
  color: var(--straw);
}

.seam {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, #b8862b 0%, #9a6a35 30%, #6b4a6e 60%, #245e8c 100%);
}

.self-serve-main {
  padding: clamp(38px, 6vw, 68px) 0 46px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 430px);
  gap: clamp(26px, 6vw, 72px);
  align-items: end;
  margin-bottom: 30px;
}

.hero-title {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--steel);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy {
  color: var(--steel);
  font-size: 1.05rem;
  line-height: 1.64;
}

.hero-copy p {
  margin-bottom: 1rem;
}

.hero-copy p:last-child {
  margin-bottom: 0;
}

.status-copy {
  color: var(--ink);
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 26px;
}

.option-card {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.option-card h2 {
  margin-bottom: 0;
  font-size: 1.55rem;
}

.option-card p,
.option-card ol {
  margin: 0;
  color: var(--steel);
  line-height: 1.56;
}

.option-card ol {
  display: grid;
  gap: 8px;
  padding-left: 1.25rem;
}

.option-card li::marker {
  color: var(--straw);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.snapshot-meta {
  color: var(--straw) !important;
  font-size: 0.9rem;
  line-height: 1.45 !important;
}

.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.primary-action {
  background: var(--temper-blue);
  color: #ffffff;
}

.primary-action:hover {
  background: var(--temper-blue-strong);
  color: #ffffff;
}

.secondary-action {
  border-color: var(--temper-blue);
  background: transparent;
  color: var(--temper-blue);
}

.secondary-action:hover {
  border-color: var(--temper-blue-strong);
  background: #e4eaee;
  color: var(--temper-blue-strong);
}

.copy-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.copy-confirmation {
  min-height: 1.3em;
  color: var(--temper-blue-strong);
  font-weight: 600;
}

.drift-note {
  color: var(--oxide) !important;
  font-size: 0.95rem;
}

.exposition-section {
  margin-top: clamp(46px, 7vw, 78px);
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.exposition-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.exposition-heading h2 {
  margin-bottom: 0;
  font-size: clamp(2.2rem, 5vw, 4rem);
}

.exposition-reader {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 0;
  align-items: start;
}

.exposition-toc {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  min-width: 0;
  overflow-y: auto;
  padding-right: clamp(6px, 1vw, 12px);
  scrollbar-gutter: stable;
  color: var(--steel);
}

.toc-details {
  border: 0;
}

.toc-details summary {
  min-height: 44px;
  align-items: center;
  color: var(--ink);
  font-weight: 600;
  list-style: none;
}

.toc-details summary::-webkit-details-marker {
  display: none;
}

.toc-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc-child-list {
  gap: 0;
  padding-left: 18px;
}

.toc-placeholder {
  color: var(--steel);
  font-size: 0.92rem;
}

.toc-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  min-width: 0;
}

.toc-toggle,
.toc-toggle-spacer {
  width: 18px;
  min-height: 36px;
}

.toc-toggle-spacer {
  display: grid;
  place-items: center;
  color: var(--steel);
}

.toc-toggle-spacer::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.55;
}

.toc-toggle {
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--steel);
}

.toc-toggle::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid currentColor;
  transform: rotate(90deg);
  transition: transform 160ms ease;
}

.toc-toggle:hover,
.toc-toggle:focus-visible {
  color: var(--ink);
}

.toc-collapsed > .toc-row .toc-toggle::before {
  transform: rotate(0deg);
}

.toc-collapsed > .toc-child-list {
  display: none;
}

.toc-list a {
  position: relative;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-height: 36px;
  min-width: 0;
  padding: 5px 0;
  color: var(--steel);
  font-size: 0.92rem;
  line-height: 1.25;
  text-decoration: none;
}

.toc-list a:hover,
.toc-list a.active {
  color: var(--ink);
}

.toc-list a span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.toc-arrow {
  width: 10px;
  height: 10px;
  color: var(--steel);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toc-list a.active .toc-arrow {
  opacity: 1;
  transform: translateX(0);
}

.toc-depth-3 a {
  font-size: 0.86rem;
}

.markdown-body {
  position: relative;
  min-width: 0;
  padding-left: 28px;
  color: #27313a;
  font-size: 1.0625rem;
  line-height: 1.65;
}

.markdown-body::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: linear-gradient(
    180deg,
    #b8862b 0,
    #9a6a35 36px,
    #6b4a6e 78px,
    #245e8c 120px,
    var(--line) 168px,
    var(--line) 100%
  );
}

.markdown-status {
  color: var(--steel);
}

.markdown-file {
  padding: 24px 0 34px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 22px;
}

.markdown-file:first-child {
  border-top: 0;
  padding-top: 0;
}

.markdown-file > :not(.markdown-table-scroll) {
  max-width: 72ch;
}

.markdown-file-path {
  margin-bottom: 16px;
  color: var(--straw);
  font-size: 0.82rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  position: relative;
  margin: 1.35em 0 0.45em;
  line-height: 1.14;
  scroll-margin-top: 22px;
}

.markdown-body h1 {
  font-size: clamp(2.1rem, 4vw, 3rem);
}

.markdown-body h2 {
  font-size: 2rem;
}

.markdown-body h3 {
  font-size: 1.42rem;
}

.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  font-size: 1.12rem;
}

.heading-anchor {
  margin-left: 0.35em;
  color: var(--temper-blue);
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.72em;
  opacity: 0;
  text-decoration: none;
}

.markdown-body h1:hover .heading-anchor,
.markdown-body h2:hover .heading-anchor,
.markdown-body h3:hover .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 1;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote,
.markdown-body pre,
.markdown-body table,
.markdown-table-scroll,
.markdown-body hr {
  margin: 0 0 1rem;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.45rem;
}

.markdown-body li + li {
  margin-top: 0.35rem;
}

.markdown-body blockquote {
  padding-left: 1rem;
  border-left: 3px solid var(--temper-blue);
  color: var(--steel);
}

.markdown-body code,
.option-card code,
.drift-note code {
  padding: 0.08rem 0.25rem;
  border-radius: 4px;
  background: #e3e8eb;
  font-size: 0.92em;
}

.markdown-body pre {
  overflow-x: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  tab-size: 2;
}

.markdown-body pre code {
  display: block;
  padding: 0;
  background: transparent;
  white-space: pre;
}

.markdown-body table {
  width: 100%;
  max-width: 68rem;
  border-collapse: collapse;
  table-layout: auto;
  overflow-wrap: anywhere;
}

.markdown-table-scroll {
  --table-max-width: 68rem;
  position: relative;
  z-index: 1;
  width: min(100%, var(--table-max-width));
  max-width: 100%;
  min-width: 0;
  padding-right: 1px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.markdown-table-scroll table {
  width: max-content;
  min-width: 100%;
  max-width: var(--table-max-width);
  margin: 0;
}

.markdown-body th,
.markdown-body td {
  min-width: 10rem;
  max-width: 24rem;
  padding: 10px 12px;
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
  text-align: left;
  vertical-align: top;
  word-break: normal;
}

.markdown-body th {
  background: #e4eaee;
  color: var(--ink);
}

.markdown-body hr {
  border: 0;
  border-top: 1px solid var(--line);
}

.markdown-body img {
  max-width: 100%;
  height: auto;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 0 0 22px;
  color: var(--steel);
  font-size: 0.86rem;
}

.privacy-page {
  width: min(760px, calc(100vw - 40px));
  margin: 48px auto;
}

.privacy-page h1 {
  font-size: clamp(2.4rem, 7vw, 4.4rem);
}

.privacy-page .seam {
  margin: 18px 0 26px;
}

.version-line,
.contact-token {
  color: var(--straw);
}

.chat-main {
  min-height: 0;
  display: grid;
  padding: 20px 0;
}

.session-chip {
  display: grid;
  gap: 4px;
  max-width: 360px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--steel);
  font-size: 0.82rem;
  box-shadow: var(--shadow-soft);
}

#sessionIdText {
  color: var(--ink);
  font-weight: 600;
}

.consent-panel {
  align-self: center;
  justify-self: center;
  width: min(680px, 100%);
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.consent-copy {
  color: var(--steel);
  font-size: 1rem;
  line-height: 1.62;
}

.consent-copy h2 {
  color: var(--ink);
}

.consent-copy h1 {
  margin-bottom: 18px;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
}

.turnstile-box {
  min-height: 70px;
  margin: 18px 0;
}

.primary-button,
.send-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--temper-blue);
  color: white;
  font-weight: 600;
}

.primary-button {
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
}

.send-button {
  align-self: end;
  min-width: 88px;
  min-height: 46px;
  padding: 0 18px;
}

.primary-button:hover,
.send-button:hover {
  background: var(--temper-blue-strong);
}

.primary-button:disabled,
.send-button:disabled {
  opacity: 0.52;
}

.config-warning {
  color: var(--oxide);
  font-weight: 600;
}

.messages {
  min-height: 0;
  max-height: calc(100vh - 264px);
  overflow-y: auto;
  padding: 8px 0 24px;
}

.empty-state {
  margin: 16px 0;
  color: var(--steel);
  font-family: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  font-size: 1.3rem;
}

.message {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 18px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.message-label {
  color: var(--steel);
  font-size: 0.82rem;
  font-weight: 600;
}

.message-body {
  max-width: 74ch;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

.message.notice .message-body {
  color: var(--oxide);
  font-weight: 600;
}

.composer {
  position: sticky;
  bottom: 0;
  padding-bottom: 16px;
  background: linear-gradient(180deg, rgba(238, 241, 243, 0), var(--paper) 24px);
}

.scope-banner {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #e4eaee;
  color: var(--steel);
  font-size: 0.92rem;
  line-height: 1.45;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: var(--surface);
}

textarea {
  width: 100%;
  max-height: 160px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 12px 10px;
  color: var(--ink);
  line-height: 1.45;
}

textarea::placeholder {
  color: #6f7b85;
}

.noscript {
  padding: 12px;
  background: #fff3cd;
  color: #4d3a00;
  text-align: center;
}

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

.hidden {
  display: none !important;
}

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

  .toc-arrow,
  .toc-toggle::before {
    transition: none;
  }
}

@media (min-width: 901px) {
  .toc-details summary {
    display: none;
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .exposition-reader {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .exposition-toc {
    position: static;
    max-height: none;
    overflow-y: visible;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
  }

  .toc-details summary {
    display: flex;
    padding: 0 14px;
  }

  .toc-details > .toc-list {
    padding: 0 14px 12px;
  }
}

@media (max-width: 720px) {
  .site-header {
    align-items: start;
    flex-direction: column;
    gap: 10px;
  }

  .header-meta {
    text-align: left;
  }

  .option-grid {
    grid-template-columns: 1fr;
  }

  .action-link,
  .copy-row .action-link {
    width: 100%;
  }

  .exposition-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .session-chip {
    width: 100%;
    max-width: none;
  }

  .messages {
    max-height: calc(100vh - 310px);
  }

  .message {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .send-button {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .site-header,
  .site-footer,
  .self-serve-main,
  .chat-main,
  .composer,
  .privacy-page {
    width: min(100% - 24px, var(--page-width));
  }

  .option-card {
    padding: 18px;
  }

  .markdown-body {
    padding-left: 18px;
    font-size: 1rem;
  }

  .markdown-table-scroll {
    --table-max-width: 100%;
  }
}
