:root {
  --color-accent: #ff4c68;
  --color-accent-dark: #ff1a3e;
  --color-text: #1c1c1c;
  --color-muted-bg: #efeded;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  color: var(--color-text);
  padding-top: 65px;
}

h1, h2, h3 { font-family: 'Roboto', sans-serif; font-weight: 900; }
p { font-family: 'Roboto', sans-serif; }

/* Responsive type — monotonic, not the original up-down-up bug */
h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; padding-bottom: 1rem; }
p  { font-size: 1.05rem; line-height: 1.6; }
@media (min-width: 768px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
  p  { font-size: 1.15rem; }
}
@media (min-width: 1200px) {
  h1 { font-size: 3rem; }
  h2 { font-size: 2.25rem; }
  p  { font-size: 1.2rem; }
}

/* Smooth scroll offset under fixed navbar */
section { scroll-margin-top: 70px; }
h2[id], section[id] { scroll-margin-top: 80px; }

/* Sections */
.colored-section {
  background-color: var(--color-accent);
  color: white;
  padding: 4rem 0;
}
.colored-section a.btn-outline-light:hover { color: var(--color-accent); }

.white-section {
  background-color: #fff;
  color: var(--color-text);
  padding: 4rem 0;
}

.darkwhite-section {
  background-color: var(--color-muted-bg);
  color: var(--color-text);
  padding: 4rem 0;
}

/* Title section */
#titletextheader {
  padding: 4rem 1rem 2rem;
  text-align: center;
}
#titletextheader h1 {
  letter-spacing: 0.05em;
}
.buttons { margin-top: 2rem; }
.button-download { margin: 0.5rem 0.5rem; }

/* Navbar */
.navbar-light .navbar-nav .nav-link.active {
  background-color: var(--color-accent);
  border-radius: 5px;
  color: white !important;
}
.navbar-brand { letter-spacing: 0.1em; }

/* Profile photo */
.profile {
  max-width: 320px;
  width: 100%;
  height: auto;
  margin: 0 auto;
  display: block;
}

/* Book covers */
.bookimagelm,
.bookimagels1,
.bookimagels2 {
  max-width: 280px;
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 1.5rem;
}

.book-actions { margin-top: 1rem; }
.book-actions .btn { margin: 0.35rem 0.25rem; }

/* Download button */
.btn-download {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
  transition: all 0.2s ease;
}
.btn-download:hover,
.btn-download:focus {
  background-color: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
  color: white;
  transform: translateY(-1px);
}

/* Publications */
#publications .table thead th {
  background: #fff;
  border-bottom: 2px solid var(--color-accent);
}

.pagination .page-link {
  color: var(--color-accent);
}
.pagination .page-item.active .page-link {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}
.pagination .page-item.disabled .page-link {
  color: #6c757d;
}
.pagination .page-link:hover {
  color: var(--color-accent-dark);
}
.pagination .page-link:focus {
  box-shadow: 0 0 0 0.25rem rgba(255, 76, 104, 0.25);
}

/* Audio */
audio { max-width: 600px; }

/* ============ Book reading experience ============ */

:root {
  --reading-fg: #1c1c1c;
  --reading-fg-muted: #555;
  --reading-bg: #fafafa;
  --reading-link: #b3243c;
  --reading-width: 72ch;
  --reading-font-size: 1.125rem;
}

html[data-text-size="small"]  { --reading-font-size: 1rem; }
html[data-text-size="medium"] { --reading-font-size: 1.125rem; }
html[data-text-size="large"]  { --reading-font-size: 1.25rem; }

.reading-progress {
  position: fixed;
  top: 65px;
  left: 0; right: 0;
  height: 3px;
  background: transparent;
  z-index: 1030;
  pointer-events: none;
}
.reading-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--color-accent);
  transition: width 0.05s linear;
}

.book-toolbar {
  position: sticky;
  top: 65px;
  z-index: 1020;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid #e3e3e3;
  padding: 0.5rem 0;
}
.book-toolbar .book-toolbar-title {
  font-size: 0.95rem;
  max-width: 60%;
}
.book-toolbar .text-size-controls .btn { padding: 0.15rem 0.45rem; font-size: 0.85rem; }
@media (max-width: 575px) {
  .book-toolbar .book-toolbar-title { display: none; }
}

