/* ==========================================================================
   Mastering APIs With Python - Chapter Styles v3
   Clean, modern styling for all 30 chapters
   ========================================================================== */

/* ============================================
   BODY OVERRIDE - CRITICAL!
   ============================================ */
body {
    background: #ffffff !important;
    line-height: 1.6;
}
html {
    scroll-behavior: smooth;
}
/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    /* Code syntax highlighting */
    --code-bg: #272a2c;
    --code-fg: #E0E0E0;
    --comment: #7FB366;
    --keyword: #C586C0;
    --string: #CE9178;
    --number: #B5CEA8;
    --builtin: #5EA4E0;
    --function: #DCDCAA;
    --operator: #D4D4D4;
    --variable: #9CDCFE;
    --boolean: #569CD6;
    --punctuation: #D4D4D4;
    
    /* Color scheme */
    --code-heading-color: #40ad61;
    --text-primary: #444;
    --text-secondary: #4a5568;
    --text-muted: #666;
    --accent: #4F46E5;
    --success-green: #28a745;
    
    /* Neutral colors */
    --border-light: #e5e7eb;
    --bg-light: #f8f9fa;
}

/* ============================================
   CONTAINER - WHITE BACKGROUND WRAPPER
   ============================================ */
.chapter-container {
    max-width: 66ch;
    margin: 0 auto;
    padding: 2rem 1.25rem;
    background: #ffffff;
}

/* ============================================
   CHAPTER HEADER
   ============================================ */
.chapter-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: #4F46E5;
    color: white;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.chapter-header h1 {
    margin: 0;
    font-size: 2.6em;
    font-weight: 400;
    font-family: 'Open Sans', sans-serif;
}

.chapter-header p {
    margin: 10px 0 0 0;
    font-size: 1.2em;
    opacity: 0.9;
    color: white;
}

.chapter-header h4 {
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    font-weight: 300;
    font-size: 1.1em;
    font-family: 'Open Sans', sans-serif;
    color: white;
}

/* ============================================
   SECTIONS
   ============================================ */
.section {
    background: transparent;
    margin-bottom: 25px;
    margin-top: 25px;
    padding: 0;
}

.section-header {
    background: #4F46E5;
    color: white;
    padding: 30px 25px 20px 40px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0px;
    border-radius: 5px 5px 0 0;
}

.section-header h2 {
    margin: 0;
    font-weight: 400;
    font-size: 1.7em;
    font-family: 'Open Sans', sans-serif;
}

.section-content {
    padding: 0;
    margin: 0px 0 60px 0;
}

/* ============================================
   SUBSECTIONS
   ============================================ */
.subsection {
    background: transparent;
    margin: 2rem 0 2rem 0;
    max-width: 86ch;
}

.subsection-header {
    padding: 22px 25px 14px 25px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 20px;
    position: relative;
}

.subsection-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 25px;
    width: 60px;
    height: 2px;
    background: var(--accent);
}

.subsection-header h3 {
    margin: 0;
    color: #111827;
    font-size: 1.4em;
    font-weight: 600;
    line-height: 1.3;
    font-family: 'Open Sans', sans-serif;
}

.subsection-header .subsection-subtitle {
    margin: 8px 0 2px 0;
    color: #6b7280;
    font-size: 1.0em;
    font-weight: 400;
    line-height: 1.5;
}

