/* CSS chapter / reference pages — aligned with shared workbook tokens */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0 0 2rem;
  background:
    radial-gradient(120% 80% at 100% -10%, #d7ebe0 0%, transparent 55%),
    radial-gradient(90% 70% at -10% 20%, #f0e6d4 0%, transparent 50%),
    linear-gradient(180deg, #eef5f0 0%, #f3f7f4 40%, #e7f0ea 100%);
  color: #12261c;
  font-family: "Figtree", "Segoe UI", Arial, Helvetica, sans-serif;
  line-height: 1.6;
}

a {
  color: #1a4a32;
}

a:hover {
  color: #c45c26;
}

a:focus-visible {
  outline: 3px solid #c9a227;
  outline-offset: 3px;
}

.book {
  width: min(64rem, calc(100% - 2rem));
  margin: 1.5rem auto 0;
}

.book-header {
  margin: 0 0 1.5rem;
  padding: clamp(2rem, 4vw, 2.75rem) clamp(1.25rem, 3vw, 2rem);
  background: linear-gradient(145deg, #1a4a32 0%, #235c40 55%, #2a8f5c 120%);
  border-radius: 1rem;
  color: #ffffff;
}

.book-header h1 {
  margin: 0 0 0.5rem;
  font-family: "Bricolage Grotesque", "Avenir Next", sans-serif;
  font-size: clamp(1.6rem, 3.2vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.book-header p {
  max-width: 44rem;
  margin: 0;
  color: #dceadd;
}

.chapter-nav {
  margin: 0 0 1.5rem;
  padding: 0.75rem 1rem;
  background: color-mix(in srgb, #ffffff 88%, transparent);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid #c5d4cb;
  border-radius: 0.75rem;
}

.chapter-nav a {
  padding: 0.5rem 0.85rem;
  background: #e8efe9;
  border: 1px solid #c5d4cb;
  border-radius: 0.55rem;
  font-weight: 700;
  text-decoration: none;
}

.chapter-nav a:hover {
  background: #1a4a32;
  border-color: #1a4a32;
  color: #ffffff;
}

.panel {
  margin: 0 0 1.25rem;
  padding: 1.25rem 1.35rem;
  background: #ffffff;
  border: 1px solid #dde6e0;
  border-radius: 0.75rem;
}

.panel-alt {
  background: #e8efe9;
}

.panel h2 {
  margin: 0 0 0.6rem;
  color: #1a4a32;
  font-family: "Bricolage Grotesque", "Avenir Next", sans-serif;
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.panel p {
  margin: 0 0 0.75rem;
}

.lesson-list,
.chapter-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.lesson-list li,
.chapter-list li {
  margin: 0 0 0.75rem;
  padding: 0.9rem 1rem;
  background: #f8faf8;
  border: 1px solid #dde6e0;
  border-radius: 0.625rem;
}

.lesson-list a,
.chapter-list a {
  font-weight: 700;
}

.chapter-list li:nth-child(even) {
  background: #e8efe9;
}

.label {
  display: inline-block;
  margin: 0 0.4rem 0 0;
  padding: 0.2rem 0.55rem;
  background: #ffffff;
  border: 1px solid #c5d4cb;
  border-radius: 999px;
  color: #1a4a32;
  font-size: 0.8rem;
  font-weight: 700;
}

.checkpoint {
  border-left: 0.4rem solid #c45c26;
}

.book-footer {
  padding: 1rem;
  color: #4f7a63;
  text-align: center;
}

.book-footer a {
  font-weight: 700;
}

.doc-content {
  margin: 0 0 1.25rem;
  padding: 1.5rem;
  background: #ffffff;
  border: 1px solid #dde6e0;
  border-radius: 0.75rem;
}

.doc-content h1,
.doc-content h2,
.doc-content h3,
.doc-content h4 {
  color: #1a4a32;
  line-height: 1.3;
}

.doc-content h1 {
  margin-top: 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #c5d4cb;
  font-family: "Bricolage Grotesque", "Avenir Next", sans-serif;
}

.doc-content h2 {
  margin-top: 2rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #dde6e0;
}

.doc-content code {
  padding: 0.15rem 0.35rem;
  background: #edf1ed;
  border-radius: 0.3rem;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.9em;
}

.doc-content pre {
  padding: 1rem;
  background: #17251c;
  overflow: auto;
  border-radius: 0.6rem;
  color: #f1f7f2;
}

.doc-content pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.doc-content table {
  width: 100%;
  margin: 1rem 0;
  display: block;
  overflow: auto;
  border-collapse: collapse;
}

.doc-content th,
.doc-content td {
  padding: 0.65rem;
  border: 1px solid #c5d4cb;
  text-align: left;
  vertical-align: top;
}

.doc-content th {
  background: #e8efe9;
}

.doc-content blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: #f7efe5;
  border-left: 0.35rem solid #c45c26;
}

.doc-source {
  margin: 0 0 1rem;
  color: #4f7a63;
  font-size: 0.9rem;
}

@media (max-width: 40rem) {
  .book {
    width: calc(100% - 1.25rem);
    margin-top: 1rem;
  }
}
