/* Midden Labs — technical, minimal, liberal humanist
   Figtree (sans) for text; Fraunces (serif) for display.
   Both are loaded via <link> in each page's <head>. */

:root {
  --paper:  #f6f4ef;  /* warm off-white, like aged paper / sediment */
  --ink:    #1b1b1a;  /* near-black text */
  --muted:  #6b6862;  /* warm gray for secondary text */
  --line:   #e2ded4;  /* hairline rules */
  --accent: #7a4f2a;  /* earth / ochre, used sparingly */

  --measure: 38rem;   /* comfortable reading width */
  --step:    clamp(1.5rem, 1rem + 2vw, 2.5rem);

  --font-sans:  "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;
}

/* Display type: Fraunces, kept upright and un-wonky so it reads as a text
   serif rather than a novelty face. */
.wordmark,
.doc h1,
.quote__text {
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 0, "WONK" 0;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-optical-sizing: auto;
  font-weight: 400;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  line-height: 1.65;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── Layout ─────────────────────────────────────────── */

.page {
  max-width: var(--measure);
  margin-inline: auto;
  padding: clamp(3rem, 8vh, 7rem) clamp(1.5rem, 6vw, 3rem);
}

/* ── Masthead ───────────────────────────────────────── */

.masthead { margin-bottom: var(--step); }

.wordmark {
  font-size: clamp(1.6rem, 1.3rem + 1.6vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.1;
}

.tagline {
  color: var(--muted);
  max-width: 32rem;
  margin: 0.9rem 0 0;
  text-wrap: balance;
}

/* ── Hairline rule ──────────────────────────────────── */

.rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--step) 0;
}

/* ── Project list ───────────────────────────────────── */

.projects {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.25rem);
}

.project {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  column-gap: 1rem;
  row-gap: 0.25rem;
}

.project__name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.project__name:hover,
.project__name:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}

.project__state {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  white-space: nowrap;
}

.project__desc {
  grid-column: 1 / -1;
  color: var(--muted);
  margin: 0;
}

/* The progression that names the lab: Stated → Recorded → Preserved */
.lifecycle {
  margin: var(--step) 0 0;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.lifecycle b { color: var(--ink); font-weight: 600; }

/* ── Footer ─────────────────────────────────────────── */

.colophon {
  margin-top: var(--step);
  font-size: 0.9rem;
  color: var(--muted);
}

.social {
  margin-top: 0.75rem;
  display: flex;
  gap: 1.25rem;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

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

/* ── Interior (stub) pages ──────────────────────────── */

.back {
  display: inline-block;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--muted);
  margin-bottom: var(--step);
}
.back:hover { color: var(--accent); }

.doc h1 {
  font-size: clamp(1.8rem, 1.4rem + 1.8vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 0.25rem;
}

.doc__state {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin: 0 0 var(--step);
}

.doc p { max-width: 34rem; }

.doc .note {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Pull quote ─────────────────────────────────────── */

.quote {
  max-width: 34rem;
  margin: var(--step) 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--accent);
}

.quote__text {
  margin: 0;
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1.55;
  text-wrap: pretty;
}

.quote__text p { margin: 0; }

.quote__cite {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.quote__cite cite { font-style: italic; }

/* ── Definition list (e.g. DVG terms) ───────────────── */

.doc__terms {
  max-width: 34rem;
  margin: var(--step) 0;
  display: grid;
  gap: 0.4rem 0;
}

.doc__terms dt {
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--ink);
}

.doc__terms dd {
  margin: 0 0 0.9rem;
  padding-left: 1rem;
  border-left: 1px solid var(--line);
  color: var(--muted);
  text-wrap: pretty;
}

.doc__terms dd:last-of-type { margin-bottom: 0; }

.doc__example {
  display: block;
  width: fit-content;
  margin-top: 0.5rem;
  padding: 0.25rem 0.4rem;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.7em;
  color: var(--ink);
  background: #efece4;
  border: 1px solid var(--line);
  border-radius: 4px;
}

/* ── DVG conversation threads (expandable) ──────────── */

.threads {
  display: grid;
  gap: 0.75rem;
  max-width: 34rem;
  margin: var(--step) 0;
}

.thread {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf6;
}

.thread__summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
}

.thread__summary::-webkit-details-marker { display: none; }

.thread__summary::after {
  content: "+";
  grid-column: 3;
  align-self: center;
  color: var(--muted);
  font-weight: 400;
}
.thread[open] .thread__summary::after { content: "−"; }

.thread__summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.thread__term {
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--ink);
}

/* Collapsed: show only the first line, truncated. Expanded: show it all. */
.thread__lead {
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread[open] .thread__lead { white-space: normal; }

.thread__body {
  overflow: hidden;
  padding: 0 1.1rem;
  transition: height 0.25s ease;
}
.thread__body p { margin: 0 0 0.6rem; max-width: none; }
.thread__body > :first-child { margin-top: 0; }
.thread__body > :last-child { margin-bottom: 0.9rem; }

/* ── Conversations page ─────────────────────────────── */

/* Reading column stays mobile-friendly at the low end, then grows with the
   viewport to roughly double width on desktop for the transcripts. */
.conversations.page { max-width: clamp(38rem, 8rem + 55vw, 72rem); }
.conversations .threads { max-width: none; }

/* ── Conversation transcript (inside a thread body) ─── */

.conv .turn { margin-bottom: 0.9rem; }

/* Speaker label leads each turn; the colon-prefixed name is the first child. */
.conv .turn > strong:first-child { color: var(--accent); }

.conv code {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.85em;
  padding: 0.05em 0.3em;
  background: #efece4;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.conv__code {
  margin: 0.6rem 0 0.9rem;
  padding: 0.7rem 0.9rem;
  overflow-x: auto;
  background: #efece4;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.conv__code code {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.8em;
  line-height: 1.5;
  padding: 0;
  background: none;
  border: 0;
  white-space: pre;
}

.conv__list {
  margin: 0 0 0.9rem;
  padding-left: 1.1rem;
  color: var(--ink);
}
.conv__list li { margin-bottom: 0.3rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
