/* Design tokens centralized in common.css :root */

* {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Layout */
.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-areas: "sidebar main";
  height: 100vh;
  overflow: hidden;
  /* Ensure content clears the fixed top bar injected by common.js */
  padding-top: var(--book-topbar-h, 64px);
}

.topbar { grid-area: topbar; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}







.brand-link {
  color: inherit;
  text-decoration: none;
}





/* Search */
.search {
  position: relative;
}

.search-input {
  width: 240px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
}

.search-input::placeholder {
  color: #94a3b8;
}

.search-results {
  position: absolute;
  top: 110%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  z-index: 60;
}

.search-item {
  padding: 8px 10px;
  font-size: 13px;
  color: #1e293b;
  cursor: pointer;
}

.search-item:hover,
.search-item.active {
  background: #f5f8ff;
}

.search-item-title {
  font-weight: 600;
}

.search-secondary {
  color: #64748b;
  font-size: 12px;
  display: block;
  margin-top: 2px;
}

/* Sidebar styles are unified in common.css */

.main {
  grid-area: main;
  overflow-y: auto;
  padding: 24px 28px 56px;
}

.hero {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr; /* keep left card width as before */
  gap: 10px; /* reduced spacing between columns */
  align-items: stretch;
}

.hero-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
}

.hero-title {
  font-size: clamp(28px, 4.2vw, 42px);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 12px 0;
  letter-spacing: -0.02em;
  color: var(--text);
}

.hero-authors {
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 10px 0;
}

.hero-sub {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 18px;
}

.pub-info {
  color: var(--muted);
  margin: 0 0 16px 0;
}

.pub-info-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
  margin: 2px 0 6px;
}

.cta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #3b82f6;
  color: #fff;
  font-weight: 700;
}

.btn.secondary {
  background: #fff;
  color: var(--text);
}

.btn:hover {
  filter: brightness(1.05);
  text-decoration: none;
}

.hero-figure {
  border: none;
  border-radius: 0;
  background: transparent;
  display: flex;
  flex-direction: column; /* stack cover and version label */
  gap: 10px;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0;
  min-height: 0;
}

.cover-ph {
  width: 100%;
  max-width: 480px; /* allow a wider cover on the page */
  border: none;
  border-radius: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: visible;
  outline: none;                 /* remove default focus ring */
  -webkit-tap-highlight-color: transparent; /* remove iOS tap highlight */
}

.cover-ph:focus,
.cover-ph:focus-visible,
.cover-ph:active {
  outline: none;
  box-shadow: none;
}

.cover-ph:hover { filter: brightness(0.98); text-decoration: none; }

.cover-img {
  display: block;
  width: 100%;
  height: auto; /* allow natural near-square aspect */
  object-fit: contain; /* show entire cover without cropping */
  border: 1px solid var(--border); /* tight outline around the cover */
  background: #fff; /* ensure clean edge if PNG has transparency */
}

/* Version label under the book cover on landing page */
.cover-version {
  margin-top: 4px;
  color: var(--text);
  font-size: clamp(16px, 2vw, 20px); /* even smaller but still visible */
  font-weight: 500; /* non-bold */
  line-height: 1.25;
  text-align: center;
  white-space: pre-line; /* honor \n in text */
}

.footer {
  margin-top: 28px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.sections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 22px;
}

.section-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
}

.section-card h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  line-height: 1.3;
}

.section-card p {
  margin: 0 0 12px 0;
  color: var(--muted);
  line-height: 1.65;
}

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

/* Normalize list appearance inside landing page cards to match surrounding text */
.section-card ul,
.section-card ol {
  margin: 0 0 12px 0;
  padding-left: 18px; /* align with card content; slightly smaller than browser default */
  color: var(--muted);
  line-height: 1.65;
}

.section-card li {
  margin: 4px 0; /* gentle spacing between list items */
}

.section-card ul:last-child,
.section-card ol:last-child {
  margin-bottom: 0;
}

@media (max-width: 1024px) {
  .app-shell {
    display: block; /* Switch from grid to block layout for consistent mobile behavior */
    height: auto;
    overflow: visible;
    padding-top: var(--book-topbar-h, 64px); /* Restore padding to clear top bar */
  }

  .main {
    grid-area: unset; /* Remove grid area constraints */
    padding-top: 0; /* Remove extra top padding since content flows naturally */
  }

  .hero {
    grid-template-columns: 1fr;
  }
}

/* Landing: Citation block spacing and styling */
.citation-info-title { margin: 10px 0 10px 0; }
.citation-info code { white-space: pre-wrap; }