.subsection-content {
    padding: 0px 25px 0px 30px;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

   /* H4 headings - used for checklists and subsection organization */
h4 {
    color: #111827;  
    font-weight: 600;
    font-size: 1.1em;
    margin: 1.75rem 0 0.75rem 0;
    font-family: 'Open Sans', sans-serif;
    line-height: 1.3;
}



p {
    margin: 0 0 1em 0;
    font-family: 'Open Sans', sans-serif;
    color: var(--text-primary);
    font-size: 1.0rem;
}

strong {
    font-weight: 600;
}

.body-strong-heading {
    font-weight: 600;
    color: #111827;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.heading-inline {
    font-weight: 600;
    color: #374151;  /* Softer gray with slight warmth */
    margin-bottom: 1.5rem;
}

code.code-heading {
    color: var(--code-heading-color);
    padding: 0.15em 0.15em;
    border-radius: 3px;
    font-family: 'Roboto Mono', monospace;
    font-size: 1.0em;
    font-weight: normal;
}

/* ============================================
   LISTS
   ============================================ */
.chapter-container ul,
.section-content ul,
.subsection-content ul,
.explanation-box ul,
.description-box ul,
.tip-box ul,
.warning-box ul,
.milestone-box ul {
    margin: 14px 0;
    padding-left: 30px;
    list-style-type: none;
}

/* Reduce bottom margin for ul/ol inside boxes (except recommendation-box and key-takeaway-box) */
.explanation-box ul,
.description-box ul,
.tip-box ul,
.warning-box ul,
.milestone-box ul,
.explanation-box ol,
.description-box ol,
.tip-box ol,
.warning-box ol,
.milestone-box ol {
    margin-bottom: 0.5rem;
}

.chapter-container li,
.section-content li,
.subsection-content li,
.explanation-box li,
.description-box li,
.tip-box li,
.warning-box li,
.milestone-box li {
    margin: 5px 0;
    color: var(--text-primary);
    position: relative;
    padding-left: 0.5rem;
}

.chapter-container li::before,
.section-content li::before,
.subsection-content li::before,
.explanation-box li::before,
.description-box li::before,
.tip-box li::before,
.warning-box li::before,
.milestone-box li::before {
    content: "→";
    position: absolute;
    left: -1.25rem;
    color: var(--accent);
    font-weight: 600;
}

ul.spaced-list {
    margin: 1em 0;
    padding-left: 1.5em;
}

ul.spaced-list li {
    margin-bottom: 0.75em;
    font-family: 'Open Sans', sans-serif;
}

ul.spaced-list-last li:last-child {
    margin-bottom: 0;
}

ul.spaced-list-last,
ol.spaced-list-last {
    margin-bottom: 3.5em;
}

/* Add specific spacing when spaced-list is followed by paragraphs */
ul.spaced-list + p,
ul.spaced-list + p.body-strong-heading,
ol.spaced-list + p,
ol.spaced-list + p.body-strong-heading {
    margin-top: 2rem;
}


/* Ordered lists - use numbers instead of arrows */
.explanation-box ol,
.description-box ol,
.tip-box ol,
.warning-box ol,
.milestone-box ol,
.subsection-content ol {
    margin: 14px 0;
    padding-left: 30px;
    list-style-position: outside;
}

.explanation-box ol li,
.description-box ol li,
.tip-box ol li,
.warning-box ol li,
.milestone-box ol li,
.subsection-content ol li {
    margin: 5px 0;
    color: var(--text-primary);
    position: relative;
    padding-left: 0.5rem;
}

.explanation-box ol li::before,
.description-box ol li::before,
.tip-box ol li::before,
.warning-box ol li::before,
.milestone-box ol li::before,
.subsection-content ol li::before {
    content: none; /* Remove the arrow for ordered lists */
}

/* For numbered lists, use standard decimal or pass through style */
ol.spaced-list {
    list-style-type: decimal;
}

.explanation-box ol,
.tip-box ol {
    font-family: 'Open Sans', sans-serif;
}

/* Code blocks inside explanation boxes and tip boxes */
.explanation-box pre,
.tip-box pre {
    margin: 1rem 0;
}

.explanation-box pre code,
.tip-box pre code {
    display: block;
    background: var(--code-bg);
    color: var(--code-fg);
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    overflow-x: auto;
    font-family: 'Courier New', Consolas, Monaco, monospace;
    font-size: 0.95em;
    line-height: 1.7;
}

/* Section headings inside explanation boxes and tip boxes */
.explanation-box .section-heading,
.description-box .section-heading,
.tip-box .section-heading {
    font-weight: 600;
    margin: 1.15rem 0 0.4rem 0;  /* More space above (1.5rem), less below (0.5rem) */
}

.explanation-box .section-heading:first-child,
.description-box .section-heading:first-child,
.tip-box .section-heading:first-child {
    margin-top: 0;  /* No extra space if it's the first element */
}

/* List item headings and descriptions */
.list-item-heading {
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.list-item-description {
    font-weight: normal;
}

/* When the list is the last child in a box, remove bottom margin completely */
.explanation-box ul.spaced-list-last:last-child,
.explanation-box ol.spaced-list-last:last-child,
.tip-box ul.spaced-list-last:last-child,
.tip-box ol.spaced-list-last:last-child,
.description-box ul.spaced-list-last:last-child,
.description-box ol.spaced-list-last:last-child,
.key-takeaway-box ul.spaced-list-last:last-child,
.key-takeaway-box ol.spaced-list-last:last-child {
    margin-bottom: 1.5;
}

/* Override the 3.5em default for lists inside boxes */
.explanation-box ul.spaced-list-last,
.explanation-box ol.spaced-list-last,
.tip-box ul.spaced-list-last,
.tip-box ol.spaced-list-last,
.description-box ul.spaced-list-last,
.description-box ol.spaced-list-last,
.key-takeaway-box ul.spaced-list-last,
.key-takeaway-box ol.spaced-list-last {
    margin-bottom: 1.5em;
}


/* ============================================
   PROGRAM TITLES
   ============================================ */
.program-title {
    font-weight: 600;
    color: #1f2937;
    margin: 2.75rem 0 0.5rem 0;
    font-size: 1.05em;
    font-family: 'Open Sans', sans-serif;
}

p + .program-title {
    margin-top: 2.75rem;
}

/* ============================================
   CODE BLOCKS
   ============================================ */
.code-block-wrapper {
    position: relative;
    margin: 2rem -4ch;
}

.code-block-wrapper pre {
    background: var(--code-bg);
    color: var(--code-fg);
    padding: 1.65rem 1.5625rem 2.1875rem 1.875rem;
    border-radius: 0 0 8px 8px;
    line-height: 1.75;
    white-space: pre;
    overflow-x: auto;
    margin: 0;
    font-family: 'Courier New', Consolas, Monaco, monospace;
    font-size: 0.95em;
}

.code-block-wrapper pre::-webkit-scrollbar {
    height: 12px;
}

.code-block-wrapper pre::-webkit-scrollbar-track {
    background: #1a1d1f;
    border-radius: 0 0 6px 0;
}

.code-block-wrapper pre::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 6px;
    border: 2px solid #1a1d1f;
}

.code-block-wrapper pre::-webkit-scrollbar-thumb:hover {
    background: #a47dcf;
}

.code-block-wrapper pre {
    scrollbar-width: thin;
    scrollbar-color: #4a5568 #1a1d1f;
}

.code-block-wrapper pre code {
    font-family: 'Courier New', Consolas, Monaco, monospace;
    font-size: 1em;
    line-height: inherit;
    color: inherit;
    background: none;
}

.code-block-wrapper pre.soft-wrap,
.code-block-wrapper pre.soft-wrap code {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Code header bar */
.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .9rem 2rem 0.6rem 2rem;
    background-color: #303336;
    border-radius: 8px 8px 0 0;
    font-family: 'Open Sans', sans-serif;
}

.code-label {
    font-family: 'Open Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: normal;
    color: #a0a0a0;
    letter-spacing: 0.5px;
    margin: 0;
}

/* Copy button */
.copy-button {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.625rem;
    background-color: #303336;
    border: 0px solid #303336;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #a0a0a0;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.copy-button:hover {
    background-color: #c6cace;
    border-color: #c6cace;
}

.copy-button:active {
    background-color: #e9ecef;
}

.copy-button.copied {
    background-color: #dafbe1;
    border-color: #2da44e;
    color: #1a7f37;
}

.copy-icon {
    width: 14px;
    height: 14px;
    color: currentColor;
    flex-shrink: 0;
    transition: color 0.3s ease;
}

.copy-button.copied .copy-icon {
    color: #1a7f37;
}

.copy-text {
    font-family: 'Open Sans', sans-serif;
    display: inline-block;
    transition: color 0.2s ease;
}

/* Wrap toggle button */
.wrap-toggle-button {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.625rem;
    background-color: #303336;
    border: 0px solid #303336;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #a0a0a0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wrap-toggle-button:hover {
    background-color: #c6cace;
    border-color: #c6cace;
}

.wrap-toggle-button.active {
    background-color: #4a5568;
    color: #e2e8f0;
}

.wrap-icon {
    font-size: 0.875rem;
}

.wrap-text {
    font-weight: 500;
}

/* Syntax highlighting colors */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: var(--comment);
}

