/* How They Think — static site stylesheet */

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

body {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 18px;
  line-height: 1.7;
  color: #222;
  background: #fff;
  margin: 0;
  padding: 0;
}

article {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ── Headings ── */

h1 {
  font-size: 1.8em;
  font-weight: 600;
  line-height: 1.3;
  margin: 1.5rem 0 1.2rem;
  color: #111;
}

/* ── Chapter heading (book-style opener) ── */

.chapter-heading {
  text-align: center;
  margin: 1.5rem 0 2rem;
}

.chapter-number {
  font-family: 'Raleway', sans-serif;
  font-size: 1.6em;
  font-weight: 300;
  color: #222;
  margin: 0 0 0.3rem;
}

.chapter-rule {
  border: none;
  border-top: 1px solid #333;
  max-width: 80%;
  margin: 0 auto 1.2rem;
}

.chapter-heading h1 {
  font-family: 'Raleway', sans-serif;
  font-size: 1.5em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.4;
  margin: 0;
}

h2 {
  font-size: 1.35em;
  font-weight: 600;
  line-height: 1.4;
  margin: 2rem 0 0.8rem;
  color: #222;
}

/* ── Paragraphs ── */

p {
  margin: 0 0 1em;
}

/* ── Links ── */

a {
  color: #4a6fa5;
  text-decoration: underline;
  text-decoration-color: rgba(74, 111, 165, 0.35);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-color: rgba(74, 111, 165, 0.8);
}

a.xref {
  color: #555;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: rgba(0, 0, 0, 0.3);
}

a.xref:hover {
  color: #4a6fa5;
  text-decoration-style: solid;
}

/* ── Figures and images ── */

figure {
  margin: 1.8rem auto;
  text-align: center;
}

figure + figure {
  margin-top: 3.5rem;
}

figure img {
  max-width: 100%;
  height: auto;
}

figure label img {
  cursor: zoom-in;
}

/* ── Lightbox (pure CSS) ── */

.lightbox-toggle {
  display: none;
}

.lightbox-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  cursor: zoom-out;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.lightbox-overlay img {
  max-width: 95%;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-toggle:checked ~ .lightbox-overlay {
  display: flex;
}

figcaption {
  font-size: 0.88em;
  font-style: italic;
  color: #666;
  margin-top: 0.5rem;
  line-height: 1.5;
}

p.caption {
  font-size: 0.88em;
  font-style: italic;
  color: #666;
  text-align: center;
  line-height: 1.5;
}

/* ── Blockquote ── */

blockquote {
  margin: 1.5rem 0;
  padding: 0.5rem 0 0.5rem 1.5rem;
  border-left: 3px solid #ccc;
  font-style: italic;
  color: #444;
}

blockquote p {
  margin: 0 0 0.6em;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* ── Conversation (text messages) ── */

.conversation {
  margin: 1.5rem 0;
  padding: 0.8rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.conversation p {
  margin: 0;
  padding: 0.6rem 1rem;
  border-radius: 1rem;
  max-width: 75%;
  line-height: 1.5;
  font-size: 0.95em;
}

.conversation .msg-user {
  align-self: flex-end;
  background: #b8d4e8;
  border-bottom-right-radius: 4px;
}

.conversation .msg-ai {
  align-self: flex-start;
  background: #e8e8e4;
  border-bottom-left-radius: 4px;
}

/* ── Inset blocks ── */

.inset {
  margin: 1.5rem 0;
  padding: 1rem 1.2rem;
  background: #f5f5f0;
  border-left: 3px solid #d0cfc8;
  border-radius: 0 4px 4px 0;
}

.inset p {
  margin: 0 0 0.6em;
}

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

.inset.mono {
  font-family: 'Menlo', 'Consolas', 'Monaco', monospace;
  font-size: 0.88em;
  line-height: 1.5;
}

.inset.mono p {
  white-space: pre-wrap;
}

/* ── Centered text ── */

.centered {
  text-align: center;
}

/* ── Section break ── */

hr.section-break {
  border: none;
  text-align: center;
  margin: 2rem 0;
}

hr.section-break::after {
  content: "* * *";
  color: #999;
  font-size: 1.1em;
  letter-spacing: 0.3em;
}

/* ── Lists ── */

ol {
  margin: 1em 0;
  padding-left: 2em;
}

ol li {
  margin-bottom: 0.5em;
}

/* ── Navigation ── */

.chapter-nav {
  max-width: 680px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9em;
  color: #888;
  border-bottom: 1px solid #e8e8e3;
}

.chapter-nav:last-of-type {
  border-bottom: none;
  border-top: 1px solid #e8e8e3;
}

.chapter-nav a {
  color: #888;
  text-decoration: none;
}

.chapter-nav a:hover {
  color: #4a6fa5;
}

/* ── TOC page ── */

.toc-page {
  padding-top: 3rem;
}

.toc-page h1 {
  font-family: 'Raleway', sans-serif;
  text-align: center;
  font-size: 2.4em;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 0.3rem;
}

.toc-page .subtitle {
  font-family: 'Raleway', sans-serif;
  text-align: center;
  font-size: 1.15em;
  font-weight: 300;
  font-style: italic;
  color: #555;
  margin: 0 0 0.3rem;
}

.toc-page .author {
  text-align: center;
  font-size: 1em;
  color: #444;
  margin: 0.8rem 0 0.2rem;
}

.author-icon {
  color: #999;
  text-decoration: none;
  margin-left: 0.25em;
  vertical-align: baseline;
  position: relative;
  top: 1px;
}

.author-icon:hover {
  color: #4a6fa5;
}

.toc-page .draft-info {
  text-align: center;
  font-size: 0.85em;
  color: #888;
  margin: 0 0 2rem;
}

.toc {
  max-width: 480px;
  margin: 0 auto;
}

.toc a.toc-special {
  display: block;
  font-size: 1.05em;
  padding: 0.4rem 0 0.4rem 2.2em;
  color: #444;
  text-decoration: none;
}

.toc a.toc-special:hover {
  color: #4a6fa5;
}

.toc ol {
  margin: 1rem 0;
  padding-left: 2.2em;
}

.toc ol li {
  padding: 0.25rem 0;
}

.toc ol li a {
  color: #333;
  text-decoration: none;
}

.toc ol li a:hover {
  color: #4a6fa5;
  text-decoration: underline;
}

/* ── Preview tooltip ── */

.preview-tooltip {
  position: fixed;
  z-index: 900;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  padding: 8px;
  pointer-events: auto;
}

.preview-tooltip[hidden] {
  display: none;
}

.preview-tooltip img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 3px;
}

/* ── Site footer ── */

.site-footer {
  max-width: 680px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2rem;
  text-align: center;
  font-size: 0.8em;
  color: #999;
}

/* ── Responsive ── */

@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  article {
    padding: 1.2rem 1rem 3rem;
  }

  .chapter-nav {
    padding: 0.8rem 1rem;
    font-size: 0.85em;
  }

  h1 {
    font-size: 1.5em;
  }
}
