/* Financial Guide Styling */

* {
    box-sizing: border-box;
}

body {
    font-family: Charter, Georgia, 'Times New Roman', serif;
    font-size: 12pt;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    color: #333;
    background: #f5f5f5;
}

/* Site Header */
.site-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 2rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.site-branding {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.site-branding h1 {
    margin: 0 0 0.5rem 0;
    font-size: 2.5em;
}

.site-branding h1 a {
    color: #fff;
    text-decoration: none;
    display: inline-block;
}

.site-branding h1 a:hover {
    color: #ffd700;
}

.tagline {
    color: #ffd700;
    font-size: 1.2em;
    margin: 0;
    font-style: italic;
}

/* Hero Section */
.site-hero {
  text-align: center;
  padding: 2rem 1rem;
}

.site-hero h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.tagline-primary {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.tagline-secondary {
  font-style: italic;
  color: #f3c94c;
}

/* Navigation */
.site-nav {
    max-width: 900px;
    margin: 1.5rem auto 0;
    padding: 0 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 1rem;
}

.site-nav a {
    color: #fff;
    text-decoration: none;
    margin: 0 1rem;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background 0.3s;
    display: inline-block;
}

.site-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
}

.site-nav a.active {
    background: #ffd700;
    color: #1a1a2e;
    font-weight: bold;
}

/* Main Content */
.content {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 2rem;
    background: #fff;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    border-radius: 8px;
}

/* Site Footer */
.site-footer {
    background: #1a1a2e;
    color: #ccc;
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
}

.site-footer p {
    margin: 0.5rem 0;
}

.site-footer em {
    color: #ffd700;
}

/* Chapter Navigation */
.chapter-nav {
    text-align: center;
    padding: 15px;
    margin: 20px 0;
    border-top: 2px solid #ddd;
    border-bottom: 2px solid #ddd;
    background: #f9f9f9;
}

.chapter-nav a {
    margin: 0 10px;
    font-weight: bold;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    line-height: 1.2;
}

h1 { font-size: 2em; }
h2 { font-size: 1.5em; }
h3 { font-size: 1.2em; }

p {
    margin: 0 0 1em 0;
    text-indent: 0;
}

/* Table of Contents */
#TOC {
    border: 1px solid #ddd;
    padding: 20px;
    margin: 2em 0;
    background: #f9f9f9;
}

#TOC a {
    text-decoration: none;
    color: #0066cc;
}

#TOC a:hover {
    text-decoration: underline;
}

/* Links */
a {
    color: #0066cc;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Lists */
ul, ol {
    margin: 1em 0;
    padding-left: 2em;
}

/* Tables */
.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95em;
}

.content th,
.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0;
    font-size: 0.92em;
}
.content th,
.content td {
    border: 1px solid #e6e6e6;
    padding: 6px 8px;
    vertical-align: top;
    text-align: left;
}
}

.content tbody tr:nth-child(odd) {
    background: #fafafa;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1rem 0;
}

.table-responsive table {
    min-width: 700px; /* reduce min-width to avoid horizontal scroll where possible */
    table-layout: fixed;
}

/* Compact tables for small reference lists (centered, not full-width) */
.table-compact {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}
.table-compact table {
    /* Use fixed layout so colgroup widths are respected */
    min-width: 0;
    width: 100%;
    table-layout: fixed;
}

/* Tighter, wrapped layout for compact reference tables */
.table-compact th,
.table-compact td {
    padding: 4px 6px;
    white-space: normal;
    word-break: break-word;
    vertical-align: middle;
    font-size: 0.95em;
}
/* Keep compact table alignment natural (left) for readability */

/* Make first column shrink to content and avoid wrapping so it doesn't become too wide */
/* (reverted) Previous first-column nowrap caused layout regressions; default behavior restored */

/* Portfolio-specific tweaks */
.table-portfolio table {
    font-size: 0.9em;
    table-layout: auto; /* Override fixed layout to allow allocation columns to size properly */
}
.table-portfolio th,
.table-portfolio td {
    padding: 6px 8px;
}
/* Give allocation columns (columns 3-7) minimum width for ETF tickers */
.table-portfolio th:nth-child(n+3):nth-child(-n+7),
.table-portfolio td:nth-child(n+3):nth-child(-n+7) {
    min-width: 55px;
    white-space: nowrap;
}
/* Right-align numeric columns (third column onward) for portfolio tables */
.table-portfolio th:nth-child(n+3),
.table-portfolio td:nth-child(n+3) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Code and pre */
code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
}

pre {
    background: #f4f4f4;
    padding: 10px;
    overflow-x: auto;
    border-radius: 5px;
}

/* Blockquotes */
blockquote {
    border-left: 4px solid #ddd;
    margin: 1em 0;
    padding-left: 1em;
    color: #666;
}

/* Horizontal rules */
hr {
    border: none;
    border-top: 2px solid #e0e0e0;
    margin: 2em 0;
}

/* Call to Action Section */
.cta-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 5px solid #ffd700;
    padding: 2rem;
    margin: 2rem 0;
    border-radius: 8px;
    text-align: center;
}

.cta-section h3 {
    color: #1a1a2e;
    margin-top: 0;
}

.cta-section a {
    display: inline-block;
    background: #1a1a2e;
    color: #fff;
    padding: 1rem 2rem;
    margin: 0.5rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
}