.token.keyword {
    color: var(--keyword);
}

.token.string {
    color: var(--string);
}

.token.number {
    color: var(--number);
}

.token.builtin,
.token.class-name {
    color: var(--builtin);
}

.token.function {
    color: var(--function);
}

.token.operator {
    color: var(--operator);
}

.token.variable {
    color: var(--variable);
}

.token.boolean {
    color: var(--boolean);
}

.token.punctuation {
    color: var(--punctuation);
}


/* HTTP Header Block */
.http-header-block {
    background: var(--code-bg);
    color: var(--code-fg);
    /* This matches line 282 of your CSS exactly */
    font-family: 'Courier New', Consolas, Monaco, monospace;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--accent);
    border-radius: 0 4px 4px 0;
    margin: 1.5rem 0;
    font-size: 0.95em; /* Matches line 283 */
    line-height: 1.75; /* Matches line 279 */
    overflow-x: auto;
}

/* ============================================
   NEW BUTTON-STYLE NAVIGATION
   ============================================ */
.chapter-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

.nav-button {
    display: inline-flex;
    align-items: center;
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none !important; /* Force no underline */
    transition: all 0.2s ease;
    font-family: 'Open Sans', sans-serif;
}

/* Green "Next" Button - W3Schools Style */
.nav-button.next {
    background-color: var(--success-green);
    color: white !important;
}

