/* John E. Bryan on Bulbs — Botanical Book Design */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --paper: #f7f4ef;
  --paper-warm: #efe9e0;
  --ink: #2c2825;
  --ink-soft: #4a4541;
  --botanical: #2d5a27;
  --botanical-light: #4a7c42;
  --accent: #8b6914;
  --accent-soft: #a67c2a;
  --border: #d4cdc4;
  --shadow: rgba(45, 90, 39, 0.08);
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Lora', Georgia, serif;
  --max-width: 42rem;
  --spacing: 1.5rem;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Site header & nav */
.site-header {
  background: linear-gradient(180deg, var(--botanical) 0%, #1e3d1a 100%);
  color: #f7f4ef;
  padding: 1.25rem var(--spacing);
  border-bottom: 3px solid var(--accent);
}

.site-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  letter-spacing: 0.02em;
}

.site-title a {
  color: inherit;
  text-decoration: none;
}

.site-title a:hover {
  color: var(--paper-warm);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.9rem;
}

.site-nav a {
  color: rgba(247, 244, 239, 0.95);
  text-decoration: none;
  padding: 0.2em 0;
  border-bottom: 1px solid transparent;
}

.site-nav a:hover {
  color: #fff;
  border-bottom-color: var(--accent-soft);
}

/* Google AdSense unit (same pattern as sfmuseum.org-style content sites) */
.ad-unit {
  max-width: 52rem;
  margin: 0.75rem auto;
  padding: 0 var(--spacing);
  min-height: 50px;
  text-align: center;
}

.ad-unit ins {
  margin: 0 auto;
}

/* Main content wrapper */
.main-wrap {
  max-width: 52rem;
  margin: 0 auto;
  padding: var(--spacing);
}

/* Home page: book cover section */
.cover-section {
  text-align: center;
  padding: 2.5rem 0;
}

.cover-section .cover-image {
  display: block;
  max-width: 100%;
  height: auto;
  width: 320px;
  margin: 0 auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  /* Layered shadow for depth and a soft “book on paper” look */
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 0 0 1px rgba(0,0,0,0.04),
    0 4px 12px rgba(0,0,0,0.06),
    0 12px 32px var(--shadow),
    0 24px 48px rgba(45, 90, 39, 0.12);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cover-section .cover-image:hover {
  transform: translateY(-4px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 0 0 1px rgba(0,0,0,0.06),
    0 8px 20px rgba(0,0,0,0.08),
    0 20px 44px var(--shadow),
    0 32px 64px rgba(45, 90, 39, 0.15);
}

/* Optional “mat” behind cover for a gallery feel */
.cover-section:first-of-type {
  background: linear-gradient(180deg, transparent 0%, rgba(239, 233, 224, 0.4) 30%, rgba(239, 233, 224, 0.5) 100%);
  padding: 2.5rem 1rem;
  border-radius: 0 0 12px 12px;
}

.cover-section .back-cover {
  margin-top: 2.5rem;
}

/* Chapter list (home) */
.chapter-list {
  background: #fff;
  padding: 2rem;
  margin: 2rem 0;
  border-radius: 4px;
  box-shadow: 0 2px 12px var(--shadow);
  border-left: 4px solid var(--botanical);
}

.chapter-list h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--botanical);
  margin: 0 0 1.25rem 0;
  font-weight: 600;
}

.chapter-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chapter-list li {
  margin: 0.5rem 0;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
}

.chapter-list li:last-child {
  border-bottom: none;
}

.chapter-list a {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.05rem;
  display: inline-block;
  padding: 0.15em 0;
  transition: color 0.2s, padding-left 0.2s;
}

.chapter-list a:hover {
  color: var(--botanical);
  padding-left: 0.5rem;
}

.chapter-list .search-links {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}

/* Typography in content */
.content-page h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--botanical);
  margin: 1.5rem 0 1rem 0;
  font-weight: 600;
}

.content-page h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--ink);
  margin: 2rem 0 0.75rem 0;
  font-weight: 600;
}

.content-page p {
  margin: 0 0 1rem 0;
  color: var(--ink-soft);
}

.content-page .lead {
  font-size: 1.1rem;
  color: var(--ink);
}

