@font-face {
  font-family: "Literata"; src: url("vendor/fonts/literata-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Literata"; src: url("vendor/fonts/literata-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 900; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Instrument Sans"; src: url("vendor/fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
}

:root {
  --ground: #e8eef0;
  --surface: #f7fafa;
  --ink: #16323b;
  --ink-soft: #55707a;
  --line: #c3d2d7;
  --pine: #1f5a66;
  --marker: #f2c230;
  --marker-ink: #16323b;
  --you: #d6e4e7;
  --bar-rest: #a9c0c7;
  --serif: "Literata", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #13242a;
    --surface: #1a2e35;
    --ink: #e2ecee;
    --ink-soft: #94adb5;
    --line: #304a53;
    --pine: #7cc0cd;
    --marker: #f2c230;
    --marker-ink: #13242a;
    --you: #24404a;
    --bar-rest: #456570;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 16px/1.5 var(--sans);
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--pine); outline-offset: 2px; }

/* Password gate */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.gate-form { width: min(100%, 340px); }
.gate-form h1 { font: 500 2.75rem/1.1 var(--serif); margin: 0 0 32px; letter-spacing: -0.01em; }
.gate-form label { display: block; color: var(--ink-soft); margin-bottom: 6px; }
.gate-form input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--ink-soft); border-radius: 3px;
  background: var(--surface);
}
.gate-form button {
  margin-top: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 3px;
  background: var(--ink); color: var(--ground); font-weight: 600;
}
.gate-form button:disabled { opacity: .6; cursor: progress; }
.gate-error { min-height: 1.5em; margin: 12px 0 0; color: #b3261e; }
@media (prefers-color-scheme: dark) { .gate-error { color: #ffb4ab; } }

/* Top bar */
.bar {
  position: sticky; top: 0; z-index: 3;
  display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; align-items: stretch;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.arrow {
  background: none; border: 0; display: grid; place-items: center; min-height: 60px; color: var(--ink);
}
.arrow svg, .caret { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.arrow:hover:not(:disabled) { background: var(--you); }
.arrow:disabled { color: var(--line); cursor: default; }
.picker {
  min-width: 0; background: none; border: 0; border-inline: 1px solid var(--line);
  display: grid; grid-template-columns: minmax(0, 1fr) 24px; column-gap: 10px; align-items: center;
  text-align: left; padding: 8px 14px;
}
.picker:hover { background: var(--you); }
.picker-date { grid-column: 1; font-size: .8125rem; color: var(--ink-soft); }
.picker-title {
  grid-column: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.caret { grid-column: 2; grid-row: 1 / span 2; color: var(--ink-soft); transition: transform .15s; }
.picker[aria-expanded="true"] .caret { transform: rotate(180deg); }

/* Browse panel */
.panel {
  position: fixed; left: 0; right: 0; top: calc(61px + env(safe-area-inset-top, 0px)); z-index: 2;
  max-height: calc(100dvh - 61px - env(safe-area-inset-top, 0px));
  display: flex; flex-direction: column;
  background: var(--surface); border-bottom: 2px solid var(--ink);
}
.panel-top { display: flex; gap: 12px; align-items: center; padding: 12px 16px 4px; }
#search {
  flex: 1 1 auto; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 3px;
  background: var(--ground);
}
.position { color: var(--ink-soft); font-size: .875rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lock { background: none; border: 1px solid var(--line); border-radius: 3px; padding: 6px 12px; }
.lock:hover { background: var(--you); }

/* The month strip is a bar chart of the archive: taller means more chats. */
.months {
  display: flex; gap: 2px; align-items: flex-end; overflow-x: auto; padding: 12px 16px 8px;
  flex: none; scrollbar-width: thin;
}
.year-break { flex: none; width: 12px; }
.month {
  flex: 1 0 34px; max-width: 72px; background: none; border: 0; padding: 0;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 4px;
  height: 104px; color: var(--ink-soft); font-size: .75rem; line-height: 1.2; text-align: center;
}
.month-count { font-variant-numeric: tabular-nums; }
.month-bar { display: block; background: var(--bar-rest); min-height: 3px; }
.month-name { display: block; white-space: nowrap; }
.month:hover .month-bar { background: var(--pine); }
.month[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.month[aria-pressed="true"] .month-bar { background: var(--marker); }

.list { overflow-y: auto; padding: 4px 16px 16px; overscroll-behavior: contain; }
.list-month { font: 500 1.25rem/1.3 var(--serif); margin: 12px 0 6px; }
.day { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 0 8px; border-top: 1px solid var(--line); padding-block: 3px; }
.day-label { color: var(--ink-soft); font-size: .875rem; padding-top: 6px; font-variant-numeric: tabular-nums; }
.day-items { display: flex; flex-direction: column; }
.item {
  display: block; width: 100%; background: none; border: 0; text-align: left;
  padding: 5px 8px; border-radius: 2px; line-height: 1.35;
}
.item:hover { background: var(--you); }
.item[aria-current="true"] { background: var(--marker); color: var(--marker-ink); font-weight: 600; }
.empty { color: var(--ink-soft); padding: 16px 0; }

/* Reading column */
.reader { padding: 40px 16px 96px; outline: none; }
.reader > * { max-width: 44rem; margin-inline: auto; }
.chat-head { margin-bottom: 32px; }
.chat-date { color: var(--ink-soft); margin: 0 0 4px; }
.chat-title { font: 500 clamp(1.75rem, 5vw, 2.5rem)/1.15 var(--serif); margin: 0 0 8px; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.chat-link { color: var(--pine); font-size: .875rem; }
.status { color: var(--ink-soft); }

.msg { margin-bottom: 28px; overflow-wrap: anywhere; }
.msg-user {
  background: var(--you); padding: 12px 16px; border-radius: 3px;
}
.msg-time { display: block; color: var(--ink-soft); font-size: .75rem; margin-bottom: 4px; }
.msg-claude { font-family: var(--serif); line-height: 1.65; font-size: 1.0625rem; }
.msg > :first-child, .prose > :first-child { margin-top: 0; }
.msg > :last-child, .prose > :last-child { margin-bottom: 0; }
.prose + .prose, details + .prose { margin-top: 1em; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--sans); font-weight: 650; line-height: 1.25; margin: 1.5em 0 .5em; }
.prose h1 { font-size: 1.375rem; } .prose h2 { font-size: 1.25rem; } .prose h3 { font-size: 1.0625rem; } .prose h4 { font-size: 1rem; }
.prose a { color: var(--pine); }
.prose blockquote { margin: 1em 0; padding-left: 14px; border-left: 3px solid var(--line); color: var(--ink-soft); }
.prose code { font: .875em/1.4 var(--mono); background: var(--you); padding: .1em .3em; border-radius: 2px; }
.msg-user .prose code { background: var(--surface); }
.prose pre, .tool pre {
  font: .8125rem/1.5 var(--mono); background: var(--surface); border: 1px solid var(--line);
  padding: 12px; overflow-x: auto; border-radius: 3px; overflow-wrap: normal;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }
.table-wrap { overflow-x: auto; margin: 1em 0; }
.prose table { border-collapse: collapse; font: .9375rem/1.4 var(--sans); overflow-wrap: normal; }
.prose th, .prose td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface); }
.prose img { max-width: 100%; }
.math-block { overflow-x: auto; padding-block: .25em; }

.tool { font: .875rem/1.4 var(--sans); margin-block: 8px; color: var(--ink-soft); }
.tool summary { cursor: pointer; padding-block: 3px; width: fit-content; max-width: 100%; }
.tool-param { margin: 8px 0 2px; font-weight: 600; }
.tool pre { margin: 0; color: var(--ink); max-height: 420px; overflow: auto; }

/* Keeps the last message clear of the pager on narrow screens. */
.pager { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 40px; }
.pager button { background: none; border: 0; color: var(--pine); padding: 4px 0; text-align: left; max-width: 48%; }
.pager button:last-child { text-align: right; margin-left: auto; }
.pager small { display: block; color: var(--ink-soft); }

@media (max-width: 560px) {
  .bar { grid-template-columns: 48px minmax(0, 1fr) 48px; }
  .month { flex-basis: 30px; }
  .position { display: none; }
  .reader { padding-top: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