.nav-button.next:hover {
    background-color: #218838;
    transform: translateX(3px); /* Subtle nudge right */
}

/* Gray/Indigo "Previous" Button */
.nav-button.prev {
    background-color: #edf2f7;
    color: var(--text-secondary) !important;
    border: 1px solid #e2e8f0;
}

.nav-button.prev:hover {
    background-color: #e2e8f0;
    transform: translateX(-3px); /* Subtle nudge left */
}

/* Center link for "Go to Top" */
.nav-top-link {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
}

.nav-top-link:hover {
    color: var(--accent);
}

@media (max-width: 600px) {
    .chapter-navigation {
        flex-direction: column;
        gap: 1.5rem;
    }
    .nav-button {
        width: 100%;
        justify-content: center;
    }
}


/* ============================================
   CALLOUT BOXES
   ============================================ */
.explanation-box {
    background: #F9F9FC;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #4793df;
    padding: 1.5rem 1.5rem 2.5rem 1.5rem;
    margin: 2rem 0;
    border-radius: 8px;
}

.description-box {
    background: #f8f4e8;
    border: 1px solid #ebeae5;
    border-left: 4px solid #f59e0b;
    padding: 1.5rem 1.5rem 2.5rem 1.5rem;
    margin: 2rem 0;
    border-radius: 8px;
}


.tip-box {
    /* Light slate background */
    background: #f8fafc; 
    /* Slate gray border */
    border-left: 4px solid #64748b; 
    padding: 1.5rem 1.25rem 2.5rem 1.25rem;
    margin: 3rem 0 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.375rem rgba(0, 0, 0, 0.05);
}

.tip-box .tip-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 1em;
    /* Dark slate text */
    color: #1e293b; 
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #cbd5e1;
    font-family: 'Open Sans', sans-serif;
}

.tip-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 1em;
    color: #1f2937;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
    font-family: 'Open Sans', sans-serif;
}

.explanation-box p,
.tip-box p {
    margin: 0.5rem 0;
}

.explanation-box p:last-child,
.tip-box p:last-child {
    margin-bottom: 0;
}

/* Milestone Box - Celebrates learning achievements */
.milestone-box {
    background: #eff6ff;
    border: 2px solid #3b82f6;
    border-radius: 8px;
    padding: 1.5rem 1.5rem 2.5rem 1.5rem;
    margin: 1.5rem 0 2.5rem 0;  /* Increased bottom margin */
}

.milestone-box h4 {
    color: #1e40af;  /* Darker blue for heading */
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.15em;
    font-family: 'Open Sans', sans-serif;
}

.milestone-box p {
    margin: 0 0 1em 0;
    font-family: 'Open Sans', sans-serif;
    color: var(--text-primary);
}

.milestone-box p:last-child {
    margin-bottom: 0;
}

/* Warning Box - For security warnings and troubleshooting */
.warning-box {
    background: #e6cfb7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 1.5rem 1.5rem 2.5rem 1.5rem;
    margin: 1.5rem 0 2.5rem 0;
}

