:root {
  /* Ice & Steel Palette */
  --bg-main: #f0f9ff; /* Sky 50 - Very light page background */
  --bg-sidebar: #e0f2fe; /* Sky 100 - Distinct sidebar */
  --text-primary: #334155; /* Slate 700 - High contrast text */
  --text-muted: #64748b; /* Slate 500 - Secondary text */
  --accent: #0284c7; /* Sky 600 - Links and highlights */
  --border: #bae6fd; /* Sky 200 - Subtle borders */
  --card-bg: rgba(255, 255, 255, 0.6); /* Glassy card background */

  --font-heading: "Merriweather", serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.7;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s;
}

/* Layout Container */
.book-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 40px;
  flex-shrink: 0;
  overflow-y: auto;
}

.logo-text {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -1px;
  display: block;
}

.logo-sub {
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  font-weight: 600;
  display: block;
  margin-top: 4px;
}

.highlight {
  color: var(--text-muted);
}

/* Sidebar Navigation */
.book-nav {
  margin-top: 60px;
  flex-grow: 1;
}

.book-nav ul {
  list-style: none;
}

.book-nav li {
  margin-bottom: 20px;
}

.book-nav a {
  display: flex;
  align-items: center;
  gap: 15px;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 8px 0;
  border-right: 3px solid transparent;
}

.book-nav a:hover {
  color: var(--accent);
}

.book-nav a.active {
  color: var(--text-primary);
  border-right-color: var(--accent);
  font-weight: 600;
}

.nav-number {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--border); /* Subtle number */
  width: 20px;
}

.book-nav a.active .nav-number {
  color: var(--accent);
}

/* Sidebar Footer & Lang */
.lang-switcher {
  margin-top: 40px;
  order: -1; /* Move above nav if needed, or keep here */
  margin-bottom: 20px;
}

.current-lang {
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.lang-options {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.lang-options button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  transition: all 0.2s;
}

.lang-options button:hover,
.lang-options button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.sidebar-footer {
  display: flex;
  gap: 20px;
  margin-top: auto;
  padding-top: 30px;
  border-top: 1px solid var(--border);
}

.sidebar-footer a {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.sidebar-footer a:hover {
  color: var(--accent);
}

/* Main Content Area */
.content-area {
  flex-grow: 1;
  padding: 80px 10%;
  max-width: 1000px; /* Optimal reading width */
}

/* Typography & Chapters */
.chapter {
  margin-bottom: 150px;
  scroll-margin-top: 100px; /* Space for sticky header if we had one, or general breathing room */
}

h1 {
  font-family: var(--font-heading);
  font-size: 3rem;
  margin-bottom: 10px;
  color: var(--text-primary);
}

h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  margin-bottom: 40px;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px;
  display: inline-block;
}

.subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 60px;
}

.text-block {
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 40px;
}

.intro-text {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 40px;
}

/* Components: Callout Box */
.callout-box {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  padding: 30px;
  border-radius: 12px;
  display: flex;
  gap: 60px;
  margin: 40px 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat strong {
  font-size: 2rem;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 5px;
}

.stat span {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Components: Service Block */
.service-block {
  margin-bottom: 40px;
  padding-left: 20px;
  border-left: 3px solid var(--border);
  transition: border-color 0.3s;
}

.service-block:hover {
  border-left-color: var(--accent);
}

.service-block h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.service-block p {
  color: var(--text-muted);
}

/* Components: Tech Grid */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.tech-item {
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-align: center;
}

.tech-name {
  display: block;
  color: var(--accent);
  font-family: var(--font-mono);
  margin-bottom: 5px;
}

/* Components: Strategy List */
.strategy-row {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  align-items: flex-start;
}

.strategy-row i {
  background: var(--bg-sidebar);
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--accent);
  flex-shrink: 0;
}

.strategy-row strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 5px;
}

.location-list-simple {
  list-style: none;
  margin-top: 20px;
  columns: 2;
}

.location-list-simple li {
  margin-bottom: 10px;
  padding-left: 20px;
  position: relative;
}

.location-list-simple li::before {
  content: "•";
  color: var(--accent);
  position: absolute;
  left: 0;
}

/* Responsive */
@media (max-width: 900px) {
  .book-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 20px;
  }
  .book-nav {
    display: none;
  } /* Hide sidenav on mobile, rely on scroll */
  .content-area {
    padding: 40px 20px;
  }

  .lang-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* Side-by-Side Layout Adapter */
.chapter-layout {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

.visual-col {
  flex: 1;
  min-width: 0; /* Prevent flex blowouts with images */
}

.text-col {
  flex: 1;
  min-width: 0;
}

.section-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

@media (max-width: 900px) {
  .chapter-layout {
    flex-direction: column;
  }

  .section-image {
    margin-bottom: 30px;
  }
}
