:root {
  --bg: #f4f8ff;
  --surface: #ffffff;
  --surface-soft: #eaf1ff;
  --border: #b6c9e8;
  --ink: #0f2238;
  --ink-soft: #425b78;
  --accent: #1f4f8f;
  --accent-soft: #d6e3f8;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 0 0, #e8f2fc 0%, transparent 45%),
    radial-gradient(circle at 100% 100%, #edf3ff 0%, transparent 40%),
    var(--bg);
}

.site-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo-link {
  display: inline-flex;
  align-items: center;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.menu-link {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
}

.menu-link:hover,
.brand:hover {
  text-decoration: underline;
}

.menu-link.is-active {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.page-title {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.lesson-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
  overflow-x: auto;
  white-space: nowrap;
}

.lesson-nav-label {
  font-size: 0.86rem;
  color: var(--ink-soft);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lesson-nav ul {
  display: flex;
  gap: 0.6rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.lesson-nav a {
  display: inline-block;
  text-decoration: none;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.86rem;
}

.lesson-nav a:hover,
.lesson-nav a.is-active {
  background: var(--accent-soft);
  border-color: #9ec7e7;
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: #eef4ff;
  padding: 0.6rem 1rem;
}

.site-footer p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  text-align: center;
}

.toc-pane {
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid var(--border);
  padding: 1rem 0.95rem;
  overflow-y: auto;
}

.toc-pane h2 {
  margin: 0 0 0.8rem;
  font-size: 1rem;
  color: var(--ink-soft);
}

.page-search {
  margin-bottom: 1rem;
}

.page-search label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.page-search-controls {
  display: flex;
  gap: 0.4rem;
}

.page-search-controls input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  padding: 0.42rem 0.55rem;
  font: inherit;
}

.page-search-controls button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  border-radius: 0.35rem;
  padding: 0.42rem 0.6rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.page-search-controls button:hover {
  background: #173f73;
}

.page-search-status {
  min-height: 1rem;
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

#toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-item {
  margin-bottom: 0.35rem;
  line-height: 1.2;
}

.toc-item a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.92rem;
}

.toc-item a:hover,
.toc-item a.is-current {
  text-decoration: underline;
  font-weight: 700;
}

.toc-level-3 {
  padding-left: 0.85rem;
}

.toc-empty {
  color: var(--ink-soft);
  font-style: italic;
  font-size: 0.9rem;
}

.toc-support {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid #d3e2f6;
  text-align: center;
}

.toc-support-label {
  margin: 0 0 0.45rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.toc-paypal-link {
  display: inline-block;
}

.toc-paypal-link img {
  max-width: 100%;
  height: auto;
}

.content-pane {
  background: var(--surface);
  overflow-y: auto;
  padding: 1.5rem clamp(1rem, 4vw, 3rem) 3rem;
}

.content-pane > * {
  max-width: 980px;
}

.content-pane h1,
.content-pane h2,
.content-pane h3 {
  line-height: 1.2;
  color: #123f73;
}

.content-pane h1 {
  font-size: clamp(1.8rem, 3vw, 2.35rem);
  margin-bottom: 0.75rem;
}

.content-pane h2 {
  margin-top: 1.9rem;
  padding-top: 0.5rem;
  border-top: 1px solid #d8e5f8;
}

.content-pane h3 {
  margin-top: 1.25rem;
}

.content-pane p,
.content-pane li {
  line-height: 1.65;
}

.content-pane img {
  max-width: 100%;
  height: auto;
  border-radius: 0.35rem;
}

.content-pane table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
}

.content-pane th,
.content-pane td {
  border: 1px solid var(--border);
  padding: 0.5rem;
  text-align: left;
}

.content-pane pre {
  background: #10243f;
  color: #eaf1ff;
  border-radius: 0.55rem;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  border: 1px solid #2f578c;
}

.content-pane code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.content-pane p code,
.content-pane li code {
  background: #e9f0ff;
  color: #173c68;
  border: 1px solid #cadcf7;
  border-radius: 0.25rem;
  padding: 0.08rem 0.25rem;
}

.content-pane blockquote {
  margin: 1rem 0;
  padding: 0.2rem 0.9rem;
  border-left: 4px solid #6ba8ea;
  background: #f3f8ff;
}

.home-hero {
  border: 1px solid #c7d9f4;
  background: linear-gradient(145deg, #f5f9ff 0%, #eaf1ff 100%);
  border-radius: 0.8rem;
  padding: 1rem 1.1rem;
  margin-top: 1rem;
}

.home-hero h2 {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

.learning-goals-card {
  border: 1px solid #c7d9f4;
  background: linear-gradient(145deg, #f5f9ff 0%, #eaf1ff 100%);
  border-radius: 0.8rem;
  padding: 1rem 1.1rem;
  margin: 1rem 0 0.8rem;
}

.learning-goals-card h2 {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

.learning-goals-card p {
  margin: 0 0 0.35rem;
}

.learning-goals-card ol {
  margin: 0;
  padding-left: 1.15rem;
}

.home-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
}

.home-panel {
  border: 1px solid #ccdcf5;
  border-radius: 0.75rem;
  background: #fcfdff;
  padding: 0.95rem 1rem;
  margin-top: 1rem;
}

.home-panel h2 {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

.home-path-list {
  margin: 0;
  padding-left: 1.1rem;
}

.home-path-list li {
  margin: 0.3rem 0;
}

.home-path-list a {
  text-decoration: none;
  color: #1b4f89;
  font-weight: 600;
}

.home-path-list a:hover {
  text-decoration: underline;
}

.home-connect {
  margin: 0;
  padding-left: 1rem;
}

.quote-day {
  margin-top: 1rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid #cfddf5;
  background: linear-gradient(140deg, #f6f9ff 0%, #edf3ff 100%);
  border-radius: 0.65rem;
}

.quote-day h3 {
  margin: 0 0 0.35rem;
  color: #1b4f89;
  font-size: 1rem;
}

.quote-day blockquote {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-style: italic;
}

.quote-author {
  margin: 0.45rem 0 0;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.92rem;
}

.connect-extra {
  margin-top: 0.9rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid #cfddf5;
  background: linear-gradient(140deg, #fbfdff 0%, #eef3ff 100%);
  border-radius: 0.65rem;
}

.connect-extra h3 {
  margin: 0 0 0.35rem;
  color: #1b4f89;
  font-size: 1rem;
}

.connect-extra p {
  margin: 0;
}

.tip-kicker {
  margin-top: 0.15rem;
  margin-bottom: 0.5rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 700;
}

#featured-tip-title {
  margin-bottom: 0.28rem;
}

#featured-tip-text {
  margin-bottom: 0.7rem;
  color: var(--ink-soft);
}

.connect-extra-link {
  display: inline-block;
  text-decoration: none;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  border-radius: 0.4rem;
  padding: 0.45rem 0.72rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.connect-extra-link:hover {
  background: #173f73;
}

.author-photo {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 0.7rem;
  border: 2px solid #c4d7f5;
  box-shadow: 0 6px 16px rgba(15, 43, 80, 0.16);
}

.author-photo-wrap {
  float: left;
  margin: 0.15rem 0.95rem 0.6rem 0;
}

.table-wrap {
  overflow-x: auto;
}

.blog-hero {
  background: linear-gradient(130deg, #f2f8ff 0%, #e8f1ff 55%, #eaf4ff 100%);
}

.blog-list {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.blog-card {
  border: 1px solid #bfe0f4;
  border-radius: 0.75rem;
  background: linear-gradient(160deg, #ffffff 0%, #f5fbff 65%, #f0f9ff 100%);
  padding: 1rem 1.05rem;
  box-shadow: 0 6px 18px rgba(15, 70, 78, 0.08);
}

.blog-card h2 {
  margin: 0.2rem 0 0.35rem;
}

.blog-card h2 a {
  color: #084f67;
  text-decoration: none;
}

.blog-card h2 a:hover {
  text-decoration: underline;
}

.blog-card-date {
  margin: 0;
  color: #496f72;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.blog-read-link {
  display: inline-block;
  margin-top: 0.25rem;
  text-decoration: none;
  color: #ffffff;
  background: #1f4f8f;
  border: 1px solid #1f4f8f;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.86rem;
  font-weight: 700;
}

.blog-read-link:hover {
  background: #173f73;
}

.latest-blog-panel {
  background: linear-gradient(140deg, #fbfffe 0%, #f2fbff 100%);
}

.latest-blog-card {
  border: 1px solid #bfe0f4;
  border-radius: 0.7rem;
  background: #ffffff;
  padding: 0.9rem 1rem;
}

.latest-blog-card h3 {
  margin: 0.2rem 0 0.4rem;
}

.latest-blog-card h3 a {
  color: #084f67;
  text-decoration: none;
}

.latest-blog-card h3 a:hover {
  text-decoration: underline;
}

.learning-support {
  margin-top: 2rem;
  display: grid;
  gap: 1rem;
}

.support-card {
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 1rem;
  background: #f7faff;
}

.support-feedback {
  background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
  padding: 1.25rem;
}

.support-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}

.support-note {
  margin: 0 0 0.8rem;
  color: var(--ink-soft);
}

.feedback-button {
  display: inline-block;
  text-decoration: none;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  border-radius: 0.4rem;
  padding: 0.52rem 0.84rem;
  font-weight: 600;
}

.feedback-button:hover {
  background: #173f73;
}

@media (max-width: 960px) {
  .support-feedback {
    padding: 1rem;
  }
}

.search-hit {
  background: #fff5b8;
  transition: background-color 0.2s ease-in-out;
}

.search-hit-current {
  background: #ffe177;
}

@media (max-width: 960px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .toc-pane {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    max-height: 32vh;
  }

  .page-title {
    display: none;
  }

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

  .author-photo {
    width: 180px;
    height: 180px;
  }

  .author-photo-wrap {
    float: none;
    display: block;
    margin: 0 auto 0.8rem;
  }

}