.warning-box .tip-heading {
    color: #92400e;
    border-bottom: 1px solid #ddb4a6;
}

.warning-box p {
    margin: 0 0 1em 0;
    font-family: 'Open Sans', sans-serif;
    color: var(--text-primary);
}

.warning-box p:last-child {
    margin-bottom: 0;
}

/* Key Takeaway Box - For important concepts and positive reinforcement */
.recommendation-box {
    background: #cbe9d9;
    border: 1px solid rgb(133, 183, 166);
    border-radius: 8px;
    padding: 1.5rem 1.5rem 2.5rem 1.5rem;
    margin: 1.5rem 0 2.5rem 0;
}

.recommendation-box .tip-heading {
    color: #235e4e;
    border-bottom: 1px solid #c6d6d0;
}

.recommendation-box p {
    margin: 0 0 1em 0;
    font-family: 'Open Sans', sans-serif;
    color: var(--text-primary);
}

.recommendation-box p:last-child {
    margin-bottom: 0;
}

/* Key Takeaway Box - Light green version for summaries and key points */
.key-takeaway-box {
    background: #ecfdf3;
    border: 1px solid #c9f7df;
    border-left: 4px solid #5bbb9f;
    padding: 1.5rem 1.5rem 2.5rem 1.5rem;
    margin: 2rem 0;
    border-radius: 8px;
}

.key-takeaway-box .tip-heading {
    color: #326e5d;
    border-bottom: 1px solid #bae5cf;
}

.key-takeaway-box p {
    margin: 0 0 1em 0;
    font-family: 'Open Sans', sans-serif;
    color: var(--text-primary);
}

.key-takeaway-box p:last-child {
    margin-bottom: 0;
}
/* ============================================
   NUMBERED HEADING BLOCKS
   ============================================ */