.book-toc {
  width: min(380px, 90vw);
}
.book-toc-list {
  list-style: decimal;
  padding-left: 1.5rem;
  margin: 0;
}
.book-toc-list li { margin: 0.4rem 0; }
.book-toc-list a {
  color: var(--reading-fg);
  text-decoration: none;
  display: inline-block;
  padding: 0.1rem 0;
}
.book-toc-list a:hover { color: var(--color-accent); }
.book-toc-list li.active a {
  color: var(--color-accent);
  font-weight: 700;
}

.book-reader {
  background: var(--reading-bg);
  color: var(--reading-fg);
  padding: 3rem 1rem 4rem;
}
.book-chapter {
  max-width: var(--reading-width);
  margin: 0 auto;
  font-size: var(--reading-font-size);
  line-height: 1.7;
}
.book-chapter-header { margin-bottom: 2rem; }
.book-chapter-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.8rem;
  color: var(--reading-fg-muted);
  margin: 0 0 0.5rem;
}
.book-chapter-header h1 {
  font-size: clamp(1.75rem, 2.5vw, 2.5rem);
  line-height: 1.2;
  margin: 0;
}
.book-chapter-body h2 {
  font-size: 1.5rem;
  margin: 2.5rem 0 1rem;
  font-weight: 800;
}
.book-chapter-body h3 {
  font-size: 1.2rem;
  margin: 2rem 0 0.75rem;
  font-weight: 700;
}
.book-chapter-body p { margin: 0 0 1.1em; }
.book-chapter-body a { color: var(--reading-link); }
.book-chapter-body a:hover { color: var(--color-accent-dark); }
.book-chapter-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem auto;
  border-radius: 4px;
}
.book-chapter-body blockquote {
  border-left: 4px solid var(--color-accent);
  padding: 0.25rem 1rem;
  margin: 1.5rem 0;
  color: var(--reading-fg-muted);
  font-style: italic;
}
.book-chapter-body .book-section,
.book-chapter-body section {
  background: transparent !important;
  color: inherit !important;
  padding: 0 !important;
}
.book-chapter-body .container,
.book-chapter-body .row,
.book-chapter-body [class*="col-"] {
  display: block;
  width: auto;
  padding: 0;
  margin: 0;
  max-width: none;
}

.book-chapter-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid #ddd;
}
.book-chapter-pager a {
  display: block;
  padding: 1rem 1.25rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  text-decoration: none;
  color: var(--reading-fg);
  background: #fff;
  transition: border-color 0.15s, transform 0.15s;
}
.book-chapter-pager a:hover {
  border-color: var(--color-accent);
  transform: translateY(-1px);
}
.book-chapter-pager .next { text-align: right; }
.book-chapter-pager .label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--reading-fg-muted);
  margin-bottom: 0.25rem;
}
.book-chapter-pager .title { font-weight: 600; }
@media (max-width: 575px) {
  .book-chapter-pager { grid-template-columns: 1fr; }
  .book-chapter-pager .next { text-align: left; }
}

.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--color-accent);
  color: white;
  font-size: 1.25rem;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  cursor: pointer;
  z-index: 1010;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Book overview pages */
.book-overview-hero {
  background: linear-gradient(135deg, var(--color-accent) 0%, #ff6b81 100%);
  color: white;
  padding: 5rem 0 4rem;
}
.book-overview-hero h1 {
  font-size: clamp(2rem, 4vw, 3.25rem);
  margin: 0.25rem 0 0.5rem;
}
.book-overview-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.85rem;
  opacity: 0.85;
  margin: 0;
}
.book-overview-subtitle {
  font-size: 1.2rem;
  opacity: 0.9;
  margin: 0 0 1rem;
}
.book-overview-cover {
  max-width: 260px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  border-radius: 4px;
}
.book-overview-toc {
  padding: 4rem 0;
  background: #fff;
}
.book-overview-toc h2 { margin-bottom: 1.5rem; }
.book-overview-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}
.book-overview-list a {
  display: grid;
  grid-template-columns: 3rem 1fr;
  align-items: center;
  padding: 0.85rem 1rem;
  border: 1px solid #e3e3e3;
  border-radius: 6px;
  text-decoration: none;
  color: var(--reading-fg);
  background: #fff;
  transition: border-color 0.15s, background 0.15s;
}
.book-overview-list a:hover {
  border-color: var(--color-accent);
  background: #fff7f9;
}
.book-overview-list .chapter-number {
  font-weight: 800;
  color: var(--color-accent);
  font-size: 1.25rem;
}
.book-overview-list .chapter-title { font-weight: 500; }
