:root {
  color-scheme: light dark;
  --bg: #fbf8f1;
  --text: #161616;
  --muted: #625d50;
  --link: #111111;
  --link-hover: #5b3b14;
  --rule: #ded7c8;
  --accent-bg: #f3ecdf;
  --max-width: 780px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11110f;
    --text: #eee8dc;
    --muted: #b8ad9c;
    --link: #fff4df;
    --link-hover: #ffd58f;
    --rule: #363228;
    --accent-bg: #1b1a17;
  }
}

* {
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  font-size: clamp(1.15rem, 0.95rem + 0.55vw, 1.45rem);
  line-height: 1.58;
  text-rendering: optimizeLegibility;
}

.page {
  width: min(var(--max-width), calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1.5rem, 3vw, 3rem) 0 4rem;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.4rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.25rem;
}

.site-title {
  color: var(--text);
  font-size: clamp(1.65rem, 1.18rem + 1vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.018em;
  line-height: 1.12;
  text-decoration: none;
  white-space: nowrap;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem 1.15rem;
  font-size: clamp(1.15rem, 1.02rem + 0.34vw, 1.35rem);
  line-height: 1.25;
}

.nav a {
  color: var(--muted);
  text-decoration-thickness: 0.07em;
  text-underline-offset: 0.18em;
}

.nav a[aria-current="page"] {
  color: var(--text);
  text-decoration: none;
}

.nav a:hover,
.nav a:focus {
  color: var(--link-hover);
}

h1 {
  font-size: clamp(2rem, 1.45rem + 1.6vw, 3rem);
  line-height: 1.08;
  margin: 0 0 1rem;
  letter-spacing: -0.035em;
}

h2 {
  font-size: clamp(1.45rem, 1.2rem + 0.8vw, 2rem);
  line-height: 1.16;
  margin: 2.5rem 0 0.85rem;
  letter-spacing: -0.025em;
}

p {
  margin: 0 0 1.2rem;
}

.preamble {
  margin-bottom: 2.35rem;
  color: var(--muted);
  font-size: 0.98em;
  line-height: 1.42;
}

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

a:hover,
a:focus {
  color: var(--link-hover);
}

.posts,
.archive-years {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post,
.archive-year {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem 1.5rem;
  align-items: baseline;
  padding: 0.82rem 0;
}

.post:not(:last-child),
.archive-year:not(:last-child) {
  border-bottom: 1px solid var(--rule);
}

.post a,
.archive-year a {
  font-weight: 600;
  text-decoration: none;
}

.post a:hover,
.post a:focus,
.archive-year a:hover,
.archive-year a:focus {
  text-decoration: underline;
}

.post time,
.archive-year span {
  color: var(--muted);
  font-size: 0.78em;
  white-space: nowrap;
}

.archive-note {
  margin-top: 2.25rem;
  padding: 1rem 1.1rem;
  background: var(--accent-bg);
  border: 1px solid var(--rule);
  border-radius: 0.4rem;
  color: var(--muted);
  font-size: 0.85em;
  line-height: 1.4;
}

.site-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.78em;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 760px) {
  .site-header {
    display: block;
  }

  .nav {
    justify-content: flex-start;
    margin-top: 0.85rem;
  }
}

@media (max-width: 560px) {
  .post,
  .archive-year {
    grid-template-columns: 1fr;
    gap: 0.1rem;
    padding: 1rem 0;
  }
}

@media (max-width: 420px) {
  .nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .nav a {
    display: block;
  }
}

/* Generated research-taxonomy UI */
.post {
  display: block;
}

.post-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: baseline;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.tag-pill {
  display: inline-block;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.11rem 0.52rem;
  color: var(--muted);
  background: var(--accent-bg);
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: 0.64em;
  font-weight: 600;
  line-height: 1.45;
  text-decoration: none;
}

.tag-pill:hover,
.tag-pill:focus {
  text-decoration: underline;
}

.notable-badge {
  display: inline-block;
  border: 1px solid #8b6f32;
  border-radius: 999px;
  padding: 0.08rem 0.48rem;
  color: #6f5316;
  background: #fff3c4;
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: 0.58em;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  line-height: 1.45;
  text-decoration: none;
}

@media (prefers-color-scheme: dark) {
  .notable-badge {
    color: #f2d77e;
    background: #3a2d09;
    border-color: #8b6f32;
  }
}

.post-note {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.78em;
  line-height: 1.4;
}

.browse-tools {
  display: grid;
  grid-template-columns: 1fr minmax(12rem, auto) minmax(8rem, auto);
  gap: 0.65rem;
  margin: 0 0 1.1rem;
}

.browse-tools input,
.browse-tools select {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--rule);
  border-radius: 0.35rem;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.72em;
}

.browse-count {
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.78em;
}

@media (max-width: 700px) {
  .browse-tools {
    grid-template-columns: 1fr;
  }
}

/* Two-date display: source publication date + Thought Studies posting date */
.post-dates {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.55rem;
  color: var(--muted);
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: 0.62em;
  font-weight: 600;
  white-space: normal;
}

.post-dates span {
  white-space: nowrap;
}

/* Media-type indicators and monthly digests */
.media-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  height: 1.25em;
  margin-right: .35rem;
  border: 1px solid var(--rule, #ded7c8);
  border-radius: 999px;
  font-size: .78em;
  line-height: 1;
  vertical-align: .08em;
  background: var(--tag-bg, #f8f4eb);
  color: var(--muted, #625d50);
  text-decoration: none;
}
.media-video { font-weight: 700; }
.digest-summary {
  margin: 1.35rem 0 1.65rem;
  padding: 1.05rem 1.15rem;
  border: 1px solid var(--rule);
  border-left: 0.24rem solid var(--link-hover);
  border-radius: 0.45rem;
  background: var(--accent-bg);
  color: var(--text);
  box-shadow: 0 0.25rem 0.8rem rgba(0, 0, 0, 0.045);
}
.digest-summary h2 {
  margin: 0 0 .45rem;
  color: var(--text);
  font-size: 1.05rem;
}
.digest-summary p {
  margin: 0;
  color: var(--text);
}
.info-card {
  margin: 1.1rem 0 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: 0.45rem;
  background: var(--accent-bg);
}
.info-card p:last-child { margin-bottom: 0; }
.digest-note {
  color: var(--muted, #625d50);
  font-style: italic;
}
.browse-tools select#media { min-width: 9rem; }

/* Optional public editor comments */
.editor-comments {
  margin-top: 0.55rem;
  padding: 0.72rem 0.85rem;
  border: 1px solid var(--rule);
  border-radius: 0.42rem;
  background: var(--accent-bg);
  color: var(--text);
  font-size: 0.78em;
  line-height: 1.42;
}
.editor-comments strong {
  color: var(--text);
}

.digest-ai-note {
  margin: 0 0 0.65rem !important;
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
}
.info-card h2 {
  margin-top: 0;
}