.numbered-heading-block{
  display: flex;
  align-items: baseline;   /* key: aligns 1. with heading baseline */
  gap: 0.9rem;             /* slightly tighter than 1.25rem */
  margin: 1.5rem 0;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.numbered-heading-block > .number{
  margin-top: 0;           /* remove the nudge that causes misalignment */
  min-width: 1.6rem;       /* keeps 1., 2. aligned */
  text-align: right;
  font-size: 0.9rem;       /* slightly smaller */
  font-weight: 700;
  line-height: 1;
  color: rgb(98, 98, 234);
  background: none;
  border-radius: 0;
  padding: 0;
}

.numbered-heading-block-last {
    border-bottom: none;
    padding-bottom: 0;
}


.numbered-heading-block .content {
    flex: 1;
}

.numbered-heading-block .content p:first-child{
  margin-top: 0;           /* helps baseline alignment feel crisp */
}


.numbered-heading-block .content p:last-child {
    margin-bottom: 0;
}


/* Add extra top margin when boxes follow numbered heading blocks */
.numbered-heading-block-last + .recommendation-box,
.numbered-heading-block-last + .key-takeaway-box,
.numbered-heading-block-last + .description-box,  /* ← ADDED */
.numbered-heading-block-last + .warning-box,
.numbered-heading-block-last + .explanation-box,
.numbered-heading-block-last + .tip-box,
.numbered-heading-block-last + .milestone-box {
    margin-top: 3rem;  /* Increased from default 1.5rem */
}


/* Add extra spacing when boxes follow spaced-list */
ul.spaced-list + .explanation-box,
ul.spaced-list + .description-box,
ul.spaced-list + .tip-box,
ul.spaced-list + .warning-box,
ul.spaced-list + .key-takeaway-box,
ul.spaced-list + .recommendation-box,
ul.spaced-list + .milestone-box,
ol.spaced-list + .explanation-box,
ol.spaced-list + .description-box,
ol.spaced-list + .tip-box,
ol.spaced-list + .warning-box,
ol.spaced-list + .key-takeaway-box,
ol.spaced-list + .recommendation-box,
ol.spaced-list + .milestone-box {
    margin-top: 3rem;  /* Increased from default 2rem */
}

/* Fix flex overflow for code blocks inside numbered heading blocks */
.numbered-heading-block .content {
    min-width: 0;  /* Allow flex child to shrink */
}

.numbered-heading-block .content .code-block-wrapper {
    max-width: 100%;  /* Constrain to container width */
    overflow: hidden;  /* Prevent overflow */
}

/* ============================================
   TABLES
   ============================================ */

.styled-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5rem 0 2rem 0;
    font-size: 16px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.styled-table caption {
    font-size: 1.1em;
    font-weight: 600;
    text-align: left;
    padding: 1.5rem 0;
    color: #111827;
    caption-side: top;
}

.styled-table thead th {
    background: #6B6FD5;
    color: white;
    font-weight: 600;
    padding: 15px 12px;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 14px;
}

.styled-table tbody tr {
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
}

.styled-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.styled-table tbody tr:last-child {
    border-bottom: none;
}

.styled-table tbody td {
    padding: 14px 12px;
    color: #333;
    line-height: 1.4;
}

.styled-table .code-heading {
    font-size: 1em;
}

.styled-table tbody tr:hover {
    background: #f0f4ff;
    cursor: default;
}

/* Add spacing when explanation/tip/warning boxes follow tables */
.styled-table + .explanation-box,
.styled-table + .tip-box,
.styled-table + .warning-box,
.styled-table + .recommendation-box,
.styled-table + .key-takeaway-box,
.styled-table + .milestone-box {
    margin-top: 2.75rem;
}

/* ============================================
   TABLE HORIZONTAL SCROLLING
   (for tables with long code/URLs)
   ============================================ */

/* Prevent code elements inside table cells from wrapping */
.styled-table td code.code-heading,
.styled-table th code.code-heading {
    white-space: pre-wrap;
    display: inline;
}

/* Scroll container with proper spacing */
div[style*="overflow-x: auto"] {
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding-bottom: 1rem; /* Bottom padding for scrollbar breathing room */
    margin: 1.5rem 0 2rem 0; /* Match table's original margin */
}

/* Tables inside scroll containers */
div[style*="overflow-x: auto"] .styled-table {
    min-width: 110%;
    margin: 0; /* Container provides spacing */
    box-shadow: none; /* Shadow on container instead */
}


/* ============================================
   CHECKPOINT QUIZ / TROUBLESHOOTING
   ============================================ */
.checkpoint-quiz {
    margin: 2rem 0;
}

.checkpoint-quiz-heading {
    font-weight: 600;
    color: #374151;
    margin-bottom: 1rem;
}

.troubleshooting-details {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 0.5rem;
    margin: 0.75rem 0;
    overflow: hidden;
    transition: all 0.2s ease;
}

.troubleshooting-details:hover {
    box-shadow: 0 0.125rem 0.375rem rgba(0, 0, 0, 0.05);
}

.troubleshooting-details summary {
    padding: 1rem 1.25rem 1rem 3rem;
    cursor: pointer;
    font-weight: 500;
    color: #1f2937;
    list-style: none;
    user-select: none;
    position: relative;
}

/* The arrow takes fixed space, text content should expand */
.troubleshooting-details summary::before {
    content: '▶';
    position: absolute;
    left: 1.25rem;
    color: #6b7280;
    transition: transform 0.2s ease;
}

/* Allow code elements in summary to wrap naturally */
.troubleshooting-details summary code {
    white-space: pre-wrap;
}

.troubleshooting-details summary::-webkit-details-marker {
    display: none;
}

.troubleshooting-details summary::before {
    content: '▶';
    flex-shrink: 0;
    color: #6b7280;
    transition: transform 0.2s ease;
}

.troubleshooting-details[open] summary::before {
    transform: rotate(90deg);
}

.troubleshooting-details summary:hover {
    background: #f9fafb;
}

.troubleshooting-content {
    padding: 0 1.25rem 1.25rem 3rem;
    color: var(--text-secondary);
}

.troubleshooting-content p {
    margin: 0.5rem 0;
}

.troubleshooting-content p:last-child {
    margin-bottom: 0;
}

/* Info Details - Simple collapsible content spacing */
.info-details {
    margin: 0.75rem 0;
}

.info-details summary {
    cursor: pointer;
    user-select: none;
}

.info-details summary:hover {
    background: #f9fafb;
}

.details-content {
    padding-top: 1rem;
}

.details-content p {
    margin: 0.5rem 0;
}

.details-content p:first-child {
    margin-top: 0;
}

.details-content p:last-child {
    margin-bottom: 0;
}

/* ============================================
   HORIZONTAL RULES
   ============================================ */
hr {
    border: none;
    height: 1px;
    background: var(--border-light);
    margin: 2rem 0;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .chapter-container {
        padding: 1rem 0.75rem;
    }
    
    .chapter-header h1 {
        font-size: 2em;
    }
    
    .section-content,
    .subsection-content {
        padding: 0 5px;
    }
    
    .subsection-header {
        padding: 22px 5px 14px 5px;
    }
    
    .subsection-header::after {
        left: 5px;
    }
    
    .code-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .numbered-heading-block {
        gap: 0.5rem;
    }
    
    .numbered-heading-block > .number {
        min-width: 1.2rem;
        font-size: 0.9rem;
    }
    
    .code-block-wrapper {
        margin-left: 0;
        margin-right: 0;
    }
    
    .styled-table {
        width: 100%;
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 0.95rem;
    }
    
    .chapter-header {
        padding: 20px;
    }
    
    .chapter-header h1 {
        font-size: 1.75em;
    }
    
    .code-block-wrapper pre {
        padding: 1rem;
        font-size: 0.875em;
    }
}

/* ============================================
   ACCESSIBILITY & FOCUS STATES
   ============================================ */
:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.5);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    body {
        color: #111;
        background: #fff !important;
    }
    
    .chapter-container {
        background: #fff;
    }
    
    a {
        color: #000;
        text-decoration: none;
    }
    
    .chapter-header,
    .section-header {
        background: #fff !important;
        color: #000 !important;
        border: 2px solid #000;
    }
    
    pre {
        background: #f5f5f5 !important;
        color: #000 !important;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
    
    .styled-table,
    pre,
    .tip-box,
    .explanation-box {
        page-break-inside: avoid;
    }
    
    h2,
    h3 {
        page-break-after: avoid;
    }
    
    .copy-button,
    .wrap-toggle-button {
        display: none;
    }
}