.content-page a {
  color: var(--botanical);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.content-page a:hover {
  border-bottom-color: var(--botanical);
}

/* Intro/contents specific */
.page-title {
  font-family: var(--font-display);
  font-size: 2.25rem;
  color: var(--botanical);
  margin: 0 0 1.5rem 0;
  font-weight: 600;
}

/* Chapter content (bb1, chapter2) */
.chapter-body {
  font-size: 1rem;
}

.chapter-body b,
.chapter-body strong {
  font-weight: 600;
  color: var(--ink);
}

.chapter-body i,
.chapter-body em {
  font-style: italic;
}

.chapter-body table {
  margin: 1.5rem 0;
  border-collapse: collapse;
  width: 100%;
  max-width: 100%;
}

/* Figure-style image blocks (image + caption tables) */
.chapter-body table:has(img) {
  border: none !important;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow:
    0 0 0 1px var(--border),
    0 4px 16px var(--shadow),
    0 8px 24px rgba(0,0,0,0.06);
  transition: box-shadow 0.25s ease;
}

.chapter-body table:has(img):hover {
  box-shadow:
    0 0 0 1px var(--border),
    0 6px 20px var(--shadow),
    0 12px 32px rgba(0,0,0,0.08);
}

.chapter-body table[align="left"] {
  float: left;
  margin: 0.5rem 1.5rem 1rem 0;
  max-width: 320px;
}

.chapter-body table[align="right"] {
  float: right;
  margin: 0.5rem 0 1rem 1.5rem;
  max-width: 320px;
}

.chapter-body table[align="center"] {
  margin-left: auto;
  margin-right: auto;
  max-width: 520px;
}

.chapter-body table:has(img) tbody tr:first-child td {
  padding: 0;
  vertical-align: top;
  border: none;
}

.chapter-body table:has(img) a {
  display: block;
  line-height: 0;
}

.chapter-body table:has(img) img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border: none;
  border-radius: 10px 10px 0 0;
  margin: 0;
  transition: opacity 0.25s ease;
}

.chapter-body table:has(img) a:hover img {
  opacity: 0.92;
}

.chapter-body table:has(img) tbody tr:last-child td {
  padding: 0.85rem 1rem 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-soft);
  font-style: italic;
  border: none;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(247,244,239,0.5) 0%, #fff 100%);
  vertical-align: top;
}

.chapter-body table:has(img) tbody tr:last-child td div,
.chapter-body table:has(img) tbody tr:last-child td font {
  font-size: inherit !important;
  font-style: italic;
  color: inherit;
}

.chapter-body td {
  padding: 0.5rem;
  vertical-align: top;
}

.chapter-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* Clear float after figure tables so following text doesn’t wrap wrongly */
.chapter-body table[align="left"] + *,
.chapter-body table[align="right"] + * {
  clear: none;
}

.chapter-body::after {
  content: "";
  display: table;
  clear: both;
}

/* Query / search page */
.query-page .main-wrap {
  max-width: 36rem;
}

.query-page h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--botanical);
  margin: 0 0 1rem 0;
}

.query-form {
  background: #fff;
  padding: 2rem;
  border-radius: 4px;
  box-shadow: 0 2px 12px var(--shadow);
  border-left: 4px solid var(--botanical);
}

.query-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--ink);
}

.query-form input[type="text"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-family: var(--font-body);
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 1rem;
  background: var(--paper);
}

.query-form input[type="text"]:focus {
  outline: none;
  border-color: var(--botanical);
  box-shadow: 0 0 0 2px var(--shadow);
}

.query-form .buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.query-form input[type="submit"] {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.5rem 1.25rem;
  background: var(--botanical);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

.query-form input[type="submit"]:hover {
  background: var(--botanical-light);
}

.query-form input[type="reset"] {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.5rem 1rem;
  background: var(--paper-warm);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.query-form input[type="reset"]:hover {
  background: var(--border);
}

/* Search results (client-side) */
.search-results {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 12px var(--shadow);
  border-left: 4px solid var(--botanical);
}

.search-result-count {
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.search-result-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-result-list li {
  margin: 0.4rem 0;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
}

.search-result-list li:last-child {
  border-bottom: none;
}

.search-result-list a {
  font-family: var(--font-body);
  color: var(--botanical);
  text-decoration: none;
  font-weight: 500;
}

.search-result-list a:hover {
  text-decoration: underline;
}

.search-no-results {
  margin: 0;
  color: var(--ink-soft);
}

.search-no-results strong {
  color: var(--ink);
}

/* Footer */
.site-footer {
  margin-top: 3rem;
  padding: 1.5rem var(--spacing);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.site-footer a {
  color: var(--botanical);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* Chapter2 Word export overrides — keep content readable */
.chapter2-wrap {
  font-family: var(--font-body) !important;
  color: var(--ink-soft) !important;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--spacing);
}

.chapter2-wrap .Section1,
.chapter2-wrap .Section2,
.chapter2-wrap .Section3,
.chapter2-wrap .Section4,
.chapter2-wrap .Section5,
.chapter2-wrap .Section6,
.chapter2-wrap .Section7,
.chapter2-wrap .Section8,
.chapter2-wrap .Section9,
.chapter2-wrap .Section10,
.chapter2-wrap .Section11,
.chapter2-wrap .Section12,
.chapter2-wrap .Section13,
.chapter2-wrap .Section14,
.chapter2-wrap .Section15,
.chapter2-wrap .Section16 {
  font-family: var(--font-body) !important;
  color: var(--ink-soft) !important;
}

.chapter2-wrap span,
.chapter2-wrap p {
  font-family: var(--font-body) !important;
  color: var(--ink-soft) !important;
}

.chapter2-wrap a {
  color: var(--botanical) !important;
}

/* Contents list styling */
.contents-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}

.contents-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.contents-list a {
  color: var(--ink);
  text-decoration: none;
}

.contents-list a:hover {
  color: var(--botanical);
}

.contents-list .page-num {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* Coming soon / placeholder */
.coming-soon {
  font-style: italic;
  color: var(--ink-soft);
}
