/* chatlog — minimal, information-dense, no shadows, no cards.
   Claude orange is the sole accent; everything else is greyscale.

   The page follows the system setting, and the theme toggle overrides it. The
   [data-theme] rules therefore come last and carry both directions, so an
   explicit choice of light wins on a dark-set machine as readily as the
   reverse. */

:root {
  --page-background: #faf9f7;
  --raised-background: #f2f0ec;
  --sunken-background: #ebe8e3;
  --primary-text: #1c1b1a;
  --secondary-text: #5f5c58;
  --muted-text: #8a857e;
  --hairline: #ddd9d2;
  --accent: #d97757;
  --accent-quiet: #a9543a;
  --error: #9a3b32;

  --reading-width: 46rem;
  --page-width: 62rem;
  --line-height: 1.5;
  --gutter: 1rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page-background: #171513;
    --raised-background: #201d1a;
    --sunken-background: #262220;
    --primary-text: #e8e4df;
    --secondary-text: #a8a29a;
    --muted-text: #837d75;
    --hairline: #332e2a;
    --accent: #e08c6d;
    --accent-quiet: #c4735a;
    --error: #e39a92;
  }
}

:root[data-theme="dark"] {
  --page-background: #171513;
  --raised-background: #201d1a;
  --sunken-background: #262220;
  --primary-text: #e8e4df;
  --secondary-text: #a8a29a;
  --muted-text: #837d75;
  --hairline: #332e2a;
  --accent: #e08c6d;
  --accent-quiet: #c4735a;
  --error: #e39a92;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  padding: 0.2rem;
  border: 1px solid transparent;
  background: none;
  color: var(--muted-text);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--accent);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0 auto;
  padding: 0 var(--gutter) 4rem;
  max-width: var(--page-width);
  background: var(--page-background);
  color: var(--primary-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: var(--line-height);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
}

/* --- chrome ------------------------------------------------------------- */

.top-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0.75rem 0 0.85rem;
  background: var(--page-background);
  border-bottom: 1px solid var(--hairline);
}

.top-bar h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.control-label {
  color: var(--muted-text);
  font-size: 0.8rem;
}

input[type="search"],
select {
  padding: 0.3rem 0.45rem;
  background: var(--raised-background);
  color: var(--primary-text);
  border: 1px solid var(--hairline);
  border-radius: 0;
  font: inherit;
  font-size: 0.9rem;
}

input[type="search"] {
  flex: 1 1 14rem;
  min-width: 8rem;
}

input[type="search"]:focus,
select:focus {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.count-line,
.filter-summary,
.outside-filter-note {
  margin: 0.4rem 0 0;
  color: var(--muted-text);
  font-size: 0.8rem;
}

.filter-summary strong {
  color: var(--accent);
  font-weight: 600;
}

.outside-filter-note {
  color: var(--error);
}

/* --- tag filter --------------------------------------------------------- */

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

/* Names the row without competing with it: the chips are the control, this is
   only the word for what they do. */
.tag-filter-label {
  margin-right: 0.15rem;
  color: var(--muted-text);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.tag-option {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--hairline);
  background: var(--raised-background);
  color: var(--secondary-text);
  font-size: 0.8rem;
  cursor: pointer;
  user-select: none;
}

.tag-option:hover {
  border-color: var(--accent-quiet);
}

/* The checkbox itself is redundant once the chip reflects its own state. */
.tag-checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* On a transcript the row reports the filter rather than offering it, so a tag
   you have not selected is greyed and inert. The checkbox carries `disabled`
   as well, which is what takes it out of the tab order. */
.tag-option:has(.tag-checkbox:disabled) {
  border-color: var(--hairline);
  background: none;
  color: var(--hairline);
  cursor: default;
}

.tag-option:has(.tag-checkbox:disabled) .tag-count {
  color: var(--hairline);
}

.tag-option:has(.tag-checkbox:disabled):hover {
  border-color: var(--hairline);
}

.tag-option:has(.tag-checkbox:checked) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--sunken-background);
}