.cta-section a:hover {
    background: #ffd700;
    color: #1a1a2e;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* --- Chapter Summary Callout --- */
.chapter-summary {
  background: #f8fafc;
  border-left: 6px solid #2d6cdf;
  border-radius: 8px;
  padding: 1.1em 1.5em 1.1em 1.2em;
  margin-bottom: 2em;
  box-shadow: 0 2px 8px rgba(44,108,223,0.04);
  max-width: 700px;
}
.chapter-summary-title {
  font-size: 1.15em;
  font-weight: bold;
  color: #2d6cdf;
  margin-bottom: 0.2em;
}
.chapter-summary-label {
  font-size: 1em;
  font-weight: 600;
  color: #444;
  margin-bottom: 0.3em;
}
.chapter-summary-body {
  font-size: 1em;
  color: #222;
}
@media (max-width: 600px) {
  .chapter-summary {
    padding: 0.9em 0.7em 0.9em 0.7em;
    max-width: 100%;
  }
  .chapter-summary-title {
    font-size: 1em;
  }
  .chapter-summary-body {
    font-size: 0.98em;
  }
}

/* --- Narrow Table (Penny Table) --- */
.narrow-table {
  max-width: 340px;
  margin: 0 auto 1.5em auto;
}
.narrow-table table {
  width: 100%;
}
.narrow-table th {
  background: #f2f2f2;
}

/* --- Compounding Chart (HTML/JS and Chart.js) --- */
.compounding-chart-section { margin: 32px 0; }
.chart-wrapper { display: flex; gap: 10px; position: relative; }
.y-axis {
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
  height: 300px;
  padding-right: 10px;
  font-size: 12px;
  color: #333;
}
.bar-container {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 300px;
  border-left: 2px solid #333;
  border-bottom: 2px solid #333;
  padding: 10px;
  flex-grow: 1;
  position: relative;
  background: #fafbfc;
}
.bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 30px;
  height: 100%;
  justify-content: flex-end;
}
.bar {
  width: 100%;
  background-color: steelblue;
  min-height: 2px;
  align-self: stretch;
  margin-top: auto;
  transition: height 0.3s;
}
.double {
  background-color: orange !important;
}
.x-labels {
  display: flex;
  gap: 6px;
  justify-content: flex-start;
  padding-left: 72px; /* y-axis width + bar-container padding */
  margin-top: 2px;
  font-size: 12px;
  color: #333;
  height: 20px;
}
.x-labels .bar-year {
  width: 30px;
  text-align: center;
}
.controls {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 350px;
  width: 100%;
  box-sizing: border-box;
}
.input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}
.input-row label {
  min-width: 120px;
  text-align: right;
  margin-right: 8px;
}
.input-row input {
  flex: 1;
  padding: 4px 8px;
  font-size: 1em;
}
button {
  align-self: flex-start;
  padding: 6px 18px;
  font-size: 1em;
  border-radius: 6px;
  border: none;
  background: #2d6cdf;
  color: #fff;
  cursor: pointer;
}
.chartjs-container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  overflow-x: auto;
  background: #fafbfc;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  height: 320px;
  min-width: 0;
}
.chartjs-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
@media (max-width: 500px) {
  .compounding-chart-section {
    padding-left: 0 !important;
    margin-left: 0 !important;
  }
  .controls {
    max-width: 100%;
    width: 100%;
    padding: 0;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
  }
  .input-row {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }
  .input-row label {
    min-width: 0;
    text-align: left;
    margin-right: 0;
    margin-bottom: 2px;
    font-size: 1em;
  }
  .input-row input {
    width: 100%;
    font-size: 1em;
  }
  .chartjs-container {
    height: 220px;
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
    .site-branding h1 {
        font-size: 1.8em;
    }
    
    .tagline {
        font-size: 1em;
    }
    
    .content {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .site-nav a {
        display: block;
        margin: 0.5rem 0;
    }
    
    .cta-section a {
        display: block;
        margin: 0.5rem 0;
    }
}

/* Sidebar / Callout */
.sidebar {
    background: #fffaf0;
    border-left: 5px solid #ffd700;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Principle Box */
.principle-box {
    background: #fff8e1; /* soft amber */
    border-left: 4px solid #ffd700;
    padding: 12px 16px;
    margin: 1rem 0 1.5rem;
}
.principle-box p {
    margin: 0;
    font-weight: bold;
}

/* You Are Here mini-map */
.mini-map {
    background: #f9f9fb;
    border: 1px dashed #ddd;
    padding: 10px 14px;
    margin: 1rem 0 1.5rem;
    font-size: 0.95em;
}
.mini-map strong { font-weight: 700; }

.sidebar h3 {
    margin-top: 0;
    color: #1a1a2e;
}

.sidebar p:last-child {
    margin-bottom: 0;
}

/* Principle Callout */
.principle {
    background: #f0f7ff;
    border-left: 5px solid #0066cc;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.principle h2 {
    margin-top: 0;
    color: #1a1a2e;
}

.principle p:last-child {
    margin-bottom: 0;
}

/* Mission and Vision Boxes */
.mission-box {
  background: #eaf6f6;
  border-left: 6px solid #2d6cdf;
  border-radius: 8px;
  padding: 1.1em 1.5em 1.1em 1.2em;
  margin-bottom: 1.5em;
  box-shadow: 0 2px 8px rgba(44,108,223,0.04);
  max-width: 700px;
}
.vision-box {
  background: #e6fae6; /* light green */
  border-left: 6px solid #4caf50;
  border-radius: 8px;
  padding: 1.1em 1.5em 1.1em 1.2em;
  margin-bottom: 1.5em;
  box-shadow: 0 2px 8px rgba(76,175,80,0.04);
  max-width: 700px;
}
.mission-box strong,
.vision-box strong {
  font-size: 1.1em;
  color: #1a1a2e;
}

/* Print styles */
@media print {
    body {
        max-width: 100%;
        font-size: 11pt;
    }
    
    a {
        color: #000;
        text-decoration: none;
    }
    
    #TOC {
        page-break-after: always;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
}