/* ============================================
   MINIMAL ROADMAP STYLES
   ============================================ */
.roadmap-timeline {
    position: relative;
    max-width: 90%;
    margin: 3rem auto 3.5rem auto;
    padding-left: 1rem;
}

/* The vertical connecting line */
.roadmap-timeline::before {
    content: '';
    position: absolute;
    top: 15px;
    bottom: 0;
    left: 24px; /* Centers line with the 48px circle */
    width: 2px;
    background: #e5e7eb; /* Neutral gray line */
    z-index: 0;
}

.roadmap-item {
    position: relative;
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    z-index: 1; /* Sits above the line */
}

.roadmap-item:last-child {
    margin-bottom: 0;
}

/* The Number Circle */
.roadmap-marker {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: white;
    border: 2px solid var(--accent); /* Uses your #4F46E5 */
    color: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    font-family: 'Open Sans', sans-serif;
    box-shadow: 0 0 0 4px #ffffff; /* White ring to break the vertical line cleanly */
}

/* Active/Filled style for visual variety (Optional) 
   If you want the first one filled, add class .active to the marker */
.roadmap-marker.active {
    background: var(--accent);
    color: white;
}

.roadmap-content {
    flex: 1;
    padding-top: 0.2rem; /* Aligns text visually with the circle */
}

.roadmap-title {
    margin: 0 0 0.35rem 0;
    font-size: 1.15rem;
    color: #111827;
    font-weight: 700;
}

.roadmap-meta {
    display: inline-block;
    font-family: 'Open Sans', sans-serif;
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-bottom: 0.6rem;
}

.roadmap-content p {
    margin: 0 0 1rem 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Tags */
.roadmap-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.roadmap-tags span {
    background: #f3f4f6;
    color: #4b5563;
    padding: 0.2rem 0.65rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: 'Open Sans', sans-serif;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

/* Subtle hover interaction */
.roadmap-item:hover .roadmap-marker {
    background: var(--accent);
    color: white;
    transform: scale(1.1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.roadmap-item:hover .roadmap-tags span {
    background: white;
    border-color: #e5e7eb;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .roadmap-timeline::before {
        left: 15px; /* Adjust line position for smaller layout */
    }
    
    .roadmap-timeline {
        padding-left: 0;
        margin-bottom: 4rem; /* Slightly reduced for mobile but still substantial */
    }
    
    .roadmap-item {
        gap: 1rem;
    }
}