.tag-option:has(.tag-checkbox:focus-visible) {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

.tag-count {
  color: var(--muted-text);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
}

.clear-tags {
  padding: 0.15rem 0.45rem;
  border: 1px solid transparent;
  background: none;
  color: var(--muted-text);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.clear-tags:hover {
  color: var(--accent);
}

/* --- homepage list ------------------------------------------------------ */

/* One grid for the whole list rather than a flex row per conversation, so
   every preview truncates at the same x: the tag column is measured once,
   against the widest row, instead of per row. Rows therefore contribute their
   two cells directly, and the hairline rides on the cells. */
.conversation-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* One flex row per conversation, so each excerpt takes whatever space its own
   tags leave rather than every row truncating at a shared x — and so the
   hairline runs the full width in one piece. */
.conversation-row {
  display: flex;
  gap: var(--gutter);
  justify-content: space-between;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--hairline);
}

.conversation-link {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  color: inherit;
}

.conversation-link:hover {
  text-decoration: none;
}

.conversation-link:hover .conversation-preview {
  color: var(--accent);
}

/* `pre` rather than `nowrap`, so that the run of spaces standing in for a line
   break survives to be seen. */
.conversation-preview {
  display: block;
  min-width: 0;
  color: var(--muted-text);
  font-size: 0.85rem;
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-meta {
  display: flex;
  flex: 0 0 auto;
  gap: 0.5rem;
  align-items: baseline;
  color: var(--muted-text);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

/* Tags are the main navigation signal, so they read as the accent colour
   rather than as more grey metadata. */
.tag-strip {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.tag {
  padding: 0 0.3rem;
  border: 1px solid var(--hairline);
  color: var(--accent);
  font-size: 0.75rem;
  white-space: nowrap;
}

.empty-note {
  margin: 1.5rem 0;
  color: var(--muted-text);
  font-style: italic;
}

.page-footer,
.bottom-bar {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  margin-top: 2rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.8rem;
}

/* Carries the weight of a row's tag, not of a button: it is one more thing you
   can reach for, not the point of the page. */
.raw-export-link {
  padding: 0 0.3rem;
  border: 1px solid var(--hairline);
  color: var(--accent);
  font-size: 0.75rem;
}

.raw-export-link:hover {
  border-color: var(--accent-quiet);
}

.raw-export-link:hover {
  color: var(--accent);
}

.raw-export-size {
  color: var(--muted-text);
  font-variant-numeric: tabular-nums;
}

/* --- transcript navigation ---------------------------------------------- */

/* Spread across the page: back on the left, forward on the right, where a hand
   already expects them, with the way out in the middle. */
.transcript-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.transcript-nav .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.nav-middle {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
}

.nav-link {
  color: var(--accent);
}

.nav-disabled {
  color: var(--hairline);
  cursor: default;
}

.nav-disabled:hover {
  text-decoration: none;
}

.nav-position {
  color: var(--muted-text);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.transcript-title {
  margin: 0.5rem 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary-text);
}

/* Everything about *this* conversation sits below the header's rule: the
   header itself is identical to the index's — same title, same toggle, same
   chips at the same y — so following a link never jogs the filter you are
   pointing at. */
.transcript-heading {
  margin-top: 0.5rem;
}

.site-name {
  color: inherit;
}

.site-name:hover {
  text-decoration: none;
  color: var(--accent-quiet);
}

.transcript-summary {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: baseline;
  margin: 0.35rem 0 0;
  color: var(--muted-text);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

/* --- messages ----------------------------------------------------------- */

.transcript {
  padding-top: 0.5rem;
}

.message {
  padding: 0.6rem 0 0.6rem 0.75rem;
  border-left: 2px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

/* The interface's own turns read like the person's: the sender name is what
   says who spoke, and styling the words themselves as lesser would editorialise
   text that is quoted evidence. */
.message-human,
.message-interface {
  border-left-color: var(--accent);
  background: var(--raised-background);
}

.message-head {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  margin-bottom: 0.25rem;
  color: var(--muted-text);
  font-size: 0.72rem;
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

.message-sender {
  font-weight: 600;
  color: var(--secondary-text);
}

.message-body {
  max-width: var(--reading-width);
}

.message-body > * + * {
  margin-top: 0.5rem;
}

.message-body p,
.message-body ul,
.message-body ol,
.message-body blockquote {
  margin: 0 0 0.5rem;
}

.message-body > :last-child {
  margin-bottom: 0;
}

.message-body h1,
.message-body h2,
.message-body h3,
.message-body h4,
.message-body h5,
.message-body h6 {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--secondary-text);
}

.message-body ul,
.message-body ol {
  padding-left: 1.3rem;
}

.message-body blockquote {
  padding-left: 0.7rem;
  border-left: 2px solid var(--hairline);
  color: var(--secondary-text);
}

.message-body hr {
  height: 0;
  margin: 0.75rem 0;
  border: 0;
  border-top: 1px solid var(--hairline);
}

.message-body code {
  padding: 0 0.2em;
  background: var(--sunken-background);
}

.message-body pre {
  margin: 0.5rem 0;
  padding: 0.5rem 0.6rem;
  background: var(--sunken-background);
  border: 1px solid var(--hairline);
  overflow-x: auto;
}

.message-body pre code {
  padding: 0;
  background: none;
}

/* --- thinking, tools ---------------------------------------------------- */

.block-thinking,
.block-tool {
  margin: 0.4rem 0;
  border-left: 2px solid var(--hairline);
  padding-left: 0.6rem;
}

.block-thinking > summary,
.block-tool > summary {
  color: var(--muted-text);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.block-thinking > summary {
  font-style: italic;
}

.thinking-body {
  color: var(--secondary-text);
  font-style: italic;
}


.thinking-summary {
  margin: 0.15rem 0 0;
}

.tool-role {
  color: var(--accent-quiet);
  font-weight: 600;
}

.block-tool-error {
  border-left-color: var(--error);
}

.tool-error-marker {
  margin-left: 0.4rem;
  padding: 0 0.25rem;
  border: 1px solid var(--error);
  color: var(--error);
  font-size: 0.7rem;
}


@media (max-width: 40rem) {
  .conversation-row {
    flex-wrap: wrap;
  }

  .conversation-link {
    flex-wrap: wrap;
  }
}
