:root {
  --ink: #17324d;
  --ink-soft: #2a4663;
  --teal: #0f6b6d;
  --teal-soft: #e8f4f3;
  --navy-soft: #eaf2f7;
  --sand: #fbf3e3;
  --paper: #f8fafb;
  --white: #ffffff;
  --line: #d5dee6;
  --prompt: #e8f4f3;
  --question: #eaf2f7;
  --impact: #fbf3e3;
  --principle: #0f6b6d;
  --sidebar: #17324d;
  --radius: 10px;
  --font: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Source Sans 3", "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
}

.app {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  color: #e8eef5;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 1.1rem 0.9rem 2rem;
}

.sidebar-top { margin-bottom: 1rem; }
.brand { color: inherit; text-decoration: none; display: block; margin-bottom: 0.85rem; }
.brand-kicker {
  display: block;
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}
.brand-title {
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 0.25rem;
  line-height: 1.25;
}

.lang-switch { display: flex; gap: 0.35rem; }
.lang-btn {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  color: #d7e2ee;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}
.lang-btn.active, .lang-btn:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}
.mobile-bar .lang-btn { color: var(--ink); border-color: var(--line); }
.mobile-bar .lang-btn.active { color: white; }

.toc-home, .toc-link {
  display: block;
  color: #d7e2ee;
  text-decoration: none;
  font-family: var(--sans);
  font-size: 0.82rem;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
}
.toc-home { font-weight: 700; margin-bottom: 0.6rem; }
.toc-home.active, .toc-link.active, .toc-link:hover, .toc-home:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}
.toc-part { margin: 0.85rem 0 0.4rem; }
.toc-part-title {
  font-family: var(--sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.75;
  padding: 0 0.45rem 0.35rem;
}
.toc-part-title span {
  display: block;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.8rem;
  opacity: 1;
  margin-top: 0.15rem;
  color: #f2f6fa;
}
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc-num {
  display: inline-block;
  min-width: 1.5rem;
  opacity: 0.65;
  margin-right: 0.25rem;
}

.main-wrap { display: flex; flex-direction: column; min-width: 0; }
.content {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 2rem 1.4rem 3rem;
}
.mobile-bar { display: none; }

.eyebrow {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 0.4rem;
}
h1 {
  font-size: clamp(1.6rem, 2.4vw, 2.15rem);
  line-height: 1.2;
  margin: 0 0 1rem;
  color: var(--ink);
}
.lead { font-size: 1.1rem; color: var(--ink-soft); margin-top: 0; }
.part-title { margin-bottom: 0.35rem; }
.part-tagline { font-style: italic; color: var(--ink-soft); margin-top: 0; }
.transition {
  background: var(--impact);
  border: 1px solid #ead9b8;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
}
.baseline-note {
  margin: 1rem 0 0.75rem;
  color: var(--ink);
}

.box {
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 1rem 0;
  border: 1px solid transparent;
}
.box-label {
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin: 0 0 0.55rem;
  color: var(--teal);
}
.box-body { font-size: 1.02rem; }
.box-body p { margin: 0 0 0.7rem; }
.box-body p:last-child { margin-bottom: 0; }

.box-question { background: var(--question); border-color: #d5e3ef; }
.box-description { background: var(--white); border-color: var(--line); }
.box-prompt { background: var(--prompt); border-color: #cfe4e2; }
.box-impact { background: var(--impact); border-color: #ead9b8; }
.box-note { background: #f4f6f8; border-color: #d5dee6; }
.answer-reveal { margin-top: 0.85rem; font-size: 0.95rem; color: var(--ink-soft); }
.prompt-pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.5;
}

.box-baseline { background: var(--prompt); border-color: #cfe4e2; }
.box-principle {
  background: var(--principle);
  color: white;
  border: none;
  box-shadow: 0 8px 24px rgba(15, 107, 109, 0.18);
}
.box-principle .box-body { font-size: 1.05rem; font-weight: 500; }

.box-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}
.box-toolbar .box-label { margin: 0; }
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid #9fc4c2;
  background: white;
  color: var(--teal);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.75rem;
}
.copy-btn:hover { background: var(--teal); color: white; border-color: var(--teal); }
.copy-btn.copied { background: var(--ink); border-color: var(--ink); color: white; }

.section-rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.8rem 0;
}

.home-block { margin: 2rem 0; }
.home-block h2 {
  font-size: 1.25rem;
  color: var(--ink);
  margin-bottom: 0.75rem;
}
.outcomes, .how-steps { padding-left: 1.2rem; }
.outcomes li, .how-steps li { margin-bottom: 0.45rem; }

.arch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}
.arch-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-decoration: none;
  color: inherit;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem;
  min-height: 100%;
}
.arch-card:hover { border-color: var(--teal); box-shadow: 0 6px 18px rgba(23,50,77,0.08); }
.arch-roman {
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--teal);
  font-weight: 700;
}
.arch-q { font-size: 0.9rem; color: var(--ink-soft); }
.arch-focus, .arch-units { font-family: var(--sans); font-size: 0.78rem; color: #607589; }

.tech-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.tech-table th, .tech-table td {
  border-top: 1px solid var(--line);
  padding: 0.55rem 0.4rem;
  text-align: left;
  vertical-align: top;
}
.tech-table th {
  width: 32%;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--teal);
}

.extras {
  background: white;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-top: 1rem;
}
.extras ul { margin: 0; padding-left: 1.1rem; }
.extras li { margin: 0.2rem 0; font-size: 0.92rem; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.pager-link {
  font-family: var(--sans);
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
}
.pager-link:hover { text-decoration: underline; }

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1.5rem 1rem 2rem;
  border-top: 1px solid var(--line);
  margin-top: auto;
}
.cc-badge img { display: block; opacity: 0.85; }
.cc-badge:hover img { opacity: 1; }
.credit {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.65rem;
  letter-spacing: 0.02em;
  color: #6a7c8d;
}

@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--line);
    background: white;
    position: sticky;
    top: 0;
    z-index: 20;
  }
  .menu-toggle {
    font-family: var(--sans);
    border: 1px solid var(--line);
    background: var(--paper);
    border-radius: 8px;
    padding: 0.4rem 0.7rem;
    color: var(--ink);
  }
  .mobile-toc {
    background: var(--sidebar);
    color: #e8eef5;
    padding: 0.75rem;
    max-height: 60vh;
    overflow: auto;
  }
  .mobile-toc[hidden] { display: none !important; }
}
